-
Notifications
You must be signed in to change notification settings - Fork 10
/
CWRLoad.cs
649 lines (594 loc) · 27 KB
/
CWRLoad.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
using CalamityMod.Items.LoreItems;
using CalamityMod.Items.Materials;
using CalamityMod.Items.PermanentBoosters;
using CalamityMod.NPCs.Abyss;
using CalamityMod.NPCs.AquaticScourge;
using CalamityMod.NPCs.AstrumAureus;
using CalamityMod.NPCs.AstrumDeus;
using CalamityMod.NPCs.DesertScourge;
using CalamityMod.NPCs.DevourerofGods;
using CalamityMod.NPCs.DraedonLabThings;
using CalamityMod.NPCs.ExoMechs.Apollo;
using CalamityMod.NPCs.ExoMechs.Ares;
using CalamityMod.NPCs.ExoMechs.Artemis;
using CalamityMod.NPCs.ExoMechs.Thanatos;
using CalamityMod.NPCs.HiveMind;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.NPCs.Perforator;
using CalamityMod.NPCs.PlaguebringerGoliath;
using CalamityMod.NPCs.Polterghast;
using CalamityMod.NPCs.PrimordialWyrm;
using CalamityMod.NPCs.Ravager;
using CalamityMod.NPCs.StormWeaver;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.NPCs.Yharon;
using CalamityMod.Projectiles.Typeless;
using CalamityOverhaul.Content.Items.Materials;
using CalamityOverhaul.Content.Items.Melee;
using CalamityOverhaul.Content.Items.Placeable;
using CalamityOverhaul.Content.Items.Rogue.Extras;
using CalamityOverhaul.Content.Items.Tools;
using CalamityOverhaul.Content.NPCs.BrutalNPCs.BrutalMechanicalEye;
using CalamityOverhaul.Content.Projectiles.Weapons.Melee.MurasamaProj;
using CalamityOverhaul.Content.Projectiles.Weapons.Ranged.Core;
using CalamityOverhaul.Content.Projectiles.Weapons.Ranged.HeavenfallLongbowProj;
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
namespace CalamityOverhaul
{
public static class CWRLoad
{
#region Data
public static bool OnLoadContentBool;
public static int DarkMatterBall;
public static int BlackMatterStick;
public static int DubiousPlating;
public static int FoodStallChair;
public static int FoodStallChairTile;
public static int Gangarus;
#region OtherMods
public static int EternitySoul;
public static int DevisCurse;
public static int DeviatingEnergy;
public static int AbomEnergy;
public static int EternalEnergy;
public static int MetanovaBar;
#endregion
public static int InfiniteArrow;
public static int InfiniteRune;
public static int ParadiseArrow;
public static int HeavenLightning;
public static int Projectile_ArcZap;
/// <summary>
/// 关于哪些物品应该被设置为64的最大堆叠数
/// </summary>
public static int[] AddMaxStackItemsIn64 { get; private set; } = [];
/// <summary>
/// 扫地机器人
/// </summary>
public static int Androomba;
/// <summary>
/// 瘟疫使者
/// </summary>
public static int PlaguebringerGoliath;
/// <summary>
/// 噬魂幽花
/// </summary>
public static int Polterghast;
/// <summary>
/// 丛林龙
/// </summary>
public static int Yharon;
/// <summary>
/// 灾坟虫
/// </summary>
public static List<int> targetNpcTypes;
public static int SepulcherHead;
public static int SepulcherBody;
public static int SepulcherTail;
/// <summary>
/// 风暴吞噬者
/// </summary>
public static List<int> targetNpcTypes2;
public static int StormWeaverHead;
public static int StormWeaverBody;
public static int StormWeaverTail;
/// <summary>
/// 幻海妖龙
/// </summary>
public static List<int> targetNpcTypes3;
public static int PrimordialWyrmHead;
public static int PrimordialWyrmBody;
public static int PrimordialWyrmTail;
/// <summary>
/// 血肉宿主
/// </summary>
public static int PerforatorHive;
/// <summary>
/// 腐巢意志
/// </summary>
public static int HiveMind;
/// <summary>
/// 血肉蠕虫
/// </summary>
public static List<int> targetNpcTypes4;
public static int PerforatorHeadLarge;
public static int PerforatorBodyLarge;
public static int PerforatorTailLarge;
/// <summary>
/// 血肉蠕虫2
/// </summary>
public static List<int> targetNpcTypes5;
public static int PerforatorHeadMedium;
public static int PerforatorBodyMedium;
public static int PerforatorTailMedium;
/// <summary>
/// 装甲掘地虫
/// </summary>
public static List<int> targetNpcTypes6;
public static int ArmoredDiggerHead;
public static int ArmoredDiggerBody;
public static int ArmoredDiggerTail;
/// <summary>
/// 星流巨械
/// </summary>
public static List<int> targetNpcTypes7;
public static List<int> targetNpcTypes7_1;
public static int Apollo;
public static int Artemis;
public static int AresBody;
public static int AresLaserCannon;
public static int AresPlasmaFlamethrower;
public static int AresTeslaCannon;
public static int AresGaussNuke;
public static int ThanatosHead;
public static int ThanatosBody1;
public static int ThanatosBody2;
public static int ThanatosTail;
/// <summary>
/// 神明吞噬者
/// </summary>
public static List<int> targetNpcTypes8;
public static int DevourerofGodsHead;
public static int DevourerofGodsBody;
public static int DevourerofGodsTail;
public static int CosmicGuardianHead;
public static int CosmicGuardianBody;
public static int CosmicGuardianTail;
/// <summary>
/// 荒漠灾虫
/// </summary>
public static List<int> targetNpcTypes9;
public static int DesertScourgeHead;
public static int DesertScourgeBody;
public static int DesertScourgeTail;
public static int DesertNuisanceHead;
public static int DesertNuisanceBody;
public static int DesertNuisanceTail;
public static int DesertNuisanceHeadYoung;
public static int DesertNuisanceBodyYoung;
public static int DesertNuisanceTailYoung;
/// <summary>
/// 星神游龙
/// </summary>
public static List<int> targetNpcTypes10;
public static int AstrumDeusHead;
public static int AstrumDeusBody;
public static int AstrumDeusTail;
/// <summary>
/// 渊海灾虫
/// </summary>
public static List<int> targetNpcTypes11;
public static int AquaticScourgeHead;
public static int AquaticScourgeBody;
public static int AquaticScourgeTail;
/// <summary>
/// 幻海妖龙幼年体
/// </summary>
public static List<int> targetNpcTypes12;
public static int EidolonWyrmHead;
public static int EidolonWyrmBody;
public static int EidolonWyrmBodyAlt;
public static int EidolonWyrmTail;
/// <summary>
/// 白金星舰
/// </summary>
public static int AstrumAureus;
/// <summary>
/// 月球领主
/// </summary>
public static List<int> targetNpcTypes13;
/// <summary>
/// 世界吞噬者
/// </summary>
public static List<int> targetNpcTypes14;
/// <summary>
/// 毁灭者
/// </summary>
public static List<int> targetNpcTypes15;
/// <summary>
/// 毁灭魔像
/// </summary>
public static List<int> targetNpcTypes16;
public static int RavagerBody;
public static int RavagerClawLeft;
public static int RavagerClawRight;
public static int RavagerHead;
public static int RavagerLegLeft;
public static int RavagerLegRight;
/// <summary>
/// 血肉蠕虫3
/// </summary>
public static List<int> targetNpcTypes17;
public static int PerforatorHeadSmall;
public static int PerforatorBodySmall;
public static int PerforatorTailSmall;
/// <summary>
/// 蠕虫类体节
/// </summary>
public static int[] WormBodys { get; private set; }
/// <summary>
/// 物块对应掉落物的词典
/// </summary>
public static Dictionary<int, int> TileToItem { get; private set; } = [];
/// <summary>
/// 墙体对应掉落物的词典
/// </summary>
public static Dictionary<int, int> WallToItem { get; private set; } = [];
/// <summary>
/// 该物品是否是一把枪械
/// </summary>
internal static Dictionary<int, bool> ItemIsGun { get; private set; } = [];
/// <summary>
/// 该物品是否是一个弓
/// </summary>
internal static Dictionary<int, bool> ItemIsBow { get; private set; } = [];
/// <summary>
/// 该物品是否是一个基本的远程类
/// </summary>
internal static Dictionary<int, bool> ItemIsRanged { get; private set; } = [];
/// <summary>
/// 该物品是否是一个基本的远程类,并且可以右键开火使用
/// </summary>
internal static Dictionary<int, bool> ItemIsRangedAndCanRightClickFire { get; private set; } = [];
/// <summary>
/// 获取一个弓类的箭族数量
/// </summary>
internal static Dictionary<int, int> ItemIsBowAndArrowNum { get; private set; } = [];
/// <summary>
/// 该枪械是否必定消耗弹药
/// </summary>
internal static Dictionary<int, bool> ItemIsGunAndMustConsumeAmmunition { get; private set; } = [];
/// <summary>
/// 获取一个枪械的后坐力数值
/// </summary>
internal static Dictionary<int, float> ItemIsGunAndGetRecoilValue { get; private set; } = [];
/// <summary>
/// 获取一个枪械的后坐力数值所对于的本地化描述键
/// </summary>
internal static Dictionary<int, string> ItemIsGunAndGetRecoilLocKey { get; private set; } = [];
/// <summary>
/// 根据<see cref="Item.useAmmo"/>映射到对应的物品id之上
/// </summary>
internal static Dictionary<int, int> AmmoIDToItemIDMapping { get; private set; } = [];
#endregion
public static class NPCValue
{
/// <summary>
/// 是否是一个金属性质的存在
/// </summary>
public static Dictionary<int, bool> TheofSteel = [];
/// <summary>
/// 是否免疫冻结
/// </summary>
public static Dictionary<int, bool> ImmuneFrozen = [];
public static bool ISTheofSteel(int type) {
if (type == NPCID.Spazmatism && SpazmatismAI.Accompany) {
return true;
}
if (type == NPCID.Retinazer && RetinazerAI.Accompany) {
return true;
}
return TheofSteel[type];
}
}
public static class ProjValue
{
/// <summary>
/// 是否免疫冻结
/// </summary>
public static Dictionary<int, bool> ImmuneFrozen = [];
}
public static void Setup() {
#region ID
InfiniteArrow = ProjectileType<InfiniteArrow>();
InfiniteRune = ProjectileType<InfiniteArrow>();
ParadiseArrow = ProjectileType<InfiniteArrow>();
HeavenLightning = ProjectileType<InfiniteArrow>();
DubiousPlating = ItemType<DubiousPlating>();
DarkMatterBall = ItemType<DarkMatterBall>();
BlackMatterStick = ItemType<BlackMatterStick>();
FoodStallChair = ItemType<FoodStallChair>();
FoodStallChairTile = TileType<Content.Tiles.FoodStallChair>();
Gangarus = ItemType<Gangarus>();
Androomba = NPCType<Androomba>();
Polterghast = NPCType<Polterghast>();
Yharon = NPCType<Yharon>();
PlaguebringerGoliath = NPCType<PlaguebringerGoliath>();
PerforatorHive = NPCType<PerforatorHive>();
HiveMind = NPCType<HiveMind>();
SepulcherHead = NPCType<SepulcherHead>();
SepulcherBody = NPCType<SepulcherBody>();
SepulcherTail = NPCType<SepulcherTail>();
StormWeaverHead = NPCType<StormWeaverHead>();
StormWeaverBody = NPCType<StormWeaverBody>();
StormWeaverTail = NPCType<StormWeaverTail>();
PrimordialWyrmHead = NPCType<PrimordialWyrmHead>();
PrimordialWyrmBody = NPCType<PrimordialWyrmBody>();
PrimordialWyrmTail = NPCType<PrimordialWyrmTail>();
PerforatorHeadLarge = NPCType<PerforatorHeadLarge>();
PerforatorBodyLarge = NPCType<PerforatorBodyLarge>();
PerforatorTailLarge = NPCType<PerforatorTailLarge>();
PerforatorHeadMedium = NPCType<PerforatorHeadMedium>();
PerforatorBodyMedium = NPCType<PerforatorBodyMedium>();
PerforatorTailMedium = NPCType<PerforatorTailMedium>();
AstrumAureus = NPCType<AstrumAureus>();
ArmoredDiggerHead = NPCType<ArmoredDiggerHead>();
ArmoredDiggerBody = NPCType<ArmoredDiggerBody>();
ArmoredDiggerTail = NPCType<ArmoredDiggerTail>();
Apollo = NPCType<Apollo>();
Artemis = NPCType<Artemis>();
AresBody = NPCType<AresBody>();
ThanatosHead = NPCType<ThanatosHead>();
ThanatosBody1 = NPCType<ThanatosBody1>();
ThanatosBody2 = NPCType<ThanatosBody2>();
ThanatosTail = NPCType<ThanatosTail>();
DevourerofGodsHead = NPCType<DevourerofGodsHead>();
DevourerofGodsBody = NPCType<DevourerofGodsBody>();
DevourerofGodsTail = NPCType<DevourerofGodsTail>();
CosmicGuardianHead = NPCType<CosmicGuardianHead>();
CosmicGuardianBody = NPCType<CosmicGuardianBody>();
CosmicGuardianTail = NPCType<CosmicGuardianTail>();
DesertScourgeHead = NPCType<DesertScourgeHead>();
DesertScourgeBody = NPCType<DesertScourgeBody>();
DesertScourgeTail = NPCType<DesertScourgeTail>();
DesertNuisanceHead = NPCType<DesertNuisanceHead>();
DesertNuisanceBody = NPCType<DesertNuisanceBody>();
DesertNuisanceTail = NPCType<DesertNuisanceTail>();
DesertNuisanceHeadYoung = NPCType<DesertNuisanceHeadYoung>();
DesertNuisanceBodyYoung = NPCType<DesertNuisanceBodyYoung>();
DesertNuisanceTailYoung = NPCType<DesertNuisanceTailYoung>();
AstrumDeusHead = NPCType<AstrumDeusHead>();
AstrumDeusBody = NPCType<AstrumDeusBody>();
AstrumDeusTail = NPCType<AstrumDeusTail>();
AquaticScourgeHead = NPCType<AquaticScourgeHead>();
AquaticScourgeBody = NPCType<AquaticScourgeBody>();
AquaticScourgeTail = NPCType<AquaticScourgeTail>();
EidolonWyrmHead = NPCType<EidolonWyrmHead>();
EidolonWyrmBody = NPCType<EidolonWyrmBody>();
EidolonWyrmBodyAlt = NPCType<EidolonWyrmBodyAlt>();
EidolonWyrmTail = NPCType<EidolonWyrmTail>();
RavagerBody = NPCType<RavagerBody>();
RavagerClawLeft = NPCType<RavagerClawLeft>();
RavagerClawRight = NPCType<RavagerClawRight>();
RavagerHead = NPCType<RavagerHead>();
RavagerLegLeft = NPCType<RavagerLegLeft>();
RavagerLegRight = NPCType<RavagerLegRight>();
AresLaserCannon = NPCType<AresLaserCannon>();
AresPlasmaFlamethrower = NPCType<AresPlasmaFlamethrower>();
AresTeslaCannon = NPCType<AresTeslaCannon>();
AresGaussNuke = NPCType<AresGaussNuke>();
PerforatorHeadSmall = NPCType<PerforatorHeadSmall>();
PerforatorBodySmall = NPCType<PerforatorBodySmall>();
PerforatorTailSmall = NPCType<PerforatorTailSmall>();
Projectile_ArcZap = ProjectileType<ArcZap>();
MurasamaEcType.heldProjType = ProjectileType<MurasamaHeld>();
#endregion
#region List
targetNpcTypes = [SepulcherHead, SepulcherBody, SepulcherTail];
targetNpcTypes2 = [StormWeaverHead, StormWeaverBody, StormWeaverTail];
targetNpcTypes3 = [PrimordialWyrmHead, PrimordialWyrmBody, PrimordialWyrmTail];
targetNpcTypes4 = [PerforatorHeadLarge, PerforatorBodyLarge, PerforatorTailLarge];
targetNpcTypes5 = [PerforatorHeadMedium, PerforatorBodyMedium, PerforatorTailMedium];
targetNpcTypes6 = [ArmoredDiggerHead, ArmoredDiggerBody, ArmoredDiggerTail];
targetNpcTypes7 = [Apollo, Artemis, AresBody, ThanatosHead, ThanatosBody1, ThanatosBody2, ThanatosTail];
targetNpcTypes7_1 = [AresBody, AresLaserCannon, AresPlasmaFlamethrower, AresTeslaCannon, AresGaussNuke];
targetNpcTypes8 = [DevourerofGodsHead, DevourerofGodsBody, DevourerofGodsTail, CosmicGuardianHead, CosmicGuardianBody, CosmicGuardianTail];
targetNpcTypes9 = [DesertScourgeHead, DesertScourgeBody, DesertScourgeTail, DesertNuisanceHead, DesertNuisanceBody, DesertNuisanceTail];
targetNpcTypes10 = [AstrumDeusHead, AstrumDeusBody, AstrumDeusTail];
targetNpcTypes11 = [AquaticScourgeHead, AquaticScourgeBody, AquaticScourgeTail];
targetNpcTypes12 = [EidolonWyrmHead, EidolonWyrmBody, EidolonWyrmBodyAlt, EidolonWyrmTail];
targetNpcTypes13 = [NPCID.MoonLordFreeEye, NPCID.MoonLordCore, NPCID.MoonLordHand, NPCID.MoonLordHead, NPCID.MoonLordLeechBlob];
targetNpcTypes14 = [NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail];
targetNpcTypes15 = [NPCID.TheDestroyer, NPCID.TheDestroyerBody, NPCID.TheDestroyerTail];
targetNpcTypes16 = [RavagerBody, RavagerClawLeft, RavagerClawRight, RavagerHead, RavagerLegLeft, RavagerLegRight];
targetNpcTypes17 = [PerforatorHeadSmall, PerforatorBodySmall, PerforatorTailSmall];
WormBodys = [ AquaticScourgeBody, StormWeaverBody, ArmoredDiggerBody, DesertScourgeBody, DesertNuisanceBody,
DesertNuisanceBodyYoung, CosmicGuardianBody, PrimordialWyrmBody, ThanatosBody1, ThanatosBody2, DevourerofGodsBody, AstrumDeusBody
, SepulcherBody, PerforatorBodyLarge, PerforatorBodyMedium, PerforatorBodySmall, NPCID.TheDestroyerBody, NPCID.EaterofWorldsBody];
AmmoIDToItemIDMapping = new Dictionary<int, int>
{
{ AmmoID.FallenStar, ItemID.FallenStar },
{ AmmoID.Gel, ItemID.Gel },
{ AmmoID.Arrow, ItemID.WoodenArrow },
{ AmmoID.Coin, ItemID.CopperCoin },
{ AmmoID.Bullet, ItemID.MusketBall },
{ AmmoID.Sand, ItemID.SandBlock },
{ AmmoID.Dart, ItemID.PoisonDart },
{ AmmoID.Rocket, ItemID.RocketI },
{ AmmoID.Flare, ItemID.Flare },
{ AmmoID.Snowball, ItemID.Snowball },
{ AmmoID.StyngerBolt, ItemID.StyngerBolt },
{ AmmoID.CandyCorn, ItemID.CandyCorn },
{ AmmoID.JackOLantern, ItemID.JackOLantern },
{ AmmoID.Stake, ItemID.Stake },
{ AmmoID.NailFriendly, ItemID.Nail },
{ AmmoID.None, ItemID.MusketBall }
};
AddMaxStackItemsIn64 = [
ItemType<BloodOrange>(),
ItemType<MiracleFruit>(),
ItemType<Elderberry>(),
ItemType<Dragonfruit>(),
ItemType<LoreCynosure>(),
];
#endregion
if (CWRMod.Instance.fargowiltasSouls != null) {
EternitySoul = CWRMod.Instance.fargowiltasSouls.Find<ModItem>("EternitySoul").Type;
DevisCurse = CWRMod.Instance.fargowiltasSouls.Find<ModItem>("DevisCurse").Type;
DeviatingEnergy = CWRMod.Instance.fargowiltasSouls.Find<ModItem>("DeviatingEnergy").Type;
AbomEnergy = CWRMod.Instance.fargowiltasSouls.Find<ModItem>("AbomEnergy").Type;
EternalEnergy = CWRMod.Instance.fargowiltasSouls.Find<ModItem>("EternalEnergy").Type;
}
if (CWRMod.Instance.catalystMod != null) {
MetanovaBar = CWRMod.Instance.catalystMod.Find<ModItem>("MetanovaBar").Type;
}
for (int itemType = 0; itemType < ItemLoader.ItemCount; itemType++) {
Item item = new Item(itemType);
ItemIsGun[itemType] = false;
ItemIsGunAndMustConsumeAmmunition[itemType] = false;
ItemIsGunAndGetRecoilValue[itemType] = 1.2f;
ItemIsGunAndGetRecoilLocKey[itemType] = "";
ItemIsBow[itemType] = false;
ItemIsBowAndArrowNum[itemType] = 1;
ItemIsRanged[itemType] = false;
ItemIsRangedAndCanRightClickFire[itemType] = false;
if (item != null && item.type != ItemID.None) {//验证物品是否有效
if (item.createTile != -1 && !TileToItem.ContainsKey(item.createTile)) {
TileToItem.Add(item.createTile, item.type);
}
if (item.createWall != -1 && !WallToItem.ContainsKey(item.createWall)) {
WallToItem.Add(item.createWall, item.type);
}
int heldProjType = item.CWR().heldProjType;
if (heldProjType > 0) {
Projectile heldProj = new Projectile();
heldProj.SetDefaults(heldProjType);
if (heldProj.ModProjectile != null) {
if (heldProj.ModProjectile is BaseGun gun) {
ItemIsGun[itemType] = true;
ItemIsGunAndMustConsumeAmmunition[itemType] = gun.MustConsumeAmmunition;
ItemIsGunAndGetRecoilValue[itemType] = gun.Recoil;
ItemIsGunAndGetRecoilLocKey[itemType] = GetLckRecoilKey(gun.Recoil);
}
if (heldProj.ModProjectile is BaseBow bow) {
ItemIsBow[itemType] = true;
ItemIsBowAndArrowNum[itemType] = bow.BowArrowDrawNum;
}
if (heldProj.ModProjectile is BaseHeldRanged ranged) {
ItemIsRanged[itemType] = true;
ItemIsRangedAndCanRightClickFire[itemType] = ranged.CanRightClick;
}
}
}
}
}
for (int i = 0; i < NPCLoader.NPCCount; i++) {
NPC npc = new NPC();
npc.SetDefaults(i);
bool isSteel = false;
if (npc.HitSound == SoundID.NPCHit2
|| npc.HitSound == SoundID.NPCHit3 || npc.HitSound == SoundID.NPCHit4
|| npc.HitSound == SoundID.NPCHit41 || npc.HitSound == SoundID.NPCHit42
|| targetNpcTypes10.Contains(npc.type) || targetNpcTypes15.Contains(npc.type)
|| targetNpcTypes7.Contains(npc.type) || targetNpcTypes7_1.Contains(npc.type)
|| targetNpcTypes6.Contains(npc.type) || targetNpcTypes7_1.Contains(npc.type)
|| npc.type == AstrumAureus) {
isSteel = true;
}
NPCValue.TheofSteel.TryAdd(i, isSteel);
NPCValue.ImmuneFrozen.TryAdd(i, false);
}
for (int i = 0; i < ProjectileLoader.ProjectileCount; i++) {
ProjValue.ImmuneFrozen.TryAdd(i, false);
}
OnLoadContentBool = true;
}
public static void UnLoad() {
TileToItem?.Clear();
WallToItem?.Clear();
ItemIsGun?.Clear();
ItemIsBow?.Clear();
ItemIsRanged?.Clear();
ItemIsRangedAndCanRightClickFire?.Clear();
ItemIsBowAndArrowNum?.Clear();
ItemIsGunAndMustConsumeAmmunition?.Clear();
ItemIsGunAndGetRecoilValue?.Clear();
ItemIsGunAndGetRecoilLocKey?.Clear();
NPCValue.TheofSteel?.Clear();
ProjValue.ImmuneFrozen?.Clear();
}
public static string GetLckRecoilKey(float recoil) {
float recoilValue = Math.Abs(recoil);
if (recoilValue == 0) {
return "CWRGun_Recoil_Level_0";
}
else if (recoilValue < 0.1f) {
return "CWRGun_Recoil_Level_1";
}
else if (recoilValue < 0.5f) {
return "CWRGun_Recoil_Level_2";
}
else if (recoilValue < 1.5f) {
return "CWRGun_Recoil_Level_3";
}
else if (recoilValue < 2.2f) {
return "CWRGun_Recoil_Level_4";
}
else if (recoilValue < 3.2f) {
return "CWRGun_Recoil_Level_5";
}
return "CWRGun_Recoil_Level_6";
}
/// <summary>
/// 修改一些原弹药设定异常的物品的shoot值
/// </summary>
/// <param name="ammoItem"></param>
public static void SetAmmoItem(Item ammoItem) {
ref int ammoTypes = ref ammoItem.shoot;
if (ammoItem.type == ItemID.FallenStar) {
ammoTypes = ProjectileID.StarCannonStar;
}
else if (ammoItem.type == ItemID.RocketI) {
ammoTypes = ProjectileID.RocketI;
}
else if (ammoItem.type == ItemID.RocketII) {
ammoTypes = ProjectileID.RocketII;
}
else if (ammoItem.type == ItemID.RocketIII) {
ammoTypes = ProjectileID.RocketIII;
}
else if (ammoItem.type == ItemID.RocketIV) {
ammoTypes = ProjectileID.RocketIV;
}
else if (ammoItem.type == ItemID.ClusterRocketI) {
ammoTypes = ProjectileID.ClusterRocketI;
}
else if (ammoItem.type == ItemID.ClusterRocketII) {
ammoTypes = ProjectileID.ClusterRocketII;
}
else if (ammoItem.type == ItemID.DryRocket) {
ammoTypes = ProjectileID.DryRocket;
}
else if (ammoItem.type == ItemID.WetRocket) {
ammoTypes = ProjectileID.WetRocket;
}
else if (ammoItem.type == ItemID.HoneyRocket) {
ammoTypes = ProjectileID.HoneyRocket;
}
else if (ammoItem.type == ItemID.LavaRocket) {
ammoTypes = ProjectileID.LavaRocket;
}
else if (ammoItem.type == ItemID.MiniNukeI) {
ammoTypes = ProjectileID.MiniNukeRocketI;
}
else if (ammoItem.type == ItemID.MiniNukeII) {
ammoTypes = ProjectileID.MiniNukeRocketII;
}
}
}
}