-
Notifications
You must be signed in to change notification settings - Fork 4
/
ItemHandler.cs
711 lines (678 loc) · 28.9 KB
/
ItemHandler.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Archipelago.Gifting.Net.Gifts.Versions.Current;
using Archipelago.MultiClient.Net.Enums;
using BepInEx.Logging;
using HarmonyLib;
using LunacidAP.Data;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace LunacidAP
{
public class ItemHandler
{
private static CONTROL Control;
private static POP_text_scr Popup;
private static LogicHelper _lunacidLogic;
private static ManualLogSource _log;
public ItemHandler(LogicHelper lunacidLogic, ManualLogSource log)
{
_log = log;
_lunacidLogic = lunacidLogic;
Harmony.CreateAndPatchAll(typeof(ItemHandler));
}
[HarmonyPatch(typeof(Menus), "ItemLoad")]
[HarmonyPrefix]
private static bool ItemLoad_CreateFakeKeys(Menus __instance)
{
if (__instance.sub_menu != 6)
{
return true;
}
var eqSelField = __instance.GetType().GetField("EQ_SEL", BindingFlags.Instance | BindingFlags.NonPublic);
int EQ_SEL = (int)eqSelField.GetValue(__instance);
__instance.TXT[9].GetComponent<Animation>().Play();
__instance.TXT[10].GetComponent<Animation>().Play();
__instance.TXT[11].GetComponent<Animation>().Play();
int num = EQ_SEL = int.Parse(EventSystem.current.currentSelectedGameObject.name.Substring(3));
if (StaticFuncs.IS_NULL(__instance.CON.CURRENT_PL_DATA.ITEMS[num]))
{
return true;
}
var keyItems = new List<string>() { "Great Well Doors Keyring", "Great Well Switches Keyring", "Orb of a Lost Archipelago" };
if (!keyItems.Contains(StaticFuncs.REMOVE_NUMS(__instance.CON.CURRENT_PL_DATA.ITEMS[num])))
{
return true;
}
int num3 = int.Parse(__instance.CON.CURRENT_PL_DATA.ITEMS[num].Substring(__instance.CON.CURRENT_PL_DATA.ITEMS[num].Length - 2, 2));
string itemName = StaticFuncs.REMOVE_NUMS(__instance.CON.CURRENT_PL_DATA.ITEMS[num]);
if (itemName == "Great Well Doors Keyring")
{
CreateDoorKeyInInventory(__instance, num3);
}
else if (itemName == "Great Well Switches Keyring")
{
CreateSwitchKeyInInventory(__instance, num3);
}
else if (itemName == "Orb of a Lost Archipelago")
{
CreateOrbInInventory(__instance, num3);
}
return false;
}
// This is a temporary patch to fix a vanilla bug.
[HarmonyPatch(typeof(Player_Poison), "Harm")]
[HarmonyPrefix]
private static bool Harm_FixSlownessBug(int type, float duration, Player_Poison __instance)
{
__instance.IMG.gameObject.GetComponent<AspectRatioFitter>().aspectRatio = Camera.main.aspect;
if (type == 4)
{
var poisonType = __instance.GetType();
var plField = poisonType.GetField("PL", BindingFlags.Instance | BindingFlags.NonPublic);
GameObject PL = (GameObject)plField.GetValue(__instance);
if (PL.GetComponent<Player_Control_scr>().CON.EQ_WEP != null)
{
return true;
}
else
{
var CON = GameObject.Find("CONTROL").GetComponent<CONTROL>();
if (__instance.SLOW_DUR == 0f)
{
var audioMethod = poisonType.GetMethod("Audio", BindingFlags.Instance | BindingFlags.NonPublic);
__instance.Active_Effects++;
audioMethod.Invoke(__instance, new object[] { 2 });
var SLOW_slotField = poisonType.GetField("SLOW_slot", BindingFlags.Instance | BindingFlags.NonPublic);
SLOW_slotField.SetValue(__instance, __instance.Active_Effects - 1);
__instance.transform.GetChild(__instance.Active_Effects - 1).GetComponent<TextMeshProUGUI>().text = "slowed";
__instance.transform.GetChild(__instance.Active_Effects - 1).GetComponent<TextMeshProUGUI>().color = Color.grey;
}
var steps = duration;
steps *= Mathf.LerpUnclamped(1.25f, 0.2f, (float)CON.CURRENT_PL_DATA.PLAYER_RES / 100f);
__instance.SLOW_DUR = Time.time + steps;
}
return false;
}
return true;
}
public static void GiveLunacidItem(string itemName, ItemFlags itemFlag, string player = "", bool self = false, string overrideColor = "")
{
if (LunacidItems.FakeItems.Contains(itemName))
{
return;
}
if (!FlagHandler.DoesPlayerHaveItem("Orb of a Lost Archipelago"))
{
Control = GameObject.Find("CONTROL").GetComponent<CONTROL>();
ApplyItemToInventory("Orb of a Lost Archipelago");
}
string color = ArchipelagoClient.FlagColor(itemFlag);
if (overrideColor != "")
{
color = overrideColor;
}
itemName = ProgressiveSymbolHandler(itemName);
if (LunacidFlags.ItemToFlag.Keys.Contains(itemName))
{
FlagHandler.HandleFlagGivenItemName(itemName);
}
var type = IdentifyItemGetType(itemName);
if (type == 1 || type == 2)
{
itemName = itemName.ToUpper();
}
switch (type)
{
case 1:
{
GiveWeapon(itemName, color, player, self);
return;
}
case 2:
{
GiveSpell(itemName, color, player, self);
return;
}
case 0:
{
GiveSilver(itemName, player, self);
return;
}
case 4:
{
GiveItem(itemName, color, player, self);
return;
}
case 3:
{
GiveMaterial(itemName, color, player, self);
return;
}
case -1:
{
GiveSwitch(itemName, color, player, self);
return;
}
case -2:
{
GiveDoor(itemName, color, player, self);
return;
}
}
if (itemName.Contains(" Trap"))
{
GiveTrap(itemName, color, player, self);
return;
}
_log.LogError($"Supplied item {itemName} was not caught by any of the given cases");
}
public static void GiveLunacidItem(long itemID, ItemFlags itemFlag, string player = "", bool self = false)
{
string Name = ArchipelagoClient.AP.Session.Items.GetItemName(itemID);
GiveLunacidItem(Name, itemFlag, player, self);
}
public static void GiveLunacidItem(ReceivedItem receivedItem, bool self)
{
GiveLunacidItem(receivedItem.ItemId, receivedItem.Classification, receivedItem.PlayerName, self);
ConnectionData.ReceivedItems.Add(receivedItem);
}
public static void GiveLunacidItem(Gift gift, bool isTrap)
{
var playerName = ArchipelagoClient.AP.GetPlayerNameFromSlot(gift.SenderSlot);
if (isTrap)
{
GiveLunacidItem(gift.ItemName, ItemFlags.Trap, playerName, false);
return;
}
GiveLunacidItem(gift.ItemName, ItemFlags.None, playerName, false);
}
private static void PopupCommand(int sprite, string Name, string color, string player, bool self)
{
Control = GameObject.Find("CONTROL").GetComponent<CONTROL>();
Popup = Control.PAPPY;
if (self)
Popup?.POP($"<color={color}>{Name}</color> <sprite={sprite}> ACQUIRED", 1f, 0);
else
Popup?.POP($"<color={color}>{Name}</color> <sprite={sprite}> RECEIVED FROM {player}", 1f, 0);
}
private static void GiveWeapon(string Name, string color, string player = "", bool self = false)
{
try
{
PopupCommand(1, Name, color, player, self);
Name = Name.Replace("JAILOR'S", "JAILORS");
for (int j = 0; j < 128; j++)
{
if (Control.CURRENT_PL_DATA.WEPS[j] == "" || Control.CURRENT_PL_DATA.WEPS[j] == null || StaticFuncs.REMOVE_NUMS(Control.CURRENT_PL_DATA.WEPS[j]) == Name)
{
Control.CURRENT_PL_DATA.WEPS[j] = Name;
j = 999;
}
}
}
catch (Exception ex)
{
_log.LogError($"Method {nameof(GiveWeapon)} failed.");
_log.LogError($"Reason: {ex.Message}");
}
}
private static void GiveSpell(string Name, string color, string player = "", bool self = false)
{
try
{
PopupCommand(2, Name, color, player, self);
for (int k = 0; k < 128; k++)
{
if (Control.CURRENT_PL_DATA.SPELLS[k] == "" || Control.CURRENT_PL_DATA.SPELLS[k] == null || StaticFuncs.REMOVE_NUMS(Control.CURRENT_PL_DATA.SPELLS[k]) == Name)
{
Control.CURRENT_PL_DATA.SPELLS[k] = Name;
k = 999;
}
}
}
catch (Exception ex)
{
_log.LogInfo($"Failure in {nameof(GiveSpell)}.");
_log.LogInfo($"Reason: {ex.Message}");
}
}
private static void GiveSilver(string Name, string player = "", bool self = false)
{
var currencyMultiplier = ArchipelagoClient.AP.SlotData.Fillerbundle;
var currencyAmount = (10 * currencyMultiplier).ToString();
PopupCommand(0, currencyAmount, "white", player, self);
Control.CURRENT_PL_DATA.GOLD += int.Parse(currencyAmount);
}
private static void GiveItem(string Name, string color, string player = "", bool self = false)
{
PopupCommand(4, Name, color, player, self);
ApplyItemToInventory(Name);
}
private static void ApplyItemToInventory(string Name)
{
if (ArchipelagoClient.AP is null)
{
_log.LogError("Archipelago is null!");
}
if (ArchipelagoClient.AP.SlotData is null)
{
_log.LogError("SlotData is null!");
}
var bundleSize = ArchipelagoClient.AP.SlotData.Fillerbundle;
if (LunacidItems.OneCountItems.Contains(Name))
{
bundleSize = 1;
}
if (Name == "Shrimp")
{
Name = "Pink Shrimp";
}
if (Name == "Poison Throwing Knife" || Name == "Throwing Knife" || Name == "Survey Banner")
{
bundleSize = Math.Min(10, bundleSize * 4); // Game normally boosts these anyway
}
if (Name == "Poison Urn" || Name == "Staff of Osiris")
{
bundleSize = Math.Min(10, bundleSize * 2); //Same deal, but not as much
}
Useable_Item[] eQ_ITEMS = Control.EQ_ITEMS;
foreach (Useable_Item useable_Item in eQ_ITEMS)
{
if (!(useable_Item.ITEM_NAME == Name.Replace(" ", "_")))
{
continue;
}
if (useable_Item.Count > 100 - bundleSize)
{
return;
}
useable_Item.Count += 1 + bundleSize;
useable_Item.TakeOne();
useable_Item.CON.ITM_SLOT--;
useable_Item.CON.SendMessage("OnNextITEM");
return;
}
for (int m = 0; m < 128; m++)
{
if (Control.CURRENT_PL_DATA.ITEMS[m] == "" || Control.CURRENT_PL_DATA.ITEMS[m] == null)
{
Control.CURRENT_PL_DATA.ITEMS[m] = Name + ValueSuffix(bundleSize);
m = 999;
}
else
{
if (!(StaticFuncs.REMOVE_NUMS(Control.CURRENT_PL_DATA.ITEMS[m]) == Name))
{
continue;
}
int num2 = int.Parse(Control.CURRENT_PL_DATA.ITEMS[m].Substring(Control.CURRENT_PL_DATA.ITEMS[m].Length - 2, 2));
num2 += bundleSize;
if (num2 > 100 - bundleSize)
{
m = 999;
continue;
}
if (num2 < 10)
{
Control.CURRENT_PL_DATA.ITEMS[m] = Name + "0" + num2;
}
else
{
Control.CURRENT_PL_DATA.ITEMS[m] = Name + num2;
}
m = 999;
}
}
}
private static void GiveMaterial(string Name, string color, string player = "", bool self = false)
{
if (!LunacidItems.MaterialNames.Keys.Contains(Name))
{
return;
}
var bundleSize = ArchipelagoClient.AP.SlotData.Fillerbundle;
if (LunacidItems.OneCountItems.Contains(Name))
{
bundleSize = 1;
}
var actualName = LunacidItems.MaterialNames[Name].ToString();
PopupCommand(3, Name, color, player, self);
for (int i = 0; i < 128; i++)
{
if (Control.CURRENT_PL_DATA.MATER[i] == "" || Control.CURRENT_PL_DATA.MATER[i] == null)
{
Control.CURRENT_PL_DATA.MATER[i] = actualName + ValueSuffix(bundleSize); // Used Alt_Name previously
i = 999;
}
else
{
if (!(Control.CURRENT_PL_DATA.MATER[i].Substring(0, Control.CURRENT_PL_DATA.MATER[i].Length - 2) == actualName)) // Used Alt_Name previously
{
continue;
}
int num = int.Parse(Control.CURRENT_PL_DATA.MATER[i].Substring(Control.CURRENT_PL_DATA.MATER[i].Length - 2, 2));
num += bundleSize;
if (num > 100 - bundleSize)
{
i = 999;
continue;
}
if (num < 10)
{
Control.CURRENT_PL_DATA.MATER[i] = actualName + "0" + num; // Used Alt_Name previously
}
else
{
Control.CURRENT_PL_DATA.MATER[i] = actualName + num; // Used Alt_Name previously
}
i = 999;
}
}
}
private static void GiveSwitch(string Name, string color, string player = "", bool self = false)
{
PopupCommand(4, Name, color, player, self);
if (!FlagHandler.DoesPlayerHaveItem("Great Well Switches Keyring"))
{
ApplyItemToInventory("Great Well Switches Keyring");
}
}
private static void GiveDoor(string Name, string color, string player = "", bool self = false)
{
PopupCommand(4, Name, color, player, self);
if (!FlagHandler.DoesPlayerHaveItem("Great Well Doors Keyring"))
{
ApplyItemToInventory("Great Well Doors Keyring");
}
}
private static void GiveTrap(string Name, string color, string player = "", bool self = false)
{
PopupCommand(4, Name, color, player, self);
Control.PL.Poison.Harm(LunacidItems.TrapToHarm[Name], 10.0f);
}
private static void CreateDoorKeyInInventory(Menus menu, int itemCount)
{
GameObject obj = UnityEngine.Object.Instantiate(Resources.Load("ITEMS/" + "Terminus Prison Key")) as GameObject;
Useable_Item component6 = obj.GetComponent<Useable_Item>();
var description = "<size=80%>A ring with the following keys on it:</size>\n";
var rightKeys = new List<string>() { };
var leftKeys = new List<string>() { };
var rightSide = "";
var leftSide = "";
foreach (var key in LunacidItems.Keys)
{
if (ArchipelagoClient.AP.WasItemReceived(key))
{
rightKeys.Add(key);
}
}
if (rightKeys.Count > 9)
{
for (var i = 0; i < 10; i++)
{
leftKeys.Add(rightKeys[0]);
rightKeys.RemoveAt(0);
}
}
foreach (var key in rightKeys)
{
rightSide += $"<size=60%><align=center>{key}</align></size>\n";
}
if (leftKeys.Count > 0)
{
foreach (var key in leftKeys)
{
leftSide += $"<size=40%><align=center>{key.ToUpper()}</align></size>\n";
}
}
menu.TXT[32].text = "Great Well Doors Keyring";
menu.TXT[33].text = itemCount.ToString() + $"\n<size=35%>\n</size>{leftSide}";
menu.TXT[34].text = description + rightSide;
menu.TXT[32].transform.GetChild(0).gameObject.SetActive(leftKeys.Count == 0);
menu.TXT[32].transform.GetChild(1).gameObject.SetActive(leftKeys.Count == 0);
if (leftKeys.Count == 0)
{
menu.TXT[32].transform.GetChild(1).GetComponent<UnityEngine.UI.Image>().sprite = component6.SPR;
}
UnityEngine.Object.Destroy(obj);
var doubleClick = menu.GetType().GetMethod("DoubleClick", BindingFlags.Instance | BindingFlags.NonPublic);
if ((bool)doubleClick.Invoke(menu, null))
{
var click = menu.GetType().GetMethod("Click", BindingFlags.Instance | BindingFlags.NonPublic);
click.Invoke(menu, new object[1] { 24 });
}
}
private static void CreateSwitchKeyInInventory(Menus menu, int itemCount)
{
GameObject obj = UnityEngine.Object.Instantiate(Resources.Load("ITEMS/" + "Terminus Prison Key")) as GameObject;
Useable_Item component6 = obj.GetComponent<Useable_Item>();
var description = "<size=80%>A ring with the following keys on it:</size>\n";
foreach (var key in LunacidItems.Switches)
{
if (ArchipelagoClient.AP.WasItemReceived(key))
{
description += $"<size=60%><align=center> {key} </align></size>\n";
}
}
menu.TXT[32].text = "Great Well Switches Keyring";
menu.TXT[33].text = itemCount.ToString();
menu.TXT[34].text = description;
menu.TXT[32].transform.GetChild(0).gameObject.SetActive(value: true);
menu.TXT[32].transform.GetChild(1).gameObject.SetActive(value: true);
menu.TXT[32].transform.GetChild(1).GetComponent<UnityEngine.UI.Image>().sprite = component6.SPR;
UnityEngine.Object.Destroy(obj);
var doubleClick = menu.GetType().GetMethod("DoubleClick", BindingFlags.Instance | BindingFlags.NonPublic);
if ((bool)doubleClick.Invoke(menu, null))
{
var click = menu.GetType().GetMethod("Click", BindingFlags.Instance | BindingFlags.NonPublic);
click.Invoke(menu, new object[1] { 24 });
}
}
private static void CreateOrbInInventory(Menus menu, int itemCount)
{
GameObject obj = UnityEngine.Object.Instantiate(Resources.Load("ITEMS/" + "Dusty Crystal Orb")) as GameObject;
var sceneName = menu.gameObject.scene.name;
Useable_Item component6 = obj.GetComponent<Useable_Item>();
var description = "<size=80%>An orb with several words floating within, as semblances of colorful smoke.</size>\n";
var rightsideLocations = new List<string>() { };
if (LunacidLocations.APLocationData.Keys.Contains(sceneName))
{
foreach (var locationData in LunacidLocations.APLocationData[sceneName])
{
if (!ArchipelagoClient.AP.IsLocationChecked(locationData.APLocationID))
{
rightsideLocations.Add(locationData.APLocationName);
}
}
}
if (ArchipelagoClient.AP.SlotData.Dropsanity != Dropsanity.Off)
{
foreach (var locationData in LunacidLocations.UniqueDropLocations)
{
var enemyName = locationData.APLocationName.Split(':')[0];
_log.LogInfo($"Looking at {enemyName}");
if (LunacidEnemies.EnemyToScenes[enemyName].Contains(sceneName))
{
if (!ArchipelagoClient.AP.IsLocationChecked(locationData.APLocationID))
{
rightsideLocations.Add(locationData.APLocationName);
}
}
}
}
if (ArchipelagoClient.AP.SlotData.Dropsanity == Dropsanity.Randomized)
{
foreach (var locationData in LunacidLocations.OtherDropLocations)
{
var enemyName = locationData.APLocationName.Split(':')[0];
if (!LunacidEnemies.EnemyToScenes.TryGetValue(enemyName, out var sceneList))
{
_log.LogWarning($"Couldn't find {locationData.APLocationName} in multiworld, continuing.");
continue;
}
if (sceneList.Contains(sceneName))
{
if (!ArchipelagoClient.AP.IsLocationChecked(locationData.APLocationID))
{
rightsideLocations.Add(locationData.APLocationName);
}
}
}
}
var shopScenes = new List<string>() { "HUB_01", "FOREST_A1" };
if (ArchipelagoClient.AP.SlotData.Shopsanity && shopScenes.Contains(sceneName))
{
if (sceneName == "FOREST_A1")
{
var locationID = ArchipelagoClient.AP.GetLocationIDFromName("Buy Ocean Elixir (Patchouli)");
if (!ArchipelagoClient.AP.IsLocationChecked(locationID))
{
rightsideLocations.Add("Buy Ocean Elixir (Patchouli)");
}
}
else
{
foreach (var locationData in LunacidLocations.ShopLocations)
{
if (locationData.APLocationName != "Buy Ocean Elixir (Patchouli)" &&
!ArchipelagoClient.AP.IsLocationChecked(locationData.APLocationID))
{
rightsideLocations.Add(locationData.APLocationName);
}
}
}
}
var random = new System.Random(DateTime.Today.Day + DateTime.Today.Hour + DateTime.Today.Minute);
rightsideLocations = rightsideLocations.OrderBy(_ => random.Next()).ToList();
var leftsideLocations = new List<string>() { };
var wasListTooBig = false;
if (rightsideLocations.Count() == 0)
{
description = "<size=80%>A multi-colored orb, clear as glass. Once, words danced upon its surface, but now nothing can be seen...</size>";
}
else if (rightsideLocations.Count > 14)
{
if (rightsideLocations.Count > 25)
{
wasListTooBig = true;
while(rightsideLocations.Count> 25)
{
rightsideLocations.RemoveAt(0);
}
}
while (rightsideLocations.Count > 14)
{
leftsideLocations.Add(rightsideLocations[0]);
rightsideLocations.RemoveAt(0);
}
}
var leftsideText = "";
var rightsideText = "";
foreach (var location in rightsideLocations)
{
rightsideText += $"<size=55%><align=center><color={_lunacidLogic.ColorLogicLocation(location, sceneName)}>{location}</color></align></size>\n";
}
if (leftsideLocations.Count > 0)
{
foreach (var location in leftsideLocations)
{
leftsideText += $"<size=37%><align=center><color={_lunacidLogic.ColorLogicLocation(location, sceneName)}>{location.ToUpper()}</color></align></size>\n";
}
}
if (wasListTooBig)
{
leftsideText += $"<size=50%>THE OTHER WORDS BLEND TOGETHER...</size>\n";
}
var inventoryItem = LunacidLocations.sceneToArea.Keys.Contains(sceneName) ? LunacidLocations.sceneToArea[sceneName] : "a Lost Archipelago";
menu.TXT[32].text = $"Orb of {inventoryItem}";
menu.TXT[33].text = itemCount.ToString() + "\n<size=35%>\n</size>" + leftsideText;
menu.TXT[34].text = description + rightsideText;
menu.TXT[32].transform.GetChild(0).gameObject.SetActive(leftsideLocations.Count == 0);
menu.TXT[32].transform.GetChild(1).gameObject.SetActive(leftsideLocations.Count == 0);
if (leftsideLocations.Count == 0)
{
menu.TXT[32].transform.GetChild(1).GetComponent<UnityEngine.UI.Image>().sprite = component6.SPR;
}
UnityEngine.Object.Destroy(obj);
var doubleClick = menu.GetType().GetMethod("DoubleClick", BindingFlags.Instance | BindingFlags.NonPublic);
if ((bool)doubleClick.Invoke(menu, null))
{
var click = menu.GetType().GetMethod("Click", BindingFlags.Instance | BindingFlags.NonPublic);
click.Invoke(menu, new object[1] { 24 });
}
}
private static string ValueSuffix(int value)
{
if (value > 9)
{
return value.ToString();
}
return "0" + value.ToString();
}
private static string ProgressiveSymbolHandler(string Name)
{
try
{
if (Name != "Progressive Vampiric Symbol")
{
return Name;
}
if (!FlagHandler.DoesPlayerHaveItem("Vampiric Symbol (W)"))
{
return "Vampiric Symbol (W)";
}
else if (!FlagHandler.DoesPlayerHaveItem("Vampiric Symbol (A)"))
{
return "Vampiric Symbol (A)";
}
else if (!FlagHandler.DoesPlayerHaveItem("Vampiric Symbol (E)"))
{
return "Vampiric Symbol (E)";
}
return Name;
}
catch (Exception ex)
{
_log.LogError($"{ex.Message}");
return Name;
}
}
public static int IdentifyItemGetType(string name)
{
if (LunacidItems.Items.Contains(name))
{
return 4;
}
else if (LunacidItems.Materials.Contains(name))
{
return 3;
}
else if (LunacidItems.Weapons.Contains(name))
{
return 1;
}
else if (LunacidItems.Spells.Contains(name))
{
return 2;
}
else if (name == "Silver" || name == "Silver (10)")
{
return 0;
}
else if (LunacidItems.Switches.Contains(name))
{
return -1;
}
else if (LunacidItems.Keys.Contains(name))
{
return -2;
}
return -3;
}
}
}