forked from timhjersted/tsorcRevamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtsorcRevamp.cs
2271 lines (2057 loc) · 122 KB
/
tsorcRevamp.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
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using On.System.Windows.Forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Terraria;
using Terraria.DataStructures;
using Terraria.GameContent;
using Terraria.GameContent.ItemDropRules;
using Terraria.GameContent.UI;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
using Terraria.UI;
using tsorcRevamp.Items;
using tsorcRevamp.Items.BossBags;
using tsorcRevamp.Items.Pets;
using tsorcRevamp.NPCs.Bosses;
using tsorcRevamp.NPCs.Bosses.SuperHardMode;
using tsorcRevamp.UI;
using static tsorcRevamp.ILEdits;
using static tsorcRevamp.MethodSwaps;
namespace tsorcRevamp
{
public class tsorcRevamp : Mod
{
public class tsorcItemDropRuleConditions
{
public static IItemDropRuleCondition SuperHardmodeRule;
public static IItemDropRuleCondition FirstBagRule;
public static IItemDropRuleCondition CursedRule;
public static IItemDropRuleCondition FirstBagCursedRule;
public static IItemDropRuleCondition AdventureModeRule;
public static IItemDropRuleCondition NonAdventureModeRule;
}
public enum BossExtras
{
EstusFlaskShard = 0b1000,
GuardianSoul = 0b0100,
StaminaVessel = 0b0010,
SublimeBoneDust = 0b0001,
DarkSoulsOnly = 0b0000
};
public static ModKeybind toggleDragoonBoots;
public static ModKeybind reflectionShiftKey;
public static ModKeybind specialAbility;
public static bool isAdventureMap = false;
public static int DarkSoulCustomCurrencyId;
internal bool UICooldown = false;
internal bool worldButtonClicked = false;
public static List<int> KillAllowed;
public static List<int> PlaceAllowed;
public static List<int> Unbreakable;
public static List<int> IgnoredTiles;
public static List<int> CrossModTiles;
public static List<int> PlaceAllowedModTiles;
public static List<int> BannedItems;
public static Dictionary<BossExtras, (IItemDropRuleCondition Condition, int ID)> BossExtrasDescription;
public static Dictionary<int, BossExtras> AssignedBossExtras;
public static Dictionary<int, int> BossBagIDtoNPCID;
public static Dictionary<int, List<int>> RemovedBossBagLoot;
public static Dictionary<int, List<IItemDropRule>> AddedBossBagLoot;
internal BonfireUIState BonfireUIState;
internal UserInterface _bonfireUIState; //"but zeo!", you say
internal DarkSoulCounterUIState DarkSoulCounterUIState;
internal UserInterface _darkSoulCounterUIState; //"prefacing a name with an underscore is supposed to be for private fields!"
internal UserInterface EmeraldHeraldUserInterface;
internal EstusFlaskUIState EstusFlaskUIState;
internal UserInterface _estusFlaskUIState; //"but reader! i dont care!" says zeo
internal PotionBagUIState PotionUIState;
internal UserInterface PotionBagUserInterface;
internal CustomMapUIState DownloadUIState;
internal UserInterface DownloadUI;
public static FieldInfo AudioLockInfo;
public static FieldInfo ActiveSoundInstancesInfo;
public static FieldInfo AreSoundsPausedInfo;
public static FieldInfo TrackedSoundsInfo;
public static Effect TheAbyssEffect;
//public static Effect AttraidiesEffect;
public static bool MusicNeedsUpdate = false;
public static bool justUpdatedMusic = false;
public static bool ReloadNeeded = false;
public static bool SpecialReloadNeeded = false;
public static bool DownloadingMusic = false;
public static float MusicDownloadProgress = 0;
public static ModKeybind DodgerollKey;
//public static ModHotKey SwordflipKey;
internal static bool[] CustomDungeonWalls;
public static bool ActuationBypassActive = false;
public override void Load()
{
toggleDragoonBoots = KeybindLoader.RegisterKeybind(this, "Dragoon Boots", Microsoft.Xna.Framework.Input.Keys.Z);
reflectionShiftKey = KeybindLoader.RegisterKeybind(this, "Reflection Shift", Microsoft.Xna.Framework.Input.Keys.O);
DodgerollKey = KeybindLoader.RegisterKeybind(this, "Dodge Roll", Microsoft.Xna.Framework.Input.Keys.LeftAlt);
specialAbility = KeybindLoader.RegisterKeybind(this, "Special Ability", Microsoft.Xna.Framework.Input.Keys.Q);
//SwordflipKey = KeybindLoader.RegisterKeybind(this, "Sword Flip", Microsoft.Xna.Framework.Input.Keys.P);
DarkSoulCustomCurrencyId = CustomCurrencyManager.RegisterCurrency(new DarkSoulCustomCurrency(ModContent.ItemType<SoulShekel>(), 99999L));
BonfireUIState = new BonfireUIState();
_bonfireUIState = new UserInterface();
DarkSoulCounterUIState = new DarkSoulCounterUIState();
//if (!Main.dedServ) DarkSoulCounterUIState.Activate();
_darkSoulCounterUIState = new UserInterface();
EstusFlaskUIState = new EstusFlaskUIState();
//if (!Main.dedServ) EstusFlaskUIState.Activate();
_estusFlaskUIState = new UserInterface();
PotionUIState = new PotionBagUIState();
PotionBagUserInterface = new UserInterface();
DownloadUIState = new CustomMapUIState();
DownloadUI = new UserInterface();
ApplyMethodSwaps();
ApplyILs();
PopulateArrays();
if (Main.dedServ)
return;
BonfireUIState.Activate();
_bonfireUIState.SetState(BonfireUIState);
_darkSoulCounterUIState.SetState(DarkSoulCounterUIState);
_estusFlaskUIState.SetState(EstusFlaskUIState);
PotionBagUserInterface.SetState(PotionUIState);
DownloadUI.SetState(DownloadUIState);
Main.QueueMainThreadAction(TransparentTextureHandler.TransparentTextureFix);
tsorcRevamp Instance = this;
TheAbyssEffect = ModContent.Request<Effect>("tsorcRevamp/Effects/ScreenFilters/TheAbyssShader", ReLogic.Content.AssetRequestMode.ImmediateLoad).Value;
Filters.Scene["tsorcRevamp:TheAbyss"] = new Filter(new ScreenShaderData(new Terraria.Ref<Effect>(TheAbyssEffect), "TheAbyssShaderPass").UseImage("Images/Misc/noise"), EffectPriority.Low);
//AttraidiesEffect = Instance.GetEffect("Effects/ScreenFilters/AttraidiesShader");
//Filters.Scene["tsorcRevamp:AttraidiesShader"] = new Filter(new ScreenShaderData(new Terraria.Ref<Effect>(AttraidiesEffect), "AttraidiesShaderPass").UseImage("Images/Misc/noise"), EffectPriority.Low);
EmeraldHeraldUserInterface = new UserInterface();
/*
if (!Main.dedServ)
{
Main.instance.LoadNPC(NPCID.TheDestroyer);
TextureAssets.Npc[NPCID.TheDestroyer] = ModContent.Request<Texture2D>("NPCs/Bosses/TheDestroyer/NPC_134");
Main.instance.LoadNPC(NPCID.TheDestroyerBody);
TextureAssets.Npc[NPCID.TheDestroyerBody] = ModContent.Request<Texture2D>("NPCs/Bosses/TheDestroyer/NPC_135");
Main.instance.LoadNPC(NPCID.TheDestroyerTail);
TextureAssets.Npc[NPCID.TheDestroyerTail] = ModContent.Request<Texture2D>("NPCs/Bosses/TheDestroyer/NPC_136");
Main.instance.LoadGore(156);
TextureAssets.Gore[156] = ModContent.Request<Texture2D>("NPCs/Bosses/TheDestroyer/Gore_156");
Main.instance.LoadNPC(NPCID.Probe);
TextureAssets.Npc[NPCID.Probe] = ModContent.Request<Texture2D>("NPCs/Bosses/TheDestroyer/NPC_139");
}*/
UpdateCheck();
}
private void PopulateArrays()
{
#region tsorcItemDropRuleConditions class
tsorcItemDropRuleConditions.SuperHardmodeRule = new SuperHardmodeRule();
tsorcItemDropRuleConditions.FirstBagRule = new FirstBagRule();
tsorcItemDropRuleConditions.CursedRule = new CursedRule();
tsorcItemDropRuleConditions.FirstBagCursedRule = new FirstBagCursedRule();
tsorcItemDropRuleConditions.AdventureModeRule = new AdventureModeRule();
tsorcItemDropRuleConditions.NonAdventureModeRule = new NonAdventureModeRule();
#endregion
//--------
#region KillAllowed list
KillAllowed = new List<int>() {
3, //small plants
4, // torch
5, //tree trunk
6, //iron
7, //copper
TileID.Gold,
9, //silver
10, //closed door
11, //open door
12, //Heart crystal
13, //bottles and jugs
14, //table
15, //chairs
16, //anvil
17, //furnance
18, //workbench
20, //sapling
21, //chests
24, //small corruption plants
27, //sunflower
28, //pot
29, //piggy bank
31, //shadow orb
32, //corruption barbs
33, //candle
34, //bronze chandellier
35, //silver c
36, //gold c
37, //meteorite
42, //chain lantern
49, //water candle
50, //books
51, //cobweb
52, //vines
53, //sand
//55, //Sign (Removed - signs shouldn't be breakable.)
//56, //obsidian (removed at tim's request)
61, //small jungle plants
62, //jungle vines
67, //Amethyst
69, //thorns
72, //mushroom stalks
71, //small mushrooms
73, //plants
74, //plants
78, //clay pot
//79, //bed
80, //cactus
81, //corals
82, //new herbs
83, //grown herbs
84, //bloomed herbs
85, //tombstone
86, //loom
87, //piano
88, //drawer
89, //bench
90, //bathtub
91, //banner
92, //lamp post
93, //tiki torch
94, //keg
95, //chinese lantern
96, //cooking pot
97, //safe
98, //skull candle
99, //trash can
100, //candlabra
101, //bookcase
102, //throne
103, //bowl
104, //grandfather clock
//105, //statue
106, //sawmill
107, //cobalt
108, //mythril
110, //Hallowed Plants
111, //adamantite
112, //ebonsand
114, //tinkerer's workbench
115, //Hallowed Vines
116, //pearlsand
125, //crystal ball
126, //discoball
128, //mannequin
129, //crystal shard
133, //adamantite forge
134, //mythril anvil
138, //boulder
141, //explosives
165, //ambient objects (stalagmites / stalactites, icicles)
TileID.Platinum,
172, //sinks
173, //platinum candelabra
174, //platinum candle
184, //moss growth
185, //ambient objects (small rocks, small coin stashes, gem stashes)
186, //ambient objects (bone piles, large rocks, large coin stashes)
187, //ambient objects (mossy / lava rocks, spider eggs, misc bg furniture (cave tents, etc)) sword shrine
201, //tall grass (crimson)
205, //crimson vines
207, //water fountain
211, //Chlorophyte Ore
218, //meat grinder
227, //strange plant
228, //dye vat
233, ////ambient objects (background leafy jungle plants)
238, //Plantera Bulb
240, //trophies
242, //big paintings
245, //tall paintings
246, //wide paintings
270, //firefly in a bottle
271, //lightning bug in a bottle
275, //bunny cage
276, //squirrel cage
277, //mallard cage
278, //duck cage
279, //bird cage
280, //blue jay cage
281, //cardinal cage
282, //fish bowl
283, //heavy work bench
285, //snail cage
286, //glowing snail cage
287, //ammo box
288, //monarch jar
289, //purple emperor jar
290, //red admiral jar
291, //ulysses jar
292, //sulphur jar
293, //tree nymph jar
294, //zebra swallowtail jar
295, //julia jar
296, //scorpion cage
297, //black scorpion cage
298, //frog cage
299, //mouse cage
300, //bone welder
301, //flesh cloning vat
302, //glass kiln
307, //steampunk boiler
309, //penguin cage
310, //worm cage
316, //blue jellyfish jar
317, //green jellyfish jar
318, //pink jellyfish jar
319, //ship in a bottle
310, //seaweed planter
324, //seashell variants
337, //number and letter statues
339, //grasshopper cage
352, //crimson thorn
354, //bewitching table
355, //alchemy table
358, //gold bird cage
359, //gold bunny cage
360, //gold butterfly jar
361, //gold frog cage
362, //gold grasshopper cage
363, //gold mouse cage
364, //gold worm cage
372, //peace candle
377, //sharpening station
378, //target dummy
382, //flower vines
390, //lava lamp
391, //enchanted nightcrawler cage
392, //buggy cage
393, //grubby cage
394, //sluggy cage
413, //red squirrel cage
414, //gold squirrel cage
463, //defenders forge
TileID.Titanium,
TileID.Pumpkins, //the harvestable kind, not the block
TileID.BreakableIce
};
#endregion
//--------
#region PlaceAllowed list
PlaceAllowed = new List<int>() {
4, //torch
10, //Closed Door
11, //Open Door
13, //bottles
15, //chairs
16, //anvil
17, //furnace
18, //workbench
20, //sapling
21, //chests
27, //sunflower
28, //pot
29, //piggy bank
33, //candle
34, //bronze chandellier
35, //silver chandellier
36, //gold chandellier
42, //chain lantern
49, //water candle
50, //books
73, //plants
74, //plants
78, //clay pot
//79, //bed
81, //corals
82, //new herbs
83, //grown herbs
84, //bloomed herbs
85, //tombstone
86, //loom
87, //piano
88, //drawer
89, //bench
90, //bathtub
91, //banner
92, //lamp post
93, //tiki torch
94, //keg
95, //chinese lantern
96, //cooking pot
97, //safe
98, //skull candle
99, //trash can
100, //candlabra
101, //bookcase
102, //throne
103, //bowl
104, //grandfather clock
105, //statue
106, //sawmill
114, //tinkerer's workbench
125, //crystal ball
126, //discoball
128, //mannequin
129, //crystal shard
132, //lever
133, //adamantite forge
134, //mythril anvil
149, //festive lights
172, //sinks
173, //platinum candelabra
174, //platinum candle
207, //water fountain
218, //meat grinder
228, //dye vat
240, //trophies
242, //big paintings
245, //tall paintings
246, //wide paintings
254, //pumpkin seeds
270, //firefly in a bottle
271, //lightning bug in a bottle
275, //bunny cage
276, //squirrel cage
277, //mallard cage
278, //duck cage
279, //bird cage
280, //blue jay cage
281, //cardinal cage
282, //fish bowl
283, //heavy work bench
285, //snail cage
286, //glowing snail cage
287, //ammo box
288, //monarch jar
289, //purple emperor jar
290, //red admiral jar
291, //ulysses jar
292, //sulphur jar
293, //tree nymph jar
294, //zebra swallowtail jar
295, //julia jar
296, //scorpion cage
297, //black scorpion cage
298, //frog cage
299, //mouse cage
300, //bone welder
301, //flesh cloning vat
302, //glass kiln
307, //steampunk boiler
309, //penguin cage
310, //worm cage
316, //blue jellyfish jar
317, //green jellyfish jar
318, //pink jellyfish jar
319, //ship in a bottle
310, //seaweed planter
324, //seashell variants
337, //number and letter statues
339, //grasshopper cage
354, //bewitching table
355, //alchemy table
358, //gold bird cage
359, //gold bunny cage
360, //gold butterfly jar
361, //gold frog cage
362, //gold grasshopper cage
363, //gold mouse cage
364, //gold worm cage
372, //peace candle
377, //sharpening station
378, //target dummy
390, //lava lamp
391, //enchanted nightcrawler cage
392, //buggy cage
393, //grubby cage
394, //sluggy cage
413, //red squirrel cage
414, //gold squirrel cage
463, //defender's forge
TileID.Pumpkins //the harvestable kind, not the block
};
#endregion
//--------
#region Unbreakable list
Unbreakable = new List<int>() {
19, //Wood platform
55, //sign
105, //statues
132, //lever
130, //active stone block
131, //inactive stone block
135, //pressure plates
136, //switch
137, //dart trap
TileID.Rope,
TileID.Chain,
TileID.VineRope,
TileID.SilkRope,
TileID.WebRope,
TileID.LunarMonolith, //410
TileID.ProjectilePressurePad
};
#endregion
//--------
#region IgnoredTiles list
IgnoredTiles = new List<int>() {
3, //tall grass
24, //tall grass (corruption)
32, //corruption thorn
51, //cobweb
52, //vines
61, //tall grass (jungle)
62, //jungle vines
69, //jungle thorn
73, //tall grass (misc)
74, //tall jungle plants
82, //plants (growing)
83, //plants (matured)
84, //plants (blooming)
85, //tombstone
115, //hallowed vines
129, //crystal shard
165, //ambient objects (stalagmites / stalactites, icicles)
184, //moss growth
185, //ambient objects (small rocks, small coin stashes, gem stashes)
186, //ambient objects (bone piles, large rocks, large coin stashes)
187, //ambient objects (mossy / lava rocks, spider eggs, misc bg furniture (cave tents, etc))
201, //tall grass (crimson)
205, //crimson vines
227, //strange plant
233, //ambient objects (background leafy jungle plants)
324, //sea shells
352, //crimson thorn
382 //flower vines
};
#endregion
//--------
#region CrossModTiles list
CrossModTiles = new List<int>();
Mod MagicStorage;
if (ModLoader.TryGetMod("MagicStorage", out MagicStorage))
{
CrossModTiles.Add(MagicStorage.Find<ModTile>("CraftingAccess").Type);
CrossModTiles.Add(MagicStorage.Find<ModTile>("RemoteAccess").Type);
CrossModTiles.Add(MagicStorage.Find<ModTile>("StorageAccess").Type);
CrossModTiles.Add(MagicStorage.Find<ModTile>("StorageComponent").Type);
CrossModTiles.Add(MagicStorage.Find<ModTile>("StorageHeart").Type);
CrossModTiles.Add(MagicStorage.Find<ModTile>("StorageUnit").Type);
CrossModTiles.Add(MagicStorage.Find<ModTile>("StorageConnector").Type);
}
Mod MagicStorageExtra;
if (ModLoader.TryGetMod("MagicStorageExtra", out MagicStorageExtra))
{
CrossModTiles.Add(MagicStorageExtra.Find<ModTile>("CraftingAccess").Type);
CrossModTiles.Add(MagicStorageExtra.Find<ModTile>("CreativeStorageUnit").Type);
CrossModTiles.Add(MagicStorageExtra.Find<ModTile>("RemoteAccess").Type);
CrossModTiles.Add(MagicStorageExtra.Find<ModTile>("StorageAccess").Type);
CrossModTiles.Add(MagicStorageExtra.Find<ModTile>("StorageComponent").Type);
CrossModTiles.Add(MagicStorageExtra.Find<ModTile>("StorageHeart").Type);
CrossModTiles.Add(MagicStorageExtra.Find<ModTile>("StorageUnit").Type);
CrossModTiles.Add(MagicStorageExtra.Find<ModTile>("StorageConnector").Type);
}
#endregion
//--------
#region PlaceAllowedModTiles list
PlaceAllowedModTiles = new List<int>()
{
Find<ModTile>("EnemyBannerTile").Type,
};
#endregion
//--------
#region BannedItems list
BannedItems = new List<int>()
{
ItemID.RodofDiscord,
ItemID.CorruptionKey,
ItemID.CrimsonKey,
ItemID.HallowedKey,
ItemID.JungleKey,
ItemID.FrozenKey,
ItemID.MechanicalEye,
ItemID.MechanicalSkull,
ItemID.MechanicalWorm
};
#endregion
//--------
#region AssignedBossExtras dictionary
AssignedBossExtras = new Dictionary<int, BossExtras>()
{
#region Vanilla
{ ItemID.KingSlimeBossBag , BossExtras.StaminaVessel },
{ ItemID.EyeOfCthulhuBossBag , BossExtras.StaminaVessel
| BossExtras.SublimeBoneDust },
{ ItemID.EaterOfWorldsBossBag , BossExtras.DarkSoulsOnly },
{ ItemID.BrainOfCthulhuBossBag , BossExtras.StaminaVessel },
{ ItemID.QueenBeeBossBag , BossExtras.DarkSoulsOnly },
{ ItemID.SkeletronBossBag , BossExtras.SublimeBoneDust },
{ ItemID.WallOfFleshBossBag , BossExtras.EstusFlaskShard },
{ ItemID.DestroyerBossBag , BossExtras.DarkSoulsOnly },
{ ItemID.TwinsBossBag , BossExtras.DarkSoulsOnly },
{ ItemID.SkeletronPrimeBossBag , BossExtras.SublimeBoneDust },
{ ItemID.PlanteraBossBag , BossExtras.DarkSoulsOnly },
{ ItemID.GolemBossBag , BossExtras.DarkSoulsOnly },
{ ItemID.FishronBossBag , BossExtras.StaminaVessel },
{ ItemID.CultistBossBag , BossExtras.DarkSoulsOnly },
{ ItemID.MoonLordBossBag , BossExtras.DarkSoulsOnly },
{ ItemID.QueenSlimeBossBag , BossExtras.DarkSoulsOnly },
{ ItemID.FairyQueenBossBag , BossExtras.DarkSoulsOnly },
{ ItemID.BossBagBetsy , BossExtras.DarkSoulsOnly },
{ ItemID.DeerclopsBossBag , BossExtras.DarkSoulsOnly },
#endregion
//--------
#region tsorc
{ ModContent.ItemType<OolacileDemonBag>() , BossExtras.DarkSoulsOnly },
{ ModContent.ItemType<SlograBag>() , BossExtras.StaminaVessel },
{ ModContent.ItemType<GaibonBag>() , BossExtras.StaminaVessel },
{ ModContent.ItemType<JungleWyvernBag>() , BossExtras.StaminaVessel },
{ ModContent.ItemType<AncientDemonBag>() , BossExtras.StaminaVessel },
{ ModContent.ItemType<LumeliaBag>() , BossExtras.StaminaVessel },
{ ModContent.ItemType<TheRageBag>() , BossExtras.DarkSoulsOnly },
{ ModContent.ItemType<TheSorrowBag>() , BossExtras.DarkSoulsOnly },
{ ModContent.ItemType<TheHunterBag>() , BossExtras.DarkSoulsOnly },
{ ModContent.ItemType<WyvernMageBag>() , BossExtras.StaminaVessel },
{ ModContent.ItemType<SerrisBag>() , BossExtras.GuardianSoul
| BossExtras.StaminaVessel },
{ ModContent.ItemType<DeathBag>() , BossExtras.GuardianSoul },
{ ModContent.ItemType<MindflayerIllusionBag>() , BossExtras.DarkSoulsOnly },
{ ModContent.ItemType<AttraidiesBag>() , BossExtras.DarkSoulsOnly },
{ ModContent.ItemType<KrakenBag>() , BossExtras.GuardianSoul
| BossExtras.StaminaVessel },
{ ModContent.ItemType<MarilithBag>() , BossExtras.GuardianSoul
| BossExtras.StaminaVessel },
{ ModContent.ItemType<LichBag>() , BossExtras.GuardianSoul
| BossExtras.StaminaVessel },
{ ModContent.ItemType<BlightBag>() , BossExtras.GuardianSoul },
{ ModContent.ItemType<ChaosBag>() , BossExtras.GuardianSoul },
{ ModContent.ItemType<MageShadowBag>() , BossExtras.DarkSoulsOnly },
{ ModContent.ItemType<OolacileSorcererBag>() , BossExtras.GuardianSoul },
{ ModContent.ItemType<ArtoriasBag>() , BossExtras.GuardianSoul },
{ ModContent.ItemType<HellkiteBag>() , BossExtras.GuardianSoul },
{ ModContent.ItemType<SeathBag>() , BossExtras.DarkSoulsOnly },
{ ModContent.ItemType<WitchkingBag>() , BossExtras.GuardianSoul },
{ ModContent.ItemType<DarkCloudBag>() , BossExtras.DarkSoulsOnly },
{ ModContent.ItemType<GwynBag>() , BossExtras.DarkSoulsOnly }
#endregion
};
#endregion
//--------
#region BossExtrasDescription dictionary
BossExtrasDescription = new Dictionary<BossExtras, (IItemDropRuleCondition Condition, int ID)>()
{
{ BossExtras.EstusFlaskShard , ( tsorcItemDropRuleConditions.FirstBagCursedRule , ModContent.ItemType<EstusFlaskShard>() ) },
{ BossExtras.GuardianSoul , ( tsorcItemDropRuleConditions.FirstBagRule , ModContent.ItemType<GuardianSoul>() ) },
{ BossExtras.StaminaVessel , ( tsorcItemDropRuleConditions.FirstBagRule , ModContent.ItemType<StaminaVessel>() ) },
{ BossExtras.SublimeBoneDust , ( tsorcItemDropRuleConditions.FirstBagCursedRule , ModContent.ItemType<SublimeBoneDust>() ) }
};
#endregion
//--------
#region BossBagIDtoNPCID dictionary
BossBagIDtoNPCID = new Dictionary<int, int>()
{
#region Vanilla
{ ItemID.KingSlimeBossBag , NPCID.KingSlime },
{ ItemID.EyeOfCthulhuBossBag , NPCID.EyeofCthulhu },
{ ItemID.EaterOfWorldsBossBag , NPCID.EaterofWorldsHead },
{ ItemID.BrainOfCthulhuBossBag , NPCID.BrainofCthulhu },
{ ItemID.QueenBeeBossBag , NPCID.QueenBee },
{ ItemID.SkeletronBossBag , NPCID.SkeletronHead },
{ ItemID.WallOfFleshBossBag , NPCID.WallofFlesh },
{ ItemID.DestroyerBossBag , NPCID.TheDestroyer },
{ ItemID.TwinsBossBag , NPCID.Retinazer }, // and also NPCID.Spazmatism
{ ItemID.SkeletronPrimeBossBag , NPCID.SkeletronPrime }, // but it doesn't really matter
{ ItemID.PlanteraBossBag , NPCID.Plantera }, // while their values are the same
{ ItemID.GolemBossBag , NPCID.Golem },
{ ItemID.FishronBossBag , NPCID.DukeFishron },
{ ItemID.CultistBossBag , NPCID.CultistBoss },
{ ItemID.MoonLordBossBag , NPCID.MoonLordCore },
{ ItemID.QueenSlimeBossBag , NPCID.QueenSlimeBoss },
{ ItemID.FairyQueenBossBag , NPCID.HallowBoss },
{ ItemID.BossBagBetsy , NPCID.DD2Betsy },
{ ItemID.DeerclopsBossBag , NPCID.Deerclops },
#endregion
//--------
#region tsorc
{ ModContent.ItemType<OolacileDemonBag>() , ModContent.NPCType<AncientOolacileDemon>() },
{ ModContent.ItemType<SlograBag>() , ModContent.NPCType<Slogra>() },
{ ModContent.ItemType<GaibonBag>() , ModContent.NPCType<Gaibon>() },
{ ModContent.ItemType<JungleWyvernBag>() , ModContent.NPCType<NPCs.Bosses.JungleWyvern.JungleWyvernHead>() },
{ ModContent.ItemType<AncientDemonBag>() , ModContent.NPCType<AncientDemon>() },
{ ModContent.ItemType<LumeliaBag>() , ModContent.NPCType<HeroofLumelia>() },
{ ModContent.ItemType<TheRageBag>() , ModContent.NPCType<TheRage>() },
{ ModContent.ItemType<TheSorrowBag>() , ModContent.NPCType<TheSorrow>() },
{ ModContent.ItemType<TheHunterBag>() , ModContent.NPCType<TheHunter>() },
{ ModContent.ItemType<WyvernMageBag>() , ModContent.NPCType<NPCs.Bosses.WyvernMage.WyvernMage>() },
{ ModContent.ItemType<SerrisBag>() , ModContent.NPCType<NPCs.Bosses.Serris.SerrisX>() },
{ ModContent.ItemType<DeathBag>() , ModContent.NPCType<NPCs.Bosses.Death>() },
{ ModContent.ItemType<MindflayerIllusionBag>() , ModContent.NPCType<NPCs.Bosses.Okiku.ThirdForm.BrokenOkiku>() },
{ ModContent.ItemType<AttraidiesBag>() , ModContent.NPCType<NPCs.Bosses.Okiku.FinalForm.Attraidies>() },
{ ModContent.ItemType<KrakenBag>() , ModContent.NPCType<NPCs.Bosses.Fiends.WaterFiendKraken>() },
{ ModContent.ItemType<MarilithBag>() , ModContent.NPCType<NPCs.Bosses.Fiends.FireFiendMarilith>() },
{ ModContent.ItemType<LichBag>() , ModContent.NPCType<NPCs.Bosses.Fiends.EarthFiendLich>() },
{ ModContent.ItemType<BlightBag>() , ModContent.NPCType<Blight>() },
{ ModContent.ItemType<ChaosBag>() , ModContent.NPCType<Chaos>() },
{ ModContent.ItemType<MageShadowBag>() , ModContent.NPCType<NPCs.Bosses.SuperHardMode.GhostWyvernMage.WyvernMageShadow>() },
{ ModContent.ItemType<OolacileSorcererBag>() , ModContent.NPCType<AbysmalOolacileSorcerer>() },
{ ModContent.ItemType<ArtoriasBag>() , ModContent.NPCType<Artorias>() },
{ ModContent.ItemType<HellkiteBag>() , ModContent.NPCType<NPCs.Bosses.SuperHardMode.HellkiteDragon.HellkiteDragonHead>() },
{ ModContent.ItemType<SeathBag>() , ModContent.NPCType<NPCs.Bosses.SuperHardMode.Seath.SeathTheScalelessHead>() },
{ ModContent.ItemType<WitchkingBag>() , ModContent.NPCType<NPCs.Bosses.SuperHardMode.Witchking>() },
{ ModContent.ItemType<DarkCloudBag>() , ModContent.NPCType<DarkCloud>() },
{ ModContent.ItemType<GwynBag>() , ModContent.NPCType<Gwyn>() }
#endregion
};
#endregion
//--------
#region RemovedBossBagLoot dictionary
RemovedBossBagLoot = new Dictionary<int, List<int>>()
{
#region Vanilla
{ ItemID.KingSlimeBossBag , new List<int>()
{
ItemID.SlimySaddle
} },
{ ItemID.EyeOfCthulhuBossBag , new List<int>() },
{ ItemID.EaterOfWorldsBossBag , new List<int>() },
{ ItemID.BrainOfCthulhuBossBag , new List<int>() },
{ ItemID.QueenBeeBossBag , new List<int>() },
{ ItemID.SkeletronBossBag , new List<int>() },
{ ItemID.WallOfFleshBossBag , new List<int>()
{
ItemID.FireWhip,
ItemID.Pwnhammer
} },
{ ItemID.DestroyerBossBag , new List<int>() },
{ ItemID.TwinsBossBag , new List<int>() },
{ ItemID.SkeletronPrimeBossBag , new List<int>() },
{ ItemID.PlanteraBossBag , new List<int>() },
{ ItemID.GolemBossBag , new List<int>()
{
ItemID.Picksaw
} },
{ ItemID.FishronBossBag , new List<int>() },
{ ItemID.CultistBossBag , new List<int>() },
{ ItemID.MoonLordBossBag , new List<int>() },
{ ItemID.QueenSlimeBossBag , new List<int>()
{
ItemID.QueenSlimeMountSaddle
} },
{ ItemID.FairyQueenBossBag , new List<int>() },
{ ItemID.BossBagBetsy , new List<int>() },
{ ItemID.DeerclopsBossBag , new List<int>() }
#endregion
};
#endregion
//--------
#region AddedBossBagLoot dictionary
AddedBossBagLoot = new Dictionary<int, List<IItemDropRule>>()
{
#region Vanilla
{ ItemID.KingSlimeBossBag , new List<IItemDropRule>() },
{ ItemID.EyeOfCthulhuBossBag , new List<IItemDropRule>()
{
ItemDropRule.Common(ItemID.HermesBoots),
ItemDropRule.Common(ItemID.HerosHat),
ItemDropRule.Common(ItemID.HerosPants),
ItemDropRule.Common(ItemID.HerosShirt)
} },
{ ItemID.EaterOfWorldsBossBag , new List<IItemDropRule>() },
{ ItemID.BrainOfCthulhuBossBag , new List<IItemDropRule>() },
{ ItemID.QueenBeeBossBag , new List<IItemDropRule>() },
{ ItemID.SkeletronBossBag , new List<IItemDropRule>()
{
ItemDropRule.Common(ModContent.ItemType<MiakodaFull>())
} },
{ ItemID.WallOfFleshBossBag , new List<IItemDropRule>()
{
ItemDropRule.Common(ItemID.MoltenPickaxe)
} },
{ ItemID.DestroyerBossBag , new List<IItemDropRule>()
{
ItemDropRule.Common(ModContent.ItemType<CrestOfCorruption>()),
ItemDropRule.Common(ModContent.ItemType<RTQ2>())
} },
{ ItemID.TwinsBossBag , new List<IItemDropRule>()
{
ItemDropRule.Common(ModContent.ItemType<CrestOfSky>())
} },
{ ItemID.SkeletronPrimeBossBag , new List<IItemDropRule>()
{
ItemDropRule.Common(ModContent.ItemType<CrestOfSteel>())
} },
{ ItemID.PlanteraBossBag , new List<IItemDropRule>()
{
ItemDropRule.Common(ModContent.ItemType<CrestOfLife>()),
ItemDropRule.Common(ModContent.ItemType<SoulOfLife>(), 1, 3, 3)
} },
{ ItemID.GolemBossBag , new List<IItemDropRule>()
{
ItemDropRule.Common(ModContent.ItemType<CrestOfStone>()),
ItemDropRule.ByCondition(tsorcItemDropRuleConditions.AdventureModeRule,
ModContent.ItemType<Items.BrokenPicksaw>()),
ItemDropRule.ByCondition(tsorcItemDropRuleConditions.NonAdventureModeRule,
ItemID.Picksaw, 3)
} },
{ ItemID.FishronBossBag , new List<IItemDropRule>() },
{ ItemID.CultistBossBag , new List<IItemDropRule>() },
{ ItemID.MoonLordBossBag , new List<IItemDropRule>() },
{ ItemID.QueenSlimeBossBag , new List<IItemDropRule>() },
{ ItemID.FairyQueenBossBag , new List<IItemDropRule>() },
{ ItemID.BossBagBetsy , new List<IItemDropRule>() },
{ ItemID.DeerclopsBossBag , new List<IItemDropRule>() }
#endregion
};
#endregion
//--------
//--------
#region CustomDungeonTiles list
CustomDungeonWalls = new bool[231];
for (int i = 0; i < 231; i++)
{
CustomDungeonWalls[i] = false;
}
CustomDungeonWalls[0] = true; //no wall
CustomDungeonWalls[34] = true; //sandstone brick wall
CustomDungeonWalls[63] = true; //flower wall
CustomDungeonWalls[65] = true; //grass wall
CustomDungeonWalls[71] = true; //ice wall
#endregion
}
public override void Unload()
{
tsorcItemDropRuleConditions.SuperHardmodeRule = null;
tsorcItemDropRuleConditions.FirstBagRule = null;
tsorcItemDropRuleConditions.CursedRule = null;
tsorcItemDropRuleConditions.FirstBagCursedRule = null;
tsorcItemDropRuleConditions.AdventureModeRule = null;
tsorcItemDropRuleConditions.NonAdventureModeRule = null;
toggleDragoonBoots = null;
reflectionShiftKey = null;
specialAbility = null;
KillAllowed = null;
BannedItems = null;
BossExtrasDescription = null;
AssignedBossExtras = null;
BossBagIDtoNPCID = null;
PlaceAllowed = null;
Unbreakable = null;
IgnoredTiles = null;
tsorcRevampWorld.Slain = null;
RemovedBossBagLoot = null;
//the following sun and moon texture changes are failsafes. they should be set back to default in PreSaveAndQuit
TextureAssets.Sun = ModContent.Request<Texture2D>("Terraria/Images/Sun", ReLogic.Content.AssetRequestMode.ImmediateLoad);
TextureAssets.Sun2 = ModContent.Request<Texture2D>("Terraria/Images/Sun2");
TextureAssets.Sun3 = ModContent.Request<Texture2D>("Terraria/Images/Sun3");
for (int i = 0; i < TextureAssets.Moon.Length; i++)
{
TextureAssets.Moon[i] = ModContent.Request<Texture2D>("Terraria/Images/Moon_" + i);
}
DarkSoulCounterUIState.ConfigInstance = null;
TransparentTextureHandler.TransparentTextures.Clear();
TransparentTextureHandler.TransparentTextures = null;
/*
for (int m = 1; m < Main.maxMusic; m++)
{
if (Main.music[m] != null)
{
if (Main.music[m].IsPlaying)
{
Main.music[m].Stop(Microsoft.Xna.Framework.Audio.AudioStopOptions.Immediate);
}
}
}*/
UnloadILs();
CustomDungeonWalls = null;
DodgerollKey = null;
//SwordflipKey = null;
/* IIRC this was to change the Destroyer's texture, which was never fully implemented?
* I think there's a new way to do it now though
if (!Main.dedServ)
{
Main.NPCLoaded[NPCID.TheDestroyer] = false;
Main.NPCLoaded[NPCID.TheDestroyerBody] = false;
Main.NPCLoaded[NPCID.TheDestroyerTail] = false;
Main.NPCLoaded[NPCID.Probe] = false;
Main.goreLoaded[156] = false;
}*/
}
public override void AddRecipes()
{
ModRecipeHelper.AddRecipes();
if (ModContent.GetInstance<tsorcRevampConfig>().AdventureModeItems)
{
RecipeHelper.EditRecipes();
}
}
public override void HandlePacket(BinaryReader reader, int whoAmI)
{
int message = reader.ReadByte(); //(byte) 1;
//Sync Soul Slot
if (message == tsorcPacketID.SyncSoulSlot)
{
byte player = reader.ReadByte(); //player.whoAmI;
tsorcRevampPlayer modPlayer = Main.player[player].GetModPlayer<tsorcRevampPlayer>();
modPlayer.SoulSlot.Item = ItemIO.Receive(reader);
if (Main.netMode == NetmodeID.Server)
{
modPlayer.SendSingleItemPacket(1, modPlayer.SoulSlot.Item, -1, whoAmI);
}
}
//Sync Event Dust
else if (message == tsorcPacketID.SyncEventDust)
{
if (Main.netMode != NetmodeID.Server)
{
tsorcScriptedEvents.NetworkEvents = new List<NetworkEvent>();
int count = reader.ReadInt32();
for (int i = 0; i < count; i++)
{
Vector2 center = reader.ReadVector2();
float radius = reader.ReadSingle();
int dustID = reader.ReadInt32();
bool square = reader.ReadBoolean();
tsorcScriptedEvents.NetworkEvents.Add(new NetworkEvent(center, radius, dustID, square));
}
}
}
//Sync time change
else if (message == tsorcPacketID.SyncTimeChange)
{
if (Main.netMode == NetmodeID.Server)
{
Main.dayTime = !Main.dayTime;
Main.time = 0;
if (Main.dayTime)
{
UsefulFunctions.BroadcastText("You shift time forward and a new day begins...", new Color(175, 75, 255));
}
else UsefulFunctions.BroadcastText("You shift time forward and a new night begins...", new Color(175, 75, 255));
NetMessage.SendData(MessageID.WorldData);
}
}
else if (message == tsorcPacketID.DispelShadow)
{
int npcID = reader.ReadInt32();
Main.npc[npcID].AddBuff(ModContent.BuffType<Buffs.DispelShadow>(), 36000);
}