|
2 | 2 | using InscryptionAPI.Boons; |
3 | 3 | using InscryptionAPI.Card; |
4 | 4 | using InscryptionAPI.Items; |
| 5 | +using InscryptionAPI.Slots; |
5 | 6 | using UnityEngine; |
6 | 7 | using static InscryptionAPI.RuleBook.RuleBookManager; |
7 | 8 |
|
@@ -35,6 +36,11 @@ public static AbilityManager.FullAbility SetUniqueRedirect(this AbilityManager.F |
35 | 36 | fullAbility.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.Unique, redirectColour, uniqueRedirect); |
36 | 37 | return fullAbility; |
37 | 38 | } |
| 39 | + public static AbilityManager.FullAbility SetSlotRedirect(this AbilityManager.FullAbility fullAbility, string clickableText, SlotModificationManager.ModificationType slotMod, Color redirectColour) |
| 40 | + { |
| 41 | + fullAbility.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.Items, redirectColour, SlotModificationManager.SLOT_PAGEID + slotMod.ToString()); |
| 42 | + return fullAbility; |
| 43 | + } |
38 | 44 |
|
39 | 45 | public static AbilityInfo SetAbilityRedirect(this AbilityInfo info, string clickableText, Ability abilityRedirect, Color redirectColour) |
40 | 46 | { |
@@ -96,6 +102,18 @@ public static AbilityInfo SetUniqueRedirect(this AbilityInfo info, string clicka |
96 | 102 | InscryptionAPIPlugin.Logger.LogError($"Can't set rulebook redirect for {clickableText} because the AbilityInfo hasn't been added to the API yet."); |
97 | 103 | return info; |
98 | 104 | } |
| 105 | + public static AbilityInfo SetSlotRedirect(this AbilityInfo info, string clickableText, SlotModificationManager.ModificationType slotMod, Color redirectColour) |
| 106 | + { |
| 107 | + AbilityManager.FullAbility full = AbilityManager.BaseGameAbilities.Concat(AbilityManager.NewAbilities).First(x => x.Info.ability == info.ability); |
| 108 | + if (full != null) |
| 109 | + { |
| 110 | + full.SetSlotRedirect(clickableText, slotMod, redirectColour); |
| 111 | + return info; |
| 112 | + } |
| 113 | + |
| 114 | + InscryptionAPIPlugin.Logger.LogError($"Can't set rulebook redirect for {clickableText} because the AbilityInfo hasn't been added to the API yet."); |
| 115 | + return info; |
| 116 | + } |
99 | 117 | #endregion |
100 | 118 |
|
101 | 119 | #region StatIconInfo |
@@ -124,6 +142,11 @@ public static StatIconManager.FullStatIcon SetUniqueRedirect(this StatIconManage |
124 | 142 | fullIcon.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.Unique, redirectColour, uniqueRedirect); |
125 | 143 | return fullIcon; |
126 | 144 | } |
| 145 | + public static StatIconManager.FullStatIcon SetSlotRedirect(this StatIconManager.FullStatIcon fullIcon, string clickableText, SlotModificationManager.ModificationType slotMod, Color redirectColour) |
| 146 | + { |
| 147 | + fullIcon.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.Items, redirectColour, SlotModificationManager.SLOT_PAGEID + slotMod.ToString()); |
| 148 | + return fullIcon; |
| 149 | + } |
127 | 150 |
|
128 | 151 | public static StatIconInfo SetAbilityRedirect(this StatIconInfo info, string clickableText, Ability abilityRedirect, Color redirectColour) |
129 | 152 | { |
@@ -185,6 +208,18 @@ public static StatIconInfo SetUniqueRedirect(this StatIconInfo info, string clic |
185 | 208 | InscryptionAPIPlugin.Logger.LogError($"Can't set rulebook redirect for {clickableText} because the StatIconInfo hasn't been added to the API yet."); |
186 | 209 | return info; |
187 | 210 | } |
| 211 | + public static StatIconInfo SetSlotRedirect(this StatIconInfo info, string clickableText, SlotModificationManager.ModificationType slotMod, Color redirectColour) |
| 212 | + { |
| 213 | + StatIconManager.FullStatIcon full = StatIconManager.AllStatIcons.Find(x => x.Id == info.iconType); |
| 214 | + if (full != null) |
| 215 | + { |
| 216 | + full.SetSlotRedirect(clickableText, slotMod, redirectColour); |
| 217 | + return info; |
| 218 | + } |
| 219 | + |
| 220 | + InscryptionAPIPlugin.Logger.LogError($"Can't set rulebook redirect for {clickableText} because the StatIconInfo hasn't been added to the API yet."); |
| 221 | + return info; |
| 222 | + } |
188 | 223 | #endregion |
189 | 224 |
|
190 | 225 | #region BoonData |
@@ -213,6 +248,11 @@ public static BoonManager.FullBoon SetUniqueRedirect(this BoonManager.FullBoon f |
213 | 248 | fullBoon.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.Unique, redirectColour, uniqueRedirect); |
214 | 249 | return fullBoon; |
215 | 250 | } |
| 251 | + public static BoonManager.FullBoon SetSlotRedirect(this BoonManager.FullBoon fullBoon, string clickableText, SlotModificationManager.ModificationType slotMod, Color redirectColour) |
| 252 | + { |
| 253 | + fullBoon.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.Items, redirectColour, SlotModificationManager.SLOT_PAGEID + slotMod.ToString()); |
| 254 | + return fullBoon; |
| 255 | + } |
216 | 256 |
|
217 | 257 | public static BoonData SetAbilityRedirect(this BoonData info, string clickableText, Ability abilityRedirect, Color redirectColour) |
218 | 258 | { |
@@ -274,6 +314,18 @@ public static BoonData SetUniqueRedirect(this BoonData info, string clickableTex |
274 | 314 | InscryptionAPIPlugin.Logger.LogError($"Can't set rulebook redirect for {clickableText} because the BoonData hasn't been added to the API yet."); |
275 | 315 | return info; |
276 | 316 | } |
| 317 | + public static BoonData SetSlotRedirect(this BoonData info, string clickableText, SlotModificationManager.ModificationType slotMod, Color redirectColour) |
| 318 | + { |
| 319 | + BoonManager.FullBoon full = BoonManager.AllFullBoons.Find(x => x.boon.type == info.type); |
| 320 | + if (full != null) |
| 321 | + { |
| 322 | + full.SetSlotRedirect(clickableText, slotMod, redirectColour); |
| 323 | + return info; |
| 324 | + } |
| 325 | + |
| 326 | + InscryptionAPIPlugin.Logger.LogError($"Can't set rulebook redirect for {clickableText} because the BoonData hasn't been added to the API yet."); |
| 327 | + return info; |
| 328 | + } |
277 | 329 | #endregion |
278 | 330 |
|
279 | 331 | #region ConsumableItemData |
@@ -302,6 +354,11 @@ public static ConsumableItemManager.FullConsumableItemData SetUniqueRedirect(thi |
302 | 354 | fullItem.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.Unique, redirectColour, uniqueRedirect); |
303 | 355 | return fullItem; |
304 | 356 | } |
| 357 | + public static ConsumableItemManager.FullConsumableItemData SetSlotRedirect(this ConsumableItemManager.FullConsumableItemData fullItem, string clickableText, SlotModificationManager.ModificationType slotMod, Color redirectColour) |
| 358 | + { |
| 359 | + fullItem.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.Items, redirectColour, SlotModificationManager.SLOT_PAGEID + slotMod.ToString()); |
| 360 | + return fullItem; |
| 361 | + } |
305 | 362 |
|
306 | 363 | public static ConsumableItemData SetAbilityRedirect(this ConsumableItemData info, string clickableText, Ability abilityRedirect, Color redirectColour) |
307 | 364 | { |
@@ -363,6 +420,124 @@ public static ConsumableItemData SetUniqueRedirect(this ConsumableItemData info, |
363 | 420 | InscryptionAPIPlugin.Logger.LogError($"Can't set rulebook redirect for {clickableText} because the ConsumableItemData hasn't been added to the API yet."); |
364 | 421 | return info; |
365 | 422 | } |
| 423 | + public static ConsumableItemData SetSlotRedirect(this ConsumableItemData info, string clickableText, SlotModificationManager.ModificationType slotMod, Color redirectColour) |
| 424 | + { |
| 425 | + ConsumableItemManager.FullConsumableItemData full = ConsumableItemManager.allFullItemDatas.Find(x => x.itemData == info); |
| 426 | + if (full != null) |
| 427 | + { |
| 428 | + full.SetSlotRedirect(clickableText, slotMod, redirectColour); |
| 429 | + return info; |
| 430 | + } |
| 431 | + |
| 432 | + InscryptionAPIPlugin.Logger.LogError($"Can't set rulebook redirect for {clickableText} because the ConsumableItemData hasn't been added to the API yet."); |
| 433 | + return info; |
| 434 | + } |
| 435 | + #endregion |
| 436 | + |
| 437 | + #region SlotMod |
| 438 | + public static SlotModificationManager.Info SetAbilityRedirect(this SlotModificationManager.Info slotInfo, string clickableText, Ability abilityRedirect, Color redirectColour) |
| 439 | + { |
| 440 | + slotInfo.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.Abilities, redirectColour, abilityRedirect.ToString()); |
| 441 | + return slotInfo; |
| 442 | + } |
| 443 | + public static SlotModificationManager.Info SetStatIconRedirect(this SlotModificationManager.Info slotInfo, string clickableText, SpecialStatIcon statIconRedirect, Color redirectColour) |
| 444 | + { |
| 445 | + slotInfo.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.StatIcons, redirectColour, statIconRedirect.ToString()); |
| 446 | + return slotInfo; |
| 447 | + } |
| 448 | + public static SlotModificationManager.Info SetBoonRedirect(this SlotModificationManager.Info slotInfo, string clickableText, BoonData.Type boonRedirect, Color redirectColour) |
| 449 | + { |
| 450 | + slotInfo.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.Boons, redirectColour, boonRedirect.ToString()); |
| 451 | + return slotInfo; |
| 452 | + } |
| 453 | + public static SlotModificationManager.Info SetItemRedirect(this SlotModificationManager.Info slotInfo, string clickableText, string itemNameRedirect, Color redirectColour) |
| 454 | + { |
| 455 | + slotInfo.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.Items, redirectColour, itemNameRedirect); |
| 456 | + return slotInfo; |
| 457 | + } |
| 458 | + public static SlotModificationManager.Info SetUniqueRedirect(this SlotModificationManager.Info slotInfo, string clickableText, string uniqueRedirect, Color redirectColour) |
| 459 | + { |
| 460 | + slotInfo.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.Unique, redirectColour, uniqueRedirect); |
| 461 | + return slotInfo; |
| 462 | + } |
| 463 | + public static SlotModificationManager.Info SetSlotRedirect(this SlotModificationManager.Info slotInfo, string clickableText, SlotModificationManager.ModificationType slotMod, Color redirectColour) |
| 464 | + { |
| 465 | + slotInfo.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.Items, redirectColour, SlotModificationManager.SLOT_PAGEID + slotMod.ToString()); |
| 466 | + return slotInfo; |
| 467 | + } |
| 468 | + |
| 469 | + public static SlotModificationManager.ModificationType SetAbilityRedirect(this SlotModificationManager.ModificationType info, string clickableText, Ability abilityRedirect, Color redirectColour) |
| 470 | + { |
| 471 | + SlotModificationManager.Info full = SlotModificationManager.AllSlotModifications.InfoByID(info); |
| 472 | + if (full != null) |
| 473 | + { |
| 474 | + full.SetAbilityRedirect(clickableText, abilityRedirect, redirectColour); |
| 475 | + return info; |
| 476 | + } |
| 477 | + |
| 478 | + InscryptionAPIPlugin.Logger.LogError($"Can't set rulebook redirect for {clickableText} because the SlotModificationManager.ModificationType hasn't been added to the API yet."); |
| 479 | + return info; |
| 480 | + } |
| 481 | + public static SlotModificationManager.ModificationType SetStatIconRedirect(this SlotModificationManager.ModificationType info, string clickableText, SpecialStatIcon statIconRedirect, Color redirectColour) |
| 482 | + { |
| 483 | + SlotModificationManager.Info full = SlotModificationManager.AllSlotModifications.InfoByID(info); |
| 484 | + if (full != null) |
| 485 | + { |
| 486 | + full.SetStatIconRedirect(clickableText, statIconRedirect, redirectColour); |
| 487 | + return info; |
| 488 | + } |
| 489 | + |
| 490 | + InscryptionAPIPlugin.Logger.LogError($"Can't set rulebook redirect for {clickableText} because the SlotModificationManager.ModificationType hasn't been added to the API yet."); |
| 491 | + return info; |
| 492 | + } |
| 493 | + public static SlotModificationManager.ModificationType SetBoonRedirect(this SlotModificationManager.ModificationType info, string clickableText, BoonData.Type boonRedirect, Color redirectColour) |
| 494 | + { |
| 495 | + SlotModificationManager.Info full = SlotModificationManager.AllSlotModifications.InfoByID(info); |
| 496 | + if (full != null) |
| 497 | + { |
| 498 | + full.SetBoonRedirect(clickableText, boonRedirect, redirectColour); |
| 499 | + return info; |
| 500 | + } |
| 501 | + |
| 502 | + InscryptionAPIPlugin.Logger.LogError($"Can't set rulebook redirect for {clickableText} because the ConsumableItemData hasn't been added to the API yet."); |
| 503 | + return info; |
| 504 | + } |
| 505 | + public static SlotModificationManager.ModificationType SetItemRedirect(this SlotModificationManager.ModificationType info, string clickableText, string itemNameRedirect, Color redirectColour) |
| 506 | + { |
| 507 | + SlotModificationManager.Info full = SlotModificationManager.AllSlotModifications.InfoByID(info); |
| 508 | + if (full != null) |
| 509 | + { |
| 510 | + full.SetItemRedirect(clickableText, itemNameRedirect, redirectColour); |
| 511 | + return info; |
| 512 | + } |
| 513 | + |
| 514 | + InscryptionAPIPlugin.Logger.LogError($"Can't set rulebook redirect for {clickableText} because the SlotModificationManager.ModificationType hasn't been added to the API yet."); |
| 515 | + return info; |
| 516 | + } |
| 517 | + public static SlotModificationManager.ModificationType SetUniqueRedirect(this SlotModificationManager.ModificationType info, string clickableText, string uniqueRedirect, Color redirectColour) |
| 518 | + { |
| 519 | + SlotModificationManager.Info full = SlotModificationManager.AllSlotModifications.InfoByID(info); |
| 520 | + if (full != null) |
| 521 | + { |
| 522 | + full.SetUniqueRedirect(clickableText, uniqueRedirect, redirectColour); |
| 523 | + return info; |
| 524 | + } |
| 525 | + |
| 526 | + InscryptionAPIPlugin.Logger.LogError($"Can't set rulebook redirect for {clickableText} because the SlotModificationManager.ModificationType hasn't been added to the API yet."); |
| 527 | + return info; |
| 528 | + } |
| 529 | + public static SlotModificationManager.ModificationType SetSlotRedirect(this SlotModificationManager.ModificationType info, string clickableText, SlotModificationManager.ModificationType slotMod, Color redirectColour) |
| 530 | + { |
| 531 | + SlotModificationManager.Info full = SlotModificationManager.AllSlotModifications.InfoByID(info); |
| 532 | + if (full != null) |
| 533 | + { |
| 534 | + full.SetSlotRedirect(clickableText, slotMod, redirectColour); |
| 535 | + return info; |
| 536 | + } |
| 537 | + |
| 538 | + InscryptionAPIPlugin.Logger.LogError($"Can't set rulebook redirect for {clickableText} because the SlotModificationManager.ModificationType hasn't been added to the API yet."); |
| 539 | + return info; |
| 540 | + } |
366 | 541 | #endregion |
367 | 542 |
|
368 | 543 | #region RuleBookPageInfo |
@@ -421,5 +596,16 @@ public static RuleBookPageInfo SetUniqueRedirect(this RuleBookPageInfo pageInfo, |
421 | 596 | ext.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.Unique, redirectColour, uniqueRedirect); |
422 | 597 | return pageInfo; |
423 | 598 | } |
| 599 | + public static RuleBookPageInfo SetSlotRedirect(this RuleBookPageInfo pageInfo, string clickableText, SlotModificationManager.ModificationType slotMod, Color redirectColour) |
| 600 | + { |
| 601 | + RuleBookPageInfoExt ext = CustomRedirectPages.Find(x => x.parentPageInfo == pageInfo); |
| 602 | + if (ext == null) |
| 603 | + { |
| 604 | + ext = new(pageInfo, new()); |
| 605 | + CustomRedirectPages.Add(ext); |
| 606 | + } |
| 607 | + ext.RulebookDescriptionRedirects[clickableText] = new(PageRangeType.Items, redirectColour, SlotModificationManager.SLOT_PAGEID + slotMod.ToString()); |
| 608 | + return pageInfo; |
| 609 | + } |
424 | 610 | #endregion |
425 | 611 | } |
0 commit comments