Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Player.cs
Go to the documentation of this file.
1using System;
3using System.IO;
5using System.Text;
7using Microsoft.Xna.Framework.Input;
10using Terraria.Chat;
12using Terraria.Enums;
28using Terraria.ID;
29using Terraria.IO;
32using Terraria.Social;
33using Terraria.UI;
38
39namespace Terraria;
40
42{
43 public static class BuilderAccToggleIDs
44 {
45 public const int RulerLine = 0;
46
47 public const int RulerGrid = 1;
48
49 public const int AutoActuate = 2;
50
51 public const int AutoPaint = 3;
52
53 public const int WireVisibility_Red = 4;
54
55 public const int WireVisibility_Green = 5;
56
57 public const int WireVisibility_Blue = 6;
58
59 public const int WireVisibility_Yellow = 7;
60
61 public const int HideAllWires = 8;
62
63 public const int WireVisibility_Actuators = 9;
64
65 public const int BlockSwap = 10;
66
67 public const int TorchBiome = 11;
68
69 public static readonly int Count = 12;
70 }
71
73 {
74 public bool controlLeft;
75
76 public bool controlRight;
77
78 public bool controlUp;
79
80 public bool controlDown;
81
83 {
84 controlLeft = player.controlLeft;
86 controlUp = player.controlUp;
87 controlDown = player.controlDown;
88 }
89
90 public void ApplyTo(Player player)
91 {
92 player.controlLeft = controlLeft;
93 player.controlRight = controlRight;
94 player.controlUp = controlUp;
95 player.controlDown = controlDown;
96 }
97 }
98
99 private struct ChannelCancelKey
100 {
102
104
105 public bool Matches(Projectile projectile)
106 {
107 if (ProjectileTypeExpected == projectile.type)
108 {
109 return ProjectileIndexExpected == projectile.whoAmI;
110 }
111 return false;
112 }
113
114 public void TryTracking(Projectile projectile)
115 {
116 if (ProjectileTypeExpected == projectile.type)
117 {
118 ProjectileIndexExpected = projectile.whoAmI;
119 }
120 }
121 }
122
124 {
125 public int DisplayFrame;
126
127 private int _frameCounter;
128
129 private int _aiState;
130
131 private const int AIState_Idle = 0;
132
133 private const int AIState_LookingAtCamera = 1;
134
135 private const int AIState_Resting = 2;
136
137 private const int AIState_EatingCarrot = 3;
138
139 public void Update()
140 {
141 switch (_aiState)
142 {
143 case 0:
144 UpdateFrame(0, 0, Main.rand.Next(1, 4), Main.rand.Next(180, 3600));
145 break;
146 case 1:
147 UpdateFrame(7, 9, 0, 20);
148 break;
149 case 2:
150 {
152 if (DisplayFrame == 13)
153 {
155 }
157 break;
158 }
159 case 3:
160 UpdateFrame(17, 26, 0, 4);
161 break;
162 }
163 }
164
165 public void Reset()
166 {
168 }
169
170 private void ChangeToAIState(int aiState)
171 {
173 _frameCounter = 0;
174 Update();
175 }
176
189 }
190
192 {
193 Full,
194 None,
195 Quarter,
197 }
198
199 public struct CompositeArmData
200 {
201 public bool enabled;
202
204
205 public float rotation;
206
208 {
209 this.enabled = enabled;
211 this.rotation = rotation;
212 }
213 }
214
216
217 public struct SetMatchRequest
218 {
219 public int Head;
220
221 public int Body;
222
223 public int Legs;
224
226
227 public bool Male;
228 }
229
230 public struct ItemSpaceStatus
231 {
232 public readonly bool CanTakeItem;
233
234 public readonly bool ItemIsGoingToVoidVault;
235
237 {
238 get
239 {
240 if (CanTakeItem)
241 {
243 }
244 return false;
245 }
246 }
247
249 {
250 this.CanTakeItem = CanTakeItem;
251 this.ItemIsGoingToVoidVault = ItemIsGoingToVoidVault;
252 }
253 }
254
255 public struct ItemCheckContext
256 {
258 }
259
261 {
263
265
266 public bool IsAValidTool;
267
268 public CanUseToolCondition UsageCondition;
269
270 public UseToolAction UsageAction;
271 }
272
281
283 {
284 public bool mostlySolidFloor;
285
286 public bool avoidLava;
287
288 public bool avoidAnyLiquid;
289
290 public bool avoidHurtTiles;
291
292 public bool avoidWalls;
293
295
297 }
298
299 public static class Hooks
300 {
301 public static event Action<Player> OnEnterWorld;
302
303 public static void PlayerConnect(int playerIndex)
304 {
306 }
307
308 public static void PlayerDisconnect(int playerIndex)
309 {
311 }
312
313 public static void EnterWorld(int playerIndex)
314 {
315 if (Hooks.OnEnterWorld != null)
316 {
318 }
320 {
322 }
323 }
324 }
325
327 {
328 public static bool SmartBlocksEnabled;
329
330 public static bool SmartAxeAfterPickaxe;
331
333 }
334
335 public class Settings
336 {
338 {
339 Hold,
340 Click
341 }
342
344
345 public static void CycleHoverControl()
346 {
347 switch (HoverControl)
348 {
349 case HoverControlMode.Hold:
351 break;
352 case HoverControlMode.Click:
354 break;
355 }
356 }
357 }
358
359 public class SelectionRadial
360 {
361 public enum SelectionMode
362 {
363 Dpad4,
366 }
367
368 private int _SelectedBinding = -1;
369
370 public int RadialCount;
371
372 public int[] Bindings;
373
375
377
378 public int SelectedItem
379 {
380 get
381 {
382 if (_SelectedBinding == -1)
383 {
384 return -1;
385 }
387 }
388 }
389
391 {
392 Mode = mode;
393 int radialCount = 0;
394 switch (mode)
395 {
396 case SelectionMode.Dpad4:
397 radialCount = 4;
398 break;
399 case SelectionMode.RadialCircular:
400 radialCount = 10;
401 break;
402 case SelectionMode.RadialQuicks:
403 radialCount = 4;
404 break;
405 }
407 Bindings = new int[RadialCount];
408 for (int i = 0; i < RadialCount; i++)
409 {
410 Bindings[i] = -1;
411 }
412 }
413
414 public void Update()
415 {
416 switch (Mode)
417 {
418 case SelectionMode.Dpad4:
419 if (PlayerInput.Triggers.JustPressed.DpadRadial1)
420 {
422 }
423 if (PlayerInput.Triggers.JustPressed.DpadRadial2)
424 {
426 }
427 if (PlayerInput.Triggers.JustPressed.DpadRadial3)
428 {
430 }
431 if (PlayerInput.Triggers.JustPressed.DpadRadial4)
432 {
434 }
435 break;
436 case SelectionMode.RadialCircular:
437 case SelectionMode.RadialQuicks:
438 {
439 for (int i = 0; i < RadialCount; i++)
440 {
441 Bindings[i] = i;
442 }
443 if ((Mode != SelectionMode.RadialCircular || !PlayerInput.Triggers.Current.RadialHotbar) && (Mode != SelectionMode.RadialQuicks || !PlayerInput.Triggers.Current.RadialQuickbar))
444 {
445 break;
446 }
447 bool flag = Mode == SelectionMode.RadialCircular;
448 float num = (float)Math.PI * 2f / (float)RadialCount / 2f;
449 Vector2 vector = PlayerInput.GamepadThumbstickRight.RotatedBy(-(float)Math.PI / 2f + num);
450 if (vector.Length() == 0f)
451 {
452 vector = PlayerInput.GamepadThumbstickLeft.RotatedBy(-(float)Math.PI / 2f + num);
453 }
454 int num2 = -1;
455 if (vector.Length() > 0.3f)
456 {
457 num2 = (int)((vector.ToRotation() + (float)Math.PI) / ((float)Math.PI * 2f / (float)RadialCount));
458 if (num2 >= RadialCount)
459 {
460 num2 -= RadialCount;
461 }
462 }
463 if ((num2 != -1 || !flag) && _SelectedBinding != num2 && (num2 != -1 || !(vector != Vector2.Zero)))
464 {
466 }
467 break;
468 }
469 }
470 }
471
472 public void ChangeBinding(int itemSlot)
473 {
474 if (itemSlot >= 0 && itemSlot < 50 && Mode == SelectionMode.Dpad4)
475 {
476 if (PlayerInput.Triggers.JustPressed.DpadRadial1)
477 {
478 Bind(itemSlot, 0);
479 }
480 if (PlayerInput.Triggers.JustPressed.DpadRadial2)
481 {
482 Bind(itemSlot, 1);
483 }
484 if (PlayerInput.Triggers.JustPressed.DpadRadial3)
485 {
486 Bind(itemSlot, 2);
487 }
488 if (PlayerInput.Triggers.JustPressed.DpadRadial4)
489 {
490 Bind(itemSlot, 3);
491 }
492 }
493 }
494
495 public void ChangeSelection(int to)
496 {
497 if (_SelectedBinding == to)
498 {
499 _SelectedBinding = -1;
500 }
501 else
502 {
504 }
505 }
506
507 private void Bind(int itemslot, int radialslot)
508 {
509 ChangeSelection(-1);
511 {
512 Bindings[radialslot] = -1;
513 return;
514 }
515 for (int i = 0; i < RadialCount; i++)
516 {
517 if (Bindings[i] == itemslot)
518 {
519 Bindings[i] = -1;
520 }
521 }
523 }
524
525 public int GetDrawMode(int itemslot)
526 {
528 {
529 return 2;
530 }
531 for (int i = 0; i < RadialCount; i++)
532 {
533 if (Bindings[i] == itemslot)
534 {
535 return 1;
536 }
537 }
538 return 0;
539 }
540
542 {
543 that._SelectedBinding = _SelectedBinding;
544 that.Mode = Mode;
545 that.RadialCount = RadialCount;
546 Array.Resize(ref that.Bindings, RadialCount);
547 for (int i = 0; i < RadialCount; i++)
548 {
549 that.Bindings[i] = Bindings[i];
550 }
551 }
552 }
553
554 public struct OverheadMessage
555 {
556 public string chatText;
557
559
561
562 public int timeLeft;
563
564 public Color color;
565
566 public void NewMessage(string message, int displayTime)
567 {
568 chatText = message;
572 }
573 }
574
575 public int emoteTime;
576
578
579 private static byte[] ENCRYPTION_KEY = new UnicodeEncoding().GetBytes("h3y_gUyZ");
580
582
584
586
588
589 public bool alchemyTable;
590
591 public int HotbarOffset;
592
594
595 public byte spelunkerTimer;
596
597 public bool[] hideInfo = new bool[13];
598
600
601 public long lostCoins;
602
603 public string lostCoinString = "";
604
605 public int soulDrain;
606
607 public float drainBoost;
608
609 public bool dd2Accessory;
610
611 private static bool disabledBlizzardGraphic = false;
612
613 private static bool disabledBlizzardSound = false;
614
615 private static float _blizzardSoundVolume;
616
618
620
621 public string name = "";
622
623 public int taxMoney;
624
625 public int taxTimer;
626
627 public static int taxRate = 3600;
628
630
632
633 public static int crystalLeafDamage = 100;
634
635 public static int crystalLeafKB = 10;
636
637 public float basiliskCharge;
638
640
642
643 public bool showLastDeath;
644
645 public bool usedAegisCrystal;
646
647 public bool usedAegisFruit;
648
649 public bool usedArcaneCrystal;
650
651 public bool usedGalaxyPearl;
652
653 public bool usedGummyWorm;
654
655 public bool usedAmbrosia;
656
657 public int extraAccessorySlots = 2;
658
659 public bool extraAccessory;
660
661 private bool dontConsumeWand;
662
663 public int tankPet = -1;
664
665 public bool tankPetReset;
666
667 public int stringColor;
668
669 public int counterWeight;
670
671 public bool yoyoString;
672
673 public bool yoyoGlove;
674
675 public int beetleOrbs;
676
677 public float beetleCounter;
678
679 public int beetleCountdown;
680
681 public bool beetleDefense;
682
683 public bool beetleOffense;
684
685 public bool beetleBuff;
686
687 public int solarShields;
688
689 public int solarCounter;
690
691 public const int maxSolarShields = 3;
692
693 public Vector2[] solarShieldPos = new Vector2[3];
694
695 public Vector2[] solarShieldVel = new Vector2[3];
696
697 public bool solarDashing;
698
700
701 public const int nebulaMaxLevel = 3;
702
703 public int nebulaLevelLife;
704
705 public int nebulaLevelMana;
706
708
710
711 public bool manaMagnet;
712
713 public bool lifeMagnet;
714
715 public bool treasureMagnet;
716
717 public bool chiselSpeed;
718
719 public bool lifeForce;
720
721 public bool calmed;
722
723 public bool inferno;
724
725 public float flameRingRot;
726
727 public float flameRingScale = 1f;
728
729 public byte flameRingFrame;
730
731 public byte flameRingAlpha;
732
733 public int netManaTime;
734
735 public int netLifeTime;
736
737 public bool netMana;
738
739 public bool netLife;
740
741 public Vector2[] beetlePos = new Vector2[3];
742
743 public Vector2[] beetleVel = new Vector2[3];
744
745 public int beetleFrame;
746
748
749 public static int manaSickTime = 300;
750
751 public static int manaSickTimeMax = 600;
752
753 public static float manaSickLessDmg = 0.25f;
754
755 public float manaSickReduction;
756
757 public bool manaSick;
758
759 public int afkCounter;
760
761 public bool stairFall;
762
763 public int loadStatus;
764
765 public Vector2[] itemFlamePos = new Vector2[7];
766
767 public int itemFlameCount;
768
769 public bool outOfRange;
770
771 public float lifeSteal = 99999f;
772
773 public float ghostDmg;
774
775 public bool teleporting;
776
777 public float teleportTime;
778
779 public int teleportStyle;
780
781 public bool sloping;
782
783 public bool chilled;
784
785 public bool dazed;
786
787 public bool frozen;
788
789 public bool stoned;
790
791 public bool lastStoned;
792
793 public bool ichor;
794
795 public bool webbed;
796
797 public bool tipsy;
798
799 public bool noBuilding;
800
801 public int ropeCount;
802
803 public int manaRegenBonus;
804
806
807 public int dashType;
808
809 public int dash;
810
811 public int dashTime;
812
814
815 public int dashDelay;
816
817 public int eocDash;
818
819 public int eocHit;
820
821 public float accRunSpeed;
822
823 public bool cordage;
824
825 public int gem = -1;
826
827 public int gemCount;
828
830
831 public byte meleeEnchant;
832
833 public byte pulleyDir;
834
835 public bool pulley;
836
837 public int pulleyFrame;
838
839 public float pulleyFrameCounter;
840
841 public bool blackBelt;
842
843 public bool sliding;
844
845 public int slideDir;
846
848
849 public bool iceSkate;
850
851 public bool carpet;
852
853 public int spikedBoots;
854
855 public int carpetFrame = -1;
856
857 public float carpetFrameCounter;
858
859 public bool canCarpet;
860
861 public int carpetTime;
862
863 public int miscCounter;
864
865 public int infernoCounter;
866
868
870
871 public bool sandStorm;
872
873 public bool crimsonRegen;
874
875 public bool ghostHeal;
876
877 public bool ghostHurt;
878
879 public bool sticky;
880
881 public bool slippy;
882
883 public bool slippy2;
884
885 public bool powerrun;
886
887 public bool runningOnSand;
888
889 public bool flapSound;
890
891 public bool iceBarrier;
892
893 public bool dangerSense;
894
895 public byte luckPotion;
896
897 public byte oldLuckPotion;
898
899 public float endurance;
900
902
904
905 public bool loveStruck;
906
907 public bool stinky;
908
909 public bool resistCold;
910
911 public bool electrified;
912
913 public bool dryadWard;
914
915 public bool panic;
916
918
920
921 public byte iceBarrierFrame;
922
924
925 public bool shadowDodge;
926
927 public float shadowDodgeCount;
928
929 public bool palladiumRegen;
930
931 public bool onHitDodge;
932
933 public bool onHitRegen;
934
935 public bool onHitPetal;
936
938
940
942
943 public int petalTimer;
944
946
947 public int boneGloveTimer;
948
950
951 public int fishingSkill;
952
953 public bool cratePotion;
954
955 public bool sonarPotion;
956
957 public bool accFishingLine;
958
959 public bool accFishingBobber;
960
961 public bool accTackleBox;
962
963 public bool accLavaFishing;
964
965 public int maxMinions = 1;
966
967 public int numMinions;
968
969 public float slotsMinions;
970
971 public bool pygmy;
972
973 public bool raven;
974
975 public bool slime;
976
977 public bool hornetMinion;
978
979 public bool impMinion;
980
981 public bool twinsMinion;
982
983 public bool spiderMinion;
984
986
987 public bool pirateMinion;
988
989 public bool sharknadoMinion;
990
991 public bool UFOMinion;
992
994
995 public bool stardustMinion;
996
997 public bool stardustGuardian;
998
999 public bool stardustDragon;
1000
1001 public bool batsOfLight;
1002
1003 public bool babyBird;
1004
1005 public bool vampireFrog;
1006
1007 public bool stormTiger;
1008
1010
1011 public bool smolstar;
1012
1013 public bool empressBlade;
1014
1015 public bool flinxMinion;
1016
1017 public bool abigailMinion;
1018
1020
1021 public float wingTime;
1022
1023 public int wings;
1024
1025 public int wingsLogic;
1026
1027 public int wingTimeMax;
1028
1029 public int wingFrame;
1030
1032
1033 public int skinVariant;
1034
1035 public bool ghost;
1036
1037 public int ghostFrame;
1038
1040
1041 public int miscTimer;
1042
1044
1046
1047 public bool pvpDeath;
1048
1049 public BitsByte zone1 = (byte)0;
1050
1051 public BitsByte zone2 = (byte)0;
1052
1053 public BitsByte zone3 = (byte)0;
1054
1055 public BitsByte zone4 = (byte)0;
1056
1057 public BitsByte zone5 = (byte)0;
1058
1059 private bool _wasInShimmerZone;
1060
1061 public bool boneArmor;
1062
1063 public bool frostArmor;
1064
1065 public bool honey;
1066
1067 public bool crystalLeaf;
1068
1070
1072
1074
1075 public bool dontHurtCritters;
1076
1077 public bool hasLucyTheAxe;
1078
1079 public bool dontHurtNature;
1080
1081 public int[] doubleTapCardinalTimer = new int[4];
1082
1083 public int[] holdDownCardinalTimer = new int[4];
1084
1086
1087 public bool hasPaladinShield;
1088
1089 public float[] speedSlice = new float[60];
1090
1091 public float townNPCs;
1092
1093 public double headFrameCounter;
1094
1095 public double bodyFrameCounter;
1096
1097 public double legFrameCounter;
1098
1099 public int netSkip;
1100
1101 public int oldSelectItem;
1102
1103 public bool immune;
1104
1105 public bool immuneNoBlink;
1106
1107 public int immuneTime;
1108
1110
1111 public int immuneAlpha;
1112
1113 public int team;
1114
1116
1117 private int _immuneStrikes;
1118
1119 public bool hbLocked;
1120
1121 public static int nameLen = 20;
1122
1123 public float maxRegenDelay;
1124
1125 public int sign = -1;
1126
1127 public bool editedChestName;
1128
1129 public int reuseDelay;
1130
1131 public int aggro;
1132
1133 public float nearbyActiveNPCs;
1134
1136
1137 public bool mouseInterface;
1138
1140
1141 public int noThrow;
1142
1143 public int changeItem = -1;
1144
1145 public int selectedItem;
1146
1147 public const int SupportedSlotsArmor = 3;
1148
1149 public const int SupportedSlotsAccs = 7;
1150
1151 public const int SupportedSlotSets = 10;
1152
1153 public const int InitialAccSlotCount = 5;
1154
1155 public const int miscSlotPet = 0;
1156
1157 public const int miscSlotLight = 1;
1158
1159 public const int miscSlotCart = 2;
1160
1161 public const int miscSlotMount = 3;
1162
1163 public const int miscSlotHook = 4;
1164
1165 public const int SupportedMiscSlotCount = 5;
1166
1167 public Item[] armor = new Item[20];
1168
1169 public Item[] dye = new Item[10];
1170
1171 public Item[] miscEquips = new Item[5];
1172
1173 public Item[] miscDyes = new Item[5];
1174
1175 public Item trashItem = new Item();
1176
1177 public float itemRotation;
1178
1179 public int itemWidth;
1180
1181 public int itemHeight;
1182
1184
1185 public bool poundRelease;
1186
1187 public float ghostFade;
1188
1189 public float ghostDir = 1f;
1190
1191 public static readonly int maxBuffs = 44;
1192
1193 public int[] buffType = new int[maxBuffs];
1194
1195 public int[] buffTime = new int[maxBuffs];
1196
1197 public bool[] buffImmune = new bool[BuffID.Count];
1198
1199 public int heldProj = -1;
1200
1201 public int breathCD;
1202
1203 public int breathMax = 200;
1204
1205 public int breath = 200;
1206
1207 public int lavaCD;
1208
1209 public int lavaMax;
1210
1211 public int lavaTime;
1212
1213 public bool ignoreWater;
1214
1216
1218
1220
1222
1224
1226
1228
1230
1231 public bool socialGhost;
1232
1233 public bool shroomiteStealth;
1234
1235 public bool ashWoodBonus;
1236
1238
1239 public int stealthTimer;
1240
1241 public float stealth = 1f;
1242
1244
1246
1247 public bool isFullbright;
1248
1249 public bool isHatRackDoll;
1250
1252
1254
1255 public string setBonus = "";
1256
1257 public Item[] inventory = new Item[59];
1258
1259 public bool[] inventoryChestStack = new bool[59];
1260
1262
1263 public Chest bank = new Chest(bank: true);
1264
1265 public Chest bank2 = new Chest(bank: true);
1266
1267 public Chest bank3 = new Chest(bank: true);
1268
1269 public Chest bank4 = new Chest(bank: true);
1270
1272
1273 public float headRotation;
1274
1275 public float bodyRotation;
1276
1277 public float legRotation;
1278
1280
1282
1284
1286
1288
1290
1291 public float fullRotation;
1292
1294
1296
1297 public const int fartKartCloudDelayMax = 20;
1298
1299 public int nonTorch = -1;
1300
1301 public float gfxOffY;
1302
1303 public float stepSpeed = 1f;
1304
1305 public static bool deadForGood = false;
1306
1307 public bool dead;
1308
1309 public int respawnTimer;
1310
1311 public const int respawnTimerMax = 3600;
1312
1314
1315 public int attackCD;
1316
1317 public int potionDelay;
1318
1319 public byte difficulty;
1320
1321 public byte wetSlime;
1322
1324
1326
1327 public int jump;
1328
1329 public int head = -1;
1330
1331 public int body = -1;
1332
1333 public int legs = -1;
1334
1335 public sbyte handon = -1;
1336
1337 public sbyte handoff = -1;
1338
1339 public sbyte back = -1;
1340
1341 public sbyte front = -1;
1342
1343 public sbyte shoe = -1;
1344
1345 public sbyte waist = -1;
1346
1347 public sbyte shield = -1;
1348
1349 public sbyte neck = -1;
1350
1351 public sbyte face = -1;
1352
1353 public sbyte balloon = -1;
1354
1355 public sbyte backpack = -1;
1356
1357 public sbyte tail = -1;
1358
1359 public sbyte faceHead = -1;
1360
1361 public sbyte faceFlower = -1;
1362
1363 public sbyte balloonFront = -1;
1364
1365 public sbyte beard = -1;
1366
1367 public bool[] hideVisibleAccessory = new bool[10];
1368
1369 public BitsByte hideMisc = (byte)0;
1370
1372
1374
1376
1378
1380
1381 public bool controlLeft;
1382
1383 public bool controlRight;
1384
1385 public bool controlUp;
1386
1387 public bool controlDown;
1388
1389 public bool controlJump;
1390
1391 public bool controlUseItem;
1392
1393 public bool controlUseTile;
1394
1395 public bool controlThrow;
1396
1397 public bool controlInv;
1398
1399 public bool controlHook;
1400
1401 public bool controlTorch;
1402
1403 public bool controlMap;
1404
1405 public bool controlSmart;
1406
1407 public bool controlMount;
1408
1409 public bool releaseJump;
1410
1411 public bool releaseUp;
1412
1413 public bool releaseUseItem;
1414
1415 public bool releaseUseTile;
1416
1417 public bool releaseInventory;
1418
1419 public bool releaseHook;
1420
1421 public bool releaseThrow;
1422
1423 public bool releaseQuickMana;
1424
1425 public bool releaseQuickHeal;
1426
1427 public bool releaseLeft;
1428
1429 public bool releaseRight;
1430
1431 public bool releaseSmart;
1432
1433 public bool releaseMount;
1434
1435 public bool releaseDown;
1436
1437 public bool controlQuickMana;
1438
1439 public bool controlQuickHeal;
1440
1442
1444
1446
1448
1449 public bool controlDownHold;
1450
1452
1454
1456
1458
1460
1461 public int altFunctionUse;
1462
1463 public bool mapZoomIn;
1464
1465 public bool mapZoomOut;
1466
1467 public bool mapAlphaUp;
1468
1469 public bool mapAlphaDown;
1470
1471 public bool mapFullScreen;
1472
1473 public bool mapStyle;
1474
1476
1477 public bool releaseMapStyle;
1478
1479 public int leftTimer;
1480
1481 public int rightTimer;
1482
1483 public bool delayUseItem;
1484
1485 public const int defaultWidth = 20;
1486
1487 public const int defaultHeight = 42;
1488
1490
1492
1494
1496
1497 public string cursorItemIconText = "";
1498
1499 public int runSoundDelay;
1500
1501 public float opacityForAnimation = 1f;
1502
1503 public const int shadowMax = 3;
1504
1505 public Vector2[] shadowPos = new Vector2[3];
1506
1507 public float[] shadowRotation = new float[3];
1508
1509 public Vector2[] shadowOrigin = new Vector2[3];
1510
1511 public int[] shadowDirection = new int[3];
1512
1513 public int shadowCount;
1514
1515 public float manaCost = 1f;
1516
1517 public bool fireWalk;
1518
1519 public bool channel;
1520
1521 public int step = -1;
1522
1524
1526
1528
1529 public bool creativeGodMode;
1530
1531 private const int MaxAdvancedShadows = 60;
1532
1534
1536
1538
1540
1542
1544
1546
1548
1550
1552
1553 public int statDefense;
1554
1555 public int statLifeMax = 100;
1556
1557 public int statLifeMax2 = 100;
1558
1559 public int statLife = 100;
1560
1561 public int statMana;
1562
1563 public int statManaMax;
1564
1565 public int statManaMax2;
1566
1567 public int lifeRegen;
1568
1569 public int lifeRegenCount;
1570
1571 public float lifeRegenTime;
1572
1573 public int manaRegen;
1574
1575 public int manaRegenCount;
1576
1577 public float manaRegenDelay;
1578
1579 public bool manaRegenBuff;
1580
1581 public bool noKnockback;
1582
1583 private bool shimmerImmune;
1584
1585 public bool spaceGun;
1586
1587 public float gravDir = 1f;
1588
1589 public bool chloroAmmoCost80;
1590
1592
1593 public bool ammoCost80;
1594
1595 public bool ammoCost75;
1596
1597 public int stickyBreak;
1598
1599 public bool magicQuiver;
1600
1601 public bool magmaStone;
1602
1603 public bool lavaRose;
1604
1605 public bool hasMoltenQuiver;
1606
1607 public int phantasmTime;
1608
1609 public bool ammoBox;
1610
1611 public bool ammoPotion;
1612
1613 public bool chaosState;
1614
1615 public bool strongBees;
1616
1617 public bool sporeSac;
1618
1619 public bool shinyStone;
1620
1621 public bool empressBrooch;
1622
1623 public bool volatileGelatin;
1624
1626
1628
1629 public bool shadowArmor;
1630
1631 public bool dontStarveShader;
1632
1633 public bool eyebrellaCloud;
1634
1635 public int yoraiz0rEye;
1636
1637 public bool yoraiz0rDarkness;
1638
1639 public bool hasUnicornHorn;
1640
1641 public bool hasAngelHalo;
1642
1643 public bool hasRainbowCursor;
1644
1645 public bool leinforsHair;
1646
1648
1650
1652
1654
1656
1658
1660
1661 public int overrideFishingBobber = -1;
1662
1664
1665 public bool ateArtisanBread;
1666
1668
1669 public bool enabledSuperCart = true;
1670
1672
1673 public bool crimsonHeart;
1674
1675 public bool lightOrb;
1676
1677 public bool blueFairy;
1678
1679 public bool redFairy;
1680
1681 public bool greenFairy;
1682
1683 public bool bunny;
1684
1685 public bool turtle;
1686
1687 public bool eater;
1688
1689 public bool penguin;
1690
1692
1693 public bool magicLantern;
1694
1695 public bool rabid;
1696
1697 public bool sunflower;
1698
1699 public bool wellFed;
1700
1701 public bool puppy;
1702
1703 public bool grinch;
1704
1705 public bool miniMinotaur;
1706
1707 public bool flowerBoots;
1708
1709 public bool fairyBoots;
1710
1711 public bool hellfireTreads;
1712
1713 public bool moonLordLegs;
1714
1715 public bool arcticDivingGear;
1716
1717 public bool coolWhipBuff;
1718
1719 public bool wearsRobe;
1720
1721 public bool minecartLeft;
1722
1723 public bool onWrongGround;
1724
1725 public bool onTrack;
1726
1727 public int cartRampTime;
1728
1729 public bool cartFlip;
1730
1731 public float trackBoost;
1732
1734
1735 public Mount mount;
1736
1737 public bool blackCat;
1738
1739 public bool spider;
1740
1741 public bool squashling;
1742
1743 public bool petFlagDD2Gato;
1744
1745 public bool petFlagDD2Ghost;
1746
1747 public bool petFlagDD2Dragon;
1748
1750
1752
1753 public bool petFlagBabyShark;
1754
1755 public bool petFlagLilHarpy;
1756
1757 public bool petFlagFennecFox;
1758
1760
1761 public bool petFlagBabyImp;
1762
1764
1765 public bool petFlagPlantero;
1766
1768
1770
1772
1773 public bool petFlagVoltBunny;
1774
1776
1778
1780
1782
1784
1786
1788
1789 public bool petFlagTwinsPet;
1790
1792
1794
1795 public bool petFlagGolemPet;
1796
1798
1800
1802
1804
1806
1808
1810
1812
1814
1816
1818
1819 public bool petFlagBerniePet;
1820
1822
1824
1825 public bool petFlagPigPet;
1826
1828
1829 public bool petFlagJunimoPet;
1830
1832
1833 public bool petFlagSpiffo;
1834
1835 public bool petFlagCaveling;
1836
1838
1839 public bool companionCube;
1840
1841 public bool babyFaceMonster;
1842
1843 public bool magicCuffs;
1844
1845 public bool coldDash;
1846
1847 public bool sailDash;
1848
1849 public bool desertDash;
1850
1851 public bool desertBoots;
1852
1853 public bool eyeSpring;
1854
1855 public bool snowman;
1856
1857 public bool scope;
1858
1859 public bool dino;
1860
1861 public bool skeletron;
1862
1863 public bool hornet;
1864
1865 public bool zephyrfish;
1866
1867 public bool tiki;
1868
1869 public bool parrot;
1870
1871 public bool truffle;
1872
1873 public bool sapling;
1874
1875 public bool cSapling;
1876
1877 public bool wisp;
1878
1879 public bool lizard;
1880
1881 public bool archery;
1882
1883 public bool poisoned;
1884
1885 public bool venom;
1886
1887 public bool blind;
1888
1889 public bool blackout;
1890
1891 public bool headcovered;
1892
1893 public bool frostBurn;
1894
1895 public bool onFrostBurn;
1896
1897 public bool onFrostBurn2;
1898
1899 public bool burned;
1900
1901 public bool shimmering;
1902
1903 public int timeShimmering;
1904
1906
1908
1909 public bool suffocating;
1910
1911 public byte suffocateDelay;
1912
1913 public bool dripping;
1914
1915 public bool drippingSlime;
1916
1918
1919 public bool onFire;
1920
1921 public bool onFire2;
1922
1923 public bool onFire3;
1924
1925 public bool noItems;
1926
1927 public bool cursed;
1928
1929 public bool hungry;
1930
1931 public bool starving;
1932
1933 public bool heartyMeal;
1934
1935 public bool windPushed;
1936
1937 public bool wereWolf;
1938
1939 public bool wolfAcc;
1940
1941 public bool hideMerman;
1942
1943 public bool hideWolf;
1944
1945 public bool forceMerman;
1946
1947 public bool forceWerewolf;
1948
1949 public bool rulerGrid;
1950
1951 public bool rulerLine;
1952
1953 public bool bleed;
1954
1955 public bool confused;
1956
1957 public bool accMerman;
1958
1959 public bool merman;
1960
1961 public bool trident;
1962
1963 public bool brokenArmor;
1964
1965 public bool silence;
1966
1967 public bool slow;
1968
1969 public bool gross;
1970
1971 public bool tongued;
1972
1973 public bool kbGlove;
1974
1975 public bool autoReuseGlove;
1976
1977 public bool meleeScaleGlove;
1978
1979 public bool kbBuff;
1980
1982
1984
1986
1988
1990
1991 public bool longInvince;
1992
1993 public bool pStone;
1994
1995 public static readonly float PhilosopherStoneDurationMultiplier = 0.75f;
1996
1997 public bool manaFlower;
1998
1999 public bool moonLeech;
2000
2001 public bool vortexDebuff;
2002
2003 public bool trapDebuffSource;
2004
2005 public bool witheredArmor;
2006
2007 public bool witheredWeapon;
2008
2009 public bool slowOgreSpit;
2010
2011 public bool parryDamageBuff;
2012
2013 public bool ballistaPanic;
2014
2016
2017 public int meleeCrit = 4;
2018
2019 public int magicCrit = 4;
2020
2021 public int rangedCrit = 4;
2022
2023 public float meleeDamage = 1f;
2024
2025 public float magicDamage = 1f;
2026
2027 public float rangedDamage = 1f;
2028
2029 public float rangedMultDamage = 1f;
2030
2032
2033 public float arrowDamage = 1f;
2034
2035 public float bulletDamage = 1f;
2036
2037 public float rocketDamage = 1f;
2038
2039 public float minionDamage = 1f;
2040
2041 public float minionKB;
2042
2043 public float meleeSpeed = 1f;
2044
2046
2047 public float moveSpeed = 1f;
2048
2049 public float pickSpeed = 1f;
2050
2051 public float wallSpeed = 1f;
2052
2053 public float tileSpeed = 1f;
2054
2055 public bool autoPaint;
2056
2057 public bool autoActuator;
2058
2059 public int SpawnX = -1;
2060
2061 public int SpawnY = -1;
2062
2064
2066
2067 public int[] spX = new int[200];
2068
2069 public int[] spY = new int[200];
2070
2071 public string[] spN = new string[200];
2072
2073 public int[] spI = new int[200];
2074
2075 public static int tileRangeX = 5;
2076
2077 public static int tileRangeY = 4;
2078
2079 public int lastTileRangeX;
2080
2081 public int lastTileRangeY;
2082
2083 public static int tileTargetX;
2084
2085 public static int tileTargetY;
2086
2087 public static float defaultGravity = 0.4f;
2088
2089 public static int jumpHeight = 15;
2090
2091 public static float jumpSpeed = 5.01f;
2092
2093 public float gravity = defaultGravity;
2094
2095 public float maxFallSpeed = 10f;
2096
2097 public float maxRunSpeed = 3f;
2098
2099 public float runAcceleration = 0.08f;
2100
2101 public float runSlowdown = 0.2f;
2102
2103 public bool adjWater;
2104
2105 public bool adjHoney;
2106
2107 public bool adjLava;
2108
2109 public bool oldAdjWater;
2110
2111 public bool oldAdjHoney;
2112
2113 public bool oldAdjLava;
2114
2115 public bool[] adjTile = new bool[TileID.Count];
2116
2117 public bool[] oldAdjTile = new bool[TileID.Count];
2118
2119 public static int defaultItemGrabRange = 42;
2120
2121 private static float itemGrabSpeed = 0.45f;
2122
2123 private static float itemGrabSpeedMax = 4f;
2124
2125 public byte hairDye;
2126
2128
2129 public float hairDyeVar;
2130
2131 public int skinDyePacked;
2132
2133 public Color hairColor = new Color(215, 90, 55);
2134
2135 public Color skinColor = new Color(255, 125, 90);
2136
2137 public Color eyeColor = new Color(105, 90, 75);
2138
2139 public Color shirtColor = new Color(175, 165, 140);
2140
2141 public Color underShirtColor = new Color(160, 180, 215);
2142
2143 public Color pantsColor = new Color(255, 230, 175);
2144
2145 public Color shoeColor = new Color(160, 105, 60);
2146
2147 public int hair;
2148
2149 public bool hostile;
2150
2152
2154
2155 public int accCompass;
2156
2157 public int accWatch;
2158
2159 public int accDepthMeter;
2160
2161 public bool accFishFinder;
2162
2163 public bool accWeatherRadio;
2164
2165 public bool accJarOfSouls;
2166
2167 public bool accCalendar;
2168
2169 public int lastCreatureHit = -1;
2170
2171 public bool accThirdEye;
2172
2174
2176
2177 public bool accStopwatch;
2178
2179 public bool accOreFinder;
2180
2181 public bool accCritterGuide;
2182
2184
2186
2187 public bool accDreamCatcher;
2188
2189 public bool hasFootball;
2190
2191 public bool drawingFootball;
2192
2193 public bool ActuationRodLock;
2194
2196
2198
2200
2202
2204
2205 public int dpsDamage;
2206
2207 public bool dpsStarted;
2208
2209 public string displayedFishingInfo = "";
2210
2211 public bool discountEquipped;
2212
2214
2215 public bool hasLuckyCoin;
2216
2218
2219 public bool goldRing;
2220
2221 public bool accDivingHelm;
2222
2223 public bool accFlipper;
2224
2226
2228
2230
2232
2234
2236
2238
2240
2242
2244
2246
2248
2250
2252
2254
2256
2258
2260
2262
2264
2266
2268
2270
2272
2274
2276
2278
2280
2282
2284
2285 public bool autoJump;
2286
2287 public bool justJumped;
2288
2289 public float jumpSpeedBoost;
2290
2291 public int extraFall;
2292
2293 public bool canFloatInWater;
2294
2295 public bool hasFloatingTube;
2296
2297 public bool frogLegJumpBoost;
2298
2299 public bool skyStoneEffects;
2300
2301 public bool spawnMax;
2302
2303 public int blockRange;
2304
2305 public int[] grappling = new int[20];
2306
2307 public int grapCount;
2308
2309 public int rocketTime;
2310
2311 public int rocketTimeMax = 7;
2312
2313 public int rocketDelay;
2314
2315 public int rocketDelay2;
2316
2318
2319 public bool rocketRelease;
2320
2321 public bool rocketFrame;
2322
2323 public int rocketBoots;
2324
2326
2327 public bool canRocket;
2328
2329 public bool jumpBoost;
2330
2331 public bool noFallDmg;
2332
2333 public int swimTime;
2334
2335 public bool killGuide;
2336
2337 public bool killClothier;
2338
2340
2342
2344
2345 public bool lavaImmune;
2346
2347 public bool gills;
2348
2349 public bool slowFall;
2350
2351 public bool findTreasure;
2352
2353 public bool biomeSight;
2354
2355 public bool invis;
2356
2357 public bool detectCreature;
2358
2359 public bool nightVision;
2360
2361 public bool enemySpawns;
2362
2363 public float thorns;
2364
2365 public bool turtleArmor;
2366
2367 public bool turtleThorns;
2368
2369 public bool cactusThorns;
2370
2371 public bool spiderArmor;
2372
2374
2376
2377 public bool setSolar;
2378
2379 public bool setVortex;
2380
2381 public bool setNebula;
2382
2383 public int nebulaCD;
2384
2385 public bool setStardust;
2386
2387 public bool setForbidden;
2388
2390
2391 public bool setSquireT3;
2392
2393 public bool setHuntressT3;
2394
2395 public bool setApprenticeT3;
2396
2397 public bool setMonkT3;
2398
2399 public bool setSquireT2;
2400
2401 public bool setHuntressT2;
2402
2403 public bool setApprenticeT2;
2404
2405 public bool setMonkT2;
2406
2407 public int maxTurrets = 1;
2408
2409 public int maxTurretsOld = 1;
2410
2412
2413 public bool waterWalk;
2414
2415 public bool waterWalk2;
2416
2417 public int forcedGravity;
2418
2419 public bool gravControl;
2420
2421 public bool gravControl2;
2422
2424
2426
2427 public int lastChest;
2428
2430
2432
2433 public int chest = -1;
2434
2435 public int chestX;
2436
2437 public int chestY;
2438
2439 public int fallStart;
2440
2441 public int fallStart2;
2442
2444
2446
2448
2449 private bool _batbatCanHeal;
2450
2452
2454
2456
2457 private bool _spawnMuramasaCut;
2458
2459 public bool isPettingAnimal;
2460
2462
2464
2466
2468
2470
2472
2474
2475 public int cHead;
2476
2477 public int cBody;
2478
2479 public int cLegs;
2480
2481 public int cHandOn;
2482
2483 public int cHandOff;
2484
2485 public int cBack;
2486
2487 public int cFront;
2488
2489 public int cShoe;
2490
2491 public int cWaist;
2492
2493 public int cShield;
2494
2495 public int cNeck;
2496
2497 public int cFace;
2498
2499 public int cFaceHead;
2500
2501 public int cFaceFlower;
2502
2503 public int cBalloon;
2504
2505 public int cBalloonFront;
2506
2507 public int cWings;
2508
2509 public int cCarpet;
2510
2511 public int cFloatingTube;
2512
2513 public int cBackpack;
2514
2515 public int cTail;
2516
2518
2519 public int cGrapple;
2520
2521 public int cMount;
2522
2523 public int cMinecart;
2524
2525 public int cPet;
2526
2527 public int cLight;
2528
2529 public int cYorai;
2530
2531 public int cPortableStool;
2532
2533 public int cUnicornHorn;
2534
2535 public int cAngelHalo;
2536
2537 public int cBeard;
2538
2539 public int cMinion;
2540
2541 public int cLeinShampoo;
2542
2543 public int cFlameWaker;
2544
2546
2547 public bool[] npcTypeNoAggro = new bool[NPCID.Count];
2548
2550
2552
2554
2556
2558
2560
2561 public int MinionAttackTargetNPC = -1;
2562
2564
2565 public int itemAnimation;
2566
2568
2569 public int itemTime;
2570
2571 public int itemTimeMax;
2572
2573 public int toolTime;
2574
2575 public static int BlockInteractionWithProjectiles = 3;
2576
2578
2580
2581 private bool makeStrongBee;
2582
2584
2586
2588
2590
2591 public bool behindBackWall;
2592
2594
2595 private float _stormShaderObstruction = 1f;
2596
2598
2600
2601 public static float airLightDecay = 1f;
2602
2603 public static float solidLightDecay = 1f;
2604
2606
2607 public const int ChairSittingMaxDistance = 40;
2608
2610
2612
2613 private bool[] nearbyTorch = new bool[TorchID.Count];
2614
2615 private bool dryCoralTorch;
2616
2618
2619 private int nearbyTorches;
2620
2621 public float torchLuck;
2622
2624
2626
2627 private int torchFunTimer;
2628
2629 private int torchGodCooldown;
2630
2632
2633 private static int maxTorchAttacks = 200;
2634
2635 private int[] unlitTorchX = new int[maxTorchAttacks];
2636
2637 private int[] unlitTorchY = new int[maxTorchAttacks];
2638
2639 private static int[] _torchAttackPosX = new int[400];
2640
2641 private static int[] _torchAttackPosY = new int[400];
2642
2644
2645 public float luck;
2646
2647 public float luckMinimumCap = -0.7f;
2648
2649 public float luckMaximumCap = 1f;
2650
2651 public float coinLuck;
2652
2653 public bool luckNeedsSync;
2654
2655 public int disableVoidBag = -1;
2656
2658
2660
2661 public float wingAccRunSpeed = -1f;
2662
2663 public float wingRunAccelerationMult = 1f;
2664
2665 public const int SHIELD_PARRY_DURATION = 20;
2666
2668
2670
2672
2673 public bool shieldRaised;
2674
2676
2678
2680
2682
2684
2686
2688
2690
2692
2694
2696
2698
2699 public int[] hurtCooldowns = new int[5];
2700
2701 public static int FlexibleWandRandomSeed;
2702
2703 public static int FlexibleWandCycleOffset;
2704
2706
2707 public static bool lastPound = true;
2708
2709 private static Point[] _tentacleSpikesMax5 = new Point[5];
2710
2711 private static Point[] _bloodButchererMax5 = new Point[5];
2712
2713 public int[] meleeNPCHitCooldown = new int[200];
2714
2715 public static int musicNotes = 6;
2716
2717 public float musicDist;
2718
2720
2722 {
2723 new EquipmentLoadout(),
2724 new EquipmentLoadout(),
2725 new EquipmentLoadout()
2726 };
2727
2729
2731
2732 private const int SaveSlotIndex_MouseItem = 0;
2733
2734 private const int SaveSlotIndex_CreativeSacrifice = 1;
2735
2736 private const int SaveSlotIndex_GuideItem = 2;
2737
2738 private const int SaveSlotIndex_TinkererItem = 3;
2739
2740 private const int SaveSlotIndexCount = 4;
2741
2742 private Item[] _temporaryItemSlots = new Item[4];
2743
2744 private static readonly PlayerFileData _visualCloneDummyData = new PlayerFileData();
2745
2746 private static readonly MemoryStream _visualCloneStream = new MemoryStream();
2747
2749
2751
2753
2755 {
2756 get
2757 {
2758 if (mount.Active)
2759 {
2760 return mount.PlayerOffset;
2761 }
2763 {
2765 }
2766 return 0f;
2767 }
2768 }
2769
2771 {
2772 get
2773 {
2774 if (mount.Active)
2775 {
2777 }
2779 {
2780 return portableStoolInfo.HeightBoost - portableStoolInfo.VisualYOffset;
2781 }
2782 return 0f;
2783 }
2784 }
2785
2786 public float MountXOffset
2787 {
2788 get
2789 {
2790 if (mount.Active)
2791 {
2792 return mount.PlayerXOFfset;
2793 }
2794 return 0f;
2795 }
2796 }
2797
2799 {
2800 get
2801 {
2802 if (mount.Active)
2803 {
2804 return mount.HeightBoost;
2805 }
2807 {
2809 }
2810 return 0;
2811 }
2812 }
2813
2815 {
2816 get
2817 {
2818 if (mount.Active)
2819 {
2820 return mount.PlayerHeadOffset;
2821 }
2823 {
2825 }
2826 return 0;
2827 }
2828 }
2829
2831 {
2832 get
2833 {
2834 Rectangle result = new Rectangle((int)position.X, (int)position.Y, width, height);
2835 result.Inflate(300, 200);
2836 return result;
2837 }
2838 }
2839
2841 {
2842 get
2843 {
2844 if ((double)Math.Abs(velocity.X) < 0.05)
2845 {
2846 return (double)Math.Abs(velocity.Y) < 0.05;
2847 }
2848 return false;
2849 }
2850 }
2851
2853 {
2854 get
2855 {
2856 return new Vector2(position.X + (float)(width / 2), position.Y + 21f + HeightOffsetHitboxCenter);
2857 }
2858 set
2859 {
2860 position = new Vector2(value.X - (float)(width / 2), value.Y - 21f - HeightOffsetHitboxCenter);
2861 }
2862 }
2863
2865
2866 public override Vector2 VisualPosition => position + new Vector2(0f, gfxOffY);
2867
2868 public bool CCed
2869 {
2870 get
2871 {
2872 if (!frozen && !webbed)
2873 {
2874 return stoned;
2875 }
2876 return true;
2877 }
2878 }
2879
2880 public float miscCounterNormalized => (float)miscCounter / 300f;
2881
2882 public bool Male
2883 {
2884 get
2885 {
2887 }
2888 set
2889 {
2890 if (value)
2891 {
2892 if (!Male)
2893 {
2895 }
2896 }
2897 else if (Male)
2898 {
2900 }
2901 }
2902 }
2903
2904 public bool ZoneDungeon
2905 {
2906 get
2907 {
2908 return zone1[0];
2909 }
2910 set
2911 {
2912 zone1[0] = value;
2913 }
2914 }
2915
2916 public bool ZoneCorrupt
2917 {
2918 get
2919 {
2920 return zone1[1];
2921 }
2922 set
2923 {
2924 zone1[1] = value;
2925 }
2926 }
2927
2928 public bool ZoneHallow
2929 {
2930 get
2931 {
2932 return zone1[2];
2933 }
2934 set
2935 {
2936 zone1[2] = value;
2937 }
2938 }
2939
2940 public bool ZoneMeteor
2941 {
2942 get
2943 {
2944 return zone1[3];
2945 }
2946 set
2947 {
2948 zone1[3] = value;
2949 }
2950 }
2951
2952 public bool ZoneJungle
2953 {
2954 get
2955 {
2956 return zone1[4];
2957 }
2958 set
2959 {
2960 zone1[4] = value;
2961 }
2962 }
2963
2964 public bool ZoneSnow
2965 {
2966 get
2967 {
2968 return zone1[5];
2969 }
2970 set
2971 {
2972 zone1[5] = value;
2973 }
2974 }
2975
2976 public bool ZoneCrimson
2977 {
2978 get
2979 {
2980 return zone1[6];
2981 }
2982 set
2983 {
2984 zone1[6] = value;
2985 }
2986 }
2987
2989 {
2990 get
2991 {
2992 return zone1[7];
2993 }
2994 set
2995 {
2996 zone1[7] = value;
2997 }
2998 }
2999
3001 {
3002 get
3003 {
3004 return zone2[0];
3005 }
3006 set
3007 {
3008 zone2[0] = value;
3009 }
3010 }
3011
3012 public bool ZoneTowerSolar
3013 {
3014 get
3015 {
3016 return zone2[1];
3017 }
3018 set
3019 {
3020 zone2[1] = value;
3021 }
3022 }
3023
3025 {
3026 get
3027 {
3028 return zone2[2];
3029 }
3030 set
3031 {
3032 zone2[2] = value;
3033 }
3034 }
3035
3037 {
3038 get
3039 {
3040 return zone2[3];
3041 }
3042 set
3043 {
3044 zone2[3] = value;
3045 }
3046 }
3047
3049 {
3050 get
3051 {
3052 return zone2[4];
3053 }
3054 set
3055 {
3056 zone2[4] = value;
3057 }
3058 }
3059
3060 public bool ZoneDesert
3061 {
3062 get
3063 {
3064 return zone2[5];
3065 }
3066 set
3067 {
3068 zone2[5] = value;
3069 }
3070 }
3071
3072 public bool ZoneGlowshroom
3073 {
3074 get
3075 {
3076 return zone2[6];
3077 }
3078 set
3079 {
3080 zone2[6] = value;
3081 }
3082 }
3083
3085 {
3086 get
3087 {
3088 return zone2[7];
3089 }
3090 set
3091 {
3092 zone2[7] = value;
3093 }
3094 }
3095
3096 public bool ZoneSkyHeight
3097 {
3098 get
3099 {
3100 return zone3[0];
3101 }
3102 set
3103 {
3104 zone3[0] = value;
3105 }
3106 }
3107
3109 {
3110 get
3111 {
3112 return zone3[1];
3113 }
3114 set
3115 {
3116 zone3[1] = value;
3117 }
3118 }
3119
3121 {
3122 get
3123 {
3124 return zone3[2];
3125 }
3126 set
3127 {
3128 zone3[2] = value;
3129 }
3130 }
3131
3133 {
3134 get
3135 {
3136 return zone3[3];
3137 }
3138 set
3139 {
3140 zone3[3] = value;
3141 }
3142 }
3143
3145 {
3146 get
3147 {
3148 return zone3[4];
3149 }
3150 set
3151 {
3152 zone3[4] = value;
3153 }
3154 }
3155
3156 public bool ZoneBeach
3157 {
3158 get
3159 {
3160 return zone3[5];
3161 }
3162 set
3163 {
3164 zone3[5] = value;
3165 }
3166 }
3167
3168 public bool ZoneRain
3169 {
3170 get
3171 {
3172 return zone3[6];
3173 }
3174 set
3175 {
3176 zone3[6] = value;
3177 }
3178 }
3179
3180 public bool ZoneSandstorm
3181 {
3182 get
3183 {
3184 return zone3[7];
3185 }
3186 set
3187 {
3188 zone3[7] = value;
3189 }
3190 }
3191
3192 public bool ZoneOldOneArmy
3193 {
3194 get
3195 {
3196 return zone4[0];
3197 }
3198 set
3199 {
3200 zone4[0] = value;
3201 }
3202 }
3203
3204 public bool ZoneGranite
3205 {
3206 get
3207 {
3208 return zone4[1];
3209 }
3210 set
3211 {
3212 zone4[1] = value;
3213 }
3214 }
3215
3216 public bool ZoneMarble
3217 {
3218 get
3219 {
3220 return zone4[2];
3221 }
3222 set
3223 {
3224 zone4[2] = value;
3225 }
3226 }
3227
3228 public bool ZoneHive
3229 {
3230 get
3231 {
3232 return zone4[3];
3233 }
3234 set
3235 {
3236 zone4[3] = value;
3237 }
3238 }
3239
3240 public bool ZoneGemCave
3241 {
3242 get
3243 {
3244 return zone4[4];
3245 }
3246 set
3247 {
3248 zone4[4] = value;
3249 }
3250 }
3251
3253 {
3254 get
3255 {
3256 return zone4[5];
3257 }
3258 set
3259 {
3260 zone4[5] = value;
3261 }
3262 }
3263
3264 public bool ZoneGraveyard
3265 {
3266 get
3267 {
3268 return zone4[6];
3269 }
3270 set
3271 {
3272 zone4[6] = value;
3273 }
3274 }
3275
3277 {
3278 get
3279 {
3280 return zone4[7];
3281 }
3282 set
3283 {
3284 zone4[7] = value;
3285 }
3286 }
3287
3288 public bool ZoneShimmer
3289 {
3290 get
3291 {
3292 return zone5[0];
3293 }
3294 set
3295 {
3296 zone5[0] = value;
3297 }
3298 }
3299
3301 {
3302 get
3303 {
3305 {
3306 return ZoneDesert;
3307 }
3308 return true;
3309 }
3310 }
3311
3312 public bool ShoppingZone_BelowSurface => (double)position.Y > Main.worldSurface * 16.0;
3313
3315 {
3316 get
3317 {
3319 {
3320 return false;
3321 }
3322 return true;
3323 }
3324 }
3325
3327
3329
3330 public int breathCDMax
3331 {
3332 get
3333 {
3334 int num = 7;
3335 if (inventory[selectedItem].type == 186 && itemAnimation == 0)
3336 {
3337 num *= 2;
3338 }
3339 if (accDivingHelm)
3340 {
3341 num *= 6;
3342 }
3343 return num;
3344 }
3345 }
3346
3348 {
3349 get
3350 {
3352 {
3353 if (mount.Active)
3354 {
3355 return mount.Type == 37;
3356 }
3357 return true;
3358 }
3359 return false;
3360 }
3361 }
3362
3363 public bool CanBeTalkedTo
3364 {
3365 get
3366 {
3367 if (active && !dead && !ShouldNotDraw)
3368 {
3369 return stealth == 1f;
3370 }
3371 return false;
3372 }
3373 }
3374
3376 {
3377 get
3378 {
3379 return voidVaultInfo[0];
3380 }
3381 set
3382 {
3383 voidVaultInfo[0] = value;
3384 }
3385 }
3386
3387 public bool DeadOrGhost
3388 {
3389 get
3390 {
3391 if (!dead)
3392 {
3393 return ghost;
3394 }
3395 return true;
3396 }
3397 }
3398
3400 {
3401 get
3402 {
3403 if (!controlUp)
3404 {
3405 return tryKeepingHoveringUp;
3406 }
3407 return true;
3408 }
3409 }
3410
3412 {
3413 get
3414 {
3415 if (!controlDown)
3416 {
3418 }
3419 return true;
3420 }
3421 }
3422
3423 public Vector2 DefaultSize => new Vector2(20f, 42f);
3424
3426 {
3427 get
3428 {
3430 {
3431 return false;
3432 }
3433 return builderAccStatus[11] == 0;
3434 }
3435 set
3436 {
3437 builderAccStatus[11] = ((!value) ? 1 : 0);
3438 }
3439 }
3440
3441 public bool UsingSuperCart
3442 {
3443 get
3444 {
3445 if (!unlockedSuperCart)
3446 {
3447 return false;
3448 }
3449 return enabledSuperCart;
3450 }
3451 set
3452 {
3454 }
3455 }
3456
3458
3460
3462
3463 public bool ShouldNotDraw
3464 {
3465 get
3466 {
3467 if (invis && itemAnimation == 0)
3468 {
3470 {
3471 return !isHatRackDoll;
3472 }
3473 return false;
3474 }
3475 return false;
3476 }
3477 }
3478
3479 public int talkNPC { get; private set; }
3480
3482 {
3483 get
3484 {
3485 if (!sitting.isSitting)
3486 {
3487 return sleeping.isSleeping;
3488 }
3489 return true;
3490 }
3491 }
3492
3494 {
3495 get
3496 {
3497 if (_portalPhysicsTime > 0)
3498 {
3499 return !mount.Active;
3500 }
3501 return false;
3502 }
3503 }
3504
3506 {
3507 get
3508 {
3509 if (statLife >= statLifeMax2 / 2 && (!wet || lavaWet || honeyWet) && !dripping && !(MountFishronSpecialCounter > 0f))
3510 {
3511 if (Main.raining)
3512 {
3514 }
3515 return false;
3516 }
3517 return true;
3518 }
3519 }
3520
3522
3524
3525 public bool ItemTimeIsZero => itemTime == 0;
3526
3528
3529 public float NormalizedLuck
3530 {
3531 get
3532 {
3533 float value = 0f;
3534 if (luck > 0f)
3535 {
3537 }
3538 else if (luck < 0f)
3539 {
3540 value = 0f - luck / luckMinimumCap;
3541 }
3542 return MathHelper.Clamp(value, -1f, 1f);
3543 }
3544 }
3545
3547 {
3548 get
3549 {
3551 {
3552 return !controlJump;
3553 }
3554 return false;
3555 }
3556 }
3557
3559 {
3560 get
3561 {
3562 if (mount.Active)
3563 {
3564 Mount.MountDelegatesData.OverridePositionMethod mouthPosition = mount.Delegations.MouthPosition;
3565 if (mouthPosition != null && mouthPosition(this, out var result))
3566 {
3567 return result;
3568 }
3569 }
3570 Vector2 spinningpoint = new Vector2(direction * 8, gravDir * -4f);
3572 }
3573 }
3574
3576 {
3577 get
3578 {
3579 if (mount.Active)
3580 {
3581 Mount.MountDelegatesData.OverridePositionMethod handPosition = mount.Delegations.HandPosition;
3582 if (handPosition != null && handPosition(this, out var result))
3583 {
3584 return result;
3585 }
3586 }
3587 Vector2 vector = Main.OffsetsPlayerOnhand[bodyFrame.Y / 56] * 2f;
3588 if (direction != 1)
3589 {
3590 vector.X = (float)bodyFrame.Width - vector.X;
3591 }
3592 if (gravDir != 1f)
3593 {
3594 vector.Y = (float)bodyFrame.Height - vector.Y;
3595 }
3596 vector -= new Vector2(bodyFrame.Width - width, bodyFrame.Height - 42) / 2f;
3597 Vector2 vector2 = -new Vector2(20f, 42f) / 2f + vector;
3599 }
3600 }
3601
3602 public void RotateRelativePoint(ref float x, ref float y)
3603 {
3605 x = vector.X;
3606 y = vector.Y;
3607 }
3608
3610 {
3612 Matrix matrix = Matrix.CreateRotationZ(fullRotation * (float)rotateForward.ToInt());
3614 pos = Vector2.Transform(pos, matrix);
3615 return pos + vector;
3616 }
3617
3618 public Vector2 RotatedRelativePoint(Vector2 pos, bool reverseRotation = false, bool addGfxOffY = true)
3619 {
3620 float num = (reverseRotation ? (0f - fullRotation) : fullRotation);
3621 if (sleeping.isSleeping)
3622 {
3623 num = 0f;
3624 }
3625 Vector2 vector = base.Bottom + new Vector2(0f, gfxOffY);
3626 int num2 = mount.PlayerOffset / 2 + 4;
3627 Vector2 vector2 = new Vector2(0f, -num2) + new Vector2(0f, num2).RotatedBy(num);
3628 if (addGfxOffY)
3629 {
3630 pos.Y += gfxOffY;
3631 }
3632 pos = vector + (pos - vector).RotatedBy(num) + vector2;
3633 if (sleeping.isSleeping)
3634 {
3636 pos += posOffset;
3637 }
3638 if (sitting.isSitting)
3639 {
3641 pos += posOffset2 + new Vector2(0f, seatAdjustment);
3642 }
3643 return pos;
3644 }
3645
3647 {
3648 if (!IsItemSlotUnlockedAndUsable(8) && armor[8].type <= 0 && armor[18].type <= 0)
3649 {
3650 return dye[8].type > 0;
3651 }
3652 return true;
3653 }
3654
3656 {
3657 if (!IsItemSlotUnlockedAndUsable(9) && armor[9].type <= 0 && armor[19].type <= 0)
3658 {
3659 return dye[9].type > 0;
3660 }
3661 return true;
3662 }
3663
3665 {
3666 int num = 0;
3668 {
3669 num++;
3670 }
3672 {
3673 num++;
3674 }
3675 return num;
3676 }
3677
3679 {
3681 {
3683 }
3684 int num = (_lastAddedAvancedShadow - shadowIndex).ModulusPositive(60);
3685 return _advancedShadows[num];
3686 }
3687
3689 {
3692 {
3694 }
3695 if (++_lastAddedAvancedShadow >= 60)
3696 {
3698 }
3700 }
3701
3703 {
3705 }
3706
3707 public void SetCompositeArmFront(bool enabled, CompositeArmStretchAmount stretch, float rotation)
3708 {
3709 if (gravDir == -1f)
3710 {
3711 rotation = 0f - rotation;
3712 }
3713 compositeFrontArm = new CompositeArmData(enabled, stretch, rotation);
3714 }
3715
3716 public void SetCompositeArmBack(bool enabled, CompositeArmStretchAmount stretch, float rotation)
3717 {
3718 if (gravDir == -1f)
3719 {
3720 rotation = 0f - rotation;
3721 }
3722 compositeBackArm = new CompositeArmData(enabled, stretch, rotation);
3723 }
3724
3725 public void SetTalkNPC(int npcIndex, bool fromNet = false)
3726 {
3727 talkNPC = npcIndex;
3728 if (Main.netMode != 1 && npcIndex >= 0 && npcIndex < 200)
3729 {
3730 Main.BestiaryTracker.Chats.RegisterChatStartWith(Main.npc[npcIndex]);
3731 }
3732 if (talkNPC == -1)
3733 {
3735 }
3736 else
3737 {
3738 currentShoppingSettings = Main.ShopHelper.GetShoppingSettings(this, Main.npc[talkNPC]);
3739 }
3740 if (currentShoppingSettings.PriceAdjustment <= 0.8199999928474426)
3741 {
3743 }
3744 }
3745
3746 public void SetItemTime(int frames)
3747 {
3748 itemTime = frames;
3750 }
3751
3753 {
3754 SetItemTime(sItem.useTime);
3755 }
3756
3758 {
3759 SetItemTime((int)((float)sItem.useTime * multiplier));
3760 }
3761
3762 public void SetDummyItemTime(int frames)
3763 {
3765 itemTime = frames;
3766 itemTimeMax = frames + 1;
3767 }
3768
3769 private void SetItemAnimation(int frames)
3770 {
3773 }
3774
3776 {
3777 int num = 0;
3778 if (sItem.autoReuse && sItem.reuseDelay == 0 && sItem.useTime <= sItem.useAnimation && sItem.shoot > 0 && sItem.useStyle == 5)
3779 {
3780 num = 1;
3781 }
3782 if (sItem.melee)
3783 {
3784 SetItemAnimation((int)((float)sItem.useAnimation * meleeSpeed));
3785 }
3787 {
3789 }
3790 else if (sItem.createTile >= 0)
3791 {
3792 SetItemAnimation((int)((float)sItem.useAnimation * tileSpeed));
3793 }
3794 else if (sItem.createWall >= 0)
3795 {
3796 SetItemAnimation((int)((float)sItem.useAnimation * wallSpeed));
3797 }
3798 else
3799 {
3800 SetItemAnimation(sItem.useAnimation + num);
3801 }
3802 reuseDelay = sItem.reuseDelay;
3803 }
3804
3806 {
3808 }
3809
3811 {
3812 if (hostile && otherPlayer.hostile)
3813 {
3814 if (otherPlayer.team != 0)
3815 {
3816 return otherPlayer.team != team;
3817 }
3818 return true;
3819 }
3820 return false;
3821 }
3822
3823 public bool TeamChangeAllowed()
3824 {
3825 return true;
3826 }
3827
3828 public void HealEffect(int healAmount, bool broadcast = true)
3829 {
3831 if (broadcast && Main.netMode == 1 && whoAmI == Main.myPlayer)
3832 {
3833 NetMessage.SendData(35, -1, -1, null, whoAmI, healAmount);
3834 }
3835 }
3836
3837 public void ManaEffect(int manaAmount)
3838 {
3840 if (Main.netMode == 1 && whoAmI == Main.myPlayer)
3841 {
3842 NetMessage.SendData(43, -1, -1, null, whoAmI, manaAmount);
3843 }
3844 }
3845
3847 {
3849 if (tile != null && tile.active() && tile.type == tileTypeToBeOver)
3850 {
3851 Main.blockMouse = true;
3852 }
3853 }
3854
3855 public Vector2 GetHairDrawOffset(int hairID, bool hatHair)
3856 {
3858 if (!hatHair && hairID == 163)
3859 {
3860 return new Vector2(0f, -2f) * Directions;
3861 }
3862 if (hairID == 164)
3863 {
3864 return new Vector2(-2f, 0f) * Directions;
3865 }
3866 return zero;
3867 }
3868
3870 {
3872 if (head == 270)
3873 {
3874 headOffset = new Vector2(-10f, 0f) * Directions;
3875 if (direction == -1)
3876 {
3877 headOffset.X -= 2f;
3878 }
3879 }
3880 else if (head == 268)
3881 {
3882 headOffset = new Vector2(0f, -6f) * Directions;
3883 }
3884 else if (head == 222)
3885 {
3886 float y = 0f;
3887 if (hair == 15 || hair == 76 || hair == 108)
3888 {
3889 y = 4f;
3890 }
3891 headOffset = new Vector2(0f, y) * Directions;
3892 }
3893 else if (head == 272)
3894 {
3895 if (hair == 15 || hair == 76 || hair == 108)
3896 {
3897 headOffset = new Vector2(0f, 4f) * Directions;
3898 }
3899 }
3900 else if (head == 275)
3901 {
3902 headOffset = new Vector2(0f, -4f) * Directions;
3903 }
3905 }
3906
3908 {
3909 Vector2 result = Vector2.Zero;
3910 switch (head)
3911 {
3912 case 165:
3913 result = new Vector2(8 * direction, 0f);
3914 break;
3915 case 146:
3916 case 150:
3917 case 152:
3918 result = new Vector2(2 * direction, 0f);
3919 break;
3920 case 148:
3921 result = new Vector2(2 * direction, 0f);
3922 break;
3923 }
3924 return result;
3925 }
3926
3928 {
3930 if (faceHead == 12 || faceHead == 13 || faceHead == 10 || faceHead == 11 || faceHead == 17 || faceHead == 18 || faceHead == 15 || faceHead == 16)
3931 {
3932 switch (head)
3933 {
3934 case 20:
3935 case 221:
3936 vector = new Vector2(0f, -2f);
3937 break;
3938 case 196:
3939 vector = new Vector2(2f, 0f);
3940 break;
3941 }
3942 }
3943 return vector * Directions;
3944 }
3945
3947 {
3948 if (faceHead == 12 || faceHead == 13 || faceHead == 10 || faceHead == 11 || faceHead == 17 || faceHead == 18 || faceHead == 15 || faceHead == 16)
3949 {
3950 switch (head)
3951 {
3952 case 16:
3953 case 21:
3954 case 24:
3955 case 65:
3956 case 67:
3957 case 94:
3958 case 95:
3959 case 96:
3960 case 159:
3961 case 222:
3962 case 231:
3963 case 250:
3964 headOffset += new Vector2(2f, 0f) * Directions;
3965 break;
3966 case 59:
3967 case 64:
3968 case 106:
3969 case 138:
3970 case 181:
3971 case 220:
3972 headOffset += new Vector2(0f, -2f) * Directions;
3973 break;
3974 case 26:
3975 case 51:
3976 case 60:
3977 case 81:
3978 headOffset += new Vector2(2f, -2f) * Directions;
3979 break;
3980 case 97:
3981 headOffset += new Vector2(-2f, 0f) * Directions;
3982 break;
3983 case 117:
3984 headOffset += new Vector2(-4f, 0f) * Directions;
3985 break;
3986 }
3987 }
3988 return headOffset;
3989 }
3990
3992 {
3993 Vector2 result = Vector2.Zero;
3994 if (legs == 226)
3995 {
3996 result = new Vector2(-6f, 0f) * Directions;
3997 }
3998 return result;
3999 }
4000
4002 {
4003 int num = score;
4004 if (golferScoreAccumulated + num > 1000000000)
4005 {
4006 num = 1000000000 - golferScoreAccumulated;
4007 }
4009 }
4010
4011 public static byte FindClosest(Vector2 Position, int Width, int Height)
4012 {
4013 byte result = 0;
4014 for (int i = 0; i < 255; i++)
4015 {
4016 if (Main.player[i].active)
4017 {
4018 result = (byte)i;
4019 break;
4020 }
4021 }
4022 float num = -1f;
4023 for (int j = 0; j < 255; j++)
4024 {
4025 if (Main.player[j].active && !Main.player[j].dead)
4026 {
4027 float num2 = Math.Abs(Main.player[j].position.X + (float)(Main.player[j].width / 2) - (Position.X + (float)(Width / 2))) + Math.Abs(Main.player[j].position.Y + (float)(Main.player[j].height / 2) - (Position.Y + (float)(Height / 2)));
4028 if (num == -1f || num2 < num)
4029 {
4030 num = num2;
4031 result = (byte)j;
4032 }
4033 }
4034 }
4035 return result;
4036 }
4037
4038 public void ToggleInv()
4039 {
4041 if (Main.mapFullscreen)
4042 {
4043 Main.mapFullscreen = false;
4044 releaseInventory = false;
4047 {
4049 }
4050 }
4051 else if (PlayerInput.InBuildingMode)
4052 {
4054 }
4055 else if (Main.ingameOptionsWindow)
4056 {
4058 {
4060 }
4061 else
4062 {
4064 }
4065 }
4066 else if (Main.inFancyUI)
4067 {
4069 }
4070 else if (CaptureManager.Instance.Active)
4071 {
4072 CaptureManager.Instance.Active = false;
4073 }
4074 else if (talkNPC >= 0)
4075 {
4076 SetTalkNPC(-1);
4077 Main.npcChatCornerItem = 0;
4078 Main.npcChatText = "";
4081 {
4082 Main.npcChatRelease = false;
4083 }
4084 }
4085 else if (sign >= 0)
4086 {
4087 sign = -1;
4088 Main.editSign = false;
4089 Main.npcChatText = "";
4091 }
4092 else if (Main.clothesWindow)
4093 {
4095 }
4096 else if (!Main.playerInventory)
4097 {
4098 OpenInventory();
4099 }
4100 else
4101 {
4102 Main.playerInventory = false;
4103 if (channel && Main.mouseItem != null && !Main.mouseItem.IsAir)
4104 {
4105 channel = false;
4106 }
4109 {
4110 Main.EquipPageSelected = 0;
4111 }
4112 else
4113 {
4115 Main.GamepadCursorAlpha = 0f;
4118 {
4120 }
4121 }
4124 {
4125 Item[] array = inventory;
4126 for (int i = 0; i < array.Length; i++)
4127 {
4128 array[i].newAndShiny = false;
4129 }
4130 }
4132 {
4133 Main.npcChatRelease = false;
4135 releaseInventory = false;
4136 Main.mouseRight = true;
4137 }
4138 }
4140 {
4142 }
4143 }
4144
4145 private static void OpenInventory()
4146 {
4148 Main.playerInventory = true;
4149 Main.EquipPageSelected = 0;
4151 }
4152
4154 {
4155 if (dead || difficulty != 3)
4156 {
4157 return;
4158 }
4159 bool flag = false;
4160 if (Main.mapFullscreen)
4161 {
4162 Main.mapFullscreen = false;
4163 flag = true;
4164 }
4166 {
4168 }
4170 {
4172 }
4173 if (Main.inFancyUI)
4174 {
4176 }
4177 if (CaptureManager.Instance.Active)
4178 {
4179 CaptureManager.Instance.Active = false;
4180 }
4181 if (talkNPC >= 0)
4182 {
4183 SetTalkNPC(-1);
4184 Main.npcChatCornerItem = 0;
4185 Main.npcChatText = "";
4186 flag = true;
4188 {
4189 Main.npcChatRelease = false;
4190 }
4191 }
4192 if (sign >= 0)
4193 {
4194 sign = -1;
4195 Main.editSign = false;
4196 Main.npcChatText = "";
4197 flag = true;
4198 }
4199 else if (Main.clothesWindow)
4200 {
4202 }
4204 {
4207 flag = true;
4208 }
4209 if (flag)
4210 {
4212 }
4213 if (!Main.playerInventory)
4214 {
4215 OpenInventory();
4216 }
4217 Main.CreativeMenu.ToggleMenu();
4218 }
4219
4220 public void dropItemCheck()
4221 {
4222 if (!Main.playerInventory)
4223 {
4224 noThrow = 0;
4225 }
4226 if (noThrow > 0)
4227 {
4228 noThrow--;
4229 }
4231 if (!Main.InGuideCraftMenu && Main.guideItem.type > 0)
4232 {
4233 Main.guideItem.position = base.Center;
4235 if (item.stack > 0)
4236 {
4237 int num = Item.NewItem(GetItemSource_Misc(4), (int)position.X, (int)position.Y, width, height, item.type, item.stack, noBroadcast: false, Main.guideItem.prefix, noGrabDelay: true);
4238 Main.item[num].newAndShiny = false;
4239 if (Main.netMode == 1)
4240 {
4241 NetMessage.SendData(21, -1, -1, null, num, 1f);
4242 }
4243 }
4244 Main.guideItem = new Item();
4245 }
4246 if (!Main.InReforgeMenu && Main.reforgeItem.type > 0)
4247 {
4248 Main.reforgeItem.position = base.Center;
4250 if (item2.stack > 0)
4251 {
4252 int num2 = Item.NewItem(GetItemSource_Misc(4), (int)position.X, (int)position.Y, width, height, item2.type, item2.stack, noBroadcast: false, Main.reforgeItem.prefix, noGrabDelay: true);
4253 Main.item[num2].newAndShiny = false;
4254 if (Main.netMode == 1)
4255 {
4256 NetMessage.SendData(21, -1, -1, null, num2, 1f);
4257 }
4258 }
4259 Main.reforgeItem = new Item();
4260 }
4261 if (Main.myPlayer == whoAmI)
4262 {
4263 inventory[58] = Main.mouseItem.Clone();
4264 }
4265 bool flag = true;
4266 if (Main.mouseItem.type > 0 && Main.mouseItem.stack > 0)
4267 {
4268 if (!Main.gamePaused)
4269 {
4270 tileTargetX = (int)(((float)Main.mouseX + Main.screenPosition.X) / 16f);
4271 tileTargetY = (int)(((float)Main.mouseY + Main.screenPosition.Y) / 16f);
4272 if (gravDir == -1f)
4273 {
4274 tileTargetY = (int)((Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16f);
4275 }
4276 }
4277 if (selectedItem != 58)
4278 {
4280 }
4281 selectedItem = 58;
4282 flag = false;
4283 }
4284 if (flag && selectedItem == 58 && ItemTimeIsZero && itemAnimation == 0)
4285 {
4287 }
4288 if (Main.mouseItem.type > 0 && !Main.playerInventory)
4289 {
4290 Main.mouseItem.position = base.Center;
4292 if (item3.stack > 0)
4293 {
4294 int num3 = Item.NewItem(GetItemSource_Misc(4), (int)position.X, (int)position.Y, width, height, item3.type, item3.stack, noBroadcast: false, Main.mouseItem.prefix, noGrabDelay: true);
4295 Main.item[num3].newAndShiny = false;
4296 if (Main.netMode == 1)
4297 {
4298 NetMessage.SendData(21, -1, -1, null, num3, 1f);
4299 }
4300 }
4301 Main.mouseItem = new Item();
4302 inventory[58] = new Item();
4304 }
4306 {
4308 }
4309 if (Main.gamePaused && selectedItem == 58)
4310 {
4312 }
4313 }
4314
4315 public void DropSelectedItem()
4316 {
4317 if (Main.mouseItem != null && Main.mouseItem.type > 0 && Main.mouseItem.stack > 0)
4318 {
4320 }
4321 else
4322 {
4324 }
4325 }
4326
4328 {
4329 bool flag = false;
4330 if (theItemWeDrop.favorited)
4331 {
4333 if (slot == 58)
4334 {
4335 Main.mouseItem = theItemWeDrop;
4336 }
4338 if (theItemWeDrop.type == 0)
4339 {
4340 flag = true;
4341 }
4342 }
4343 if (!flag)
4344 {
4345 Item item = new Item();
4347 {
4350 delayUseItem = true;
4351 controlUseItem = false;
4352 }
4353 if (whoAmI == Main.myPlayer && theItemWeDrop.type == 5095)
4354 {
4355 LucyAxeMessage.Create(LucyAxeMessage.MessageSource.ThrownAway, base.Top, new Vector2(direction * 7, -2f));
4356 }
4357 int num = Item.NewItem(GetItemSource_Misc(4), (int)position.X, (int)position.Y, width, height, theItemWeDrop.type);
4358 theItemWeDrop.position = Main.item[num].position;
4359 Main.item[num] = theItemWeDrop;
4360 theItemWeDrop = new Item();
4361 if (slot == 58)
4362 {
4363 Main.mouseItem = new Item();
4364 }
4365 Item item2 = Main.item[num];
4366 if (Main.netMode == 0)
4367 {
4368 item2.noGrabDelay = 100;
4369 }
4370 item2.velocity.Y = -2f;
4371 item2.velocity.X = (float)(4 * direction) + velocity.X;
4372 item2.favorited = false;
4373 item2.newAndShiny = false;
4374 if (((Main.mouseRight && !mouseInterface) || !Main.playerInventory) && Main.mouseItem.type > 0)
4375 {
4377 Main.mouseItem = new Item();
4378 }
4379 else
4380 {
4381 SetItemAnimation(10);
4382 JustDroppedAnItem = true;
4384 }
4386 if (Main.netMode == 1)
4387 {
4388 NetMessage.SendData(21, -1, -1, null, num);
4389 }
4390 }
4391 }
4392
4393 public void PlayDroppedItemAnimation(int time)
4394 {
4396 int num = 58;
4397 inventory[num].TurnToAir();
4398 selectedItem = num;
4399 JustDroppedAnItem = true;
4400 SetItemAnimation(time);
4401 SetItemTime(time);
4403 }
4404
4406 {
4407 if (heldProj >= 0)
4408 {
4409 Projectile projectile = Main.projectile[heldProj];
4410 if (projectile.active && projectile.owner == whoAmI)
4411 {
4412 projectile.Kill();
4413 }
4414 }
4415 for (int i = 0; i < 1000; i++)
4416 {
4418 if (projectile2.active && projectile2.owner == whoAmI && (projectile2.aiStyle == 61 || projectile2.aiStyle == 160))
4419 {
4420 projectile2.Kill();
4421 }
4422 }
4423 }
4424
4425 public int FindBuffIndex(int type)
4426 {
4427 if (buffImmune[type])
4428 {
4429 return -1;
4430 }
4431 for (int i = 0; i < maxBuffs; i++)
4432 {
4433 if (buffTime[i] >= 1 && buffType[i] == type)
4434 {
4435 return i;
4436 }
4437 }
4438 return -1;
4439 }
4440
4441 public void AddBuff(int type, int timeToAdd, bool quiet = true, bool foodHack = false)
4442 {
4443 if (buffImmune[type])
4444 {
4445 return;
4446 }
4447 bool flag = !quiet && Main.netMode == 1 && Main.pvpBuff[type] && Main.myPlayer != whoAmI;
4448 if (!flag && BuffID.Sets.IsFedState[type])
4449 {
4450 for (int i = 0; i < maxBuffs; i++)
4451 {
4453 {
4454 DelBuff(i);
4455 }
4456 }
4457 }
4460 {
4461 return;
4462 }
4463 if (!quiet && Main.netMode == 1)
4464 {
4465 NetMessage.SendData(55, -1, -1, null, whoAmI, type, num);
4466 if (flag)
4467 {
4468 return;
4469 }
4470 }
4474 }
4475
4476 private bool AddBuff_ActuallyTryToAddTheBuff(int type, int time)
4477 {
4478 int num = -1;
4479 while (num == -1)
4480 {
4481 int num2 = -1;
4482 for (int i = 0; i < maxBuffs; i++)
4483 {
4484 if (!Main.debuff[buffType[i]])
4485 {
4486 num2 = i;
4487 break;
4488 }
4489 }
4490 if (num2 == -1)
4491 {
4492 return false;
4493 }
4494 for (int j = num2; j < maxBuffs; j++)
4495 {
4496 if (buffType[j] == 0)
4497 {
4498 num = j;
4499 break;
4500 }
4501 }
4502 if (num == -1)
4503 {
4504 DelBuff(num2);
4505 }
4506 }
4507 buffType[num] = type;
4508 buffTime[num] = time;
4509 return true;
4510 }
4511
4513 {
4514 if (!Main.meleeBuff[type])
4515 {
4516 return;
4517 }
4518 for (int i = 0; i < maxBuffs; i++)
4519 {
4520 if (buffType[i] != type && Main.meleeBuff[buffType[i]])
4521 {
4522 DelBuff(i);
4523 i--;
4524 }
4525 }
4526 }
4527
4529 {
4530 if (Main.lightPet[type])
4531 {
4532 for (int i = 0; i < maxBuffs; i++)
4533 {
4534 if (Main.lightPet[buffType[i]])
4535 {
4536 DelBuff(i);
4537 }
4538 }
4539 }
4540 if (!Main.vanityPet[type])
4541 {
4542 return;
4543 }
4544 for (int j = 0; j < maxBuffs; j++)
4545 {
4546 if (Main.vanityPet[buffType[j]])
4547 {
4548 DelBuff(j);
4549 }
4550 }
4551 }
4552
4553 private bool AddBuff_TryUpdatingExistingBuffTime(int type, int time)
4554 {
4555 bool result = false;
4556 for (int i = 0; i < maxBuffs; i++)
4557 {
4558 if (buffType[i] != type)
4559 {
4560 continue;
4561 }
4562 if (type == 94)
4563 {
4564 buffTime[i] += time;
4565 if (buffTime[i] > manaSickTimeMax)
4566 {
4568 }
4569 }
4570 else if (buffTime[i] < time)
4571 {
4572 buffTime[i] = time;
4573 }
4574 result = true;
4575 break;
4576 }
4577 return result;
4578 }
4579
4581 {
4582 int num = time1;
4583 if (Main.expertMode && whoAmI == Main.myPlayer && (type == 20 || type == 22 || type == 23 || type == 24 || type == 30 || type == 31 || type == 32 || type == 33 || type == 35 || type == 36 || type == 39 || type == 44 || type == 46 || type == 47 || type == 69 || type == 70 || type == 80))
4584 {
4585 float debuffTimeMultiplier = Main.GameModeInfo.DebuffTimeMultiplier;
4586 if (Main.GameModeInfo.IsJourneyMode)
4587 {
4588 if (Main.masterMode)
4589 {
4590 debuffTimeMultiplier = Main.RegisteredGameModes[2].DebuffTimeMultiplier;
4591 }
4592 else if (Main.expertMode)
4593 {
4594 debuffTimeMultiplier = Main.RegisteredGameModes[1].DebuffTimeMultiplier;
4595 }
4596 }
4597 num = (int)(debuffTimeMultiplier * (float)num);
4598 }
4599 return num;
4600 }
4601
4602 public void DelBuff(int b)
4603 {
4604 buffTime[b] = 0;
4605 buffType[b] = 0;
4606 int num = 0;
4607 for (int i = 0; i < maxBuffs - 1; i++)
4608 {
4609 if (buffTime[i] != 0 && buffType[i] != 0)
4610 {
4611 if (num < i)
4612 {
4613 buffTime[num] = buffTime[i];
4614 buffType[num] = buffType[i];
4615 buffTime[i] = 0;
4616 buffType[i] = 0;
4617 }
4618 num++;
4619 }
4620 }
4621 }
4622
4623 public void ClearBuff(int type)
4624 {
4625 for (int i = 0; i < maxBuffs; i++)
4626 {
4627 if (buffType[i] == type)
4628 {
4629 DelBuff(i);
4630 }
4631 }
4632 }
4633
4634 public int CountBuffs()
4635 {
4636 int num = 0;
4637 for (int i = 0; i < maxBuffs; i++)
4638 {
4639 if (buffType[num] > 0)
4640 {
4641 num++;
4642 }
4643 }
4644 return num;
4645 }
4646
4647 public void QuickHeal()
4648 {
4649 if (cursed || CCed || dead || statLife == statLifeMax2 || potionDelay > 0)
4650 {
4651 return;
4652 }
4654 if (item == null || !ItemCheck_CheckCanUse(item))
4655 {
4656 return;
4657 }
4659 if (item.potion)
4660 {
4662 }
4664 if (item.type == 5)
4665 {
4667 }
4668 if (item.buffType > 0)
4669 {
4670 int num = item.buffTime;
4671 if (num == 0)
4672 {
4673 num = 3600;
4674 }
4675 AddBuff(item.buffType, num);
4676 }
4677 item.stack--;
4678 if (item.stack <= 0)
4679 {
4680 item.TurnToAir();
4681 }
4682 if (Main.myPlayer == whoAmI && item.type == 126 && breath == 0)
4683 {
4685 }
4687 }
4688
4690 {
4691 int num = statLifeMax2 - statLife;
4692 Item result = null;
4693 int num2 = -statLifeMax2;
4694 int num3 = 58;
4695 if (useVoidBag())
4696 {
4697 num3 = 98;
4698 }
4699 for (int i = 0; i < num3; i++)
4700 {
4701 Item item = ((i >= 58) ? bank4.item[i - 58] : inventory[i]);
4702 if (item.stack <= 0 || item.type <= 0 || !item.potion || item.healLife <= 0)
4703 {
4704 continue;
4705 }
4706 int num4 = item.healLife - num;
4707 if (item.type == 227 && num4 < 0)
4708 {
4709 num4 += 30;
4710 if (num4 > 0)
4711 {
4712 num4 = 0;
4713 }
4714 }
4715 if (num2 < 0)
4716 {
4717 if (num4 > num2)
4718 {
4719 result = item;
4720 num2 = num4;
4721 }
4722 }
4723 else if (num4 < num2 && num4 >= 0)
4724 {
4725 result = item;
4726 num2 = num4;
4727 }
4728 }
4729 return result;
4730 }
4731
4732 public void QuickMana()
4733 {
4734 if (cursed || CCed || dead || statMana == statManaMax2)
4735 {
4736 return;
4737 }
4739 if (item != null && ItemCheck_CheckCanUse(item))
4740 {
4742 if (item.potion)
4743 {
4745 }
4747 item.stack--;
4748 if (item.stack <= 0)
4749 {
4750 item.TurnToAir();
4751 }
4753 }
4754 }
4755
4757 {
4758 for (int i = 0; i < 58; i++)
4759 {
4760 if (inventory[i].stack > 0 && inventory[i].type > 0 && inventory[i].healMana > 0 && (potionDelay == 0 || !inventory[i].potion))
4761 {
4762 return inventory[i];
4763 }
4764 }
4765 if (useVoidBag())
4766 {
4767 for (int j = 0; j < 40; j++)
4768 {
4769 if (bank4.item[j].stack > 0 && bank4.item[j].type > 0 && bank4.item[j].healMana > 0 && (potionDelay == 0 || !bank4.item[j].potion))
4770 {
4771 return bank4.item[j];
4772 }
4773 }
4774 }
4775 return null;
4776 }
4777
4779 {
4780 bool flag = itemTime > 0 || itemAnimation > 0;
4781 if ((whoAmI != Main.myPlayer || (!flag && !CCed && !dead)) && loadoutIndex != CurrentLoadoutIndex && loadoutIndex >= 0 && loadoutIndex < Loadouts.Length)
4782 {
4784 Loadouts[loadoutIndex].Swap(this);
4786 if (whoAmI == Main.myPlayer)
4787 {
4789 Main.mouseLeftRelease = false;
4792 NetMessage.TrySendData(147, -1, -1, null, whoAmI, loadoutIndex);
4794 {
4795 PositionInWorld = base.Center,
4796 UniqueInfoPiece = loadoutIndex
4797 }, whoAmI);
4798 }
4799 }
4800 }
4801
4802 public void QuickBuff()
4803 {
4804 if (cursed || CCed || dead)
4805 {
4806 return;
4807 }
4809 if (CountBuffs() == maxBuffs)
4810 {
4811 return;
4812 }
4814 if (item != null && ItemCheck_CheckCanUse(item))
4815 {
4816 legacySoundStyle = item.UseSound;
4817 int num = item.buffTime;
4818 if (num == 0)
4819 {
4820 num = 3600;
4821 }
4822 AddBuff(item.buffType, num);
4823 if (item.consumable)
4824 {
4825 item.stack--;
4826 if (item.stack <= 0)
4827 {
4828 item.TurnToAir();
4829 }
4830 }
4831 }
4832 if (CountBuffs() != maxBuffs)
4833 {
4834 int num2 = 58;
4835 if (useVoidBag())
4836 {
4837 num2 = 98;
4838 }
4839 for (int i = 0; i < num2; i++)
4840 {
4841 Item item2 = ((i >= 58) ? bank4.item[i - 58] : inventory[i]);
4842 if (item2.stack <= 0 || item2.type <= 0 || item2.buffType <= 0 || item2.summon || !ItemCheck_CheckCanUse(item2))
4843 {
4844 continue;
4845 }
4846 int num3 = item2.buffType;
4848 if (item2.mana > 0 && flag)
4849 {
4850 if (statMana >= (int)((float)item2.mana * manaCost))
4851 {
4853 statMana -= (int)((float)item2.mana * manaCost);
4854 }
4855 else
4856 {
4857 flag = false;
4858 }
4859 }
4860 if (whoAmI == Main.myPlayer && item2.type == 603 && !Main.runningCollectorsEdition)
4861 {
4862 flag = false;
4863 }
4864 if (num3 == 27)
4865 {
4866 num3 = Main.rand.Next(3);
4867 if (num3 == 0)
4868 {
4869 num3 = 27;
4870 }
4871 if (num3 == 1)
4872 {
4873 num3 = 101;
4874 }
4875 if (num3 == 2)
4876 {
4877 num3 = 102;
4878 }
4879 }
4880 if (!flag)
4881 {
4882 continue;
4883 }
4884 legacySoundStyle = item2.UseSound;
4885 int num4 = item2.buffTime;
4886 if (num4 == 0)
4887 {
4888 num4 = 3600;
4889 }
4890 AddBuff(num3, num4);
4891 if (item2.consumable)
4892 {
4893 item2.stack--;
4894 if (item2.stack <= 0)
4895 {
4896 item2.TurnToAir();
4897 }
4898 }
4899 if (CountBuffs() == maxBuffs)
4900 {
4901 break;
4902 }
4903 }
4904 }
4905 if (legacySoundStyle != null)
4906 {
4909 }
4910 }
4911
4913 {
4914 int num = 0;
4915 Item item = null;
4916 for (int i = 0; i < maxBuffs; i++)
4917 {
4918 if (buffTime[i] >= 1)
4919 {
4921 if (num <= num2)
4922 {
4923 num = num2 + 1;
4924 }
4925 }
4926 }
4927 for (int j = 0; j < 58; j++)
4928 {
4929 Item item2 = inventory[j];
4930 if (!item2.IsAir)
4931 {
4932 int num3 = QuickBuff_FindFoodPriority(item2.buffType);
4933 if (num3 >= num && (item == null || item.buffTime < item2.buffTime || num3 > num))
4934 {
4935 item = item2;
4936 num = num3;
4937 }
4938 }
4939 }
4940 if (useVoidBag())
4941 {
4942 for (int k = 0; k < 40; k++)
4943 {
4944 Item item3 = bank4.item[k];
4945 if (!item3.IsAir)
4946 {
4947 int num4 = QuickBuff_FindFoodPriority(item3.buffType);
4948 if (num4 >= num && (item == null || item.buffTime < item3.buffTime || num4 > num))
4949 {
4950 item = item3;
4951 num = num4;
4952 }
4953 }
4954 }
4955 }
4956 return item;
4957 }
4958
4960 {
4961 return buffType switch
4962 {
4963 26 => 1,
4964 206 => 2,
4965 207 => 3,
4966 _ => 0,
4967 };
4968 }
4969
4971 {
4972 bool result = true;
4973 for (int i = 0; i < maxBuffs; i++)
4974 {
4975 if (attemptedType == 27 && (buffType[i] == 27 || buffType[i] == 101 || buffType[i] == 102))
4976 {
4977 result = false;
4978 break;
4979 }
4981 {
4982 result = false;
4983 break;
4984 }
4985 if (buffType[i] == attemptedType)
4986 {
4987 result = false;
4988 break;
4989 }
4991 {
4992 result = false;
4993 break;
4994 }
4995 }
4997 {
4998 for (int j = 0; j < maxBuffs; j++)
4999 {
5001 {
5002 result = false;
5003 }
5005 {
5006 result = false;
5007 }
5008 }
5009 }
5010 return result;
5011 }
5012
5013 public void QuickMount()
5014 {
5015 if (mount.Active)
5016 {
5017 mount.Dismount(this);
5018 }
5019 else
5020 {
5021 if (frozen || tongued || webbed || stoned || gravDir == -1f || dead || noItems)
5022 {
5023 return;
5024 }
5026 if (item != null && item.mountType != -1 && mount.CanMount(item.mountType, this) && ItemCheck_CheckCanUse(item))
5027 {
5028 if (!QuickMinecartSnap())
5029 {
5030 mount.SetMount(item.mountType, this);
5031 if (item.UseSound != null)
5032 {
5033 SoundEngine.PlaySound(item.UseSound, base.Center);
5034 }
5035 }
5036 }
5037 else
5038 {
5039 QuickMinecart();
5040 }
5041 }
5042 }
5043
5044 public bool CanFitSpace(int heightBoost)
5045 {
5046 int num = 42 + heightBoost;
5047 return Collision.IsClearSpotTest(position + new Vector2(0f, height - num) + velocity, 16f, width, num, fallThrough: true, fall2: true);
5048 }
5049
5050 private void QuickMinecart()
5051 {
5052 int num = 0;
5053 int value = (int)(position.X / 16f) - tileRangeX - num + 1;
5054 int value2 = (int)((position.X + (float)width) / 16f) + tileRangeX + num - 1;
5055 int value3 = (int)(position.Y / 16f) - tileRangeY - num + 1;
5056 int value4 = (int)((position.Y + (float)height) / 16f) + tileRangeY + num - 2;
5057 int num2 = Utils.Clamp(value, 10, Main.maxTilesX - 10);
5058 value2 = Utils.Clamp(value2, 10, Main.maxTilesX - 10);
5059 value3 = Utils.Clamp(value3, 10, Main.maxTilesY - 10);
5060 List<Point> list = Collision.GetTilesIn(BottomRight: new Vector2(value2 + 1, Utils.Clamp(value4, 10, Main.maxTilesY - 10) + 1) * 16f, TopLeft: new Vector2(num2, value3) * 16f);
5061 if (list.Count <= 0)
5062 {
5063 return;
5064 }
5065 Point? point = null;
5066 _ = base.Hitbox;
5067 for (int i = 0; i < list.Count; i++)
5068 {
5069 Point point2 = list[i];
5071 if (tileSafely.active() && tileSafely.type == 314)
5072 {
5073 Vector2 vector = list[i].ToVector2() * 16f + new Vector2(8f);
5074 if (!point.HasValue || (Distance(vector) < Distance(point.Value.ToVector2() * 16f + new Vector2(8f)) && Collision.CanHitLine(base.Center, 0, 0, vector, 0, 0)))
5075 {
5076 point = list[i];
5077 }
5078 }
5079 }
5080 if (point.HasValue)
5081 {
5082 LaunchMinecartHook(point.Value.X, point.Value.Y);
5083 }
5084 }
5085
5086 private bool QuickMinecartSnap()
5087 {
5088 bool result = false;
5089 List<Point> tilesIn = Collision.GetTilesIn(base.TopLeft - new Vector2(24f), base.BottomRight + new Vector2(24f));
5090 if (tilesIn.Count > 0)
5091 {
5092 Point? point = null;
5093 _ = base.Hitbox;
5094 for (int i = 0; i < tilesIn.Count; i++)
5095 {
5096 Point point2 = tilesIn[i];
5098 if (tileSafely.active() && tileSafely.type == 314)
5099 {
5100 Vector2 vector = tilesIn[i].ToVector2() * 16f + new Vector2(8f);
5101 if (!point.HasValue || (Distance(vector) < Distance(point.Value.ToVector2() * 16f + new Vector2(8f)) && Collision.CanHitLine(base.Center, 0, 0, vector, 0, 0)))
5102 {
5103 point = tilesIn[i];
5104 }
5105 }
5106 }
5107 if (point.HasValue)
5108 {
5109 LaunchMinecartHook(point.Value.X, point.Value.Y);
5110 result = true;
5111 }
5112 }
5113 return result;
5114 }
5115
5117 {
5118 Item item = null;
5119 if (item == null && miscEquips[3].mountType != -1 && !MountID.Sets.Cart[miscEquips[3].mountType])
5120 {
5121 item = miscEquips[3];
5122 }
5123 if (item == null)
5124 {
5125 for (int i = 0; i < 58; i++)
5126 {
5127 if (inventory[i].mountType != -1 && !MountID.Sets.Cart[inventory[i].mountType])
5128 {
5129 item = inventory[i];
5130 break;
5131 }
5132 }
5133 }
5134 return item;
5135 }
5136
5141
5146
5148 {
5150 for (int i = 0; i < 1000; i++)
5151 {
5152 if (!Main.projectile[i].active || Main.projectile[i].owner != whoAmI || Main.projectile[i].aiStyle != 7 || Main.projectile[i].ai[0] != 2f)
5153 {
5154 continue;
5155 }
5156 Point point = Main.projectile[i].Center.ToTileCoordinates();
5157 for (int j = -1; j <= 1; j++)
5158 {
5159 for (int k = -1; k <= 1; k++)
5160 {
5161 if (!WorldGen.SolidTile(point.X + j, point.Y + k))
5162 {
5163 _blackListedTileCoordsForGrappling.Add(new Point(point.X + j, point.Y + k));
5164 }
5165 }
5166 }
5167 }
5168 }
5169
5170 public void QuickGrapple()
5171 {
5172 if (frozen || tongued || webbed || stoned || dead)
5173 {
5174 return;
5175 }
5177 {
5179 {
5180 return;
5181 }
5182 bool num = controlUseTile;
5183 bool flag = releaseUseTile;
5184 if (!num && !flag)
5185 {
5186 return;
5187 }
5189 if ((tileSafely.active() && (tileSafely.type == 4 || tileSafely.type == 33 || tileSafely.type == 372 || tileSafely.type == 174 || tileSafely.type == 646 || tileSafely.type == 49)) || (inventory[selectedItem].type == 3384 && PlayerInput.UsingGamepad))
5190 {
5191 return;
5192 }
5193 }
5194 if (noItems)
5195 {
5196 return;
5197 }
5198 if (mount.Active)
5199 {
5200 mount.Dismount(this);
5201 }
5203 if (item == null || !ItemCheck_CheckCanUse(item))
5204 {
5205 return;
5206 }
5207 if (item.shoot == 73)
5208 {
5209 int num2 = 0;
5210 for (int i = 0; i < 1000; i++)
5211 {
5212 if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && (Main.projectile[i].type == 73 || Main.projectile[i].type == 74))
5213 {
5214 num2++;
5215 }
5216 }
5217 if (num2 > 1)
5218 {
5219 item = null;
5220 }
5221 }
5222 else if (item.shoot == 165)
5223 {
5224 int num3 = 0;
5225 for (int j = 0; j < 1000; j++)
5226 {
5227 if (Main.projectile[j].active && Main.projectile[j].owner == Main.myPlayer && Main.projectile[j].type == 165)
5228 {
5229 num3++;
5230 }
5231 }
5232 if (num3 > 8)
5233 {
5234 item = null;
5235 }
5236 }
5237 else if (item.shoot == 372)
5238 {
5239 int num4 = 0;
5240 for (int k = 0; k < 1000; k++)
5241 {
5242 if (Main.projectile[k].active && Main.projectile[k].owner == Main.myPlayer && Main.projectile[k].type == 372)
5243 {
5244 num4++;
5245 }
5246 }
5247 if (num4 > 2)
5248 {
5249 item = null;
5250 }
5251 }
5252 else if (item.shoot == 652)
5253 {
5254 int num5 = 0;
5255 for (int l = 0; l < 1000; l++)
5256 {
5257 if (Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == 652)
5258 {
5259 num5++;
5260 }
5261 }
5262 if (num5 > 1)
5263 {
5264 item = null;
5265 }
5266 }
5267 else if (item.type == 3572)
5268 {
5269 int num6 = 0;
5270 bool flag2 = false;
5271 for (int m = 0; m < 1000; m++)
5272 {
5273 if (Main.projectile[m].active && Main.projectile[m].owner == Main.myPlayer && Main.projectile[m].type >= 646 && Main.projectile[m].type <= 649)
5274 {
5275 num6++;
5276 if (Main.projectile[m].ai[0] == 2f)
5277 {
5278 flag2 = true;
5279 }
5280 }
5281 }
5282 if (num6 > 4 || (!flag2 && num6 > 3))
5283 {
5284 item = null;
5285 }
5286 }
5287 else
5288 {
5289 for (int n = 0; n < 1000; n++)
5290 {
5291 if (Main.projectile[n].active && Main.projectile[n].owner == Main.myPlayer && Main.projectile[n].type == item.shoot && Main.projectile[n].ai[0] != 2f)
5292 {
5293 item = null;
5294 break;
5295 }
5296 }
5297 }
5298 if (item == null)
5299 {
5300 return;
5301 }
5304 if (Main.netMode == 1 && whoAmI == Main.myPlayer)
5305 {
5306 NetMessage.SendData(51, -1, -1, null, whoAmI, 2f);
5307 }
5308 int num7 = item.shoot;
5309 float shootSpeed = item.shootSpeed;
5310 int damage = item.damage;
5311 float knockBack = item.knockBack;
5312 if (num7 == 13 || num7 == 32 || num7 == 315 || (num7 >= 230 && num7 <= 235) || num7 == 331 || num7 == 753 || num7 == 865 || num7 == 935)
5313 {
5314 grappling[0] = -1;
5315 grapCount = 0;
5316 for (int num8 = 0; num8 < 1000; num8++)
5317 {
5318 if (Main.projectile[num8].active && Main.projectile[num8].owner == whoAmI)
5319 {
5320 switch (Main.projectile[num8].type)
5321 {
5322 case 13:
5323 case 230:
5324 case 231:
5325 case 232:
5326 case 233:
5327 case 234:
5328 case 235:
5329 case 315:
5330 case 331:
5331 case 753:
5332 case 865:
5333 case 935:
5334 Main.projectile[num8].Kill();
5335 break;
5336 }
5337 }
5338 }
5339 }
5340 if (num7 == 256)
5341 {
5342 int num9 = 0;
5343 int num10 = -1;
5344 int num11 = 100000;
5345 for (int num12 = 0; num12 < 1000; num12++)
5346 {
5347 if (Main.projectile[num12].active && Main.projectile[num12].owner == whoAmI && Main.projectile[num12].type == 256)
5348 {
5349 num9++;
5350 if (Main.projectile[num12].timeLeft < num11)
5351 {
5352 num10 = num12;
5353 num11 = Main.projectile[num12].timeLeft;
5354 }
5355 }
5356 }
5357 if (num9 > 1)
5358 {
5359 Main.projectile[num10].Kill();
5360 }
5361 }
5362 if (num7 == 652)
5363 {
5364 int num13 = 0;
5365 int num14 = -1;
5366 int num15 = 100000;
5367 for (int num16 = 0; num16 < 1000; num16++)
5368 {
5369 if (Main.projectile[num16].active && Main.projectile[num16].owner == whoAmI && Main.projectile[num16].type == 652)
5370 {
5371 num13++;
5372 if (Main.projectile[num16].timeLeft < num15)
5373 {
5374 num14 = num16;
5375 num15 = Main.projectile[num16].timeLeft;
5376 }
5377 }
5378 }
5379 if (num13 > 1)
5380 {
5381 Main.projectile[num14].Kill();
5382 }
5383 }
5384 if (num7 == 73)
5385 {
5386 for (int num17 = 0; num17 < 1000; num17++)
5387 {
5388 if (Main.projectile[num17].active && Main.projectile[num17].owner == whoAmI && Main.projectile[num17].type == 73)
5389 {
5390 num7 = 74;
5391 }
5392 }
5393 }
5394 if (item.type == 3572)
5395 {
5396 int num18 = -1;
5397 int num19 = -1;
5398 for (int num20 = 0; num20 < 1000; num20++)
5399 {
5400 Projectile projectile = Main.projectile[num20];
5401 if (projectile.active && projectile.owner == whoAmI && projectile.type >= 646 && projectile.type <= 649 && (num19 == -1 || num19 < projectile.timeLeft))
5402 {
5403 num18 = projectile.type;
5404 num19 = projectile.timeLeft;
5405 }
5406 }
5407 switch (num18)
5408 {
5409 case 646:
5410 num7 = 647;
5411 break;
5412 case 647:
5413 num7 = 648;
5414 break;
5415 case 648:
5416 num7 = 649;
5417 break;
5418 case -1:
5419 case 649:
5420 num7 = 646;
5421 break;
5422 }
5423 }
5424 Vector2 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
5425 float num21 = (float)Main.mouseX + Main.screenPosition.X - vector.X;
5426 float num22 = (float)Main.mouseY + Main.screenPosition.Y - vector.Y;
5427 if (gravDir == -1f)
5428 {
5429 num22 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector.Y;
5430 }
5431 float num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22);
5432 if ((float.IsNaN(num21) && float.IsNaN(num22)) || (num21 == 0f && num22 == 0f))
5433 {
5434 num21 = direction;
5435 num22 = 0f;
5436 num23 = shootSpeed;
5437 }
5438 else
5439 {
5440 num23 = shootSpeed / num23;
5441 }
5442 num21 *= num23;
5443 num22 *= num23;
5445 }
5446
5448 {
5449 Item item = null;
5450 if (Main.projHook[miscEquips[4].shoot])
5451 {
5452 item = miscEquips[4];
5453 }
5454 if (item == null)
5455 {
5456 for (int i = 0; i < 58; i++)
5457 {
5458 if (Main.projHook[inventory[i].shoot])
5459 {
5460 item = inventory[i];
5461 break;
5462 }
5463 }
5464 }
5465 return item;
5466 }
5467
5468 public void StatusToNPC(int type, int i)
5469 {
5470 if (meleeEnchant > 0)
5471 {
5472 if (meleeEnchant == 1)
5473 {
5474 Main.npc[i].AddBuff(70, 60 * Main.rand.Next(5, 10));
5475 }
5476 if (meleeEnchant == 2)
5477 {
5478 Main.npc[i].AddBuff(39, 60 * Main.rand.Next(3, 7));
5479 }
5480 if (meleeEnchant == 3)
5481 {
5482 Main.npc[i].AddBuff(24, 60 * Main.rand.Next(3, 7));
5483 }
5484 if (meleeEnchant == 5)
5485 {
5486 Main.npc[i].AddBuff(69, 60 * Main.rand.Next(10, 20));
5487 }
5488 if (meleeEnchant == 6)
5489 {
5490 Main.npc[i].AddBuff(31, 60 * Main.rand.Next(1, 4));
5491 }
5492 if (meleeEnchant == 8)
5493 {
5494 Main.npc[i].AddBuff(20, 60 * Main.rand.Next(5, 10));
5495 }
5496 if (meleeEnchant == 4)
5497 {
5498 Main.npc[i].AddBuff(72, 120);
5499 }
5500 }
5501 if (frostBurn)
5502 {
5503 Main.npc[i].AddBuff(324, 60 * Main.rand.Next(5, 15));
5504 }
5505 if (magmaStone)
5506 {
5507 if (Main.rand.Next(4) == 0)
5508 {
5509 Main.npc[i].AddBuff(323, 360);
5510 }
5511 else if (Main.rand.Next(2) == 0)
5512 {
5513 Main.npc[i].AddBuff(323, 240);
5514 }
5515 else
5516 {
5517 Main.npc[i].AddBuff(323, 120);
5518 }
5519 }
5520 if (type == 3211)
5521 {
5522 Main.npc[i].AddBuff(69, 60 * Main.rand.Next(5, 10));
5523 }
5524 if (type == 5129)
5525 {
5526 Main.npc[i].AddBuff(120, 300);
5527 }
5528 switch (type)
5529 {
5530 case 121:
5531 if (Main.rand.Next(2) == 0)
5532 {
5533 Main.npc[i].AddBuff(24, 180);
5534 }
5535 break;
5536 case 3823:
5537 if (Main.rand.Next(4) == 0)
5538 {
5539 Main.npc[i].AddBuff(323, 300);
5540 }
5541 break;
5542 case 5382:
5543 if (Main.rand.Next(3) == 0)
5544 {
5545 Main.npc[i].AddBuff(323, 300);
5546 }
5547 break;
5548 case 122:
5549 if (Main.rand.Next(10) == 0)
5550 {
5551 Main.npc[i].AddBuff(24, 180);
5552 }
5553 break;
5554 case 190:
5555 if (Main.rand.Next(4) == 0)
5556 {
5557 Main.npc[i].AddBuff(20, 420);
5558 }
5559 break;
5560 case 217:
5561 if (Main.rand.Next(5) == 0)
5562 {
5563 Main.npc[i].AddBuff(24, 180);
5564 }
5565 break;
5566 case 1123:
5567 if (Main.rand.Next(10) != 0)
5568 {
5569 Main.npc[i].AddBuff(31, 120);
5570 }
5571 break;
5572 }
5573 }
5574
5575 public void StatusToPlayerPvP(int type, int i)
5576 {
5577 if (meleeEnchant > 0)
5578 {
5579 if (meleeEnchant == 1)
5580 {
5581 Main.player[i].AddBuff(70, 60 * Main.rand.Next(5, 10), quiet: false);
5582 }
5583 if (meleeEnchant == 2)
5584 {
5585 Main.player[i].AddBuff(39, 60 * Main.rand.Next(3, 7), quiet: false);
5586 }
5587 if (meleeEnchant == 3)
5588 {
5589 Main.player[i].AddBuff(24, 60 * Main.rand.Next(3, 7), quiet: false);
5590 }
5591 if (meleeEnchant == 5)
5592 {
5593 Main.player[i].AddBuff(69, 60 * Main.rand.Next(10, 20), quiet: false);
5594 }
5595 if (meleeEnchant == 6)
5596 {
5597 Main.player[i].AddBuff(31, 60 * Main.rand.Next(1, 4), quiet: false);
5598 }
5599 if (meleeEnchant == 8)
5600 {
5601 Main.player[i].AddBuff(20, 60 * Main.rand.Next(5, 10), quiet: false);
5602 }
5603 }
5604 if (frostBurn)
5605 {
5606 Main.player[i].AddBuff(324, 60 * Main.rand.Next(1, 8), quiet: false);
5607 }
5608 if (magmaStone)
5609 {
5610 if (Main.rand.Next(7) == 0)
5611 {
5612 Main.player[i].AddBuff(323, 360, quiet: false);
5613 }
5614 else if (Main.rand.Next(3) == 0)
5615 {
5616 Main.player[i].AddBuff(323, 120, quiet: false);
5617 }
5618 else
5619 {
5620 Main.player[i].AddBuff(323, 60, quiet: false);
5621 }
5622 }
5623 if (type == 5129)
5624 {
5625 Main.player[i].AddBuff(120, 300, quiet: false);
5626 }
5627 switch (type)
5628 {
5629 case 121:
5630 if (Main.rand.Next(2) == 0)
5631 {
5632 Main.player[i].AddBuff(24, 180, quiet: false);
5633 }
5634 break;
5635 case 3823:
5636 if (Main.rand.Next(4) == 0)
5637 {
5638 Main.player[i].AddBuff(323, 300, quiet: false);
5639 }
5640 break;
5641 case 5382:
5642 if (Main.rand.Next(3) == 0)
5643 {
5644 Main.player[i].AddBuff(323, 300, quiet: false);
5645 }
5646 break;
5647 case 122:
5648 if (Main.rand.Next(10) == 0)
5649 {
5650 Main.player[i].AddBuff(24, 180, quiet: false);
5651 }
5652 break;
5653 case 190:
5654 if (Main.rand.Next(4) == 0)
5655 {
5656 Main.player[i].AddBuff(20, 420, quiet: false);
5657 }
5658 break;
5659 case 217:
5660 if (Main.rand.Next(5) == 0)
5661 {
5662 Main.player[i].AddBuff(24, 180, quiet: false);
5663 }
5664 break;
5665 case 1123:
5666 if (Main.rand.Next(9) != 0)
5667 {
5668 Main.player[i].AddBuff(31, 120, quiet: false);
5669 }
5670 break;
5671 }
5672 }
5673
5674 public void Ghost()
5675 {
5676 immune = false;
5677 immuneAlpha = 0;
5678 if (Main.hasFocus && whoAmI == Main.myPlayer)
5679 {
5680 controlUp = false;
5681 controlLeft = false;
5682 controlDown = false;
5683 controlRight = false;
5684 controlJump = false;
5686 {
5687 PlayerInput.Triggers.Current.CopyInto(this);
5690 }
5691 }
5692 float num = 7f;
5693 float num2 = 0.2f;
5694 if (controlUp || controlJump)
5695 {
5696 if (velocity.Y > 0f)
5697 {
5698 velocity.Y *= 0.9f;
5699 }
5700 velocity.Y -= num2;
5701 if (velocity.Y < 0f - num)
5702 {
5703 velocity.Y = 0f - num;
5704 }
5705 }
5706 else if (controlDown)
5707 {
5708 if (velocity.Y < 0f)
5709 {
5710 velocity.Y *= 0.9f;
5711 }
5712 velocity.Y += num2;
5713 if (velocity.Y > num)
5714 {
5715 velocity.Y = num;
5716 }
5717 }
5718 else if ((double)velocity.Y < -0.1 || (double)velocity.Y > 0.1)
5719 {
5720 velocity.Y *= 0.9f;
5721 }
5722 else
5723 {
5724 velocity.Y = 0f;
5725 }
5726 if (controlLeft && !controlRight)
5727 {
5728 if (velocity.X > 0f)
5729 {
5730 velocity.X *= 0.9f;
5731 }
5732 velocity.X -= num2;
5733 if (velocity.X < 0f - num)
5734 {
5735 velocity.X = 0f - num;
5736 }
5737 }
5738 else if (controlRight && !controlLeft)
5739 {
5740 if (velocity.X < 0f)
5741 {
5742 velocity.X *= 0.9f;
5743 }
5744 velocity.X += num2;
5745 if (velocity.X > num)
5746 {
5747 velocity.X = num;
5748 }
5749 }
5750 else if (velocity.X < 0f - num2 || velocity.X > num2)
5751 {
5752 velocity.X *= 0.9f;
5753 }
5754 else
5755 {
5756 velocity.X = 0f;
5757 }
5758 position += velocity;
5760 if (velocity.X < 0f)
5761 {
5762 direction = -1;
5763 }
5764 else if (velocity.X > 0f)
5765 {
5766 direction = 1;
5767 }
5768 if (ghostFrameCounter >= 8)
5769 {
5771 ghostFrame++;
5772 if (ghostFrame >= 4)
5773 {
5774 ghostFrame = 0;
5775 }
5776 }
5777 if (position.X < Main.leftWorld + (float)(Lighting.OffScreenTiles * 16) + 16f)
5778 {
5779 position.X = Main.leftWorld + (float)(Lighting.OffScreenTiles * 16) + 16f;
5780 velocity.X = 0f;
5781 }
5782 if (position.X + (float)width > Main.rightWorld - (float)(Lighting.OffScreenTiles * 16) - 32f)
5783 {
5784 position.X = Main.rightWorld - (float)(Lighting.OffScreenTiles * 16) - 32f - (float)width;
5785 velocity.X = 0f;
5786 }
5787 if (position.Y < Main.topWorld + (float)(Lighting.OffScreenTiles * 16) + 16f)
5788 {
5789 position.Y = Main.topWorld + (float)(Lighting.OffScreenTiles * 16) + 16f;
5790 if ((double)velocity.Y < -0.1)
5791 {
5792 velocity.Y = -0.1f;
5793 }
5794 }
5795 if (position.Y > Main.bottomWorld - (float)(Lighting.OffScreenTiles * 16) - 32f - (float)height)
5796 {
5797 position.Y = Main.bottomWorld - (float)(Lighting.OffScreenTiles * 16) - 32f - (float)height;
5798 velocity.Y = 0f;
5799 }
5800 }
5801
5802 private void TrySyncingInput()
5803 {
5804 if (Main.netMode == 1)
5805 {
5806 bool flag = false;
5807 Player clientPlayer = Main.clientPlayer;
5808 if (controlUp != clientPlayer.controlUp)
5809 {
5810 flag = true;
5811 }
5812 if (controlDown != clientPlayer.controlDown)
5813 {
5814 flag = true;
5815 }
5816 if (controlLeft != clientPlayer.controlLeft)
5817 {
5818 flag = true;
5819 }
5820 if (controlRight != clientPlayer.controlRight)
5821 {
5822 flag = true;
5823 }
5824 if (controlJump != clientPlayer.controlJump)
5825 {
5826 flag = true;
5827 }
5828 if (controlUseItem != clientPlayer.controlUseItem)
5829 {
5830 flag = true;
5831 }
5832 if (selectedItem != clientPlayer.selectedItem)
5833 {
5834 flag = true;
5835 }
5836 if (autoReuseAllWeapons != clientPlayer.autoReuseAllWeapons)
5837 {
5838 flag = true;
5839 }
5840 if (controlDownHold != clientPlayer.controlDownHold)
5841 {
5842 flag = true;
5843 }
5845 {
5846 flag = true;
5847 }
5848 if (flag)
5849 {
5850 NetMessage.SendData(13, -1, -1, null, Main.myPlayer);
5851 }
5852 }
5853 }
5854
5855 public void OnHit(float x, float y, Entity victim)
5856 {
5857 if (Main.myPlayer != whoAmI)
5858 {
5859 return;
5860 }
5861 bool flag = victim is NPC && (((NPC)victim).type == 488 || ((NPC)victim).SpawnedFromStatue);
5862 if (titaniumStormCooldown > 0)
5863 {
5864 flag = true;
5865 }
5866 if (victim is NPC)
5867 {
5868 Main.BigBossProgressBar.TryTracking(victim.whoAmI);
5869 }
5870 if (onHitTitaniumStorm && !flag)
5871 {
5873 AddBuff(306, 600);
5874 if (ownedProjectileCounts[908] < 7)
5875 {
5876 ownedProjectileCounts[908]++;
5878 }
5879 }
5880 if (onHitDodge && shadowDodgeTimer == 0)
5881 {
5882 AddBuff(59, 1800);
5883 }
5884 if (onHitRegen)
5885 {
5886 AddBuff(58, 300);
5887 }
5888 if (stardustMinion && victim is NPC)
5889 {
5890 for (int i = 0; i < 1000; i++)
5891 {
5892 Projectile projectile = Main.projectile[i];
5893 if (projectile.active && projectile.owner == whoAmI && projectile.type == 613 && !(projectile.localAI[1] > 0f) && Main.rand.Next(2) == 0)
5894 {
5895 Vector2 vector = new Vector2(x, y) - projectile.Center;
5896 if (vector.Length() > 0f)
5897 {
5898 vector.Normalize();
5899 }
5900 vector *= 20f;
5901 Projectile.NewProjectile(Projectile.InheritSource(projectile), projectile.Center.X, projectile.Center.Y, vector.X, vector.Y, 614, projectile.damage / 3, 0f, projectile.owner, 0f, victim.whoAmI);
5902 projectile.localAI[1] = 30 + Main.rand.Next(4) * 10;
5903 }
5904 }
5905 }
5906 if (onHitPetal && petalTimer == 0)
5907 {
5908 petalTimer = 20;
5909 _ = position.X + (float)(width / 2);
5910 int num = direction;
5911 float num2 = Main.screenPosition.X;
5912 if (num < 0)
5913 {
5914 num2 += (float)Main.screenWidth;
5915 }
5916 float y2 = Main.screenPosition.Y;
5917 y2 += (float)Main.rand.Next(Main.screenHeight);
5918 Vector2 vector2 = new Vector2(num2, y2);
5919 float num3 = x - vector2.X;
5920 float num4 = y - vector2.Y;
5921 num3 += (float)Main.rand.Next(-50, 51) * 0.1f;
5922 num4 += (float)Main.rand.Next(-50, 51) * 0.1f;
5923 float num5 = (float)Math.Sqrt(num3 * num3 + num4 * num4);
5924 num5 = 24f / num5;
5925 num3 *= num5;
5926 num4 *= num5;
5928 }
5929 if (!crystalLeaf || petalTimer != 0)
5930 {
5931 return;
5932 }
5933 for (int j = 0; j < 1000; j++)
5934 {
5935 if (Main.projectile[j].owner != whoAmI || Main.projectile[j].type != 226)
5936 {
5937 continue;
5938 }
5939 petalTimer = 50;
5940 float num6 = 12f;
5941 Vector2 vector3 = new Vector2(Main.projectile[j].position.X + (float)width * 0.5f, Main.projectile[j].position.Y + (float)height * 0.5f);
5942 float num7 = x - vector3.X;
5943 float num8 = y - vector3.Y;
5944 float num9 = (float)Math.Sqrt(num7 * num7 + num8 * num8);
5945 int num10 = 180;
5946 float num11 = num6 * (float)num10;
5947 if (!(num9 >= num11))
5948 {
5949 num9 = num6 / num9;
5950 num7 *= num9;
5951 num8 *= num9;
5953 if (chaseResults.InterceptionHappens && chaseResults.InterceptionTime <= 180f)
5954 {
5955 Vector2 vector4 = chaseResults.ChaserVelocity / num10;
5956 num7 = vector4.X;
5957 num8 = vector4.Y;
5958 }
5960 break;
5961 }
5962 }
5963 }
5964
5965 public void OpenPresent(int itemType)
5966 {
5968 if (Main.rand.Next(15) == 0 && Main.hardMode)
5969 {
5971 if (Main.netMode == 1)
5972 {
5973 NetMessage.SendData(21, -1, -1, null, number, 1f);
5974 }
5975 return;
5976 }
5977 if (Main.rand.Next(30) == 0)
5978 {
5980 if (Main.netMode == 1)
5981 {
5982 NetMessage.SendData(21, -1, -1, null, number2, 1f);
5983 }
5984 return;
5985 }
5986 if (Main.rand.Next(400) == 0)
5987 {
5989 if (Main.netMode == 1)
5990 {
5991 NetMessage.SendData(21, -1, -1, null, number3, 1f);
5992 }
5993 return;
5994 }
5995 if (Main.rand.Next(150) == 0)
5996 {
5998 if (Main.netMode == 1)
5999 {
6000 NetMessage.SendData(21, -1, -1, null, number4, 1f);
6001 }
6002 number4 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 97, Main.rand.Next(30, 61));
6003 if (Main.netMode == 1)
6004 {
6005 NetMessage.SendData(21, -1, -1, null, number4, 1f);
6006 }
6007 return;
6008 }
6009 if (Main.rand.Next(150) == 0)
6010 {
6012 if (Main.netMode == 1)
6013 {
6014 NetMessage.SendData(21, -1, -1, null, number5, 1f);
6015 }
6016 return;
6017 }
6018 if (Main.rand.Next(150) == 0)
6019 {
6021 if (Main.netMode == 1)
6022 {
6023 NetMessage.SendData(21, -1, -1, null, number6, 1f);
6024 }
6025 return;
6026 }
6027 if (Main.rand.Next(150) == 0)
6028 {
6030 if (Main.netMode == 1)
6031 {
6032 NetMessage.SendData(21, -1, -1, null, number7, 1f);
6033 }
6034 return;
6035 }
6036 if (Main.rand.Next(150) == 0)
6037 {
6039 if (Main.netMode == 1)
6040 {
6041 NetMessage.SendData(21, -1, -1, null, number8, 1f);
6042 }
6043 return;
6044 }
6045 if (Main.rand.Next(150) == 0)
6046 {
6048 if (Main.netMode == 1)
6049 {
6050 NetMessage.SendData(21, -1, -1, null, number9, 1f);
6051 }
6052 return;
6053 }
6054 if (Main.rand.Next(300) == 0)
6055 {
6057 if (Main.netMode == 1)
6058 {
6059 NetMessage.SendData(21, -1, -1, null, number10, 1f);
6060 }
6061 return;
6062 }
6063 if (Main.rand.Next(40) == 0)
6064 {
6066 if (Main.netMode == 1)
6067 {
6068 NetMessage.SendData(21, -1, -1, null, number11, 1f);
6069 }
6070 return;
6071 }
6072 if (Main.rand.Next(10) == 0)
6073 {
6075 if (Main.netMode == 1)
6076 {
6077 NetMessage.SendData(21, -1, -1, null, number12, 1f);
6078 }
6079 return;
6080 }
6081 if (Main.rand.Next(15) == 0)
6082 {
6083 switch (Main.rand.Next(5))
6084 {
6085 case 0:
6086 {
6088 if (Main.netMode == 1)
6089 {
6090 NetMessage.SendData(21, -1, -1, null, number14, 1f);
6091 }
6093 if (Main.netMode == 1)
6094 {
6095 NetMessage.SendData(21, -1, -1, null, number14, 1f);
6096 }
6098 if (Main.netMode == 1)
6099 {
6100 NetMessage.SendData(21, -1, -1, null, number14, 1f);
6101 }
6102 break;
6103 }
6104 case 1:
6105 {
6107 if (Main.netMode == 1)
6108 {
6109 NetMessage.SendData(21, -1, -1, null, number16, 1f);
6110 }
6112 if (Main.netMode == 1)
6113 {
6114 NetMessage.SendData(21, -1, -1, null, number16, 1f);
6115 }
6117 if (Main.netMode == 1)
6118 {
6119 NetMessage.SendData(21, -1, -1, null, number16, 1f);
6120 }
6121 break;
6122 }
6123 case 2:
6124 {
6126 if (Main.netMode == 1)
6127 {
6128 NetMessage.SendData(21, -1, -1, null, number17, 1f);
6129 }
6131 if (Main.netMode == 1)
6132 {
6133 NetMessage.SendData(21, -1, -1, null, number17, 1f);
6134 }
6136 if (Main.netMode == 1)
6137 {
6138 NetMessage.SendData(21, -1, -1, null, number17, 1f);
6139 }
6140 break;
6141 }
6142 case 3:
6143 {
6145 if (Main.netMode == 1)
6146 {
6147 NetMessage.SendData(21, -1, -1, null, number15, 1f);
6148 }
6149 break;
6150 }
6151 case 4:
6152 {
6154 if (Main.netMode == 1)
6155 {
6156 NetMessage.SendData(21, -1, -1, null, number13, 1f);
6157 }
6158 break;
6159 }
6160 }
6161 return;
6162 }
6163 if (Main.rand.Next(7) == 0)
6164 {
6165 int num = Main.rand.Next(3);
6166 if (num == 0)
6167 {
6168 num = 1911;
6169 }
6170 if (num == 1)
6171 {
6172 num = 1919;
6173 }
6174 if (num == 2)
6175 {
6176 num = 1920;
6177 }
6179 if (Main.netMode == 1)
6180 {
6181 NetMessage.SendData(21, -1, -1, null, number18, 1f);
6182 }
6183 return;
6184 }
6185 if (Main.rand.Next(8) == 0)
6186 {
6187 int number19 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1912, Main.rand.Next(1, 4));
6188 if (Main.netMode == 1)
6189 {
6190 NetMessage.SendData(21, -1, -1, null, number19, 1f);
6191 }
6192 return;
6193 }
6194 if (Main.rand.Next(9) == 0)
6195 {
6196 int number20 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1913, Main.rand.Next(20, 41));
6197 if (Main.netMode == 1)
6198 {
6199 NetMessage.SendData(21, -1, -1, null, number20, 1f);
6200 }
6201 return;
6202 }
6203 switch (Main.rand.Next(3))
6204 {
6205 case 0:
6206 {
6207 int number22 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1872, Main.rand.Next(20, 50));
6208 if (Main.netMode == 1)
6209 {
6210 NetMessage.SendData(21, -1, -1, null, number22, 1f);
6211 }
6212 break;
6213 }
6214 case 1:
6215 {
6216 int number23 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 586, Main.rand.Next(20, 50));
6217 if (Main.netMode == 1)
6218 {
6219 NetMessage.SendData(21, -1, -1, null, number23, 1f);
6220 }
6221 break;
6222 }
6223 default:
6224 {
6225 int number21 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 591, Main.rand.Next(20, 50));
6226 if (Main.netMode == 1)
6227 {
6228 NetMessage.SendData(21, -1, -1, null, number21, 1f);
6229 }
6230 break;
6231 }
6232 }
6233 }
6234
6236 {
6238 int num = Main.rand.Next(14);
6239 if (num == 0 && Main.hardMode)
6240 {
6242 if (Main.netMode == 1)
6243 {
6244 NetMessage.SendData(21, -1, -1, null, number, 1f);
6245 }
6246 }
6247 else if (num <= 7)
6248 {
6249 int number2 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 586, Main.rand.Next(20, 50));
6250 if (Main.netMode == 1)
6251 {
6252 NetMessage.SendData(21, -1, -1, null, number2, 1f);
6253 }
6254 }
6255 else
6256 {
6257 int number3 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 591, Main.rand.Next(20, 50));
6258 if (Main.netMode == 1)
6259 {
6260 NetMessage.SendData(21, -1, -1, null, number3, 1f);
6261 }
6262 }
6263 }
6264
6265 public void QuickSpawnItem(IEntitySource source, int item, int stack = 1)
6266 {
6267 int number = Item.NewItem(source, (int)position.X, (int)position.Y, width, height, item, stack, noBroadcast: false, -1);
6268 if (Main.netMode == 1)
6269 {
6270 NetMessage.SendData(21, -1, -1, null, number, 1f);
6271 }
6272 }
6273
6274 public void OpenBossBag(int type)
6275 {
6277 float strength = 1f;
6278 if (gameModeInfo.IsJourneyMode)
6279 {
6281 if (power != null && power.GetIsUnlocked())
6282 {
6283 strength = power.StrengthMultiplierToGiveNPCs;
6284 }
6285 }
6288 switch (type)
6289 {
6290 case 3318:
6291 {
6292 if (Main.rand.Next(2) == 0)
6293 {
6295 }
6296 if (Main.rand.Next(7) == 0)
6297 {
6299 }
6300 int num4 = Main.rand.Next(256, 259);
6301 int num5;
6302 for (num5 = Main.rand.Next(256, 259); num5 == num4; num5 = Main.rand.Next(256, 259))
6303 {
6304 }
6307 if (Main.rand.Next(2) == 0)
6308 {
6310 }
6311 else
6312 {
6314 }
6317 break;
6318 }
6319 case 3319:
6320 if (Main.rand.Next(7) == 0)
6321 {
6323 }
6324 if (Main.rand.Next(30) == 0)
6325 {
6327 }
6328 if (WorldGen.crimson)
6329 {
6330 int num9 = Main.rand.Next(20) + 10;
6331 num9 += Main.rand.Next(20) + 10;
6332 num9 += Main.rand.Next(20) + 10;
6334 num9 = Main.rand.Next(3) + 1;
6336 }
6337 else
6338 {
6339 int num10 = Main.rand.Next(20) + 10;
6340 num10 += Main.rand.Next(20) + 10;
6341 num10 += Main.rand.Next(20) + 10;
6343 num10 = Main.rand.Next(3) + 1;
6345 num10 = Main.rand.Next(30) + 20;
6347 }
6349 break;
6350 case 3320:
6351 {
6352 int num3 = Main.rand.Next(15, 30);
6353 if (flag)
6354 {
6355 num3 = Main.rand.Next(110, 136);
6357 }
6358 else
6359 {
6360 num3 = Main.rand.Next(80, 111);
6362 }
6363 if (flag)
6364 {
6365 num3 = Main.rand.Next(30, 51);
6367 }
6368 else
6369 {
6370 num3 = Main.rand.Next(20, 41);
6372 }
6373 if (Main.rand.Next(20) == 0)
6374 {
6376 }
6377 if (Main.rand.Next(7) == 0)
6378 {
6380 }
6382 break;
6383 }
6384 case 3321:
6385 {
6386 int num8 = Main.rand.Next(20, 46);
6387 if (flag)
6388 {
6389 num8 = Main.rand.Next(110, 136);
6391 }
6392 else
6393 {
6394 num8 = Main.rand.Next(80, 111);
6396 }
6397 if (flag)
6398 {
6399 num8 = Main.rand.Next(30, 51);
6401 }
6402 else
6403 {
6404 num8 = Main.rand.Next(20, 41);
6406 }
6407 if (Main.rand.Next(7) == 0)
6408 {
6410 }
6411 if (Main.rand.Next(20) == 0)
6412 {
6414 }
6416 break;
6417 }
6418 case 3322:
6419 {
6420 if (Main.rand.Next(7) == 0)
6421 {
6423 }
6424 int num6 = Main.rand.Next(3);
6425 switch (num6)
6426 {
6427 case 0:
6428 num6 = 1121;
6429 break;
6430 case 1:
6431 num6 = 1123;
6432 break;
6433 case 2:
6434 num6 = 2888;
6435 break;
6436 }
6439 if (Main.rand.Next(3) == 0)
6440 {
6442 }
6443 if (Main.rand.Next(9) == 0)
6444 {
6446 }
6447 if (Main.rand.Next(9) == 0)
6448 {
6450 }
6453 QuickSpawnItem(itemSource_OpenItem, 1130, Main.rand.Next(10, 30));
6454 QuickSpawnItem(itemSource_OpenItem, 2431, Main.rand.Next(17, 30));
6455 break;
6456 }
6457 case 3323:
6459 switch (Main.rand.Next(3))
6460 {
6461 case 0:
6463 break;
6464 case 1:
6466 break;
6467 default:
6469 break;
6470 }
6471 break;
6472 case 3324:
6473 {
6474 if (Main.rand.Next(7) == 0)
6475 {
6477 }
6479 if (!extraAccessory)
6480 {
6482 }
6483 int num7 = Main.rand.Next(4);
6484 num7 = ((num7 != 3) ? (489 + num7) : 2998);
6486 switch (Main.rand.Next(4))
6487 {
6488 case 0:
6490 break;
6491 case 1:
6493 break;
6494 case 2:
6496 break;
6497 case 3:
6499 break;
6500 }
6501 break;
6502 }
6503 case 3325:
6505 if (Main.rand.Next(7) == 0)
6506 {
6508 }
6509 QuickSpawnItem(itemSource_OpenItem, 548, Main.rand.Next(25, 41));
6510 QuickSpawnItem(itemSource_OpenItem, 1225, Main.rand.Next(20, 36));
6512 break;
6513 case 3326:
6515 if (Main.rand.Next(7) == 0)
6516 {
6518 }
6519 QuickSpawnItem(itemSource_OpenItem, 549, Main.rand.Next(25, 41));
6520 QuickSpawnItem(itemSource_OpenItem, 1225, Main.rand.Next(20, 36));
6522 break;
6523 case 3327:
6525 if (Main.rand.Next(7) == 0)
6526 {
6528 }
6529 QuickSpawnItem(itemSource_OpenItem, 547, Main.rand.Next(25, 41));
6530 QuickSpawnItem(itemSource_OpenItem, 1225, Main.rand.Next(20, 36));
6532 break;
6533 case 3328:
6535 if (Main.rand.Next(7) == 0)
6536 {
6538 }
6541 if (Main.rand.Next(15) == 0)
6542 {
6544 }
6545 if (Main.rand.Next(20) == 0)
6546 {
6548 }
6549 if (Main.rand.Next(2) == 0)
6550 {
6552 }
6553 if (Main.rand.Next(10) == 0)
6554 {
6556 }
6557 switch (Main.rand.Next(7))
6558 {
6559 case 0:
6561 QuickSpawnItem(itemSource_OpenItem, 771, Main.rand.Next(50, 150));
6562 break;
6563 case 1:
6565 break;
6566 case 2:
6568 break;
6569 case 3:
6571 break;
6572 case 4:
6574 break;
6575 case 5:
6577 break;
6578 case 6:
6580 break;
6581 }
6582 break;
6583 case 3329:
6586 if (Main.rand.Next(7) == 0)
6587 {
6589 }
6590 if (Main.rand.Next(3) == 0)
6591 {
6593 }
6594 switch (Main.rand.Next(7))
6595 {
6596 case 0:
6598 QuickSpawnItem(itemSource_OpenItem, 1261, Main.rand.Next(60, 100));
6599 break;
6600 case 1:
6602 break;
6603 case 2:
6605 break;
6606 case 3:
6608 break;
6609 case 4:
6611 break;
6612 case 5:
6614 break;
6615 default:
6617 break;
6618 }
6619 QuickSpawnItem(itemSource_OpenItem, 2218, Main.rand.Next(18, 24));
6620 break;
6621 case 3330:
6624 if (Main.rand.Next(7) == 0)
6625 {
6627 }
6628 if (Main.rand.Next(10) == 0)
6629 {
6631 }
6632 switch (Main.rand.Next(5))
6633 {
6634 case 0:
6636 break;
6637 case 1:
6639 break;
6640 case 2:
6642 break;
6643 case 3:
6645 break;
6646 case 4:
6647 if (Main.remixWorld)
6648 {
6650 }
6651 else
6652 {
6654 }
6655 break;
6656 }
6657 break;
6658 case 3331:
6660 if (Main.rand.Next(7) == 0)
6661 {
6663 }
6664 break;
6665 case 3860:
6667 if (Main.rand.Next(7) == 0)
6668 {
6670 }
6671 switch (Main.rand.Next(4))
6672 {
6673 case 0:
6675 break;
6676 case 1:
6678 break;
6679 case 2:
6681 break;
6682 default:
6684 break;
6685 }
6686 if (Main.rand.Next(4) == 0)
6687 {
6689 }
6690 QuickSpawnItem(itemSource_OpenItem, 3817, Main.rand.Next(30, 50));
6691 break;
6692 case 4782:
6695 if (Main.rand.Next(7) == 0)
6696 {
6698 }
6699 if (Main.rand.Next(10) == 0)
6700 {
6702 }
6703 if (Main.rand.Next(20) == 0)
6704 {
6706 }
6707 if (Main.rand.Next(4) == 0)
6708 {
6710 }
6711 if (Main.rand.Next(20) == 0)
6712 {
6714 }
6715 switch (Main.rand.Next(4))
6716 {
6717 case 0:
6719 break;
6720 case 1:
6722 break;
6723 case 2:
6725 break;
6726 case 3:
6728 break;
6729 }
6730 break;
6731 case 4957:
6732 {
6734 QuickSpawnItem(itemSource_OpenItem, 4986, Main.rand.Next(25, 75));
6735 if (Main.rand.Next(7) == 0)
6736 {
6738 }
6739 if (Main.rand.Next(2) == 0)
6740 {
6742 }
6743 if (Main.rand.Next(3) == 0)
6744 {
6746 }
6747 if (Main.rand.Next(2) == 0)
6748 {
6750 }
6751 int num = Main.rand.Next(4982, 4985);
6752 int num2 = Main.rand.Next(4982, 4985);
6753 while (num2 == num)
6754 {
6755 num = Main.rand.Next(4982, 4985);
6756 }
6759 break;
6760 }
6761 }
6762 switch (type)
6763 {
6764 case 5111:
6766 if (Main.rand.Next(7) == 0)
6767 {
6769 }
6770 if (Main.rand.Next(14) == 0)
6771 {
6773 }
6774 if (Main.rand.Next(3) == 0)
6775 {
6777 }
6778 if (Main.rand.Next(3) == 0)
6779 {
6781 }
6782 if (Main.rand.Next(3) == 0)
6783 {
6785 }
6786 switch (Main.rand.Next(4))
6787 {
6788 case 0:
6790 break;
6791 case 1:
6793 break;
6794 case 2:
6796 break;
6797 case 3:
6799 break;
6800 }
6801 break;
6802 case 3332:
6803 {
6805 if (Main.rand.Next(7) == 0)
6806 {
6808 }
6809 if (Main.rand.Next(10) == 0)
6810 {
6812 }
6813 if (!HasItem(3384))
6814 {
6816 }
6817 QuickSpawnItem(itemSource_OpenItem, 3460, Main.rand.Next(90, 111));
6821 List<int> list = new List<int> { 3063, 3389, 3065, 1553, 3930, 3541, 3570, 3571, 3569 };
6822 for (int i = 0; i < 2; i++)
6823 {
6824 int index = Main.rand.Next(list.Count);
6825 int item = list[index];
6827 list.RemoveAt(index);
6828 }
6829 break;
6830 }
6831 }
6832 int num11 = -1;
6833 if (type == 3318)
6834 {
6835 num11 = 50;
6836 }
6837 if (type == 3319)
6838 {
6839 num11 = 4;
6840 }
6841 if (type == 3320)
6842 {
6843 num11 = 13;
6844 }
6845 if (type == 3321)
6846 {
6847 num11 = 266;
6848 }
6849 if (type == 3322)
6850 {
6851 num11 = 222;
6852 }
6853 if (type == 3323)
6854 {
6855 num11 = 35;
6856 }
6857 if (type == 3324)
6858 {
6859 num11 = 113;
6860 }
6861 if (type == 3325)
6862 {
6863 num11 = 134;
6864 }
6865 if (type == 3326)
6866 {
6867 num11 = 125;
6868 }
6869 if (type == 3327)
6870 {
6871 num11 = 127;
6872 }
6873 if (type == 3328)
6874 {
6875 num11 = 262;
6876 }
6877 if (type == 3329)
6878 {
6879 num11 = 245;
6880 }
6881 if (type == 3330)
6882 {
6883 num11 = 370;
6884 }
6885 if (type == 3331)
6886 {
6887 num11 = 439;
6888 }
6889 if (type == 3332)
6890 {
6891 num11 = 398;
6892 }
6893 if (type == 3860)
6894 {
6895 num11 = 551;
6896 }
6897 if (type == 3861)
6898 {
6899 num11 = 576;
6900 }
6901 if (type == 3862)
6902 {
6903 num11 = 564;
6904 }
6905 if (type == 4782)
6906 {
6907 num11 = 636;
6908 }
6909 if (type == 4957)
6910 {
6911 num11 = 657;
6912 }
6913 if (type == 5111)
6914 {
6915 num11 = 668;
6916 }
6917 if (num11 <= 0)
6918 {
6919 return;
6920 }
6921 NPC nPC = new NPC();
6922 nPC.SetDefaults(num11);
6923 float value = nPC.value;
6924 value *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
6925 if (Main.rand.Next(5) == 0)
6926 {
6927 value *= 1f + (float)Main.rand.Next(5, 11) * 0.01f;
6928 }
6929 if (Main.rand.Next(10) == 0)
6930 {
6931 value *= 1f + (float)Main.rand.Next(10, 21) * 0.01f;
6932 }
6933 if (Main.rand.Next(15) == 0)
6934 {
6935 value *= 1f + (float)Main.rand.Next(15, 31) * 0.01f;
6936 }
6937 if (Main.rand.Next(20) == 0)
6938 {
6939 value *= 1f + (float)Main.rand.Next(20, 41) * 0.01f;
6940 }
6941 while ((int)value > 0)
6942 {
6943 if (value > 1000000f)
6944 {
6945 int num12 = (int)(value / 1000000f);
6946 value -= (float)(1000000 * num12);
6948 continue;
6949 }
6950 if (value > 10000f)
6951 {
6952 int num13 = (int)(value / 10000f);
6953 value -= (float)(10000 * num13);
6955 continue;
6956 }
6957 if (value > 100f)
6958 {
6959 int num14 = (int)(value / 100f);
6960 value -= (float)(100 * num14);
6962 continue;
6963 }
6964 int num15 = (int)value;
6965 if (num15 < 1)
6966 {
6967 num15 = 1;
6968 }
6969 value -= (float)num15;
6971 }
6972 }
6973
6975 {
6976 if (Main.rand.Next(Main.tenthAnniversaryWorld ? 8 : 16) == 0)
6977 {
6978 switch (Main.rand.Next(18))
6979 {
6980 case 0:
6981 QuickSpawnItem(source, 666);
6982 QuickSpawnItem(source, 667);
6983 QuickSpawnItem(source, 668);
6984 QuickSpawnItem(source, 665);
6985 QuickSpawnItem(source, 3287);
6986 break;
6987 case 1:
6988 QuickSpawnItem(source, 1554);
6989 QuickSpawnItem(source, 1555);
6990 QuickSpawnItem(source, 1556);
6991 QuickSpawnItem(source, 1586);
6992 break;
6993 case 2:
6994 QuickSpawnItem(source, 1554);
6995 QuickSpawnItem(source, 1587);
6996 QuickSpawnItem(source, 1588);
6997 QuickSpawnItem(source, 1586);
6998 break;
6999 case 3:
7000 QuickSpawnItem(source, 1557);
7001 QuickSpawnItem(source, 1558);
7002 QuickSpawnItem(source, 1559);
7003 QuickSpawnItem(source, 1585);
7004 break;
7005 case 4:
7006 QuickSpawnItem(source, 1560);
7007 QuickSpawnItem(source, 1561);
7008 QuickSpawnItem(source, 1562);
7009 QuickSpawnItem(source, 1584);
7010 break;
7011 case 5:
7012 QuickSpawnItem(source, 1563);
7013 QuickSpawnItem(source, 1564);
7014 QuickSpawnItem(source, 1565);
7015 QuickSpawnItem(source, 3582);
7016 break;
7017 case 6:
7018 QuickSpawnItem(source, 1566);
7019 QuickSpawnItem(source, 1567);
7020 QuickSpawnItem(source, 1568);
7021 break;
7022 case 7:
7023 QuickSpawnItem(source, 1580);
7024 QuickSpawnItem(source, 1581);
7025 QuickSpawnItem(source, 1582);
7026 QuickSpawnItem(source, 1583);
7027 break;
7028 case 8:
7029 QuickSpawnItem(source, 3226);
7030 QuickSpawnItem(source, 3227);
7031 QuickSpawnItem(source, 3228);
7032 QuickSpawnItem(source, 3288);
7033 break;
7034 case 9:
7035 QuickSpawnItem(source, 3583);
7036 QuickSpawnItem(source, 3581);
7037 QuickSpawnItem(source, 3578);
7038 QuickSpawnItem(source, 3579);
7039 QuickSpawnItem(source, 3580);
7040 break;
7041 case 10:
7042 QuickSpawnItem(source, 3585);
7043 QuickSpawnItem(source, 3586);
7044 QuickSpawnItem(source, 3587);
7045 QuickSpawnItem(source, 3588);
7046 QuickSpawnItem(source, 3024, 4);
7047 break;
7048 case 11:
7049 QuickSpawnItem(source, 3589);
7050 QuickSpawnItem(source, 3590);
7051 QuickSpawnItem(source, 3591);
7052 QuickSpawnItem(source, 3592);
7053 QuickSpawnItem(source, 3599, 4);
7054 break;
7055 case 12:
7056 QuickSpawnItem(source, 3368);
7057 QuickSpawnItem(source, 3921);
7058 QuickSpawnItem(source, 3922);
7059 QuickSpawnItem(source, 3923);
7060 QuickSpawnItem(source, 3924);
7061 break;
7062 case 13:
7063 QuickSpawnItem(source, 3925);
7064 QuickSpawnItem(source, 3926);
7065 QuickSpawnItem(source, 3927);
7066 QuickSpawnItem(source, 3928);
7067 QuickSpawnItem(source, 3929);
7068 break;
7069 case 14:
7070 QuickSpawnItem(source, 4732);
7071 QuickSpawnItem(source, 4733);
7072 QuickSpawnItem(source, 4734);
7073 QuickSpawnItem(source, 4730);
7074 break;
7075 case 15:
7076 QuickSpawnItem(source, 4747);
7077 QuickSpawnItem(source, 4748);
7078 QuickSpawnItem(source, 4749);
7079 QuickSpawnItem(source, 4746);
7080 break;
7081 case 16:
7082 QuickSpawnItem(source, 4751);
7083 QuickSpawnItem(source, 4752);
7084 QuickSpawnItem(source, 4753);
7085 QuickSpawnItem(source, 4750);
7086 break;
7087 case 17:
7088 QuickSpawnItem(source, 4755);
7089 QuickSpawnItem(source, 4756);
7090 QuickSpawnItem(source, 4757);
7091 QuickSpawnItem(source, 4754);
7092 break;
7093 }
7094 }
7095 }
7096
7098 {
7101 switch (crateItemID)
7102 {
7103 case 2334:
7104 case 3979:
7105 {
7106 bool flag2 = true;
7107 while (flag2)
7108 {
7109 if (flag && flag2 && Main.rand.Next(200) == 0)
7110 {
7112 if (Main.netMode == 1)
7113 {
7114 NetMessage.SendData(21, -1, -1, null, number, 1f);
7115 }
7116 flag2 = false;
7117 }
7118 if (flag2 && Main.rand.Next(40) == 0)
7119 {
7120 int type = 3200;
7121 int stack = 1;
7122 int number2 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, type, stack, noBroadcast: false, -1);
7123 if (Main.netMode == 1)
7124 {
7125 NetMessage.SendData(21, -1, -1, null, number2, 1f);
7126 }
7127 flag2 = false;
7128 }
7129 if (flag2 && Main.rand.Next(40) == 0)
7130 {
7131 int type2 = 3201;
7132 int stack2 = 1;
7134 if (Main.netMode == 1)
7135 {
7136 NetMessage.SendData(21, -1, -1, null, number3, 1f);
7137 }
7138 flag2 = false;
7139 }
7140 if (flag && flag2 && Main.rand.Next(25) == 0)
7141 {
7142 int type3 = 2424;
7143 int stack3 = 1;
7145 if (Main.netMode == 1)
7146 {
7147 NetMessage.SendData(21, -1, -1, null, number4, 1f);
7148 }
7149 flag2 = false;
7150 }
7151 if (Main.rand.Next(20) == 0)
7152 {
7153 int num = Main.rand.Next(5);
7154 switch (num)
7155 {
7156 case 0:
7157 num = 285;
7158 break;
7159 case 1:
7160 num = 953;
7161 break;
7162 case 2:
7163 num = 4341;
7164 break;
7165 case 3:
7166 num = 3068;
7167 break;
7168 case 4:
7169 num = 3084;
7170 break;
7171 }
7172 int number5 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, num, 1, noBroadcast: false, -1);
7173 if (Main.netMode == 1)
7174 {
7175 NetMessage.SendData(21, -1, -1, null, number5, 1f);
7176 }
7177 flag2 = false;
7178 }
7179 if (!flag && flag2 && Main.rand.Next(50) == 0)
7180 {
7181 int type4 = 997;
7182 int stack4 = 1;
7184 if (Main.netMode == 1)
7185 {
7186 NetMessage.SendData(21, -1, -1, null, number6, 1f);
7187 }
7188 flag2 = false;
7189 }
7190 if (Main.rand.Next(7) == 0)
7191 {
7192 int type5;
7193 int stack5;
7194 if (Main.rand.Next(3) == 0)
7195 {
7196 type5 = 73;
7197 stack5 = Main.rand.Next(1, 6);
7198 }
7199 else
7200 {
7201 type5 = 72;
7202 stack5 = Main.rand.Next(20, 91);
7203 }
7205 if (Main.netMode == 1)
7206 {
7207 NetMessage.SendData(21, -1, -1, null, number7, 1f);
7208 }
7209 flag2 = false;
7210 }
7211 if (Main.rand.Next(7) == 0)
7212 {
7213 int num2 = Main.rand.Next(4);
7214 switch (num2)
7215 {
7216 case 0:
7217 num2 = 12;
7218 break;
7219 case 1:
7220 num2 = 699;
7221 break;
7222 case 2:
7223 num2 = 11;
7224 break;
7225 case 3:
7226 num2 = 700;
7227 break;
7228 }
7229 if (Main.rand.Next(2) == 0 && flag)
7230 {
7231 num2 = Main.rand.Next(2);
7232 switch (num2)
7233 {
7234 case 0:
7235 num2 = 364;
7236 break;
7237 case 1:
7238 num2 = 1104;
7239 break;
7240 }
7241 }
7242 int stack6 = Main.rand.Next(4, 16);
7244 if (Main.netMode == 1)
7245 {
7246 NetMessage.SendData(21, -1, -1, null, number8, 1f);
7247 }
7248 flag2 = false;
7249 }
7250 else if (Main.rand.Next(8) == 0)
7251 {
7252 int num3 = Main.rand.Next(4);
7253 switch (num3)
7254 {
7255 case 0:
7256 num3 = 20;
7257 break;
7258 case 1:
7259 num3 = 703;
7260 break;
7261 case 2:
7262 num3 = 22;
7263 break;
7264 case 3:
7265 num3 = 704;
7266 break;
7267 case 4:
7268 num3 = 21;
7269 break;
7270 case 5:
7271 num3 = 705;
7272 break;
7273 case 6:
7274 num3 = 19;
7275 break;
7276 case 7:
7277 num3 = 706;
7278 break;
7279 }
7280 int stack7 = Main.rand.Next(2, 6);
7281 if (Main.rand.Next(2) == 0 && flag)
7282 {
7283 num3 = Main.rand.Next(2);
7284 switch (num3)
7285 {
7286 case 0:
7287 num3 = 381;
7288 break;
7289 case 1:
7290 num3 = 1184;
7291 break;
7292 case 2:
7293 num3 = 382;
7294 break;
7295 case 3:
7296 num3 = 1191;
7297 break;
7298 case 4:
7299 num3 = 391;
7300 break;
7301 case 5:
7302 num3 = 1198;
7303 break;
7304 }
7305 stack7 = Main.rand.Next(2, 4);
7306 }
7308 if (Main.netMode == 1)
7309 {
7310 NetMessage.SendData(21, -1, -1, null, number9, 1f);
7311 }
7312 flag2 = false;
7313 }
7314 if (Main.rand.Next(7) == 0)
7315 {
7316 int num4 = Main.rand.Next(10);
7317 switch (num4)
7318 {
7319 case 0:
7320 num4 = 288;
7321 break;
7322 case 1:
7323 num4 = 290;
7324 break;
7325 case 2:
7326 num4 = 292;
7327 break;
7328 case 3:
7329 num4 = 299;
7330 break;
7331 case 4:
7332 num4 = 298;
7333 break;
7334 case 5:
7335 num4 = 304;
7336 break;
7337 case 6:
7338 num4 = 291;
7339 break;
7340 case 7:
7341 num4 = 2322;
7342 break;
7343 case 8:
7344 num4 = 2323;
7345 break;
7346 case 9:
7347 num4 = 2329;
7348 break;
7349 }
7350 int stack8 = Main.rand.Next(1, 4);
7352 if (Main.netMode == 1)
7353 {
7354 NetMessage.SendData(21, -1, -1, null, number10, 1f);
7355 }
7356 flag2 = false;
7357 }
7358 }
7359 if (Main.rand.Next(3) == 0)
7360 {
7361 int num5 = Main.rand.Next(2);
7362 switch (num5)
7363 {
7364 case 0:
7365 num5 = 28;
7366 break;
7367 case 1:
7368 num5 = 110;
7369 break;
7370 }
7371 int stack9 = Main.rand.Next(5, 16);
7373 if (Main.netMode == 1)
7374 {
7375 NetMessage.SendData(21, -1, -1, null, number11, 1f);
7376 }
7377 }
7378 if (Main.rand.Next(3) == 0)
7379 {
7380 int type6 = ((Main.rand.Next(3) != 0) ? 2674 : 2675);
7381 int stack10 = Main.rand.Next(1, 5);
7383 if (Main.netMode == 1)
7384 {
7385 NetMessage.SendData(21, -1, -1, null, number12, 1f);
7386 }
7387 }
7388 return;
7389 }
7390 case 2335:
7391 case 3980:
7392 {
7393 bool flag4 = true;
7394 while (flag4)
7395 {
7396 if (flag && flag4 && Main.rand.Next(60) == 0)
7397 {
7399 if (Main.netMode == 1)
7400 {
7401 NetMessage.SendData(21, -1, -1, null, number24, 1f);
7402 }
7403 flag4 = false;
7404 }
7405 if (flag4 && Main.rand.Next(25) == 0)
7406 {
7407 int type12 = 2501;
7408 int stack19 = 1;
7410 if (Main.netMode == 1)
7411 {
7412 NetMessage.SendData(21, -1, -1, null, number25, 1f);
7413 }
7414 flag4 = false;
7415 }
7416 if (flag4 && Main.rand.Next(20) == 0)
7417 {
7418 int type13 = 2587;
7419 int stack20 = 1;
7421 if (Main.netMode == 1)
7422 {
7423 NetMessage.SendData(21, -1, -1, null, number26, 1f);
7424 }
7425 flag4 = false;
7426 }
7427 if (flag4 && Main.rand.Next(15) == 0)
7428 {
7429 int type14 = 2608;
7430 int stack21 = 1;
7432 if (Main.netMode == 1)
7433 {
7434 NetMessage.SendData(21, -1, -1, null, number27, 1f);
7435 }
7436 flag4 = false;
7437 }
7438 if (flag4 && Main.rand.Next(20) == 0)
7439 {
7440 int type15 = 3200;
7441 int stack22 = 1;
7443 if (Main.netMode == 1)
7444 {
7445 NetMessage.SendData(21, -1, -1, null, number28, 1f);
7446 }
7447 flag4 = false;
7448 }
7449 if (flag4 && Main.rand.Next(20) == 0)
7450 {
7451 int type16 = 3201;
7452 int stack23 = 1;
7454 if (Main.netMode == 1)
7455 {
7456 NetMessage.SendData(21, -1, -1, null, number29, 1f);
7457 }
7458 flag4 = false;
7459 }
7460 if (Main.rand.Next(4) == 0)
7461 {
7462 int type17 = 73;
7463 int stack24 = Main.rand.Next(5, 11);
7465 if (Main.netMode == 1)
7466 {
7467 NetMessage.SendData(21, -1, -1, null, number30, 1f);
7468 }
7469 flag4 = false;
7470 }
7471 if (Main.rand.Next(6) == 0)
7472 {
7473 int num9 = Main.rand.Next(6);
7474 switch (num9)
7475 {
7476 case 0:
7477 num9 = 12;
7478 break;
7479 case 1:
7480 num9 = 699;
7481 break;
7482 case 2:
7483 num9 = 11;
7484 break;
7485 case 3:
7486 num9 = 700;
7487 break;
7488 case 4:
7489 num9 = 14;
7490 break;
7491 case 5:
7492 num9 = 701;
7493 break;
7494 }
7495 if (Main.rand.Next(2) == 0 && flag)
7496 {
7497 num9 = Main.rand.Next(4);
7498 switch (num9)
7499 {
7500 case 0:
7501 num9 = 364;
7502 break;
7503 case 1:
7504 num9 = 1104;
7505 break;
7506 case 2:
7507 num9 = 365;
7508 break;
7509 case 3:
7510 num9 = 1105;
7511 break;
7512 }
7513 }
7514 int stack25 = Main.rand.Next(12, 22);
7516 if (Main.netMode == 1)
7517 {
7518 NetMessage.SendData(21, -1, -1, null, number31, 1f);
7519 }
7520 flag4 = false;
7521 }
7522 else if (Main.rand.Next(4) == 0)
7523 {
7524 int num10 = Main.rand.Next(6);
7525 switch (num10)
7526 {
7527 case 0:
7528 num10 = 20;
7529 break;
7530 case 1:
7531 num10 = 703;
7532 break;
7533 case 2:
7534 num10 = 22;
7535 break;
7536 case 3:
7537 num10 = 704;
7538 break;
7539 case 4:
7540 num10 = 21;
7541 break;
7542 case 5:
7543 num10 = 705;
7544 break;
7545 }
7546 int num11 = Main.rand.Next(4, 8);
7547 if (Main.rand.Next(3) != 0 && flag)
7548 {
7549 num10 = Main.rand.Next(4);
7550 switch (num10)
7551 {
7552 case 0:
7553 num10 = 381;
7554 break;
7555 case 1:
7556 num10 = 1184;
7557 break;
7558 case 2:
7559 num10 = 382;
7560 break;
7561 case 3:
7562 num10 = 1191;
7563 break;
7564 }
7565 num11 -= Main.rand.Next(2);
7566 }
7568 if (Main.netMode == 1)
7569 {
7570 NetMessage.SendData(21, -1, -1, null, number32, 1f);
7571 }
7572 flag4 = false;
7573 }
7574 if (Main.rand.Next(4) == 0)
7575 {
7576 int num12 = Main.rand.Next(8);
7577 switch (num12)
7578 {
7579 case 0:
7580 num12 = 288;
7581 break;
7582 case 1:
7583 num12 = 296;
7584 break;
7585 case 2:
7586 num12 = 304;
7587 break;
7588 case 3:
7589 num12 = 305;
7590 break;
7591 case 4:
7592 num12 = 2322;
7593 break;
7594 case 5:
7595 num12 = 2323;
7596 break;
7597 case 6:
7598 num12 = 2324;
7599 break;
7600 case 7:
7601 num12 = 2327;
7602 break;
7603 }
7604 int stack26 = Main.rand.Next(2, 5);
7606 if (Main.netMode == 1)
7607 {
7608 NetMessage.SendData(21, -1, -1, null, number33, 1f);
7609 }
7610 flag4 = false;
7611 }
7612 }
7613 if (Main.rand.Next(2) == 0)
7614 {
7615 int type18 = Main.rand.Next(188, 190);
7616 int stack27 = Main.rand.Next(5, 16);
7618 if (Main.netMode == 1)
7619 {
7620 NetMessage.SendData(21, -1, -1, null, number34, 1f);
7621 }
7622 }
7623 if (Main.rand.Next(2) == 0)
7624 {
7625 int type19 = ((Main.rand.Next(3) != 0) ? 2675 : 2676);
7626 int stack28 = Main.rand.Next(2, 5);
7628 if (Main.netMode == 1)
7629 {
7630 NetMessage.SendData(21, -1, -1, null, number35, 1f);
7631 }
7632 }
7633 return;
7634 }
7635 case 2336:
7636 case 3981:
7637 {
7638 bool flag3 = true;
7639 while (flag3)
7640 {
7641 if (flag && flag3 && Main.rand.Next(20) == 0)
7642 {
7644 if (Main.netMode == 1)
7645 {
7646 NetMessage.SendData(21, -1, -1, null, number13, 1f);
7647 }
7648 flag3 = false;
7649 }
7650 if (flag3 && Main.rand.Next(8) == 0)
7651 {
7652 int type7 = 29;
7653 int stack11 = 1;
7655 if (Main.netMode == 1)
7656 {
7657 NetMessage.SendData(21, -1, -1, null, number14, 1f);
7658 }
7659 flag3 = false;
7660 }
7661 if (flag3 && Main.rand.Next(10) == 0)
7662 {
7663 int type8 = 2491;
7664 int stack12 = 1;
7666 if (Main.netMode == 1)
7667 {
7668 NetMessage.SendData(21, -1, -1, null, number15, 1f);
7669 }
7670 flag3 = false;
7671 }
7672 if (Main.rand.Next(3) == 0)
7673 {
7674 int type9 = 73;
7675 int stack13 = Main.rand.Next(8, 21);
7677 if (Main.netMode == 1)
7678 {
7679 NetMessage.SendData(21, -1, -1, null, number16, 1f);
7680 }
7681 flag3 = false;
7682 }
7683 if (Main.rand.Next(5) == 0)
7684 {
7685 int num6 = Main.rand.Next(4);
7686 switch (num6)
7687 {
7688 case 0:
7689 num6 = 14;
7690 break;
7691 case 1:
7692 num6 = 701;
7693 break;
7694 case 2:
7695 num6 = 13;
7696 break;
7697 case 3:
7698 num6 = 702;
7699 break;
7700 }
7701 if (Main.rand.Next(2) == 0 && flag)
7702 {
7703 num6 = Main.rand.Next(4);
7704 switch (num6)
7705 {
7706 case 0:
7707 num6 = 365;
7708 break;
7709 case 1:
7710 num6 = 1105;
7711 break;
7712 case 2:
7713 num6 = 366;
7714 break;
7715 case 3:
7716 num6 = 1106;
7717 break;
7718 }
7719 }
7720 int stack14 = Main.rand.Next(25, 35);
7722 if (Main.netMode == 1)
7723 {
7724 NetMessage.SendData(21, -1, -1, null, number17, 1f);
7725 }
7726 flag3 = false;
7727 }
7728 else
7729 {
7730 if (Main.rand.Next(3) != 0)
7731 {
7732 continue;
7733 }
7734 int num7 = Main.rand.Next(4);
7735 switch (num7)
7736 {
7737 case 0:
7738 num7 = 21;
7739 break;
7740 case 1:
7741 num7 = 19;
7742 break;
7743 case 2:
7744 num7 = 705;
7745 break;
7746 case 3:
7747 num7 = 706;
7748 break;
7749 }
7750 if (Main.rand.Next(3) != 0 && flag)
7751 {
7752 num7 = Main.rand.Next(4);
7753 switch (num7)
7754 {
7755 case 0:
7756 num7 = 382;
7757 break;
7758 case 1:
7759 num7 = 391;
7760 break;
7761 case 2:
7762 num7 = 1191;
7763 break;
7764 case 3:
7765 num7 = 1198;
7766 break;
7767 }
7768 }
7769 int stack15 = Main.rand.Next(8, 12);
7771 if (Main.netMode == 1)
7772 {
7773 NetMessage.SendData(21, -1, -1, null, number18, 1f);
7774 }
7775 flag3 = false;
7776 }
7777 }
7778 if (Main.rand.Next(3) == 0)
7779 {
7780 int num8 = Main.rand.Next(5);
7781 switch (num8)
7782 {
7783 case 0:
7784 num8 = 288;
7785 break;
7786 case 1:
7787 num8 = 296;
7788 break;
7789 case 2:
7790 num8 = 305;
7791 break;
7792 case 3:
7793 num8 = 2322;
7794 break;
7795 case 4:
7796 num8 = 2323;
7797 break;
7798 }
7799 int stack16 = Main.rand.Next(2, 6);
7801 if (Main.netMode == 1)
7802 {
7803 NetMessage.SendData(21, -1, -1, null, number19, 1f);
7804 }
7805 }
7806 if (Main.rand.Next(2) == 0)
7807 {
7808 int type10 = Main.rand.Next(188, 190);
7809 int stack17 = Main.rand.Next(5, 21);
7811 if (Main.netMode == 1)
7812 {
7813 NetMessage.SendData(21, -1, -1, null, number20, 1f);
7814 }
7815 }
7816 if (Main.rand.Next(3) != 0)
7817 {
7818 int type11 = 2676;
7819 int stack18 = Main.rand.Next(3, 8);
7821 if (Main.netMode == 1)
7822 {
7823 NetMessage.SendData(21, -1, -1, null, number21, 1f);
7824 }
7825 }
7826 if (Main.rand.Next(30) == 0 && !flag)
7827 {
7829 if (Main.netMode == 1)
7830 {
7831 NetMessage.SendData(21, -1, -1, null, number22, 1f);
7832 }
7833 }
7834 if (Main.rand.Next(15) == 0 && flag)
7835 {
7837 if (Main.netMode == 1)
7838 {
7839 NetMessage.SendData(21, -1, -1, null, number23, 1f);
7840 }
7841 }
7842 return;
7843 }
7844 }
7845 int maxValue = 1;
7846 bool flag5 = true;
7847 while (flag5)
7848 {
7849 if ((crateItemID == 5002 || crateItemID == 5003) && flag5 && Main.rand.Next(maxValue) == 0)
7850 {
7851 int num13 = Main.rand.Next(4);
7852 int number36 = Item.NewItem(Type: (Main.rand.Next(10) == 0) ? 863 : (num13 switch
7853 {
7854 0 => 186,
7855 1 => 4404,
7856 2 => 277,
7857 _ => 187,
7858 }), source: itemSource_OpenItem, X: (int)position.X, Y: (int)position.Y, Width: width, Height: height, Stack: 1, noBroadcast: false, pfix: -1);
7859 if (Main.netMode == 1)
7860 {
7861 NetMessage.SendData(21, -1, -1, null, number36, 1f);
7862 }
7863 flag5 = false;
7864 }
7865 if ((crateItemID == 3203 || crateItemID == 3982) && flag5 && Main.rand.Next(maxValue) == 0)
7866 {
7867 int num14 = Main.rand.Next(5);
7869 {
7870 0 => 162,
7871 1 => 111,
7872 2 => 96,
7873 3 => 115,
7874 _ => 64,
7875 }, 1, noBroadcast: false, -1);
7876 if (Main.netMode == 1)
7877 {
7878 NetMessage.SendData(21, -1, -1, null, number37, 1f);
7879 }
7880 flag5 = false;
7881 }
7882 if ((crateItemID == 3204 || crateItemID == 3983) && flag5 && Main.rand.Next(maxValue) == 0)
7883 {
7884 int num15 = Main.rand.Next(5);
7886 {
7887 0 => 800,
7888 1 => 802,
7889 2 => 1256,
7890 3 => 1290,
7891 _ => 3062,
7892 }, 1, noBroadcast: false, -1);
7893 if (Main.netMode == 1)
7894 {
7895 NetMessage.SendData(21, -1, -1, null, number38, 1f);
7896 }
7897 flag5 = false;
7898 }
7899 if ((crateItemID == 3205 || crateItemID == 3984) && flag5 && Main.rand.Next(maxValue) == 0)
7900 {
7901 int type21 = 3085;
7903 if (Main.netMode == 1)
7904 {
7905 NetMessage.SendData(21, -1, -1, null, number39, 1f);
7906 }
7907 flag5 = false;
7908 if (Main.rand.Next(2) == 0)
7909 {
7910 number39 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 149, Main.rand.Next(5, 16), noBroadcast: false, -1);
7911 if (Main.netMode == 1)
7912 {
7913 NetMessage.SendData(21, -1, -1, null, number39, 1f);
7914 }
7915 }
7916 }
7917 if ((crateItemID == 3206 || crateItemID == 3985) && flag5 && Main.rand.Next(maxValue) == 0)
7918 {
7919 int num16 = Main.rand.Next(4);
7921 {
7922 0 => 158,
7923 1 => 65,
7924 2 => 159,
7925 _ => 2219,
7926 }, 1, noBroadcast: false, -1);
7927 if (Main.netMode == 1)
7928 {
7929 NetMessage.SendData(21, -1, -1, null, number40, 1f);
7930 }
7931 flag5 = false;
7932 }
7933 if ((crateItemID == 3208 || crateItemID == 3987) && flag5 && Main.rand.Next(maxValue) == 0)
7934 {
7935 if (Main.rand.Next(20) == 0)
7936 {
7937 int num17 = Main.rand.Next(5);
7938 num17 = 3017;
7940 if (Main.netMode == 1)
7941 {
7942 NetMessage.SendData(21, -1, -1, null, number41, 1f);
7943 }
7944 flag5 = false;
7945 }
7946 else
7947 {
7948 int num18 = Main.rand.Next(5);
7950 {
7951 0 => 212,
7952 1 => 964,
7953 2 => 211,
7954 3 => 213,
7955 _ => 2292,
7956 }, 1, noBroadcast: false, -1);
7957 if (Main.netMode == 1)
7958 {
7959 NetMessage.SendData(21, -1, -1, null, number42, 1f);
7960 }
7961 flag5 = false;
7962 }
7963 }
7964 if ((crateItemID == 4405 || crateItemID == 4406) && flag5 && Main.rand.Next(maxValue) == 0)
7965 {
7966 int number43 = Item.NewItem(Type: Main.rand.Next(6) switch
7967 {
7968 0 => 670,
7969 1 => 724,
7970 2 => 950,
7971 3 => (!Main.remixWorld) ? 1319 : 725,
7972 4 => 987,
7973 _ => 1579,
7974 }, source: itemSource_OpenItem, X: (int)position.X, Y: (int)position.Y, Width: width, Height: height, Stack: 1, noBroadcast: false, pfix: -1);
7975 if (Main.netMode == 1)
7976 {
7977 NetMessage.SendData(21, -1, -1, null, number43, 1f);
7978 }
7979 flag5 = false;
7980 }
7981 if (crateItemID == 4407 || crateItemID == 4408)
7982 {
7983 if (flag5 && Main.rand.Next(maxValue) == 0)
7984 {
7985 int num19 = Main.rand.Next(8);
7987 {
7988 0 => 4056,
7989 1 => 4442,
7990 2 => 4055,
7991 3 => 4061,
7992 4 => 4062,
7993 5 => 4276,
7994 6 => 4262,
7995 _ => 4263,
7996 }, 1, noBroadcast: false, -1);
7997 if (Main.netMode == 1)
7998 {
7999 NetMessage.SendData(21, -1, -1, null, number44, 1f);
8000 }
8001 flag5 = false;
8002 }
8003 if (Main.rand.Next(4) == 0)
8004 {
8005 int type23 = 4423;
8006 int stack29 = Main.rand.Next(4, 7);
8008 if (Main.netMode == 1)
8009 {
8010 NetMessage.SendData(21, -1, -1, null, number45, 1f);
8011 }
8012 flag5 = false;
8013 }
8014 if (Main.rand.Next(2) == 0)
8015 {
8016 int type24 = 3380;
8017 int stack30 = Main.rand.Next(10, 17);
8019 if (Main.netMode == 1)
8020 {
8021 NetMessage.SendData(21, -1, -1, null, number46, 1f);
8022 }
8023 flag5 = false;
8024 }
8025 if (Main.rand.Next(35) == 0)
8026 {
8027 int type25 = 857;
8029 if (Main.netMode == 1)
8030 {
8031 NetMessage.SendData(21, -1, -1, null, number47, 1f);
8032 }
8033 flag5 = false;
8034 }
8035 }
8036 if (crateItemID == 4877 || crateItemID == 4878)
8037 {
8038 if (flag5 && Main.rand.Next(maxValue) == 0)
8039 {
8040 if (Main.rand.Next(20) == 0)
8041 {
8042 int num20 = Main.rand.Next(5);
8043 num20 = 906;
8045 if (Main.netMode == 1)
8046 {
8047 NetMessage.SendData(21, -1, -1, null, number48, 1f);
8048 }
8049 flag5 = false;
8050 }
8051 else
8052 {
8053 int num21 = Main.rand.Next(5);
8055 {
8056 0 => 4822,
8057 1 => 4828,
8058 2 => 4880,
8059 3 => 4881,
8060 _ => 4868,
8061 }, 1, noBroadcast: false, -1);
8062 if (Main.netMode == 1)
8063 {
8064 NetMessage.SendData(21, -1, -1, null, number49, 1f);
8065 }
8066 flag5 = false;
8067 }
8068 if (Main.rand.Next(4) == 0)
8069 {
8070 int type26 = 4858;
8071 int stack31 = 2;
8073 if (Main.netMode == 1)
8074 {
8075 NetMessage.SendData(21, -1, -1, null, number50, 1f);
8076 }
8077 flag5 = false;
8078 }
8079 }
8080 int type27 = 4879;
8082 if (Main.netMode == 1)
8083 {
8084 NetMessage.SendData(21, -1, -1, null, number51, 1f);
8085 }
8086 flag5 = false;
8087 if (Main.rand.Next(3) == 0)
8088 {
8089 int type28 = 4824;
8090 int stack32 = Main.rand.Next(7, 11);
8092 if (Main.netMode == 1)
8093 {
8094 NetMessage.SendData(21, -1, -1, null, number52, 1f);
8095 }
8096 flag5 = false;
8097 }
8098 if (Main.rand.Next(2) == 0)
8099 {
8100 int num22 = Main.rand.Next(5);
8101 switch (num22)
8102 {
8103 case 0:
8104 num22 = 4902;
8105 break;
8106 case 1:
8107 num22 = 4903;
8108 break;
8109 case 2:
8110 num22 = 4904;
8111 break;
8112 case 3:
8113 num22 = 4905;
8114 break;
8115 case 4:
8116 num22 = 4906;
8117 break;
8118 }
8120 if (Main.netMode == 1)
8121 {
8122 NetMessage.SendData(21, -1, -1, null, number53, 1f);
8123 }
8124 flag5 = false;
8125 }
8126 }
8127 if (Main.rand.Next(4) == 0)
8128 {
8129 int type29 = 73;
8130 int stack33 = Main.rand.Next(5, 13);
8132 if (Main.netMode == 1)
8133 {
8134 NetMessage.SendData(21, -1, -1, null, number54, 1f);
8135 }
8136 flag5 = false;
8137 }
8138 if (Main.rand.Next(7) == 0)
8139 {
8140 int num23 = Main.rand.Next(8);
8141 switch (num23)
8142 {
8143 case 0:
8144 num23 = 12;
8145 break;
8146 case 1:
8147 num23 = 699;
8148 break;
8149 case 2:
8150 num23 = 11;
8151 break;
8152 case 3:
8153 num23 = 700;
8154 break;
8155 case 4:
8156 num23 = 14;
8157 break;
8158 case 5:
8159 num23 = 701;
8160 break;
8161 case 6:
8162 num23 = 13;
8163 break;
8164 case 7:
8165 num23 = 702;
8166 break;
8167 }
8168 if (Main.rand.Next(2) == 0 && flag)
8169 {
8170 num23 = Main.rand.Next(6);
8171 switch (num23)
8172 {
8173 case 0:
8174 num23 = 364;
8175 break;
8176 case 1:
8177 num23 = 1104;
8178 break;
8179 case 2:
8180 num23 = 365;
8181 break;
8182 case 3:
8183 num23 = 1105;
8184 break;
8185 case 4:
8186 num23 = 366;
8187 break;
8188 case 5:
8189 num23 = 1106;
8190 break;
8191 }
8192 }
8193 int stack34 = Main.rand.Next(20, 36);
8195 if (Main.netMode == 1)
8196 {
8197 NetMessage.SendData(21, -1, -1, null, number55, 1f);
8198 }
8199 flag5 = false;
8200 }
8201 if (Main.rand.Next(4) != 0)
8202 {
8203 continue;
8204 }
8205 int num24 = Main.rand.Next(6);
8206 switch (num24)
8207 {
8208 case 0:
8209 num24 = 22;
8210 break;
8211 case 1:
8212 num24 = 21;
8213 break;
8214 case 2:
8215 num24 = 19;
8216 break;
8217 case 3:
8218 num24 = 704;
8219 break;
8220 case 4:
8221 num24 = 705;
8222 break;
8223 case 5:
8224 num24 = 706;
8225 break;
8226 }
8227 int num25 = Main.rand.Next(6, 17);
8228 if (Main.rand.Next(3) != 0 && flag)
8229 {
8230 num24 = Main.rand.Next(6);
8231 switch (num24)
8232 {
8233 case 0:
8234 num24 = 381;
8235 break;
8236 case 1:
8237 num24 = 382;
8238 break;
8239 case 2:
8240 num24 = 391;
8241 break;
8242 case 3:
8243 num24 = 1184;
8244 break;
8245 case 4:
8246 num24 = 1191;
8247 break;
8248 case 5:
8249 num24 = 1198;
8250 break;
8251 }
8252 num25 -= Main.rand.Next(2);
8253 }
8255 if (Main.netMode == 1)
8256 {
8257 NetMessage.SendData(21, -1, -1, null, number56, 1f);
8258 }
8259 flag5 = false;
8260 }
8261 if (Main.rand.Next(4) == 0)
8262 {
8263 int num26 = Main.rand.Next(6);
8264 switch (num26)
8265 {
8266 case 0:
8267 num26 = 288;
8268 break;
8269 case 1:
8270 num26 = 296;
8271 break;
8272 case 2:
8273 num26 = 304;
8274 break;
8275 case 3:
8276 num26 = 305;
8277 break;
8278 case 4:
8279 num26 = 2322;
8280 break;
8281 case 5:
8282 num26 = 2323;
8283 break;
8284 }
8285 int stack35 = Main.rand.Next(2, 5);
8287 if (Main.netMode == 1)
8288 {
8289 NetMessage.SendData(21, -1, -1, null, number57, 1f);
8290 }
8291 flag5 = false;
8292 }
8293 if (Main.rand.Next(2) == 0)
8294 {
8295 int type30 = Main.rand.Next(188, 190);
8296 int stack36 = Main.rand.Next(5, 18);
8298 if (Main.netMode == 1)
8299 {
8300 NetMessage.SendData(21, -1, -1, null, number58, 1f);
8301 }
8302 }
8303 if (Main.rand.Next(2) == 0)
8304 {
8305 int type31 = ((Main.rand.Next(2) != 0) ? 2675 : 2676);
8306 int stack37 = Main.rand.Next(2, 7);
8308 if (Main.netMode == 1)
8309 {
8310 NetMessage.SendData(21, -1, -1, null, number59, 1f);
8311 }
8312 }
8313 if (crateItemID == 5002 || crateItemID == 5003)
8314 {
8315 if (Main.rand.Next(3) == 0)
8316 {
8317 int type32 = 4090;
8318 int stack38 = Main.rand.Next(20, 51);
8320 if (Main.netMode == 1)
8321 {
8322 NetMessage.SendData(21, -1, -1, null, number60, 1f);
8323 }
8324 }
8325 if (Main.rand.Next(10) == 0)
8326 {
8327 int type33 = 4460;
8329 if (Main.netMode == 1)
8330 {
8331 NetMessage.SendData(21, -1, -1, null, number61, 1f);
8332 }
8333 }
8334 if (Main.rand.Next(10) == 0)
8335 {
8336 int type34 = 4425;
8338 if (Main.netMode == 1)
8339 {
8340 NetMessage.SendData(21, -1, -1, null, number62, 1f);
8341 }
8342 }
8343 }
8344 if (crateItemID == 3208 || crateItemID == 3987)
8345 {
8346 if (Main.rand.Next(3) == 0)
8347 {
8348 int type35 = 4564;
8349 int stack39 = Main.rand.Next(20, 51);
8351 if (Main.netMode == 1)
8352 {
8353 NetMessage.SendData(21, -1, -1, null, number63, 1f);
8354 }
8355 }
8356 if (Main.rand.Next(20) == 0)
8357 {
8358 int type36 = 753;
8360 if (Main.netMode == 1)
8361 {
8362 NetMessage.SendData(21, -1, -1, null, number64, 1f);
8363 }
8364 }
8365 }
8366 if ((crateItemID == 4405 || crateItemID == 4406) && Main.rand.Next(20) == 0)
8367 {
8368 int type37 = 669;
8370 if (Main.netMode == 1)
8371 {
8372 NetMessage.SendData(21, -1, -1, null, number65, 1f);
8373 }
8374 }
8375 if (crateItemID == 3206 || crateItemID == 3985)
8376 {
8377 if (Main.rand.Next(2) == 0)
8378 {
8379 int type38 = 751;
8380 int stack40 = Main.rand.Next(50, 101);
8382 if (Main.netMode == 1)
8383 {
8384 NetMessage.SendData(21, -1, -1, null, number66, 1f);
8385 }
8386 }
8387 if (Main.rand.Next(2) == 0)
8388 {
8389 int num27 = Main.rand.Next(6);
8390 switch (num27)
8391 {
8392 case 0:
8393 num27 = 5226;
8394 break;
8395 case 1:
8396 num27 = 5254;
8397 break;
8398 case 2:
8399 num27 = 5238;
8400 break;
8401 case 3:
8402 num27 = 5258;
8403 break;
8404 case 4:
8405 num27 = 5255;
8406 break;
8407 case 5:
8408 num27 = 5388;
8409 break;
8410 }
8412 if (Main.netMode == 1)
8413 {
8414 NetMessage.SendData(21, -1, -1, null, num27, 1f);
8415 }
8416 }
8417 if (Main.rand.Next(40) == 0)
8418 {
8419 int type39 = 4978;
8421 if (Main.netMode == 1)
8422 {
8423 NetMessage.SendData(21, -1, -1, null, number67, 1f);
8424 }
8425 }
8426 }
8427 if (crateItemID == 4877 || crateItemID == 4878)
8428 {
8429 if (Main.rand.Next(20) == 0)
8430 {
8431 int type40 = 4443;
8433 if (Main.netMode == 1)
8434 {
8435 NetMessage.SendData(21, -1, -1, null, number68, 1f);
8436 }
8437 }
8438 if (Main.rand.Next(20) == 0)
8439 {
8440 int type41 = 4737;
8442 if (Main.netMode == 1)
8443 {
8444 NetMessage.SendData(21, -1, -1, null, number69, 1f);
8445 }
8446 }
8447 if (Main.rand.Next(20) == 0)
8448 {
8449 int type42 = 4551;
8451 if (Main.netMode == 1)
8452 {
8453 NetMessage.SendData(21, -1, -1, null, number70, 1f);
8454 }
8455 }
8456 }
8457 if (!flag || (crateItemID != 3982 && crateItemID != 3986 && crateItemID != 3983))
8458 {
8459 return;
8460 }
8461 if (Main.rand.Next(2) == 0)
8462 {
8463 int type43 = 521;
8464 if (crateItemID == 3986)
8465 {
8466 type43 = 520;
8467 }
8468 int stack41 = Main.rand.Next(2, 6);
8470 if (Main.netMode == 1)
8471 {
8472 NetMessage.SendData(21, -1, -1, null, number71, 1f);
8473 }
8474 }
8475 if (Main.rand.Next(2) == 0)
8476 {
8477 int type44 = 522;
8478 int stack42 = Main.rand.Next(2, 6);
8479 switch (crateItemID)
8480 {
8481 case 3983:
8482 type44 = 1332;
8483 break;
8484 case 3986:
8485 type44 = 502;
8486 stack42 = Main.rand.Next(4, 11);
8487 break;
8488 }
8490 if (Main.netMode == 1)
8491 {
8492 NetMessage.SendData(21, -1, -1, null, number72, 1f);
8493 }
8494 }
8495 }
8496
8497 public int CountItem(int type, int stopCountingAt = 0)
8498 {
8499 int num = 0;
8500 for (int i = 0; i != 58; i++)
8501 {
8502 if (inventory[i].stack > 0 && inventory[i].type == type)
8503 {
8504 num += inventory[i].stack;
8505 if (num >= stopCountingAt)
8506 {
8507 return num;
8508 }
8509 }
8510 }
8511 return num;
8512 }
8513
8514 public bool ConsumeItem(int type, bool reverseOrder = false, bool includeVoidBag = false)
8515 {
8516 int num = 0;
8517 int num2 = 58;
8518 int num3 = 1;
8519 if (reverseOrder)
8520 {
8521 num = 57;
8522 num2 = -1;
8523 num3 = -1;
8524 }
8525 for (int i = num; i != num2; i += num3)
8526 {
8527 if (inventory[i].stack > 0 && inventory[i].type == type)
8528 {
8529 inventory[i].stack--;
8530 if (inventory[i].stack <= 0)
8531 {
8532 inventory[i].SetDefaults();
8533 }
8534 return true;
8535 }
8536 }
8537 if (includeVoidBag && useVoidBag())
8538 {
8539 int num4 = FindItem(type, bank4.item);
8540 if (num4 == -1)
8541 {
8542 return false;
8543 }
8544 Item item = bank4.item[num4];
8545 item.stack--;
8546 if (item.stack <= 0)
8547 {
8548 item.TurnToAir();
8549 }
8550 return true;
8551 }
8552 return false;
8553 }
8554
8556 {
8557 bool flag = true;
8558 IEntitySource itemSource_OpenItem = GetItemSource_OpenItem(boxType);
8559 while (flag)
8560 {
8561 flag = false;
8562 int type = Main.rand.NextFromList(new short[5] { 274, 220, 112, 218, 3019 });
8563 if (Main.remixWorld)
8564 {
8565 type = Main.rand.NextFromList(new short[5] { 274, 220, 683, 218, 3019 });
8566 }
8567 int number = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, type, 1, noBroadcast: false, -1);
8568 if (Main.netMode == 1)
8569 {
8570 NetMessage.SendData(21, -1, -1, null, number, 1f);
8571 }
8572 if (Main.rand.Next(5) == 0)
8573 {
8574 number = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 5010, 1, noBroadcast: false, -1);
8575 if (Main.netMode == 1)
8576 {
8577 NetMessage.SendData(21, -1, -1, null, number, 1f);
8578 }
8579 }
8580 }
8581 }
8582
8584 {
8585 bool flag = true;
8586 IEntitySource itemSource_OpenItem = GetItemSource_OpenItem(lockboxItemType);
8587 while (flag)
8588 {
8589 flag = false;
8590 int num = 0;
8591 int number = Item.NewItem(Type: Main.rand.Next(7) switch
8592 {
8593 1 => 3317,
8594 2 => 155,
8595 3 => 156,
8596 4 => (!Main.remixWorld) ? 157 : 2623,
8597 5 => 163,
8598 6 => 113,
8599 _ => 164,
8600 }, source: itemSource_OpenItem, X: (int)position.X, Y: (int)position.Y, Width: width, Height: height, Stack: 1, noBroadcast: false, pfix: -1);
8601 if (Main.netMode == 1)
8602 {
8603 NetMessage.SendData(21, -1, -1, null, number, 1f);
8604 }
8605 if (Main.rand.Next(3) == 0)
8606 {
8607 int number2 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 329, 1, noBroadcast: false, -1);
8608 if (Main.netMode == 1)
8609 {
8610 NetMessage.SendData(21, -1, -1, null, number2, 1f);
8611 }
8612 }
8613 }
8614 }
8615
8616 public void OpenHerbBag(int bagType)
8617 {
8618 IEntitySource itemSource_OpenItem = GetItemSource_OpenItem(bagType);
8619 int num = Main.rand.Next(2, 5);
8620 if (Main.rand.Next(3) == 0)
8621 {
8622 num++;
8623 }
8624 for (int i = 0; i < num; i++)
8625 {
8626 int num2 = Main.rand.Next(14);
8627 if (num2 == 0)
8628 {
8629 num2 = 313;
8630 }
8631 if (num2 == 1)
8632 {
8633 num2 = 314;
8634 }
8635 if (num2 == 2)
8636 {
8637 num2 = 315;
8638 }
8639 if (num2 == 3)
8640 {
8641 num2 = 317;
8642 }
8643 if (num2 == 4)
8644 {
8645 num2 = 316;
8646 }
8647 if (num2 == 5)
8648 {
8649 num2 = 318;
8650 }
8651 if (num2 == 6)
8652 {
8653 num2 = 2358;
8654 }
8655 if (num2 == 7)
8656 {
8657 num2 = 307;
8658 }
8659 if (num2 == 8)
8660 {
8661 num2 = 308;
8662 }
8663 if (num2 == 9)
8664 {
8665 num2 = 309;
8666 }
8667 if (num2 == 10)
8668 {
8669 num2 = 311;
8670 }
8671 if (num2 == 11)
8672 {
8673 num2 = 310;
8674 }
8675 if (num2 == 12)
8676 {
8677 num2 = 312;
8678 }
8679 if (num2 == 13)
8680 {
8681 num2 = 2357;
8682 }
8683 int num3 = Main.rand.Next(2, 5);
8684 if (Main.rand.Next(3) == 0)
8685 {
8686 num3 += Main.rand.Next(1, 5);
8687 }
8688 int number = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, num2, num3);
8689 if (Main.netMode == 1)
8690 {
8691 NetMessage.SendData(21, -1, -1, null, number, 1f);
8692 }
8693 }
8694 }
8695
8697 {
8698 IEntitySource itemSource_OpenItem = GetItemSource_OpenItem(sourceItemType);
8699 QuickSpawnItem(itemSource_OpenItem, 2002, Main.rand.Next(5, 9));
8700 if (Main.rand.Next(10) < 3)
8701 {
8702 QuickSpawnItem(itemSource_OpenItem, 3191, Main.rand.Next(1, 3));
8703 }
8704 if (Main.rand.Next(20) == 0)
8705 {
8706 QuickSpawnItem(itemSource_OpenItem, 2895);
8707 }
8708 }
8709
8711 {
8712 IEntitySource itemSource_OpenItem = GetItemSource_OpenItem(sourceItemType);
8713 if (Main.rand.Next(5) == 0)
8714 {
8715 if (Main.rand.Next(15) == 0)
8716 {
8717 QuickSpawnItem(itemSource_OpenItem, 4414);
8718 }
8719 else if (Main.rand.Next(3) == 0)
8720 {
8721 QuickSpawnItem(itemSource_OpenItem, 4413);
8722 }
8723 else
8724 {
8725 QuickSpawnItem(itemSource_OpenItem, 4412);
8726 }
8727 }
8728 QuickSpawnItem(itemSource_OpenItem, 4411);
8729 }
8730
8731 public void OpenGoodieBag(int itemType)
8732 {
8733 IEntitySource itemSource_OpenItem = GetItemSource_OpenItem(itemType);
8734 if (Main.rand.Next(150) == 0)
8735 {
8736 int number = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1810);
8737 if (Main.netMode == 1)
8738 {
8739 NetMessage.SendData(21, -1, -1, null, number, 1f);
8740 }
8741 return;
8742 }
8743 if (Main.rand.Next(150) == 0)
8744 {
8745 int number2 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1800);
8746 if (Main.netMode == 1)
8747 {
8748 NetMessage.SendData(21, -1, -1, null, number2, 1f);
8749 }
8750 return;
8751 }
8752 if (Main.rand.Next(4) == 0)
8753 {
8754 int number3 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1809, Main.rand.Next(10, 41));
8755 if (Main.netMode == 1)
8756 {
8757 NetMessage.SendData(21, -1, -1, null, number3, 1f);
8758 }
8759 return;
8760 }
8761 if (Main.rand.Next(10) == 0)
8762 {
8763 int number4 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, Main.rand.Next(1846, 1851));
8764 if (Main.netMode == 1)
8765 {
8766 NetMessage.SendData(21, -1, -1, null, number4, 1f);
8767 }
8768 return;
8769 }
8770 switch (Main.rand.Next(19))
8771 {
8772 case 0:
8773 {
8774 int number6 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1749);
8775 if (Main.netMode == 1)
8776 {
8777 NetMessage.SendData(21, -1, -1, null, number6, 1f);
8778 }
8779 number6 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1750);
8780 if (Main.netMode == 1)
8781 {
8782 NetMessage.SendData(21, -1, -1, null, number6, 1f);
8783 }
8784 number6 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1751);
8785 if (Main.netMode == 1)
8786 {
8787 NetMessage.SendData(21, -1, -1, null, number6, 1f);
8788 }
8789 break;
8790 }
8791 case 1:
8792 {
8793 int number17 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1746);
8794 if (Main.netMode == 1)
8795 {
8796 NetMessage.SendData(21, -1, -1, null, number17, 1f);
8797 }
8798 number17 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1747);
8799 if (Main.netMode == 1)
8800 {
8801 NetMessage.SendData(21, -1, -1, null, number17, 1f);
8802 }
8803 number17 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1748);
8804 if (Main.netMode == 1)
8805 {
8806 NetMessage.SendData(21, -1, -1, null, number17, 1f);
8807 }
8808 break;
8809 }
8810 case 2:
8811 {
8812 int number18 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1752);
8813 if (Main.netMode == 1)
8814 {
8815 NetMessage.SendData(21, -1, -1, null, number18, 1f);
8816 }
8817 number18 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1753);
8818 if (Main.netMode == 1)
8819 {
8820 NetMessage.SendData(21, -1, -1, null, number18, 1f);
8821 }
8822 break;
8823 }
8824 case 3:
8825 {
8826 int number19 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1767);
8827 if (Main.netMode == 1)
8828 {
8829 NetMessage.SendData(21, -1, -1, null, number19, 1f);
8830 }
8831 number19 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1768);
8832 if (Main.netMode == 1)
8833 {
8834 NetMessage.SendData(21, -1, -1, null, number19, 1f);
8835 }
8836 number19 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1769);
8837 if (Main.netMode == 1)
8838 {
8839 NetMessage.SendData(21, -1, -1, null, number19, 1f);
8840 }
8841 break;
8842 }
8843 case 4:
8844 {
8845 int number11 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1770);
8846 if (Main.netMode == 1)
8847 {
8848 NetMessage.SendData(21, -1, -1, null, number11, 1f);
8849 }
8850 number11 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1771);
8851 if (Main.netMode == 1)
8852 {
8853 NetMessage.SendData(21, -1, -1, null, number11, 1f);
8854 }
8855 break;
8856 }
8857 case 5:
8858 {
8859 int number8 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1772);
8860 if (Main.netMode == 1)
8861 {
8862 NetMessage.SendData(21, -1, -1, null, number8, 1f);
8863 }
8864 number8 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1773);
8865 if (Main.netMode == 1)
8866 {
8867 NetMessage.SendData(21, -1, -1, null, number8, 1f);
8868 }
8869 break;
8870 }
8871 case 6:
8872 {
8873 int number22 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1754);
8874 if (Main.netMode == 1)
8875 {
8876 NetMessage.SendData(21, -1, -1, null, number22, 1f);
8877 }
8878 number22 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1755);
8879 if (Main.netMode == 1)
8880 {
8881 NetMessage.SendData(21, -1, -1, null, number22, 1f);
8882 }
8883 number22 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1756);
8884 if (Main.netMode == 1)
8885 {
8886 NetMessage.SendData(21, -1, -1, null, number22, 1f);
8887 }
8888 break;
8889 }
8890 case 7:
8891 {
8892 int number10 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1757);
8893 if (Main.netMode == 1)
8894 {
8895 NetMessage.SendData(21, -1, -1, null, number10, 1f);
8896 }
8897 number10 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1758);
8898 if (Main.netMode == 1)
8899 {
8900 NetMessage.SendData(21, -1, -1, null, number10, 1f);
8901 }
8902 number10 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1759);
8903 if (Main.netMode == 1)
8904 {
8905 NetMessage.SendData(21, -1, -1, null, number10, 1f);
8906 }
8907 break;
8908 }
8909 case 8:
8910 {
8911 int number12 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1760);
8912 if (Main.netMode == 1)
8913 {
8914 NetMessage.SendData(21, -1, -1, null, number12, 1f);
8915 }
8916 number12 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1761);
8917 if (Main.netMode == 1)
8918 {
8919 NetMessage.SendData(21, -1, -1, null, number12, 1f);
8920 }
8921 number12 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1762);
8922 if (Main.netMode == 1)
8923 {
8924 NetMessage.SendData(21, -1, -1, null, number12, 1f);
8925 }
8926 break;
8927 }
8928 case 9:
8929 {
8930 int number20 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1763);
8931 if (Main.netMode == 1)
8932 {
8933 NetMessage.SendData(21, -1, -1, null, number20, 1f);
8934 }
8935 number20 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1764);
8936 if (Main.netMode == 1)
8937 {
8938 NetMessage.SendData(21, -1, -1, null, number20, 1f);
8939 }
8940 number20 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1765);
8941 if (Main.netMode == 1)
8942 {
8943 NetMessage.SendData(21, -1, -1, null, number20, 1f);
8944 }
8945 break;
8946 }
8947 case 10:
8948 {
8949 int number14 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1766);
8950 if (Main.netMode == 1)
8951 {
8952 NetMessage.SendData(21, -1, -1, null, number14, 1f);
8953 }
8954 number14 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1775);
8955 if (Main.netMode == 1)
8956 {
8957 NetMessage.SendData(21, -1, -1, null, number14, 1f);
8958 }
8959 number14 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1776);
8960 if (Main.netMode == 1)
8961 {
8962 NetMessage.SendData(21, -1, -1, null, number14, 1f);
8963 }
8964 break;
8965 }
8966 case 11:
8967 {
8968 int number7 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1777);
8969 if (Main.netMode == 1)
8970 {
8971 NetMessage.SendData(21, -1, -1, null, number7, 1f);
8972 }
8973 number7 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1778);
8974 if (Main.netMode == 1)
8975 {
8976 NetMessage.SendData(21, -1, -1, null, number7, 1f);
8977 }
8978 break;
8979 }
8980 case 12:
8981 {
8982 int number16 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1779);
8983 if (Main.netMode == 1)
8984 {
8985 NetMessage.SendData(21, -1, -1, null, number16, 1f);
8986 }
8987 number16 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1780);
8988 if (Main.netMode == 1)
8989 {
8990 NetMessage.SendData(21, -1, -1, null, number16, 1f);
8991 }
8992 number16 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1781);
8993 if (Main.netMode == 1)
8994 {
8995 NetMessage.SendData(21, -1, -1, null, number16, 1f);
8996 }
8997 break;
8998 }
8999 case 13:
9000 {
9001 int number13 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1819);
9002 if (Main.netMode == 1)
9003 {
9004 NetMessage.SendData(21, -1, -1, null, number13, 1f);
9005 }
9006 number13 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1820);
9007 if (Main.netMode == 1)
9008 {
9009 NetMessage.SendData(21, -1, -1, null, number13, 1f);
9010 }
9011 break;
9012 }
9013 case 14:
9014 {
9015 int number23 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1821);
9016 if (Main.netMode == 1)
9017 {
9018 NetMessage.SendData(21, -1, -1, null, number23, 1f);
9019 }
9020 number23 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1822);
9021 if (Main.netMode == 1)
9022 {
9023 NetMessage.SendData(21, -1, -1, null, number23, 1f);
9024 }
9025 number23 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1823);
9026 if (Main.netMode == 1)
9027 {
9028 NetMessage.SendData(21, -1, -1, null, number23, 1f);
9029 }
9030 break;
9031 }
9032 case 15:
9033 {
9034 int number21 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1824);
9035 if (Main.netMode == 1)
9036 {
9037 NetMessage.SendData(21, -1, -1, null, number21, 1f);
9038 }
9039 break;
9040 }
9041 case 16:
9042 {
9043 int number15 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1838);
9044 if (Main.netMode == 1)
9045 {
9046 NetMessage.SendData(21, -1, -1, null, number15, 1f);
9047 }
9048 number15 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1839);
9049 if (Main.netMode == 1)
9050 {
9051 NetMessage.SendData(21, -1, -1, null, number15, 1f);
9052 }
9053 number15 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1840);
9054 if (Main.netMode == 1)
9055 {
9056 NetMessage.SendData(21, -1, -1, null, number15, 1f);
9057 }
9058 break;
9059 }
9060 case 17:
9061 {
9062 int number9 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1841);
9063 if (Main.netMode == 1)
9064 {
9065 NetMessage.SendData(21, -1, -1, null, number9, 1f);
9066 }
9067 number9 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1842);
9068 if (Main.netMode == 1)
9069 {
9070 NetMessage.SendData(21, -1, -1, null, number9, 1f);
9071 }
9072 number9 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1843);
9073 if (Main.netMode == 1)
9074 {
9075 NetMessage.SendData(21, -1, -1, null, number9, 1f);
9076 }
9077 break;
9078 }
9079 case 18:
9080 {
9081 int number5 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1851);
9082 if (Main.netMode == 1)
9083 {
9084 NetMessage.SendData(21, -1, -1, null, number5, 1f);
9085 }
9086 number5 = Item.NewItem(itemSource_OpenItem, (int)position.X, (int)position.Y, width, height, 1852);
9087 if (Main.netMode == 1)
9088 {
9089 NetMessage.SendData(21, -1, -1, null, number5, 1f);
9090 }
9091 break;
9092 }
9093 }
9094 }
9095
9096 public void UpdateDyes()
9097 {
9098 cShieldFallback = -1;
9099 cHead = (cBody = (cLegs = (cHandOn = (cHandOff = (cBack = (cFront = (cShoe = (cWaist = (cShield = (cNeck = (cFace = (cFaceHead = (cFaceFlower = (cBalloon = (cBalloon = (cWings = (cCarpet = (cFloatingTube = (cBackpack = (cTail = 0))))))))))))))))))));
9100 cGrapple = (cMount = (cMinecart = (cPet = (cLight = (cYorai = (cPortableStool = (cUnicornHorn = (cAngelHalo = (cBeard = (cMinion = (cLeinShampoo = (cFlameWaker = 0))))))))))));
9101 skinDyePacked = 0;
9102 cHead = dye[0].dye;
9103 cBody = dye[1].dye;
9104 cLegs = dye[2].dye;
9105 if (wearsRobe)
9106 {
9107 cLegs = cBody;
9108 }
9109 cPet = miscDyes[0].dye;
9110 cLight = miscDyes[1].dye;
9111 cMinecart = miscDyes[2].dye;
9112 cMount = miscDyes[3].dye;
9113 cGrapple = miscDyes[4].dye;
9114 for (int i = 0; i < 20; i++)
9115 {
9116 if (IsItemSlotUnlockedAndUsable(i))
9117 {
9118 int num = i % 10;
9119 UpdateItemDye(i < 10, hideVisibleAccessory[num], armor[i], dye[num]);
9120 }
9121 }
9122 cYorai = cPet;
9123 }
9124
9126 {
9127 if (armorItem.IsAir)
9128 {
9129 return;
9130 }
9131 bool num = armorItem.wingSlot > 0 || armorItem.type == 934 || armorItem.type == 4341 || armorItem.type == 5126 || armorItem.type == 4563 || armorItem.type == 1987;
9132 bool flag = isNotInVanitySlot && isSetToHidden;
9133 if (armorItem.shieldSlot > 0 && armorItem.shieldSlot < ArmorIDs.Shield.Count && (cShieldFallback == -1 || !flag))
9134 {
9135 cShieldFallback = dyeItem.dye;
9136 }
9137 if (!num && flag)
9138 {
9139 return;
9140 }
9141 if (armorItem.handOnSlot > 0 && armorItem.handOnSlot < ArmorIDs.HandOn.Count)
9142 {
9143 cHandOn = dyeItem.dye;
9144 }
9145 if (armorItem.handOffSlot > 0 && armorItem.handOffSlot < ArmorIDs.HandOff.Count)
9146 {
9147 cHandOff = dyeItem.dye;
9148 }
9149 if (armorItem.backSlot > 0 && armorItem.backSlot < ArmorIDs.Back.Count)
9150 {
9152 {
9153 cBackpack = dyeItem.dye;
9154 }
9155 else if (ArmorIDs.Back.Sets.DrawInTailLayer[armorItem.backSlot])
9156 {
9157 cTail = dyeItem.dye;
9158 }
9159 else
9160 {
9161 cBack = dyeItem.dye;
9162 }
9163 }
9164 if (armorItem.frontSlot > 0 && armorItem.frontSlot < ArmorIDs.Front.Count)
9165 {
9166 cFront = dyeItem.dye;
9167 }
9168 if (armorItem.shoeSlot > 0 && armorItem.shoeSlot < ArmorIDs.Shoe.Count)
9169 {
9170 if (armorItem.type == 4822 || armorItem.type == 4874)
9171 {
9172 cFlameWaker = dyeItem.dye;
9173 }
9174 else
9175 {
9176 cShoe = dyeItem.dye;
9177 }
9178 }
9179 if (armorItem.waistSlot > 0 && armorItem.waistSlot < ArmorIDs.Waist.Count)
9180 {
9181 cWaist = dyeItem.dye;
9182 }
9183 if (armorItem.shieldSlot > 0 && armorItem.shieldSlot < ArmorIDs.Shield.Count)
9184 {
9185 cShield = dyeItem.dye;
9186 }
9187 if (armorItem.neckSlot > 0 && armorItem.neckSlot < ArmorIDs.Neck.Count)
9188 {
9189 cNeck = dyeItem.dye;
9190 }
9191 if (armorItem.faceSlot > 0 && armorItem.faceSlot < ArmorIDs.Face.Count)
9192 {
9194 {
9195 cFaceHead = dyeItem.dye;
9196 }
9198 {
9199 cFaceFlower = dyeItem.dye;
9200 }
9201 else
9202 {
9203 cFace = dyeItem.dye;
9204 }
9205 }
9206 if (armorItem.beardSlot > 0 && armorItem.beardSlot < ArmorIDs.Beard.Count)
9207 {
9208 cBeard = dyeItem.dye;
9209 }
9210 if (armorItem.balloonSlot > 0 && armorItem.balloonSlot < ArmorIDs.Balloon.Count)
9211 {
9213 {
9214 cBalloonFront = dyeItem.dye;
9215 }
9216 else
9217 {
9218 cBalloon = dyeItem.dye;
9219 }
9220 }
9221 if (armorItem.wingSlot > 0 && armorItem.wingSlot < ArmorIDs.Wing.Count)
9222 {
9223 cWings = dyeItem.dye;
9224 }
9225 if (armorItem.type == 934)
9226 {
9227 cCarpet = dyeItem.dye;
9228 }
9229 if (armorItem.type == 4404)
9230 {
9231 cFloatingTube = dyeItem.dye;
9232 }
9233 if (armorItem.type == 4341 || armorItem.type == 5126)
9234 {
9235 cPortableStool = dyeItem.dye;
9236 }
9237 if (armorItem.type == 4563)
9238 {
9239 cUnicornHorn = dyeItem.dye;
9240 }
9241 if (armorItem.type == 1987)
9242 {
9243 cAngelHalo = dyeItem.dye;
9244 }
9245 if (armorItem.type == 4762)
9246 {
9247 cMinion = dyeItem.dye;
9248 }
9249 if (armorItem.type == 3929)
9250 {
9251 cLeinShampoo = dyeItem.dye;
9252 }
9253 }
9254
9255 public int ArmorSetDye()
9256 {
9257 return Main.rand.Next(3) switch
9258 {
9259 0 => cHead,
9260 1 => cBody,
9261 2 => cLegs,
9262 _ => cBody,
9263 };
9264 }
9265
9267 {
9268 int buffId = buffType[buffIndex];
9269 return new EntitySource_Buff(this, buffId, buffIndex);
9270 }
9271
9273 {
9274 return new EntitySource_ItemUse(this, item);
9275 }
9276
9278 {
9279 return new EntitySource_ItemOpen(this, itemType);
9280 }
9281
9283 {
9284 return new EntitySource_ByItemSourceId(this, 3);
9285 }
9286
9291
9296
9301
9306
9311
9313 {
9314 return new EntitySource_ItemUse(this, item);
9315 }
9316
9321
9326
9331
9336
9341
9342 public void UpdateBuffs(int i)
9343 {
9344 if (soulDrain > 0 && whoAmI == Main.myPlayer)
9345 {
9346 AddBuff(151, 2);
9347 }
9349 {
9350 UpdateStarvingState(withEmote: true);
9351 }
9352 for (int j = 0; j < maxBuffs; j++)
9353 {
9354 if (buffType[j] <= 0 || buffTime[j] <= 0)
9355 {
9356 continue;
9357 }
9358 if (whoAmI == Main.myPlayer && !BuffID.Sets.TimeLeftDoesNotDecrease[buffType[j]])
9359 {
9360 buffTime[j]--;
9361 }
9362 if (buffType[j] == 1)
9363 {
9364 lavaImmune = true;
9365 fireWalk = true;
9366 buffImmune[24] = true;
9367 }
9368 else if (BuffID.Sets.BasicMountData[buffType[j]] != null)
9369 {
9371 mount.SetMount(buffMountData.mountID, this, buffMountData.faceLeft);
9372 buffTime[j] = 10;
9373 }
9374 else if (buffType[j] == 158)
9375 {
9376 manaRegenDelayBonus += 0.5f;
9377 manaRegenBonus += 10;
9378 }
9379 else if (buffType[j] == 159 && inventory[selectedItem].melee)
9380 {
9381 armorPenetration += 12;
9382 }
9383 else if (buffType[j] == 192)
9384 {
9385 pickSpeed -= 0.2f;
9386 moveSpeed += 0.2f;
9387 }
9388 else if (buffType[j] == 321)
9389 {
9390 int num = 10;
9391 meleeCrit += num;
9392 rangedCrit += num;
9393 magicCrit += num;
9394 minionDamage += (float)num / 100f;
9395 }
9396 else if (buffType[j] == 2)
9397 {
9398 lifeRegen += 4;
9399 }
9400 else if (buffType[j] == 3)
9401 {
9402 moveSpeed += 0.25f;
9403 }
9404 else if (buffType[j] == 4)
9405 {
9406 gills = true;
9407 }
9408 else if (buffType[j] == 5)
9409 {
9410 statDefense += 8;
9411 }
9412 else if (buffType[j] == 6)
9413 {
9414 manaRegenBuff = true;
9415 }
9416 else if (buffType[j] == 7)
9417 {
9418 magicDamage += 0.2f;
9419 }
9420 else if (buffType[j] == 8)
9421 {
9422 slowFall = true;
9423 }
9424 else if (buffType[j] == 9)
9425 {
9426 findTreasure = true;
9427 }
9428 else if (buffType[j] == 343)
9429 {
9430 biomeSight = true;
9431 }
9432 else if (buffType[j] == 10)
9433 {
9434 invis = true;
9435 }
9436 else if (buffType[j] == 11)
9437 {
9438 Lighting.AddLight((int)(position.X + (float)(width / 2)) / 16, (int)(position.Y + (float)(height / 2)) / 16, 0.8f, 0.95f, 1f);
9439 }
9440 else if (buffType[j] == 12)
9441 {
9442 nightVision = true;
9443 }
9444 else if (buffType[j] == 13)
9445 {
9446 enemySpawns = true;
9447 }
9448 else if (buffType[j] == 14)
9449 {
9450 if (thorns < 1f)
9451 {
9452 thorns = 1f;
9453 }
9454 }
9455 else if (buffType[j] == 15)
9456 {
9457 waterWalk = true;
9458 }
9459 else if (buffType[j] == 16)
9460 {
9461 archery = true;
9462 }
9463 else if (buffType[j] == 17)
9464 {
9465 detectCreature = true;
9466 }
9467 else if (buffType[j] == 18)
9468 {
9469 gravControl = true;
9470 }
9471 else if (buffType[j] == 30)
9472 {
9473 bleed = true;
9474 }
9475 else if (buffType[j] == 31)
9476 {
9477 confused = true;
9478 }
9479 else if (buffType[j] == 32)
9480 {
9481 slow = true;
9482 }
9483 else if (buffType[j] == 35)
9484 {
9485 silence = true;
9486 }
9487 else if (buffType[j] == 160)
9488 {
9489 dazed = true;
9490 }
9491 else if (buffType[j] == 46)
9492 {
9493 chilled = true;
9494 }
9495 else if (buffType[j] == 47)
9496 {
9497 frozen = true;
9498 }
9499 else if (buffType[j] == 156)
9500 {
9501 stoned = true;
9502 }
9503 else if (buffType[j] == 69)
9504 {
9505 ichor = true;
9506 statDefense -= 15;
9507 }
9508 else if (buffType[j] == 36)
9509 {
9510 brokenArmor = true;
9511 }
9512 else if (buffType[j] == 48)
9513 {
9514 honey = true;
9515 }
9516 else if (buffType[j] == 59)
9517 {
9518 shadowDodge = true;
9519 }
9520 else if (buffType[j] == 93)
9521 {
9522 ammoBox = true;
9523 }
9524 else if (buffType[j] == 58)
9525 {
9526 palladiumRegen = true;
9527 }
9528 else if (buffType[j] == 306)
9529 {
9530 hasTitaniumStormBuff = true;
9531 }
9532 else if (buffType[j] == 88)
9533 {
9534 chaosState = true;
9535 }
9536 else if (buffType[j] == 215)
9537 {
9538 statDefense += 5;
9539 }
9540 else if (buffType[j] == 311)
9541 {
9542 summonerWeaponSpeedBonus += 0.35f;
9543 }
9544 else if (buffType[j] == 308)
9545 {
9546 summonerWeaponSpeedBonus += 0.25f;
9547 }
9548 else if (buffType[j] == 314)
9549 {
9550 summonerWeaponSpeedBonus += 0.12f;
9551 }
9552 else if (buffType[j] == 312)
9553 {
9554 coolWhipBuff = true;
9555 }
9556 else if (buffType[j] == 63)
9557 {
9558 moveSpeed += 1f;
9559 }
9560 else if (buffType[j] == 104)
9561 {
9562 pickSpeed -= 0.25f;
9563 }
9564 else if (buffType[j] == 105)
9565 {
9566 lifeMagnet = true;
9567 }
9568 else if (buffType[j] == 106)
9569 {
9570 calmed = true;
9571 }
9572 else if (buffType[j] == 121)
9573 {
9574 fishingSkill += 15;
9575 }
9576 else if (buffType[j] == 122)
9577 {
9578 sonarPotion = true;
9579 }
9580 else if (buffType[j] == 123)
9581 {
9582 cratePotion = true;
9583 }
9584 else if (buffType[j] == 107)
9585 {
9586 tileSpeed += 0.25f;
9587 wallSpeed += 0.25f;
9588 blockRange++;
9589 }
9590 else if (buffType[j] == 108)
9591 {
9592 kbBuff = true;
9593 }
9594 else if (buffType[j] == 109)
9595 {
9596 ignoreWater = true;
9597 accFlipper = true;
9598 }
9599 else if (buffType[j] == 110)
9600 {
9601 maxMinions++;
9602 }
9603 else if (buffType[j] == 150)
9604 {
9605 maxMinions++;
9606 }
9607 else if (buffType[j] == 348)
9608 {
9609 maxTurrets++;
9610 }
9611 else if (buffType[j] == 111)
9612 {
9613 dangerSense = true;
9614 }
9615 else if (buffType[j] == 112)
9616 {
9617 ammoPotion = true;
9618 }
9619 else if (buffType[j] == 113)
9620 {
9621 lifeForce = true;
9622 statLifeMax2 += statLifeMax / 5 / 20 * 20;
9623 }
9624 else if (buffType[j] == 114)
9625 {
9626 endurance += 0.1f;
9627 }
9628 else if (buffType[j] == 115)
9629 {
9630 meleeCrit += 10;
9631 rangedCrit += 10;
9632 magicCrit += 10;
9633 }
9634 else if (buffType[j] == 116)
9635 {
9636 inferno = true;
9637 Lighting.AddLight((int)(base.Center.X / 16f), (int)(base.Center.Y / 16f), 0.65f, 0.4f, 0.1f);
9638 int num2 = 323;
9639 float num3 = 200f;
9640 bool flag = infernoCounter % 60 == 0;
9641 int damage = 20;
9642 if (whoAmI != Main.myPlayer)
9643 {
9644 continue;
9645 }
9646 for (int k = 0; k < 200; k++)
9647 {
9648 NPC nPC = Main.npc[k];
9649 if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num2] && CanNPCBeHitByPlayerOrPlayerProjectile(nPC) && Vector2.Distance(base.Center, nPC.Center) <= num3)
9650 {
9651 if (nPC.FindBuffIndex(num2) == -1)
9652 {
9653 nPC.AddBuff(num2, 120);
9654 }
9655 if (flag)
9656 {
9657 ApplyDamageToNPC(nPC, damage, 0f, 0, crit: false);
9658 }
9659 }
9660 }
9661 if (!hostile)
9662 {
9663 continue;
9664 }
9665 for (int l = 0; l < 255; l++)
9666 {
9667 Player player = Main.player[l];
9668 if (player == this || !player.active || player.dead || !player.hostile || player.buffImmune[num2] || (player.team == team && player.team != 0) || !(Vector2.Distance(base.Center, player.Center) <= num3))
9669 {
9670 continue;
9671 }
9672 if (player.FindBuffIndex(num2) == -1)
9673 {
9674 player.AddBuff(num2, 120);
9675 }
9676 if (flag)
9677 {
9678 player.Hurt(PlayerDeathReason.LegacyEmpty(), damage, 0, pvp: true);
9679 if (Main.netMode != 0)
9680 {
9682 NetMessage.SendPlayerHurt(l, reason, damage, 0, critical: false, pvp: true, -1);
9683 }
9684 }
9685 }
9686 }
9687 else if (buffType[j] == 117)
9688 {
9689 meleeDamage += 0.1f;
9690 rangedDamage += 0.1f;
9691 magicDamage += 0.1f;
9692 minionDamage += 0.1f;
9693 }
9694 else if (buffType[j] == 119)
9695 {
9696 loveStruck = true;
9697 }
9698 else if (buffType[j] == 120)
9699 {
9700 stinky = true;
9701 }
9702 else if (buffType[j] == 124)
9703 {
9704 resistCold = true;
9705 }
9706 else if (buffType[j] == 257)
9707 {
9708 if (Main.myPlayer == whoAmI)
9709 {
9710 if (buffTime[j] > 36000)
9711 {
9712 luckPotion = 3;
9713 }
9714 else if (buffTime[j] > 18000)
9715 {
9716 luckPotion = 2;
9717 }
9718 else
9719 {
9720 luckPotion = 1;
9721 }
9722 }
9723 }
9724 else if (buffType[j] == 165)
9725 {
9726 lifeRegen += 6;
9727 statDefense += 8;
9728 dryadWard = true;
9729 if (thorns < 1f)
9730 {
9731 thorns += 0.5f;
9732 }
9733 }
9734 else if (buffType[j] == 144)
9735 {
9736 electrified = true;
9737 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.3f, 0.8f, 1.1f);
9738 }
9739 else if (buffType[j] == 94)
9740 {
9741 manaSick = true;
9742 manaSickReduction = manaSickLessDmg * ((float)buffTime[j] / (float)manaSickTime);
9743 }
9744 else if (buffType[j] >= 95 && buffType[j] <= 97)
9745 {
9746 buffTime[j] = 5;
9747 int num4 = (byte)(1 + buffType[j] - 95);
9748 if (beetleOrbs > 0 && beetleOrbs != num4)
9749 {
9750 if (beetleOrbs > num4)
9751 {
9752 DelBuff(j);
9753 j--;
9754 }
9755 else
9756 {
9757 for (int m = 0; m < maxBuffs; m++)
9758 {
9759 if (buffType[m] >= 95 && buffType[m] <= 95 + num4 - 1)
9760 {
9761 DelBuff(m);
9762 m--;
9763 }
9764 }
9765 }
9766 }
9767 beetleOrbs = num4;
9768 if (!beetleDefense)
9769 {
9770 beetleOrbs = 0;
9771 DelBuff(j);
9772 j--;
9773 }
9774 else
9775 {
9776 beetleBuff = true;
9777 }
9778 }
9779 else if (buffType[j] >= 170 && buffType[j] <= 172)
9780 {
9781 buffTime[j] = 5;
9782 int num5 = (byte)(1 + buffType[j] - 170);
9783 if (solarShields > 0 && solarShields != num5)
9784 {
9785 if (solarShields > num5)
9786 {
9787 DelBuff(j);
9788 j--;
9789 }
9790 else
9791 {
9792 for (int n = 0; n < maxBuffs; n++)
9793 {
9794 if (buffType[n] >= 170 && buffType[n] <= 170 + num5 - 1)
9795 {
9796 DelBuff(n);
9797 n--;
9798 }
9799 }
9800 }
9801 }
9802 solarShields = num5;
9803 if (!setSolar)
9804 {
9805 solarShields = 0;
9806 DelBuff(j);
9807 j--;
9808 }
9809 }
9810 else if (buffType[j] >= 98 && buffType[j] <= 100)
9811 {
9812 int num6 = (byte)(1 + buffType[j] - 98);
9813 if (beetleOrbs > 0 && beetleOrbs != num6)
9814 {
9815 if (beetleOrbs > num6)
9816 {
9817 DelBuff(j);
9818 j--;
9819 }
9820 else
9821 {
9822 for (int num7 = 0; num7 < maxBuffs; num7++)
9823 {
9824 if (buffType[num7] >= 98 && buffType[num7] <= 98 + num6 - 1)
9825 {
9826 DelBuff(num7);
9827 num7--;
9828 }
9829 }
9830 }
9831 }
9832 beetleOrbs = num6;
9833 meleeDamage += 0.1f * (float)beetleOrbs;
9834 meleeSpeed += 0.1f * (float)beetleOrbs;
9835 if (!beetleOffense)
9836 {
9837 beetleOrbs = 0;
9838 DelBuff(j);
9839 j--;
9840 }
9841 else
9842 {
9843 beetleBuff = true;
9844 }
9845 }
9846 else if (buffType[j] >= 176 && buffType[j] <= 178)
9847 {
9848 int num8 = nebulaLevelMana;
9849 int num9 = (byte)(1 + buffType[j] - 176);
9850 if (num8 > 0 && num8 != num9)
9851 {
9852 if (num8 > num9)
9853 {
9854 DelBuff(j);
9855 j--;
9856 }
9857 else
9858 {
9859 for (int num10 = 0; num10 < maxBuffs; num10++)
9860 {
9861 if (buffType[num10] >= 176 && buffType[num10] <= 178 + num9 - 1)
9862 {
9863 DelBuff(num10);
9864 num10--;
9865 }
9866 }
9867 }
9868 }
9869 nebulaLevelMana = num9;
9870 if (buffTime[j] == 2 && nebulaLevelMana > 1)
9871 {
9872 nebulaLevelMana--;
9873 buffType[j]--;
9874 buffTime[j] = 480;
9875 }
9876 }
9877 else if (buffType[j] >= 173 && buffType[j] <= 175)
9878 {
9879 int num11 = nebulaLevelLife;
9880 int num12 = (byte)(1 + buffType[j] - 173);
9881 if (num11 > 0 && num11 != num12)
9882 {
9883 if (num11 > num12)
9884 {
9885 DelBuff(j);
9886 j--;
9887 }
9888 else
9889 {
9890 for (int num13 = 0; num13 < maxBuffs; num13++)
9891 {
9892 if (buffType[num13] >= 173 && buffType[num13] <= 175 + num12 - 1)
9893 {
9894 DelBuff(num13);
9895 num13--;
9896 }
9897 }
9898 }
9899 }
9900 nebulaLevelLife = num12;
9901 if (buffTime[j] == 2 && nebulaLevelLife > 1)
9902 {
9903 nebulaLevelLife--;
9904 buffType[j]--;
9905 buffTime[j] = 480;
9906 }
9907 lifeRegen += 6 * nebulaLevelLife;
9908 }
9909 else if (buffType[j] >= 179 && buffType[j] <= 181)
9910 {
9911 int num14 = nebulaLevelDamage;
9912 int num15 = (byte)(1 + buffType[j] - 179);
9913 if (num14 > 0 && num14 != num15)
9914 {
9915 if (num14 > num15)
9916 {
9917 DelBuff(j);
9918 j--;
9919 }
9920 else
9921 {
9922 for (int num16 = 0; num16 < maxBuffs; num16++)
9923 {
9924 if (buffType[num16] >= 179 && buffType[num16] <= 181 + num15 - 1)
9925 {
9926 DelBuff(num16);
9927 num16--;
9928 }
9929 }
9930 }
9931 }
9932 nebulaLevelDamage = num15;
9933 if (buffTime[j] == 2 && nebulaLevelDamage > 1)
9934 {
9935 nebulaLevelDamage--;
9936 buffType[j]--;
9937 buffTime[j] = 480;
9938 }
9939 float num17 = 0.15f * (float)nebulaLevelDamage;
9940 meleeDamage += num17;
9941 rangedDamage += num17;
9942 magicDamage += num17;
9943 minionDamage += num17;
9944 }
9945 else if (buffType[j] == 62)
9946 {
9947 if ((double)statLife <= (double)statLifeMax2 * 0.5)
9948 {
9949 Lighting.AddLight((int)(base.Center.X / 16f), (int)(base.Center.Y / 16f), 0.1f, 0.2f, 0.45f);
9950 iceBarrier = true;
9951 endurance += 0.25f;
9952 iceBarrierFrameCounter++;
9953 if (iceBarrierFrameCounter > 2)
9954 {
9955 iceBarrierFrameCounter = 0;
9956 iceBarrierFrame++;
9957 if (iceBarrierFrame >= 12)
9958 {
9959 iceBarrierFrame = 0;
9960 }
9961 }
9962 }
9963 else
9964 {
9965 DelBuff(j);
9966 j--;
9967 }
9968 }
9969 else if (buffType[j] == 49)
9970 {
9971 for (int num18 = 191; num18 <= 194; num18++)
9972 {
9973 if (ownedProjectileCounts[num18] > 0)
9974 {
9975 pygmy = true;
9976 }
9977 }
9978 if (!pygmy)
9979 {
9980 DelBuff(j);
9981 j--;
9982 }
9983 else
9984 {
9985 buffTime[j] = 18000;
9986 }
9987 }
9988 else if (buffType[j] == 83)
9989 {
9990 if (ownedProjectileCounts[317] > 0)
9991 {
9992 raven = true;
9993 }
9994 if (!raven)
9995 {
9996 DelBuff(j);
9997 j--;
9998 }
9999 else
10000 {
10001 buffTime[j] = 18000;
10002 }
10003 }
10004 else if (buffType[j] == 64)
10005 {
10006 if (ownedProjectileCounts[266] > 0)
10007 {
10008 slime = true;
10009 }
10010 if (!slime)
10011 {
10012 DelBuff(j);
10013 j--;
10014 }
10015 else
10016 {
10017 buffTime[j] = 18000;
10018 }
10019 }
10020 else if (buffType[j] == 125)
10021 {
10022 if (ownedProjectileCounts[373] > 0)
10023 {
10024 hornetMinion = true;
10025 }
10026 if (!hornetMinion)
10027 {
10028 DelBuff(j);
10029 j--;
10030 }
10031 else
10032 {
10033 buffTime[j] = 18000;
10034 }
10035 }
10036 else if (buffType[j] == 126)
10037 {
10038 if (ownedProjectileCounts[375] > 0)
10039 {
10040 impMinion = true;
10041 }
10042 if (!impMinion)
10043 {
10044 DelBuff(j);
10045 j--;
10046 }
10047 else
10048 {
10049 buffTime[j] = 18000;
10050 }
10051 }
10052 else if (buffType[j] == 133)
10053 {
10054 if (ownedProjectileCounts[390] > 0 || ownedProjectileCounts[391] > 0 || ownedProjectileCounts[392] > 0)
10055 {
10056 spiderMinion = true;
10057 }
10058 if (!spiderMinion)
10059 {
10060 DelBuff(j);
10061 j--;
10062 }
10063 else
10064 {
10065 buffTime[j] = 18000;
10066 }
10067 }
10068 else if (buffType[j] == 134)
10069 {
10070 if (ownedProjectileCounts[387] > 0 || ownedProjectileCounts[388] > 0)
10071 {
10072 twinsMinion = true;
10073 }
10074 if (!twinsMinion)
10075 {
10076 DelBuff(j);
10077 j--;
10078 }
10079 else
10080 {
10081 buffTime[j] = 18000;
10082 }
10083 }
10084 else if (buffType[j] == 135)
10085 {
10086 if (ownedProjectileCounts[393] > 0 || ownedProjectileCounts[394] > 0 || ownedProjectileCounts[395] > 0)
10087 {
10088 pirateMinion = true;
10089 }
10090 if (!pirateMinion)
10091 {
10092 DelBuff(j);
10093 j--;
10094 }
10095 else
10096 {
10097 buffTime[j] = 18000;
10098 }
10099 }
10100 else if (buffType[j] == 214)
10101 {
10102 if (ownedProjectileCounts[758] > 0)
10103 {
10104 vampireFrog = true;
10105 }
10106 if (!vampireFrog)
10107 {
10108 DelBuff(j);
10109 j--;
10110 }
10111 else
10112 {
10113 buffTime[j] = 18000;
10114 }
10115 }
10116 else if (buffType[j] == 139)
10117 {
10118 if (ownedProjectileCounts[407] > 0)
10119 {
10120 sharknadoMinion = true;
10121 }
10122 if (!sharknadoMinion)
10123 {
10124 DelBuff(j);
10125 j--;
10126 }
10127 else
10128 {
10129 buffTime[j] = 18000;
10130 }
10131 }
10132 else if (buffType[j] == 140)
10133 {
10134 if (ownedProjectileCounts[423] > 0)
10135 {
10136 UFOMinion = true;
10137 }
10138 if (!UFOMinion)
10139 {
10140 DelBuff(j);
10141 j--;
10142 }
10143 else
10144 {
10145 buffTime[j] = 18000;
10146 }
10147 }
10148 else if (buffType[j] == 182)
10149 {
10150 if (ownedProjectileCounts[613] > 0)
10151 {
10152 stardustMinion = true;
10153 }
10154 if (!stardustMinion)
10155 {
10156 DelBuff(j);
10157 j--;
10158 }
10159 else
10160 {
10161 buffTime[j] = 18000;
10162 }
10163 }
10164 else if (buffType[j] == 213)
10165 {
10166 if (ownedProjectileCounts[755] > 0)
10167 {
10168 batsOfLight = true;
10169 }
10170 if (!batsOfLight)
10171 {
10172 DelBuff(j);
10173 j--;
10174 }
10175 else
10176 {
10177 buffTime[j] = 18000;
10178 }
10179 }
10180 else if (buffType[j] == 216)
10181 {
10182 bool flag2 = true;
10183 if (ownedProjectileCounts[759] > 0)
10184 {
10185 babyBird = true;
10186 }
10187 else if (whoAmI == Main.myPlayer)
10188 {
10189 if (numMinions < maxMinions)
10190 {
10191 int num19 = FindItem(4281);
10192 if (num19 != -1)
10193 {
10194 Item item = inventory[num19];
10195 int num20 = Projectile.NewProjectile(GetProjectileSource_Item(item), base.Top, Vector2.Zero, item.shoot, item.damage, item.knockBack, whoAmI);
10196 Main.projectile[num20].originalDamage = item.damage;
10197 babyBird = true;
10198 }
10199 }
10200 if (!babyBird)
10201 {
10202 DelBuff(j);
10203 j--;
10204 flag2 = false;
10205 }
10206 }
10207 if (flag2)
10208 {
10209 buffTime[j] = 18000;
10210 }
10211 }
10212 else if (buffType[j] == 325)
10213 {
10214 if (ownedProjectileCounts[951] > 0)
10215 {
10216 flinxMinion = true;
10217 }
10218 if (!flinxMinion)
10219 {
10220 DelBuff(j);
10221 j--;
10222 }
10223 else
10224 {
10225 buffTime[j] = 18000;
10226 }
10227 }
10228 else if (buffType[j] == 335)
10229 {
10230 if (ownedProjectileCounts[970] > 0)
10231 {
10232 abigailMinion = true;
10233 }
10234 if (!abigailMinion)
10235 {
10236 DelBuff(j);
10237 j--;
10238 }
10239 else
10240 {
10241 buffTime[j] = 18000;
10242 }
10243 if (whoAmI == Main.myPlayer)
10244 {
10245 UpdateAbigailStatus();
10246 }
10247 }
10248 else if (buffType[j] == 263)
10249 {
10250 if (ownedProjectileCounts[831] > 0)
10251 {
10252 stormTiger = true;
10253 }
10254 if (!stormTiger)
10255 {
10256 DelBuff(j);
10257 j--;
10258 }
10259 else
10260 {
10261 buffTime[j] = 18000;
10262 }
10263 if (whoAmI == Main.myPlayer)
10264 {
10265 UpdateStormTigerStatus();
10266 }
10267 }
10268 else if (buffType[j] == 271)
10269 {
10270 if (ownedProjectileCounts[864] > 0)
10271 {
10272 smolstar = true;
10273 }
10274 if (!smolstar)
10275 {
10276 DelBuff(j);
10277 j--;
10278 }
10279 else
10280 {
10281 buffTime[j] = 18000;
10282 }
10283 }
10284 else if (buffType[j] == 322)
10285 {
10286 if (ownedProjectileCounts[946] > 0)
10287 {
10288 empressBlade = true;
10289 }
10290 if (!empressBlade)
10291 {
10292 DelBuff(j);
10293 j--;
10294 }
10295 else
10296 {
10297 buffTime[j] = 18000;
10298 }
10299 }
10300 else if (buffType[j] == 187)
10301 {
10302 if (ownedProjectileCounts[623] > 0)
10303 {
10304 stardustGuardian = true;
10305 }
10306 if (!stardustGuardian)
10307 {
10308 DelBuff(j);
10309 j--;
10310 }
10311 else
10312 {
10313 buffTime[j] = 18000;
10314 }
10315 }
10316 else if (buffType[j] == 188)
10317 {
10318 if (ownedProjectileCounts[625] > 0)
10319 {
10320 stardustDragon = true;
10321 }
10322 if (!stardustDragon)
10323 {
10324 DelBuff(j);
10325 j--;
10326 }
10327 else
10328 {
10329 buffTime[j] = 18000;
10330 }
10331 }
10332 else if (buffType[j] == 161)
10333 {
10334 if (ownedProjectileCounts[533] > 0)
10335 {
10336 DeadlySphereMinion = true;
10337 }
10338 if (!DeadlySphereMinion)
10339 {
10340 DelBuff(j);
10341 j--;
10342 }
10343 else
10344 {
10345 buffTime[j] = 18000;
10346 }
10347 }
10348 else if (buffType[j] == 90)
10349 {
10350 mount.SetMount(0, this);
10351 buffTime[j] = 10;
10352 }
10353 else if (buffType[j] == 128)
10354 {
10355 mount.SetMount(1, this);
10356 buffTime[j] = 10;
10357 }
10358 else if (buffType[j] == 129)
10359 {
10360 mount.SetMount(2, this);
10361 buffTime[j] = 10;
10362 }
10363 else if (buffType[j] == 130)
10364 {
10365 mount.SetMount(3, this);
10366 buffTime[j] = 10;
10367 }
10368 else if (buffType[j] == 131)
10369 {
10370 ignoreWater = true;
10371 accFlipper = true;
10372 mount.SetMount(4, this);
10373 buffTime[j] = 10;
10374 }
10375 else if (buffType[j] == 132)
10376 {
10377 mount.SetMount(5, this);
10378 buffTime[j] = 10;
10379 }
10380 else if (buffType[j] == 168)
10381 {
10382 ignoreWater = true;
10383 accFlipper = true;
10384 mount.SetMount(12, this);
10385 buffTime[j] = 10;
10386 }
10387 else if (buffType[j] == 141)
10388 {
10389 mount.SetMount(7, this);
10390 buffTime[j] = 10;
10391 }
10392 else if (buffType[j] == 142)
10393 {
10394 mount.SetMount(8, this);
10395 buffTime[j] = 10;
10396 }
10397 else if (buffType[j] == 143)
10398 {
10399 mount.SetMount(9, this);
10400 buffTime[j] = 10;
10401 }
10402 else if (buffType[j] == 162)
10403 {
10404 mount.SetMount(10, this);
10405 buffTime[j] = 10;
10406 }
10407 else if (buffType[j] == 193)
10408 {
10409 mount.SetMount(14, this);
10410 buffTime[j] = 10;
10411 }
10412 else if (buffType[j] == 212)
10413 {
10414 mount.SetMount(17, this);
10415 buffTime[j] = 10;
10416 }
10417 else if (buffType[j] == 230)
10418 {
10419 mount.SetMount(23, this);
10420 buffTime[j] = 10;
10421 }
10422 else if (buffType[j] == 265)
10423 {
10424 canFloatInWater = true;
10425 accFlipper = true;
10426 mount.SetMount(37, this);
10427 buffTime[j] = 10;
10428 }
10429 else if (buffType[j] == 275)
10430 {
10431 mount.SetMount(40, this);
10432 buffTime[j] = 10;
10433 }
10434 else if (buffType[j] == 276)
10435 {
10436 mount.SetMount(41, this);
10437 buffTime[j] = 10;
10438 }
10439 else if (buffType[j] == 277)
10440 {
10441 mount.SetMount(42, this);
10442 buffTime[j] = 10;
10443 }
10444 else if (buffType[j] == 278)
10445 {
10446 mount.SetMount(43, this);
10447 buffTime[j] = 10;
10448 }
10449 else if (buffType[j] == 279)
10450 {
10451 ignoreWater = true;
10452 accFlipper = true;
10453 mount.SetMount(44, this);
10454 buffTime[j] = 10;
10455 }
10456 else if (buffType[j] == 280)
10457 {
10458 mount.SetMount(45, this);
10459 buffTime[j] = 10;
10460 }
10461 else if (buffType[j] == 281)
10462 {
10463 mount.SetMount(46, this);
10464 buffTime[j] = 10;
10465 }
10466 else if (buffType[j] == 282)
10467 {
10468 mount.SetMount(47, this);
10469 buffTime[j] = 10;
10470 }
10471 else if (buffType[j] == 283)
10472 {
10473 mount.SetMount(48, this);
10474 buffTime[j] = 10;
10475 }
10476 else if (buffType[j] == 305)
10477 {
10478 ignoreWater = true;
10479 accFlipper = true;
10480 lavaImmune = true;
10481 mount.SetMount(49, this);
10482 buffTime[j] = 10;
10483 }
10484 else if (buffType[j] == 318)
10485 {
10486 mount.SetMount(50, this);
10487 buffTime[j] = 10;
10488 }
10489 else if (buffType[j] == 342)
10490 {
10491 mount.SetMount(52, this);
10492 buffTime[j] = 10;
10493 }
10494 else if (buffType[j] == 37)
10495 {
10496 if (Main.wofNPCIndex >= 0 && Main.npc[Main.wofNPCIndex].type == 113)
10497 {
10498 gross = true;
10499 buffTime[j] = 10;
10500 }
10501 else
10502 {
10503 DelBuff(j);
10504 j--;
10505 }
10506 }
10507 else if (buffType[j] == 38)
10508 {
10509 buffTime[j] = 10;
10510 tongued = true;
10511 }
10512 else if (buffType[j] == 146)
10513 {
10514 moveSpeed += 0.1f;
10515 moveSpeed *= 1.1f;
10516 sunflower = true;
10517 }
10518 else if (buffType[j] == 19)
10519 {
10520 buffTime[j] = 18000;
10521 lightOrb = true;
10522 bool flag3 = true;
10523 if (ownedProjectileCounts[18] > 0)
10524 {
10525 flag3 = false;
10526 }
10527 if (flag3 && whoAmI == Main.myPlayer)
10528 {
10529 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 18, 0, 0f, whoAmI);
10530 }
10531 }
10532 else if (buffType[j] == 155)
10533 {
10534 buffTime[j] = 18000;
10535 crimsonHeart = true;
10536 bool flag4 = true;
10537 if (ownedProjectileCounts[500] > 0)
10538 {
10539 flag4 = false;
10540 }
10541 if (flag4 && whoAmI == Main.myPlayer)
10542 {
10543 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 500, 0, 0f, whoAmI);
10544 }
10545 }
10546 else if (buffType[j] == 191)
10547 {
10548 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref companionCube, 653);
10549 }
10550 else if (buffType[j] == 202)
10551 {
10552 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagDD2Dragon, 701);
10553 }
10554 else if (buffType[j] == 217)
10555 {
10556 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagUpbeatStar, 764);
10557 }
10558 else if (buffType[j] == 219)
10559 {
10560 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagBabyShark, 774);
10561 }
10562 else if (buffType[j] == 258)
10563 {
10564 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagLilHarpy, 815);
10565 }
10566 else if (buffType[j] == 259)
10567 {
10568 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagFennecFox, 816);
10569 }
10570 else if (buffType[j] == 260)
10571 {
10572 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagGlitteryButterfly, 817);
10573 }
10574 else if (buffType[j] == 261)
10575 {
10576 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagBabyImp, 821);
10577 }
10578 else if (buffType[j] == 262)
10579 {
10580 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagBabyRedPanda, 825);
10581 }
10582 else if (buffType[j] == 264)
10583 {
10584 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagPlantero, 854);
10585 }
10586 else if (buffType[j] == 266)
10587 {
10588 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagDynamiteKitten, 858);
10589 }
10590 else if (buffType[j] == 267)
10591 {
10592 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagBabyWerewolf, 859);
10593 }
10594 else if (buffType[j] == 268)
10595 {
10596 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagShadowMimic, 860);
10597 }
10598 else if (buffType[j] == 274)
10599 {
10600 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagVoltBunny, 875);
10601 }
10602 else if (buffType[j] == 284)
10603 {
10604 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagKingSlimePet, 881);
10605 }
10606 else if (buffType[j] == 285)
10607 {
10608 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagEyeOfCthulhuPet, 882);
10609 }
10610 else if (buffType[j] == 286)
10611 {
10612 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagEaterOfWorldsPet, 883);
10613 }
10614 else if (buffType[j] == 287)
10615 {
10616 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagBrainOfCthulhuPet, 884);
10617 }
10618 else if (buffType[j] == 288)
10619 {
10620 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagSkeletronPet, 885);
10621 }
10622 else if (buffType[j] == 289)
10623 {
10624 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagQueenBeePet, 886);
10625 }
10626 else if (buffType[j] == 290)
10627 {
10628 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagDestroyerPet, 887);
10629 }
10630 else if (buffType[j] == 291)
10631 {
10632 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagTwinsPet, 888);
10633 }
10634 else if (buffType[j] == 292)
10635 {
10636 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagSkeletronPrimePet, 889);
10637 }
10638 else if (buffType[j] == 293)
10639 {
10640 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagPlanteraPet, 890);
10641 }
10642 else if (buffType[j] == 294)
10643 {
10644 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagGolemPet, 891);
10645 }
10646 else if (buffType[j] == 295)
10647 {
10648 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagDukeFishronPet, 892);
10649 }
10650 else if (buffType[j] == 296)
10651 {
10652 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagLunaticCultistPet, 893);
10653 }
10654 else if (buffType[j] == 297)
10655 {
10656 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagMoonLordPet, 894);
10657 }
10658 else if (buffType[j] == 298)
10659 {
10660 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagFairyQueenPet, 895);
10661 }
10662 else if (buffType[j] == 299)
10663 {
10664 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagPumpkingPet, 896);
10665 }
10666 else if (buffType[j] == 300)
10667 {
10668 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagEverscreamPet, 897);
10669 }
10670 else if (buffType[j] == 301)
10671 {
10672 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagIceQueenPet, 898);
10673 }
10674 else if (buffType[j] == 302)
10675 {
10676 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagMartianPet, 899);
10677 }
10678 else if (buffType[j] == 303)
10679 {
10680 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagDD2OgrePet, 900);
10681 }
10682 else if (buffType[j] == 304)
10683 {
10684 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagDD2BetsyPet, 901);
10685 }
10686 else if (buffType[j] == 317)
10687 {
10688 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagQueenSlimePet, 934);
10689 }
10690 else if (buffType[j] == 327)
10691 {
10692 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagBerniePet, 956);
10693 }
10694 else if (buffType[j] == 328)
10695 {
10696 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagGlommerPet, 957);
10697 }
10698 else if (buffType[j] == 329)
10699 {
10700 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagDeerclopsPet, 958);
10701 }
10702 else if (buffType[j] == 330)
10703 {
10704 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagPigPet, 959);
10705 }
10706 else if (buffType[j] == 331)
10707 {
10708 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagChesterPet, 960);
10709 }
10710 else if (buffType[j] == 341)
10711 {
10712 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagKingSlimePet, 881);
10713 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagQueenSlimePet, 934);
10714 }
10715 else if (buffType[j] == 345)
10716 {
10717 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagJunimoPet, 994);
10718 }
10719 else if (buffType[j] == 349)
10720 {
10721 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagBlueChickenPet, 998);
10722 }
10723 else if (buffType[j] == 351)
10724 {
10725 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagSpiffo, 1003);
10726 }
10727 else if (buffType[j] == 352)
10728 {
10729 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagCaveling, 1004);
10730 }
10731 else if (buffType[j] == 354)
10732 {
10733 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagDirtiestBlock, 1018);
10734 }
10735 else if (buffType[j] == 200)
10736 {
10737 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagDD2Gato, 703);
10738 }
10739 else if (buffType[j] == 201)
10740 {
10741 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagDD2Ghost, 702);
10742 }
10743 else if (buffType[j] == 218)
10744 {
10745 BuffHandle_SpawnPetIfNeededAndSetTime(j, ref petFlagSugarGlider, 765);
10746 }
10747 else if (buffType[j] == 190)
10748 {
10749 buffTime[j] = 18000;
10750 suspiciouslookingTentacle = true;
10751 bool flag5 = true;
10752 if (ownedProjectileCounts[650] > 0)
10753 {
10754 flag5 = false;
10755 }
10756 if (flag5 && whoAmI == Main.myPlayer)
10757 {
10758 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 650, 0, 0f, whoAmI);
10759 }
10760 }
10761 else if (buffType[j] == 27 || buffType[j] == 101 || buffType[j] == 102)
10762 {
10763 buffTime[j] = 18000;
10764 bool flag6 = true;
10765 int num21 = 72;
10766 if (buffType[j] == 27)
10767 {
10768 blueFairy = true;
10769 }
10770 if (buffType[j] == 101)
10771 {
10772 num21 = 86;
10773 redFairy = true;
10774 }
10775 if (buffType[j] == 102)
10776 {
10777 num21 = 87;
10778 greenFairy = true;
10779 }
10780 if (head == 45 && body == 26 && legs == 25)
10781 {
10782 num21 = 72;
10783 }
10784 if (ownedProjectileCounts[num21] > 0)
10785 {
10786 flag6 = false;
10787 }
10788 if (flag6 && whoAmI == Main.myPlayer)
10789 {
10790 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, num21, 0, 0f, whoAmI);
10791 }
10792 }
10793 else if (buffType[j] == 40)
10794 {
10795 buffTime[j] = 18000;
10796 bunny = true;
10797 bool flag7 = true;
10798 if (ownedProjectileCounts[111] > 0)
10799 {
10800 flag7 = false;
10801 }
10802 if (flag7 && whoAmI == Main.myPlayer)
10803 {
10804 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 111, 0, 0f, whoAmI);
10805 }
10806 }
10807 else if (buffType[j] == 148)
10808 {
10809 rabid = true;
10810 if (Main.rand.Next(1200) == 0)
10811 {
10812 int num22 = Main.rand.Next(6);
10813 float num23 = (float)Main.rand.Next(60, 100) * 0.01f;
10814 switch (num22)
10815 {
10816 case 0:
10817 AddBuff(22, (int)(60f * num23 * 3f));
10818 break;
10819 case 1:
10820 AddBuff(23, (int)(60f * num23 * 0.75f));
10821 break;
10822 case 2:
10823 AddBuff(31, (int)(60f * num23 * 1.5f));
10824 break;
10825 case 3:
10826 AddBuff(32, (int)(60f * num23 * 3.5f));
10827 break;
10828 case 4:
10829 AddBuff(33, (int)(60f * num23 * 5f));
10830 break;
10831 case 5:
10832 AddBuff(35, (int)(60f * num23 * 1f));
10833 break;
10834 }
10835 }
10836 meleeDamage += 0.2f;
10837 magicDamage += 0.2f;
10838 rangedDamage += 0.2f;
10839 minionDamage += 0.2f;
10840 }
10841 else if (buffType[j] == 41)
10842 {
10843 buffTime[j] = 18000;
10844 penguin = true;
10845 bool flag8 = true;
10846 if (ownedProjectileCounts[112] > 0)
10847 {
10848 flag8 = false;
10849 }
10850 if (flag8 && whoAmI == Main.myPlayer)
10851 {
10852 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 112, 0, 0f, whoAmI);
10853 }
10854 }
10855 else if (buffType[j] == 152)
10856 {
10857 buffTime[j] = 18000;
10858 magicLantern = true;
10859 if (ownedProjectileCounts[492] == 0 && whoAmI == Main.myPlayer)
10860 {
10861 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 492, 0, 0f, whoAmI);
10862 }
10863 }
10864 else if (buffType[j] == 91)
10865 {
10866 buffTime[j] = 18000;
10867 puppy = true;
10868 bool flag9 = true;
10869 if (ownedProjectileCounts[334] > 0)
10870 {
10871 flag9 = false;
10872 }
10873 if (flag9 && whoAmI == Main.myPlayer)
10874 {
10875 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 334, 0, 0f, whoAmI);
10876 }
10877 }
10878 else if (buffType[j] == 92)
10879 {
10880 buffTime[j] = 18000;
10881 grinch = true;
10882 bool flag10 = true;
10883 if (ownedProjectileCounts[353] > 0)
10884 {
10885 flag10 = false;
10886 }
10887 if (flag10 && whoAmI == Main.myPlayer)
10888 {
10889 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 353, 0, 0f, whoAmI);
10890 }
10891 }
10892 else if (buffType[j] == 84)
10893 {
10894 buffTime[j] = 18000;
10895 blackCat = true;
10896 bool flag11 = true;
10897 if (ownedProjectileCounts[319] > 0)
10898 {
10899 flag11 = false;
10900 }
10901 if (flag11 && whoAmI == Main.myPlayer)
10902 {
10903 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 319, 0, 0f, whoAmI);
10904 }
10905 }
10906 else if (buffType[j] == 61)
10907 {
10908 buffTime[j] = 18000;
10909 dino = true;
10910 bool flag12 = true;
10911 if (ownedProjectileCounts[236] > 0)
10912 {
10913 flag12 = false;
10914 }
10915 if (flag12 && whoAmI == Main.myPlayer)
10916 {
10917 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 236, 0, 0f, whoAmI);
10918 }
10919 }
10920 else if (buffType[j] == 154)
10921 {
10922 buffTime[j] = 18000;
10923 babyFaceMonster = true;
10924 bool flag13 = true;
10925 if (ownedProjectileCounts[499] > 0)
10926 {
10927 flag13 = false;
10928 }
10929 if (flag13 && whoAmI == Main.myPlayer)
10930 {
10931 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 499, 0, 0f, whoAmI);
10932 }
10933 }
10934 else if (buffType[j] == 65)
10935 {
10936 buffTime[j] = 18000;
10937 eyeSpring = true;
10938 bool flag14 = true;
10939 if (ownedProjectileCounts[268] > 0)
10940 {
10941 flag14 = false;
10942 }
10943 if (flag14 && whoAmI == Main.myPlayer)
10944 {
10945 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 268, 0, 0f, whoAmI);
10946 }
10947 }
10948 else if (buffType[j] == 66)
10949 {
10950 buffTime[j] = 18000;
10951 snowman = true;
10952 bool flag15 = true;
10953 if (ownedProjectileCounts[269] > 0)
10954 {
10955 flag15 = false;
10956 }
10957 if (flag15 && whoAmI == Main.myPlayer)
10958 {
10959 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 269, 0, 0f, whoAmI);
10960 }
10961 }
10962 else if (buffType[j] == 42)
10963 {
10964 buffTime[j] = 18000;
10965 turtle = true;
10966 bool flag16 = true;
10967 if (ownedProjectileCounts[127] > 0)
10968 {
10969 flag16 = false;
10970 }
10971 if (flag16 && whoAmI == Main.myPlayer)
10972 {
10973 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 127, 0, 0f, whoAmI);
10974 }
10975 }
10976 else if (buffType[j] == 45)
10977 {
10978 buffTime[j] = 18000;
10979 eater = true;
10980 bool flag17 = true;
10981 if (ownedProjectileCounts[175] > 0)
10982 {
10983 flag17 = false;
10984 }
10985 if (flag17 && whoAmI == Main.myPlayer)
10986 {
10987 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 175, 0, 0f, whoAmI);
10988 }
10989 }
10990 else if (buffType[j] == 50)
10991 {
10992 buffTime[j] = 18000;
10993 skeletron = true;
10994 bool flag18 = true;
10995 if (ownedProjectileCounts[197] > 0)
10996 {
10997 flag18 = false;
10998 }
10999 if (flag18 && whoAmI == Main.myPlayer)
11000 {
11001 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 197, 0, 0f, whoAmI);
11002 }
11003 }
11004 else if (buffType[j] == 51)
11005 {
11006 buffTime[j] = 18000;
11007 hornet = true;
11008 bool flag19 = true;
11009 if (ownedProjectileCounts[198] > 0)
11010 {
11011 flag19 = false;
11012 }
11013 if (flag19 && whoAmI == Main.myPlayer)
11014 {
11015 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 198, 0, 0f, whoAmI);
11016 }
11017 }
11018 else if (buffType[j] == 52)
11019 {
11020 buffTime[j] = 18000;
11021 tiki = true;
11022 bool flag20 = true;
11023 if (ownedProjectileCounts[199] > 0)
11024 {
11025 flag20 = false;
11026 }
11027 if (flag20 && whoAmI == Main.myPlayer)
11028 {
11029 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 199, 0, 0f, whoAmI);
11030 }
11031 }
11032 else if (buffType[j] == 53)
11033 {
11034 buffTime[j] = 18000;
11035 lizard = true;
11036 bool flag21 = true;
11037 if (ownedProjectileCounts[200] > 0)
11038 {
11039 flag21 = false;
11040 }
11041 if (flag21 && whoAmI == Main.myPlayer)
11042 {
11043 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 200, 0, 0f, whoAmI);
11044 }
11045 }
11046 else if (buffType[j] == 54)
11047 {
11048 buffTime[j] = 18000;
11049 parrot = true;
11050 bool flag22 = true;
11051 if (ownedProjectileCounts[208] > 0)
11052 {
11053 flag22 = false;
11054 }
11055 if (flag22 && whoAmI == Main.myPlayer)
11056 {
11057 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 208, 0, 0f, whoAmI);
11058 }
11059 }
11060 else if (buffType[j] == 55)
11061 {
11062 buffTime[j] = 18000;
11063 truffle = true;
11064 bool flag23 = true;
11065 if (ownedProjectileCounts[209] > 0)
11066 {
11067 flag23 = false;
11068 }
11069 if (flag23 && whoAmI == Main.myPlayer)
11070 {
11071 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 209, 0, 0f, whoAmI);
11072 }
11073 }
11074 else if (buffType[j] == 56)
11075 {
11076 buffTime[j] = 18000;
11077 sapling = true;
11078 bool flag24 = true;
11079 if (ownedProjectileCounts[210] > 0)
11080 {
11081 flag24 = false;
11082 }
11083 if (flag24 && whoAmI == Main.myPlayer)
11084 {
11085 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 210, 0, 0f, whoAmI);
11086 }
11087 }
11088 else if (buffType[j] == 85)
11089 {
11090 buffTime[j] = 18000;
11091 cSapling = true;
11092 bool flag25 = true;
11093 if (ownedProjectileCounts[324] > 0)
11094 {
11095 flag25 = false;
11096 }
11097 if (flag25 && whoAmI == Main.myPlayer)
11098 {
11099 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 324, 0, 0f, whoAmI);
11100 }
11101 }
11102 else if (buffType[j] == 81)
11103 {
11104 buffTime[j] = 18000;
11105 spider = true;
11106 bool flag26 = true;
11107 if (ownedProjectileCounts[313] > 0)
11108 {
11109 flag26 = false;
11110 }
11111 if (flag26 && whoAmI == Main.myPlayer)
11112 {
11113 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 313, 0, 0f, whoAmI);
11114 }
11115 }
11116 else if (buffType[j] == 82)
11117 {
11118 buffTime[j] = 18000;
11119 squashling = true;
11120 bool flag27 = true;
11121 if (ownedProjectileCounts[314] > 0)
11122 {
11123 flag27 = false;
11124 }
11125 if (flag27 && whoAmI == Main.myPlayer)
11126 {
11127 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 314, 0, 0f, whoAmI);
11128 }
11129 }
11130 else if (buffType[j] == 57)
11131 {
11132 buffTime[j] = 18000;
11133 wisp = true;
11134 bool flag28 = true;
11135 if (ownedProjectileCounts[211] > 0)
11136 {
11137 flag28 = false;
11138 }
11139 if (flag28 && whoAmI == Main.myPlayer)
11140 {
11141 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 211, 0, 0f, whoAmI);
11142 }
11143 }
11144 else if (buffType[j] == 60)
11145 {
11146 buffTime[j] = 18000;
11147 crystalLeaf = true;
11148 bool flag29 = true;
11149 for (int num24 = 0; num24 < 1000; num24++)
11150 {
11151 if (Main.projectile[num24].active && Main.projectile[num24].owner == whoAmI && Main.projectile[num24].type == 226)
11152 {
11153 if (!flag29)
11154 {
11155 Main.projectile[num24].Kill();
11156 }
11157 flag29 = false;
11158 }
11159 }
11160 if (flag29 && whoAmI == Main.myPlayer)
11161 {
11162 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 226, 0, 0f, whoAmI);
11163 }
11164 }
11165 else if (buffType[j] == 127)
11166 {
11167 buffTime[j] = 18000;
11168 zephyrfish = true;
11169 bool flag30 = true;
11170 if (ownedProjectileCounts[380] > 0)
11171 {
11172 flag30 = false;
11173 }
11174 if (flag30 && whoAmI == Main.myPlayer)
11175 {
11176 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 380, 0, 0f, whoAmI);
11177 }
11178 }
11179 else if (buffType[j] == 136)
11180 {
11181 buffTime[j] = 18000;
11182 miniMinotaur = true;
11183 bool flag31 = true;
11184 if (ownedProjectileCounts[398] > 0)
11185 {
11186 flag31 = false;
11187 }
11188 if (flag31 && whoAmI == Main.myPlayer)
11189 {
11190 Projectile.NewProjectile(GetProjectileSource_Buff(j), position.X + (float)(width / 2), position.Y + (float)(height / 2), 0f, 0f, 398, 0, 0f, whoAmI);
11191 }
11192 }
11193 else if (buffType[j] == 70)
11194 {
11195 venom = true;
11196 }
11197 else if (buffType[j] == 20)
11198 {
11199 poisoned = true;
11200 }
11201 else if (buffType[j] == 21)
11202 {
11203 potionDelay = buffTime[j];
11204 }
11205 else if (buffType[j] == 22)
11206 {
11207 blind = true;
11208 }
11209 else if (buffType[j] == 80)
11210 {
11211 blackout = true;
11212 }
11213 else if (buffType[j] == 23)
11214 {
11215 noItems = true;
11216 cursed = true;
11217 }
11218 else if (buffType[j] == 24)
11219 {
11220 onFire = true;
11221 }
11222 else if (buffType[j] == 103)
11223 {
11224 dripping = true;
11225 }
11226 else if (buffType[j] == 137)
11227 {
11228 drippingSlime = true;
11229 }
11230 else if (buffType[j] == 320)
11231 {
11232 drippingSparkleSlime = true;
11233 }
11234 else if (buffType[j] == 67)
11235 {
11236 burned = true;
11237 }
11238 else if (buffType[j] == 68)
11239 {
11240 suffocating = true;
11241 }
11242 else if (buffType[j] == 39)
11243 {
11244 onFire2 = true;
11245 }
11246 else if (buffType[j] == 323)
11247 {
11248 onFire3 = true;
11249 }
11250 else if (buffType[j] == 44)
11251 {
11252 onFrostBurn = true;
11253 }
11254 else if (buffType[j] == 324)
11255 {
11256 onFrostBurn2 = true;
11257 }
11258 else if (buffType[j] == 353)
11259 {
11260 shimmering = true;
11261 frozen = true;
11262 fallStart = (int)(position.Y / 16f);
11263 if (Main.myPlayer != whoAmI)
11264 {
11265 continue;
11266 }
11267 if (position.Y / 16f > (float)Main.UnderworldLayer)
11268 {
11269 if (Main.myPlayer == whoAmI)
11270 {
11271 DelBuff(j);
11272 }
11273 continue;
11274 }
11275 if (shimmerWet)
11276 {
11277 buffTime[j] = 60;
11278 continue;
11279 }
11280 bool flag32 = false;
11281 for (int num25 = (int)(position.X / 16f); (float)num25 <= (position.X + (float)width) / 16f; num25++)
11282 {
11283 for (int num26 = (int)(position.Y / 16f); (float)num26 <= (position.Y + (float)height) / 16f; num26++)
11284 {
11286 {
11287 flag32 = true;
11288 }
11289 }
11290 }
11291 if (flag32)
11292 {
11293 buffTime[j] = 6;
11294 }
11295 else
11296 {
11297 DelBuff(j);
11298 }
11299 }
11300 else if (buffType[j] == 163)
11301 {
11302 headcovered = true;
11303 bleed = true;
11304 }
11305 else if (buffType[j] == 164)
11306 {
11307 vortexDebuff = true;
11308 }
11309 else if (buffType[j] == 194)
11310 {
11311 windPushed = true;
11312 }
11313 else if (buffType[j] == 195)
11314 {
11315 witheredArmor = true;
11316 }
11317 else if (buffType[j] == 205)
11318 {
11319 ballistaPanic = true;
11320 }
11321 else if (buffType[j] == 196)
11322 {
11323 witheredWeapon = true;
11324 }
11325 else if (buffType[j] == 197)
11326 {
11327 slowOgreSpit = true;
11328 }
11329 else if (buffType[j] == 198)
11330 {
11331 parryDamageBuff = true;
11332 }
11333 else if (buffType[j] == 145)
11334 {
11335 moonLeech = true;
11336 }
11337 else if (buffType[j] == 149)
11338 {
11339 webbed = true;
11340 if (velocity.Y != 0f)
11341 {
11342 velocity = new Vector2(0f, 1E-06f);
11343 }
11344 else
11345 {
11346 velocity = Vector2.Zero;
11347 }
11348 jumpHeight = 0;
11349 gravity = 0f;
11350 moveSpeed = 0f;
11351 dash = 0;
11352 dashType = 0;
11353 noKnockback = true;
11354 RemoveAllGrapplingHooks();
11355 }
11356 else if (buffType[j] == 43)
11357 {
11358 defendedByPaladin = true;
11359 }
11360 else if (buffType[j] == 29)
11361 {
11362 magicCrit += 2;
11363 magicDamage += 0.05f;
11364 statManaMax2 += 20;
11365 manaCost -= 0.02f;
11366 }
11367 else if (buffType[j] == 28)
11368 {
11369 if (!Main.dayTime && wolfAcc && !merman)
11370 {
11371 lifeRegen++;
11372 wereWolf = true;
11373 meleeCrit += 2;
11374 meleeDamage += 0.051f;
11375 meleeSpeed += 0.051f;
11376 statDefense += 3;
11377 moveSpeed += 0.05f;
11378 }
11379 else
11380 {
11381 DelBuff(j);
11382 j--;
11383 }
11384 }
11385 else if (buffType[j] == 33)
11386 {
11387 meleeDamage -= 0.051f;
11388 meleeSpeed -= 0.051f;
11389 statDefense -= 4;
11390 moveSpeed -= 0.1f;
11391 }
11392 else if (buffType[j] == 25)
11393 {
11394 tipsy = true;
11395 statDefense -= 4;
11396 meleeCrit += 2;
11397 meleeDamage += 0.1f;
11398 meleeSpeed += 0.1f;
11399 }
11400 else if (buffType[j] == 26)
11401 {
11402 wellFed = true;
11403 statDefense += 2;
11404 meleeCrit += 2;
11405 meleeDamage += 0.05f;
11406 meleeSpeed += 0.05f;
11407 magicCrit += 2;
11408 magicDamage += 0.05f;
11409 rangedCrit += 2;
11410 rangedDamage += 0.05f;
11411 minionDamage += 0.05f;
11412 minionKB += 0.5f;
11413 moveSpeed += 0.2f;
11414 pickSpeed -= 0.05f;
11415 }
11416 else if (buffType[j] == 206)
11417 {
11418 wellFed = true;
11419 statDefense += 3;
11420 meleeCrit += 3;
11421 meleeDamage += 0.075f;
11422 meleeSpeed += 0.075f;
11423 magicCrit += 3;
11424 magicDamage += 0.075f;
11425 rangedCrit += 3;
11426 rangedDamage += 0.075f;
11427 minionDamage += 0.075f;
11428 minionKB += 0.75f;
11429 moveSpeed += 0.3f;
11430 pickSpeed -= 0.1f;
11431 }
11432 else if (buffType[j] == 207)
11433 {
11434 wellFed = true;
11435 statDefense += 4;
11436 meleeCrit += 4;
11437 meleeDamage += 0.1f;
11438 meleeSpeed += 0.1f;
11439 magicCrit += 4;
11440 magicDamage += 0.1f;
11441 rangedCrit += 4;
11442 rangedDamage += 0.1f;
11443 minionDamage += 0.1f;
11444 minionKB += 1f;
11445 moveSpeed += 0.4f;
11446 pickSpeed -= 0.15f;
11447 }
11448 else if (buffType[j] == 333)
11449 {
11450 hungry = true;
11451 statDefense -= 2;
11452 meleeCrit -= 2;
11453 meleeDamage -= 0.05f;
11454 meleeSpeed -= 0.05f;
11455 magicCrit -= 2;
11456 magicDamage -= 0.05f;
11457 rangedCrit -= 2;
11458 rangedDamage -= 0.05f;
11459 minionDamage -= 0.05f;
11460 minionKB -= 0.5f;
11461 pickSpeed += 0.05f;
11462 }
11463 else if (buffType[j] == 334)
11464 {
11465 starving = true;
11466 statDefense -= 4;
11467 meleeCrit -= 4;
11468 meleeDamage -= 0.1f;
11469 meleeSpeed -= 0.1f;
11470 magicCrit -= 4;
11471 magicDamage -= 0.1f;
11472 rangedCrit -= 4;
11473 rangedDamage -= 0.1f;
11474 minionDamage -= 0.1f;
11475 minionKB -= 1f;
11476 pickSpeed += 0.15f;
11477 }
11478 else if (buffType[j] == 336)
11479 {
11480 heartyMeal = true;
11481 }
11482 else if (buffType[j] == 71)
11483 {
11484 meleeEnchant = 1;
11485 }
11486 else if (buffType[j] == 73)
11487 {
11488 meleeEnchant = 2;
11489 }
11490 else if (buffType[j] == 74)
11491 {
11492 meleeEnchant = 3;
11493 }
11494 else if (buffType[j] == 75)
11495 {
11496 meleeEnchant = 4;
11497 }
11498 else if (buffType[j] == 76)
11499 {
11500 meleeEnchant = 5;
11501 }
11502 else if (buffType[j] == 77)
11503 {
11504 meleeEnchant = 6;
11505 }
11506 else if (buffType[j] == 78)
11507 {
11508 meleeEnchant = 7;
11509 }
11510 else if (buffType[j] == 79)
11511 {
11512 meleeEnchant = 8;
11513 }
11514 }
11515 UpdateHungerBuffs();
11516 if (whoAmI == Main.myPlayer && luckPotion != oldLuckPotion)
11517 {
11518 luckNeedsSync = true;
11519 oldLuckPotion = luckPotion;
11520 }
11521 }
11522
11524 {
11525 bool flag = false;
11526 for (int i = 0; i < maxBuffs; i++)
11527 {
11528 if (buffType[i] > 0 && buffTime[i] > 0 && (buffType[i] == 332 || buffType[i] == 333 || buffType[i] == 334))
11529 {
11530 buffTime[i] = 0;
11531 flag = true;
11532 }
11533 }
11534 if (flag)
11535 {
11536 UpdateHungerBuffs();
11537 }
11538 }
11539
11540 public void UpdateHungerBuffs()
11541 {
11542 for (int i = 0; i < maxBuffs; i++)
11543 {
11544 if (buffType[i] <= 0 || buffTime[i] <= 0)
11545 {
11546 continue;
11547 }
11548 if (buffType[i] == 332)
11549 {
11550 if (buffTime[i] <= 2 && whoAmI == Main.myPlayer)
11551 {
11553 {
11554 AddBuff(333, 28800);
11555 }
11556 else
11557 {
11558 AddBuff(333, 18000);
11559 }
11561 }
11562 if (!Main.dontStarveWorld)
11563 {
11564 buffTime[i] = 0;
11565 }
11566 }
11567 else if (buffType[i] == 333)
11568 {
11569 if (buffTime[i] <= 2 && whoAmI == Main.myPlayer)
11570 {
11572 {
11573 AddBuff(334, 5);
11574 }
11575 else
11576 {
11577 AddBuff(334, 5);
11578 }
11580 }
11581 if (!Main.dontStarveWorld)
11582 {
11583 buffTime[i] = 0;
11584 }
11585 }
11586 else if (buffType[i] == 334 && !Main.dontStarveWorld)
11587 {
11588 buffTime[i] = 0;
11589 }
11590 }
11591 }
11592
11594 {
11595 if (whoAmI != Main.myPlayer)
11596 {
11597 return;
11598 }
11599 bool flag = false;
11600 for (int i = 0; i < maxBuffs; i++)
11601 {
11602 if (buffTime[i] > 0 && BuffID.Sets.IsFedState[buffType[i]])
11603 {
11604 flag = true;
11605 break;
11606 }
11607 }
11608 if (!flag)
11609 {
11611 {
11612 AddBuff(332, 28800);
11613 }
11614 else
11615 {
11616 AddBuff(332, 18000);
11617 }
11618 if (withEmote)
11619 {
11621 }
11622 }
11623 }
11624
11625 private void UpdateProjectileCaches(int i)
11626 {
11627 for (int j = 0; j < 1000; j++)
11628 {
11629 if (!Main.projectile[j].active || Main.projectile[j].owner != i)
11630 {
11631 continue;
11632 }
11633 ownedProjectileCounts[Main.projectile[j].type]++;
11634 switch (Main.projectile[j].type)
11635 {
11636 case 831:
11637 {
11638 int originalDamage2 = Main.projectile[j].originalDamage;
11639 if (highestStormTigerGemOriginalDamage < originalDamage2)
11640 {
11641 highestStormTigerGemOriginalDamage = originalDamage2;
11642 }
11643 break;
11644 }
11645 case 970:
11646 {
11647 int originalDamage = Main.projectile[j].originalDamage;
11648 if (highestAbigailCounterOriginalDamage < originalDamage)
11649 {
11650 highestAbigailCounterOriginalDamage = originalDamage;
11651 }
11652 break;
11653 }
11654 }
11655 }
11656 }
11657
11659 {
11660 highestStormTigerGemOriginalDamage = 0;
11661 highestAbigailCounterOriginalDamage = 0;
11662 for (int i = 0; i < ownedProjectileCounts.Length; i++)
11663 {
11664 ownedProjectileCounts[i] = 0;
11665 }
11666 }
11667
11669 {
11670 buffTime[buffIndex] = buffTimeToGive;
11671 BuffHandle_SpawnPetIfNeeded(ref petBool, petProjID, buffIndex);
11672 }
11673
11675 {
11676 petBool = true;
11677 bool flag = true;
11678 if (ownedProjectileCounts[petProjID] > 0)
11679 {
11680 flag = false;
11681 }
11682 Vector2 center = base.Center;
11683 if (buffType[buffIndex] == 341)
11684 {
11685 float num = 10f;
11686 if (petProjID == 934)
11687 {
11688 center += new Vector2(num * (float)direction, 0f);
11689 }
11690 else
11691 {
11692 center -= new Vector2(num * (float)direction, 0f);
11693 }
11694 }
11695 if (flag && whoAmI == Main.myPlayer)
11696 {
11697 Projectile.NewProjectile(GetProjectileSource_Buff(buffIndex), center.X, center.Y, 0f, 0f, petProjID, 0, 0f, whoAmI);
11698 }
11699 }
11700
11701 private void UpdateAbigailStatus()
11702 {
11703 int num = 963;
11704 if (ownedProjectileCounts[970] < 1)
11705 {
11706 for (int i = 0; i < 1000; i++)
11707 {
11708 Projectile projectile = Main.projectile[i];
11709 if (projectile.active && projectile.owner == whoAmI && projectile.type == num)
11710 {
11711 projectile.Kill();
11712 }
11713 }
11714 }
11715 else if (ownedProjectileCounts[num] < 1)
11716 {
11717 Projectile.NewProjectile(GetProjectileSource_Misc(14), base.Center, Vector2.Zero, num, 0, 0f, whoAmI);
11718 }
11719 }
11720
11722 {
11723 int num = GetDesiredStormTigerMinionRank() switch
11724 {
11725 1 => 833,
11726 2 => 834,
11727 3 => 835,
11728 _ => -1,
11729 };
11730 bool flag = false;
11731 if (num == -1)
11732 {
11733 flag = true;
11734 }
11735 for (int i = 0; i < ProjectileID.Sets.StormTigerIds.Length; i++)
11736 {
11738 if (num2 != num && ownedProjectileCounts[num2] >= 1)
11739 {
11740 flag = true;
11741 break;
11742 }
11743 }
11744 if (flag)
11745 {
11746 for (int j = 0; j < 1000; j++)
11747 {
11748 Projectile projectile = Main.projectile[j];
11749 if (projectile.active && projectile.owner == whoAmI && projectile.type != num && ProjectileID.Sets.StormTiger[projectile.type])
11750 {
11751 projectile.Kill();
11752 }
11753 }
11754 }
11755 else if (ownedProjectileCounts[num] < 1)
11756 {
11757 int num3 = Projectile.NewProjectile(GetProjectileSource_Misc(13), base.Center, Vector2.Zero, num, 0, 0f, whoAmI, 0f, 1f);
11758 Main.projectile[num3].localAI[0] = 60f;
11759 }
11760 }
11761
11763 {
11764 int result = 0;
11765 int num = ownedProjectileCounts[831];
11766 if (num > 0)
11767 {
11768 result = 1;
11769 }
11770 if (num > 3)
11771 {
11772 result = 2;
11773 }
11774 if (num > 6)
11775 {
11776 result = 3;
11777 }
11778 return result;
11779 }
11780
11781 public void Counterweight(Vector2 hitPos, int dmg, float kb)
11782 {
11783 if (!yoyoGlove && counterWeight <= 0)
11784 {
11785 return;
11786 }
11787 int num = -1;
11788 int num2 = 0;
11789 int num3 = 0;
11790 for (int i = 0; i < 1000; i++)
11791 {
11792 if (Main.projectile[i].active && Main.projectile[i].owner == whoAmI)
11793 {
11794 if (Main.projectile[i].counterweight)
11795 {
11796 num3++;
11797 }
11798 else if (Main.projectile[i].aiStyle == 99)
11799 {
11800 num2++;
11801 num = i;
11802 }
11803 }
11804 }
11805 if (yoyoGlove && num2 < 2)
11806 {
11807 if (num >= 0)
11808 {
11809 Vector2 vector = hitPos - base.Center;
11810 vector.Normalize();
11811 vector *= 16f;
11812 Projectile.NewProjectile(Projectile.InheritSource(Main.projectile[num]), base.Center.X, base.Center.Y, vector.X, vector.Y, Main.projectile[num].type, Main.projectile[num].damage, Main.projectile[num].knockBack, whoAmI, 1f);
11813 }
11814 }
11815 else if (num3 < num2)
11816 {
11817 Vector2 vector2 = hitPos - base.Center;
11818 vector2.Normalize();
11819 vector2 *= 16f;
11820 float knockBack = (kb + 6f) / 2f;
11822 if (num3 > 0)
11823 {
11824 Projectile.NewProjectile(spawnSource, base.Center.X, base.Center.Y, vector2.X, vector2.Y, counterWeight, (int)((double)dmg * 0.8), knockBack, whoAmI, 1f);
11825 }
11826 else
11827 {
11828 Projectile.NewProjectile(spawnSource, base.Center.X, base.Center.Y, vector2.X, vector2.Y, counterWeight, (int)((double)dmg * 0.8), knockBack, whoAmI);
11829 }
11830 }
11831 }
11832
11833 public int beeType()
11834 {
11835 if (strongBees && Main.rand.Next(2) == 0)
11836 {
11837 makeStrongBee = true;
11838 return 566;
11839 }
11840 makeStrongBee = false;
11841 return 181;
11842 }
11843
11844 public int beeDamage(int dmg)
11845 {
11846 if (makeStrongBee)
11847 {
11848 return dmg + Main.rand.Next(1, 4);
11849 }
11850 return dmg + Main.rand.Next(2);
11851 }
11852
11853 public float beeKB(float KB)
11854 {
11855 if (makeStrongBee)
11856 {
11857 return 0.5f + KB * 1.1f;
11858 }
11859 return KB;
11860 }
11861
11862 public void Yoraiz0rEye()
11863 {
11864 int num = 0;
11865 num += bodyFrame.Y / 56;
11866 if (num >= Main.OffsetsPlayerHeadgear.Length)
11867 {
11868 num = 0;
11869 }
11871 vector *= Directions;
11872 Vector2 vector2 = new Vector2(width / 2, height / 2) + vector + (MountedCenter - base.Center);
11873 sitting.GetSittingOffsetInfo(this, out var posOffset, out var seatAdjustment);
11875 if (face == 19)
11876 {
11877 vector2.Y -= 5f * gravDir;
11878 }
11879 if (head == 276)
11880 {
11881 vector2.X += 2.5f * (float)direction;
11882 }
11883 if (mount.Active && mount.Type == 52)
11884 {
11885 vector2.X += 14f * (float)direction;
11886 vector2.Y -= 2f * gravDir;
11887 }
11888 float y = -11.5f * gravDir;
11889 Vector2 vector3 = new Vector2(3 * direction - ((direction == 1) ? 1 : 0), y) + Vector2.UnitY * gfxOffY + vector2;
11890 Vector2 vector4 = new Vector2(3 * shadowDirection[1] - ((direction == 1) ? 1 : 0), y) + vector2;
11892 if (mount.Active && mount.Cart)
11893 {
11894 int num2 = Math.Sign(velocity.X);
11895 if (num2 == 0)
11896 {
11897 num2 = direction;
11898 }
11899 vector5 = new Vector2(MathHelper.Lerp(0f, -8f, fullRotation / ((float)Math.PI / 4f)), MathHelper.Lerp(0f, 2f, Math.Abs(fullRotation / ((float)Math.PI / 4f)))).RotatedBy(fullRotation);
11900 if (num2 == Math.Sign(fullRotation))
11901 {
11902 vector5 *= MathHelper.Lerp(1f, 0.6f, Math.Abs(fullRotation / ((float)Math.PI / 4f)));
11903 }
11904 }
11905 if (fullRotation != 0f)
11906 {
11907 vector3 = vector3.RotatedBy(fullRotation, fullRotationOrigin);
11908 vector4 = vector4.RotatedBy(fullRotation, fullRotationOrigin);
11909 }
11910 float num3 = 0f;
11911 Vector2 vector6 = position + vector3 + vector5;
11912 Vector2 vector7 = oldPosition + vector4 + vector5;
11913 vector7.Y -= num3 / 2f;
11914 vector6.Y -= num3 / 2f;
11915 float num4 = 1f;
11916 switch (yoraiz0rEye % 10)
11917 {
11918 case 1:
11919 return;
11920 case 2:
11921 num4 = 0.5f;
11922 break;
11923 case 3:
11924 num4 = 0.625f;
11925 break;
11926 case 4:
11927 num4 = 0.75f;
11928 break;
11929 case 5:
11930 num4 = 0.875f;
11931 break;
11932 case 6:
11933 num4 = 1f;
11934 break;
11935 case 7:
11936 num4 = 1.1f;
11937 break;
11938 }
11939 if (yoraiz0rEye < 7)
11940 {
11941 DelegateMethods.v3_1 = Main.hslToRgb(Main.rgbToHsl(eyeColor).X, 1f, 0.5f).ToVector3() * 0.5f * num4;
11942 if (velocity != Vector2.Zero)
11943 {
11944 Utils.PlotTileLine(base.Center, base.Center + velocity * 2f, 4f, DelegateMethods.CastLightOpen);
11945 }
11946 else
11947 {
11949 }
11950 }
11951 int num5 = (int)Vector2.Distance(vector6, vector7) / 3 + 1;
11952 if (Vector2.Distance(vector6, vector7) % 3f != 0f)
11953 {
11954 num5++;
11955 }
11956 for (float num6 = 1f; num6 <= (float)num5; num6 += 1f)
11957 {
11958 Dust obj = Main.dust[Dust.NewDust(base.Center, 0, 0, 182)];
11959 obj.position = Vector2.Lerp(vector7, vector6, num6 / (float)num5);
11960 obj.noGravity = true;
11961 obj.velocity = Vector2.Zero;
11962 obj.customData = this;
11963 obj.scale = num4;
11964 obj.shader = GameShaders.Armor.GetSecondaryShader(cYorai, this);
11965 }
11966 }
11967
11969 {
11970 switch (slot)
11971 {
11972 default:
11973 return true;
11974 case 8:
11975 case 18:
11976 {
11977 bool result2 = extraAccessory;
11978 if (!Main.expertMode && !Main.gameMenu)
11979 {
11980 result2 = false;
11981 }
11982 return result2;
11983 }
11984 case 9:
11985 case 19:
11986 {
11987 bool result = true;
11988 if (!Main.masterMode && !Main.gameMenu)
11989 {
11990 result = false;
11991 }
11992 return result;
11993 }
11994 }
11995 }
11996
11997 public void RefreshInfoAccs()
11998 {
11999 bool flag = false;
12000 accWatch = 0;
12001 accCompass = 0;
12002 accDepthMeter = 0;
12003 accFishFinder = false;
12004 accWeatherRadio = false;
12005 accCalendar = false;
12006 accThirdEye = false;
12007 accJarOfSouls = false;
12008 accCritterGuide = false;
12009 accStopwatch = false;
12010 accOreFinder = false;
12011 accDreamCatcher = false;
12012 for (int i = 0; i < 58; i++)
12013 {
12014 int type = inventory[i].type;
12015 RefreshInfoAccsFromItemType(type);
12016 if (type == 4131)
12017 {
12018 flag = true;
12019 }
12020 }
12021 for (int j = 0; j < 10; j++)
12022 {
12023 int type2 = armor[j].type;
12024 RefreshInfoAccsFromItemType(type2);
12025 }
12026 if (flag)
12027 {
12028 for (int k = 0; k < 40; k++)
12029 {
12030 int type3 = bank4.item[k].type;
12032 {
12033 RefreshInfoAccsFromItemType(type3);
12034 }
12035 }
12036 }
12037 RefreshInfoAccsFromTeamPlayers();
12038 }
12039
12041 {
12042 if (Main.netMode != 1 || whoAmI != Main.myPlayer)
12043 {
12044 return;
12045 }
12046 for (int i = 0; i < 255; i++)
12047 {
12048 if (i == whoAmI || !Main.player[i].active || Main.player[i].dead || Main.player[i].team != team || Main.player[i].team == 0)
12049 {
12050 continue;
12051 }
12052 int num = 800;
12053 if ((Main.player[i].Center - base.Center).Length() < (float)num)
12054 {
12055 if (Main.player[i].accWatch > accWatch)
12056 {
12057 accWatch = Main.player[i].accWatch;
12058 }
12059 if (Main.player[i].accCompass > accCompass)
12060 {
12061 accCompass = Main.player[i].accCompass;
12062 }
12063 if (Main.player[i].accDepthMeter > accDepthMeter)
12064 {
12065 accDepthMeter = Main.player[i].accDepthMeter;
12066 }
12067 if (Main.player[i].accFishFinder)
12068 {
12069 accFishFinder = true;
12070 }
12071 if (Main.player[i].accWeatherRadio)
12072 {
12073 accWeatherRadio = true;
12074 }
12075 if (Main.player[i].accThirdEye)
12076 {
12077 accThirdEye = true;
12078 }
12079 if (Main.player[i].accJarOfSouls)
12080 {
12081 accJarOfSouls = true;
12082 }
12083 if (Main.player[i].accCalendar)
12084 {
12085 accCalendar = true;
12086 }
12087 if (Main.player[i].accStopwatch)
12088 {
12089 accStopwatch = true;
12090 }
12091 if (Main.player[i].accOreFinder)
12092 {
12093 accOreFinder = true;
12094 }
12095 if (Main.player[i].accCritterGuide)
12096 {
12097 accCritterGuide = true;
12098 }
12099 if (Main.player[i].accDreamCatcher)
12100 {
12101 accDreamCatcher = true;
12102 }
12103 if (Main.player[i].hasLuck_LuckyHorseshoe)
12104 {
12105 hasLuck_LuckyHorseshoe = true;
12106 }
12107 if (Main.player[i].hasLuck_LuckyCoin)
12108 {
12109 hasLuck_LuckyCoin = true;
12110 }
12111 }
12112 }
12113 }
12114
12116 {
12117 if ((accType == 15 || accType == 707) && accWatch < 1)
12118 {
12119 accWatch = 1;
12120 }
12121 if ((accType == 16 || accType == 708) && accWatch < 2)
12122 {
12123 accWatch = 2;
12124 }
12125 if ((accType == 17 || accType == 709) && accWatch < 3)
12126 {
12127 accWatch = 3;
12128 }
12129 if (accType == 393)
12130 {
12131 accCompass = 1;
12132 }
12133 if (accType == 18)
12134 {
12135 accDepthMeter = 1;
12136 }
12137 if (accType == 395 || accType == 3123 || accType == 3124 || accType == 5358 || accType == 5359 || accType == 5360 || accType == 5361)
12138 {
12139 accWatch = 3;
12140 accDepthMeter = 1;
12141 accCompass = 1;
12142 }
12143 if (accType == 3120 || accType == 3036 || accType == 3123 || accType == 3124 || accType == 5358 || accType == 5359 || accType == 5360 || accType == 5361)
12144 {
12145 accFishFinder = true;
12146 }
12147 if (accType == 3037 || accType == 3036 || accType == 3123 || accType == 3124 || accType == 5358 || accType == 5359 || accType == 5360 || accType == 5361)
12148 {
12149 accWeatherRadio = true;
12150 }
12151 if (accType == 3096 || accType == 3036 || accType == 3123 || accType == 3124 || accType == 5358 || accType == 5359 || accType == 5360 || accType == 5361)
12152 {
12153 accCalendar = true;
12154 }
12155 if (accType == 3084 || accType == 3122 || accType == 3123 || accType == 3124 || accType == 5358 || accType == 5359 || accType == 5360 || accType == 5361)
12156 {
12157 accThirdEye = true;
12158 }
12159 if (accType == 3095 || accType == 3122 || accType == 3123 || accType == 3124 || accType == 5358 || accType == 5359 || accType == 5360 || accType == 5361)
12160 {
12161 accJarOfSouls = true;
12162 }
12163 if (accType == 3118 || accType == 3122 || accType == 3123 || accType == 3124 || accType == 5358 || accType == 5359 || accType == 5360 || accType == 5361)
12164 {
12165 accCritterGuide = true;
12166 }
12167 if (accType == 3099 || accType == 3121 || accType == 3123 || accType == 3124 || accType == 5358 || accType == 5359 || accType == 5360 || accType == 5361)
12168 {
12169 accStopwatch = true;
12170 }
12171 if (accType == 3102 || accType == 3121 || accType == 3123 || accType == 3124 || accType == 5358 || accType == 5359 || accType == 5360 || accType == 5361)
12172 {
12173 accOreFinder = true;
12174 }
12175 if (accType == 3119 || accType == 3121 || accType == 3123 || accType == 3124 || accType == 5358 || accType == 5359 || accType == 5360 || accType == 5361)
12176 {
12177 accDreamCatcher = true;
12178 }
12179 }
12180
12182 {
12183 if (accType == 3619 || accType == 3611)
12184 {
12185 InfoAccMechShowWires = true;
12186 }
12187 if (accType == 486 || accType == 3611)
12188 {
12189 rulerLine = true;
12190 }
12191 if (accType == 2799 || accType == 3611)
12192 {
12193 rulerGrid = true;
12194 }
12195 if (accType == 2216 || accType == 3061 || accType == 5126)
12196 {
12197 autoPaint = true;
12198 }
12199 if (accType == 3624)
12200 {
12201 autoActuator = true;
12202 }
12203 if (accType == 4346)
12204 {
12205 preventAllItemPickups = true;
12206 }
12207 if (accType == 4767 || accType == 5323)
12208 {
12209 dontHurtCritters = true;
12210 }
12211 if (accType == 5309 || accType == 5323)
12212 {
12213 dontHurtNature = true;
12214 }
12215 if (accType == 5095)
12216 {
12217 hasLucyTheAxe = true;
12218 }
12219 }
12220
12222 {
12223 if (usedAegisFruit)
12224 {
12225 statDefense += 4;
12226 }
12227 if (usedGummyWorm)
12228 {
12229 fishingSkill += 3;
12230 }
12231 if (usedAmbrosia)
12232 {
12233 pickSpeed -= 0.05f;
12234 tileSpeed += 0.05f;
12235 wallSpeed += 0.05f;
12236 }
12237 }
12238
12240 {
12241 switch (itemSlot)
12242 {
12243 default:
12244 return true;
12245 case 0:
12246 return item.headSlot > -1;
12247 case 1:
12248 return item.bodySlot > -1;
12249 case 2:
12250 return item.legSlot > -1;
12251 case 3:
12252 case 4:
12253 case 5:
12254 case 6:
12255 case 7:
12256 case 8:
12257 case 9:
12258 return item.accessory;
12259 }
12260 }
12261
12262 public void UpdateEquips(int i)
12263 {
12264 if (inventory[selectedItem].type == 277 && (!mount.Active || !mount.Cart))
12265 {
12266 trident = true;
12267 }
12268 bool flag = false;
12269 for (int j = 0; j < 58; j++)
12270 {
12271 int type = inventory[j].type;
12272 RefreshInfoAccsFromItemType(type);
12273 RefreshMechanicalAccsFromItemType(type);
12274 if (type == 4743)
12275 {
12276 hasFootball = true;
12277 }
12278 if (type == 4131)
12279 {
12280 flag = true;
12281 }
12282 }
12283 if (inventory[58].type == 4743)
12284 {
12285 hasFootball = true;
12286 }
12287 for (int k = 0; k < 10; k++)
12288 {
12289 Item item = armor[k];
12290 if (!item.IsAir && IsItemSlotUnlockedAndUsable(k) && (!item.expertOnly || Main.expertMode) && UpdateEquips_CanItemGrantBenefits(k, item))
12291 {
12292 if (item.accessory)
12293 {
12294 GrantPrefixBenefits(item);
12295 }
12296 GrantArmorBenefits(item);
12297 }
12298 }
12299 if (flag)
12300 {
12301 for (int l = 0; l < 40; l++)
12302 {
12303 int type2 = bank4.item[l].type;
12305 {
12306 RefreshInfoAccsFromItemType(type2);
12307 RefreshMechanicalAccsFromItemType(type2);
12308 }
12309 }
12310 }
12311 equippedAnyWallSpeedAcc = false;
12312 equippedAnyTileSpeedAcc = false;
12313 equippedAnyTileRangeAcc = false;
12314 if (whoAmI == Main.myPlayer)
12315 {
12316 Main.musicBoxNotModifiedByVolume = -1;
12317 }
12318 for (int m = 3; m < 10; m++)
12319 {
12320 if (IsItemSlotUnlockedAndUsable(m))
12321 {
12322 ApplyEquipFunctional(m, armor[m]);
12323 }
12324 }
12325 if (accFishingBobber)
12326 {
12327 fishingSkill += 10;
12328 }
12329 if (skyStoneEffects)
12330 {
12331 lifeRegen += 2;
12332 statDefense += 4;
12333 meleeSpeed += 0.1f;
12334 meleeDamage += 0.1f;
12335 meleeCrit += 2;
12336 rangedDamage += 0.1f;
12337 rangedCrit += 2;
12338 magicDamage += 0.1f;
12339 magicCrit += 2;
12340 pickSpeed -= 0.15f;
12341 minionDamage += 0.1f;
12342 minionKB += 0.5f;
12343 }
12344 if (dd2Accessory)
12345 {
12346 minionDamage += 0.1f;
12347 maxTurrets++;
12348 }
12349 for (int n = 3; n < 10; n++)
12350 {
12351 if (armor[n].wingSlot > 0 && IsItemSlotUnlockedAndUsable(n))
12352 {
12353 if (!hideVisibleAccessory[n] || (velocity.Y != 0f && !mount.Active))
12354 {
12355 wings = armor[n].wingSlot;
12356 }
12357 wingsLogic = armor[n].wingSlot;
12358 }
12359 }
12360 for (int num = 13; num < 20; num++)
12361 {
12362 if (IsItemSlotUnlockedAndUsable(num))
12363 {
12364 ApplyEquipVanity(num, armor[num]);
12365 }
12366 }
12367 if (wet && ShouldFloatInWater)
12368 {
12369 accFlipper = true;
12370 }
12371 if (whoAmI == Main.myPlayer && Main.SceneMetrics.HasClock && accWatch < 3)
12372 {
12373 accWatch++;
12374 }
12375 if (equippedAnyTileSpeedAcc && inventory[selectedItem].createTile != 4)
12376 {
12377 tileSpeed += 0.5f;
12378 }
12379 if (chiselSpeed)
12380 {
12381 pickSpeed -= 0.25f;
12382 }
12383 if (equippedAnyWallSpeedAcc)
12384 {
12385 wallSpeed += 0.5f;
12386 }
12387 if (equippedAnyTileRangeAcc && whoAmI == Main.myPlayer)
12388 {
12389 tileRangeX += 3;
12390 tileRangeY += 2;
12391 }
12392 if (!accThirdEye)
12393 {
12394 accThirdEyeCounter = 0;
12395 }
12396 RefreshInfoAccsFromTeamPlayers();
12397 if (whoAmI == Main.myPlayer && hasLuck_LuckyHorseshoe)
12398 {
12399 equipmentBasedLuckBonus += 0.05f;
12400 }
12401 if (whoAmI == Main.myPlayer && hasLuck_LuckyCoin)
12402 {
12403 equipmentBasedLuckBonus += 0.05f;
12404 }
12405 if (!accDreamCatcher && dpsStarted)
12406 {
12407 dpsStarted = false;
12408 dpsEnd = DateTime.Now;
12409 }
12410 if (HeldItem.type == 4760 && ownedProjectileCounts[866] < 1)
12411 {
12412 hasRaisableShield = true;
12413 }
12414 int num2 = 0;
12415 int num3 = 10 + num2;
12416 if (armor[num2].type == 5101 || armor[num3].type == 5101)
12417 {
12418 DoEyebrellaRainEffect();
12419 eyebrellaCloud = true;
12420 }
12421 if (lastEquipmentBasedLuckBonus != equipmentBasedLuckBonus)
12422 {
12423 lastEquipmentBasedLuckBonus = equipmentBasedLuckBonus;
12424 luckNeedsSync = true;
12425 }
12426 }
12427
12429 {
12430 int type = armorPiece.type;
12431 RefreshInfoAccsFromItemType(type);
12432 RefreshMechanicalAccsFromItemType(type);
12433 if (armorPiece.type == 3017 || armorPiece.type == 3993)
12434 {
12435 flowerBoots = true;
12436 if (whoAmI == Main.myPlayer)
12437 {
12438 DoBootsEffect(DoBootsEffect_PlaceFlowersOnTile);
12439 }
12440 }
12441 if (armorPiece.type == 5001)
12442 {
12443 moveSpeed += 0.25f;
12444 moonLordLegs = true;
12445 }
12446 statDefense += armorPiece.defense;
12447 lifeRegen += armorPiece.lifeRegen;
12448 if (armorPiece.shieldSlot > 0)
12449 {
12450 hasRaisableShield = true;
12451 }
12452 switch (armorPiece.type)
12453 {
12454 case 3797:
12455 maxTurrets++;
12456 manaCost -= 0.1f;
12457 magicDamage += 0.1f;
12458 break;
12459 case 3798:
12460 magicDamage += 0.1f;
12461 minionDamage += 0.2f;
12462 break;
12463 case 3799:
12464 minionDamage += 0.1f;
12465 magicCrit += 20;
12466 moveSpeed += 0.2f;
12467 break;
12468 case 3800:
12469 maxTurrets++;
12470 lifeRegen += 4;
12471 break;
12472 case 3801:
12473 meleeDamage += 0.15f;
12474 minionDamage += 0.15f;
12475 break;
12476 case 3802:
12477 minionDamage += 0.15f;
12478 meleeCrit += 15;
12479 moveSpeed += 0.15f;
12480 break;
12481 case 3806:
12482 maxTurrets++;
12483 meleeSpeed += 0.2f;
12484 break;
12485 case 3807:
12486 meleeDamage += 0.2f;
12487 minionDamage += 0.2f;
12488 break;
12489 case 3808:
12490 minionDamage += 0.1f;
12491 meleeCrit += 15;
12492 moveSpeed += 0.2f;
12493 break;
12494 case 3803:
12495 maxTurrets++;
12496 rangedCrit += 10;
12497 break;
12498 case 3804:
12499 rangedDamage += 0.2f;
12500 minionDamage += 0.2f;
12501 huntressAmmoCost90 = true;
12502 break;
12503 case 3805:
12504 minionDamage += 0.1f;
12505 moveSpeed += 0.2f;
12506 break;
12507 case 3871:
12508 maxTurrets += 2;
12509 meleeDamage += 0.1f;
12510 minionDamage += 0.1f;
12511 break;
12512 case 3872:
12513 minionDamage += 0.3f;
12514 lifeRegen += 8;
12515 break;
12516 case 3873:
12517 minionDamage += 0.2f;
12518 meleeCrit += 20;
12519 moveSpeed += 0.2f;
12520 break;
12521 case 3874:
12522 maxTurrets += 2;
12523 magicDamage += 0.15f;
12524 minionDamage += 0.15f;
12525 break;
12526 case 3875:
12527 minionDamage += 0.25f;
12528 magicDamage += 0.1f;
12529 manaCost -= 0.15f;
12530 break;
12531 case 3876:
12532 minionDamage += 0.2f;
12533 magicCrit += 25;
12534 moveSpeed += 0.2f;
12535 break;
12536 case 3877:
12537 maxTurrets += 2;
12538 minionDamage += 0.1f;
12539 rangedCrit += 10;
12540 break;
12541 case 3878:
12542 minionDamage += 0.25f;
12543 rangedDamage += 0.25f;
12544 ammoCost80 = true;
12545 break;
12546 case 3879:
12547 minionDamage += 0.25f;
12548 rangedCrit += 10;
12549 moveSpeed += 0.2f;
12550 break;
12551 case 3880:
12552 maxTurrets += 2;
12553 minionDamage += 0.2f;
12554 meleeDamage += 0.2f;
12555 break;
12556 case 3881:
12557 meleeSpeed += 0.2f;
12558 meleeCrit += 5;
12559 minionDamage += 0.2f;
12560 break;
12561 case 3882:
12562 minionDamage += 0.2f;
12563 meleeCrit += 20;
12564 moveSpeed += 0.3f;
12565 break;
12566 }
12567 if (armorPiece.type == 5100)
12568 {
12569 SpawnHallucination(armorPiece);
12570 }
12571 if (armorPiece.type == 268)
12572 {
12573 accDivingHelm = true;
12574 }
12575 if (armorPiece.type == 238)
12576 {
12577 magicDamage += 0.05f;
12579 {
12580 maxMinions++;
12581 }
12582 }
12583 if (armorPiece.type == 3770)
12584 {
12585 slowFall = true;
12586 }
12587 if (armorPiece.type == 4404)
12588 {
12589 canFloatInWater = true;
12590 }
12591 if (armorPiece.type == 3776)
12592 {
12593 magicDamage += 0.15f;
12594 minionDamage += 0.15f;
12595 }
12596 if (armorPiece.type == 3777)
12597 {
12598 statManaMax2 += 40;
12599 minionDamage += 0.1f;
12600 maxMinions++;
12601 }
12602 if (armorPiece.type == 3778)
12603 {
12604 statManaMax2 += 40;
12605 magicDamage += 0.1f;
12606 maxMinions++;
12607 }
12608 if (armorPiece.type == 3212)
12609 {
12610 armorPenetration += 5;
12611 }
12612 if (armorPiece.type == 2277)
12613 {
12614 magicDamage += 0.05f;
12615 meleeDamage += 0.05f;
12616 rangedDamage += 0.05f;
12617 minionDamage += 0.05f;
12618 magicCrit += 5;
12619 rangedCrit += 5;
12620 meleeCrit += 5;
12621 meleeSpeed += 0.1f;
12622 moveSpeed += 0.1f;
12623 }
12624 if (armorPiece.type == 2279)
12625 {
12626 magicDamage += 0.06f;
12627 magicCrit += 6;
12628 manaCost -= 0.1f;
12629 }
12630 if (armorPiece.type == 3109 || armorPiece.type == 4008)
12631 {
12632 nightVision = true;
12633 }
12634 if (armorPiece.type == 256 || armorPiece.type == 257 || armorPiece.type == 258)
12635 {
12636 rangedCrit += 3;
12637 meleeCrit += 3;
12638 magicCrit += 3;
12639 }
12640 if (armorPiece.type == 3374)
12641 {
12642 rangedCrit += 4;
12643 }
12644 if (armorPiece.type == 3375)
12645 {
12646 rangedDamage += 0.05f;
12647 }
12648 if (armorPiece.type == 3376)
12649 {
12650 rangedCrit += 4;
12651 }
12652 if (armorPiece.type == 151 || armorPiece.type == 959 || armorPiece.type == 152 || armorPiece.type == 153)
12653 {
12654 rangedDamage += 0.05f;
12655 }
12656 if (armorPiece.type == 2275)
12657 {
12658 magicDamage += 0.06f;
12659 magicCrit += 6;
12660 }
12661 if (armorPiece.type == 123 || armorPiece.type == 124 || armorPiece.type == 125)
12662 {
12663 magicDamage += 0.09f;
12664 }
12665 if (armorPiece.type == 228 || armorPiece.type == 960)
12666 {
12667 statManaMax2 += 40;
12668 magicCrit += 6;
12669 }
12670 if (armorPiece.type == 229 || armorPiece.type == 961)
12671 {
12672 statManaMax2 += 20;
12673 magicDamage += 0.06f;
12674 }
12675 if (armorPiece.type == 230 || armorPiece.type == 962)
12676 {
12677 statManaMax2 += 20;
12678 magicCrit += 6;
12679 }
12680 if (armorPiece.type == 100 || armorPiece.type == 101 || armorPiece.type == 102)
12681 {
12682 magicCrit += 5;
12683 meleeCrit += 5;
12684 rangedCrit += 5;
12685 }
12686 if (armorPiece.type == 956 || armorPiece.type == 957 || armorPiece.type == 958)
12687 {
12688 magicCrit += 5;
12689 meleeCrit += 5;
12690 rangedCrit += 5;
12691 }
12692 if (armorPiece.type == 792 || armorPiece.type == 793 || armorPiece.type == 794)
12693 {
12694 meleeDamage += 0.03f;
12695 rangedDamage += 0.03f;
12696 magicDamage += 0.03f;
12697 minionDamage += 0.03f;
12698 }
12699 if (armorPiece.type == 231)
12700 {
12701 meleeCrit += 7;
12702 }
12703 if (armorPiece.type == 232)
12704 {
12705 meleeDamage += 0.07f;
12706 }
12707 if (armorPiece.type == 233)
12708 {
12709 meleeSpeed += 0.07f;
12710 }
12711 if (armorPiece.type == 371)
12712 {
12713 magicCrit += 9;
12714 magicDamage += 0.1f;
12715 statManaMax2 += 40;
12716 }
12717 if (armorPiece.type == 372)
12718 {
12719 moveSpeed += 0.1f;
12720 meleeDamage += 0.15f;
12721 }
12722 if (armorPiece.type == 373)
12723 {
12724 rangedDamage += 0.1f;
12725 rangedCrit += 10;
12726 }
12727 if (armorPiece.type == 374)
12728 {
12729 magicCrit += 5;
12730 meleeCrit += 5;
12731 rangedCrit += 5;
12732 }
12733 if (armorPiece.type == 375)
12734 {
12735 rangedDamage += 0.03f;
12736 meleeDamage += 0.03f;
12737 magicDamage += 0.03f;
12738 minionDamage += 0.03f;
12739 moveSpeed += 0.1f;
12740 }
12741 if (armorPiece.type == 376)
12742 {
12743 magicDamage += 0.15f;
12744 statManaMax2 += 60;
12745 }
12746 if (armorPiece.type == 377)
12747 {
12748 meleeCrit += 8;
12749 meleeDamage += 0.1f;
12750 }
12751 if (armorPiece.type == 378)
12752 {
12753 rangedDamage += 0.12f;
12754 rangedCrit += 7;
12755 }
12756 if (armorPiece.type == 379)
12757 {
12758 rangedDamage += 0.07f;
12759 meleeDamage += 0.07f;
12760 magicDamage += 0.07f;
12761 minionDamage += 0.07f;
12762 }
12763 if (armorPiece.type == 380)
12764 {
12765 magicCrit += 10;
12766 meleeCrit += 10;
12767 rangedCrit += 10;
12768 }
12769 if (armorPiece.type >= 2367 && armorPiece.type <= 2369)
12770 {
12771 fishingSkill += 5;
12772 }
12773 if (armorPiece.type == 400)
12774 {
12775 magicDamage += 0.12f;
12776 magicCrit += 12;
12777 statManaMax2 += 80;
12778 }
12779 if (armorPiece.type == 401)
12780 {
12781 meleeCrit += 7;
12782 meleeDamage += 0.14f;
12783 }
12784 if (armorPiece.type == 402)
12785 {
12786 rangedDamage += 0.14f;
12787 rangedCrit += 10;
12788 }
12789 if (armorPiece.type == 403)
12790 {
12791 rangedDamage += 0.08f;
12792 meleeDamage += 0.08f;
12793 magicDamage += 0.08f;
12794 minionDamage += 0.08f;
12795 }
12796 if (armorPiece.type == 404)
12797 {
12798 magicCrit += 7;
12799 meleeCrit += 7;
12800 rangedCrit += 7;
12801 moveSpeed += 0.05f;
12802 }
12803 if (armorPiece.type == 1205)
12804 {
12805 meleeDamage += 0.12f;
12806 meleeSpeed += 0.12f;
12807 }
12808 if (armorPiece.type == 1206)
12809 {
12810 rangedDamage += 0.09f;
12811 rangedCrit += 9;
12812 }
12813 if (armorPiece.type == 1207)
12814 {
12815 magicDamage += 0.09f;
12816 magicCrit += 9;
12817 statManaMax2 += 60;
12818 }
12819 if (armorPiece.type == 1208)
12820 {
12821 meleeDamage += 0.03f;
12822 rangedDamage += 0.03f;
12823 magicDamage += 0.03f;
12824 minionDamage += 0.03f;
12825 magicCrit += 2;
12826 meleeCrit += 2;
12827 rangedCrit += 2;
12828 }
12829 if (armorPiece.type == 1209)
12830 {
12831 meleeDamage += 0.02f;
12832 rangedDamage += 0.02f;
12833 magicDamage += 0.02f;
12834 minionDamage += 0.02f;
12835 magicCrit++;
12836 meleeCrit++;
12837 rangedCrit++;
12838 }
12839 if (armorPiece.type == 1210)
12840 {
12841 meleeDamage += 0.11f;
12842 meleeSpeed += 0.11f;
12843 moveSpeed += 0.07f;
12844 }
12845 if (armorPiece.type == 1211)
12846 {
12847 rangedCrit += 15;
12848 moveSpeed += 0.08f;
12849 }
12850 if (armorPiece.type == 1212)
12851 {
12852 magicCrit += 18;
12853 statManaMax2 += 80;
12854 }
12855 if (armorPiece.type == 1213)
12856 {
12857 magicCrit += 6;
12858 meleeCrit += 6;
12859 rangedCrit += 6;
12860 }
12861 if (armorPiece.type == 1214)
12862 {
12863 moveSpeed += 0.11f;
12864 meleeDamage += 0.08f;
12865 rangedDamage += 0.08f;
12866 magicDamage += 0.08f;
12867 minionDamage += 0.08f;
12868 }
12869 if (armorPiece.type == 1215)
12870 {
12871 meleeDamage += 0.09f;
12872 meleeCrit += 9;
12873 meleeSpeed += 0.09f;
12874 }
12875 if (armorPiece.type == 1216)
12876 {
12877 rangedDamage += 0.16f;
12878 rangedCrit += 7;
12879 }
12880 if (armorPiece.type == 1217)
12881 {
12882 magicDamage += 0.16f;
12883 magicCrit += 7;
12884 statManaMax2 += 100;
12885 }
12886 if (armorPiece.type == 1218)
12887 {
12888 meleeDamage += 0.04f;
12889 rangedDamage += 0.04f;
12890 magicDamage += 0.04f;
12891 minionDamage += 0.04f;
12892 magicCrit += 3;
12893 meleeCrit += 3;
12894 rangedCrit += 3;
12895 }
12896 if (armorPiece.type == 1219)
12897 {
12898 meleeDamage += 0.03f;
12899 rangedDamage += 0.03f;
12900 magicDamage += 0.03f;
12901 minionDamage += 0.03f;
12902 magicCrit += 3;
12903 meleeCrit += 3;
12904 rangedCrit += 3;
12905 moveSpeed += 0.06f;
12906 }
12907 if (armorPiece.type == 558 || armorPiece.type == 4898)
12908 {
12909 magicDamage += 0.12f;
12910 magicCrit += 12;
12911 statManaMax2 += 100;
12912 }
12913 if (armorPiece.type == 559 || armorPiece.type == 4896)
12914 {
12915 meleeCrit += 10;
12916 meleeDamage += 0.1f;
12917 meleeSpeed += 0.1f;
12918 }
12919 if (armorPiece.type == 553 || armorPiece.type == 4897)
12920 {
12921 rangedDamage += 0.15f;
12922 rangedCrit += 8;
12923 }
12924 if (armorPiece.type == 4873 || armorPiece.type == 4899)
12925 {
12926 minionDamage += 0.1f;
12927 maxMinions++;
12928 }
12929 if (armorPiece.type == 551 || armorPiece.type == 4900)
12930 {
12931 magicCrit += 7;
12932 meleeCrit += 7;
12933 rangedCrit += 7;
12934 }
12935 if (armorPiece.type == 552 || armorPiece.type == 4901)
12936 {
12937 rangedDamage += 0.07f;
12938 meleeDamage += 0.07f;
12939 magicDamage += 0.07f;
12940 minionDamage += 0.07f;
12941 moveSpeed += 0.08f;
12942 }
12943 if (armorPiece.type == 4982)
12944 {
12945 rangedCrit += 5;
12946 meleeCrit += 5;
12947 magicCrit += 5;
12948 manaCost -= 0.1f;
12949 }
12950 if (armorPiece.type == 4983)
12951 {
12952 rangedDamage += 0.05f;
12953 meleeDamage += 0.05f;
12954 magicDamage += 0.05f;
12955 minionDamage += 0.05f;
12956 huntressAmmoCost90 = true;
12957 }
12958 if (armorPiece.type == 4984)
12959 {
12960 meleeSpeed += 0.1f;
12961 moveSpeed += 0.2f;
12962 }
12963 if (armorPiece.type == 1001)
12964 {
12965 meleeDamage += 0.16f;
12966 meleeCrit += 6;
12967 }
12968 if (armorPiece.type == 1002)
12969 {
12970 rangedDamage += 0.16f;
12971 chloroAmmoCost80 = true;
12972 }
12973 if (armorPiece.type == 1003)
12974 {
12975 statManaMax2 += 80;
12976 manaCost -= 0.17f;
12977 magicDamage += 0.16f;
12978 }
12979 if (armorPiece.type == 1004)
12980 {
12981 meleeDamage += 0.05f;
12982 magicDamage += 0.05f;
12983 rangedDamage += 0.05f;
12984 minionDamage += 0.05f;
12985 magicCrit += 7;
12986 meleeCrit += 7;
12987 rangedCrit += 7;
12988 }
12989 if (armorPiece.type == 1005)
12990 {
12991 magicCrit += 8;
12992 meleeCrit += 8;
12993 rangedCrit += 8;
12994 moveSpeed += 0.05f;
12995 }
12996 if (armorPiece.type == 2189)
12997 {
12998 statManaMax2 += 60;
12999 manaCost -= 0.13f;
13000 magicDamage += 0.1f;
13001 magicCrit += 10;
13002 }
13003 if (armorPiece.type == 1504)
13004 {
13005 magicDamage += 0.07f;
13006 magicCrit += 7;
13007 }
13008 if (armorPiece.type == 1505)
13009 {
13010 magicDamage += 0.08f;
13011 moveSpeed += 0.08f;
13012 }
13013 if (armorPiece.type == 1546)
13014 {
13015 rangedCrit += 5;
13016 arrowDamage *= 1.15f;
13017 }
13018 if (armorPiece.type == 1547)
13019 {
13020 rangedCrit += 5;
13021 bulletDamage *= 1.15f;
13022 }
13023 if (armorPiece.type == 1548)
13024 {
13025 rangedCrit += 5;
13026 rocketDamage *= 1.15f;
13027 }
13028 if (armorPiece.type == 1549)
13029 {
13030 rangedCrit += 13;
13031 rangedDamage += 0.13f;
13032 ammoCost80 = true;
13033 }
13034 if (armorPiece.type == 1550)
13035 {
13036 rangedCrit += 7;
13037 moveSpeed += 0.12f;
13038 }
13039 if (armorPiece.type == 1282)
13040 {
13041 statManaMax2 += 20;
13042 manaCost -= 0.05f;
13043 }
13044 if (armorPiece.type == 1283)
13045 {
13046 statManaMax2 += 40;
13047 manaCost -= 0.07f;
13048 }
13049 if (armorPiece.type == 1284)
13050 {
13051 statManaMax2 += 40;
13052 manaCost -= 0.09f;
13053 }
13054 if (armorPiece.type == 1285)
13055 {
13056 statManaMax2 += 60;
13057 manaCost -= 0.11f;
13058 }
13059 if (armorPiece.type == 1286 || armorPiece.type == 4256)
13060 {
13061 statManaMax2 += 60;
13062 manaCost -= 0.13f;
13063 }
13064 if (armorPiece.type == 1287)
13065 {
13066 statManaMax2 += 80;
13067 manaCost -= 0.15f;
13068 }
13069 if (armorPiece.type == 1316 || armorPiece.type == 1317 || armorPiece.type == 1318)
13070 {
13071 aggro += 250;
13072 }
13073 if (armorPiece.type == 1316)
13074 {
13075 meleeDamage += 0.06f;
13076 }
13077 if (armorPiece.type == 1317)
13078 {
13079 meleeDamage += 0.08f;
13080 meleeCrit += 8;
13081 }
13082 if (armorPiece.type == 1318)
13083 {
13084 meleeCrit += 4;
13085 }
13086 if (armorPiece.type == 2199 || armorPiece.type == 2202)
13087 {
13088 aggro += 250;
13089 }
13090 if (armorPiece.type == 2201)
13091 {
13092 aggro += 400;
13093 }
13094 if (armorPiece.type == 2199)
13095 {
13096 meleeDamage += 0.06f;
13097 }
13098 if (armorPiece.type == 2200)
13099 {
13100 meleeDamage += 0.08f;
13101 meleeCrit += 8;
13102 meleeSpeed += 0.06f;
13103 moveSpeed += 0.06f;
13104 }
13105 if (armorPiece.type == 2201)
13106 {
13107 meleeDamage += 0.05f;
13108 meleeCrit += 5;
13109 }
13110 if (armorPiece.type == 2202)
13111 {
13112 meleeSpeed += 0.06f;
13113 moveSpeed += 0.06f;
13114 }
13115 if (armorPiece.type == 684)
13116 {
13117 rangedDamage += 0.16f;
13118 meleeDamage += 0.16f;
13119 }
13120 if (armorPiece.type == 685)
13121 {
13122 meleeCrit += 11;
13123 rangedCrit += 11;
13124 }
13125 if (armorPiece.type == 686)
13126 {
13127 moveSpeed += 0.08f;
13128 meleeSpeed += 0.1f;
13129 }
13130 if (armorPiece.type == 5068)
13131 {
13132 maxMinions++;
13133 minionDamage += 0.05f;
13134 }
13135 if (armorPiece.type == 2361)
13136 {
13137 maxMinions++;
13138 minionDamage += 0.04f;
13139 }
13140 if (armorPiece.type == 2362)
13141 {
13142 maxMinions++;
13143 minionDamage += 0.04f;
13144 }
13145 if (armorPiece.type == 2363)
13146 {
13147 minionDamage += 0.05f;
13148 }
13149 if (armorPiece.type == 3266)
13150 {
13151 minionDamage += 0.08f;
13152 }
13153 if (armorPiece.type == 3267)
13154 {
13155 maxMinions++;
13156 }
13157 if (armorPiece.type == 3268)
13158 {
13159 minionDamage += 0.08f;
13160 }
13161 if (armorPiece.type == 410)
13162 {
13163 pickSpeed -= 0.1f;
13164 }
13165 if (armorPiece.type == 411)
13166 {
13167 pickSpeed -= 0.1f;
13168 }
13169 if (armorPiece.type >= 1158 && armorPiece.type <= 1161)
13170 {
13171 maxMinions++;
13172 }
13173 if (armorPiece.type == 1159)
13174 {
13175 whipRangeMultiplier += 0.1f;
13176 }
13177 if (armorPiece.type >= 1159 && armorPiece.type <= 1161)
13178 {
13179 minionDamage += 0.1f;
13180 }
13181 if (armorPiece.type >= 2370 && armorPiece.type <= 2371)
13182 {
13183 minionDamage += 0.05f;
13184 maxMinions++;
13185 }
13186 if (armorPiece.type == 2372)
13187 {
13188 minionDamage += 0.06f;
13189 maxMinions++;
13190 }
13191 if (armorPiece.type == 3381)
13192 {
13193 maxMinions++;
13194 maxTurrets++;
13195 minionDamage += 0.22f;
13196 }
13197 if (armorPiece.type == 3382 || armorPiece.type == 3383)
13198 {
13199 maxMinions += 2;
13200 whipRangeMultiplier += 0.15f;
13201 minionDamage += 0.22f;
13202 }
13203 if (armorPiece.type == 2763)
13204 {
13205 aggro += 300;
13206 meleeCrit += 26;
13207 lifeRegen += 2;
13208 }
13209 if (armorPiece.type == 2764)
13210 {
13211 aggro += 300;
13212 meleeDamage += 0.29f;
13213 lifeRegen += 2;
13214 }
13215 if (armorPiece.type == 2765)
13216 {
13217 aggro += 300;
13218 meleeSpeed += 0.15f;
13219 moveSpeed += 0.15f;
13220 lifeRegen += 2;
13221 }
13222 if (armorPiece.type == 2757)
13223 {
13224 rangedCrit += 7;
13225 rangedDamage += 0.16f;
13226 }
13227 if (armorPiece.type == 2758)
13228 {
13229 ammoCost75 = true;
13230 rangedCrit += 12;
13231 rangedDamage += 0.12f;
13232 }
13233 if (armorPiece.type == 2759)
13234 {
13235 rangedCrit += 8;
13236 rangedDamage += 0.08f;
13237 moveSpeed += 0.1f;
13238 }
13239 if (armorPiece.type == 2760)
13240 {
13241 statManaMax2 += 60;
13242 manaCost -= 0.15f;
13243 magicCrit += 7;
13244 magicDamage += 0.07f;
13245 }
13246 if (armorPiece.type == 2761)
13247 {
13248 magicDamage += 0.09f;
13249 magicCrit += 9;
13250 }
13251 if (armorPiece.type == 2762)
13252 {
13253 moveSpeed += 0.1f;
13254 magicDamage += 0.1f;
13255 }
13256 if (armorPiece.type == 1832)
13257 {
13258 maxMinions++;
13259 minionDamage += 0.11f;
13260 }
13261 if (armorPiece.type == 1833)
13262 {
13263 maxMinions += 2;
13264 minionDamage += 0.11f;
13265 }
13266 if (armorPiece.type == 1834)
13267 {
13268 moveSpeed += 0.2f;
13269 maxMinions++;
13270 minionDamage += 0.11f;
13271 }
13272 }
13273
13275 {
13276 if (item.prefix == 62)
13277 {
13278 statDefense++;
13279 }
13280 if (item.prefix == 63)
13281 {
13282 statDefense += 2;
13283 }
13284 if (item.prefix == 64)
13285 {
13286 statDefense += 3;
13287 }
13288 if (item.prefix == 65)
13289 {
13290 statDefense += 4;
13291 }
13292 if (item.prefix == 66)
13293 {
13294 statManaMax2 += 20;
13295 }
13296 if (item.prefix == 67)
13297 {
13298 meleeCrit += 2;
13299 rangedCrit += 2;
13300 magicCrit += 2;
13301 }
13302 if (item.prefix == 68)
13303 {
13304 meleeCrit += 4;
13305 rangedCrit += 4;
13306 magicCrit += 4;
13307 }
13308 if (item.prefix == 69)
13309 {
13310 meleeDamage += 0.01f;
13311 rangedDamage += 0.01f;
13312 magicDamage += 0.01f;
13313 minionDamage += 0.01f;
13314 }
13315 if (item.prefix == 70)
13316 {
13317 meleeDamage += 0.02f;
13318 rangedDamage += 0.02f;
13319 magicDamage += 0.02f;
13320 minionDamage += 0.02f;
13321 }
13322 if (item.prefix == 71)
13323 {
13324 meleeDamage += 0.03f;
13325 rangedDamage += 0.03f;
13326 magicDamage += 0.03f;
13327 minionDamage += 0.03f;
13328 }
13329 if (item.prefix == 72)
13330 {
13331 meleeDamage += 0.04f;
13332 rangedDamage += 0.04f;
13333 magicDamage += 0.04f;
13334 minionDamage += 0.04f;
13335 }
13336 if (item.prefix == 73)
13337 {
13338 moveSpeed += 0.01f;
13339 }
13340 if (item.prefix == 74)
13341 {
13342 moveSpeed += 0.02f;
13343 }
13344 if (item.prefix == 75)
13345 {
13346 moveSpeed += 0.03f;
13347 }
13348 if (item.prefix == 76)
13349 {
13350 moveSpeed += 0.04f;
13351 }
13352 if (item.prefix == 77)
13353 {
13354 meleeSpeed += 0.01f;
13355 }
13356 if (item.prefix == 78)
13357 {
13358 meleeSpeed += 0.02f;
13359 }
13360 if (item.prefix == 79)
13361 {
13362 meleeSpeed += 0.03f;
13363 }
13364 if (item.prefix == 80)
13365 {
13366 meleeSpeed += 0.04f;
13367 }
13368 }
13369
13371 {
13372 if (whoAmI != Main.myPlayer)
13373 {
13374 return;
13375 }
13376 insanityShadowCooldown = Utils.Clamp(insanityShadowCooldown - 1, 0, 100);
13377 if (insanityShadowCooldown > 0)
13378 {
13379 return;
13380 }
13381 insanityShadowCooldown = Main.rand.Next(20, 101);
13382 float num = 500f;
13383 int damage = 18;
13384 _hallucinationCandidates.Clear();
13385 for (int i = 0; i < 200; i++)
13386 {
13387 NPC nPC = Main.npc[i];
13388 if (nPC.CanBeChasedBy(this) && !(Distance(nPC.Center) > num) && Collision.CanHitLine(position, width, height, nPC.position, nPC.width, nPC.height))
13389 {
13390 _hallucinationCandidates.Add(nPC);
13391 }
13392 }
13393 if (_hallucinationCandidates.Count != 0)
13394 {
13395 Projectile.RandomizeInsanityShadowFor(Main.rand.NextFromCollection(_hallucinationCandidates), isHostile: false, out var spawnposition, out var spawnvelocity, out var ai, out var ai2);
13396 Projectile.NewProjectile(new EntitySource_ItemUse(this, item), spawnposition, spawnvelocity, 964, damage, 0f, whoAmI, ai, ai2);
13397 }
13398 }
13399
13401 {
13402 if (miscCounter % 2 == 0 && velocity.Y == 0f && grappling[0] == -1 && velocity.X != 0f)
13403 {
13404 int x = (int)base.Center.X / 16;
13405 int y = (int)(position.Y + (float)height - 1f) / 16;
13406 theEffectMethod(x, y);
13407 }
13408 }
13409
13411 {
13412 Tile tile = Main.tile[X, Y + 1];
13413 if (tile == null || !tile.active() || tile.liquid > 0 || !WorldGen.SolidTileAllowBottomSlope(X, Y + 1))
13414 {
13415 return false;
13416 }
13418 {
13419 PositionInWorld = new Vector2(X * 16 + 8, Y * 16 + 16)
13420 }, whoAmI);
13421 return true;
13422 }
13423
13425 {
13426 Tile tile = Main.tile[X, Y];
13427 if (tile == null)
13428 {
13429 return false;
13430 }
13431 if (!tile.active() && tile.liquid == 0 && Main.tile[X, Y + 1] != null && WorldGen.SolidTile(X, Y + 1))
13432 {
13433 tile.frameY = 0;
13434 tile.slope(0);
13435 tile.halfBrick(halfBrick: false);
13436 if (Main.tile[X, Y + 1].type == 2 || Main.tile[X, Y + 1].type == 477)
13437 {
13438 int num = Main.rand.NextFromList<int>(6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 27, 30, 33, 36, 39, 42);
13439 switch (num)
13440 {
13441 case 21:
13442 case 24:
13443 case 27:
13444 case 30:
13445 case 33:
13446 case 36:
13447 case 39:
13448 case 42:
13449 num += Main.rand.Next(3);
13450 break;
13451 }
13452 tile.active(active: true);
13453 tile.type = 3;
13454 tile.frameX = (short)(num * 18);
13455 tile.CopyPaintAndCoating(Main.tile[X, Y + 1]);
13456 if (Main.netMode == 1)
13457 {
13459 }
13460 return true;
13461 }
13462 if (Main.tile[X, Y + 1].type == 109 || Main.tile[X, Y + 1].type == 492)
13463 {
13464 if (Main.rand.Next(2) == 0)
13465 {
13466 tile.active(active: true);
13467 tile.type = 110;
13468 tile.frameX = (short)(18 * Main.rand.Next(4, 7));
13469 tile.CopyPaintAndCoating(Main.tile[X, Y + 1]);
13470 while (tile.frameX == 90)
13471 {
13472 tile.frameX = (short)(18 * Main.rand.Next(4, 7));
13473 }
13474 }
13475 else
13476 {
13477 tile.active(active: true);
13478 tile.type = 113;
13479 tile.frameX = (short)(18 * Main.rand.Next(2, 8));
13480 tile.CopyPaintAndCoating(Main.tile[X, Y + 1]);
13481 while (tile.frameX == 90)
13482 {
13483 tile.frameX = (short)(18 * Main.rand.Next(2, 8));
13484 }
13485 }
13486 if (Main.netMode == 1)
13487 {
13489 }
13490 return true;
13491 }
13492 if (Main.tile[X, Y + 1].type == 60)
13493 {
13494 tile.active(active: true);
13495 tile.type = 74;
13496 tile.frameX = (short)(18 * Main.rand.Next(9, 17));
13497 tile.CopyPaintAndCoating(Main.tile[X, Y + 1]);
13498 if (Main.netMode == 1)
13499 {
13501 }
13502 return true;
13503 }
13504 if (Main.tile[X, Y + 1].type == 633)
13505 {
13506 tile.active(active: true);
13507 tile.type = 637;
13508 tile.frameX = (short)(18 * Main.rand.Next(6, 11));
13509 tile.CopyPaintAndCoating(Main.tile[X, Y + 1]);
13510 if (Main.netMode == 1)
13511 {
13513 }
13514 return true;
13515 }
13516 }
13517 return false;
13518 }
13519
13521 {
13522 int type = currentItem.type;
13523 if (currentItem.wingSlot > 0)
13524 {
13525 wings = currentItem.wingSlot;
13526 }
13527 if (type == 861 || type == 3110 || type == 485)
13528 {
13529 hideWolf = false;
13530 forceWerewolf = true;
13531 }
13532 switch (type)
13533 {
13534 case 5452:
13535 remoteVisionForDrone = true;
13536 break;
13537 case 3538:
13538 stardustMonolithShader = true;
13539 break;
13540 case 3537:
13541 nebulaMonolithShader = true;
13542 break;
13543 case 3536:
13544 vortexMonolithShader = true;
13545 break;
13546 case 3539:
13547 solarMonolithShader = true;
13548 break;
13549 case 4318:
13550 moonLordMonolithShader = true;
13551 break;
13552 case 4054:
13553 bloodMoonMonolithShader = true;
13554 break;
13555 case 5345:
13556 CanSeeInvisibleBlocks = true;
13557 break;
13558 case 5347:
13559 shimmerMonolithShader = true;
13560 break;
13561 }
13562 if (type == 5113)
13563 {
13564 dontStarveShader = !dontStarveShader;
13565 }
13566 if (((wet && !lavaWet && (!mount.Active || !mount.IsConsideredASlimeMount)) || !forceWerewolf) && (type == 861 || type == 3110 || type == 497))
13567 {
13568 hideMerman = false;
13569 forceMerman = true;
13570 }
13571 if ((!mount.Active || mount.Type != 47) && (type == 4822 || type == 4874))
13572 {
13573 DoBootsEffect(DoBootsEffect_PlaceFlamesOnTile);
13574 }
13575 if (Main.myPlayer == whoAmI)
13576 {
13577 ApplyMusicBox(currentItem);
13578 }
13579 UpdateBootVisualEffects(currentItem);
13580 UpdateFishingBobber(currentItem);
13581 }
13582
13584 {
13585 if (Main.netMode == 2 || Main.dedServ || Main.rand.Next(4) != 0)
13586 {
13587 return;
13588 }
13589 Vector2 vector = MountedCenter - new Vector2(0f, (float)height * 0.5f) + new Vector2((-0.5f + Main.rand.NextFloat()) * (float)(width + 18), -30f);
13590 int num = (int)(vector.X / 16f);
13591 int num2 = (int)(vector.Y / 16f);
13592 if (WorldGen.InWorld(num, num2))
13593 {
13594 Tile tile = Main.tile[num, num2];
13595 if (tile != null && !WorldGen.SolidTile3(tile) && tile.liquid <= 0)
13596 {
13597 Rain.NewRainForced(Velocity: new Vector2(Main.windSpeedCurrent * 3f, 9f), Position: vector);
13598 }
13599 }
13600 }
13601
13603 {
13605 {
13606 return default(WingStats);
13607 }
13608 return ArmorIDs.Wing.Sets.Stats[wingID];
13609 }
13610
13612 {
13613 if (currentItem.expertOnly && !Main.expertMode)
13614 {
13615 return;
13616 }
13617 if (currentItem.type == 3810 || currentItem.type == 3809 || currentItem.type == 3812 || currentItem.type == 3811)
13618 {
13619 dd2Accessory = true;
13620 }
13621 if (!hideVisibleAccessory[itemSlot])
13622 {
13623 UpdateBootVisualEffects(currentItem);
13624 UpdateFishingBobber(currentItem);
13625 }
13626 switch (currentItem.type)
13627 {
13628 case 4056:
13629 chiselSpeed = true;
13630 break;
13631 case 3990:
13632 accRunSpeed = 6f;
13633 autoJump = true;
13634 jumpSpeedBoost += 1.6f;
13635 extraFall += 10;
13636 break;
13637 case 3991:
13638 manaFlower = true;
13639 manaCost -= 0.08f;
13640 aggro -= 400;
13641 break;
13642 case 3992:
13643 kbGlove = true;
13644 autoReuseGlove = true;
13645 meleeScaleGlove = true;
13646 meleeSpeed += 0.12f;
13647 aggro += 400;
13648 break;
13649 case 3993:
13650 accRunSpeed = 6f;
13651 rocketBoots = (vanityRocketBoots = 2);
13652 break;
13653 case 4055:
13654 accRunSpeed = 6f;
13655 desertBoots = true;
13656 break;
13657 case 3994:
13658 autoJump = true;
13659 jumpSpeedBoost += 1.6f;
13660 extraFall += 10;
13661 accFlipper = true;
13662 break;
13663 case 3995:
13664 autoJump = true;
13665 jumpSpeedBoost += 1.6f;
13666 extraFall += 10;
13667 accFlipper = true;
13668 spikedBoots += 2;
13669 break;
13670 case 3996:
13671 autoJump = true;
13672 jumpSpeedBoost += 1.6f;
13673 extraFall += 10;
13674 spikedBoots += 2;
13675 break;
13676 case 3998:
13677 aggro += 400;
13678 break;
13679 case 4038:
13680 fireWalk = true;
13681 break;
13682 case 4003:
13683 fireWalk = true;
13684 lavaRose = true;
13685 break;
13686 case 4000:
13687 manaFlower = true;
13688 manaCost -= 0.08f;
13689 manaMagnet = true;
13690 break;
13691 case 4001:
13692 manaFlower = true;
13693 manaCost -= 0.08f;
13694 starCloakItem = currentItem;
13695 starCloakItem_manaCloakOverrideItem = currentItem;
13696 break;
13697 case 4002:
13698 magicQuiver = true;
13699 arrowDamageAdditiveStack += 0.1f;
13700 hasMoltenQuiver = true;
13701 break;
13702 case 4004:
13703 fireWalk = true;
13704 lavaRose = true;
13705 break;
13706 case 3999:
13707 fireWalk = true;
13708 break;
13709 case 4005:
13710 rangedCrit += 10;
13711 rangedDamage += 0.1f;
13712 aggro -= 400;
13713 break;
13714 case 4006:
13715 aggro -= 400;
13716 magicQuiver = true;
13717 arrowDamageAdditiveStack += 0.1f;
13718 break;
13719 case 4007:
13720 honeyCombItem = currentItem;
13721 armorPenetration += 5;
13722 break;
13723 case 4341:
13724 case 5126:
13725 portableStoolInfo.SetStats(26, 26, 26);
13726 break;
13727 case 4409:
13728 CanSeeInvisibleBlocks = true;
13729 break;
13730 case 5010:
13731 treasureMagnet = true;
13732 break;
13733 case 3245:
13734 boneGloveItem = currentItem;
13735 break;
13736 case 5107:
13737 hasMagiluminescence = true;
13738 MountedCenter.ToTileCoordinates();
13739 DelegateMethods.v3_1 = new Vector3(0.9f, 0.8f, 0.5f);
13740 Utils.PlotTileLine(base.Center, base.Center + velocity * 6f, 20f, DelegateMethods.CastLightOpen);
13742 break;
13743 }
13744 if (currentItem.type == 3015)
13745 {
13746 aggro -= 400;
13747 meleeCrit += 5;
13748 magicCrit += 5;
13749 rangedCrit += 5;
13750 meleeDamage += 0.05f;
13751 magicDamage += 0.05f;
13752 rangedDamage += 0.05f;
13753 minionDamage += 0.05f;
13754 }
13755 if (currentItem.type == 3016)
13756 {
13757 aggro += 400;
13758 }
13759 if (currentItem.type == 2373)
13760 {
13761 accFishingLine = true;
13762 }
13763 if (currentItem.type == 2374)
13764 {
13765 fishingSkill += 10;
13766 }
13767 if (currentItem.type == 5139 || currentItem.type == 5144 || currentItem.type == 5142 || currentItem.type == 5141 || currentItem.type == 5146 || currentItem.type == 5140 || currentItem.type == 5145 || currentItem.type == 5143)
13768 {
13769 accFishingBobber = true;
13770 }
13771 if (currentItem.type == 2375)
13772 {
13773 accTackleBox = true;
13774 }
13775 if (currentItem.type == 4881)
13776 {
13777 accLavaFishing = true;
13778 }
13779 if (currentItem.type == 3721)
13780 {
13781 accFishingLine = true;
13782 accTackleBox = true;
13783 fishingSkill += 10;
13784 }
13785 if (currentItem.type == 5064)
13786 {
13787 accFishingLine = true;
13788 accTackleBox = true;
13789 fishingSkill += 10;
13790 accLavaFishing = true;
13791 }
13792 if (currentItem.type == 3090)
13793 {
13794 npcTypeNoAggro[1] = true;
13795 npcTypeNoAggro[16] = true;
13796 npcTypeNoAggro[59] = true;
13797 npcTypeNoAggro[71] = true;
13798 npcTypeNoAggro[81] = true;
13799 npcTypeNoAggro[138] = true;
13800 npcTypeNoAggro[121] = true;
13801 npcTypeNoAggro[122] = true;
13802 npcTypeNoAggro[141] = true;
13803 npcTypeNoAggro[147] = true;
13804 npcTypeNoAggro[183] = true;
13805 npcTypeNoAggro[184] = true;
13806 npcTypeNoAggro[204] = true;
13807 npcTypeNoAggro[225] = true;
13808 npcTypeNoAggro[244] = true;
13809 npcTypeNoAggro[302] = true;
13810 npcTypeNoAggro[333] = true;
13811 npcTypeNoAggro[335] = true;
13812 npcTypeNoAggro[334] = true;
13813 npcTypeNoAggro[336] = true;
13814 npcTypeNoAggro[537] = true;
13815 npcTypeNoAggro[676] = true;
13816 npcTypeNoAggro[667] = true;
13817 }
13818 if (currentItem.stringColor > 0)
13819 {
13820 yoyoString = true;
13821 }
13822 if (currentItem.type == 3366)
13823 {
13824 counterWeight = 556 + Main.rand.Next(6);
13825 yoyoGlove = true;
13826 yoyoString = true;
13827 }
13828 if (currentItem.type >= 3309 && currentItem.type <= 3314)
13829 {
13830 counterWeight = 556 + currentItem.type - 3309;
13831 }
13832 if (currentItem.type == 3334)
13833 {
13834 yoyoGlove = true;
13835 }
13836 if (currentItem.type == 3337)
13837 {
13838 shinyStone = true;
13839 }
13840 if (currentItem.type == 4989)
13841 {
13842 empressBrooch = true;
13843 moveSpeed += 0.075f;
13844 }
13845 if (currentItem.type == 3336)
13846 {
13847 SporeSac(currentItem);
13848 sporeSac = true;
13849 }
13850 if (currentItem.type == 4987)
13851 {
13852 VolatileGelatin(currentItem);
13853 volatileGelatin = true;
13854 }
13855 switch (currentItem.type)
13856 {
13857 case 3538:
13858 stardustMonolithShader = true;
13859 break;
13860 case 3537:
13861 nebulaMonolithShader = true;
13862 break;
13863 case 3536:
13864 vortexMonolithShader = true;
13865 break;
13866 case 3539:
13867 solarMonolithShader = true;
13868 break;
13869 case 4318:
13870 moonLordMonolithShader = true;
13871 break;
13872 case 4054:
13873 bloodMoonMonolithShader = true;
13874 break;
13875 case 5345:
13876 CanSeeInvisibleBlocks = true;
13877 break;
13878 case 5347:
13879 shimmerMonolithShader = true;
13880 break;
13881 }
13882 if (currentItem.type == 5113)
13883 {
13884 dontStarveShader = !dontStarveShader;
13885 }
13886 if (currentItem.type == 2423)
13887 {
13888 autoJump = true;
13889 jumpSpeedBoost += 1.6f;
13890 extraFall += 10;
13891 }
13892 if (currentItem.type == 857)
13893 {
13894 hasJumpOption_Sandstorm = true;
13895 }
13896 if (currentItem.type == 983)
13897 {
13898 hasJumpOption_Sandstorm = true;
13899 jumpBoost = true;
13900 }
13901 if (currentItem.type == 987)
13902 {
13903 hasJumpOption_Blizzard = true;
13904 }
13905 if (currentItem.type == 1163)
13906 {
13907 hasJumpOption_Blizzard = true;
13908 jumpBoost = true;
13909 }
13910 if (currentItem.type == 1724)
13911 {
13912 hasJumpOption_Fart = true;
13913 }
13914 if (currentItem.type == 1863)
13915 {
13916 hasJumpOption_Fart = true;
13917 jumpBoost = true;
13918 }
13919 if (currentItem.type == 1164)
13920 {
13921 hasJumpOption_Cloud = true;
13922 hasJumpOption_Sandstorm = true;
13923 hasJumpOption_Blizzard = true;
13924 jumpBoost = true;
13925 }
13926 if (currentItem.type == 5331)
13927 {
13928 hasJumpOption_Cloud = true;
13929 hasJumpOption_Sandstorm = true;
13930 hasJumpOption_Blizzard = true;
13931 jumpBoost = true;
13932 noFallDmg = true;
13933 hasLuck_LuckyHorseshoe = true;
13934 }
13935 if (currentItem.type == 1250)
13936 {
13937 jumpBoost = true;
13938 hasJumpOption_Cloud = true;
13939 noFallDmg = true;
13940 hasLuck_LuckyHorseshoe = true;
13941 }
13942 if (currentItem.type == 1252)
13943 {
13944 hasJumpOption_Sandstorm = true;
13945 jumpBoost = true;
13946 noFallDmg = true;
13947 hasLuck_LuckyHorseshoe = true;
13948 }
13949 if (currentItem.type == 1251)
13950 {
13951 hasJumpOption_Blizzard = true;
13952 jumpBoost = true;
13953 noFallDmg = true;
13954 hasLuck_LuckyHorseshoe = true;
13955 }
13956 if (currentItem.type == 3250)
13957 {
13958 hasJumpOption_Fart = true;
13959 jumpBoost = true;
13960 noFallDmg = true;
13961 hasLuck_LuckyHorseshoe = true;
13962 }
13963 if (currentItem.type == 3252)
13964 {
13965 hasJumpOption_Sail = true;
13966 jumpBoost = true;
13967 noFallDmg = true;
13968 hasLuck_LuckyHorseshoe = true;
13969 }
13970 if (currentItem.type == 3251)
13971 {
13972 jumpBoost = true;
13973 honeyCombItem = currentItem;
13974 noFallDmg = true;
13975 hasLuck_LuckyHorseshoe = true;
13976 }
13977 if (currentItem.type == 1249)
13978 {
13979 jumpBoost = true;
13980 honeyCombItem = currentItem;
13981 }
13982 if (currentItem.type == 3241)
13983 {
13984 jumpBoost = true;
13985 hasJumpOption_Sail = true;
13986 }
13987 if ((currentItem.type == 1253 || currentItem.type == 3997) && (double)statLife <= (double)statLifeMax2 * 0.5)
13988 {
13989 AddBuff(62, 5);
13990 }
13991 if (currentItem.type == 1290)
13992 {
13993 panic = true;
13994 }
13995 if ((currentItem.type == 1300 || currentItem.type == 1858 || currentItem.type == 4005) && (inventory[selectedItem].useAmmo == AmmoID.Bullet || inventory[selectedItem].useAmmo == AmmoID.CandyCorn || inventory[selectedItem].useAmmo == AmmoID.Stake || inventory[selectedItem].useAmmo == 23 || inventory[selectedItem].useAmmo == AmmoID.Solution))
13996 {
13997 scope = true;
13998 }
13999 if (currentItem.type == 1858)
14000 {
14001 rangedCrit += 10;
14002 rangedDamage += 0.1f;
14003 }
14004 if (currentItem.type == 1301)
14005 {
14006 meleeCrit += 8;
14007 rangedCrit += 8;
14008 magicCrit += 8;
14009 meleeDamage += 0.1f;
14010 rangedDamage += 0.1f;
14011 magicDamage += 0.1f;
14012 minionDamage += 0.1f;
14013 }
14014 if (currentItem.type == 111)
14015 {
14016 statManaMax2 += 20;
14017 }
14018 if (currentItem.type == 982)
14019 {
14020 statManaMax2 += 20;
14021 manaRegenDelayBonus += 1f;
14022 manaRegenBonus += 25;
14023 }
14024 if (currentItem.type == 1595)
14025 {
14026 statManaMax2 += 20;
14027 magicCuffs = true;
14028 }
14029 if (currentItem.type == 2219)
14030 {
14031 manaMagnet = true;
14032 }
14033 if (currentItem.type == 2220)
14034 {
14035 manaMagnet = true;
14036 magicDamage += 0.15f;
14037 }
14038 if (currentItem.type == 2221)
14039 {
14040 manaMagnet = true;
14041 statManaMax2 += 20;
14042 magicCuffs = true;
14043 }
14044 if (whoAmI == Main.myPlayer && currentItem.type == 1923)
14045 {
14046 tileRangeX++;
14047 tileRangeY++;
14048 }
14049 if (currentItem.type == 1247)
14050 {
14051 starCloakItem = currentItem;
14052 honeyCombItem = currentItem;
14053 starCloakItem_beeCloakOverrideItem = currentItem;
14054 }
14055 if (currentItem.type == 1248)
14056 {
14057 meleeCrit += 10;
14058 rangedCrit += 10;
14059 magicCrit += 10;
14060 }
14061 if (currentItem.type == 854)
14062 {
14063 discountEquipped = true;
14064 }
14065 if (currentItem.type == 855)
14066 {
14067 hasLuckyCoin = true;
14068 hasLuck_LuckyCoin = true;
14069 }
14070 if (currentItem.type == 3033)
14071 {
14072 goldRing = true;
14073 }
14074 if (currentItem.type == 3034)
14075 {
14076 goldRing = true;
14077 hasLuckyCoin = true;
14078 hasLuck_LuckyCoin = true;
14079 }
14080 if (currentItem.type == 3035)
14081 {
14082 goldRing = true;
14083 hasLuckyCoin = true;
14084 hasLuck_LuckyCoin = true;
14085 discountEquipped = true;
14086 }
14087 if (currentItem.type == 53)
14088 {
14089 hasJumpOption_Cloud = true;
14090 }
14091 if (currentItem.type == 3201)
14092 {
14093 hasJumpOption_Sail = true;
14094 }
14095 if (currentItem.type == 54)
14096 {
14097 accRunSpeed = 6f;
14098 }
14099 if (currentItem.type == 3068)
14100 {
14101 cordage = true;
14102 }
14103 if (currentItem.type == 1579)
14104 {
14105 accRunSpeed = 6f;
14106 }
14107 if (currentItem.type == 3200)
14108 {
14109 accRunSpeed = 6f;
14110 }
14111 if (currentItem.type == 128)
14112 {
14113 rocketBoots = (vanityRocketBoots = 1);
14114 }
14115 if (currentItem.type == 156)
14116 {
14117 noKnockback = true;
14118 }
14119 if (currentItem.type == 158)
14120 {
14121 noFallDmg = true;
14122 hasLuck_LuckyHorseshoe = true;
14123 }
14124 if (currentItem.type == 934)
14125 {
14126 carpet = true;
14127 }
14128 if (currentItem.type == 953)
14129 {
14130 spikedBoots++;
14131 }
14132 if (currentItem.type == 975)
14133 {
14134 spikedBoots++;
14135 }
14136 if (currentItem.type == 976)
14137 {
14138 spikedBoots += 2;
14139 }
14140 if (currentItem.type == 977)
14141 {
14142 dashType = 1;
14143 }
14144 if (currentItem.type == 3097)
14145 {
14146 dashType = 2;
14147 }
14148 if (currentItem.type == 963)
14149 {
14150 blackBelt = true;
14151 }
14152 if (currentItem.type == 984)
14153 {
14154 blackBelt = true;
14155 dashType = 1;
14156 spikedBoots = 2;
14157 }
14158 if (currentItem.type == 1131)
14159 {
14160 gravControl2 = true;
14161 }
14162 if (currentItem.type == 1132)
14163 {
14164 honeyCombItem = currentItem;
14165 }
14166 if (currentItem.type == 1578)
14167 {
14168 honeyCombItem = currentItem;
14169 panic = true;
14170 }
14171 if (currentItem.type == 3224)
14172 {
14173 endurance += 0.17f;
14174 }
14175 if (currentItem.type == 3223)
14176 {
14177 brainOfConfusionItem = currentItem;
14178 }
14179 if (currentItem.type == 950)
14180 {
14181 iceSkate = true;
14182 }
14183 if (currentItem.type == 159)
14184 {
14185 jumpBoost = true;
14186 }
14187 if (currentItem.type == 3225)
14188 {
14189 jumpBoost = true;
14190 }
14191 if (currentItem.type == 187)
14192 {
14193 accFlipper = true;
14194 }
14195 if (currentItem.type == 211)
14196 {
14197 autoReuseGlove = true;
14198 meleeSpeed += 0.12f;
14199 }
14200 if (currentItem.type == 223)
14201 {
14202 manaCost -= 0.06f;
14203 }
14204 if (currentItem.type == 285)
14205 {
14206 moveSpeed += 0.05f;
14207 }
14208 if (currentItem.type == 212)
14209 {
14210 moveSpeed += 0.1f;
14211 }
14212 if (currentItem.type == 267)
14213 {
14214 killGuide = true;
14215 }
14216 if (currentItem.type == 1307)
14217 {
14218 killClothier = true;
14219 }
14220 if (currentItem.type == 193)
14221 {
14222 fireWalk = true;
14223 }
14224 if (currentItem.type == 861)
14225 {
14226 accMerman = true;
14227 wolfAcc = true;
14228 if (hideVisibleAccessory[itemSlot])
14229 {
14230 hideMerman = true;
14231 hideWolf = true;
14232 }
14233 }
14234 if (currentItem.type == 862)
14235 {
14236 starCloakItem = currentItem;
14237 longInvince = true;
14238 starCloakItem_starVeilOverrideItem = currentItem;
14239 }
14240 if (currentItem.type == 860)
14241 {
14242 pStone = true;
14243 }
14244 if (currentItem.type == 863)
14245 {
14246 waterWalk2 = true;
14247 }
14248 if (currentItem.type == 907)
14249 {
14250 waterWalk2 = true;
14251 fireWalk = true;
14252 }
14253 if (currentItem.type == 5044)
14254 {
14255 hasCreditsSceneMusicBox = true;
14256 }
14257 if (currentItem.type == 908 || currentItem.type == 5000)
14258 {
14259 waterWalk = true;
14260 fireWalk = true;
14261 lavaMax += 420;
14262 lavaRose = true;
14263 }
14264 if ((!mount.Active || mount.Type != 47) && !hideVisibleAccessory[itemSlot] && (currentItem.type == 4822 || currentItem.type == 4874))
14265 {
14266 DoBootsEffect(DoBootsEffect_PlaceFlamesOnTile);
14267 }
14268 if (currentItem.type == 906 || currentItem.type == 4038 || currentItem.type == 3999 || currentItem.type == 4003)
14269 {
14270 lavaMax += 420;
14271 }
14272 if (currentItem.type == 485)
14273 {
14274 wolfAcc = true;
14275 if (hideVisibleAccessory[itemSlot])
14276 {
14277 hideWolf = true;
14278 }
14279 }
14280 if (currentItem.type == 486)
14281 {
14282 rulerLine = true;
14283 }
14284 if (currentItem.type == 2799)
14285 {
14286 rulerGrid = true;
14287 }
14288 if (currentItem.type == 394)
14289 {
14290 accFlipper = true;
14291 accDivingHelm = true;
14292 }
14293 if (currentItem.type == 396)
14294 {
14295 noFallDmg = true;
14296 fireWalk = true;
14297 hasLuck_LuckyHorseshoe = true;
14298 }
14299 if (currentItem.type == 397)
14300 {
14301 noKnockback = true;
14302 fireWalk = true;
14303 }
14304 if (currentItem.type == 399)
14305 {
14306 jumpBoost = true;
14307 hasJumpOption_Cloud = true;
14308 }
14309 if (currentItem.type == 405)
14310 {
14311 accRunSpeed = 6f;
14312 rocketBoots = (vanityRocketBoots = 2);
14313 }
14314 if (currentItem.type == 1303)
14315 {
14316 if (!wet)
14317 {
14318 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.225f, 0.05f, 0.15f);
14319 }
14320 if (wet)
14321 {
14322 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 1.8f, 0.4f, 1.2f);
14323 }
14324 }
14325 if (currentItem.type == 1860)
14326 {
14327 accFlipper = true;
14328 accDivingHelm = true;
14329 if (!wet)
14330 {
14331 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.225f, 0.05f, 0.15f);
14332 }
14333 if (wet)
14334 {
14335 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 1.8f, 0.4f, 1.2f);
14336 }
14337 }
14338 if (currentItem.type == 1861)
14339 {
14340 arcticDivingGear = true;
14341 accFlipper = true;
14342 accDivingHelm = true;
14343 iceSkate = true;
14344 if (!wet)
14345 {
14346 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.05f, 0.15f, 0.225f);
14347 }
14348 if (wet)
14349 {
14350 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.4f, 1.2f, 1.8f);
14351 }
14352 }
14353 if (currentItem.type == 2214)
14354 {
14355 equippedAnyTileSpeedAcc = true;
14356 }
14357 if (currentItem.type == 2215)
14358 {
14359 equippedAnyTileRangeAcc = true;
14360 }
14361 if (currentItem.type == 2216)
14362 {
14363 autoPaint = true;
14364 }
14365 if (currentItem.type == 2217)
14366 {
14367 equippedAnyWallSpeedAcc = true;
14368 }
14369 if (currentItem.type == 3061)
14370 {
14371 equippedAnyWallSpeedAcc = true;
14372 equippedAnyTileSpeedAcc = true;
14373 autoPaint = true;
14374 equippedAnyTileRangeAcc = true;
14375 }
14376 if (currentItem.type == 5126)
14377 {
14378 equippedAnyWallSpeedAcc = true;
14379 equippedAnyTileSpeedAcc = true;
14380 autoPaint = true;
14381 equippedAnyTileRangeAcc = true;
14382 treasureMagnet = true;
14383 chiselSpeed = true;
14384 }
14385 if (currentItem.type == 3624)
14386 {
14387 autoActuator = true;
14388 }
14389 if (currentItem.type == 897)
14390 {
14391 kbGlove = true;
14392 autoReuseGlove = true;
14393 meleeScaleGlove = true;
14394 meleeSpeed += 0.12f;
14395 }
14396 if (currentItem.type == 1343)
14397 {
14398 kbGlove = true;
14399 autoReuseGlove = true;
14400 meleeScaleGlove = true;
14401 meleeSpeed += 0.12f;
14402 meleeDamage += 0.12f;
14403 magmaStone = true;
14404 }
14405 if (currentItem.type == 1167)
14406 {
14407 minionKB += 2f;
14408 minionDamage += 0.15f;
14409 }
14410 if (currentItem.type == 1864)
14411 {
14412 minionKB += 2f;
14413 minionDamage += 0.15f;
14414 maxMinions++;
14415 }
14416 if (currentItem.type == 1845)
14417 {
14418 minionDamage += 0.1f;
14419 maxMinions++;
14420 }
14421 if (currentItem.type == 1321)
14422 {
14423 magicQuiver = true;
14424 arrowDamageAdditiveStack += 0.1f;
14425 }
14426 if (currentItem.type == 1322)
14427 {
14428 magmaStone = true;
14429 }
14430 if (currentItem.type == 1323)
14431 {
14432 lavaRose = true;
14433 }
14434 if (currentItem.type == 3333)
14435 {
14436 strongBees = true;
14437 }
14438 if (currentItem.type == 938 || currentItem.type == 3997 || currentItem.type == 3998)
14439 {
14440 noKnockback = true;
14441 if ((float)statLife > (float)statLifeMax2 * 0.25f)
14442 {
14443 hasPaladinShield = true;
14444 if (whoAmI != Main.myPlayer && miscCounter % 10 == 0)
14445 {
14446 int myPlayer = Main.myPlayer;
14447 if (Main.player[myPlayer].team == team && team != 0)
14448 {
14449 float num = position.X - Main.player[myPlayer].position.X;
14450 float num2 = position.Y - Main.player[myPlayer].position.Y;
14451 if ((float)Math.Sqrt(num * num + num2 * num2) < 800f)
14452 {
14453 Main.player[myPlayer].AddBuff(43, 20);
14454 }
14455 }
14456 }
14457 }
14458 }
14459 if (currentItem.type == 936)
14460 {
14461 kbGlove = true;
14462 autoReuseGlove = true;
14463 meleeScaleGlove = true;
14464 meleeSpeed += 0.12f;
14465 meleeDamage += 0.12f;
14466 }
14467 if (currentItem.type == 898)
14468 {
14469 accRunSpeed = 6.75f;
14470 rocketBoots = (vanityRocketBoots = 2);
14471 moveSpeed += 0.08f;
14472 }
14473 if (currentItem.type == 1862)
14474 {
14475 accRunSpeed = 6.75f;
14476 rocketBoots = (vanityRocketBoots = 3);
14477 moveSpeed += 0.08f;
14478 iceSkate = true;
14479 }
14480 if (currentItem.type == 5000)
14481 {
14482 accRunSpeed = 6.75f;
14483 rocketBoots = (vanityRocketBoots = 4);
14484 moveSpeed += 0.08f;
14485 iceSkate = true;
14486 }
14487 if (currentItem.type == 4874)
14488 {
14489 accRunSpeed = 6f;
14490 rocketBoots = (vanityRocketBoots = 5);
14491 }
14492 if (currentItem.type == 3110)
14493 {
14494 accMerman = true;
14495 wolfAcc = true;
14496 if (hideVisibleAccessory[itemSlot])
14497 {
14498 hideMerman = true;
14499 hideWolf = true;
14500 }
14501 }
14502 if (currentItem.type == 1865 || currentItem.type == 3110)
14503 {
14504 skyStoneEffects = true;
14505 }
14506 if (currentItem.type == 899 && Main.dayTime)
14507 {
14508 skyStoneEffects = true;
14509 }
14510 if (currentItem.type == 900 && (!Main.dayTime || Main.eclipse))
14511 {
14512 skyStoneEffects = true;
14513 }
14514 if (currentItem.type == 407)
14515 {
14516 blockRange++;
14517 }
14518 if (currentItem.type == 489)
14519 {
14520 magicDamage += 0.15f;
14521 }
14522 if (currentItem.type == 490)
14523 {
14524 meleeDamage += 0.15f;
14525 }
14526 if (currentItem.type == 491)
14527 {
14528 rangedDamage += 0.15f;
14529 }
14530 if (currentItem.type == 2998)
14531 {
14532 minionDamage += 0.15f;
14533 }
14534 if (currentItem.type == 935)
14535 {
14536 magicDamage += 0.12f;
14537 meleeDamage += 0.12f;
14538 rangedDamage += 0.12f;
14539 minionDamage += 0.12f;
14540 }
14541 if (currentItem.wingSlot != -1)
14542 {
14543 wingTimeMax = GetWingStats(currentItem.wingSlot).FlyTime;
14544 }
14545 if (currentItem.wingSlot == 26)
14546 {
14547 ignoreWater = true;
14548 }
14549 if (currentItem.type == 5452)
14550 {
14551 remoteVisionForDrone = true;
14552 }
14553 if (currentItem.type == 885)
14554 {
14555 buffImmune[30] = true;
14556 }
14557 if (currentItem.type == 886)
14558 {
14559 buffImmune[36] = true;
14560 }
14561 if (currentItem.type == 887)
14562 {
14563 buffImmune[20] = true;
14564 }
14565 if (currentItem.type == 888)
14566 {
14567 buffImmune[22] = true;
14568 }
14569 if (currentItem.type == 889)
14570 {
14571 buffImmune[32] = true;
14572 }
14573 if (currentItem.type == 890)
14574 {
14575 buffImmune[35] = true;
14576 }
14577 if (currentItem.type == 891)
14578 {
14579 buffImmune[23] = true;
14580 }
14581 if (currentItem.type == 892)
14582 {
14583 buffImmune[33] = true;
14584 }
14585 if (currentItem.type == 893)
14586 {
14587 buffImmune[31] = true;
14588 }
14589 if (currentItem.type == 3781)
14590 {
14591 buffImmune[156] = true;
14592 }
14593 if (currentItem.type == 901)
14594 {
14595 buffImmune[33] = true;
14596 buffImmune[36] = true;
14597 }
14598 if (currentItem.type == 902)
14599 {
14600 buffImmune[30] = true;
14601 buffImmune[20] = true;
14602 }
14603 if (currentItem.type == 903)
14604 {
14605 buffImmune[32] = true;
14606 buffImmune[31] = true;
14607 }
14608 if (currentItem.type == 904)
14609 {
14610 buffImmune[35] = true;
14611 buffImmune[23] = true;
14612 }
14613 if (currentItem.type == 5354)
14614 {
14615 buffImmune[22] = true;
14616 buffImmune[156] = true;
14617 }
14618 if (currentItem.type == 5355 && !controlDownHold)
14619 {
14620 shimmerImmune = true;
14621 }
14622 if (currentItem.type == 1921)
14623 {
14624 buffImmune[46] = true;
14625 buffImmune[47] = true;
14626 }
14627 if (currentItem.type == 1612)
14628 {
14629 buffImmune[33] = true;
14630 buffImmune[36] = true;
14631 buffImmune[30] = true;
14632 buffImmune[20] = true;
14633 buffImmune[32] = true;
14634 buffImmune[31] = true;
14635 buffImmune[35] = true;
14636 buffImmune[23] = true;
14637 buffImmune[22] = true;
14638 buffImmune[156] = true;
14639 }
14640 if (currentItem.type == 1613)
14641 {
14642 buffImmune[46] = true;
14643 noKnockback = true;
14644 fireWalk = true;
14645 buffImmune[33] = true;
14646 buffImmune[36] = true;
14647 buffImmune[30] = true;
14648 buffImmune[20] = true;
14649 buffImmune[32] = true;
14650 buffImmune[31] = true;
14651 buffImmune[35] = true;
14652 buffImmune[23] = true;
14653 buffImmune[22] = true;
14654 buffImmune[156] = true;
14655 }
14656 if (currentItem.type == 497)
14657 {
14658 accMerman = true;
14659 if (hideVisibleAccessory[itemSlot])
14660 {
14661 hideMerman = true;
14662 }
14663 }
14664 if (currentItem.type == 535)
14665 {
14666 pStone = true;
14667 }
14668 if (currentItem.type == 536)
14669 {
14670 kbGlove = true;
14671 meleeScaleGlove = true;
14672 }
14673 if (currentItem.type == 532)
14674 {
14675 starCloakItem = currentItem;
14676 }
14677 if (currentItem.type == 554)
14678 {
14679 longInvince = true;
14680 }
14681 if (currentItem.type == 555)
14682 {
14683 manaFlower = true;
14684 manaCost -= 0.08f;
14685 }
14686 if (Main.myPlayer != whoAmI)
14687 {
14688 return;
14689 }
14690 if (currentItem.type == 5104 || currentItem.type == 5105)
14691 {
14692 ApplyWilsonBeard(currentItem);
14693 }
14694 else if (currentItem.type == 576 && Main.rand.Next(540) == 0 && Main.curMusic > 0 && Main.curMusic <= Main.maxMusic)
14695 {
14697 int num3 = -1;
14698 if (Main.curMusic == 1)
14699 {
14700 num3 = 0;
14701 }
14702 if (Main.curMusic == 2)
14703 {
14704 num3 = 1;
14705 }
14706 if (Main.curMusic == 3)
14707 {
14708 num3 = 2;
14709 }
14710 if (Main.curMusic == 4)
14711 {
14712 num3 = 4;
14713 }
14714 if (Main.curMusic == 5)
14715 {
14716 num3 = 5;
14717 }
14718 if (Main.curMusic == 6)
14719 {
14720 num3 = 3;
14721 }
14722 if (Main.curMusic == 7)
14723 {
14724 num3 = 6;
14725 }
14726 if (Main.curMusic == 8)
14727 {
14728 num3 = 7;
14729 }
14730 if (Main.curMusic == 9)
14731 {
14732 num3 = 9;
14733 }
14734 if (Main.curMusic == 10)
14735 {
14736 num3 = 8;
14737 }
14738 if (Main.curMusic == 11)
14739 {
14740 num3 = 11;
14741 }
14742 if (Main.curMusic == 12)
14743 {
14744 num3 = 10;
14745 }
14746 if (Main.curMusic == 13)
14747 {
14748 num3 = 12;
14749 }
14750 if (Main.curMusic == 28)
14751 {
14752 currentItem.SetDefaults(1963);
14753 }
14754 else if (Main.curMusic == 29)
14755 {
14756 currentItem.SetDefaults(1610);
14757 }
14758 else if (Main.curMusic == 30)
14759 {
14760 currentItem.SetDefaults(1963);
14761 }
14762 else if (Main.curMusic == 31)
14763 {
14764 currentItem.SetDefaults(1964);
14765 }
14766 else if (Main.curMusic == 32)
14767 {
14768 currentItem.SetDefaults(1965);
14769 }
14770 else if (Main.curMusic == 33)
14771 {
14772 currentItem.SetDefaults(2742);
14773 }
14774 else if (Main.curMusic == 34)
14775 {
14776 currentItem.SetDefaults(3370);
14777 }
14778 else if (Main.curMusic == 35)
14779 {
14780 currentItem.SetDefaults(3236);
14781 }
14782 else if (Main.curMusic == 36)
14783 {
14784 currentItem.SetDefaults(3237);
14785 }
14786 else if (Main.curMusic == 37)
14787 {
14788 currentItem.SetDefaults(3235);
14789 }
14790 else if (Main.curMusic == 38)
14791 {
14792 currentItem.SetDefaults(3044);
14793 }
14794 else if (Main.curMusic == 39)
14795 {
14796 currentItem.SetDefaults(3371);
14797 }
14798 else if (Main.curMusic == 40)
14799 {
14800 currentItem.SetDefaults(3796);
14801 }
14802 else if (Main.curMusic == 41)
14803 {
14804 currentItem.SetDefaults(3869);
14805 }
14806 else if (Main.curMusic == 42)
14807 {
14808 currentItem.SetDefaults(4079);
14809 }
14810 else if (Main.curMusic == 43)
14811 {
14812 currentItem.SetDefaults(4077);
14813 }
14814 else if (Main.curMusic == 44)
14815 {
14816 currentItem.SetDefaults(4082);
14817 }
14818 else if (Main.curMusic == 46)
14819 {
14820 currentItem.SetDefaults(4080);
14821 }
14822 else if (Main.curMusic == 47)
14823 {
14824 currentItem.SetDefaults(4081);
14825 }
14826 else if (Main.curMusic == 48)
14827 {
14828 currentItem.SetDefaults(4078);
14829 }
14830 else if (Main.curMusic == 49)
14831 {
14832 currentItem.SetDefaults(4237);
14833 }
14834 else if (Main.curMusic == 51)
14835 {
14836 currentItem.SetDefaults(4356);
14837 }
14838 else if (Main.curMusic == 52)
14839 {
14840 currentItem.SetDefaults(4357);
14841 }
14842 else if (Main.curMusic == 53)
14843 {
14844 currentItem.SetDefaults(4358);
14845 }
14846 else if (Main.curMusic == 54)
14847 {
14848 currentItem.SetDefaults(4421);
14849 }
14850 else if (Main.curMusic == 55)
14851 {
14852 currentItem.SetDefaults(4606);
14853 }
14854 else if (Main.curMusic == 56)
14855 {
14856 currentItem.SetDefaults(4979);
14857 }
14858 else if (Main.curMusic == 57)
14859 {
14860 currentItem.SetDefaults(4985);
14861 }
14862 else if (Main.curMusic == 58)
14863 {
14864 currentItem.SetDefaults(4990);
14865 }
14866 else if (Main.curMusic == 59)
14867 {
14868 currentItem.SetDefaults(4991);
14869 }
14870 else if (Main.curMusic == 60)
14871 {
14872 currentItem.SetDefaults(4992);
14873 }
14874 else if (Main.curMusic == 61)
14875 {
14876 currentItem.SetDefaults(5006);
14877 }
14878 else if (Main.curMusic == 62)
14879 {
14880 currentItem.SetDefaults(5014);
14881 }
14882 else if (Main.curMusic == 63)
14883 {
14884 currentItem.SetDefaults(5015);
14885 }
14886 else if (Main.curMusic == 64)
14887 {
14888 currentItem.SetDefaults(5016);
14889 }
14890 else if (Main.curMusic == 65)
14891 {
14892 currentItem.SetDefaults(5017);
14893 }
14894 else if (Main.curMusic == 66)
14895 {
14896 currentItem.SetDefaults(5018);
14897 }
14898 else if (Main.curMusic == 67)
14899 {
14900 currentItem.SetDefaults(5019);
14901 }
14902 else if (Main.curMusic == 68)
14903 {
14904 currentItem.SetDefaults(5020);
14905 }
14906 else if (Main.curMusic == 69)
14907 {
14908 currentItem.SetDefaults(5021);
14909 }
14910 else if (Main.curMusic == 70)
14911 {
14912 currentItem.SetDefaults(5022);
14913 }
14914 else if (Main.curMusic == 71)
14915 {
14916 currentItem.SetDefaults(5023);
14917 }
14918 else if (Main.curMusic == 72)
14919 {
14920 currentItem.SetDefaults(5024);
14921 }
14922 else if (Main.curMusic == 73)
14923 {
14924 currentItem.SetDefaults(5025);
14925 }
14926 else if (Main.curMusic == 74)
14927 {
14928 currentItem.SetDefaults(5026);
14929 }
14930 else if (Main.curMusic == 75)
14931 {
14932 currentItem.SetDefaults(5027);
14933 }
14934 else if (Main.curMusic == 76)
14935 {
14936 currentItem.SetDefaults(5028);
14937 }
14938 else if (Main.curMusic == 77)
14939 {
14940 currentItem.SetDefaults(5029);
14941 }
14942 else if (Main.curMusic == 78)
14943 {
14944 currentItem.SetDefaults(5030);
14945 }
14946 else if (Main.curMusic == 79)
14947 {
14948 currentItem.SetDefaults(5031);
14949 }
14950 else if (Main.curMusic == 80)
14951 {
14952 currentItem.SetDefaults(5032);
14953 }
14954 else if (Main.curMusic == 81)
14955 {
14956 currentItem.SetDefaults(5033);
14957 }
14958 else if (Main.curMusic == 82)
14959 {
14960 currentItem.SetDefaults(5034);
14961 }
14962 else if (Main.curMusic == 83)
14963 {
14964 currentItem.SetDefaults(5035);
14965 }
14966 else if (Main.curMusic == 84)
14967 {
14968 currentItem.SetDefaults(5036);
14969 }
14970 else if (Main.curMusic == 85)
14971 {
14972 currentItem.SetDefaults(5037);
14973 }
14974 else if (Main.curMusic == 86)
14975 {
14976 currentItem.SetDefaults(5038);
14977 }
14978 else if (Main.curMusic == 87)
14979 {
14980 currentItem.SetDefaults(5039);
14981 }
14982 else if (Main.curMusic == 88)
14983 {
14984 currentItem.SetDefaults(5040);
14985 }
14986 else if (Main.curMusic == 89)
14987 {
14988 currentItem.SetDefaults(5044);
14989 }
14990 else if (Main.curMusic == 90)
14991 {
14992 currentItem.SetDefaults(5112);
14993 }
14994 else if (Main.curMusic == 91)
14995 {
14996 currentItem.SetDefaults(5362);
14997 }
14998 else if (Main.curMusic > 13)
14999 {
15000 currentItem.SetDefaults(1596 + Main.curMusic - 14);
15001 }
15002 else if (num3 != -1)
15003 {
15004 currentItem.SetDefaults(num3 + 562);
15005 }
15006 }
15007 ApplyMusicBox(currentItem);
15008 }
15009
15011 {
15012 beardGrowthTimer++;
15013 if (beardGrowthTimer >= 43200 && Main.rand.Next(540) == 0)
15014 {
15015 beardGrowthTimer = 0;
15016 short defaults = 5105;
15017 if (currentItem.type == 5105)
15018 {
15019 defaults = 5106;
15020 }
15022 currentItem.SetDefaults(defaults);
15023 }
15024 }
15025
15027 {
15028 if (currentItem.type >= 562 && currentItem.type <= 574)
15029 {
15030 Main.musicBox2 = currentItem.type - 562;
15031 }
15032 if (currentItem.type >= 1596 && currentItem.type <= 1609)
15033 {
15034 Main.musicBox2 = currentItem.type - 1596 + 13;
15035 }
15036 if (currentItem.type == 1610)
15037 {
15038 Main.musicBox2 = 27;
15039 }
15040 if (currentItem.type == 1963)
15041 {
15042 Main.musicBox2 = 28;
15043 }
15044 if (currentItem.type == 1964)
15045 {
15046 Main.musicBox2 = 29;
15047 }
15048 if (currentItem.type == 1965)
15049 {
15050 Main.musicBox2 = 30;
15051 }
15052 if (currentItem.type == 2742)
15053 {
15054 Main.musicBox2 = 31;
15055 }
15056 if (currentItem.type == 3044)
15057 {
15058 Main.musicBox2 = 32;
15059 }
15060 if (currentItem.type == 3235)
15061 {
15062 Main.musicBox2 = 33;
15063 }
15064 if (currentItem.type == 3236)
15065 {
15066 Main.musicBox2 = 34;
15067 }
15068 if (currentItem.type == 3237)
15069 {
15070 Main.musicBox2 = 35;
15071 }
15072 if (currentItem.type == 3370)
15073 {
15074 Main.musicBox2 = 36;
15075 }
15076 if (currentItem.type == 3371)
15077 {
15078 Main.musicBox2 = 37;
15079 }
15080 if (currentItem.type == 3796)
15081 {
15082 Main.musicBox2 = 38;
15083 }
15084 if (currentItem.type == 3869)
15085 {
15086 Main.musicBox2 = 39;
15087 }
15088 if (currentItem.type == 4082)
15089 {
15090 Main.musicBox2 = 40;
15091 }
15092 if (currentItem.type == 4078)
15093 {
15094 Main.musicBox2 = 41;
15095 }
15096 if (currentItem.type == 4079)
15097 {
15098 Main.musicBox2 = 42;
15099 }
15100 if (currentItem.type == 4077)
15101 {
15102 Main.musicBox2 = 43;
15103 }
15104 if (currentItem.type == 4080)
15105 {
15106 Main.musicBox2 = 44;
15107 }
15108 if (currentItem.type == 4081)
15109 {
15110 Main.musicBox2 = 45;
15111 }
15112 if (currentItem.type == 4237)
15113 {
15114 Main.musicBox2 = 46;
15115 }
15116 if (currentItem.type == 4356)
15117 {
15118 Main.musicBox2 = 47;
15119 }
15120 if (currentItem.type == 4357)
15121 {
15122 Main.musicBox2 = 48;
15123 }
15124 if (currentItem.type == 4358)
15125 {
15126 Main.musicBox2 = 49;
15127 }
15128 if (currentItem.type == 4421)
15129 {
15130 Main.musicBox2 = 50;
15131 }
15132 if (currentItem.type == 4606)
15133 {
15134 Main.musicBox2 = 51;
15135 }
15136 if (currentItem.type == 4979)
15137 {
15138 Main.musicBox2 = 52;
15139 }
15140 if (currentItem.type == 4985)
15141 {
15142 Main.musicBox2 = 53;
15143 }
15144 if (currentItem.type == 4990)
15145 {
15146 Main.musicBox2 = 54;
15147 }
15148 if (currentItem.type == 4991)
15149 {
15150 Main.musicBox2 = 55;
15151 }
15152 if (currentItem.type == 4992)
15153 {
15154 Main.musicBox2 = 56;
15155 }
15156 if (currentItem.type == 5006)
15157 {
15158 Main.musicBox2 = 57;
15159 }
15160 if (currentItem.type == 5014)
15161 {
15162 Main.musicBox2 = 58;
15163 }
15164 if (currentItem.type == 5015)
15165 {
15166 Main.musicBox2 = 59;
15167 }
15168 if (currentItem.type == 5016)
15169 {
15170 Main.musicBox2 = 60;
15171 }
15172 if (currentItem.type == 5017)
15173 {
15174 Main.musicBox2 = 61;
15175 }
15176 if (currentItem.type == 5018)
15177 {
15178 Main.musicBox2 = 62;
15179 }
15180 if (currentItem.type == 5019)
15181 {
15182 Main.musicBox2 = 63;
15183 }
15184 if (currentItem.type == 5020)
15185 {
15186 Main.musicBox2 = 64;
15187 }
15188 if (currentItem.type == 5021)
15189 {
15190 Main.musicBox2 = 65;
15191 }
15192 if (currentItem.type == 5022)
15193 {
15194 Main.musicBox2 = 66;
15195 }
15196 if (currentItem.type == 5023)
15197 {
15198 Main.musicBox2 = 67;
15199 }
15200 if (currentItem.type == 5024)
15201 {
15202 Main.musicBox2 = 68;
15203 }
15204 if (currentItem.type == 5025)
15205 {
15206 Main.musicBox2 = 69;
15207 }
15208 if (currentItem.type == 5026)
15209 {
15210 Main.musicBox2 = 70;
15211 }
15212 if (currentItem.type == 5027)
15213 {
15214 Main.musicBox2 = 71;
15215 }
15216 if (currentItem.type == 5028)
15217 {
15218 Main.musicBox2 = 72;
15219 }
15220 if (currentItem.type == 5029)
15221 {
15222 Main.musicBox2 = 73;
15223 }
15224 if (currentItem.type == 5030)
15225 {
15226 Main.musicBox2 = 74;
15227 }
15228 if (currentItem.type == 5031)
15229 {
15230 Main.musicBox2 = 75;
15231 }
15232 if (currentItem.type == 5032)
15233 {
15234 Main.musicBox2 = 76;
15235 }
15236 if (currentItem.type == 5033)
15237 {
15238 Main.musicBox2 = 77;
15239 }
15240 if (currentItem.type == 5034)
15241 {
15242 Main.musicBox2 = 78;
15243 }
15244 if (currentItem.type == 5035)
15245 {
15246 Main.musicBox2 = 79;
15247 }
15248 if (currentItem.type == 5036)
15249 {
15250 Main.musicBox2 = 80;
15251 }
15252 if (currentItem.type == 5037)
15253 {
15254 Main.musicBox2 = 81;
15255 }
15256 if (currentItem.type == 5038)
15257 {
15258 Main.musicBox2 = 82;
15259 }
15260 if (currentItem.type == 5039)
15261 {
15262 Main.musicBox2 = 83;
15263 }
15264 if (currentItem.type == 5040)
15265 {
15266 Main.musicBox2 = 84;
15267 }
15268 if (currentItem.type == 5044)
15269 {
15270 Main.musicBox2 = 85;
15271 }
15272 if (currentItem.type == 5112)
15273 {
15274 Main.musicBox2 = 86;
15275 }
15276 if (currentItem.type == 5362)
15277 {
15278 Main.musicBox2 = 87;
15279 }
15280 Main.musicBoxNotModifiedByVolume = Main.musicBox2;
15281 }
15282
15283 public void UpdateArmorSets(int i)
15284 {
15285 setBonus = "";
15286 if (body == 67 && legs == 56 && head >= 103 && head <= 105)
15287 {
15288 setBonus = Language.GetTextValue("ArmorSetBonus.Shroomite");
15289 shroomiteStealth = true;
15290 }
15291 if ((head == 52 && body == 32 && legs == 31) || (head == 53 && body == 33 && legs == 32) || (head == 54 && body == 34 && legs == 33) || (head == 55 && body == 35 && legs == 34) || (head == 71 && body == 47 && legs == 43) || (head == 166 && body == 173 && legs == 108) || (head == 167 && body == 174 && legs == 109))
15292 {
15293 setBonus = Language.GetTextValue("ArmorSetBonus.Wood");
15294 statDefense++;
15295 }
15296 if (head == 278 && body == 246 && legs == 234)
15297 {
15298 setBonus = Language.GetTextValue("ArmorSetBonus.AshWood");
15299 ashWoodBonus = true;
15300 }
15301 if ((head == 1 && body == 1 && legs == 1) || ((head == 72 || head == 2) && body == 2 && legs == 2) || (head == 47 && body == 28 && legs == 27))
15302 {
15303 setBonus = Language.GetTextValue("ArmorSetBonus.MetalTier1");
15304 statDefense += 2;
15305 }
15306 if ((head == 3 && body == 3 && legs == 3) || ((head == 73 || head == 4) && body == 4 && legs == 4) || (head == 48 && body == 29 && legs == 28) || (head == 49 && body == 30 && legs == 29))
15307 {
15308 setBonus = Language.GetTextValue("ArmorSetBonus.MetalTier2");
15309 statDefense += 3;
15310 }
15311 if (head == 50 && body == 31 && legs == 30)
15312 {
15313 setBonus = Language.GetTextValue("ArmorSetBonus.Platinum");
15314 statDefense += 4;
15315 }
15316 if (head == 112 && body == 75 && legs == 64)
15317 {
15318 setBonus = Language.GetTextValue("ArmorSetBonus.Pumpkin");
15319 meleeDamage += 0.1f;
15320 magicDamage += 0.1f;
15321 rangedDamage += 0.1f;
15322 minionDamage += 0.1f;
15323 }
15324 if (head == 180 && body == 182 && legs == 122)
15325 {
15326 setBonus = Language.GetTextValue("ArmorSetBonus.Gladiator");
15327 noKnockback = true;
15328 }
15329 if (head == 22 && body == 14 && legs == 14)
15330 {
15331 setBonus = Language.GetTextValue("ArmorSetBonus.Ninja");
15332 moveSpeed += 0.2f;
15333 }
15334 if (head == 188 && body == 189 && legs == 129)
15335 {
15336 setBonus = Language.GetTextValue("ArmorSetBonus.Fossil");
15337 ammoCost80 = true;
15338 }
15339 if ((head == 75 || head == 7) && body == 7 && legs == 7)
15340 {
15341 setBonus = Language.GetTextValue("ArmorSetBonus.Bone");
15342 rangedCrit += 10;
15343 }
15344 if (head == 157 && body == 105 && legs == 98)
15345 {
15346 int num = 0;
15347 setBonus = Language.GetTextValue("ArmorSetBonus.BeetleDamage");
15348 beetleOffense = true;
15349 beetleCounter -= 3f;
15350 beetleCounter -= beetleCountdown / 20;
15351 beetleCountdown++;
15352 if (beetleCounter < 0f)
15353 {
15354 beetleCounter = 0f;
15355 }
15356 int num2 = 400;
15357 int num3 = 1200;
15358 int num4 = 3600;
15359 if (beetleCounter > (float)(num2 + num3 + num4 + num3))
15360 {
15361 beetleCounter = num2 + num3 + num4 + num3;
15362 }
15363 if (beetleCounter > (float)(num2 + num3 + num4))
15364 {
15365 AddBuff(100, 5, quiet: false);
15366 num = 3;
15367 }
15368 else if (beetleCounter > (float)(num2 + num3))
15369 {
15370 AddBuff(99, 5, quiet: false);
15371 num = 2;
15372 }
15373 else if (beetleCounter > (float)num2)
15374 {
15375 AddBuff(98, 5, quiet: false);
15376 num = 1;
15377 }
15378 if (num < beetleOrbs)
15379 {
15380 beetleCountdown = 0;
15381 }
15382 else if (num > beetleOrbs)
15383 {
15384 beetleCounter += 200f;
15385 }
15386 if (num != beetleOrbs && beetleOrbs > 0)
15387 {
15388 for (int j = 0; j < maxBuffs; j++)
15389 {
15390 if (buffType[j] >= 98 && buffType[j] <= 100 && buffType[j] != 97 + num)
15391 {
15392 DelBuff(j);
15393 }
15394 }
15395 }
15396 }
15397 else if (head == 157 && body == 106 && legs == 98)
15398 {
15399 setBonus = Language.GetTextValue("ArmorSetBonus.BeetleDefense");
15400 beetleDefense = true;
15401 beetleCounter += 1f;
15402 int num5 = 180;
15403 if (beetleCounter >= (float)num5)
15404 {
15405 if (beetleOrbs > 0 && beetleOrbs < 3)
15406 {
15407 for (int k = 0; k < maxBuffs; k++)
15408 {
15409 if (buffType[k] >= 95 && buffType[k] <= 96)
15410 {
15411 DelBuff(k);
15412 }
15413 }
15414 }
15415 if (beetleOrbs < 3)
15416 {
15417 AddBuff(95 + beetleOrbs, 5, quiet: false);
15418 beetleCounter = 0f;
15419 }
15420 else
15421 {
15422 beetleCounter = num5;
15423 }
15424 }
15425 }
15426 if (!beetleDefense && !beetleOffense)
15427 {
15428 beetleCounter = 0f;
15429 }
15430 else
15431 {
15432 beetleFrameCounter++;
15433 if (beetleFrameCounter >= 1)
15434 {
15435 beetleFrameCounter = 0;
15436 beetleFrame++;
15437 if (beetleFrame > 2)
15438 {
15439 beetleFrame = 0;
15440 }
15441 }
15442 for (int l = beetleOrbs; l < 3; l++)
15443 {
15444 beetlePos[l].X = 0f;
15445 beetlePos[l].Y = 0f;
15446 }
15447 for (int m = 0; m < beetleOrbs; m++)
15448 {
15449 beetlePos[m] += beetleVel[m];
15450 beetleVel[m].X += (float)Main.rand.Next(-100, 101) * 0.005f;
15451 beetleVel[m].Y += (float)Main.rand.Next(-100, 101) * 0.005f;
15452 float x = beetlePos[m].X;
15453 float y = beetlePos[m].Y;
15454 float num6 = (float)Math.Sqrt(x * x + y * y);
15455 if (num6 > 100f)
15456 {
15457 num6 = 20f / num6;
15458 x *= 0f - num6;
15459 y *= 0f - num6;
15460 int num7 = 10;
15461 beetleVel[m].X = (beetleVel[m].X * (float)(num7 - 1) + x) / (float)num7;
15462 beetleVel[m].Y = (beetleVel[m].Y * (float)(num7 - 1) + y) / (float)num7;
15463 }
15464 else if (num6 > 30f)
15465 {
15466 num6 = 10f / num6;
15467 x *= 0f - num6;
15468 y *= 0f - num6;
15469 int num8 = 20;
15470 beetleVel[m].X = (beetleVel[m].X * (float)(num8 - 1) + x) / (float)num8;
15471 beetleVel[m].Y = (beetleVel[m].Y * (float)(num8 - 1) + y) / (float)num8;
15472 }
15473 x = beetleVel[m].X;
15474 y = beetleVel[m].Y;
15475 num6 = (float)Math.Sqrt(x * x + y * y);
15476 if (num6 > 2f)
15477 {
15478 beetleVel[m] *= 0.9f;
15479 }
15480 beetlePos[m] -= velocity * 0.25f;
15481 }
15482 }
15483 if (head == 14 && ((body >= 58 && body <= 63) || body == 167 || body == 213))
15484 {
15485 setBonus = Language.GetTextValue("ArmorSetBonus.Wizard");
15486 magicCrit += 10;
15487 }
15488 if (head == 159 && ((body >= 58 && body <= 63) || body == 167 || body == 213))
15489 {
15490 setBonus = Language.GetTextValue("ArmorSetBonus.MagicHat");
15491 statManaMax2 += 60;
15492 }
15493 if ((head == 5 || head == 74) && (body == 5 || body == 48) && (legs == 5 || legs == 44))
15494 {
15495 setBonus = Language.GetTextValue("ArmorSetBonus.ShadowScale");
15496 shadowArmor = true;
15497 }
15498 if (head == 57 && body == 37 && legs == 35)
15499 {
15500 setBonus = Language.GetTextValue("ArmorSetBonus.Crimson");
15501 crimsonRegen = true;
15502 }
15503 if (head == 101 && body == 66 && legs == 55)
15504 {
15505 setBonus = Language.GetTextValue("ArmorSetBonus.SpectreHealing");
15506 ghostHeal = true;
15507 magicDamage -= 0.4f;
15508 }
15509 if (head == 156 && body == 66 && legs == 55)
15510 {
15511 setBonus = Language.GetTextValue("ArmorSetBonus.SpectreDamage");
15512 ghostHurt = true;
15513 }
15514 if (head == 6 && body == 6 && legs == 6)
15515 {
15516 setBonus = Language.GetTextValue("ArmorSetBonus.Meteor");
15517 spaceGun = true;
15518 }
15519 if (head == 46 && body == 27 && legs == 26)
15520 {
15521 setBonus = Language.GetTextValue("ArmorSetBonus.Frost");
15522 frostBurn = true;
15523 meleeDamage += 0.1f;
15524 rangedDamage += 0.1f;
15525 }
15526 if ((head == 76 || head == 8) && (body == 49 || body == 8) && (legs == 45 || legs == 8))
15527 {
15528 setBonus = Language.GetTextValue("ArmorSetBonus.Jungle");
15529 manaCost -= 0.16f;
15530 }
15531 if (head == 9 && body == 9 && legs == 9)
15532 {
15533 setBonus = Language.GetTextValue("ArmorSetBonus.Molten");
15534 meleeDamage += 0.1f;
15535 buffImmune[24] = true;
15536 }
15537 if ((head == 58 || head == 77) && (body == 38 || body == 50) && (legs == 36 || legs == 46))
15538 {
15539 setBonus = Language.GetTextValue("ArmorSetBonus.Snow");
15540 buffImmune[46] = true;
15541 buffImmune[47] = true;
15542 }
15543 if (head == 11 && body == 20 && legs == 19)
15544 {
15545 setBonus = Language.GetTextValue("ArmorSetBonus.Mining");
15546 pickSpeed -= 0.1f;
15547 }
15548 if (head == 216 && body == 20 && legs == 19)
15549 {
15550 setBonus = Language.GetTextValue("ArmorSetBonus.Mining");
15551 pickSpeed -= 0.1f;
15552 }
15553 if (head == 78 && body == 51 && legs == 47)
15554 {
15555 setBonus = Language.GetTextValue("ArmorSetBonus.ChlorophyteMelee");
15556 AddBuff(60, 18000);
15557 endurance += 0.05f;
15558 }
15559 else if ((head == 80 || head == 79) && body == 51 && legs == 47)
15560 {
15561 setBonus = Language.GetTextValue("ArmorSetBonus.Chlorophyte");
15562 AddBuff(60, 18000);
15563 }
15564 else if (crystalLeaf)
15565 {
15566 for (int n = 0; n < maxBuffs; n++)
15567 {
15568 if (buffType[n] == 60)
15569 {
15570 DelBuff(n);
15571 }
15572 }
15573 }
15574 if (head == 161 && body == 169 && legs == 104)
15575 {
15576 setBonus = Language.GetTextValue("ArmorSetBonus.Angler");
15577 anglerSetSpawnReduction = true;
15578 }
15579 if (head == 70 && body == 46 && legs == 42)
15580 {
15581 setBonus = Language.GetTextValue("ArmorSetBonus.Cactus");
15582 cactusThorns = true;
15583 }
15584 if (head == 99 && body == 65 && legs == 54)
15585 {
15586 setBonus = Language.GetTextValue("ArmorSetBonus.Turtle");
15587 endurance += 0.15f;
15588 thorns = 1f;
15589 turtleThorns = true;
15590 }
15591 if (body == 17 && legs == 16)
15592 {
15593 if (head == 29)
15594 {
15595 setBonus = Language.GetTextValue("ArmorSetBonus.CobaltCaster");
15596 manaCost -= 0.14f;
15597 }
15598 else if (head == 30)
15599 {
15600 setBonus = Language.GetTextValue("ArmorSetBonus.CobaltMelee");
15601 meleeSpeed += 0.15f;
15602 }
15603 else if (head == 31)
15604 {
15605 setBonus = Language.GetTextValue("ArmorSetBonus.CobaltRanged");
15606 ammoCost80 = true;
15607 }
15608 }
15609 if (body == 18 && legs == 17)
15610 {
15611 if (head == 32)
15612 {
15613 setBonus = Language.GetTextValue("ArmorSetBonus.MythrilCaster");
15614 manaCost -= 0.17f;
15615 }
15616 else if (head == 33)
15617 {
15618 setBonus = Language.GetTextValue("ArmorSetBonus.MythrilMelee");
15619 meleeCrit += 10;
15620 }
15621 else if (head == 34)
15622 {
15623 setBonus = Language.GetTextValue("ArmorSetBonus.MythrilRanged");
15624 ammoCost80 = true;
15625 }
15626 }
15627 if (body == 19 && legs == 18)
15628 {
15629 if (head == 35)
15630 {
15631 setBonus = Language.GetTextValue("ArmorSetBonus.AdamantiteCaster");
15632 manaCost -= 0.19f;
15633 }
15634 else if (head == 36)
15635 {
15636 setBonus = Language.GetTextValue("ArmorSetBonus.AdamantiteMelee");
15637 meleeSpeed += 0.2f;
15638 moveSpeed += 0.2f;
15639 }
15640 else if (head == 37)
15641 {
15642 setBonus = Language.GetTextValue("ArmorSetBonus.AdamantiteRanged");
15643 ammoCost75 = true;
15644 }
15645 }
15646 if (body == 54 && legs == 49 && (head == 83 || head == 84 || head == 85))
15647 {
15648 setBonus = Language.GetTextValue("ArmorSetBonus.Palladium");
15649 onHitRegen = true;
15650 }
15651 if (body == 55 && legs == 50 && (head == 86 || head == 87 || head == 88))
15652 {
15653 setBonus = Language.GetTextValue("ArmorSetBonus.Orichalcum");
15654 onHitPetal = true;
15655 }
15656 if (body == 56 && legs == 51)
15657 {
15658 bool flag = false;
15659 if (head == 91)
15660 {
15661 setBonus = Language.GetTextValue("ArmorSetBonus.Titanium");
15662 flag = true;
15663 }
15664 else if (head == 89)
15665 {
15666 setBonus = Language.GetTextValue("ArmorSetBonus.Titanium");
15667 flag = true;
15668 }
15669 else if (head == 90)
15670 {
15671 setBonus = Language.GetTextValue("ArmorSetBonus.Titanium");
15672 flag = true;
15673 }
15674 if (flag)
15675 {
15676 onHitTitaniumStorm = true;
15677 }
15678 }
15679 if ((body == 24 || body == 229) && (legs == 23 || legs == 212) && (head == 42 || head == 41 || head == 43 || head == 254 || head == 257 || head == 256 || head == 255 || head == 258))
15680 {
15681 if (head == 254 || head == 258)
15682 {
15683 setBonus = Language.GetTextValue("ArmorSetBonus.HallowedSummoner");
15684 maxMinions += 2;
15685 }
15686 else
15687 {
15688 setBonus = Language.GetTextValue("ArmorSetBonus.Hallowed");
15689 }
15690 onHitDodge = true;
15691 }
15692 if (head == 261 && body == 230 && legs == 213)
15693 {
15694 setBonus = Language.GetTextValue("ArmorSetBonus.CrystalNinja");
15695 rangedDamage += 0.1f;
15696 meleeDamage += 0.1f;
15697 magicDamage += 0.1f;
15698 minionDamage += 0.1f;
15699 rangedCrit += 10;
15700 meleeCrit += 10;
15701 magicCrit += 10;
15702 dashType = 5;
15703 }
15704 if (head == 82 && body == 53 && legs == 48)
15705 {
15706 setBonus = Language.GetTextValue("ArmorSetBonus.Tiki");
15707 maxMinions++;
15708 whipRangeMultiplier += 0.2f;
15709 }
15710 if (head == 134 && body == 95 && legs == 79)
15711 {
15712 setBonus = Language.GetTextValue("ArmorSetBonus.Spooky");
15713 minionDamage += 0.25f;
15714 }
15715 if (head == 160 && body == 168 && legs == 103)
15716 {
15717 setBonus = Language.GetTextValue("ArmorSetBonus.Bee");
15718 minionDamage += 0.1f;
15719 if (itemAnimation > 0 && inventory[selectedItem].type == 1121)
15720 {
15722 }
15723 }
15724 if (head == 162 && body == 170 && legs == 105)
15725 {
15726 setBonus = Language.GetTextValue("ArmorSetBonus.Spider");
15727 minionDamage += 0.12f;
15728 }
15729 if (head == 171 && body == 177 && legs == 112)
15730 {
15731 endurance += 0.12f;
15732 setSolar = true;
15733 setBonus = Language.GetTextValue("ArmorSetBonus.Solar");
15734 solarCounter++;
15735 int num9 = 180;
15736 if (solarCounter >= num9)
15737 {
15738 if (solarShields > 0 && solarShields < 3)
15739 {
15740 for (int num10 = 0; num10 < maxBuffs; num10++)
15741 {
15742 if (buffType[num10] >= 170 && buffType[num10] <= 171)
15743 {
15744 DelBuff(num10);
15745 }
15746 }
15747 }
15748 if (solarShields < 3)
15749 {
15750 AddBuff(170 + solarShields, 5, quiet: false);
15751 for (int num11 = 0; num11 < 16; num11++)
15752 {
15753 Dust obj = Main.dust[Dust.NewDust(position, width, height, 6, 0f, 0f, 100)];
15754 obj.noGravity = true;
15755 obj.scale = 1.7f;
15756 obj.fadeIn = 0.5f;
15757 obj.velocity *= 5f;
15758 obj.shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
15759 }
15760 solarCounter = 0;
15761 }
15762 else
15763 {
15764 solarCounter = num9;
15765 }
15766 }
15767 for (int num12 = solarShields; num12 < 3; num12++)
15768 {
15769 solarShieldPos[num12] = Vector2.Zero;
15770 }
15771 for (int num13 = 0; num13 < solarShields; num13++)
15772 {
15773 solarShieldPos[num13] += solarShieldVel[num13];
15774 Vector2 vector = ((float)miscCounter / 100f * ((float)Math.PI * 2f) + (float)num13 * ((float)Math.PI * 2f / (float)solarShields)).ToRotationVector2() * 6f;
15775 vector.X = direction * 20;
15776 if (mount.Active && mount.Type == 52)
15777 {
15778 vector.X = direction * 50;
15779 }
15780 solarShieldVel[num13] = (vector - solarShieldPos[num13]) * 0.2f;
15781 }
15782 if (dashDelay >= 0)
15783 {
15784 solarDashing = false;
15785 solarDashConsumedFlare = false;
15786 }
15787 bool flag2 = solarDashing && dashDelay < 0;
15788 if (solarShields > 0 || flag2)
15789 {
15790 dashType = 3;
15791 }
15792 }
15793 else
15794 {
15795 solarCounter = 0;
15796 }
15797 if (head == 169 && body == 175 && legs == 110)
15798 {
15799 setVortex = true;
15800 setBonus = Language.GetTextValue("ArmorSetBonus.Vortex", Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN"));
15801 }
15802 else
15803 {
15804 vortexStealthActive = false;
15805 }
15806 if (head == 170 && body == 176 && legs == 111)
15807 {
15808 if (nebulaCD > 0)
15809 {
15810 nebulaCD--;
15811 }
15812 setNebula = true;
15813 setBonus = Language.GetTextValue("ArmorSetBonus.Nebula");
15814 }
15815 if (head == 189 && body == 190 && legs == 130)
15816 {
15817 setBonus = Language.GetTextValue("ArmorSetBonus.Stardust", Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN"));
15818 setStardust = true;
15819 if (whoAmI == Main.myPlayer)
15820 {
15821 if (FindBuffIndex(187) == -1)
15822 {
15823 AddBuff(187, 3600);
15824 }
15825 if (ownedProjectileCounts[623] < 1)
15826 {
15827 int num14 = 10;
15828 int num15 = 30;
15829 int num16 = Projectile.NewProjectile(GetProjectileSource_SetBonus(7), base.Center.X, base.Center.Y, 0f, -1f, 623, num15, num14, Main.myPlayer);
15830 Main.projectile[num16].originalDamage = num15;
15831 }
15832 }
15833 }
15834 else if (FindBuffIndex(187) != -1)
15835 {
15836 DelBuff(FindBuffIndex(187));
15837 }
15838 if (head == 200 && body == 198 && legs == 142)
15839 {
15840 setBonus = Language.GetTextValue("ArmorSetBonus.Forbidden", Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN"));
15841 setForbidden = true;
15842 UpdateForbiddenSetLock();
15843 Lighting.AddLight(base.Center, 0.8f, 0.7f, 0.2f);
15844 }
15845 if (head == 204 && body == 201 && legs == 145)
15846 {
15847 setBonus = Language.GetTextValue("ArmorSetBonus.SquireTier2");
15848 setSquireT2 = true;
15849 maxTurrets++;
15850 }
15851 if (head == 203 && body == 200 && legs == 144)
15852 {
15853 setBonus = Language.GetTextValue("ArmorSetBonus.ApprenticeTier2");
15854 setApprenticeT2 = true;
15855 maxTurrets++;
15856 }
15857 if (head == 205 && body == 202 && (legs == 147 || legs == 146))
15858 {
15859 setBonus = Language.GetTextValue("ArmorSetBonus.HuntressTier2");
15860 setHuntressT2 = true;
15861 maxTurrets++;
15862 }
15863 if (head == 206 && body == 203 && legs == 148)
15864 {
15865 setBonus = Language.GetTextValue("ArmorSetBonus.MonkTier2");
15866 setMonkT2 = true;
15867 maxTurrets++;
15868 }
15869 if (head == 210 && body == 204 && legs == 152)
15870 {
15871 setBonus = Language.GetTextValue("ArmorSetBonus.SquireTier3");
15872 setSquireT3 = true;
15873 setSquireT2 = true;
15874 maxTurrets++;
15875 }
15876 if (head == 211 && body == 205 && legs == 153)
15877 {
15878 setBonus = Language.GetTextValue("ArmorSetBonus.ApprenticeTier3");
15879 setApprenticeT3 = true;
15880 setApprenticeT2 = true;
15881 maxTurrets++;
15882 }
15883 if (head == 212 && body == 206 && (legs == 154 || legs == 155))
15884 {
15885 setBonus = Language.GetTextValue("ArmorSetBonus.HuntressTier3");
15886 setHuntressT3 = true;
15887 setHuntressT2 = true;
15888 maxTurrets++;
15889 }
15890 if (head == 213 && body == 207 && legs == 156)
15891 {
15892 setBonus = Language.GetTextValue("ArmorSetBonus.MonkTier3");
15893 setMonkT3 = true;
15894 setMonkT2 = true;
15895 maxTurrets++;
15896 }
15897 if (head == 185 && body == 187 && legs == 127)
15898 {
15899 setBonus = Language.GetTextValue("ArmorSetBonus.ObsidianOutlaw");
15900 minionDamage += 0.15f;
15901 whipRangeMultiplier += 0.3f;
15902 float num17 = 1.15f;
15903 float num18 = 1f / num17;
15904 whipUseTimeMultiplier *= num18;
15905 }
15906 ApplyArmorSoundAndDustChanges();
15907 }
15908
15910 {
15911 for (int num = 2; num > 0; num--)
15912 {
15913 shadowDirection[num] = shadowDirection[num - 1];
15914 }
15915 shadowDirection[0] = direction;
15916 shadowCount++;
15917 if (shadowCount == 1)
15918 {
15919 shadowPos[2] = shadowPos[1];
15920 shadowRotation[2] = shadowRotation[1];
15921 shadowOrigin[2] = shadowOrigin[1];
15922 }
15923 else if (shadowCount == 2)
15924 {
15925 shadowPos[1] = shadowPos[0];
15926 shadowRotation[1] = shadowRotation[0];
15927 shadowOrigin[1] = shadowOrigin[0];
15928 }
15929 else if (shadowCount >= 3)
15930 {
15931 shadowCount = 0;
15932 shadowPos[0] = position;
15933 shadowPos[0].Y += gfxOffY;
15934 shadowRotation[0] = fullRotation;
15935 shadowOrigin[0] = fullRotationOrigin;
15936 }
15937 }
15938
15940 {
15941 if (!(teleportTime > 0f))
15942 {
15943 return;
15944 }
15945 if (teleportStyle == 0)
15946 {
15947 if ((float)Main.rand.Next(100) <= 100f * teleportTime * 2f)
15948 {
15949 int num = Dust.NewDust(new Vector2(getRect().X, getRect().Y), getRect().Width, getRect().Height, 159);
15950 Main.dust[num].scale = teleportTime * 1.5f;
15951 Main.dust[num].noGravity = true;
15952 Main.dust[num].velocity *= 1.1f;
15953 }
15954 }
15955 else if (teleportStyle == 1)
15956 {
15957 if ((float)Main.rand.Next(100) <= 100f * teleportTime)
15958 {
15959 int num2 = Dust.NewDust(new Vector2(getRect().X, getRect().Y), getRect().Width, getRect().Height, 164);
15960 Main.dust[num2].scale = teleportTime * 1.5f;
15961 Main.dust[num2].noGravity = true;
15962 Main.dust[num2].velocity *= 1.1f;
15963 }
15964 }
15965 else if (teleportStyle == 2)
15966 {
15967 teleportTime = 0.005f;
15968 }
15969 else if (teleportStyle == 3)
15970 {
15971 teleportTime = 0.005f;
15972 }
15973 else if (teleportStyle == 4)
15974 {
15975 teleportTime -= 0.02f;
15976 if ((float)Main.rand.Next(100) <= 100f * teleportTime)
15977 {
15978 Dust obj = Main.dust[Dust.NewDust(position, width, height, 263)];
15979 obj.color = PortalHelper.GetPortalColor(lastPortalColorIndex);
15980 obj.noLight = true;
15981 obj.noGravity = true;
15982 obj.scale = 1.2f;
15983 obj.fadeIn = 0.4f;
15984 }
15985 }
15986 else if (teleportStyle == 9)
15987 {
15988 Rectangle hitbox = base.Hitbox;
15989 hitbox.Inflate(5, 5);
15990 if ((float)Main.rand.Next(100) <= 100f * teleportTime)
15991 {
15992 TeleportPylonsSystem.SpawnInWorldDust(lastTeleportPylonStyleUsed, hitbox);
15993 }
15994 }
15995 teleportTime -= 0.005f;
15996 }
15997
15998 private void UpdateGraveyard(bool now = false)
15999 {
16001 if (now)
16002 {
16003 graveImmediateTime = 30;
16004 }
16005 if (graveImmediateTime > 0)
16006 {
16007 graveImmediateTime--;
16008 Main.GraveyardVisualIntensity = lerpValue;
16009 }
16011 {
16012 Main.GraveyardVisualIntensity += 0.02f;
16014 {
16015 Main.GraveyardVisualIntensity = lerpValue;
16016 }
16017 }
16019 {
16020 Main.GraveyardVisualIntensity -= 0.01f;
16022 {
16023 Main.GraveyardVisualIntensity = lerpValue;
16024 }
16025 }
16026 }
16027
16028 public void ForceUpdateBiomes()
16029 {
16030 if (whoAmI == Main.myPlayer)
16031 {
16032 Main.GetAreaToLight(out var firstTileX, out var lastTileX, out var firstTileY, out var lastTileY);
16033 Rectangle value = new Rectangle(firstTileX, firstTileY, lastTileX - firstTileX, lastTileY - firstTileY);
16034 int num = 28;
16035 value.Inflate(num, num);
16036 Main.SceneMetrics.ScanAndExportToMain(new SceneMetricsScanSettings
16037 {
16038 VisualScanArea = value,
16039 BiomeScanCenterPositionInWorld = base.Center,
16040 ScanOreFinderData = accOreFinder
16041 });
16042 UpdateBiomes();
16043 }
16044 }
16045
16047 {
16048 if (Main.SceneMetrics.ShimmerMonolithState == 2)
16049 {
16050 return false;
16051 }
16052 if (ZoneShimmer)
16053 {
16054 return true;
16055 }
16056 if (shimmerMonolithShader || Main.SceneMetrics.ShimmerMonolithState == 1)
16057 {
16058 return true;
16059 }
16060 if (!((double)(Main.screenPosition.Y / 16f) > Main.worldSurface + 50.0) || !(Main.screenPosition.Y / 16f < (float)(Main.maxTilesY - 330 - 100)))
16061 {
16062 return false;
16063 }
16064 return shimmering;
16065 }
16066
16067 public void UpdateBiomes()
16068 {
16069 //IL_11ac: Unknown result type (might be due to invalid IL or missing references)
16070 //IL_11b6: Unknown result type (might be due to invalid IL or missing references)
16071 //IL_11c9: Unknown result type (might be due to invalid IL or missing references)
16072 //IL_11ce: Unknown result type (might be due to invalid IL or missing references)
16073 //IL_1255: Unknown result type (might be due to invalid IL or missing references)
16074 //IL_1261: Unknown result type (might be due to invalid IL or missing references)
16075 //IL_11e6: Unknown result type (might be due to invalid IL or missing references)
16076 //IL_11f1: Unknown result type (might be due to invalid IL or missing references)
16077 //IL_11dc: Unknown result type (might be due to invalid IL or missing references)
16078 //IL_11e1: Unknown result type (might be due to invalid IL or missing references)
16079 //IL_12ef: Unknown result type (might be due to invalid IL or missing references)
16080 //IL_12f4: Unknown result type (might be due to invalid IL or missing references)
16081 //IL_1282: Unknown result type (might be due to invalid IL or missing references)
16082 //IL_1287: Unknown result type (might be due to invalid IL or missing references)
16083 //IL_128c: Unknown result type (might be due to invalid IL or missing references)
16084 //IL_12b0: Unknown result type (might be due to invalid IL or missing references)
16085 //IL_12b5: Unknown result type (might be due to invalid IL or missing references)
16086 //IL_12ba: Unknown result type (might be due to invalid IL or missing references)
16087 //IL_130b: Unknown result type (might be due to invalid IL or missing references)
16088 //IL_1310: Unknown result type (might be due to invalid IL or missing references)
16089 Point point = base.Center.ToTileCoordinates();
16090 ZoneDungeon = false;
16091 if (Main.SceneMetrics.DungeonTileCount >= 250 && (double)base.Center.Y > Main.worldSurface * 16.0)
16092 {
16093 int num = (int)base.Center.X / 16;
16094 int num2 = (int)base.Center.Y / 16;
16095 if (Main.tile[num, num2] != null && Main.wallDungeon[Main.tile[num, num2].wall])
16096 {
16097 ZoneDungeon = true;
16098 }
16099 }
16100 ZoneLihzhardTemple = false;
16101 int num3 = (int)base.Center.X / 16;
16102 int num4 = (int)base.Center.Y / 16;
16103 if (Main.tile[num3, num4] != null && Main.tile[num3, num4].wall == 87)
16104 {
16105 ZoneLihzhardTemple = true;
16106 }
16108 if (tileSafely != null)
16109 {
16110 behindBackWall = tileSafely.wall > 0;
16111 }
16112 if (behindBackWall && ZoneDesert && (double)base.Center.Y > Main.worldSurface)
16113 {
16115 {
16116 ZoneUndergroundDesert = true;
16117 }
16118 }
16119 else
16120 {
16121 ZoneUndergroundDesert = false;
16122 }
16123 if (behindBackWall && (tileSafely.wall == 184 || tileSafely.wall == 180))
16124 {
16125 ZoneGranite = true;
16126 }
16127 else
16128 {
16129 ZoneGranite = false;
16130 }
16131 if (behindBackWall && (tileSafely.wall == 183 || tileSafely.wall == 178))
16132 {
16133 ZoneMarble = true;
16134 }
16135 else
16136 {
16137 ZoneMarble = false;
16138 }
16139 if (behindBackWall && (tileSafely.wall == 108 || tileSafely.wall == 86))
16140 {
16141 ZoneHive = true;
16142 }
16143 else
16144 {
16145 ZoneHive = false;
16146 }
16147 if (behindBackWall && tileSafely.wall >= 48 && tileSafely.wall <= 53)
16148 {
16149 ZoneGemCave = true;
16150 }
16151 else
16152 {
16153 ZoneGemCave = false;
16154 }
16155 bool flag = (double)(Main.screenPosition.Y / 16f) > Main.worldSurface + 50.0 && Main.screenPosition.Y / 16f < (float)(Main.maxTilesY - 330 - 100);
16156 ZoneShimmer = Main.SceneMetrics.EnoughTilesForShimmer && flag;
16157 ZoneCorrupt = Main.SceneMetrics.EnoughTilesForCorruption;
16158 ZoneCrimson = Main.SceneMetrics.EnoughTilesForCrimson;
16159 ZoneHallow = Main.SceneMetrics.EnoughTilesForHallow;
16160 ZoneJungle = Main.SceneMetrics.EnoughTilesForJungle && position.Y / 16f < (float)Main.UnderworldLayer;
16161 ZoneSnow = Main.SceneMetrics.EnoughTilesForSnow;
16162 ZoneDesert = Main.SceneMetrics.EnoughTilesForDesert;
16163 ZoneGlowshroom = Main.SceneMetrics.EnoughTilesForGlowingMushroom;
16164 ZoneMeteor = Main.SceneMetrics.EnoughTilesForMeteor;
16165 ZoneWaterCandle = Main.SceneMetrics.WaterCandleCount > 0;
16166 ZonePeaceCandle = Main.SceneMetrics.PeaceCandleCount > 0;
16167 ZoneShadowCandle = Main.SceneMetrics.ShadowCandleCount > 0;
16168 ZoneGraveyard = Main.SceneMetrics.EnoughTilesForGraveyard;
16169 UpdateGraveyard();
16170 if (HasGardenGnomeNearby != Main.SceneMetrics.HasGardenGnome)
16171 {
16172 luckNeedsSync = true;
16173 HasGardenGnomeNearby = Main.SceneMetrics.HasGardenGnome;
16174 }
16175 ZoneUnderworldHeight = point.Y > Main.UnderworldLayer;
16176 ZoneRockLayerHeight = point.Y <= Main.UnderworldLayer && (double)point.Y > Main.rockLayer;
16177 ZoneDirtLayerHeight = (double)point.Y <= Main.rockLayer && (double)point.Y > Main.worldSurface;
16178 ZoneOverworldHeight = (double)point.Y <= Main.worldSurface && (double)point.Y > Main.worldSurface * 0.3499999940395355;
16179 ZoneSkyHeight = (double)point.Y <= Main.worldSurface * 0.3499999940395355;
16180 ZoneBeach = WorldGen.oceanDepths(point.X, point.Y);
16181 ZoneRain = Main.raining && (double)point.Y <= Main.worldSurface;
16182 if (Main.remixWorld)
16183 {
16184 ZoneSandstorm = (double)point.Y >= Main.rockLayer && ZoneDesert && !ZoneBeach && Sandstorm.Happening;
16185 }
16186 else
16187 {
16188 ZoneSandstorm = (double)point.Y <= Main.worldSurface && ZoneDesert && !ZoneBeach && Sandstorm.Happening;
16189 }
16190 bool flag3 = (ZoneTowerStardust = false);
16191 bool flag5 = (ZoneTowerNebula = flag3);
16192 bool zoneTowerSolar = (ZoneTowerVortex = flag5);
16193 ZoneTowerSolar = zoneTowerSolar;
16194 ZoneOldOneArmy = false;
16199 _ = Vector2.Zero;
16200 for (int i = 0; i < 200; i++)
16201 {
16202 if (!Main.npc[i].active)
16203 {
16204 continue;
16205 }
16206 if (Main.npc[i].type == 493)
16207 {
16208 if (Distance(Main.npc[i].Center) <= 4000f)
16209 {
16210 ZoneTowerStardust = true;
16211 vector4 = Main.npc[i].Center;
16212 }
16213 }
16214 else if (Main.npc[i].type == 507)
16215 {
16216 if (Distance(Main.npc[i].Center) <= 4000f)
16217 {
16218 ZoneTowerNebula = true;
16219 vector3 = Main.npc[i].Center;
16220 }
16221 }
16222 else if (Main.npc[i].type == 422)
16223 {
16224 if (Distance(Main.npc[i].Center) <= 4000f)
16225 {
16226 ZoneTowerVortex = true;
16227 vector2 = Main.npc[i].Center;
16228 }
16229 }
16230 else if (Main.npc[i].type == 517)
16231 {
16232 if (Distance(Main.npc[i].Center) <= 4000f)
16233 {
16234 ZoneTowerSolar = true;
16235 vector = Main.npc[i].Center;
16236 }
16237 }
16238 else if (Main.npc[i].type == 549 && Distance(Main.npc[i].Center) <= 4000f)
16239 {
16240 ZoneOldOneArmy = true;
16241 vector = Main.npc[i].Center;
16242 }
16243 }
16244 float num5 = 1f;
16245 float num6 = 1f;
16246 float num7 = Main.shimmerAlpha;
16247 if (CanSeeShimmerEffects())
16248 {
16249 num5 *= 1f;
16250 num6 *= 0.7f;
16251 if (num7 < 1f)
16252 {
16253 num7 += 0.025f;
16254 if (num7 > 1f)
16255 {
16256 num7 = 1f;
16257 }
16258 }
16259 if (num7 >= 0.5f)
16260 {
16261 Main.shimmerDarken = MathHelper.Clamp(Main.shimmerDarken + 0.025f, 0f, 1f);
16262 Main.shimmerBrightenDelay = 4f;
16263 }
16264 }
16265 else if (num7 > 0f)
16266 {
16267 Main.shimmerDarken = MathHelper.Clamp(Main.shimmerDarken - 0.05f, 0f, 1f);
16268 if (Main.shimmerDarken == 0f && Main.shimmerBrightenDelay > 0f)
16269 {
16270 Main.shimmerBrightenDelay -= 1f;
16271 }
16272 if (Main.shimmerBrightenDelay == 0f)
16273 {
16274 num7 -= 0.05f;
16275 }
16276 if (num7 < 0f)
16277 {
16278 num7 = 0f;
16279 }
16280 }
16281 Main.shimmerAlpha = num7;
16282 if (Main.getGoodWorld)
16283 {
16284 bool flag7 = false;
16285 int num8 = NPC.FindFirstNPC(245);
16286 if (num8 >= 0 && Vector2.Distance(base.Center, Main.npc[num8].Center) < 2000f)
16287 {
16288 flag7 = true;
16289 }
16290 if (flag7)
16291 {
16292 num5 *= 0.6f;
16293 num6 *= 0.6f;
16294 }
16295 else if (ZoneLihzhardTemple)
16296 {
16297 num5 *= 0.88f;
16298 num6 *= 0.88f;
16299 }
16300 else if (ZoneDungeon)
16301 {
16302 num5 *= 0.94f;
16303 num6 *= 0.94f;
16304 }
16305 }
16306 if (num5 != airLightDecay)
16307 {
16308 if (airLightDecay >= num5)
16309 {
16310 airLightDecay -= 0.005f;
16311 if (airLightDecay < num5)
16312 {
16313 airLightDecay = num5;
16314 }
16315 }
16316 else
16317 {
16318 airLightDecay += 0.005f;
16319 if (airLightDecay > num5)
16320 {
16321 airLightDecay = num5;
16322 }
16323 }
16324 }
16325 if (num6 != solidLightDecay)
16326 {
16327 if (solidLightDecay >= num6)
16328 {
16329 solidLightDecay -= 0.005f;
16330 if (solidLightDecay < num6)
16331 {
16332 solidLightDecay = num6;
16333 }
16334 }
16335 else
16336 {
16337 solidLightDecay += 0.005f;
16338 if (solidLightDecay > num6)
16339 {
16340 solidLightDecay = num6;
16341 }
16342 }
16343 }
16344 bool flag8 = ZoneRain && ZoneSnow;
16345 if (Main.remixWorld)
16346 {
16347 flag8 = (double)(position.Y / 16f) > Main.worldSurface && Main.raining && ZoneSnow;
16348 }
16349 bool flag9 = point.Y > Main.maxTilesY - 320;
16350 bool flag10 = ZoneOverworldHeight && (point.X < 380 || point.X > Main.maxTilesX - 380);
16351 ManageSpecialBiomeVisuals("Stardust", ZoneTowerStardust, vector4 - new Vector2(0f, 10f));
16352 ManageSpecialBiomeVisuals("Nebula", ZoneTowerNebula, vector3 - new Vector2(0f, 10f));
16353 ManageSpecialBiomeVisuals("Vortex", ZoneTowerVortex, vector2 - new Vector2(0f, 10f));
16354 ManageSpecialBiomeVisuals("Solar", ZoneTowerSolar, vector - new Vector2(0f, 10f));
16355 ManageSpecialBiomeVisuals("MoonLord", NPC.AnyNPCs(398));
16356 ManageSpecialBiomeVisuals("BloodMoon", Main.bloodMoon || Main.SceneMetrics.BloodMoonMonolith || bloodMoonMonolithShader);
16357 ManageSpecialBiomeVisuals("Blizzard", Main.UseStormEffects && flag8);
16358 ManageSpecialBiomeVisuals("HeatDistortion", Main.UseHeatDistortion && (flag9 || ((double)point.Y < Main.worldSurface && ZoneDesert && !flag10 && !Main.raining && !Filters.Scene["Sandstorm"].IsActive())));
16360 {
16361 if (!Filters.Scene["Graveyard"].IsActive())
16362 {
16363 Filters.Scene.Activate("Graveyard", default(Vector2));
16364 }
16365 else
16366 {
16367 Filters.Scene["Graveyard"].GetShader().UseTargetPosition(base.Center);
16369 Filters.Scene["Graveyard"].GetShader().UseProgress(progress);
16370 Filters.Scene["Graveyard"].GetShader().UseIntensity(1.2f);
16371 }
16372 }
16373 else if (Filters.Scene["Graveyard"].IsActive())
16374 {
16375 Filters.Scene.Deactivate("Graveyard");
16376 }
16377 if (!Filters.Scene["Sepia"].IsActive() && dontStarveShader)
16378 {
16379 Filters.Scene.Activate("Sepia", default(Vector2));
16380 }
16381 else if (Filters.Scene["Sepia"].IsActive() && !dontStarveShader)
16382 {
16383 Filters.Scene.Deactivate("Sepia");
16384 }
16385 if (!Filters.Scene["WaterDistortion"].IsActive() && Main.WaveQuality > 0)
16386 {
16387 Filters.Scene.Activate("WaterDistortion", default(Vector2));
16388 }
16389 else if (Filters.Scene["WaterDistortion"].IsActive() && Main.WaveQuality == 0)
16390 {
16391 Filters.Scene.Deactivate("WaterDistortion");
16392 }
16393 if (Filters.Scene["WaterDistortion"].IsActive())
16394 {
16395 float num9 = (float)Main.maxTilesX * 0.5f - Math.Abs((float)point.X - (float)Main.maxTilesX * 0.5f);
16396 float num10 = 1f;
16398 num10 += num11 * 1.25f;
16399 float num12 = MathHelper.Clamp(Main.maxRaining, 0f, 1f);
16400 num10 += num12 * 1.25f;
16401 float num13 = 0f - (MathHelper.Clamp((num9 - 380f) / 100f, 0f, 1f) * 0.5f - 0.25f);
16402 num10 += num13;
16403 float num14 = 1f - MathHelper.Clamp(3f * ((float)((double)point.Y - Main.worldSurface) / (float)(Main.rockLayer - Main.worldSurface)), 0f, 1f);
16404 num10 *= num14;
16405 float num15 = 0.9f - MathHelper.Clamp((float)(Main.maxTilesY - point.Y - 200) / 300f, 0f, 1f) * 0.9f;
16406 num10 += num15;
16407 num10 += (1f - num14) * 0.75f;
16408 num10 = MathHelper.Clamp(num10, 0f, 2.5f);
16409 Filters.Scene["WaterDistortion"].GetShader().UseIntensity(num10);
16410 }
16411 if (flag9)
16412 {
16413 float val = (float)(point.Y - (Main.maxTilesY - 320)) / 120f;
16414 val = Math.Min(1f, val) * 2f;
16415 Filters.Scene["HeatDistortion"].GetShader().UseIntensity(val);
16416 }
16417 _shaderObstructionInternalValue = Utils.Clamp(_shaderObstructionInternalValue + (float)behindBackWall.ToDirectionInt() * -0.005f, -0.1f, 1.1f);
16418 _stormShaderObstruction = Utils.Clamp(_shaderObstructionInternalValue, 0f, 1f);
16419 if (Filters.Scene["Sandstorm"].IsActive())
16420 {
16421 Filters.Scene["Sandstorm"].GetShader().UseIntensity(_stormShaderObstruction * 0.4f * Math.Min(1f, Sandstorm.Severity));
16422 Filters.Scene["Sandstorm"].GetShader().UseOpacity(Math.Min(1f, Sandstorm.Severity * 1.5f) * _stormShaderObstruction);
16423 ((SimpleOverlay)Overlays.Scene["Sandstorm"]).GetShader().UseOpacity(Math.Min(1f, Sandstorm.Severity * 1.5f) * (1f - _stormShaderObstruction));
16424 }
16425 else if (ZoneDesert && !flag10 && !Main.raining && !flag9)
16426 {
16427 Vector3 vector5 = Main.tileColor.ToVector3();
16428 float num16 = (vector5.X + vector5.Y + vector5.Z) / 3f;
16429 float num17 = _stormShaderObstruction * 4f * Math.Max(0f, 0.5f - Main.cloudAlpha) * num16;
16430 Filters.Scene["HeatDistortion"].GetShader().UseIntensity(num17);
16431 if (num17 <= 0f)
16432 {
16433 Filters.Scene["HeatDistortion"].IsHidden = true;
16434 }
16435 else
16436 {
16437 Filters.Scene["HeatDistortion"].IsHidden = false;
16438 }
16439 }
16440 if (!disabledBlizzardGraphic)
16441 {
16442 try
16443 {
16444 if (flag8)
16445 {
16446 float cloudAlpha = Main.cloudAlpha;
16447 if (Main.remixWorld)
16448 {
16449 Main.cloudAlpha = 0.4f;
16450 }
16452 _deerclopsBlizzardSmoothedEffect = MathHelper.Clamp(_deerclopsBlizzardSmoothedEffect + (float)value.ToDirectionInt() * 0.0033333334f, 0f, 1f);
16453 float num18 = Math.Min(1f, Main.cloudAlpha * 2f) * _stormShaderObstruction;
16454 float num19 = _stormShaderObstruction * 0.4f * Math.Min(1f, Main.cloudAlpha * 2f) * 0.9f + 0.1f;
16455 num19 = MathHelper.Lerp(num19, num19 * 0.5f, _deerclopsBlizzardSmoothedEffect);
16456 num18 = MathHelper.Lerp(num18, num18 * 0.5f, _deerclopsBlizzardSmoothedEffect);
16457 Filters.Scene["Blizzard"].GetShader().UseIntensity(num19);
16458 Filters.Scene["Blizzard"].GetShader().UseOpacity(num18);
16459 ((SimpleOverlay)Overlays.Scene["Blizzard"]).GetShader().UseOpacity(1f - num18);
16460 if (Main.remixWorld)
16461 {
16462 Main.cloudAlpha = cloudAlpha;
16463 }
16464 }
16465 }
16466 catch
16467 {
16468 disabledBlizzardGraphic = true;
16469 }
16470 }
16471 if (!disabledBlizzardSound)
16472 {
16473 try
16474 {
16475 if (flag8)
16476 {
16477 ActiveSound activeSound = SoundEngine.GetActiveSound(_strongBlizzardSound);
16478 ActiveSound activeSound2 = SoundEngine.GetActiveSound(_insideBlizzardSound);
16479 if (activeSound == null)
16480 {
16482 }
16483 if (activeSound2 == null)
16484 {
16486 }
16487 SoundEngine.GetActiveSound(_strongBlizzardSound);
16488 activeSound2 = SoundEngine.GetActiveSound(_insideBlizzardSound);
16489 }
16490 if (flag8)
16491 {
16492 _blizzardSoundVolume = Math.Min(_blizzardSoundVolume + 0.01f, 1f);
16493 }
16494 else
16495 {
16496 _blizzardSoundVolume = Math.Max(_blizzardSoundVolume - 0.01f, 0f);
16497 }
16498 float num20 = Math.Min(1f, Main.cloudAlpha * 2f) * _stormShaderObstruction;
16499 ActiveSound activeSound3 = SoundEngine.GetActiveSound(_strongBlizzardSound);
16500 ActiveSound activeSound4 = SoundEngine.GetActiveSound(_insideBlizzardSound);
16501 if (_blizzardSoundVolume > 0f)
16502 {
16503 if (activeSound3 == null)
16504 {
16506 activeSound3 = SoundEngine.GetActiveSound(_strongBlizzardSound);
16507 }
16508 activeSound3.Volume = num20 * _blizzardSoundVolume;
16509 if (activeSound4 == null)
16510 {
16512 activeSound4 = SoundEngine.GetActiveSound(_insideBlizzardSound);
16513 }
16514 activeSound4.Volume = (1f - num20) * _blizzardSoundVolume;
16515 }
16516 else
16517 {
16518 if (activeSound3 != null)
16519 {
16520 activeSound3.Volume = 0f;
16521 }
16522 else
16523 {
16524 _strongBlizzardSound = SlotId.Invalid;
16525 }
16526 if (activeSound4 != null)
16527 {
16528 activeSound4.Volume = 0f;
16529 }
16530 else
16531 {
16532 _insideBlizzardSound = SlotId.Invalid;
16533 }
16534 }
16535 }
16536 catch
16537 {
16538 disabledBlizzardSound = true;
16539 }
16540 }
16541 if (!dead)
16542 {
16543 Point point2 = base.Center.ToTileCoordinates();
16544 if (WorldGen.InWorld(point2.X, point2.Y, 1))
16545 {
16546 int num21 = 0;
16547 if (Main.tile[point2.X, point2.Y] != null)
16548 {
16549 num21 = Main.tile[point2.X, point2.Y].wall;
16550 }
16551 switch (num21)
16552 {
16553 case 86:
16555 break;
16556 case 62:
16558 break;
16559 }
16560 }
16561 if (_funkytownAchievementCheckCooldown > 0)
16562 {
16563 _funkytownAchievementCheckCooldown--;
16564 }
16566 {
16568 }
16569 if (position.Y / 16f > (float)Main.UnderworldLayer)
16570 {
16572 }
16573 else if (_funkytownAchievementCheckCooldown == 0 && (double)(position.Y / 16f) < Main.worldSurface && ZoneGlowshroom)
16574 {
16576 }
16577 else if (_funkytownAchievementCheckCooldown == 0 && ZoneGraveyard)
16578 {
16580 }
16581 }
16582 else
16583 {
16584 _funkytownAchievementCheckCooldown = 100;
16585 }
16586 }
16587
16588 private void TrySpawningFaelings()
16589 {
16590 if (!_wasInShimmerZone && ZoneShimmer && Main.netMode != 1)
16591 {
16592 NPC.SpawnFaelings(whoAmI);
16593 }
16594 _wasInShimmerZone = ZoneShimmer;
16595 }
16596
16598 {
16599 if (SkyManager.Instance[biomeName] != null && inZone != SkyManager.Instance[biomeName].IsActive())
16600 {
16601 if (inZone)
16602 {
16604 }
16605 else
16606 {
16607 SkyManager.Instance.Deactivate(biomeName);
16608 }
16609 }
16610 if (inZone != Filters.Scene[biomeName].IsActive())
16611 {
16612 if (inZone)
16613 {
16615 }
16616 else
16617 {
16618 Filters.Scene[biomeName].Deactivate();
16619 }
16620 }
16621 else if (inZone)
16622 {
16623 Filters.Scene[biomeName].GetShader().UseTargetPosition(activationSource);
16624 }
16625 if (Overlays.Scene[biomeName] != null && inZone != (Overlays.Scene[biomeName].Mode != OverlayMode.Inactive))
16626 {
16627 if (inZone)
16628 {
16630 }
16631 else
16632 {
16633 Overlays.Scene[biomeName].Deactivate();
16634 }
16635 }
16636 }
16637
16638 public void GetHairSettings(out bool fullHair, out bool hatHair, out bool hideHair, out bool backHairDraw, out bool drawsBackHairWithoutHeadgear)
16639 {
16640 fullHair = (hatHair = (hideHair = (drawsBackHairWithoutHeadgear = false)));
16641 switch (head)
16642 {
16643 case 0:
16644 case 259:
16645 drawsBackHairWithoutHeadgear = true;
16646 break;
16647 case 10:
16648 case 12:
16649 case 28:
16650 case 42:
16651 case 62:
16652 case 97:
16653 case 106:
16654 case 113:
16655 case 116:
16656 case 119:
16657 case 133:
16658 case 138:
16659 case 139:
16660 case 163:
16661 case 178:
16662 case 181:
16663 case 191:
16664 case 198:
16665 case 217:
16666 case 218:
16667 case 220:
16668 case 222:
16669 case 224:
16670 case 225:
16671 case 228:
16672 case 229:
16673 case 230:
16674 case 232:
16675 case 235:
16676 case 238:
16677 case 242:
16678 case 243:
16679 case 244:
16680 case 245:
16681 case 272:
16682 case 273:
16683 case 274:
16684 case 277:
16685 fullHair = true;
16686 break;
16687 case 13:
16688 case 14:
16689 case 15:
16690 case 16:
16691 case 18:
16692 case 21:
16693 case 24:
16694 case 25:
16695 case 26:
16696 case 29:
16697 case 40:
16698 case 44:
16699 case 51:
16700 case 56:
16701 case 59:
16702 case 60:
16703 case 63:
16704 case 64:
16705 case 65:
16706 case 67:
16707 case 68:
16708 case 69:
16709 case 81:
16710 case 92:
16711 case 94:
16712 case 95:
16713 case 100:
16714 case 114:
16715 case 121:
16716 case 126:
16717 case 130:
16718 case 136:
16719 case 140:
16720 case 143:
16721 case 145:
16722 case 158:
16723 case 159:
16724 case 161:
16725 case 182:
16726 case 184:
16727 case 190:
16728 case 195:
16729 case 215:
16730 case 216:
16731 case 219:
16732 case 223:
16733 case 226:
16734 case 227:
16735 case 231:
16736 case 233:
16737 case 234:
16738 case 262:
16739 case 263:
16740 case 264:
16741 case 265:
16742 case 267:
16743 case 275:
16744 case 279:
16745 case 280:
16746 case 281:
16747 hatHair = true;
16748 break;
16749 }
16750 if (face > -1 && ArmorIDs.Face.Sets.PreventHairDraw[face])
16751 {
16752 hideHair = true;
16753 }
16754 if (faceHead > -1 && head != 0)
16755 {
16756 hideHair = true;
16757 }
16758 int num = hair;
16759 backHairDraw = num > 50 && (num < 56 || num > 63) && (num < 74 || num > 77) && (num < 88 || num > 89) && num != 100 && num != 104 && num != 112 && num < 116;
16760 if (num == 133 || num == 134 || num == 146 || num == 162 || num == 6)
16761 {
16762 backHairDraw = true;
16763 }
16764 }
16765
16766 public void UpdateDead()
16767 {
16768 shimmerUnstuckHelper.Clear();
16769 timeShimmering = 0;
16770 forcedGravity = 0;
16771 _portalPhysicsTime = 0;
16772 MountFishronSpecialCounter = 0f;
16773 gem = -1;
16774 ownedLargeGems = (byte)0;
16775 brainOfConfusionDodgeAnimationCounter = 0;
16776 ResetFloorFlags();
16777 wings = 0;
16778 wingsLogic = 0;
16779 ResetVisibleAccessories();
16780 poisoned = false;
16781 venom = false;
16782 onFire = false;
16783 dripping = false;
16784 drippingSlime = false;
16785 drippingSparkleSlime = false;
16786 hungry = false;
16787 heartyMeal = false;
16788 starving = false;
16789 burned = false;
16790 suffocating = false;
16791 onFire2 = false;
16792 onFire3 = false;
16793 onFrostBurn = false;
16794 onFrostBurn2 = false;
16795 shimmering = false;
16796 blind = false;
16797 blackout = false;
16798 loveStruck = false;
16799 dryadWard = false;
16800 stinky = false;
16801 resistCold = false;
16802 electrified = false;
16803 moonLeech = false;
16804 headcovered = false;
16805 vortexDebuff = false;
16806 windPushed = false;
16807 setForbidden = false;
16808 setMonkT3 = false;
16809 setHuntressT3 = false;
16810 setApprenticeT3 = false;
16811 setSquireT3 = false;
16812 setForbiddenCooldownLocked = false;
16813 setSolar = (setVortex = (setNebula = (setStardust = false)));
16814 nebulaLevelDamage = (nebulaLevelLife = (nebulaLevelMana = 0));
16815 trapDebuffSource = false;
16816 yoraiz0rEye = 0;
16817 yoraiz0rDarkness = false;
16818 hasFloatingTube = false;
16819 hasUnicornHorn = false;
16820 hasAngelHalo = false;
16821 hasRainbowCursor = false;
16822 leinforsHair = false;
16823 overrideFishingBobber = -1;
16824 gravDir = 1f;
16825 for (int i = 0; i < maxBuffs; i++)
16826 {
16827 if (buffType[i] <= 0 || !Main.persistentBuff[buffType[i]])
16828 {
16829 buffTime[i] = 0;
16830 buffType[i] = 0;
16831 }
16832 }
16833 if (whoAmI == Main.myPlayer)
16834 {
16835 Main.npcChatText = "";
16836 Main.editSign = false;
16837 Main.npcChatCornerItem = 0;
16838 }
16839 numMinions = 0;
16840 grappling[0] = -1;
16841 grappling[1] = -1;
16842 grappling[2] = -1;
16843 sign = -1;
16844 SetTalkNPC(-1);
16845 statLife = 0;
16846 channel = false;
16847 potionDelay = 0;
16848 chest = -1;
16849 tileEntityAnchor.Clear();
16850 changeItem = -1;
16851 itemAnimation = 0;
16852 immuneAlpha += 2;
16853 if (immuneAlpha > 255)
16854 {
16855 immuneAlpha = 255;
16856 }
16857 headPosition += headVelocity;
16858 bodyPosition += bodyVelocity;
16859 legPosition += legVelocity;
16860 headRotation += headVelocity.X * 0.1f;
16861 bodyRotation += bodyVelocity.X * 0.1f;
16862 legRotation += legVelocity.X * 0.1f;
16863 headVelocity.Y += 0.1f;
16864 bodyVelocity.Y += 0.1f;
16865 legVelocity.Y += 0.1f;
16866 headVelocity.X *= 0.99f;
16867 bodyVelocity.X *= 0.99f;
16868 legVelocity.X *= 0.99f;
16869 for (int j = 0; j < npcTypeNoAggro.Length; j++)
16870 {
16871 npcTypeNoAggro[j] = false;
16872 }
16873 if (difficulty == 2)
16874 {
16875 if (respawnTimer > 0)
16876 {
16877 respawnTimer = Utils.Clamp(respawnTimer - 1, 0, 3600);
16878 }
16879 else if (whoAmI == Main.myPlayer || Main.netMode == 2)
16880 {
16881 ghost = true;
16882 }
16883 }
16884 else
16885 {
16886 respawnTimer = Utils.Clamp(respawnTimer - 1, 0, 3600);
16887 if (respawnTimer <= 0 && Main.myPlayer == whoAmI)
16888 {
16889 if (Main.mouseItem.type > 0)
16890 {
16891 Main.playerInventory = true;
16892 }
16893 Spawn(PlayerSpawnContext.ReviveFromDeath);
16894 }
16895 }
16897 {
16898 PlayerInput.Triggers.Current.CopyInto(this);
16899 TryOpeningInGameOptionsBasedOnInput();
16900 }
16901 }
16902
16904 {
16905 if (controlInv)
16906 {
16907 if (releaseInventory)
16908 {
16909 releaseInventory = false;
16911 {
16913 }
16914 else
16915 {
16917 }
16918 }
16919 }
16920 else
16921 {
16922 releaseInventory = true;
16923 }
16924 }
16925
16926 public void UpdatePet(int i)
16927 {
16928 if (i == Main.myPlayer && miscEquips[0].buffType >= 1 && miscEquips[0].stack >= 1)
16929 {
16930 int num = miscEquips[0].buffType;
16931 if ((Main.vanityPet[num] || Main.lightPet[num]) && !hideMisc[0] && (miscEquips[0].type != 603 || Main.runningCollectorsEdition) && FindBuffIndex(num) == -1)
16932 {
16933 AddBuff(num, 3600);
16934 SoundEngine.PlaySound(miscEquips[0].UseSound, position);
16935 }
16936 }
16937 }
16938
16939 public void UpdatePetLight(int i)
16940 {
16941 if (i != Main.myPlayer || miscEquips[1].buffType < 1 || miscEquips[1].stack < 1)
16942 {
16943 return;
16944 }
16945 int num = miscEquips[1].buffType;
16946 if ((!Main.vanityPet[num] && !Main.lightPet[num]) || hideMisc[1] || (miscEquips[1].type == 603 && !Main.runningCollectorsEdition))
16947 {
16948 return;
16949 }
16950 int num2 = FindBuffIndex(num);
16951 if (num == 27 && num2 == -1)
16952 {
16953 num2 = FindBuffIndex(102);
16954 }
16955 if (num == 27 && num2 == -1)
16956 {
16957 num2 = FindBuffIndex(101);
16958 }
16959 if (num2 == -1)
16960 {
16961 if (num == 27)
16962 {
16963 num = Utils.SelectRandom<int>(Main.rand, 27, 102, 101);
16964 }
16965 AddBuff(num, 3600);
16966 SoundEngine.PlaySound(miscEquips[1].UseSound, position);
16967 }
16968 }
16969
16970 public void TogglePet()
16971 {
16972 hideMisc[0] = !hideMisc[0];
16973 if (hideMisc[0])
16974 {
16975 ClearBuff(miscEquips[0].buffType);
16976 }
16977 }
16978
16979 public void ToggleLight()
16980 {
16981 hideMisc[1] = !hideMisc[1];
16982 if (hideMisc[1])
16983 {
16984 ClearBuff(miscEquips[1].buffType);
16985 if (miscEquips[1].buffType == 27)
16986 {
16987 ClearBuff(102);
16988 ClearBuff(101);
16989 }
16990 }
16991 }
16992
16993 public bool IsWithinSnappngRangeToTile(int x, int y, int distanceInPixels)
16994 {
16995 if ((new Vector2(x * 16 + 8, y * 16 + 8) - new Vector2(base.Center.X, base.Bottom.Y - 16f)).Length() <= (float)distanceInPixels)
16996 {
16997 return true;
16998 }
16999 return false;
17000 }
17001
17003 {
17006 {
17008 }
17011 if (!flag && !showGamepadHints)
17012 {
17013 _smartInteractSys.Clear();
17014 return;
17015 }
17016 SmartInteractLookup_PrepareCommonlyUsedInfo(out var mousevec, out var LX, out var HX, out var LY, out var HY);
17017 _smartInteractSys.RunQuery(new SmartInteractScanSettings
17018 {
17019 DemandOnlyZeroDistanceTargets = (PlayerInput.SettingsForUI.ShowGamepadHints && !Main.SmartCursorIsUsed),
17020 FullInteraction = flag,
17021 HX = HX,
17022 HY = HY,
17023 LX = LX,
17024 LY = LY,
17025 mousevec = mousevec,
17026 player = this
17027 });
17028 }
17029
17030 private void SmartInteractLookup_PrepareCommonlyUsedInfo(out Vector2 mousevec, out int LX, out int HX, out int LY, out int HY)
17031 {
17033 int num = 0;
17034 LX = (int)(position.X / 16f) - tileRangeX - num + 1;
17035 HX = (int)((position.X + (float)width) / 16f) + tileRangeX + num - 1;
17036 LY = (int)(position.Y / 16f) - tileRangeY - num + 1;
17037 HY = (int)((position.Y + (float)height) / 16f) + tileRangeY + num - 2;
17038 LX = Utils.Clamp(LX, 10, Main.maxTilesX - 10);
17039 HX = Utils.Clamp(HX, 10, Main.maxTilesX - 10);
17040 LY = Utils.Clamp(LY, 10, Main.maxTilesY - 10);
17041 HY = Utils.Clamp(HY, 10, Main.maxTilesY - 10);
17042 }
17043
17044 public void SmartSelectLookup()
17045 {
17046 if (mouseInterface)
17047 {
17048 controlTorch = false;
17049 }
17050 if (controlTorch && itemAnimation == 0)
17051 {
17052 PlayerInput.smartSelectPointer.SmartSelectLookup_GetTargetTile(this, out var tX, out var tY);
17053 SmartSelect_GetToolStrategy(tX, tY, out var toolStrategy, out var wetTile);
17054 if (PlayerInput.UsingGamepad && _lastSmartCursorToolStrategy != -1)
17055 {
17056 toolStrategy = _lastSmartCursorToolStrategy;
17057 }
17058 if (toolStrategy == 0 || toolStrategy == 4)
17059 {
17060 float num = Math.Abs((float)Main.mouseX + Main.screenPosition.X - (position.X + (float)(width / 2)));
17061 float num2 = Math.Abs((float)Main.mouseY + Main.screenPosition.Y - (position.Y + (float)(height / 2))) * 1.3f;
17062 if ((float)Math.Sqrt(num * num + num2 * num2) > 200f)
17063 {
17064 toolStrategy = 5;
17065 }
17066 }
17067 SmartSelect_PickToolForStrategy(tX, tY, toolStrategy, wetTile);
17068 _lastSmartCursorToolStrategy = toolStrategy;
17069 }
17070 else if (itemAnimation == 0 && DpadRadial.SelectedItem != -1 && inventory[DpadRadial.SelectedItem].stack > 0)
17071 {
17072 if (nonTorch == -1)
17073 {
17074 nonTorch = selectedItem;
17075 }
17076 selectedItem = DpadRadial.SelectedItem;
17077 _lastSmartCursorToolStrategy = -1;
17078 }
17079 else if (itemAnimation == 0 && CircularRadial.SelectedItem != -1 && inventory[CircularRadial.SelectedItem].stack > 0)
17080 {
17081 if (nonTorch == -1)
17082 {
17083 nonTorch = selectedItem;
17084 }
17085 selectedItem = CircularRadial.SelectedItem;
17086 _lastSmartCursorToolStrategy = -1;
17087 }
17088 else if (nonTorch > -1 && itemAnimation == 0)
17089 {
17090 selectedItem = nonTorch;
17091 nonTorch = -1;
17092 _lastSmartCursorToolStrategy = -1;
17093 }
17094 }
17095
17097 {
17098 tX = (int)(((float)Main.mouseX + Main.screenPosition.X) / 16f);
17099 tY = (int)(((float)Main.mouseY + Main.screenPosition.Y) / 16f);
17100 if (gravDir == -1f)
17101 {
17102 tY = (int)((Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16f);
17103 }
17104 }
17105
17107 {
17108 for (int i = 0; i < 50; i++)
17109 {
17110 int type = inventory[i].type;
17111 switch (toolStrategy)
17112 {
17113 case 0:
17114 if (ItemID.Sets.Torches[type])
17115 {
17116 SmartSelect_SelectItem(i);
17117 return;
17118 }
17119 if (type == 282 || type == 286 || type == 3002 || type == 3112 || type == 4776)
17120 {
17121 SmartSelect_SelectItem(i);
17122 }
17123 break;
17124 case 1:
17125 if (inventory[i].hammer > 0)
17126 {
17127 SmartSelect_SelectItem(i);
17128 return;
17129 }
17130 break;
17131 case 2:
17132 if (inventory[i].axe > 0)
17133 {
17134 SmartSelect_SelectItem(i);
17135 return;
17136 }
17137 break;
17138 case 3:
17139 if (inventory[i].pick > 0)
17140 {
17141 SmartSelect_SelectItem(i);
17142 return;
17143 }
17144 break;
17145 case 4:
17146 if (inventory[i].type != 282 && inventory[i].type != 286 && inventory[i].type != 3002 && inventory[i].type != 3112 && inventory[i].type != 4776 && inventory[i].type != 930 && ItemID.Sets.Torches[type] && !ItemID.Sets.WaterTorches[type])
17147 {
17148 if (nonTorch == -1)
17149 {
17150 nonTorch = selectedItem;
17151 }
17152 if (inventory[selectedItem].createTile != 4)
17153 {
17154 selectedItem = i;
17155 }
17156 break;
17157 }
17158 if ((type == 282 || type == 286 || type == 3002 || type == 3112 || type == 4776) && wetTile)
17159 {
17160 SmartSelect_SelectItem(i);
17161 return;
17162 }
17163 if (type == 930 && wetTile)
17164 {
17165 bool flag = false;
17166 for (int num = 57; num >= 0; num--)
17167 {
17168 if (inventory[num].ammo == inventory[i].useAmmo && inventory[num].stack > 0)
17169 {
17170 flag = true;
17171 break;
17172 }
17173 }
17174 if (flag)
17175 {
17176 SmartSelect_SelectItem(i);
17177 return;
17178 }
17179 }
17180 else if (ItemID.Sets.WaterTorches[type])
17181 {
17182 SmartSelect_SelectItem(i);
17183 return;
17184 }
17185 break;
17186 case 5:
17187 if (ItemID.Sets.Torches[type])
17188 {
17189 if (nonTorch == -1)
17190 {
17191 nonTorch = selectedItem;
17192 }
17193 if (inventory[selectedItem].createTile != 4)
17194 {
17195 selectedItem = i;
17196 }
17197 break;
17198 }
17199 switch (type)
17200 {
17201 case 930:
17202 {
17203 bool flag2 = false;
17204 for (int num2 = 57; num2 >= 0; num2--)
17205 {
17206 if (inventory[num2].ammo == inventory[i].useAmmo && inventory[num2].stack > 0)
17207 {
17208 flag2 = true;
17209 break;
17210 }
17211 }
17212 if (flag2)
17213 {
17214 SmartSelect_SelectItem(i);
17215 return;
17216 }
17217 break;
17218 }
17219 case 282:
17220 case 286:
17221 case 3002:
17222 case 3112:
17223 case 4776:
17224 SmartSelect_SelectItem(i);
17225 return;
17226 }
17227 break;
17228 case 6:
17229 {
17230 int num3 = Main.tile[tX, tY].frameX / 72;
17231 int num4 = -1;
17232 switch (num3)
17233 {
17234 case 0:
17235 num4 = 929;
17236 break;
17237 case 1:
17238 num4 = 1338;
17239 break;
17240 case 2:
17241 num4 = 1345;
17242 break;
17243 }
17244 if (type == num4)
17245 {
17246 SmartSelect_SelectItem(i);
17247 return;
17248 }
17249 break;
17250 }
17251 case 7:
17252 {
17253 ItemTrader itemTrader = TryGettingItemTraderFromBlock(Main.tile[tX, tY]);
17254 if (itemTrader != null && itemTrader.TryGetTradeOption(inventory[i], out var _))
17255 {
17256 SmartSelect_SelectItem(i);
17257 return;
17258 }
17260 {
17261 SmartSelect_SelectItem(i);
17262 return;
17263 }
17264 break;
17265 }
17266 case 8:
17268 {
17269 SmartSelect_SelectItem(i);
17270 return;
17271 }
17272 break;
17273 }
17274 }
17275 }
17276
17277 private void SmartSelect_SelectItem(int t)
17278 {
17279 if (nonTorch == -1)
17280 {
17281 nonTorch = selectedItem;
17282 }
17283 selectedItem = t;
17284 }
17285
17286 private void SmartSelect_GetToolStrategy(int tX, int tY, out int toolStrategy, out bool wetTile)
17287 {
17288 toolStrategy = 0;
17289 bool flag = false;
17290 wetTile = false;
17291 try
17292 {
17293 int num = 0;
17294 int num2 = 0;
17295 if (position.X / 16f >= (float)tX)
17296 {
17297 num = (int)(position.X / 16f) - tX;
17298 }
17299 if ((position.X + (float)width) / 16f <= (float)tX)
17300 {
17301 num = tX - (int)((position.X + (float)width) / 16f);
17302 }
17303 if (position.Y / 16f >= (float)tY)
17304 {
17305 num2 = (int)(position.Y / 16f) - tY;
17306 }
17307 if ((position.Y + (float)height) / 16f <= (float)tY)
17308 {
17309 num2 = tY - (int)((position.Y + (float)height) / 16f);
17310 }
17312 wetTile = Main.tile[tX, tY].liquid > 0;
17313 if (Main.tile[tX, tY].active())
17314 {
17315 int type = Main.tile[tX, tY].type;
17316 if ((type == 219 || type == 642) && num <= extractItemRange + tileRangeX && num2 <= extractItemRange + tileRangeY)
17317 {
17318 toolStrategy = 7;
17319 flag = true;
17320 }
17321 else if (type == 209 && num <= cannonRange + tileRangeX && num2 <= cannonRange + tileRangeY)
17322 {
17323 toolStrategy = 6;
17324 flag = true;
17325 }
17326 else if (Main.tileHammer[type] && num <= hammerRange + tileRangeX && num2 <= hammerRange + tileRangeY)
17327 {
17328 toolStrategy = 1;
17329 flag = true;
17330 }
17331 else if (Main.tileAxe[type] && num <= axeRange + tileRangeX && num2 <= axeRange + tileRangeY)
17332 {
17333 toolStrategy = 2;
17334 flag = true;
17335 }
17336 else if (type == 184 && num <= paintScraperRange + tileRangeX && num2 <= paintScraperRange + tileRangeY)
17337 {
17338 toolStrategy = 8;
17339 flag = true;
17340 }
17341 else if (num <= pickRange + tileRangeX && num2 <= pickRange + tileRangeY)
17342 {
17343 toolStrategy = 3;
17344 flag = true;
17345 }
17346 }
17347 else if (wetTile && wet)
17348 {
17349 toolStrategy = 4;
17350 flag = true;
17351 }
17352 }
17353 catch
17354 {
17355 }
17356 if (!flag && wet)
17357 {
17358 toolStrategy = 4;
17359 }
17360 }
17361
17363 {
17364 pickRange = -10;
17365 axeRange = -10;
17366 hammerRange = -10;
17367 cannonRange = -10;
17368 extractItemRange = -10;
17369 paintScraperRange = -10;
17370 for (int i = 0; i < 50; i++)
17371 {
17372 if (inventory[i].pick > 0 && pickRange == -10)
17373 {
17374 pickRange = inventory[i].tileBoost;
17375 }
17376 if (inventory[i].axe > 0 && axeRange == -10)
17377 {
17378 axeRange = inventory[i].tileBoost;
17379 }
17380 if (inventory[i].hammer > 0 && hammerRange == -10)
17381 {
17382 hammerRange = inventory[i].tileBoost;
17383 }
17384 if ((inventory[i].type == 929 || inventory[i].type == 1338 || inventory[i].type == 1345) && cannonRange == -10)
17385 {
17386 cannonRange = inventory[i].tileBoost;
17387 }
17388 if (ItemID.Sets.IsPaintScraper[inventory[i].type] && paintScraperRange == -10)
17389 {
17390 paintScraperRange = inventory[i].tileBoost;
17391 }
17392 if (ItemID.Sets.ExtractinatorMode[inventory[i].type] != -1 && extractItemRange == -10)
17393 {
17394 extractItemRange = inventory[i].tileBoost;
17395 }
17396 }
17397 }
17398
17400 {
17401 if (happyFunTorchTime)
17402 {
17403 RelightTorches();
17404 happyFunTorchTime = false;
17405 if (Main.netMode == 1)
17406 {
17407 NetMessage.SendData(4, -1, -1, null, whoAmI);
17408 }
17409 }
17410 }
17411
17413 {
17414 if (happyFunTorchTime)
17415 {
17416 luckyTorchCounter = 0;
17417 TorchAttack();
17418 return;
17419 }
17420 if (torchGodCooldown > 0)
17421 {
17422 torchGodCooldown--;
17423 }
17424 Vector2 nextTorchLuckCheckCenter = _nextTorchLuckCheckCenter;
17425 if (false | ((double)nextTorchLuckCheckCenter.Y < Main.worldSurface * 16.0) | dead)
17426 {
17427 UpdateTorchLuck_ConsumeCountersAndCalculate();
17428 return;
17429 }
17430 int num = 1;
17431 int num2 = 40;
17432 int num3 = (int)nextTorchLuckCheckCenter.Y / 16 - num2;
17433 int value = (int)nextTorchLuckCheckCenter.X / 16 - num2;
17434 int value2 = (int)nextTorchLuckCheckCenter.X / 16 + num2;
17435 value = Utils.Clamp(value, 10, Main.maxTilesX - 10);
17436 value2 = Utils.Clamp(value2, 10, Main.maxTilesX - 10);
17437 for (int i = 0; i < num; i++)
17438 {
17439 int num4 = num3 + i + luckyTorchCounter * num;
17441 {
17442 continue;
17443 }
17444 for (int j = value; j <= value2; j++)
17445 {
17446 Tile tile = Main.tile[j, num4];
17447 if (tile == null)
17448 {
17449 return;
17450 }
17451 if (!tile.active() || tile.type != 4 || tile.frameX < 0 || tile.frameY < 0)
17452 {
17453 continue;
17454 }
17455 if (tile.frameX < 66)
17456 {
17457 nearbyTorches++;
17458 }
17459 int num5 = tile.frameY / 22;
17460 if (num5 < TorchID.Count)
17461 {
17462 nearbyTorch[num5] = true;
17463 if (num5 == 17 && (tile.liquid == 0 || tile.liquidType() != 0))
17464 {
17465 dryCoralTorch = true;
17466 }
17467 }
17468 }
17469 if (num4 >= (int)nextTorchLuckCheckCenter.Y / 16 + num2)
17470 {
17471 UpdateTorchLuck_ConsumeCountersAndCalculate();
17472 return;
17473 }
17474 }
17475 luckyTorchCounter++;
17476 }
17477
17478 private void RelightTorches()
17479 {
17480 torchGodCooldown = 3600;
17481 for (int i = 0; i < numberOfTorchAttacksMade; i++)
17482 {
17483 int num = unlitTorchX[i];
17484 int num2 = unlitTorchY[i];
17485 if (Main.tile[num, num2].type == 4 && Main.tile[num, num2].frameX >= 66)
17486 {
17487 Main.tile[num, num2].frameX -= 66;
17488 NetMessage.SendTileSquare(-1, num, num2);
17489 }
17490 }
17491 }
17492
17493 private void TorchAttack()
17494 {
17495 if (whoAmI != Main.myPlayer)
17496 {
17497 return;
17498 }
17499 if ((double)position.Y < Main.worldSurface * 16.0)
17500 {
17501 EndOngoingTorchGodEvent();
17502 return;
17503 }
17504 AddBuff(80, 2);
17505 torchFunTimer++;
17506 if (torchFunTimer <= 20)
17507 {
17508 return;
17509 }
17510 torchFunTimer = 0;
17511 int num = 0;
17512 int num2 = 100;
17513 int value = (int)base.Center.X / 16 - num2;
17514 int value2 = (int)base.Center.X / 16 + num2;
17515 int value3 = (int)base.Center.Y / 16 - num2;
17516 int value4 = (int)base.Center.Y / 16 + num2;
17517 int num3 = Utils.Clamp(value, 10, Main.maxTilesX - 10);
17518 value2 = Utils.Clamp(value2, 10, Main.maxTilesX - 10);
17519 value3 = Utils.Clamp(value3, 10, Main.maxTilesY - 10);
17520 value4 = Utils.Clamp(value4, 10, Main.maxTilesY - 10);
17521 for (int i = num3; i <= value2; i++)
17522 {
17523 for (int j = value3; j <= value4; j++)
17524 {
17525 Tile tile = Main.tile[i, j];
17526 if (tile != null && (tile.active() & (tile.type == 4)) && tile.frameX < 66)
17527 {
17528 _torchAttackPosX[num] = i;
17529 _torchAttackPosY[num] = j;
17530 num++;
17531 if (num >= _torchAttackPosX.Length)
17532 {
17533 break;
17534 }
17535 }
17536 }
17537 if (num >= _torchAttackPosX.Length)
17538 {
17539 break;
17540 }
17541 }
17542 if (num == 0 || numberOfTorchAttacksMade >= maxTorchAttacks)
17543 {
17544 RelightTorches();
17545 happyFunTorchTime = false;
17546 if (Main.netMode == 1)
17547 {
17548 NetMessage.SendData(4, -1, -1, null, whoAmI);
17549 }
17550 if (numberOfTorchAttacksMade >= 95)
17551 {
17552 int number = Item.NewItem(new EntitySource_ByItemSourceId(this, 6), (int)position.X, (int)position.Y, width, height, 5043);
17553 if (Main.netMode == 1)
17554 {
17555 NetMessage.SendData(21, -1, -1, null, number, 1f);
17556 }
17557 }
17558 }
17559 else
17560 {
17561 if (num <= 0)
17562 {
17563 return;
17564 }
17565 int num4 = Main.rand.Next(num);
17566 int num5 = _torchAttackPosX[num4];
17567 int num6 = _torchAttackPosY[num4];
17568 if (Main.tile[num5, num6].type == 4 && Main.tile[num5, num6].frameX < 66)
17569 {
17570 float num7 = 8f;
17571 int num8 = 20;
17572 if (num8 < 10)
17573 {
17574 num8 = 10;
17575 }
17576 int num9 = (int)MathHelper.Clamp(Main.tile[num5, num6].frameY / 22, 0f, TorchID.Count - 1);
17577 num9 = TorchID.Dust[num9];
17578 Main.tile[num5, num6].frameX += 66;
17579 unlitTorchX[numberOfTorchAttacksMade] = num5;
17580 unlitTorchY[numberOfTorchAttacksMade] = num6;
17581 numberOfTorchAttacksMade++;
17583 Vector2 vector = new Vector2(num5 * 16 + 8, num6 * 16);
17584 Vector2 vector2 = base.Center - vector;
17585 float num10 = vector2.Length();
17586 vector2.Normalize();
17587 vector2 *= num7;
17588 int num11 = Projectile.NewProjectile(GetProjectileSource_Misc(10), vector, vector2, 949, num8, 1f, whoAmI, num9, num10);
17589 Main.projectile[num11].ai[0] = num9;
17590 Main.projectile[num11].ai[1] = num10;
17591 Main.projectile[num11].netUpdate = true;
17592 if ((num == 1 && numberOfTorchAttacksMade >= 95) || numberOfTorchAttacksMade >= maxTorchAttacks)
17593 {
17594 torchFunTimer = -180;
17595 }
17596 }
17597 }
17598 }
17599
17601 {
17602 luckyTorchCounter = 0;
17603 torchLuck = 0f;
17604 _nextTorchLuckCheckCenter = base.Center;
17605 if (inventory[selectedItem].createTile == 4 && inventory[selectedItem].placeStyle < TorchID.Count)
17606 {
17607 nearbyTorch[inventory[selectedItem].placeStyle] = true;
17608 }
17609 float num = 0f;
17610 float num2 = 0f;
17611 if (!ZoneDungeon && !ZoneLihzhardTemple)
17612 {
17613 if (nearbyTorch[9])
17614 {
17615 if (ZoneSnow)
17616 {
17617 num2 += 1f;
17618 }
17619 else
17620 {
17621 num += 1f;
17622 }
17623 }
17624 if (nearbyTorch[16])
17625 {
17626 if (ZoneDesert)
17627 {
17628 num2 += 1f;
17629 }
17630 else
17631 {
17632 num += 1f;
17633 }
17634 }
17635 if (nearbyTorch[17])
17636 {
17637 if (WorldGen.oceanDepths((int)base.Center.X / 16, (int)base.Center.Y / 16))
17638 {
17639 num2 += 1f;
17640 }
17641 else if (dryCoralTorch)
17642 {
17643 num += 1f;
17644 }
17645 }
17646 if (nearbyTorch[21])
17647 {
17648 if (ZoneJungle)
17649 {
17650 num2 += 1f;
17651 }
17652 else
17653 {
17654 num += 1f;
17655 }
17656 }
17657 if (nearbyTorch[22])
17658 {
17659 if (ZoneGlowshroom)
17660 {
17661 num2 += 1f;
17662 }
17663 else
17664 {
17665 num += 1f;
17666 }
17667 }
17668 if (nearbyTorch[18])
17669 {
17670 if (ZoneCorrupt)
17671 {
17672 num2 += 1f;
17673 }
17674 else
17675 {
17676 num += 1f;
17677 }
17678 }
17679 if (nearbyTorch[8] && ZoneCorrupt)
17680 {
17681 num2 += 1f;
17682 }
17683 if (nearbyTorch[19])
17684 {
17685 if (ZoneCrimson)
17686 {
17687 num2 += 1f;
17688 }
17689 else
17690 {
17691 num += 1f;
17692 }
17693 }
17694 if (nearbyTorch[11] && ZoneCrimson)
17695 {
17696 num2 += 1f;
17697 }
17698 if (nearbyTorch[20])
17699 {
17700 if (ZoneHallow)
17701 {
17702 num2 += 1f;
17703 }
17704 else
17705 {
17706 num += 1f;
17707 }
17708 }
17709 if (nearbyTorch[13] && !ZoneSnow && !ZoneDesert && !ZoneCorrupt && !ZoneCrimson && !ZoneHallow && !ZoneJungle)
17710 {
17711 num2 += 0.5f;
17712 }
17713 if (nearbyTorch[0])
17714 {
17715 if (ZoneSnow)
17716 {
17717 num += 2f;
17718 }
17719 else if (ZoneDesert || ZoneCorrupt || ZoneCrimson || ZoneHallow)
17720 {
17721 num += 0.5f;
17722 }
17723 }
17724 }
17725 if (num2 >= 1f)
17726 {
17727 torchLuck += 1f;
17728 }
17729 else if (num2 > 0f)
17730 {
17731 torchLuck += 0.5f;
17732 }
17733 if (num >= 2f)
17734 {
17735 torchLuck += -1.5f;
17736 }
17737 else if (num >= 1f)
17738 {
17739 torchLuck += -1f;
17740 }
17741 else if (num > 0f)
17742 {
17743 torchLuck += -0.5f;
17744 }
17745 dryCoralTorch = false;
17746 for (int i = 0; i < TorchID.Count; i++)
17747 {
17748 nearbyTorch[i] = false;
17749 }
17750 if (torchLuck < 0f)
17751 {
17752 torchLuck = 0f;
17753 }
17754 if (torchGodCooldown <= 0 && !unlockedBiomeTorches && nearbyTorches > 100 && !happyFunTorchTime && (double)position.Y > Main.worldSurface * 16.0)
17755 {
17756 bool flag = false;
17757 for (int j = 0; j < inventory.Length; j++)
17758 {
17759 if (inventory[j].type == 5043)
17760 {
17761 flag = true;
17762 break;
17763 }
17764 }
17765 if (!flag)
17766 {
17767 happyFunTorchTime = true;
17768 numberOfTorchAttacksMade = 0;
17769 }
17770 }
17771 nearbyTorches = 0;
17772 }
17773
17775 {
17776 if (!dead && Vector2.Distance(coinPosition, base.Center) < 1000f)
17777 {
17778 coinLuck += coinAmount;
17779 if (coinLuck > 1000000f)
17780 {
17781 coinLuck = 1000000f;
17782 }
17783 luckNeedsSync = true;
17784 }
17785 }
17786
17787 private void UpdateCoinLuck()
17788 {
17789 if (!(coinLuck <= 0f))
17790 {
17791 coinLuck *= 0.9999f;
17792 if ((double)coinLuck < 0.25)
17793 {
17794 coinLuck = 0f;
17795 }
17796 }
17797 }
17798
17799 private float CalculateCoinLuck()
17800 {
17801 if (coinLuck == 0f)
17802 {
17803 return 0f;
17804 }
17805 if (coinLuck > 249000f)
17806 {
17807 return 0.2f;
17808 }
17809 if (coinLuck > 24900f)
17810 {
17811 return 0.175f;
17812 }
17813 if (coinLuck > 24900f)
17814 {
17815 return 0.175f;
17816 }
17817 if (coinLuck > 2490f)
17818 {
17819 return 0.15f;
17820 }
17821 if (coinLuck > 249f)
17822 {
17823 return 0.125f;
17824 }
17825 if ((double)coinLuck > 24.9)
17826 {
17827 return 0.1f;
17828 }
17829 if ((double)coinLuck > 2.49)
17830 {
17831 return 0.075f;
17832 }
17833 if ((double)coinLuck > 0.249)
17834 {
17835 return 0.05f;
17836 }
17837 return 0.025f;
17838 }
17839
17840 private float GetLadyBugLuck()
17841 {
17842 if (ladyBugLuckTimeLeft > 0)
17843 {
17844 return (float)ladyBugLuckTimeLeft / (float)NPC.ladyBugGoodLuckTime;
17845 }
17846 if (ladyBugLuckTimeLeft < 0)
17847 {
17848 return (0f - (float)ladyBugLuckTimeLeft) / (float)NPC.ladyBugBadLuckTime;
17849 }
17850 return 0f;
17851 }
17852
17854 {
17855 return Main.player[FindClosest(new Vector2(Position.X * 16, Position.Y * 16), 1, 1)].luck;
17856 }
17857
17859 {
17860 return Main.player[FindClosest(Position, 1, 1)].luck;
17861 }
17862
17863 public int RollLuck(int range)
17864 {
17865 if (luck > 0f && Main.rand.NextFloat() < luck)
17866 {
17867 return Main.rand.Next(Main.rand.Next(range / 2, range));
17868 }
17869 if (luck < 0f && Main.rand.NextFloat() < 0f - luck)
17870 {
17871 return Main.rand.Next(Main.rand.Next(range, range * 2));
17872 }
17873 return Main.rand.Next(range);
17874 }
17875
17876 public static float GetClosestRollLuck(Vector2 position, int range)
17877 {
17878 return Main.player[FindClosest(position, 1, 1)].RollLuck(range);
17879 }
17880
17881 public static float GetClosestRollLuck(int x, int y, int range)
17882 {
17883 return Main.player[FindClosest(new Vector2(x * 16, y * 16), 1, 1)].RollLuck(range);
17884 }
17885
17886 public void ResetEffects()
17887 {
17888 if (extraAccessory && (Main.expertMode || Main.gameMenu))
17889 {
17890 extraAccessorySlots = 1;
17891 }
17892 else
17893 {
17894 extraAccessorySlots = 0;
17895 }
17896 if (shimmering)
17897 {
17898 shimmerTransparency += 0.015f;
17899 if (shimmerTransparency > 0.8f)
17900 {
17901 shimmerTransparency = 0.8f;
17902 }
17903 }
17904 else if (shimmerTransparency > 0f)
17905 {
17906 if (shimmerTransparency == 0.8f)
17907 {
17908 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 3);
17909 }
17910 shimmerTransparency -= 0.015f;
17911 if (shimmerTransparency < 0f)
17912 {
17913 shimmerTransparency = 0f;
17914 }
17915 }
17916 shimmering = false;
17917 fairyBoots = false;
17918 hellfireTreads = false;
17919 moonLordLegs = false;
17920 flowerBoots = false;
17921 arcticDivingGear = false;
17922 noBuilding = false;
17923 strongBees = false;
17924 armorPenetration = 0;
17925 ashWoodBonus = false;
17926 shroomiteStealth = false;
17927 statDefense = 0;
17928 accWatch = 0;
17929 accCompass = 0;
17930 accDepthMeter = 0;
17931 accDivingHelm = false;
17932 canFloatInWater = false;
17933 lifeRegen = 0;
17934 manaCost = 1f;
17935 meleeSpeed = 1f;
17936 meleeDamage = 1f;
17937 rangedDamage = 1f;
17938 rangedMultDamage = 1f;
17939 magicDamage = 1f;
17940 minionDamage = 1f;
17941 summonerWeaponSpeedBonus = 0f;
17942 meleeCrit = 4;
17943 rangedCrit = 4;
17944 magicCrit = 4;
17945 hasFootball = false;
17946 drawingFootball = false;
17947 minionKB = 0f;
17948 moveSpeed = 1f;
17949 boneArmor = false;
17950 honey = false;
17951 frostArmor = false;
17952 rocketBoots = 0;
17953 vanityRocketBoots = 0;
17954 fireWalk = false;
17955 noKnockback = false;
17956 jumpBoost = false;
17957 frogLegJumpBoost = false;
17958 skyStoneEffects = false;
17959 noFallDmg = false;
17960 accFlipper = false;
17961 spawnMax = false;
17962 spaceGun = false;
17963 killGuide = false;
17964 killClothier = false;
17965 lavaImmune = false;
17966 gills = false;
17967 slowFall = false;
17968 findTreasure = false;
17969 biomeSight = false;
17970 invis = false;
17971 nightVision = false;
17972 enemySpawns = false;
17973 hasTitaniumStormBuff = false;
17974 thorns = 0f;
17975 aggro = 0;
17976 waterWalk = false;
17977 waterWalk2 = false;
17978 detectCreature = false;
17979 gravControl = false;
17980 if (forcedGravity > 0)
17981 {
17982 forcedGravity--;
17983 }
17984 honeyCombItem = null;
17985 gravControl2 = false;
17986 statLifeMax2 = statLifeMax;
17987 statManaMax2 = statManaMax;
17988 chloroAmmoCost80 = false;
17989 huntressAmmoCost90 = false;
17990 ammoCost80 = false;
17991 ammoCost75 = false;
17992 manaRegenBuff = false;
17993 hasCreditsSceneMusicBox = false;
17994 arrowDamage = 1f;
17995 arrowDamageAdditiveStack = 0f;
17996 bulletDamage = 1f;
17997 rocketDamage = 1f;
17998 coolWhipBuff = false;
17999 yoraiz0rEye = 0;
18000 yoraiz0rDarkness = false;
18001 hasFloatingTube = false;
18002 hasUnicornHorn = false;
18003 hasAngelHalo = false;
18004 hasRainbowCursor = false;
18005 leinforsHair = false;
18006 overrideFishingBobber = -1;
18007 suspiciouslookingTentacle = false;
18008 crimsonHeart = false;
18009 lightOrb = false;
18010 blueFairy = false;
18011 redFairy = false;
18012 greenFairy = false;
18013 wisp = false;
18014 bunny = false;
18015 turtle = false;
18016 eater = false;
18017 trident = false;
18018 skeletron = false;
18019 hornet = false;
18020 zephyrfish = false;
18021 tiki = false;
18022 lizard = false;
18023 parrot = false;
18024 sapling = false;
18025 cSapling = false;
18026 truffle = false;
18027 yoyoGlove = false;
18028 counterWeight = 0;
18029 stringColor = 0;
18030 yoyoString = false;
18031 shadowDodge = false;
18032 palladiumRegen = false;
18033 chaosState = false;
18034 onHitDodge = false;
18035 onHitRegen = false;
18036 onHitPetal = false;
18037 iceBarrier = false;
18038 onHitTitaniumStorm = false;
18039 maxMinions = 1;
18040 maxTurrets = 1;
18041 ammoBox = false;
18042 ammoPotion = false;
18043 penguin = false;
18044 sporeSac = false;
18045 shinyStone = false;
18046 empressBrooch = false;
18047 volatileGelatin = false;
18048 hasMagiluminescence = false;
18049 shadowArmor = false;
18051 {
18052 dontStarveShader = false;
18053 }
18054 else
18055 {
18056 dontStarveShader = Main.dontStarveWorld;
18057 }
18058 eyebrellaCloud = false;
18059 stardustMonolithShader = false;
18060 nebulaMonolithShader = false;
18061 vortexMonolithShader = false;
18062 solarMonolithShader = false;
18063 moonLordMonolithShader = false;
18064 bloodMoonMonolithShader = false;
18065 shimmerMonolithShader = false;
18066 dd2Accessory = false;
18067 magicLantern = false;
18068 rabid = false;
18069 sunflower = false;
18070 wellFed = false;
18071 inferno = false;
18072 manaMagnet = false;
18073 lifeMagnet = false;
18074 treasureMagnet = false;
18075 chiselSpeed = false;
18076 lifeForce = false;
18077 dangerSense = false;
18078 endurance = 0f;
18079 whipRangeMultiplier = 1f;
18080 whipUseTimeMultiplier = 1f;
18081 calmed = false;
18082 beetleOrbs = 0;
18083 beetleBuff = false;
18084 miniMinotaur = false;
18085 goldRing = false;
18086 solarShields = 0;
18087 GoingDownWithGrapple = false;
18088 fishingSkill = 0;
18089 cratePotion = false;
18090 sonarPotion = false;
18091 accTackleBox = false;
18092 accFishingBobber = false;
18093 accFishingLine = false;
18094 accLavaFishing = false;
18095 accFishFinder = false;
18096 accWeatherRadio = false;
18097 accThirdEye = false;
18098 InfoAccMechShowWires = false;
18099 accJarOfSouls = false;
18100 accCalendar = false;
18101 accStopwatch = false;
18102 accOreFinder = false;
18103 accCritterGuide = false;
18104 accDreamCatcher = false;
18105 wallSpeed = 1f;
18106 tileSpeed = 1f;
18107 autoPaint = false;
18108 autoActuator = false;
18109 petFlagKingSlimePet = false;
18110 petFlagEyeOfCthulhuPet = false;
18111 petFlagEaterOfWorldsPet = false;
18112 petFlagBrainOfCthulhuPet = false;
18113 petFlagSkeletronPet = false;
18114 petFlagQueenBeePet = false;
18115 petFlagDestroyerPet = false;
18116 petFlagTwinsPet = false;
18117 petFlagSkeletronPrimePet = false;
18118 petFlagPlanteraPet = false;
18119 petFlagGolemPet = false;
18120 petFlagDukeFishronPet = false;
18121 petFlagLunaticCultistPet = false;
18122 petFlagMoonLordPet = false;
18123 petFlagFairyQueenPet = false;
18124 petFlagPumpkingPet = false;
18125 petFlagEverscreamPet = false;
18126 petFlagIceQueenPet = false;
18127 petFlagMartianPet = false;
18128 petFlagDD2OgrePet = false;
18129 petFlagDD2BetsyPet = false;
18130 petFlagQueenSlimePet = false;
18131 petFlagVoltBunny = false;
18132 petFlagShadowMimic = false;
18133 petFlagBabyWerewolf = false;
18134 petFlagDynamiteKitten = false;
18135 petFlagPlantero = false;
18136 petFlagBabyRedPanda = false;
18137 petFlagLilHarpy = false;
18138 petFlagFennecFox = false;
18139 petFlagGlitteryButterfly = false;
18140 petFlagBabyImp = false;
18141 petFlagBabyShark = false;
18142 petFlagUpbeatStar = false;
18143 petFlagDD2Gato = false;
18144 petFlagDD2Dragon = false;
18145 petFlagDD2Ghost = false;
18146 petFlagBerniePet = false;
18147 petFlagGlommerPet = false;
18148 petFlagDeerclopsPet = false;
18149 petFlagPigPet = false;
18150 petFlagChesterPet = false;
18151 petFlagJunimoPet = false;
18152 petFlagBlueChickenPet = false;
18153 petFlagSpiffo = false;
18154 petFlagCaveling = false;
18155 petFlagDirtiestBlock = false;
18156 companionCube = false;
18157 petFlagSugarGlider = false;
18158 babyFaceMonster = false;
18159 manaSick = false;
18160 puppy = false;
18161 grinch = false;
18162 blackCat = false;
18163 spider = false;
18164 squashling = false;
18165 magicCuffs = false;
18166 coldDash = false;
18167 desertDash = false;
18168 desertBoots = false;
18169 sailDash = false;
18170 cordage = false;
18171 magicQuiver = false;
18172 shimmerImmune = false;
18173 hasMoltenQuiver = false;
18174 magmaStone = false;
18175 hasRaisableShield = false;
18176 lavaRose = false;
18177 eyeSpring = false;
18178 snowman = false;
18179 scope = false;
18180 panic = false;
18181 brainOfConfusionItem = null;
18182 dino = false;
18183 crystalLeaf = false;
18184 pygmy = false;
18185 raven = false;
18186 slime = false;
18187 hornetMinion = false;
18188 impMinion = false;
18189 twinsMinion = false;
18190 spiderMinion = false;
18191 pirateMinion = false;
18192 sharknadoMinion = false;
18193 stardustMinion = false;
18194 batsOfLight = false;
18195 babyBird = false;
18196 stormTiger = false;
18197 flinxMinion = false;
18198 abigailMinion = false;
18199 smolstar = false;
18200 empressBlade = false;
18201 stardustGuardian = false;
18202 stardustDragon = false;
18203 UFOMinion = false;
18204 DeadlySphereMinion = false;
18205 chilled = false;
18206 tipsy = false;
18207 dazed = false;
18208 frozen = false;
18209 stoned = false;
18210 webbed = false;
18211 ichor = false;
18212 manaRegenBonus = 0;
18213 manaRegenDelayBonus = 0f;
18214 carpet = false;
18215 iceSkate = false;
18216 dashType = 0;
18217 spikedBoots = 0;
18218 blackBelt = false;
18219 lavaMax = 0;
18220 archery = false;
18221 poisoned = false;
18222 venom = false;
18223 blind = false;
18224 blackout = false;
18225 onFire = false;
18226 dripping = false;
18227 hungry = false;
18228 heartyMeal = false;
18229 starving = false;
18230 drippingSlime = false;
18231 drippingSparkleSlime = false;
18232 burned = false;
18233 suffocating = false;
18234 onFire2 = false;
18235 onFire3 = false;
18236 onFrostBurn = false;
18237 onFrostBurn2 = false;
18238 frostBurn = false;
18239 noItems = false;
18240 cursed = false;
18241 blockRange = 0;
18242 pickSpeed = 1f;
18243 wereWolf = false;
18244 rulerGrid = false;
18245 rulerLine = true;
18246 bleed = false;
18247 confused = false;
18248 witheredArmor = false;
18249 witheredWeapon = false;
18250 parryDamageBuff = false;
18251 slowOgreSpit = false;
18252 wings = 0;
18253 wingsLogic = 0;
18254 wingTimeMax = 0;
18255 brokenArmor = false;
18256 silence = false;
18257 slow = false;
18258 gross = false;
18259 tongued = false;
18260 kbGlove = false;
18261 autoReuseGlove = false;
18262 meleeScaleGlove = false;
18263 remoteVisionForDrone = false;
18264 kbBuff = false;
18265 starCloakItem = null;
18266 starCloakItem_manaCloakOverrideItem = null;
18267 starCloakItem_starVeilOverrideItem = null;
18268 starCloakItem_beeCloakOverrideItem = null;
18269 longInvince = false;
18270 pStone = false;
18271 manaFlower = false;
18272 crimsonRegen = false;
18273 ghostHeal = false;
18274 ghostHurt = false;
18275 turtleArmor = false;
18276 turtleThorns = false;
18277 cactusThorns = false;
18278 spiderArmor = false;
18279 anglerSetSpawnReduction = false;
18280 loveStruck = false;
18281 stinky = false;
18282 dryadWard = false;
18283 resistCold = false;
18284 electrified = false;
18285 moonLeech = false;
18286 headcovered = false;
18287 vortexDebuff = false;
18288 windPushed = false;
18289 ballistaPanic = false;
18290 vampireFrog = false;
18291 CanSeeInvisibleBlocks = false;
18292 setVortex = (setNebula = (setStardust = false));
18293 setForbidden = false;
18294 setHuntressT3 = false;
18295 setSquireT3 = false;
18296 setMonkT3 = false;
18297 setApprenticeT3 = false;
18298 setHuntressT2 = false;
18299 setSquireT2 = false;
18300 setMonkT2 = false;
18301 setApprenticeT2 = false;
18302 setForbiddenCooldownLocked = false;
18303 nebulaLevelDamage = (nebulaLevelLife = (nebulaLevelMana = 0));
18304 ignoreWater = false;
18305 meleeEnchant = 0;
18306 discountEquipped = false;
18307 hasLuckyCoin = false;
18308 boneGloveItem = null;
18309 hasLuck_LuckyCoin = false;
18310 hasLuck_LuckyHorseshoe = false;
18311 hasJumpOption_Cloud = false;
18312 hasJumpOption_Sail = false;
18313 hasJumpOption_Sandstorm = false;
18314 hasJumpOption_Blizzard = false;
18315 hasJumpOption_Fart = false;
18316 hasJumpOption_Unicorn = false;
18317 hasJumpOption_Santank = false;
18318 hasJumpOption_WallOfFleshGoat = false;
18319 hasJumpOption_Basilisk = false;
18320 defendedByPaladin = false;
18321 hasPaladinShield = false;
18322 hasLucyTheAxe = false;
18323 preventAllItemPickups = false;
18324 dontHurtCritters = false;
18325 dontHurtNature = false;
18326 portableStoolInfo.Reset();
18327 ResizeHitbox();
18328 autoJump = false;
18329 justJumped = false;
18330 jumpSpeedBoost = 0f;
18331 extraFall = 0;
18332 creativeGodMode = false;
18333 if (phantasmTime > 0)
18334 {
18335 phantasmTime--;
18336 }
18337 if (brainOfConfusionDodgeAnimationCounter > 0)
18338 {
18339 brainOfConfusionDodgeAnimationCounter--;
18340 }
18341 if (wireOperationsCooldown > 0)
18342 {
18343 wireOperationsCooldown--;
18344 }
18345 if (releaseUseItem)
18346 {
18347 ActuationRodLock = false;
18348 }
18349 for (int i = 0; i < npcTypeNoAggro.Length; i++)
18350 {
18351 npcTypeNoAggro[i] = false;
18352 }
18353 ResetProjectileCaches();
18354 if (whoAmI == Main.myPlayer && !isDisplayDollOrInanimate)
18355 {
18356 equipmentBasedLuckBonus = 0f;
18357 luckPotion = 0;
18358 tileRangeX = 5;
18359 tileRangeY = 4;
18360 if (Main.GameModeInfo.IsJourneyMode)
18361 {
18363 if (power.GetIsUnlocked() && power.IsEnabledForPlayer(whoAmI))
18364 {
18365 tileRangeX *= 2;
18366 tileRangeY *= 2;
18367 tileRangeX += 8;
18368 tileRangeY += 8;
18369 }
18370 }
18371 }
18372 mount.CheckMountBuff(this);
18373 }
18374
18376 {
18377 if (ladyBugLuckTimeLeft > 0)
18378 {
18379 ladyBugLuckTimeLeft -= Main.dayRate;
18380 if (ladyBugLuckTimeLeft < 0)
18381 {
18382 ladyBugLuckTimeLeft = 0;
18383 }
18384 }
18385 else if (ladyBugLuckTimeLeft < 0)
18386 {
18387 ladyBugLuckTimeLeft += Main.dayRate;
18388 if (ladyBugLuckTimeLeft > 0)
18389 {
18390 ladyBugLuckTimeLeft = 0;
18391 }
18392 }
18393 }
18394
18395 public void UpdateImmunity()
18396 {
18397 if (immune)
18398 {
18399 immuneTime--;
18400 if (immuneTime <= 0)
18401 {
18402 immune = false;
18403 immuneNoBlink = false;
18404 }
18405 if (immuneNoBlink)
18406 {
18407 immuneAlpha = 0;
18408 }
18409 else
18410 {
18411 immuneAlpha += immuneAlphaDirection * 50;
18412 if (immuneAlpha <= 50)
18413 {
18414 immuneAlphaDirection = 1;
18415 }
18416 else if (immuneAlpha >= 205)
18417 {
18418 immuneAlphaDirection = -1;
18419 }
18420 }
18421 }
18422 else
18423 {
18424 immuneAlpha = 0;
18425 }
18426 for (int i = 0; i < hurtCooldowns.Length; i++)
18427 {
18428 if (hurtCooldowns[i] > 0)
18429 {
18430 hurtCooldowns[i]--;
18431 }
18432 }
18433 }
18434
18435 private void TryToPoop()
18436 {
18437 if (whoAmI != Main.myPlayer || !wellFed)
18438 {
18439 return;
18440 }
18441 int maxValue = 600;
18442 if (Main.rand.Next(maxValue) != 0)
18443 {
18444 return;
18445 }
18446 int num = 3;
18447 int num2 = FindBuffIndex(207);
18448 if (num2 == -1)
18449 {
18450 num = 2;
18451 num2 = FindBuffIndex(206);
18452 }
18453 if (num2 == -1)
18454 {
18455 num = 1;
18456 num2 = FindBuffIndex(26);
18457 }
18458 if (num2 != -1)
18459 {
18460 int num3 = buffTime[num2];
18461 DelBuff(num2);
18462 int stack = Utils.Clamp(num3 / 3600 * num, num, 999);
18463 Vector2 mountedCenter = MountedCenter;
18465 {
18466 PositionInWorld = mountedCenter,
18467 MovementVector = new Vector2(-direction, 0f)
18468 }, whoAmI);
18469 int num4 = Item.NewItem(GetItemSource_Misc(9), mountedCenter, Vector2.Zero, 5395, stack, noBroadcast: false, 0, noGrabDelay: true);
18470 if (Main.netMode == 0)
18471 {
18472 Main.item[num4].noGrabDelay = 100;
18473 }
18474 if (Main.netMode == 1)
18475 {
18476 NetMessage.SendData(21, -1, -1, null, num4);
18477 }
18478 }
18479 }
18480
18481 public void UpdateLifeRegen()
18482 {
18483 bool flag = false;
18484 if (shinyStone && IsStandingStillForSpecialEffects && itemAnimation == 0)
18485 {
18486 flag = true;
18487 }
18488 if (poisoned)
18489 {
18490 if (lifeRegen > 0)
18491 {
18492 lifeRegen = 0;
18493 }
18494 lifeRegenTime = 0f;
18495 lifeRegen -= 4;
18496 }
18497 if (venom)
18498 {
18499 if (lifeRegen > 0)
18500 {
18501 lifeRegen = 0;
18502 }
18503 lifeRegenTime = 0f;
18504 lifeRegen -= 30;
18505 }
18506 if (onFire)
18507 {
18508 if (lifeRegen > 0)
18509 {
18510 lifeRegen = 0;
18511 }
18512 lifeRegenTime = 0f;
18513 lifeRegen -= 8;
18514 }
18515 if (onFire3)
18516 {
18517 if (lifeRegen > 0)
18518 {
18519 lifeRegen = 0;
18520 }
18521 lifeRegenTime = 0f;
18522 lifeRegen -= 8;
18523 }
18524 if (onFrostBurn)
18525 {
18526 if (lifeRegen > 0)
18527 {
18528 lifeRegen = 0;
18529 }
18530 lifeRegenTime = 0f;
18531 lifeRegen -= 16;
18532 }
18533 if (onFrostBurn2)
18534 {
18535 if (lifeRegen > 0)
18536 {
18537 lifeRegen = 0;
18538 }
18539 lifeRegenTime = 0f;
18540 lifeRegen -= 16;
18541 }
18542 if (onFire2)
18543 {
18544 if (lifeRegen > 0)
18545 {
18546 lifeRegen = 0;
18547 }
18548 lifeRegenTime = 0f;
18549 lifeRegen -= 24;
18550 }
18551 if (burned)
18552 {
18553 if (lifeRegen > 0)
18554 {
18555 lifeRegen = 0;
18556 }
18557 lifeRegenTime = 0f;
18558 lifeRegen -= 60;
18559 moveSpeed *= 0.5f;
18560 }
18561 if (suffocating)
18562 {
18563 if (lifeRegen > 0)
18564 {
18565 lifeRegen = 0;
18566 }
18567 lifeRegenTime = 0f;
18568 lifeRegen -= 40;
18569 }
18570 if (electrified)
18571 {
18572 if (lifeRegen > 0)
18573 {
18574 lifeRegen = 0;
18575 }
18576 lifeRegenTime = 0f;
18577 lifeRegen -= 8;
18578 if (controlLeft || controlRight)
18579 {
18580 lifeRegen -= 32;
18581 }
18582 }
18583 if (tongued && Main.expertMode)
18584 {
18585 if (lifeRegen > 0)
18586 {
18587 lifeRegen = 0;
18588 }
18589 lifeRegenTime = 0f;
18590 lifeRegen -= 100;
18591 }
18592 if (honey && lifeRegen < 0)
18593 {
18594 lifeRegen += 4;
18595 if (lifeRegen > 0)
18596 {
18597 lifeRegen = 0;
18598 }
18599 }
18601 {
18602 lifeRegen = 0;
18603 }
18604 if (flag && lifeRegen < 0)
18605 {
18606 lifeRegen /= 2;
18607 }
18608 lifeRegenTime += 1f;
18609 if (usedAegisCrystal)
18610 {
18611 lifeRegenTime += 0.2f;
18612 }
18613 if (crimsonRegen)
18614 {
18615 lifeRegenTime += 1f;
18616 }
18617 if (soulDrain > 0)
18618 {
18619 lifeRegenTime += 2f;
18620 }
18621 if (flag)
18622 {
18623 if (lifeRegenTime > 90f && lifeRegenTime < 1800f)
18624 {
18625 lifeRegenTime = 1800f;
18626 }
18627 lifeRegenTime += 4f;
18628 lifeRegen += 4;
18629 }
18630 if (honey)
18631 {
18632 lifeRegenTime += 2f;
18633 lifeRegen += 2;
18634 }
18635 if (starving)
18636 {
18637 if (lifeRegen > 0)
18638 {
18639 lifeRegen = 0;
18640 }
18641 if (lifeRegenCount > 0)
18642 {
18643 lifeRegenCount = 0;
18644 }
18645 if (lifeRegenTime > 0f)
18646 {
18647 lifeRegenTime = 0f;
18648 }
18649 int num = 3000;
18650 int num2 = 120 * statLifeMax2 / num;
18651 if (num2 < 4)
18652 {
18653 num2 = 4;
18654 }
18655 lifeRegen = -num2;
18656 }
18657 if (soulDrain > 0)
18658 {
18659 int num3 = (5 + soulDrain) / 2;
18660 lifeRegenTime += num3;
18661 lifeRegen += num3;
18662 }
18663 if (heartyMeal)
18664 {
18665 int num4 = 3 * 120 / 60;
18666 lifeRegen += num4;
18667 }
18668 if (whoAmI == Main.myPlayer && Main.SceneMetrics.HasCampfire)
18669 {
18670 lifeRegen++;
18671 }
18672 if (whoAmI == Main.myPlayer && Main.SceneMetrics.HasHeartLantern)
18673 {
18674 lifeRegen += 2;
18675 }
18676 if (bleed)
18677 {
18678 lifeRegenTime = 0f;
18679 }
18680 float num5 = 0f;
18681 if (lifeRegenTime >= 300f)
18682 {
18683 num5 += 1f;
18684 }
18685 if (lifeRegenTime >= 600f)
18686 {
18687 num5 += 1f;
18688 }
18689 if (lifeRegenTime >= 900f)
18690 {
18691 num5 += 1f;
18692 }
18693 if (lifeRegenTime >= 1200f)
18694 {
18695 num5 += 1f;
18696 }
18697 if (lifeRegenTime >= 1500f)
18698 {
18699 num5 += 1f;
18700 }
18701 if (lifeRegenTime >= 1800f)
18702 {
18703 num5 += 1f;
18704 }
18705 if (lifeRegenTime >= 2400f)
18706 {
18707 num5 += 1f;
18708 }
18709 if (lifeRegenTime >= 3000f)
18710 {
18711 num5 += 1f;
18712 }
18713 if (flag)
18714 {
18715 float num6 = lifeRegenTime - 3000f;
18716 num6 /= 300f;
18717 if (num6 > 0f)
18718 {
18719 if (num6 > 30f)
18720 {
18721 num6 = 30f;
18722 }
18723 num5 += num6;
18724 }
18725 }
18726 else if (lifeRegenTime >= 3600f)
18727 {
18728 num5 += 1f;
18729 lifeRegenTime = 3600f;
18730 }
18731 if (sitting.isSitting || sleeping.isSleeping)
18732 {
18733 lifeRegenTime += 3f;
18734 num5 *= 1.3f;
18735 }
18736 if (sitting.isSitting && sitting.details.IsAToilet)
18737 {
18738 TryToPoop();
18739 }
18740 num5 = ((velocity.X != 0f && grappling[0] <= 0) ? (num5 * 0.5f) : (num5 * 1.25f));
18741 if (crimsonRegen)
18742 {
18743 num5 *= 1.5f;
18744 }
18745 if (shinyStone)
18746 {
18747 num5 *= 1.1f;
18748 }
18749 if (whoAmI == Main.myPlayer && Main.SceneMetrics.HasCampfire)
18750 {
18751 num5 *= 1.1f;
18752 }
18753 if (Main.expertMode && !wellFed)
18754 {
18755 num5 = ((!shinyStone) ? (num5 / 2f) : (num5 * 0.75f));
18756 }
18757 if (rabid)
18758 {
18759 num5 = ((!shinyStone) ? (num5 / 2f) : (num5 * 0.75f));
18760 }
18761 float num7 = (float)statLifeMax2 / 400f * 0.85f + 0.15f;
18762 num5 *= num7;
18763 lifeRegen += (int)Math.Round(num5);
18764 lifeRegenCount += lifeRegen;
18765 if (palladiumRegen)
18766 {
18767 lifeRegenCount += 4;
18768 }
18769 if (flag && lifeRegen > 0 && statLife < statLifeMax2)
18770 {
18771 lifeRegenCount++;
18772 if (flag && ((float)Main.rand.Next(30000) < lifeRegenTime || Main.rand.Next(30) == 0))
18773 {
18774 int num8 = Dust.NewDust(position, width, height, 55, 0f, 0f, 200, default(Color), 0.5f);
18775 Main.dust[num8].noGravity = true;
18776 Main.dust[num8].velocity *= 0.75f;
18777 Main.dust[num8].fadeIn = 1.3f;
18778 Vector2 vector = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
18779 vector.Normalize();
18780 vector *= (float)Main.rand.Next(50, 100) * 0.04f;
18781 Main.dust[num8].velocity = vector;
18782 vector.Normalize();
18783 vector *= 34f;
18784 Main.dust[num8].position = base.Center - vector;
18785 }
18786 }
18787 while (lifeRegenCount >= 120)
18788 {
18789 lifeRegenCount -= 120;
18790 if (statLife < statLifeMax2)
18791 {
18792 statLife++;
18793 if (crimsonRegen)
18794 {
18795 for (int i = 0; i < 10; i++)
18796 {
18797 int num9 = Dust.NewDust(position, width, height, 5, 0f, 0f, 175, default(Color), 1.75f);
18798 Main.dust[num9].noGravity = true;
18799 Main.dust[num9].velocity *= 0.75f;
18800 int num10 = Main.rand.Next(-40, 41);
18801 int num11 = Main.rand.Next(-40, 41);
18802 Main.dust[num9].position.X += num10;
18803 Main.dust[num9].position.Y += num11;
18804 Main.dust[num9].velocity.X = (float)(-num10) * 0.075f;
18805 Main.dust[num9].velocity.Y = (float)(-num11) * 0.075f;
18806 }
18807 }
18808 }
18809 if (statLife > statLifeMax2)
18810 {
18811 statLife = statLifeMax2;
18812 }
18813 }
18814 if (burned || suffocating || (tongued && Main.expertMode))
18815 {
18816 while (lifeRegenCount <= -600)
18817 {
18818 lifeRegenCount += 600;
18819 statLife -= 5;
18820 CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, width, height), CombatText.LifeRegen, 5, dramatic: false, dot: true);
18821 if (statLife <= 0 && whoAmI == Main.myPlayer)
18822 {
18823 if (suffocating)
18824 {
18825 KillMe(PlayerDeathReason.ByOther(7), 10.0, 0);
18826 }
18827 else if (tongued)
18828 {
18829 KillMe(PlayerDeathReason.ByOther(12), 10.0, 0);
18830 }
18831 else
18832 {
18833 KillMe(PlayerDeathReason.ByOther(8), 10.0, 0);
18834 }
18835 }
18836 }
18837 return;
18838 }
18839 if (starving)
18840 {
18841 int num12 = statLifeMax2 / 50;
18842 if (num12 < 2)
18843 {
18844 num12 = 2;
18845 }
18846 int num13 = ((ZoneDesert || ZoneSnow) ? (num12 * 2) : num12);
18847 int num14 = 120 * num12;
18848 while (lifeRegenCount <= -num14)
18849 {
18850 lifeRegenCount += num14;
18851 statLife -= num13;
18852 CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, width, height), CombatText.LifeRegen, num13, dramatic: false, dot: true);
18853 if (statLife <= 0 && whoAmI == Main.myPlayer)
18854 {
18855 KillMe(PlayerDeathReason.ByOther(18), 10.0, 0);
18856 }
18857 }
18858 return;
18859 }
18860 while (lifeRegenCount <= -120)
18861 {
18862 if (lifeRegenCount <= -480)
18863 {
18864 lifeRegenCount += 480;
18865 statLife -= 4;
18866 CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, width, height), CombatText.LifeRegen, 4, dramatic: false, dot: true);
18867 }
18868 else if (lifeRegenCount <= -360)
18869 {
18870 lifeRegenCount += 360;
18871 statLife -= 3;
18872 CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, width, height), CombatText.LifeRegen, 3, dramatic: false, dot: true);
18873 }
18874 else if (lifeRegenCount <= -240)
18875 {
18876 lifeRegenCount += 240;
18877 statLife -= 2;
18878 CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, width, height), CombatText.LifeRegen, 2, dramatic: false, dot: true);
18879 }
18880 else
18881 {
18882 lifeRegenCount += 120;
18883 statLife--;
18884 CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, width, height), CombatText.LifeRegen, 1, dramatic: false, dot: true);
18885 }
18886 if (statLife <= 0 && whoAmI == Main.myPlayer)
18887 {
18888 if (poisoned || venom)
18889 {
18890 KillMe(PlayerDeathReason.ByOther(9), 10.0, 0);
18891 }
18892 else if (electrified)
18893 {
18894 KillMe(PlayerDeathReason.ByOther(10), 10.0, 0);
18895 }
18896 else
18897 {
18898 KillMe(PlayerDeathReason.ByOther(8), 10.0, 0);
18899 }
18900 }
18901 }
18902 }
18903
18904 public void UpdateManaRegen()
18905 {
18906 if (nebulaLevelMana > 0)
18907 {
18908 int num = 6;
18909 nebulaManaCounter += nebulaLevelMana;
18910 if (nebulaManaCounter >= num)
18911 {
18912 nebulaManaCounter -= num;
18913 statMana++;
18914 if (statMana >= statManaMax2)
18915 {
18916 statMana = statManaMax2;
18917 }
18918 }
18919 }
18920 else
18921 {
18922 nebulaManaCounter = 0;
18923 }
18924 if (manaRegenDelay > 0f)
18925 {
18926 manaRegenDelay -= 1f;
18927 manaRegenDelay -= manaRegenDelayBonus;
18928 if (IsStandingStillForSpecialEffects || grappling[0] >= 0 || manaRegenBuff)
18929 {
18930 manaRegenDelay -= 1f;
18931 }
18932 if (usedArcaneCrystal)
18933 {
18934 manaRegenDelay -= 0.05f;
18935 }
18936 }
18937 if (manaRegenBuff && manaRegenDelay > 20f)
18938 {
18939 manaRegenDelay = 20f;
18940 }
18941 if (manaRegenDelay <= 0f)
18942 {
18943 manaRegenDelay = 0f;
18944 manaRegen = statManaMax2 / 3 + 1 + manaRegenBonus;
18945 if (IsStandingStillForSpecialEffects || grappling[0] >= 0 || manaRegenBuff)
18946 {
18947 manaRegen += statManaMax2 / 3;
18948 }
18949 if (usedArcaneCrystal)
18950 {
18951 manaRegen += statManaMax2 / 50;
18952 }
18953 float num2 = (float)statMana / (float)statManaMax2 * 0.8f + 0.2f;
18954 if (manaRegenBuff)
18955 {
18956 num2 = 1f;
18957 }
18958 manaRegen = (int)((double)((float)manaRegen * num2) * 1.15);
18959 }
18960 else
18961 {
18962 manaRegen = 0;
18963 }
18964 manaRegenCount += manaRegen;
18965 while (manaRegenCount >= 120)
18966 {
18967 bool flag = false;
18968 manaRegenCount -= 120;
18969 if (statMana < statManaMax2)
18970 {
18971 statMana++;
18972 flag = true;
18973 }
18974 if (statMana < statManaMax2)
18975 {
18976 continue;
18977 }
18978 if (whoAmI == Main.myPlayer && flag)
18979 {
18981 for (int i = 0; i < 5; i++)
18982 {
18983 int num3 = Dust.NewDust(position, width, height, 45, 0f, 0f, 255, default(Color), (float)Main.rand.Next(20, 26) * 0.1f);
18984 Main.dust[num3].noLight = true;
18985 Main.dust[num3].noGravity = true;
18986 Main.dust[num3].velocity *= 0.5f;
18987 }
18988 }
18989 statMana = statManaMax2;
18990 }
18991 }
18992
18993 public void UpdateJumpHeight()
18994 {
18995 if (mount.Active)
18996 {
18997 jumpHeight = mount.JumpHeight(velocity.X);
18998 jumpSpeed = mount.JumpSpeed(velocity.X);
18999 }
19000 else
19001 {
19002 if (jumpBoost)
19003 {
19004 jumpHeight = 20;
19005 jumpSpeed = 6.51f;
19006 }
19007 if (empressBrooch)
19008 {
19009 jumpSpeedBoost += 1.8f;
19010 }
19011 if (frogLegJumpBoost)
19012 {
19013 jumpSpeedBoost += 2.4f;
19014 extraFall += 15;
19015 }
19016 if (moonLordLegs)
19017 {
19018 jumpSpeedBoost += 1.8f;
19019 extraFall += 10;
19020 jumpHeight++;
19021 }
19022 if (wereWolf)
19023 {
19024 jumpHeight += 2;
19025 jumpSpeed += 0.2f;
19026 }
19027 if (portableStoolInfo.IsInUse)
19028 {
19029 jumpHeight += 5;
19030 }
19031 jumpSpeed += jumpSpeedBoost;
19032 }
19033 if (sticky)
19034 {
19035 jumpHeight /= 10;
19036 jumpSpeed /= 5f;
19037 }
19038 if (dazed)
19039 {
19040 jumpHeight /= 5;
19041 jumpSpeed /= 2f;
19042 }
19043 }
19044
19045 public void FindPulley()
19046 {
19047 if (portableStoolInfo.IsInUse || (!controlUp && !controlDown))
19048 {
19049 return;
19050 }
19051 int num = (int)(position.X + (float)(width / 2)) / 16;
19052 int num2 = (int)(position.Y - 8f) / 16;
19053 if (!WorldGen.IsRope(num, num2))
19054 {
19055 return;
19056 }
19057 float num3 = position.Y;
19058 if (Main.tile[num, num2 - 1] == null)
19059 {
19060 Main.tile[num, num2 - 1] = new Tile();
19061 }
19062 if (Main.tile[num, num2 + 1] == null)
19063 {
19064 Main.tile[num, num2 + 1] = new Tile();
19065 }
19066 if ((!Main.tile[num, num2 - 1].active() || !Main.tileRope[Main.tile[num, num2 - 1].type]) && (!Main.tile[num, num2 + 1].active() || !Main.tileRope[Main.tile[num, num2 + 1].type]))
19067 {
19068 num3 = num2 * 16 + 22;
19069 }
19070 float num4 = num * 16 + 8 - width / 2 + 6 * direction;
19071 int num5 = num * 16 + 8 - width / 2 + 6;
19072 int num6 = num * 16 + 8 - width / 2;
19073 int num7 = num * 16 + 8 - width / 2 + -6;
19074 int num8 = 1;
19075 float num9 = Math.Abs(position.X - (float)num5);
19076 if (Math.Abs(position.X - (float)num6) < num9)
19077 {
19078 num8 = 2;
19079 num9 = Math.Abs(position.X - (float)num6);
19080 }
19081 if (Math.Abs(position.X - (float)num7) < num9)
19082 {
19083 num8 = 3;
19084 num9 = Math.Abs(position.X - (float)num7);
19085 }
19086 if (num8 == 1)
19087 {
19088 num4 = num5;
19089 pulleyDir = 2;
19090 direction = 1;
19091 }
19092 if (num8 == 2)
19093 {
19094 num4 = num6;
19095 pulleyDir = 1;
19096 }
19097 if (num8 == 3)
19098 {
19099 num4 = num7;
19100 pulleyDir = 2;
19101 direction = -1;
19102 }
19103 if (!Collision.SolidCollision(new Vector2(num4, position.Y), width, height))
19104 {
19105 if (whoAmI == Main.myPlayer)
19106 {
19107 Main.cameraX = Main.cameraX + position.X - num4;
19108 }
19109 pulley = true;
19110 position.X = num4;
19111 gfxOffY = position.Y - num3;
19112 stepSpeed = 2.5f;
19113 position.Y = num3;
19114 velocity.X = 0f;
19115 return;
19116 }
19117 num4 = num5;
19118 pulleyDir = 2;
19119 direction = 1;
19120 if (!Collision.SolidCollision(new Vector2(num4, position.Y), width, height))
19121 {
19122 if (whoAmI == Main.myPlayer)
19123 {
19124 Main.cameraX = Main.cameraX + position.X - num4;
19125 }
19126 pulley = true;
19127 position.X = num4;
19128 gfxOffY = position.Y - num3;
19129 stepSpeed = 2.5f;
19130 position.Y = num3;
19131 velocity.X = 0f;
19132 return;
19133 }
19134 num4 = num7;
19135 pulleyDir = 2;
19136 direction = -1;
19137 if (!Collision.SolidCollision(new Vector2(num4, position.Y), width, height))
19138 {
19139 if (whoAmI == Main.myPlayer)
19140 {
19141 Main.cameraX = Main.cameraX + position.X - num4;
19142 }
19143 pulley = true;
19144 position.X = num4;
19145 gfxOffY = position.Y - num3;
19146 stepSpeed = 2.5f;
19147 position.Y = num3;
19148 velocity.X = 0f;
19149 }
19150 }
19151
19153 {
19154 if (chilled)
19155 {
19156 accRunSpeed = maxRunSpeed;
19157 }
19158 bool flag = (itemAnimation == 0 || inventory[selectedItem].useTurn) && mount.AllowDirectionChange;
19159 bool flag2 = controlLeft || controlRight;
19160 float num = (accRunSpeed + maxRunSpeed) / 2f;
19161 float num2 = 0f;
19162 bool flag3 = false;
19163 if (flag2 && mount.Active && mount.Type == 43 && velocity.Y == 0f && !controlJump)
19164 {
19166 float num3 = jumpSpeed * gravDir * 0.5f;
19167 if (num3 < 2f)
19168 {
19169 num3 = 2f;
19170 }
19171 num3 += 0.01f;
19172 velocity.Y = 0f - num3;
19173 jump = jumpHeight;
19174 fullRotation = 0f;
19175 return;
19176 }
19177 if (windPushed && !isLockedToATile && !(mount.Active && velocity.Y == 0f && flag2))
19178 {
19179 num2 = (float)Math.Sign(Main.windSpeedCurrent) * 0.06f;
19180 if (Math.Abs(Main.windSpeedCurrent) > 0.5f)
19181 {
19182 num2 *= 1.37f;
19183 }
19184 if (velocity.Y != 0f)
19185 {
19186 num2 *= 1.5f;
19187 }
19188 if (flag2)
19189 {
19190 num2 *= 0.8f;
19191 float num4 = 0.072f;
19192 num2 = MathHelper.Clamp(num2, 0f - num4, num4);
19193 }
19194 flag3 = true;
19195 if (Math.Sign(direction) != Math.Sign(num2))
19196 {
19197 num -= Math.Abs(num2) * 40f;
19198 }
19199 }
19200 if (trackBoost != 0f)
19201 {
19202 velocity.X += trackBoost;
19203 trackBoost = 0f;
19204 if (velocity.X < 0f)
19205 {
19206 if (velocity.X < 0f - maxRunSpeed)
19207 {
19208 velocity.X = 0f - maxRunSpeed;
19209 }
19210 }
19211 else if (velocity.X > maxRunSpeed)
19212 {
19213 velocity.X = maxRunSpeed;
19214 }
19215 }
19216 if (controlLeft && velocity.X > 0f - maxRunSpeed)
19217 {
19218 if (!mount.Active || !mount.Cart || velocity.Y == 0f)
19219 {
19220 if (velocity.X > runSlowdown)
19221 {
19222 velocity.X -= runSlowdown;
19223 }
19224 velocity.X -= runAcceleration;
19225 }
19226 if (onWrongGround)
19227 {
19228 if (velocity.X < 0f - runSlowdown)
19229 {
19230 velocity.X += runSlowdown;
19231 }
19232 else
19233 {
19234 velocity.X = 0f;
19235 }
19236 }
19237 if (mount.Active && mount.Cart && !onWrongGround)
19238 {
19239 if (velocity.X < 0f && flag)
19240 {
19241 direction = -1;
19242 }
19243 else if (itemAnimation <= 0 && velocity.Y == 0f)
19244 {
19245 SoundEngine.PlaySound(SoundID.Item55, (int)position.X + width / 2, (int)position.Y + height / 2);
19246 DelegateMethods.Minecart.rotation = fullRotation;
19247 DelegateMethods.Minecart.rotationOrigin = fullRotationOrigin;
19248 if ((double)Math.Abs(velocity.X) > (double)maxRunSpeed * 0.66)
19249 {
19250 if (Main.rand.Next(2) == 0)
19251 {
19252 Minecart.WheelSparks(mount.Delegations.MinecartDust, position + velocity * 0.66f, width, height, 1);
19253 }
19254 if (Main.rand.Next(2) == 0)
19255 {
19256 Minecart.WheelSparks(mount.Delegations.MinecartDust, position + velocity * 0.33f, width, height, 1);
19257 }
19258 if (Main.rand.Next(2) == 0)
19259 {
19260 Minecart.WheelSparks(mount.Delegations.MinecartDust, position, width, height, 1);
19261 }
19262 }
19263 else if ((double)Math.Abs(velocity.X) > (double)maxRunSpeed * 0.33)
19264 {
19265 if (Main.rand.Next(3) != 0)
19266 {
19267 Minecart.WheelSparks(mount.Delegations.MinecartDust, position + velocity * 0.5f, width, height, 1);
19268 }
19269 if (Main.rand.Next(3) != 0)
19270 {
19271 Minecart.WheelSparks(mount.Delegations.MinecartDust, position, width, height, 1);
19272 }
19273 }
19274 else
19275 {
19276 Minecart.WheelSparks(mount.Delegations.MinecartDust, position, width, height, 1);
19277 }
19278 }
19279 }
19280 else if (!sandStorm && (itemAnimation == 0 || inventory[selectedItem].useTurn) && mount.AllowDirectionChange)
19281 {
19282 direction = -1;
19283 }
19284 }
19285 else if (controlRight && velocity.X < maxRunSpeed)
19286 {
19287 if (!mount.Active || !mount.Cart || velocity.Y == 0f)
19288 {
19289 if (velocity.X < 0f - runSlowdown)
19290 {
19291 velocity.X += runSlowdown;
19292 }
19293 velocity.X += runAcceleration;
19294 }
19295 if (onWrongGround)
19296 {
19297 if (velocity.X > runSlowdown)
19298 {
19299 velocity.X -= runSlowdown;
19300 }
19301 else
19302 {
19303 velocity.X = 0f;
19304 }
19305 }
19306 if (mount.Active && mount.Cart && !onWrongGround)
19307 {
19308 if (velocity.X > 0f && flag)
19309 {
19310 direction = 1;
19311 }
19312 else if (itemAnimation <= 0 && velocity.Y == 0f)
19313 {
19314 SoundEngine.PlaySound(SoundID.Item55, (int)position.X + width / 2, (int)position.Y + height / 2);
19315 DelegateMethods.Minecart.rotation = fullRotation;
19316 DelegateMethods.Minecart.rotationOrigin = fullRotationOrigin;
19317 if ((double)Math.Abs(velocity.X) > (double)maxRunSpeed * 0.66)
19318 {
19319 if (Main.rand.Next(2) == 0)
19320 {
19321 Minecart.WheelSparks(mount.Delegations.MinecartDust, position + velocity * 0.66f, width, height, 1);
19322 }
19323 if (Main.rand.Next(2) == 0)
19324 {
19325 Minecart.WheelSparks(mount.Delegations.MinecartDust, position + velocity * 0.33f, width, height, 1);
19326 }
19327 if (Main.rand.Next(2) == 0)
19328 {
19329 Minecart.WheelSparks(mount.Delegations.MinecartDust, position, width, height, 1);
19330 }
19331 }
19332 else if ((double)Math.Abs(velocity.X) > (double)maxRunSpeed * 0.33)
19333 {
19334 if (Main.rand.Next(3) != 0)
19335 {
19336 Minecart.WheelSparks(mount.Delegations.MinecartDust, position + velocity * 0.5f, width, height, 1);
19337 }
19338 if (Main.rand.Next(3) != 0)
19339 {
19340 Minecart.WheelSparks(mount.Delegations.MinecartDust, position, width, height, 1);
19341 }
19342 }
19343 else
19344 {
19345 Minecart.WheelSparks(mount.Delegations.MinecartDust, position, width, height, 1);
19346 }
19347 }
19348 }
19349 else if (!sandStorm && (itemAnimation == 0 || inventory[selectedItem].useTurn) && mount.AllowDirectionChange)
19350 {
19351 direction = 1;
19352 }
19353 }
19354 else if (controlLeft && velocity.X > 0f - accRunSpeed && dashDelay >= 0)
19355 {
19356 if (mount.Active && mount.Cart)
19357 {
19358 if (velocity.X < 0f)
19359 {
19360 direction = -1;
19361 }
19362 }
19363 else if ((itemAnimation == 0 || inventory[selectedItem].useTurn) && mount.AllowDirectionChange)
19364 {
19365 direction = -1;
19366 }
19367 if (velocity.Y == 0f || wingsLogic > 0 || mount.CanFly())
19368 {
19369 if (velocity.X > runSlowdown)
19370 {
19371 velocity.X -= runSlowdown;
19372 }
19373 velocity.X -= runAcceleration * 0.2f;
19374 if (wingsLogic > 0)
19375 {
19376 velocity.X -= runAcceleration * 0.2f;
19377 }
19378 }
19379 if (onWrongGround)
19380 {
19381 if (velocity.X < runSlowdown)
19382 {
19383 velocity.X += runSlowdown;
19384 }
19385 else
19386 {
19387 velocity.X = 0f;
19388 }
19389 }
19390 if (velocity.X < 0f - num && velocity.Y == 0f && !mount.Active)
19391 {
19392 SpawnFastRunParticles();
19393 }
19394 }
19395 else if (controlRight && velocity.X < accRunSpeed && dashDelay >= 0)
19396 {
19397 if (mount.Active && mount.Cart)
19398 {
19399 if (velocity.X > 0f)
19400 {
19401 direction = -1;
19402 }
19403 }
19404 else if ((itemAnimation == 0 || inventory[selectedItem].useTurn) && mount.AllowDirectionChange)
19405 {
19406 direction = 1;
19407 }
19408 if (velocity.Y == 0f || wingsLogic > 0 || mount.CanFly())
19409 {
19410 if (velocity.X < 0f - runSlowdown)
19411 {
19412 velocity.X += runSlowdown;
19413 }
19414 velocity.X += runAcceleration * 0.2f;
19415 if (wingsLogic > 0)
19416 {
19417 velocity.X += runAcceleration * 0.2f;
19418 }
19419 }
19420 if (onWrongGround)
19421 {
19422 if (velocity.X > runSlowdown)
19423 {
19424 velocity.X -= runSlowdown;
19425 }
19426 else
19427 {
19428 velocity.X = 0f;
19429 }
19430 }
19431 if (velocity.X > num && velocity.Y == 0f && !mount.Active)
19432 {
19433 SpawnFastRunParticles();
19434 }
19435 }
19436 else if (mount.Active && mount.Cart && Math.Abs(velocity.X) >= 1f)
19437 {
19438 if (onWrongGround)
19439 {
19440 if (velocity.X > 0f)
19441 {
19442 if (velocity.X > runSlowdown)
19443 {
19444 velocity.X -= runSlowdown;
19445 }
19446 else
19447 {
19448 velocity.X = 0f;
19449 }
19450 }
19451 else if (velocity.X < 0f)
19452 {
19453 if (velocity.X < 0f - runSlowdown)
19454 {
19455 velocity.X += runSlowdown;
19456 }
19457 else
19458 {
19459 velocity.X = 0f;
19460 }
19461 }
19462 }
19463 if (velocity.X > maxRunSpeed)
19464 {
19465 velocity.X = maxRunSpeed;
19466 }
19467 if (velocity.X < 0f - maxRunSpeed)
19468 {
19469 velocity.X = 0f - maxRunSpeed;
19470 }
19471 }
19472 else if (velocity.Y == 0f)
19473 {
19474 if (velocity.X > runSlowdown)
19475 {
19476 velocity.X -= runSlowdown;
19477 }
19478 else if (velocity.X < 0f - runSlowdown)
19479 {
19480 velocity.X += runSlowdown;
19481 }
19482 else
19483 {
19484 velocity.X = 0f;
19485 }
19486 }
19487 else if (!PortalPhysicsEnabled)
19488 {
19489 if ((double)velocity.X > (double)runSlowdown * 0.5)
19490 {
19491 velocity.X -= runSlowdown * 0.5f;
19492 }
19493 else if ((double)velocity.X < (double)(0f - runSlowdown) * 0.5)
19494 {
19495 velocity.X += runSlowdown * 0.5f;
19496 }
19497 else
19498 {
19499 velocity.X = 0f;
19500 }
19501 }
19502 if (flag3)
19503 {
19505 {
19506 velocity.X += num2;
19507 if (velocity.X < num2)
19508 {
19509 velocity.X = num2;
19510 }
19511 }
19512 if (num2 > 0f && velocity.X < num2)
19513 {
19514 velocity.X += num2;
19515 if (velocity.X > num2)
19516 {
19517 velocity.X = num2;
19518 }
19519 }
19520 }
19521 bool flag4 = mount.Type == 40 || mount.Type == 41 || mount.Type == 42;
19522 if (mount.Active && (mount.Type == 10 || mount.Type == 47 || flag4) && Math.Abs(velocity.X) > mount.DashSpeed - mount.RunSpeed / 2f)
19523 {
19524 Rectangle rect = getRect();
19525 if (direction == 1)
19526 {
19527 rect.Offset(width - 1, 0);
19528 }
19529 rect.Width = 2;
19530 rect.Inflate(6, 12);
19531 int num5 = 60;
19532 if (flag4)
19533 {
19534 num5 = 30;
19535 }
19536 float damage = (float)num5 * minionDamage;
19537 float knockback = 10f;
19538 if (flag4)
19539 {
19540 knockback = 7f;
19541 }
19542 int nPCImmuneTime = 30;
19543 int playerImmuneTime = 6;
19544 CollideWithNPCs(rect, damage, knockback, nPCImmuneTime, playerImmuneTime);
19545 }
19546 if (mount.Active && mount.Type == 44 && Math.Abs(velocity.X) > mount.DashSpeed - mount.RunSpeed / 4f)
19547 {
19548 Rectangle rect2 = getRect();
19549 if (direction == 1)
19550 {
19551 rect2.Offset(width - 1, 0);
19552 }
19553 rect2.Width = 2;
19554 rect2.Inflate(6, 12);
19555 float damage2 = 100f * minionDamage;
19556 float knockback2 = 12f;
19557 int nPCImmuneTime2 = 30;
19558 int playerImmuneTime2 = 6;
19560 }
19561 if (mount.Active && mount.Type == 45 && Math.Abs(velocity.X) > mount.DashSpeed * 0.9f)
19562 {
19563 Rectangle rect3 = getRect();
19564 if (direction == 1)
19565 {
19566 rect3.Offset(width - 1, 0);
19567 }
19568 rect3.Width = 2;
19569 rect3.Inflate(6, 12);
19570 float damage3 = 120f * minionDamage;
19571 float knockback3 = 12f;
19572 int nPCImmuneTime3 = 30;
19573 int playerImmuneTime3 = 6;
19575 }
19576 if (mount.Active && mount.Type == 14 && Math.Abs(velocity.X) > mount.RunSpeed / 2f)
19577 {
19578 Rectangle rect4 = getRect();
19579 if (direction == 1)
19580 {
19581 rect4.Offset(width - 1, 0);
19582 }
19583 rect4.Width = 2;
19584 rect4.Inflate(6, 12);
19585 float damage4 = 90f * minionDamage;
19586 float knockback4 = 10f;
19587 int nPCImmuneTime4 = 30;
19588 int playerImmuneTime4 = 6;
19590 }
19591 if (mount.Active && mount.Type == 17 && Math.Abs(velocity.X) > mount.RunSpeed / 2f)
19592 {
19593 Rectangle rect5 = getRect();
19594 if (direction == 1)
19595 {
19596 rect5.Offset(width - 1, 0);
19597 }
19598 rect5.Width = 2;
19599 rect5.Inflate(6, 12);
19600 float damage5 = 40f * minionDamage;
19601 float knockback5 = 10f;
19602 int nPCImmuneTime5 = 30;
19603 int playerImmuneTime5 = 12;
19605 }
19606 TryUsingDiggerCart();
19607 if (HeldItem.type == 4049 && whoAmI == Main.myPlayer)
19608 {
19609 MowTheLawn();
19610 }
19611 }
19612
19613 private void TryUsingDiggerCart()
19614 {
19615 if (whoAmI == Main.myPlayer && mount.Active && mount.Type == 39 && velocity.Y == 0f)
19616 {
19617 int num = 12;
19618 int num2 = 20;
19619 Vector2 vector = new Vector2(0f, gravDir * 10f);
19620 Vector2 trackWorldPosition = RotatedRelativePoint(base.Center + new Vector2(num * direction, gravDir * (float)num2));
19623 if (!tileSafely.active() || tileSafely.type != 314)
19624 {
19625 trackWorldPosition = RotatedRelativePoint(base.Center + new Vector2((float)(num * direction) * 0.5f, gravDir * (float)num2));
19627 }
19628 int digDirectionY = controlDown.ToInt() - controlUp.ToInt();
19629 if (controlUp.ToInt() + controlDown.ToInt() + controlLeft.ToInt() + controlRight.ToInt() > 0)
19630 {
19631 MinecartDiggerHelper.Instance.TryDigging(this, trackWorldPosition, direction, digDirectionY);
19632 }
19633 }
19634 }
19635
19637 {
19638 int num = 0;
19639 if (gravDir == -1f)
19640 {
19641 num -= height;
19642 }
19643 if (runSoundDelay == 0 && velocity.Y == 0f)
19644 {
19645 SoundEngine.PlaySound(hermesStepSound.SoundType, (int)position.X, (int)position.Y, hermesStepSound.SoundStyle);
19646 runSoundDelay = hermesStepSound.IntendedCooldown;
19647 }
19648 if (wings == 3)
19649 {
19650 int num2 = Dust.NewDust(new Vector2(position.X - 4f, position.Y + (float)height + (float)num), width + 8, 4, 186, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 50, default(Color), 1.5f);
19651 Main.dust[num2].velocity *= 0.025f;
19652 Main.dust[num2].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
19653 num2 = Dust.NewDust(new Vector2(position.X - 4f, position.Y + (float)height + (float)num), width + 8, 4, 186, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 50, default(Color), 1.5f);
19654 Main.dust[num2].velocity *= 0.2f;
19655 Main.dust[num2].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
19656 }
19657 else if (sailDash)
19658 {
19659 for (int i = 0; i < 4; i++)
19660 {
19661 int num3 = Dust.NewDust(new Vector2(position.X - 4f, position.Y), width + 8, height, 253, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 100, default(Color), 1.5f);
19662 Main.dust[num3].noGravity = true;
19663 Main.dust[num3].velocity.X = Main.dust[num3].velocity.X * 0.2f;
19664 Main.dust[num3].velocity.Y = Main.dust[num3].velocity.Y * 0.2f;
19665 Main.dust[num3].shader = GameShaders.Armor.GetSecondaryShader(cShoe, this);
19666 Main.dust[num3].scale += (float)Main.rand.Next(-5, 3) * 0.1f;
19667 Vector2 vector = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
19668 vector.Normalize();
19669 vector *= (float)Main.rand.Next(81) * 0.1f;
19670 }
19671 }
19672 else if (desertDash)
19673 {
19674 Dust dust = Dust.NewDustDirect(new Vector2(position.X - 4f, position.Y + (float)height + (float)num), width + 8, 4, 32, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f);
19675 dust.velocity *= 0.2f;
19676 dust.velocity.Y -= gravDir * 2f;
19677 dust.shader = GameShaders.Armor.GetSecondaryShader(cShoe, this);
19678 }
19679 else if (coldDash)
19680 {
19681 for (int j = 0; j < 2; j++)
19682 {
19683 int num4 = ((j != 0) ? Dust.NewDust(new Vector2(position.X + (float)(width / 2), position.Y + (float)height + gfxOffY), width / 2, 6, 76, 0f, 0f, 0, default(Color), 1.35f) : Dust.NewDust(new Vector2(position.X, position.Y + (float)height + gfxOffY), width / 2, 6, 76, 0f, 0f, 0, default(Color), 1.35f));
19684 Main.dust[num4].scale *= 1f + (float)Main.rand.Next(20, 40) * 0.01f;
19685 Main.dust[num4].noGravity = true;
19686 Main.dust[num4].noLight = true;
19687 Main.dust[num4].velocity *= 0.001f;
19688 Main.dust[num4].velocity.Y -= 0.003f;
19689 Main.dust[num4].shader = GameShaders.Armor.GetSecondaryShader(cShoe, this);
19690 }
19691 }
19692 else if (fairyBoots)
19693 {
19694 int type = Main.rand.NextFromList(new short[6] { 61, 61, 61, 242, 64, 63 });
19695 int alpha = 0;
19696 for (int k = 1; k < 3; k++)
19697 {
19698 float scale = 1.5f;
19699 if (k == 2)
19700 {
19701 scale = 1f;
19702 }
19703 int num5 = Dust.NewDust(new Vector2(position.X - 4f, position.Y + (float)height + (float)num), width + 8, 4, type, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, alpha, default(Color), scale);
19704 Main.dust[num5].velocity *= 1.5f;
19705 if (k == 2)
19706 {
19707 Main.dust[num5].position += Main.dust[num5].velocity;
19708 }
19709 Main.dust[num5].noGravity = true;
19710 Main.dust[num5].noLightEmittence = true;
19711 Main.dust[num5].shader = GameShaders.Armor.GetSecondaryShader(cShoe, this);
19712 }
19713 }
19714 else if (hellfireTreads)
19715 {
19716 int num6 = Dust.NewDust(new Vector2(position.X - 4f, position.Y + (float)height + (float)num), width + 8, 4, 6, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 50, default(Color), 2f);
19717 Main.dust[num6].velocity.X = Main.dust[num6].velocity.X * 0.2f;
19718 Main.dust[num6].velocity.Y = -1.5f - Main.rand.NextFloat() * 0.5f;
19719 Main.dust[num6].fadeIn = 0.5f;
19720 Main.dust[num6].noGravity = true;
19721 Main.dust[num6].shader = GameShaders.Armor.GetSecondaryShader(cShoe, this);
19722 }
19723 else
19724 {
19725 int num7 = Dust.NewDust(new Vector2(position.X - 4f, position.Y + (float)height + (float)num), width + 8, 4, 16, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 50, default(Color), 1.5f);
19726 Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f;
19727 Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f;
19728 Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(cShoe, this);
19729 }
19730 }
19731
19732 private void MowTheLawn()
19733 {
19734 if (miscCounter % 2 != 0 || velocity.Y != 0f || grappling[0] != -1 || itemAnimation < 1)
19735 {
19736 return;
19737 }
19738 Vector2 vector = base.Center + new Vector2(direction * 38, (float)(height / 2 + 4) * gravDir);
19739 float num = 1f - (float)itemAnimation / (float)itemAnimationMax;
19740 num *= 2f;
19741 num = ((!(num < 1f)) ? (num - 1f) : (1f - num));
19742 Vector2 value = vector + new Vector2(direction * -16, gravDir * -4f);
19743 Vector2 value2 = vector + new Vector2(direction * -6, gravDir * -4f);
19744 Dust dust = Dust.NewDustDirect(Vector2.Lerp(value, value2, num), 0, 0, 31, 0f, (0f - gravDir) * 0.25f, 127);
19745 dust.scale = 0.9f;
19746 dust.position -= new Vector2(4f);
19747 if (dust.velocity.Y > 0f)
19748 {
19749 dust.velocity.Y *= -1f;
19750 }
19751 dust.velocity *= 0.25f;
19753 if (velocity.X * (float)direction > 0f || velocity.Y * gravDir > 0f)
19754 {
19756 myRect.Height -= 4;
19757 myRect.Y += 2;
19758 float damage = 8f;
19759 float knockback = 2f;
19760 int nPCImmuneTime = 12;
19761 int playerImmuneTime = 6;
19762 CollideWithNPCs(myRect, damage, knockback, nPCImmuneTime, playerImmuneTime);
19763 }
19764 rectangle.X -= direction * 10;
19765 if (whoAmI == Main.myPlayer)
19766 {
19767 bool[] shouldIgnore = ItemCheck_GetTileCutIgnoreList(HeldItem);
19768 ItemCheck_CutTiles(HeldItem, rectangle, shouldIgnore);
19769 MowGrassTile(vector);
19770 if (!WorldGen.SolidTile(Framing.GetTileSafely(vector.ToTileCoordinates())))
19771 {
19772 MowGrassTile(vector + new Vector2(0f, 16f * gravDir));
19773 }
19774 }
19775 }
19776
19778 {
19779 Point point = thePos.ToTileCoordinates();
19780 Tile tile = Main.tile[point.X, point.Y];
19781 if (tile == null || !WorldGen.CanKillTile(point.X, point.Y, WorldGen.SpecialKillTileContext.MowingTheGrass))
19782 {
19783 return;
19784 }
19785 ushort num = 0;
19786 switch (tile.type)
19787 {
19788 case 2:
19789 num = 477;
19790 break;
19791 case 109:
19792 num = 492;
19793 break;
19794 }
19795 if (num != 0)
19796 {
19797 int num2 = WorldGen.KillTile_GetTileDustAmount(fail: true, tile);
19798 for (int i = 0; i < num2; i++)
19799 {
19800 WorldGen.KillTile_MakeTileDust(point.X, point.Y, tile);
19801 }
19802 tile.type = num;
19803 if (Main.netMode == 1)
19804 {
19805 NetMessage.SendTileSquare(-1, point.X, point.Y);
19806 }
19807 }
19808 }
19809
19811 {
19812 int num = 0;
19813 for (int i = 0; i < 200; i++)
19814 {
19815 NPC nPC = Main.npc[i];
19816 if (!nPC.active || nPC.dontTakeDamage || nPC.friendly || nPC.immune[whoAmI] != 0 || !CanNPCBeHitByPlayerOrPlayerProjectile(nPC))
19817 {
19818 continue;
19819 }
19820 Rectangle rect = nPC.getRect();
19821 if (myRect.Intersects(rect) && (nPC.noTileCollide || Collision.CanHit(position, width, height, nPC.position, nPC.width, nPC.height)))
19822 {
19823 int num2 = direction;
19824 if (velocity.X < 0f)
19825 {
19826 num2 = -1;
19827 }
19828 if (velocity.X > 0f)
19829 {
19830 num2 = 1;
19831 }
19832 if (whoAmI == Main.myPlayer)
19833 {
19834 ApplyDamageToNPC(nPC, (int)Damage, Knockback, num2, crit: false);
19835 }
19836 nPC.immune[whoAmI] = NPCImmuneTime;
19837 GiveImmuneTimeForCollisionAttack(PlayerImmuneTime);
19838 num++;
19839 break;
19840 }
19841 }
19842 return num;
19843 }
19844
19845 public void ApplyDamageToNPC(NPC npc, int damage, float knockback, int direction, bool crit)
19846 {
19847 int num = Item.NPCtoBanner(npc.BannerID());
19848 if (num > 0 && HasNPCBannerBuff(num))
19849 {
19850 damage = ((!Main.expertMode) ? ((int)((float)damage * ItemID.Sets.BannerStrength[Item.BannerToItem(num)].NormalDamageDealt)) : ((int)((float)damage * ItemID.Sets.BannerStrength[Item.BannerToItem(num)].ExpertDamageDealt)));
19851 }
19852 OnHit(npc.Center.X, npc.Center.Y, npc);
19853 damage += npc.checkArmorPenetration(armorPenetration, 0f);
19855 int dmg = (int)npc.StrikeNPC(damage, knockback, direction, crit);
19856 if (accDreamCatcher)
19857 {
19858 addDPS(dmg);
19859 }
19860 if (Main.netMode != 0)
19861 {
19862 NetMessage.SendData(28, -1, -1, null, npc.whoAmI, damage, knockback, direction, crit.ToInt());
19863 }
19864 int num2 = Item.NPCtoBanner(npc.BannerID());
19865 if (num2 >= 0)
19866 {
19867 lastCreatureHit = num2;
19868 }
19869 if (attempt.DidNPCDie())
19870 {
19871 OnKillNPC(ref attempt, null);
19872 }
19873 }
19874
19876 {
19877 if (Main.myPlayer == whoAmI && externalKillingBlowSource is Item { type: 5096 })
19878 {
19879 AddBuff(336, 420, quiet: false);
19880 }
19881 }
19882
19884 {
19885 if (_timeSinceLastImmuneGet <= 20)
19886 {
19887 _immuneStrikes++;
19888 }
19889 else
19890 {
19891 _immuneStrikes = 1;
19892 }
19893 _timeSinceLastImmuneGet = 0;
19894 if (_immuneStrikes < 3 && (!immune || immuneTime <= time))
19895 {
19896 immune = true;
19897 immuneNoBlink = true;
19898 immuneTime = time;
19899 }
19900 }
19901
19902 public bool CanNPCBeHitByPlayerOrPlayerProjectile(NPC npc, Projectile projectile = null)
19903 {
19904 bool flag = dontHurtCritters || (projectile != null && (projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]));
19905 if (NPCID.Sets.CountsAsCritter[npc.type] && flag)
19906 {
19907 return false;
19908 }
19909 return true;
19910 }
19911
19912 public void JumpMovement()
19913 {
19914 if (mount.Active && mount.IsConsideredASlimeMount && wetSlime == 0 && velocity.Y > 0f)
19915 {
19916 Rectangle rect = getRect();
19917 rect.Offset(0, height - 1);
19918 rect.Height = 2;
19919 rect.Inflate(12, 6);
19920 for (int i = 0; i < 200; i++)
19921 {
19922 NPC nPC = Main.npc[i];
19923 if (!nPC.active || nPC.dontTakeDamage || nPC.friendly || nPC.immune[whoAmI] != 0 || !CanNPCBeHitByPlayerOrPlayerProjectile(nPC))
19924 {
19925 continue;
19926 }
19927 Rectangle rect2 = nPC.getRect();
19928 if (rect.Intersects(rect2) && (nPC.noTileCollide || Collision.CanHit(position, width, height, nPC.position, nPC.width, nPC.height)))
19929 {
19930 float num = 40f * minionDamage;
19931 float knockback = 5f;
19932 int num2 = direction;
19933 if (velocity.X < 0f)
19934 {
19935 num2 = -1;
19936 }
19937 if (velocity.X > 0f)
19938 {
19939 num2 = 1;
19940 }
19941 if (whoAmI == Main.myPlayer)
19942 {
19943 ApplyDamageToNPC(nPC, (int)num, knockback, num2, crit: false);
19944 }
19945 nPC.immune[whoAmI] = 10;
19946 velocity.Y = -10f;
19947 GiveImmuneTimeForCollisionAttack(6);
19948 break;
19949 }
19950 }
19951 }
19952 if (mount.Active && mount.Type == 17 && velocity.Y > 0f)
19953 {
19954 Rectangle rect3 = getRect();
19955 rect3.Offset(0, height - 1);
19956 rect3.Height = 2;
19957 rect3.Inflate(12, 6);
19958 for (int j = 0; j < 200; j++)
19959 {
19960 NPC nPC2 = Main.npc[j];
19961 if (!nPC2.active || nPC2.dontTakeDamage || nPC2.friendly || nPC2.immune[whoAmI] != 0 || !CanNPCBeHitByPlayerOrPlayerProjectile(nPC2))
19962 {
19963 continue;
19964 }
19965 Rectangle rect4 = nPC2.getRect();
19966 if (rect3.Intersects(rect4) && (nPC2.noTileCollide || Collision.CanHit(position, width, height, nPC2.position, nPC2.width, nPC2.height)))
19967 {
19968 float num3 = 40f;
19969 float knockback2 = 5f;
19970 int num4 = direction;
19971 if (velocity.X < 0f)
19972 {
19973 num4 = -1;
19974 }
19975 if (velocity.X > 0f)
19976 {
19977 num4 = 1;
19978 }
19979 if (whoAmI == Main.myPlayer)
19980 {
19981 ApplyDamageToNPC(nPC2, (int)num3, knockback2, num4, crit: false);
19982 }
19983 nPC2.immune[whoAmI] = 12;
19984 GiveImmuneTimeForCollisionAttack(12);
19985 break;
19986 }
19987 }
19988 }
19989 if (controlJump)
19990 {
19991 if (sliding)
19992 {
19993 autoJump = false;
19994 }
19995 bool flag = false;
19996 bool flag2 = wet && accFlipper;
19997 bool flag3 = !mount.Active || !mount.Cart;
19998 if (mount.Active && mount.IsConsideredASlimeMount && wetSlime > 0)
19999 {
20000 wetSlime = 0;
20001 flag = true;
20002 }
20003 if (mount.Active && mount.Type == 43 && releaseJump && velocity.Y != 0f)
20004 {
20005 isPerformingPogostickTricks = true;
20006 }
20007 if (jump > 0)
20008 {
20009 if (velocity.Y == 0f)
20010 {
20011 jump = 0;
20012 }
20013 else
20014 {
20015 velocity.Y = (0f - jumpSpeed) * gravDir;
20016 if (merman && (!mount.Active || !mount.Cart))
20017 {
20018 if (swimTime <= 10)
20019 {
20020 swimTime = 30;
20021 }
20022 }
20023 else
20024 {
20025 jump--;
20026 }
20027 }
20028 }
20029 else if ((sliding || velocity.Y == 0f || flag || canJumpAgain_Cloud || canJumpAgain_Sandstorm || canJumpAgain_Blizzard || canJumpAgain_Fart || canJumpAgain_Sail || canJumpAgain_Unicorn || canJumpAgain_Santank || canJumpAgain_WallOfFleshGoat || canJumpAgain_Basilisk || (flag2 && flag3)) && (releaseJump || (autoJump && (velocity.Y == 0f || sliding))))
20030 {
20031 if (mount.Active && MountID.Sets.Cart[mount.Type])
20032 {
20033 position.Y -= 0.001f;
20034 }
20035 if (sliding || velocity.Y == 0f)
20036 {
20037 justJumped = true;
20038 }
20039 bool flag4 = false;
20040 if (wet && accFlipper)
20041 {
20042 if (swimTime == 0)
20043 {
20044 swimTime = 30;
20045 }
20046 flag4 = true;
20047 }
20048 bool flag5 = false;
20049 bool flag6 = false;
20050 bool flag7 = false;
20051 bool flag8 = false;
20052 bool flag9 = false;
20053 bool flag10 = false;
20054 bool flag11 = false;
20055 bool flag12 = false;
20056 if (!flag2 && !flag)
20057 {
20058 if (canJumpAgain_Basilisk)
20059 {
20060 flag12 = true;
20061 canJumpAgain_Basilisk = false;
20062 }
20063 if (canJumpAgain_WallOfFleshGoat)
20064 {
20065 flag11 = true;
20066 canJumpAgain_WallOfFleshGoat = false;
20067 }
20068 else if (canJumpAgain_Santank)
20069 {
20070 flag10 = true;
20071 canJumpAgain_Santank = false;
20072 }
20073 else if (canJumpAgain_Unicorn)
20074 {
20075 flag9 = true;
20076 canJumpAgain_Unicorn = false;
20077 }
20078 else if (canJumpAgain_Sandstorm)
20079 {
20080 flag5 = true;
20081 canJumpAgain_Sandstorm = false;
20082 }
20083 else if (canJumpAgain_Blizzard)
20084 {
20085 flag6 = true;
20086 canJumpAgain_Blizzard = false;
20087 }
20088 else if (canJumpAgain_Fart)
20089 {
20090 canJumpAgain_Fart = false;
20091 flag7 = true;
20092 }
20093 else if (canJumpAgain_Sail)
20094 {
20095 canJumpAgain_Sail = false;
20096 flag8 = true;
20097 }
20098 else
20099 {
20100 canJumpAgain_Cloud = false;
20101 }
20102 }
20103 canRocket = false;
20104 rocketRelease = false;
20105 if (velocity.Y == 0f || sliding || (autoJump && justJumped))
20106 {
20107 RefreshDoubleJumps();
20108 }
20109 if (velocity.Y == 0f || flag4 || sliding || flag)
20110 {
20111 if (mount.Active && mount.Type == 43)
20112 {
20114 }
20115 velocity.Y = (0f - jumpSpeed) * gravDir;
20116 jump = jumpHeight;
20117 if (portableStoolInfo.IsInUse)
20118 {
20119 position.Y -= portableStoolInfo.HeightBoost;
20120 gfxOffY += portableStoolInfo.HeightBoost;
20121 }
20122 if (sliding)
20123 {
20124 velocity.X = 3 * -slideDir;
20125 }
20126 }
20127 else if (flag5)
20128 {
20129 isPerformingJump_Sandstorm = true;
20130 _ = height;
20131 _ = gravDir;
20132 _ = -1f;
20133 SoundEngine.PlaySound(16, (int)position.X, (int)position.Y);
20134 velocity.Y = (0f - jumpSpeed) * gravDir;
20135 jump = jumpHeight * 3;
20136 }
20137 else if (flag6)
20138 {
20139 isPerformingJump_Blizzard = true;
20140 _ = height;
20141 _ = gravDir;
20142 _ = -1f;
20143 SoundEngine.PlaySound(16, (int)position.X, (int)position.Y);
20144 velocity.Y = (0f - jumpSpeed) * gravDir;
20145 jump = (int)((double)jumpHeight * 1.5);
20146 }
20147 else if (flag8)
20148 {
20149 isPerformingJump_Sail = true;
20150 int num5 = height;
20151 if (gravDir == -1f)
20152 {
20153 num5 = 0;
20154 }
20155 SoundEngine.PlaySound(16, (int)position.X, (int)position.Y);
20156 velocity.Y = (0f - jumpSpeed) * gravDir;
20157 jump = (int)((double)jumpHeight * 1.25);
20158 for (int k = 0; k < 30; k++)
20159 {
20160 int num6 = Dust.NewDust(new Vector2(position.X, position.Y + (float)num5), width, 12, 253, velocity.X * 0.3f, velocity.Y * 0.3f, 100, default(Color), 1.5f);
20161 if (k % 2 == 0)
20162 {
20163 Main.dust[num6].velocity.X += (float)Main.rand.Next(30, 71) * 0.1f;
20164 }
20165 else
20166 {
20167 Main.dust[num6].velocity.X -= (float)Main.rand.Next(30, 71) * 0.1f;
20168 }
20169 Main.dust[num6].velocity.Y += (float)Main.rand.Next(-10, 31) * 0.1f;
20170 Main.dust[num6].noGravity = true;
20171 Main.dust[num6].scale += (float)Main.rand.Next(-10, 41) * 0.01f;
20172 Main.dust[num6].velocity *= Main.dust[num6].scale * 0.7f;
20173 Vector2 vector = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
20174 vector.Normalize();
20175 vector *= (float)Main.rand.Next(81) * 0.1f;
20176 }
20177 }
20178 else if (flag7)
20179 {
20180 isPerformingJump_Fart = true;
20181 int num7 = height;
20182 if (gravDir == -1f)
20183 {
20184 num7 = 0;
20185 }
20187 velocity.Y = (0f - jumpSpeed) * gravDir;
20188 jump = jumpHeight * 2;
20189 for (int l = 0; l < 10; l++)
20190 {
20191 int num8 = Dust.NewDust(new Vector2(position.X - 34f, position.Y + (float)num7 - 16f), 102, 32, 188, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 100, default(Color), 1.5f);
20192 Main.dust[num8].velocity.X = Main.dust[num8].velocity.X * 0.5f - velocity.X * 0.1f;
20193 Main.dust[num8].velocity.Y = Main.dust[num8].velocity.Y * 0.5f - velocity.Y * 0.3f;
20194 }
20195 int num9 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 16f, position.Y + (float)num7 - 16f), new Vector2(0f - velocity.X, 0f - velocity.Y), Main.rand.Next(435, 438));
20196 Main.gore[num9].velocity.X = Main.gore[num9].velocity.X * 0.1f - velocity.X * 0.1f;
20197 Main.gore[num9].velocity.Y = Main.gore[num9].velocity.Y * 0.1f - velocity.Y * 0.05f;
20198 num9 = Gore.NewGore(new Vector2(position.X - 36f, position.Y + (float)num7 - 16f), new Vector2(0f - velocity.X, 0f - velocity.Y), Main.rand.Next(435, 438));
20199 Main.gore[num9].velocity.X = Main.gore[num9].velocity.X * 0.1f - velocity.X * 0.1f;
20200 Main.gore[num9].velocity.Y = Main.gore[num9].velocity.Y * 0.1f - velocity.Y * 0.05f;
20201 num9 = Gore.NewGore(new Vector2(position.X + (float)width + 4f, position.Y + (float)num7 - 16f), new Vector2(0f - velocity.X, 0f - velocity.Y), Main.rand.Next(435, 438));
20202 Main.gore[num9].velocity.X = Main.gore[num9].velocity.X * 0.1f - velocity.X * 0.1f;
20203 Main.gore[num9].velocity.Y = Main.gore[num9].velocity.Y * 0.1f - velocity.Y * 0.05f;
20204 }
20205 else if (flag9)
20206 {
20207 isPerformingJump_Unicorn = true;
20208 _ = height;
20209 _ = gravDir;
20210 _ = -1f;
20211 SoundEngine.PlaySound(16, (int)position.X, (int)position.Y);
20212 velocity.Y = (0f - jumpSpeed) * gravDir;
20213 jump = jumpHeight * 2;
20214 Vector2 center = base.Center;
20215 Vector2 vector2 = new Vector2(50f, 20f);
20216 float num10 = (float)Math.PI * 2f * Main.rand.NextFloat();
20217 for (int m = 0; m < 5; m++)
20218 {
20219 for (float num11 = 0f; num11 < 14f; num11 += 1f)
20220 {
20221 Dust obj = Main.dust[Dust.NewDust(center, 0, 0, Utils.SelectRandom<int>(Main.rand, 176, 177, 179))];
20222 Vector2 vector3 = Vector2.UnitY.RotatedBy(num11 * ((float)Math.PI * 2f) / 14f + num10);
20223 vector3 *= 0.2f * (float)m;
20224 obj.position = center + vector3 * vector2;
20225 obj.velocity = vector3 + new Vector2(0f, gravDir * 4f);
20226 obj.noGravity = true;
20227 obj.scale = 1f + Main.rand.NextFloat() * 0.8f;
20228 obj.fadeIn = Main.rand.NextFloat() * 2f;
20229 obj.shader = GameShaders.Armor.GetSecondaryShader(cMount, this);
20230 }
20231 }
20232 }
20233 else if (flag11)
20234 {
20235 isPerformingJump_WallOfFleshGoat = true;
20236 _ = height;
20237 _ = gravDir;
20238 _ = -1f;
20239 SoundEngine.PlaySound(16, (int)position.X, (int)position.Y);
20240 velocity.Y = (0f - jumpSpeed) * gravDir;
20241 jump = jumpHeight * 2;
20242 Vector2 center2 = base.Center;
20243 Vector2 vector4 = new Vector2(50f, 20f);
20244 float num12 = (float)Math.PI * 2f * Main.rand.NextFloat();
20245 for (int n = 0; n < 5; n++)
20246 {
20247 for (float num13 = 0f; num13 < 14f; num13 += 1f)
20248 {
20249 Dust obj2 = Main.dust[Dust.NewDust(center2, 0, 0, 6)];
20250 Vector2 vector5 = Vector2.UnitY.RotatedBy(num13 * ((float)Math.PI * 2f) / 14f + num12);
20251 vector5 *= 0.2f * (float)n;
20252 obj2.position = center2 + vector5 * vector4;
20253 obj2.velocity = vector5 + new Vector2(0f, gravDir * 4f);
20254 obj2.noGravity = true;
20255 obj2.scale = 1f + Main.rand.NextFloat() * 0.8f;
20256 obj2.fadeIn = Main.rand.NextFloat() * 2f;
20257 obj2.shader = GameShaders.Armor.GetSecondaryShader(cMount, this);
20258 }
20259 }
20260 }
20261 else if (flag12)
20262 {
20263 isPerformingJump_Basilisk = true;
20264 _ = height;
20265 _ = gravDir;
20266 _ = -1f;
20267 SoundEngine.PlaySound(16, (int)position.X, (int)position.Y);
20268 velocity.Y = (0f - jumpSpeed) * gravDir;
20269 jump = (int)((double)jumpHeight * 0.75);
20270 Vector2 center3 = base.Center;
20271 Vector2 vector6 = new Vector2(50f, 20f);
20272 float num14 = (float)Math.PI * 2f * Main.rand.NextFloat();
20273 for (int num15 = 0; num15 < 5; num15++)
20274 {
20275 for (float num16 = 0f; num16 < 14f; num16 += 1f)
20276 {
20277 Dust obj3 = Main.dust[Dust.NewDust(center3, 0, 0, 31)];
20278 Vector2 vector7 = Vector2.UnitY.RotatedBy(num16 * ((float)Math.PI * 2f) / 14f + num14);
20279 vector7 *= 0.2f * (float)num15;
20280 obj3.position = center3 + vector7 * vector6;
20281 obj3.velocity = vector7 + new Vector2(0f, gravDir * 4f);
20282 obj3.noGravity = true;
20283 obj3.scale = 1f + Main.rand.NextFloat() * 0.8f;
20284 obj3.fadeIn = Main.rand.NextFloat() * 2f;
20285 obj3.shader = GameShaders.Armor.GetSecondaryShader(cMount, this);
20286 }
20287 }
20288 }
20289 else if (flag10)
20290 {
20291 isPerformingJump_Santank = true;
20292 int num17 = height;
20293 if (gravDir == -1f)
20294 {
20295 num17 = 0;
20296 }
20297 SoundEngine.PlaySound(16, (int)position.X, (int)position.Y);
20298 velocity.Y = (0f - jumpSpeed) * gravDir;
20299 jump = jumpHeight * 2;
20300 for (int num18 = 0; num18 < 15; num18++)
20301 {
20302 int num19 = Dust.NewDust(new Vector2(position.X - 34f, position.Y + (float)num17 - 16f), 102, 32, 4, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 100, new Color(250, 230, 230, 150), 1.5f);
20303 Main.dust[num19].velocity.X = Main.dust[num19].velocity.X * 0.5f - velocity.X * 0.1f;
20304 Main.dust[num19].velocity.Y = Main.dust[num19].velocity.Y * 0.5f - velocity.Y * 0.3f;
20305 Main.dust[num19].noGravity = true;
20306 num19 = Dust.NewDust(new Vector2(position.X - 34f, position.Y + (float)num17 - 16f), 102, 32, 6, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 20, default(Color), 1.5f);
20307 Main.dust[num19].velocity.Y -= 1f;
20308 if (num18 % 2 == 0)
20309 {
20310 Main.dust[num19].fadeIn = Main.rand.NextFloat() * 2f;
20311 }
20312 }
20313 float y = base.Bottom.Y - 22f;
20314 for (int num20 = 0; num20 < 3; num20++)
20315 {
20316 Vector2 vector8 = base.Center;
20317 switch (num20)
20318 {
20319 case 0:
20320 vector8 = new Vector2(base.Center.X - 16f, y);
20321 break;
20322 case 1:
20323 vector8 = new Vector2(position.X - 36f, y);
20324 break;
20325 case 2:
20326 vector8 = new Vector2(base.Right.X + 4f, y);
20327 break;
20328 }
20329 int num21 = Gore.NewGore(vector8, new Vector2(0f - velocity.X, 0f - velocity.Y), Main.rand.Next(61, 63));
20330 Main.gore[num21].velocity *= 0.1f;
20331 Main.gore[num21].velocity.X -= velocity.X * 0.1f;
20332 Main.gore[num21].velocity.Y -= velocity.Y * 0.05f;
20333 Main.gore[num21].velocity += Main.rand.NextVector2Circular(1f, 1f) * 0.5f;
20334 }
20335 }
20336 else
20337 {
20338 isPerformingJump_Cloud = true;
20339 int num22 = height;
20340 if (gravDir == -1f)
20341 {
20342 num22 = 0;
20343 }
20344 SoundEngine.PlaySound(16, (int)position.X, (int)position.Y);
20345 velocity.Y = (0f - jumpSpeed) * gravDir;
20346 jump = (int)((double)jumpHeight * 0.75);
20347 for (int num23 = 0; num23 < 10; num23++)
20348 {
20349 int num24 = Dust.NewDust(new Vector2(position.X - 34f, position.Y + (float)num22 - 16f), 102, 32, 16, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 100, default(Color), 1.5f);
20350 Main.dust[num24].velocity.X = Main.dust[num24].velocity.X * 0.5f - velocity.X * 0.1f;
20351 Main.dust[num24].velocity.Y = Main.dust[num24].velocity.Y * 0.5f - velocity.Y * 0.3f;
20352 }
20353 int num25 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 16f, position.Y + (float)num22 - 16f), new Vector2(0f - velocity.X, 0f - velocity.Y), Main.rand.Next(11, 14));
20354 Main.gore[num25].velocity.X = Main.gore[num25].velocity.X * 0.1f - velocity.X * 0.1f;
20355 Main.gore[num25].velocity.Y = Main.gore[num25].velocity.Y * 0.1f - velocity.Y * 0.05f;
20356 num25 = Gore.NewGore(new Vector2(position.X - 36f, position.Y + (float)num22 - 16f), new Vector2(0f - velocity.X, 0f - velocity.Y), Main.rand.Next(11, 14));
20357 Main.gore[num25].velocity.X = Main.gore[num25].velocity.X * 0.1f - velocity.X * 0.1f;
20358 Main.gore[num25].velocity.Y = Main.gore[num25].velocity.Y * 0.1f - velocity.Y * 0.05f;
20359 num25 = Gore.NewGore(new Vector2(position.X + (float)width + 4f, position.Y + (float)num22 - 16f), new Vector2(0f - velocity.X, 0f - velocity.Y), Main.rand.Next(11, 14));
20360 Main.gore[num25].velocity.X = Main.gore[num25].velocity.X * 0.1f - velocity.X * 0.1f;
20361 Main.gore[num25].velocity.Y = Main.gore[num25].velocity.Y * 0.1f - velocity.Y * 0.05f;
20362 }
20363 }
20364 releaseJump = false;
20365 }
20366 else
20367 {
20368 jump = 0;
20369 releaseJump = true;
20370 rocketRelease = true;
20371 }
20372 }
20373
20374 public void DashMovement()
20375 {
20376 if (dashDelay == 0)
20377 {
20378 dash = dashType;
20379 }
20380 if (dash == 0)
20381 {
20382 dashTime = 0;
20383 dashDelay = 0;
20384 }
20385 if (dash == 2 && eocDash > 0)
20386 {
20387 if (eocHit < 0)
20388 {
20389 Rectangle rectangle = new Rectangle((int)((double)position.X + (double)velocity.X * 0.5 - 4.0), (int)((double)position.Y + (double)velocity.Y * 0.5 - 4.0), width + 8, height + 8);
20390 for (int i = 0; i < 200; i++)
20391 {
20392 NPC nPC = Main.npc[i];
20393 if (!nPC.active || nPC.dontTakeDamage || nPC.friendly || (nPC.aiStyle == 112 && !(nPC.ai[2] <= 1f)) || !CanNPCBeHitByPlayerOrPlayerProjectile(nPC))
20394 {
20395 continue;
20396 }
20397 Rectangle rect = nPC.getRect();
20398 if (rectangle.Intersects(rect) && (nPC.noTileCollide || CanHit(nPC)))
20399 {
20400 float num = 30f * meleeDamage;
20401 float num2 = 9f;
20402 bool crit = false;
20403 if (kbGlove)
20404 {
20405 num2 *= 2f;
20406 }
20407 if (kbBuff)
20408 {
20409 num2 *= 1.5f;
20410 }
20411 if (Main.rand.Next(100) < meleeCrit)
20412 {
20413 crit = true;
20414 }
20415 int num3 = direction;
20416 if (velocity.X < 0f)
20417 {
20418 num3 = -1;
20419 }
20420 if (velocity.X > 0f)
20421 {
20422 num3 = 1;
20423 }
20424 if (whoAmI == Main.myPlayer)
20425 {
20426 ApplyDamageToNPC(nPC, (int)num, num2, num3, crit);
20427 }
20428 eocDash = 10;
20429 dashDelay = 30;
20430 velocity.X = -num3 * 9;
20431 velocity.Y = -4f;
20432 GiveImmuneTimeForCollisionAttack(4);
20433 eocHit = i;
20434 }
20435 }
20436 }
20437 else if ((!controlLeft || !(velocity.X < 0f)) && (!controlRight || !(velocity.X > 0f)))
20438 {
20439 velocity.X *= 0.95f;
20440 }
20441 }
20442 if (dash == 3 && dashDelay < 0 && whoAmI == Main.myPlayer)
20443 {
20444 Rectangle rectangle2 = new Rectangle((int)((double)position.X + (double)velocity.X * 0.5 - 4.0), (int)((double)position.Y + (double)velocity.Y * 0.5 - 4.0), width + 8, height + 8);
20445 for (int j = 0; j < 200; j++)
20446 {
20447 NPC nPC2 = Main.npc[j];
20448 if (!nPC2.active || nPC2.dontTakeDamage || nPC2.friendly || nPC2.immune[whoAmI] > 0 || (nPC2.aiStyle == 112 && !(nPC2.ai[2] <= 1f)) || !CanNPCBeHitByPlayerOrPlayerProjectile(nPC2))
20449 {
20450 continue;
20451 }
20452 Rectangle rect2 = nPC2.getRect();
20453 if (rectangle2.Intersects(rect2) && (nPC2.noTileCollide || CanHit(nPC2)))
20454 {
20455 if (!solarDashConsumedFlare)
20456 {
20457 solarDashConsumedFlare = true;
20458 ConsumeSolarFlare();
20459 }
20460 float num4 = 150f * meleeDamage;
20461 float num5 = 9f;
20462 bool crit2 = false;
20463 if (kbGlove)
20464 {
20465 num5 *= 2f;
20466 }
20467 if (kbBuff)
20468 {
20469 num5 *= 1.5f;
20470 }
20471 if (Main.rand.Next(100) < meleeCrit)
20472 {
20473 crit2 = true;
20474 }
20475 int num6 = direction;
20476 if (velocity.X < 0f)
20477 {
20478 num6 = -1;
20479 }
20480 if (velocity.X > 0f)
20481 {
20482 num6 = 1;
20483 }
20484 if (whoAmI == Main.myPlayer)
20485 {
20486 ApplyDamageToNPC(nPC2, (int)num4, num5, num6, crit2);
20487 int num7 = Projectile.NewProjectile(GetProjectileSource_OnHit(nPC2, 2), base.Center.X, base.Center.Y, 0f, 0f, 608, (int)num4, 15f, Main.myPlayer);
20488 Main.projectile[num7].Kill();
20489 }
20490 nPC2.immune[whoAmI] = 6;
20491 GiveImmuneTimeForCollisionAttack(4);
20492 }
20493 }
20494 }
20495 if (dashDelay > 0)
20496 {
20497 if (eocDash > 0)
20498 {
20499 eocDash--;
20500 }
20501 if (eocDash == 0)
20502 {
20503 eocHit = -1;
20504 }
20505 dashDelay--;
20506 }
20507 else if (dashDelay < 0)
20508 {
20509 StopVanityActions();
20510 float num8 = 12f;
20511 float num9 = 0.992f;
20512 float num10 = Math.Max(accRunSpeed, maxRunSpeed);
20513 float num11 = 0.96f;
20514 int num12 = 20;
20515 if (dash == 1)
20516 {
20517 for (int k = 0; k < 2; k++)
20518 {
20519 int num13 = ((velocity.Y != 0f) ? Dust.NewDust(new Vector2(position.X, position.Y + (float)(height / 2) - 8f), width, 16, 31, 0f, 0f, 100, default(Color), 1.4f) : Dust.NewDust(new Vector2(position.X, position.Y + (float)height - 4f), width, 8, 31, 0f, 0f, 100, default(Color), 1.4f));
20520 Main.dust[num13].velocity *= 0.1f;
20521 Main.dust[num13].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
20522 }
20523 }
20524 else if (dash == 2)
20525 {
20526 for (int l = 0; l < 0; l++)
20527 {
20528 int num14 = ((velocity.Y != 0f) ? Dust.NewDust(new Vector2(position.X, position.Y + (float)(height / 2) - 8f), width, 16, 31, 0f, 0f, 100, default(Color), 1.4f) : Dust.NewDust(new Vector2(position.X, position.Y + (float)height - 4f), width, 8, 31, 0f, 0f, 100, default(Color), 1.4f));
20529 Main.dust[num14].velocity *= 0.1f;
20530 Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
20531 }
20532 num9 = 0.985f;
20533 num11 = 0.94f;
20534 num12 = 30;
20535 }
20536 else if (dash == 3)
20537 {
20538 for (int m = 0; m < 4; m++)
20539 {
20540 int num15 = Dust.NewDust(new Vector2(position.X, position.Y + 4f), width, height - 8, 6, 0f, 0f, 100, default(Color), 1.7f);
20541 Main.dust[num15].velocity *= 0.1f;
20542 Main.dust[num15].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
20543 Main.dust[num15].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
20544 Main.dust[num15].noGravity = true;
20545 if (Main.rand.Next(2) == 0)
20546 {
20547 Main.dust[num15].fadeIn = 0.5f;
20548 }
20549 }
20550 num8 = 14f;
20551 num9 = 0.985f;
20552 num11 = 0.94f;
20553 num12 = 20;
20554 }
20555 else if (dash == 4)
20556 {
20557 for (int n = 0; n < 2; n++)
20558 {
20559 int num16 = Dust.NewDust(new Vector2(position.X, position.Y + 4f), width, height - 8, 229, 0f, 0f, 100, default(Color), 1.2f);
20560 Main.dust[num16].velocity *= 0.1f;
20561 Main.dust[num16].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
20562 Main.dust[num16].noGravity = true;
20563 if (Main.rand.Next(2) == 0)
20564 {
20565 Main.dust[num16].fadeIn = 0.3f;
20566 }
20567 }
20568 num9 = 0.985f;
20569 num11 = 0.94f;
20570 num12 = 20;
20571 }
20572 if (dash == 5)
20573 {
20574 for (int num17 = 0; num17 < 2; num17++)
20575 {
20576 int type = Main.rand.NextFromList(new short[3] { 68, 69, 70 });
20577 int num18 = ((velocity.Y != 0f) ? Dust.NewDust(new Vector2(position.X, position.Y + (float)(height / 2) - 8f), width, 16, type, 0f, 0f, 100) : Dust.NewDust(new Vector2(position.X, position.Y + (float)height - 4f), width, 8, type, 0f, 0f, 100));
20578 Main.dust[num18].velocity *= 0.2f;
20579 Main.dust[num18].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
20580 Main.dust[num18].fadeIn = 0.5f + (float)Main.rand.Next(20) * 0.01f;
20581 Main.dust[num18].noGravity = true;
20582 Main.dust[num18].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
20583 }
20584 }
20585 if (dash <= 0)
20586 {
20587 return;
20588 }
20589 doorHelper.AllowOpeningDoorsByVelocityAloneForATime(num12 * 3);
20590 vortexStealthActive = false;
20591 if (velocity.X > num8 || velocity.X < 0f - num8)
20592 {
20593 velocity.X *= num9;
20594 return;
20595 }
20596 if (velocity.X > num10 || velocity.X < 0f - num10)
20597 {
20598 velocity.X *= num11;
20599 return;
20600 }
20601 dashDelay = num12;
20602 if (velocity.X < 0f)
20603 {
20604 velocity.X = 0f - num10;
20605 }
20606 else if (velocity.X > 0f)
20607 {
20608 velocity.X = num10;
20609 }
20610 }
20611 else
20612 {
20613 if (dash <= 0 || mount.Active)
20614 {
20615 return;
20616 }
20617 if (dash == 1)
20618 {
20619 DoCommonDashHandle(out var dir, out var dashing);
20620 if (dashing)
20621 {
20622 velocity.X = 16.9f * (float)dir;
20623 Point point = (base.Center + new Vector2(dir * width / 2 + 2, gravDir * (float)(-height) / 2f + gravDir * 2f)).ToTileCoordinates();
20624 Point point2 = (base.Center + new Vector2(dir * width / 2 + 2, 0f)).ToTileCoordinates();
20626 {
20627 velocity.X /= 2f;
20628 }
20629 dashDelay = -1;
20630 for (int num19 = 0; num19 < 20; num19++)
20631 {
20632 int num20 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 2f);
20633 Main.dust[num20].position.X += Main.rand.Next(-5, 6);
20634 Main.dust[num20].position.Y += Main.rand.Next(-5, 6);
20635 Main.dust[num20].velocity *= 0.2f;
20636 Main.dust[num20].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
20637 }
20638 int num21 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 34f), default(Vector2), Main.rand.Next(61, 64));
20639 Main.gore[num21].velocity.X = (float)Main.rand.Next(-50, 51) * 0.01f;
20640 Main.gore[num21].velocity.Y = (float)Main.rand.Next(-50, 51) * 0.01f;
20641 Main.gore[num21].velocity *= 0.4f;
20642 num21 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 14f), default(Vector2), Main.rand.Next(61, 64));
20643 Main.gore[num21].velocity.X = (float)Main.rand.Next(-50, 51) * 0.01f;
20644 Main.gore[num21].velocity.Y = (float)Main.rand.Next(-50, 51) * 0.01f;
20645 Main.gore[num21].velocity *= 0.4f;
20646 }
20647 }
20648 else if (dash == 2)
20649 {
20650 DoCommonDashHandle(out var dir2, out var dashing2);
20651 if (dashing2)
20652 {
20653 velocity.X = 14.5f * (float)dir2;
20654 Point point3 = (base.Center + new Vector2(dir2 * width / 2 + 2, gravDir * (float)(-height) / 2f + gravDir * 2f)).ToTileCoordinates();
20655 Point point4 = (base.Center + new Vector2(dir2 * width / 2 + 2, 0f)).ToTileCoordinates();
20657 {
20658 velocity.X /= 2f;
20659 }
20660 dashDelay = -1;
20661 eocDash = 15;
20662 for (int num22 = 0; num22 < 0; num22++)
20663 {
20664 int num23 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 2f);
20665 Main.dust[num23].position.X += Main.rand.Next(-5, 6);
20666 Main.dust[num23].position.Y += Main.rand.Next(-5, 6);
20667 Main.dust[num23].velocity *= 0.2f;
20668 Main.dust[num23].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
20669 }
20670 }
20671 }
20672 else if (dash == 3)
20673 {
20674 DoCommonDashHandle(out var dir3, out var dashing3, SolarDashStart);
20675 if (dashing3)
20676 {
20677 velocity.X = 21.9f * (float)dir3;
20678 Point point5 = (base.Center + new Vector2(dir3 * width / 2 + 2, gravDir * (float)(-height) / 2f + gravDir * 2f)).ToTileCoordinates();
20679 Point point6 = (base.Center + new Vector2(dir3 * width / 2 + 2, 0f)).ToTileCoordinates();
20681 {
20682 velocity.X /= 2f;
20683 }
20684 dashDelay = -1;
20685 for (int num24 = 0; num24 < 20; num24++)
20686 {
20687 int num25 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2f);
20688 Main.dust[num25].position.X += Main.rand.Next(-5, 6);
20689 Main.dust[num25].position.Y += Main.rand.Next(-5, 6);
20690 Main.dust[num25].velocity *= 0.2f;
20691 Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
20692 Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
20693 Main.dust[num25].noGravity = true;
20694 Main.dust[num25].fadeIn = 0.5f;
20695 }
20696 }
20697 }
20698 if (dash != 5)
20699 {
20700 return;
20701 }
20702 DoCommonDashHandle(out var dir4, out var dashing4);
20703 if (dashing4)
20704 {
20705 velocity.X = 16.9f * (float)dir4;
20706 Point point7 = (base.Center + new Vector2(dir4 * width / 2 + 2, gravDir * (float)(-height) / 2f + gravDir * 2f)).ToTileCoordinates();
20707 Point point8 = (base.Center + new Vector2(dir4 * width / 2 + 2, 0f)).ToTileCoordinates();
20709 {
20710 velocity.X /= 2f;
20711 }
20712 dashDelay = -1;
20713 for (int num26 = 0; num26 < 20; num26++)
20714 {
20715 int type2 = Main.rand.NextFromList(new short[3] { 68, 69, 70 });
20716 int num27 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, type2, 0f, 0f, 100, default(Color), 1.5f);
20717 Main.dust[num27].position.X += Main.rand.Next(-5, 6);
20718 Main.dust[num27].position.Y += Main.rand.Next(-5, 6);
20719 Main.dust[num27].velocity = DirectionTo(Main.dust[num27].position) * 2f;
20720 Main.dust[num27].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
20721 Main.dust[num27].fadeIn = 0.5f + (float)Main.rand.Next(20) * 0.01f;
20722 Main.dust[num27].noGravity = true;
20723 Main.dust[num27].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
20724 }
20725 }
20726 }
20727 }
20728
20730 {
20731 solarDashing = true;
20732 solarDashConsumedFlare = false;
20733 }
20734
20735 private void DoCommonDashHandle(out int dir, out bool dashing, DashStartAction dashStartAction = null)
20736 {
20737 dir = 0;
20738 dashing = false;
20739 if (dashTime > 0)
20740 {
20741 dashTime--;
20742 }
20743 if (dashTime < 0)
20744 {
20745 dashTime++;
20746 }
20747 if (controlRight && releaseRight)
20748 {
20749 if (dashTime > 0)
20750 {
20751 dir = 1;
20752 dashing = true;
20753 dashTime = 0;
20754 timeSinceLastDashStarted = 0;
20755 dashStartAction?.Invoke(dir);
20756 }
20757 else
20758 {
20759 dashTime = 15;
20760 }
20761 }
20762 else if (controlLeft && releaseLeft)
20763 {
20764 if (dashTime < 0)
20765 {
20766 dir = -1;
20767 dashing = true;
20768 dashTime = 0;
20769 timeSinceLastDashStarted = 0;
20770 dashStartAction?.Invoke(dir);
20771 }
20772 else
20773 {
20774 dashTime = -15;
20775 }
20776 }
20777 }
20778
20779 public void WallslideMovement()
20780 {
20781 sliding = false;
20782 if (slideDir == 0 || spikedBoots <= 0 || mount.Active || ((!controlLeft || slideDir != -1) && (!controlRight || slideDir != 1)))
20783 {
20784 return;
20785 }
20786 bool flag = false;
20787 float num = position.X;
20788 if (slideDir == 1)
20789 {
20790 num += (float)width;
20791 }
20792 num += (float)slideDir;
20793 float num2 = position.Y + (float)height + 1f;
20794 if (gravDir < 0f)
20795 {
20796 num2 = position.Y - 1f;
20797 }
20798 num /= 16f;
20799 num2 /= 16f;
20800 if (WorldGen.SolidTile((int)num, (int)num2) && WorldGen.SolidTile((int)num, (int)num2 - 1))
20801 {
20802 flag = true;
20803 }
20804 if (spikedBoots >= 2)
20805 {
20806 if (!flag || ((!(velocity.Y > 0f) || gravDir != 1f) && (!(velocity.Y < gravity) || gravDir != -1f)))
20807 {
20808 return;
20809 }
20810 float num3 = gravity;
20811 if (slowFall)
20812 {
20813 num3 = ((!TryingToHoverUp) ? (gravity / 3f * gravDir) : (gravity / 10f * gravDir));
20814 }
20815 fallStart = (int)(position.Y / 16f);
20816 if ((controlDown && gravDir == 1f) || (controlUp && gravDir == -1f))
20817 {
20818 velocity.Y = 4f * gravDir;
20819 int num4 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)((width / 2 - 4) * slideDir), position.Y + (float)(height / 2) + (float)(height / 2 - 4) * gravDir), 8, 8, 31);
20820 if (slideDir < 0)
20821 {
20822 Main.dust[num4].position.X -= 10f;
20823 }
20824 if (gravDir < 0f)
20825 {
20826 Main.dust[num4].position.Y -= 12f;
20827 }
20828 Main.dust[num4].velocity *= 0.1f;
20829 Main.dust[num4].scale *= 1.2f;
20830 Main.dust[num4].noGravity = true;
20831 Main.dust[num4].shader = GameShaders.Armor.GetSecondaryShader(cShoe, this);
20832 }
20833 else if (gravDir == -1f)
20834 {
20835 velocity.Y = (0f - num3 + 1E-05f) * gravDir;
20836 }
20837 else
20838 {
20839 velocity.Y = (0f - num3 + 1E-05f) * gravDir;
20840 }
20841 sliding = true;
20842 }
20843 else if ((flag && (double)velocity.Y > 0.5 && gravDir == 1f) || ((double)velocity.Y < -0.5 && gravDir == -1f))
20844 {
20845 fallStart = (int)(position.Y / 16f);
20846 if (controlDown)
20847 {
20848 velocity.Y = 4f * gravDir;
20849 }
20850 else
20851 {
20852 velocity.Y = 0.5f * gravDir;
20853 }
20854 sliding = true;
20855 int num5 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)((width / 2 - 4) * slideDir), position.Y + (float)(height / 2) + (float)(height / 2 - 4) * gravDir), 8, 8, 31);
20856 if (slideDir < 0)
20857 {
20858 Main.dust[num5].position.X -= 10f;
20859 }
20860 if (gravDir < 0f)
20861 {
20862 Main.dust[num5].position.Y -= 12f;
20863 }
20864 Main.dust[num5].velocity *= 0.1f;
20865 Main.dust[num5].scale *= 1.2f;
20866 Main.dust[num5].noGravity = true;
20867 Main.dust[num5].shader = GameShaders.Armor.GetSecondaryShader(cShoe, this);
20868 }
20869 }
20870
20871 public void CarpetMovement()
20872 {
20873 bool flag = false;
20874 if (grappling[0] == -1 && carpet && !canJumpAgain_Cloud && !canJumpAgain_Sandstorm && !canJumpAgain_Blizzard && !canJumpAgain_Fart && !canJumpAgain_Sail && !canJumpAgain_Unicorn && !canJumpAgain_Santank && !canJumpAgain_WallOfFleshGoat && !canJumpAgain_Basilisk && jump == 0 && velocity.Y != 0f && rocketTime == 0 && wingTime == 0f && !mount.Active)
20875 {
20876 if (controlJump && canCarpet)
20877 {
20878 canCarpet = false;
20879 carpetTime = 300;
20880 }
20881 if (carpetTime > 0 && controlJump)
20882 {
20883 fallStart = (int)(position.Y / 16f);
20884 flag = true;
20885 carpetTime--;
20886 float num = gravity;
20887 if (gravDir == 1f && velocity.Y > 0f - num)
20888 {
20889 velocity.Y = 0f - (num + 1E-06f);
20890 }
20891 else if (gravDir == -1f && velocity.Y < num)
20892 {
20893 velocity.Y = num + 1E-06f;
20894 }
20895 carpetFrameCounter += 1f + Math.Abs(velocity.X * 0.5f);
20896 if (carpetFrameCounter > 8f)
20897 {
20898 carpetFrameCounter = 0f;
20899 carpetFrame++;
20900 }
20901 if (carpetFrame < 0)
20902 {
20903 carpetFrame = 0;
20904 }
20905 if (carpetFrame > 5)
20906 {
20907 carpetFrame = 0;
20908 }
20909 }
20910 }
20911 if (!flag)
20912 {
20913 carpetFrame = -1;
20914 }
20915 else
20916 {
20917 slowFall = false;
20918 }
20919 }
20920
20921 public void DoubleJumpVisuals()
20922 {
20923 if (isPerformingJump_Cloud && hasJumpOption_Cloud && !canJumpAgain_Cloud && (canJumpAgain_Sandstorm || !hasJumpOption_Sandstorm) && ((gravDir == 1f && velocity.Y < 0f) || (gravDir == -1f && velocity.Y > 0f)))
20924 {
20925 int num = height;
20926 if (gravDir == -1f)
20927 {
20928 num = -6;
20929 }
20930 int num2 = Dust.NewDust(new Vector2(position.X - 4f, position.Y + (float)num), width + 8, 4, 16, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 100, default(Color), 1.5f);
20931 Main.dust[num2].velocity.X = Main.dust[num2].velocity.X * 0.5f - velocity.X * 0.1f;
20932 Main.dust[num2].velocity.Y = Main.dust[num2].velocity.Y * 0.5f - velocity.Y * 0.3f;
20933 }
20934 if (isPerformingJump_Sandstorm && hasJumpOption_Sandstorm && !canJumpAgain_Sandstorm && ((gravDir == 1f && velocity.Y < 0f) || (gravDir == -1f && velocity.Y > 0f)))
20935 {
20936 int num3 = height;
20937 if (gravDir == -1f)
20938 {
20939 num3 = -6;
20940 }
20941 float num4 = ((float)jump / 75f + 1f) / 2f;
20942 for (int i = 0; i < 3; i++)
20943 {
20944 int num5 = Dust.NewDust(new Vector2(position.X, position.Y + (float)(num3 / 2)), width, 32, 124, velocity.X * 0.3f, velocity.Y * 0.3f, 150, default(Color), 1f * num4);
20945 Main.dust[num5].velocity *= 0.5f * num4;
20946 Main.dust[num5].fadeIn = 1.5f * num4;
20947 }
20948 sandStorm = true;
20949 if (miscCounter % 3 == 0)
20950 {
20951 int num6 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 18f, position.Y + (float)(num3 / 2)), new Vector2(0f - velocity.X, 0f - velocity.Y), Main.rand.Next(220, 223), num4);
20952 Main.gore[num6].velocity = velocity * 0.3f * num4;
20953 Main.gore[num6].alpha = 100;
20954 }
20955 }
20956 if (isPerformingJump_Fart && hasJumpOption_Fart && !canJumpAgain_Fart && ((gravDir == 1f && velocity.Y < 0f) || (gravDir == -1f && velocity.Y > 0f)))
20957 {
20958 int num7 = height;
20959 if (gravDir == -1f)
20960 {
20961 num7 = -6;
20962 }
20963 int num8 = Dust.NewDust(new Vector2(position.X - 4f, position.Y + (float)num7), width + 8, 4, 188, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 100, default(Color), 1.5f);
20964 Main.dust[num8].velocity.X = Main.dust[num8].velocity.X * 0.5f - velocity.X * 0.1f;
20965 Main.dust[num8].velocity.Y = Main.dust[num8].velocity.Y * 0.5f - velocity.Y * 0.3f;
20966 Main.dust[num8].velocity *= 0.5f;
20967 }
20968 if (isPerformingJump_Unicorn && hasJumpOption_Unicorn && !canJumpAgain_Unicorn && ((gravDir == 1f && velocity.Y < 0f) || (gravDir == -1f && velocity.Y > 0f)))
20969 {
20970 Dust obj = Main.dust[Dust.NewDust(position, width, height, Utils.SelectRandom<int>(Main.rand, 176, 177, 179))];
20971 obj.velocity = Vector2.Zero;
20972 obj.noGravity = true;
20973 obj.scale = 0.5f + Main.rand.NextFloat() * 0.8f;
20974 obj.fadeIn = 1f + Main.rand.NextFloat() * 2f;
20975 obj.shader = GameShaders.Armor.GetSecondaryShader(cMount, this);
20976 }
20977 if (isPerformingJump_Sail && hasJumpOption_Sail && !canJumpAgain_Sail && ((gravDir == 1f && velocity.Y < 1f) || (gravDir == -1f && velocity.Y > 1f)))
20978 {
20979 int num9 = 1;
20980 if (jump > 0)
20981 {
20982 num9 = 2;
20983 }
20984 int num10 = height - 6;
20985 if (gravDir == -1f)
20986 {
20987 num10 = 6;
20988 }
20989 for (int j = 0; j < num9; j++)
20990 {
20991 int num11 = Dust.NewDust(new Vector2(position.X, position.Y + (float)num10), width, 12, 253, velocity.X * 0.3f, velocity.Y * 0.3f, 100, default(Color), 1.5f);
20992 Main.dust[num11].scale += (float)Main.rand.Next(-5, 3) * 0.1f;
20993 if (jump <= 0)
20994 {
20995 Main.dust[num11].scale *= 0.8f;
20996 }
20997 else
20998 {
20999 Main.dust[num11].velocity -= velocity / 5f;
21000 }
21001 Main.dust[num11].noGravity = true;
21002 Vector2 vector = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
21003 vector.Normalize();
21004 vector *= (float)Main.rand.Next(81) * 0.1f;
21005 }
21006 }
21007 if (!isPerformingJump_Blizzard || !hasJumpOption_Blizzard || canJumpAgain_Blizzard || ((gravDir != 1f || !(velocity.Y < 0f)) && (gravDir != -1f || !(velocity.Y > 0f))))
21008 {
21009 return;
21010 }
21011 int num12 = height - 6;
21012 if (gravDir == -1f)
21013 {
21014 num12 = 6;
21015 }
21016 for (int k = 0; k < 2; k++)
21017 {
21018 int num13 = Dust.NewDust(new Vector2(position.X, position.Y + (float)num12), width, 12, 76, velocity.X * 0.3f, velocity.Y * 0.3f);
21019 Main.dust[num13].velocity *= 0.1f;
21020 if (k == 0)
21021 {
21022 Main.dust[num13].velocity += velocity * 0.03f;
21023 }
21024 else
21025 {
21026 Main.dust[num13].velocity -= velocity * 0.03f;
21027 }
21028 Main.dust[num13].velocity -= velocity * 0.1f;
21029 Main.dust[num13].noGravity = true;
21030 Main.dust[num13].noLight = true;
21031 }
21032 for (int l = 0; l < 3; l++)
21033 {
21034 int num14 = Dust.NewDust(new Vector2(position.X, position.Y + (float)num12), width, 12, 76, velocity.X * 0.3f, velocity.Y * 0.3f);
21035 Main.dust[num14].fadeIn = 1.5f;
21036 Main.dust[num14].velocity *= 0.6f;
21037 Main.dust[num14].velocity += velocity * 0.8f;
21038 Main.dust[num14].noGravity = true;
21039 Main.dust[num14].noLight = true;
21040 }
21041 for (int m = 0; m < 3; m++)
21042 {
21043 int num15 = Dust.NewDust(new Vector2(position.X, position.Y + (float)num12), width, 12, 76, velocity.X * 0.3f, velocity.Y * 0.3f);
21044 Main.dust[num15].fadeIn = 1.5f;
21045 Main.dust[num15].velocity *= 0.6f;
21046 Main.dust[num15].velocity -= velocity * 0.8f;
21047 Main.dust[num15].noGravity = true;
21048 Main.dust[num15].noLight = true;
21049 }
21050 }
21051
21052 public void WingMovement()
21053 {
21054 if (wingsLogic == 4 && TryingToHoverUp)
21055 {
21056 velocity.Y -= 0.2f * gravDir;
21057 if (gravDir == 1f)
21058 {
21059 if (velocity.Y > 0f)
21060 {
21061 velocity.Y -= 1f;
21062 }
21063 else if (velocity.Y > 0f - jumpSpeed)
21064 {
21065 velocity.Y -= 0.2f;
21066 }
21067 if (velocity.Y < (0f - jumpSpeed) * 3f)
21068 {
21069 velocity.Y = (0f - jumpSpeed) * 3f;
21070 }
21071 }
21072 else
21073 {
21074 if (velocity.Y < 0f)
21075 {
21076 velocity.Y += 1f;
21077 }
21078 else if (velocity.Y < jumpSpeed)
21079 {
21080 velocity.Y += 0.2f;
21081 }
21082 if (velocity.Y > jumpSpeed * 3f)
21083 {
21084 velocity.Y = jumpSpeed * 3f;
21085 }
21086 }
21087 wingTime -= 2f;
21088 }
21089 else
21090 {
21091 float num = 0.1f;
21092 float num2 = 0.5f;
21093 float num3 = 1.5f;
21094 float num4 = 0.5f;
21095 float num5 = 0.1f;
21096 if (wingsLogic == 26)
21097 {
21098 num2 = 0.75f;
21099 num5 = 0.15f;
21100 num4 = 1f;
21101 num3 = 2.5f;
21102 num = 0.125f;
21103 }
21104 if (wingsLogic == 8 || wingsLogic == 11 || wingsLogic == 24 || wingsLogic == 27 || wingsLogic == 22)
21105 {
21106 num3 = 1.66f;
21107 }
21108 if (wingsLogic == 21 || wingsLogic == 12 || wingsLogic == 20 || wingsLogic == 23)
21109 {
21110 num3 = 1.805f;
21111 }
21112 if (wingsLogic == 37)
21113 {
21114 num2 = 0.75f;
21115 num5 = 0.15f;
21116 num4 = 1f;
21117 num3 = 2.5f;
21118 num = 0.125f;
21119 }
21120 if (wingsLogic == 44)
21121 {
21122 num2 = 0.85f;
21123 num5 = 0.15f;
21124 num4 = 1f;
21125 num3 = 2.75f;
21126 num = 0.125f;
21127 if (TryingToHoverUp)
21128 {
21129 velocity.Y -= 0.4f * gravDir;
21130 if (gravDir == 1f)
21131 {
21132 if (velocity.Y > 0f)
21133 {
21134 velocity.Y -= 1f;
21135 }
21136 else if (velocity.Y > 0f - jumpSpeed)
21137 {
21138 velocity.Y -= 0.2f;
21139 }
21140 if (velocity.Y < (0f - jumpSpeed) * 3f)
21141 {
21142 velocity.Y = (0f - jumpSpeed) * 3f;
21143 }
21144 }
21145 else
21146 {
21147 if (velocity.Y < 0f)
21148 {
21149 velocity.Y += 1f;
21150 }
21151 else if (velocity.Y < jumpSpeed)
21152 {
21153 velocity.Y += 0.2f;
21154 }
21155 if (velocity.Y > jumpSpeed * 3f)
21156 {
21157 velocity.Y = jumpSpeed * 3f;
21158 }
21159 }
21160 }
21161 if (TryingToHoverDown && !controlJump && velocity.Y != 0f)
21162 {
21163 velocity.Y += 0.4f;
21164 }
21165 }
21166 if (wingsLogic == 45)
21167 {
21168 num2 = 0.95f;
21169 num5 = 0.15f;
21170 num4 = 1f;
21171 num3 = 4.5f;
21172 if (TryingToHoverUp)
21173 {
21174 velocity.Y -= 0.4f * gravDir;
21175 if (gravDir == 1f)
21176 {
21177 if (velocity.Y > 0f)
21178 {
21179 velocity.Y -= 1f;
21180 }
21181 else if (velocity.Y > 0f - jumpSpeed)
21182 {
21183 velocity.Y -= 0.2f;
21184 }
21185 if (velocity.Y < (0f - jumpSpeed) * 3f)
21186 {
21187 velocity.Y = (0f - jumpSpeed) * 3f;
21188 }
21189 }
21190 else
21191 {
21192 if (velocity.Y < 0f)
21193 {
21194 velocity.Y += 1f;
21195 }
21196 else if (velocity.Y < jumpSpeed)
21197 {
21198 velocity.Y += 0.2f;
21199 }
21200 if (velocity.Y > jumpSpeed * 3f)
21201 {
21202 velocity.Y = jumpSpeed * 3f;
21203 }
21204 }
21205 }
21206 if (TryingToHoverDown && !controlJump && velocity.Y != 0f)
21207 {
21208 velocity.Y += 0.4f;
21209 }
21210 }
21211 if (wingsLogic == 29 || wingsLogic == 32)
21212 {
21213 num2 = 0.85f;
21214 num5 = 0.15f;
21215 num4 = 1f;
21216 num3 = 3f;
21217 num = 0.135f;
21218 }
21219 if (wingsLogic == 30 || wingsLogic == 31)
21220 {
21221 num4 = 1f;
21222 num3 = 2.45f;
21223 if (!TryingToHoverDown)
21224 {
21225 num = 0.15f;
21226 }
21227 }
21228 velocity.Y -= num * gravDir;
21229 if (gravDir == 1f)
21230 {
21231 if (velocity.Y > 0f)
21232 {
21233 velocity.Y -= num2;
21234 }
21235 else if (velocity.Y > (0f - jumpSpeed) * num4)
21236 {
21237 velocity.Y -= num5;
21238 }
21239 if (velocity.Y < (0f - jumpSpeed) * num3)
21240 {
21241 velocity.Y = (0f - jumpSpeed) * num3;
21242 }
21243 }
21244 else
21245 {
21246 if (velocity.Y < 0f)
21247 {
21248 velocity.Y += num2;
21249 }
21250 else if (velocity.Y < jumpSpeed * num4)
21251 {
21252 velocity.Y += num5;
21253 }
21254 if (velocity.Y > jumpSpeed * num3)
21255 {
21256 velocity.Y = jumpSpeed * num3;
21257 }
21258 }
21259 if ((wingsLogic == 22 || wingsLogic == 28 || wingsLogic == 30 || wingsLogic == 31 || wingsLogic == 37 || wingsLogic == 45) && TryingToHoverDown && !controlLeft && !controlRight)
21260 {
21261 wingTime -= 0.5f;
21262 }
21263 else
21264 {
21265 wingTime -= 1f;
21266 }
21267 }
21268 if (empressBrooch && wingTime != 0f)
21269 {
21270 wingTime = wingTimeMax;
21271 }
21272 }
21273
21274 public void MoonLeechRope()
21275 {
21276 int num = -1;
21277 for (int i = 0; i < 1000; i++)
21278 {
21279 if (Main.projectile[i].active && Main.projectile[i].type == 456 && Main.projectile[i].ai[1] == (float)whoAmI)
21280 {
21281 num = i;
21282 break;
21283 }
21284 }
21285 if (num != -1 && !(Main.projectile[num].ai[0] < 0f))
21286 {
21287 Projectile projectile = Main.projectile[num];
21288 Vector2 vector = new Vector2(0f, 216f);
21289 Vector2 value = Main.npc[(int)Math.Abs(projectile.ai[0]) - 1].Center - base.Center + vector;
21290 if (value.Length() > 200f)
21291 {
21293 position += vector2 * (value.Length() - 200f);
21294 }
21295 }
21296 }
21297
21298 public void WOFTongue()
21299 {
21300 if (Main.wofNPCIndex < 0 || !Main.npc[Main.wofNPCIndex].active)
21301 {
21302 return;
21303 }
21304 float num = Main.npc[Main.wofNPCIndex].position.X + 40f;
21305 if (Main.npc[Main.wofNPCIndex].direction > 0)
21306 {
21307 num -= 96f;
21308 }
21309 if (position.X + (float)width > num && position.X < num + 140f && gross)
21310 {
21311 noKnockback = false;
21312 int attackDamage_ScaledByStrength = Main.npc[Main.wofNPCIndex].GetAttackDamage_ScaledByStrength(50f);
21314 }
21315 if (!gross && position.Y > (float)((Main.maxTilesY - 250) * 16) && position.X > num - 1920f && position.X < num + 1920f)
21316 {
21317 AddBuff(37, 10);
21318 SoundEngine.PlaySound(4, (int)Main.npc[Main.wofNPCIndex].position.X, (int)Main.npc[Main.wofNPCIndex].position.Y, 10);
21319 }
21320 if (gross)
21321 {
21322 if (position.Y < (float)(Main.UnderworldLayer * 16))
21323 {
21324 AddBuff(38, 10);
21325 }
21326 if (Main.npc[Main.wofNPCIndex].direction < 0)
21327 {
21328 if (position.X + (float)(width / 2) > Main.npc[Main.wofNPCIndex].position.X + (float)(Main.npc[Main.wofNPCIndex].width / 2) + 40f)
21329 {
21330 AddBuff(38, 10);
21331 }
21332 }
21333 else if (position.X + (float)(width / 2) < Main.npc[Main.wofNPCIndex].position.X + (float)(Main.npc[Main.wofNPCIndex].width / 2) - 40f)
21334 {
21335 AddBuff(38, 10);
21336 }
21337 }
21338 if (!tongued)
21339 {
21340 return;
21341 }
21342 controlHook = false;
21343 controlUseItem = false;
21344 for (int i = 0; i < 1000; i++)
21345 {
21346 if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].aiStyle == 7)
21347 {
21348 Main.projectile[i].Kill();
21349 }
21350 }
21351 Vector2 center = base.Center;
21352 float num2 = Main.npc[Main.wofNPCIndex].position.X + (float)(Main.npc[Main.wofNPCIndex].width / 2) - center.X;
21353 float num3 = Main.npc[Main.wofNPCIndex].position.Y + (float)(Main.npc[Main.wofNPCIndex].height / 2) - center.Y;
21354 if ((float)Math.Sqrt(num2 * num2 + num3 * num3) > 3000f)
21355 {
21356 KillMe(PlayerDeathReason.ByOther(11), 1000.0, 0);
21357 }
21358 else if (Main.npc[Main.wofNPCIndex].position.X < 608f || Main.npc[Main.wofNPCIndex].position.X > (float)((Main.maxTilesX - 38) * 16))
21359 {
21360 KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0);
21361 }
21362 }
21363
21364 public void StatusFromNPC(NPC npc)
21365 {
21366 if (Main.expertMode && ((npc.type == 266 && Main.rand.Next(3) == 0) || npc.type == 267))
21367 {
21368 int num = Main.rand.Next(9);
21369 if (num == 2 || num == 4)
21370 {
21371 num = Main.rand.Next(9);
21372 }
21373 float num2 = (float)Main.rand.Next(75, 150) * 0.01f;
21374 switch (num)
21375 {
21376 case 0:
21377 AddBuff(20, (int)(60f * num2 * 3.5f));
21378 break;
21379 case 1:
21380 AddBuff(22, (int)(60f * num2 * 2f));
21381 break;
21382 case 2:
21383 AddBuff(23, (int)(60f * num2 * 0.5f));
21384 break;
21385 case 3:
21386 AddBuff(30, (int)(60f * num2 * 5f));
21387 break;
21388 case 4:
21389 AddBuff(31, (int)(60f * num2 * 1f));
21390 break;
21391 case 5:
21392 AddBuff(32, (int)(60f * num2 * 3.5f));
21393 break;
21394 case 6:
21395 AddBuff(33, (int)(60f * num2 * 7.5f));
21396 break;
21397 case 7:
21398 AddBuff(35, (int)(60f * num2 * 1f));
21399 break;
21400 case 8:
21401 AddBuff(36, (int)((double)(60f * num2) * 6.5));
21402 break;
21403 }
21404 }
21405 if (npc.type == 530 || npc.type == 531)
21406 {
21407 AddBuff(70, Main.rand.Next(240, 241));
21408 }
21409 if (npc.type == 159 || npc.type == 158)
21410 {
21411 AddBuff(30, Main.rand.Next(300, 600));
21412 }
21413 if (npc.type == 525)
21414 {
21415 AddBuff(39, 240);
21416 }
21417 if (npc.type == 526)
21418 {
21419 AddBuff(69, 420);
21420 }
21421 if (npc.type == 527)
21422 {
21423 AddBuff(31, 840);
21424 }
21425 if (Main.expertMode && (npc.type == 49 || npc.type == 93 || npc.type == 51 || npc.type == 152 || npc.type == 634) && Main.rand.Next(10) == 0)
21426 {
21427 AddBuff(148, Main.rand.Next(1800, 5400));
21428 }
21429 if (Main.expertMode && npc.type == 222)
21430 {
21431 AddBuff(20, Main.rand.Next(60, 240));
21432 }
21433 if (Main.expertMode && (npc.type == 210 || npc.type == 211))
21434 {
21435 AddBuff(20, Main.rand.Next(60, 180));
21436 }
21437 if (Main.expertMode && npc.type == 35)
21438 {
21439 AddBuff(30, Main.rand.Next(180, 300));
21440 }
21441 if (Main.expertMode && npc.type == 36 && Main.rand.Next(2) == 0)
21442 {
21443 AddBuff(32, Main.rand.Next(30, 60));
21444 }
21445 if (npc.type >= 269 && npc.type <= 272)
21446 {
21447 if (Main.rand.Next(3) == 0)
21448 {
21449 AddBuff(30, 600);
21450 }
21451 else if (Main.rand.Next(3) == 0)
21452 {
21453 AddBuff(32, 300);
21454 }
21455 }
21456 if (npc.type >= 273 && npc.type <= 276 && Main.rand.Next(2) == 0)
21457 {
21458 AddBuff(36, 600);
21459 }
21460 if (npc.type >= 277 && npc.type <= 280)
21461 {
21462 AddBuff(24, 600);
21463 }
21464 if (npc.type == 371)
21465 {
21466 AddBuff(103, 60 * Main.rand.Next(3, 8));
21467 }
21468 if (npc.type == 370 && Main.expertMode)
21469 {
21470 int num3 = Utils.SelectRandom<int>(Main.rand, 0, 148, 30);
21471 if (num3 != 0)
21472 {
21473 AddBuff(num3, 60 * Main.rand.Next(3, 11));
21474 }
21475 }
21476 if (((npc.type == 1 && npc.netID == -6) || npc.type == 81 || npc.type == 79 || npc.type == 183 || npc.type == 630) && Main.rand.Next(4) == 0)
21477 {
21478 AddBuff(22, 900);
21479 }
21480 if ((npc.type == 23 || npc.type == 25) && Main.rand.Next(3) == 0)
21481 {
21482 AddBuff(24, 420);
21483 }
21484 if ((npc.type == 34 || npc.type == 83 || npc.type == 84 || npc.type == 179 || npc.type == 289) && Main.rand.Next(3) == 0)
21485 {
21486 AddBuff(23, 240);
21487 }
21488 if ((npc.type == 104 || npc.type == 102) && Main.rand.Next(8) == 0)
21489 {
21490 AddBuff(30, 2700);
21491 }
21492 if (npc.type == 75 && Main.rand.Next(10) == 0)
21493 {
21494 AddBuff(35, 420);
21495 }
21496 if ((npc.type == 163 || npc.type == 238 || npc.type == 236 || npc.type == 237) && Main.rand.Next(10) == 0)
21497 {
21498 AddBuff(70, 240);
21499 }
21500 if ((npc.type == 79 || npc.type == 103 || npc.type == 630) && Main.rand.Next(5) == 0)
21501 {
21502 AddBuff(35, 420);
21503 }
21504 if ((npc.type == 75 || npc.type == 78 || npc.type == 82) && Main.rand.Next(8) == 0)
21505 {
21506 AddBuff(32, 900);
21507 }
21508 if ((npc.type == 93 || npc.type == 109 || npc.type == 80) && Main.rand.Next(14) == 0)
21509 {
21510 AddBuff(31, 300);
21511 }
21512 if (npc.type >= 305 && npc.type <= 314 && Main.rand.Next(10) == 0)
21513 {
21514 AddBuff(33, 3600);
21515 }
21516 if (npc.type == 77 && Main.rand.Next(6) == 0)
21517 {
21518 AddBuff(36, 7200);
21519 }
21520 if (npc.type == 112 && Main.rand.Next(20) == 0)
21521 {
21522 AddBuff(33, 18000);
21523 }
21524 if (npc.type == 182 && Main.rand.Next(25) == 0)
21525 {
21526 AddBuff(33, 7200);
21527 }
21528 if (npc.type == 141 && Main.rand.Next(2) == 0)
21529 {
21530 AddBuff(20, 600);
21531 }
21532 if (npc.type == 147 && !frozen && Main.rand.Next(12) == 0)
21533 {
21534 AddBuff(46, 600);
21535 }
21536 if (npc.type == 150)
21537 {
21538 if (Main.rand.Next(2) == 0)
21539 {
21540 AddBuff(46, 900);
21541 }
21542 if (!frozen && Main.rand.Next(35) == 0)
21543 {
21544 AddBuff(47, 60);
21545 }
21546 else if (!frozen && Main.expertMode && Main.rand.Next(35) == 0)
21547 {
21548 AddBuff(47, 60);
21549 }
21550 }
21551 if (npc.type == 184)
21552 {
21553 AddBuff(46, 1200);
21554 if (!frozen && Main.rand.Next(15) == 0)
21555 {
21556 AddBuff(47, 60);
21557 }
21558 else if (!frozen && Main.expertMode && Main.rand.Next(25) == 0)
21559 {
21560 AddBuff(47, 60);
21561 }
21562 }
21563 }
21564
21565 public void GrappleMovement()
21566 {
21567 if (grappling[0] < 0)
21568 {
21569 return;
21570 }
21571 StopVanityActions();
21572 if (Main.myPlayer == whoAmI && mount.Active)
21573 {
21574 mount.Dismount(this);
21575 }
21576 canCarpet = true;
21577 carpetFrame = -1;
21578 wingFrame = 1;
21579 if (velocity.Y == 0f || (wet && (double)velocity.Y > -0.02 && (double)velocity.Y < 0.02))
21580 {
21581 wingFrame = 0;
21582 }
21583 if (wings == 4)
21584 {
21585 wingFrame = 3;
21586 }
21587 if (wings == 30)
21588 {
21589 wingFrame = 0;
21590 }
21591 RefreshMovementAbilities();
21592 rocketFrame = false;
21593 canRocket = false;
21594 rocketRelease = false;
21595 fallStart = (int)(position.Y / 16f);
21596 int num = -1;
21597 for (int i = 0; i < grapCount; i++)
21598 {
21599 if (Main.projectile[grappling[i]].type == 403)
21600 {
21601 num = i;
21602 }
21603 }
21605 if (preferedPlayerVelocityY > 0f)
21606 {
21607 GoingDownWithGrapple = true;
21608 }
21609 velocity.X = preferedPlayerVelocityX;
21610 velocity.Y = preferedPlayerVelocityY;
21611 if (num != -1)
21612 {
21613 Projectile projectile = Main.projectile[grappling[num]];
21614 if (projectile.position.X < position.X + (float)width && projectile.position.X + (float)projectile.width >= position.X && projectile.position.Y < position.Y + (float)height && projectile.position.Y + (float)projectile.height >= position.Y)
21615 {
21616 int num2 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16;
21617 int num3 = (int)(projectile.position.Y + (float)(projectile.height / 2)) / 16;
21618 velocity = Vector2.Zero;
21619 if (Main.tile[num2, num3].type == 314)
21620 {
21621 Vector2 Position = default(Vector2);
21622 Position.X = projectile.position.X + (float)(projectile.width / 2) - (float)(width / 2);
21623 Position.Y = projectile.position.Y + (float)(projectile.height / 2) - (float)(height / 2);
21624 RemoveAllGrapplingHooks();
21625 int num4 = 13;
21626 if (miscEquips[2].stack > 0 && miscEquips[2].mountType >= 0 && MountID.Sets.Cart[miscEquips[2].mountType] && (!miscEquips[2].expertOnly || Main.expertMode))
21627 {
21628 num4 = miscEquips[2].mountType;
21629 }
21630 int num5 = height + Mount.GetHeightBoost(num4);
21632 {
21633 position = Position;
21634 DelegateMethods.Minecart.rotation = fullRotation;
21635 DelegateMethods.Minecart.rotationOrigin = fullRotationOrigin;
21636 mount.SetMount(num4, this, minecartLeft);
21637 Minecart.WheelSparks(mount.Delegations.MinecartDust, position, width, height, 25);
21638 }
21639 }
21640 }
21641 }
21642 if (itemAnimation == 0)
21643 {
21644 if (velocity.X == 0f && preferredPlayerDirectionToSet.HasValue)
21645 {
21646 ChangeDir(preferredPlayerDirectionToSet.Value);
21647 }
21648 if (velocity.X > 0f)
21649 {
21650 ChangeDir(1);
21651 }
21652 if (velocity.X < 0f)
21653 {
21654 ChangeDir(-1);
21655 }
21656 }
21657 if (controlJump)
21658 {
21659 if (releaseJump)
21660 {
21661 if ((velocity.Y == 0f || (wet && (double)velocity.Y > -0.02 && (double)velocity.Y < 0.02)) && !controlDown)
21662 {
21663 velocity.Y = 0f - jumpSpeed;
21664 jump = jumpHeight / 2;
21665 releaseJump = false;
21666 }
21667 else
21668 {
21669 velocity.Y += 0.01f;
21670 releaseJump = false;
21671 }
21672 RefreshDoubleJumps();
21673 RemoveAllGrapplingHooks();
21674 }
21675 }
21676 else
21677 {
21678 releaseJump = true;
21679 }
21680 }
21681
21683 {
21684 int num = 150;
21685 Vector2 vector = position;
21686 Vector2 vector2 = velocity;
21687 for (int i = 0; i < num; i++)
21688 {
21689 vector2 = (vector + base.Size / 2f).DirectionTo(targetPosition).SafeNormalize(Vector2.Zero) * 12f;
21690 Vector2 vector3 = Collision.TileCollision(vector, vector2, width, height, fallThrough: true, fall2: true, (int)gravDir);
21691 vector += vector3;
21692 }
21693 int num2 = 10;
21694 _ = vector - position;
21695 Teleport(vector, num2);
21696 NetMessage.SendData(65, -1, -1, null, 0, whoAmI, vector.X, vector.Y, num2);
21697 }
21698
21700 {
21701 float num = 0f;
21702 float num2 = 0f;
21704 int num3 = 0;
21705 for (int i = 0; i < grapCount; i++)
21706 {
21707 Projectile projectile = Main.projectile[grappling[i]];
21708 if (projectile.ai[0] != 2f || projectile.position.HasNaNs())
21709 {
21710 continue;
21711 }
21712 num += projectile.position.X + (float)(projectile.width / 2);
21713 num2 += projectile.position.Y + (float)(projectile.height / 2);
21714 num3++;
21715 if (projectile.type == 446)
21716 {
21717 Vector2 vector = new Vector2(controlRight.ToInt() - controlLeft.ToInt(), (float)(controlDown.ToInt() - controlUp.ToInt()) * gravDir);
21718 if (vector != Vector2.Zero)
21719 {
21720 vector.Normalize();
21721 }
21722 vector *= 100f;
21723 Vector2 vec = Vector2.Normalize(base.Center - projectile.Center + vector);
21724 if (vec.HasNaNs())
21725 {
21726 vec = -Vector2.UnitY;
21727 }
21728 float num4 = 200f;
21729 num += vec.X * num4;
21730 num2 += vec.Y * num4;
21731 }
21732 else if (projectile.type == 652)
21733 {
21734 Vector2 vector2 = new Vector2(controlRight.ToInt() - controlLeft.ToInt(), (float)(controlDown.ToInt() - controlUp.ToInt()) * gravDir).SafeNormalize(Vector2.Zero);
21735 Vector2 vector3 = projectile.Center - base.Center;
21736 Vector2 vector4 = vector3.SafeNormalize(Vector2.Zero);
21738 if (vector2 != Vector2.Zero)
21739 {
21741 }
21742 float num5 = 6f;
21743 if (Vector2.Dot(value, vector3) < 0f && vector3.Length() >= 600f)
21744 {
21745 num5 = 0f;
21746 }
21747 num += 0f - vector3.X + value.X * num5;
21748 num2 += 0f - vector3.Y + value.Y * num5;
21749 }
21750 else if (projectile.type == 865)
21751 {
21752 Vector2 vector5 = (projectile.rotation - (float)Math.PI / 2f).ToRotationVector2().SafeNormalize(Vector2.UnitY);
21753 Vector2 vector6 = -vector5 * 28f;
21754 num += vector6.X;
21755 num2 += vector6.Y;
21756 if (vector5.X != 0f)
21757 {
21759 }
21760 }
21761 }
21762 if (num3 == 0)
21763 {
21764 preferedPlayerVelocityX = velocity.X;
21765 preferedPlayerVelocityY = velocity.Y;
21766 return;
21767 }
21768 float num6 = num / (float)num3;
21769 float num7 = num2 / (float)num3;
21774 float num9 = 11f;
21775 if (Main.projectile[grappling[0]].type == 315)
21776 {
21777 num9 = 14f;
21778 }
21779 if (Main.projectile[grappling[0]].type == 487)
21780 {
21781 num9 = 12f;
21782 }
21783 if (Main.projectile[grappling[0]].type >= 646 && Main.projectile[grappling[0]].type <= 649)
21784 {
21785 num9 = 16f;
21786 }
21787 float num10 = num8;
21788 num10 = ((!(num8 > num9)) ? 1f : (num9 / num8));
21791 }
21792
21793 private void RefreshMovementAbilities(bool doubleJumps = true)
21794 {
21795 wingTime = wingTimeMax;
21796 rocketTime = rocketTimeMax;
21797 rocketDelay = 0;
21798 if (doubleJumps)
21799 {
21800 RefreshDoubleJumps();
21801 }
21802 }
21803
21804 private void RefreshDoubleJumps()
21805 {
21806 if (hasJumpOption_Cloud)
21807 {
21808 canJumpAgain_Cloud = true;
21809 }
21810 if (hasJumpOption_Sandstorm)
21811 {
21812 canJumpAgain_Sandstorm = true;
21813 }
21814 if (hasJumpOption_Blizzard)
21815 {
21816 canJumpAgain_Blizzard = true;
21817 }
21818 if (hasJumpOption_Fart)
21819 {
21820 canJumpAgain_Fart = true;
21821 }
21822 if (hasJumpOption_Sail)
21823 {
21824 canJumpAgain_Sail = true;
21825 }
21826 if (hasJumpOption_Unicorn)
21827 {
21828 canJumpAgain_Unicorn = true;
21829 }
21830 if (hasJumpOption_Santank)
21831 {
21832 canJumpAgain_Santank = true;
21833 }
21834 if (hasJumpOption_WallOfFleshGoat)
21835 {
21836 canJumpAgain_WallOfFleshGoat = true;
21837 }
21838 if (hasJumpOption_Basilisk)
21839 {
21840 canJumpAgain_Basilisk = true;
21841 }
21842 }
21843
21844 public void StickyMovement()
21845 {
21846 if (shimmering)
21847 {
21848 return;
21849 }
21850 bool flag = false;
21851 if (mount.Type > 0 && MountID.Sets.Cart[mount.Type] && Math.Abs(velocity.X) > 5f)
21852 {
21853 flag = true;
21854 }
21855 int num = width / 2;
21856 int num2 = height / 2;
21857 new Vector2(position.X + (float)(width / 2) - (float)(num / 2), position.Y + (float)(height / 2) - (float)(num2 / 2));
21858 Vector2 vector = Collision.StickyTiles(position, velocity, width, height);
21859 if (vector.Y != -1f && vector.X != -1f)
21860 {
21861 int num3 = (int)vector.X;
21862 int num4 = (int)vector.Y;
21863 int type = Main.tile[num3, num4].type;
21864 if (whoAmI == Main.myPlayer && type == 51 && (velocity.X != 0f || velocity.Y != 0f))
21865 {
21866 stickyBreak++;
21867 if (stickyBreak > Main.rand.Next(20, 100) || flag)
21868 {
21869 stickyBreak = 0;
21871 if (Main.netMode == 1 && !Main.tile[num3, num4].active() && Main.netMode == 1)
21872 {
21873 NetMessage.SendData(17, -1, -1, null, 0, num3, num4);
21874 }
21875 }
21876 }
21877 if (flag)
21878 {
21879 return;
21880 }
21881 fallStart = (int)(position.Y / 16f);
21882 if (type != 229)
21883 {
21884 jump = 0;
21885 }
21886 if (velocity.X > 1f)
21887 {
21888 velocity.X = 1f;
21889 }
21890 if (velocity.X < -1f)
21891 {
21892 velocity.X = -1f;
21893 }
21894 if ((double)velocity.X > 0.75 || (double)velocity.X < -0.75)
21895 {
21896 velocity.X *= 0.85f;
21897 }
21898 else
21899 {
21900 velocity.X *= 0.6f;
21901 }
21902 if (gravDir == -1f)
21903 {
21904 if (velocity.Y < -1f)
21905 {
21906 velocity.Y = -1f;
21907 }
21908 if (velocity.Y > 5f)
21909 {
21910 velocity.Y = 5f;
21911 }
21912 if (velocity.Y > 0f)
21913 {
21914 velocity.Y *= 0.96f;
21915 }
21916 else
21917 {
21918 velocity.Y *= 0.3f;
21919 }
21920 }
21921 else
21922 {
21923 if (velocity.Y > 1f)
21924 {
21925 velocity.Y = 1f;
21926 }
21927 if (velocity.Y < -5f)
21928 {
21929 velocity.Y = -5f;
21930 }
21931 if (velocity.Y < 0f)
21932 {
21933 velocity.Y *= 0.96f;
21934 }
21935 else
21936 {
21937 velocity.Y *= 0.3f;
21938 }
21939 }
21940 if (type != 229 || Main.rand.Next(5) != 0 || (!((double)velocity.Y > 0.15) && !(velocity.Y < 0f)))
21941 {
21942 return;
21943 }
21944 if ((float)(num3 * 16) < position.X + (float)(width / 2))
21945 {
21946 int num5 = Dust.NewDust(new Vector2(position.X - 4f, num4 * 16), 4, 16, 153, 0f, 0f, 50);
21947 Main.dust[num5].scale += (float)Main.rand.Next(0, 6) * 0.1f;
21948 Main.dust[num5].velocity *= 0.1f;
21949 Main.dust[num5].noGravity = true;
21950 }
21951 else
21952 {
21953 int num6 = Dust.NewDust(new Vector2(position.X + (float)width - 2f, num4 * 16), 4, 16, 153, 0f, 0f, 50);
21954 Main.dust[num6].scale += (float)Main.rand.Next(0, 6) * 0.1f;
21955 Main.dust[num6].velocity *= 0.1f;
21956 Main.dust[num6].noGravity = true;
21957 }
21958 if (Main.tile[num3, num4 + 1] != null && Main.tile[num3, num4 + 1].type == 229 && position.Y + (float)height > (float)((num4 + 1) * 16))
21959 {
21960 if ((float)(num3 * 16) < position.X + (float)(width / 2))
21961 {
21962 int num7 = Dust.NewDust(new Vector2(position.X - 4f, num4 * 16 + 16), 4, 16, 153, 0f, 0f, 50);
21963 Main.dust[num7].scale += (float)Main.rand.Next(0, 6) * 0.1f;
21964 Main.dust[num7].velocity *= 0.1f;
21965 Main.dust[num7].noGravity = true;
21966 }
21967 else
21968 {
21969 int num8 = Dust.NewDust(new Vector2(position.X + (float)width - 2f, num4 * 16 + 16), 4, 16, 153, 0f, 0f, 50);
21970 Main.dust[num8].scale += (float)Main.rand.Next(0, 6) * 0.1f;
21971 Main.dust[num8].velocity *= 0.1f;
21972 Main.dust[num8].noGravity = true;
21973 }
21974 }
21975 if (Main.tile[num3, num4 + 2] != null && Main.tile[num3, num4 + 2].type == 229 && position.Y + (float)height > (float)((num4 + 2) * 16))
21976 {
21977 if ((float)(num3 * 16) < position.X + (float)(width / 2))
21978 {
21979 int num9 = Dust.NewDust(new Vector2(position.X - 4f, num4 * 16 + 32), 4, 16, 153, 0f, 0f, 50);
21980 Main.dust[num9].scale += (float)Main.rand.Next(0, 6) * 0.1f;
21981 Main.dust[num9].velocity *= 0.1f;
21982 Main.dust[num9].noGravity = true;
21983 }
21984 else
21985 {
21986 int num10 = Dust.NewDust(new Vector2(position.X + (float)width - 2f, num4 * 16 + 32), 4, 16, 153, 0f, 0f, 50);
21987 Main.dust[num10].scale += (float)Main.rand.Next(0, 6) * 0.1f;
21988 Main.dust[num10].velocity *= 0.1f;
21989 Main.dust[num10].noGravity = true;
21990 }
21991 }
21992 }
21993 else
21994 {
21995 stickyBreak = 0;
21996 }
21997 }
21998
22000 {
22001 return IsStackingItems();
22002 }
22003
22004 public bool IsStackingItems()
22005 {
22006 for (int i = 0; i < inventoryChestStack.Length; i++)
22007 {
22008 if (inventoryChestStack[i])
22009 {
22010 if (inventory[i].type != 0 && inventory[i].stack != 0)
22011 {
22012 return true;
22013 }
22014 inventoryChestStack[i] = false;
22015 }
22016 }
22017 if (disableVoidBag >= 0)
22018 {
22019 return true;
22020 }
22021 return false;
22022 }
22023
22025 {
22026 List<int> list = new List<int>();
22027 Vector2 center = base.Center;
22028 for (int i = 0; i < 1000; i++)
22029 {
22030 Projectile projectile = Main.projectile[i];
22031 if (!projectile.active)
22032 {
22033 continue;
22034 }
22035 int containerIndex = -1;
22036 if (projectile.TryGetContainerIndex(out containerIndex))
22037 {
22038 Point point = projectile.Hitbox.ClosestPointInRect(center).ToTileCoordinates();
22039 if (IsInTileInteractionRange(point.X, point.Y, TileReachCheckSettings.QuickStackToNearbyChests))
22040 {
22041 list.Add(i);
22042 }
22043 }
22044 }
22045 return list;
22046 }
22047
22049 {
22050 List<int> projectilesToInteractWith = _projectilesToInteractWith;
22053 {
22054 return;
22055 }
22056 Vector2 compareSpot = base.Center;
22057 for (int i = 0; i < 1000; i++)
22058 {
22060 if (IsProjectileInteractibleAndInInteractionRange(proj, ref compareSpot))
22061 {
22063 }
22064 }
22065 }
22066
22068 {
22069 if (!proj.active)
22070 {
22071 return false;
22072 }
22073 if (!proj.IsInteractible())
22074 {
22075 return false;
22076 }
22077 Point point = proj.Hitbox.ClosestPointInRect(compareSpot).ToTileCoordinates();
22078 if (!IsInTileInteractionRange(point.X, point.Y, TileReachCheckSettings.Simple))
22079 {
22080 return false;
22081 }
22082 return true;
22083 }
22084
22085 public bool useVoidBag()
22086 {
22087 for (int i = 0; i < 58; i++)
22088 {
22089 if (inventory[i].stack > 0 && inventory[i].type == 4131)
22090 {
22091 return true;
22092 }
22093 }
22094 return false;
22095 }
22096
22098 {
22099 if (HasLockedInventory())
22100 {
22101 return;
22102 }
22103 List<int> nearbyContainerProjectilesList = GetNearbyContainerProjectilesList();
22104 for (int i = 0; i < nearbyContainerProjectilesList.Count; i++)
22105 {
22108 {
22110 int num = chest;
22111 chest = containerIndex;
22112 ChestUI.QuickStack(context);
22113 if (useVoidBag())
22114 {
22115 ChestUI.QuickStack(context, voidStack: true);
22116 }
22117 chest = num;
22118 }
22119 }
22120 int num2 = 39;
22121 int num3 = (int)(base.Center.X / 16f);
22122 int num4 = (int)(base.Center.Y / 16f);
22123 for (int j = num3 - num2; j <= num3 + num2; j++)
22124 {
22126 {
22127 continue;
22128 }
22129 for (int k = num4 - num2; k <= num4 + num2; k++)
22130 {
22132 {
22133 continue;
22134 }
22135 int num5 = 0;
22136 if (Main.tile[j, k].type == 29)
22137 {
22138 num5 = -2;
22139 }
22140 else if (Main.tile[j, k].type == 97)
22141 {
22142 num5 = -3;
22143 }
22144 else if (Main.tile[j, k].type == 463)
22145 {
22146 num5 = -4;
22147 }
22148 else if (Main.tile[j, k].type == 491)
22149 {
22150 num5 = -5;
22151 }
22152 if (num5 < 0 && (new Vector2(j * 16 + 8, k * 16 + 8) - base.Center).Length() < 600f)
22153 {
22155 int num6 = chest;
22156 chest = num5;
22158 if (useVoidBag())
22159 {
22161 }
22162 chest = num6;
22163 }
22164 }
22165 }
22166 if (Main.netMode == 1)
22167 {
22168 for (int l = 10; l < 50; l++)
22169 {
22170 if (inventory[l].type > 0 && inventory[l].stack > 0 && !inventory[l].favorited && !inventory[l].IsACoin)
22171 {
22172 NetMessage.SendData(5, -1, -1, null, whoAmI, PlayerItemSlotID.Inventory0 + l, (int)inventory[l].prefix);
22173 NetMessage.SendData(85, -1, -1, null, PlayerItemSlotID.Inventory0 + l);
22174 inventoryChestStack[l] = true;
22175 }
22176 }
22177 if (!useVoidBag())
22178 {
22179 return;
22180 }
22181 for (int m = 0; m < 40; m++)
22182 {
22183 if (bank4.item[m].type > 0 && bank4.item[m].stack > 0 && !bank4.item[m].favorited && !bank4.item[m].IsACoin)
22184 {
22185 NetMessage.SendData(5, -1, -1, null, whoAmI, PlayerItemSlotID.Bank4_0 + m, (int)bank4.item[m].prefix);
22186 NetMessage.SendData(85, -1, -1, null, PlayerItemSlotID.Bank4_0 + m);
22187 disableVoidBag = m;
22188 }
22189 }
22190 return;
22191 }
22192 for (int n = 10; n < 50; n++)
22193 {
22194 if (inventory[n].type > 0 && inventory[n].stack > 0 && !inventory[n].favorited && !inventory[n].IsACoin)
22195 {
22196 int type = inventory[n].type;
22197 int stack = inventory[n].stack;
22198 inventory[n] = Chest.PutItemInNearbyChest(inventory[n], base.Center);
22199 if (inventory[n].type == type)
22200 {
22201 _ = inventory[n].stack;
22202 }
22203 }
22204 }
22205 if (!useVoidBag())
22206 {
22207 return;
22208 }
22209 for (int num7 = 0; num7 < 40; num7++)
22210 {
22211 if (bank4.item[num7].type > 0 && bank4.item[num7].stack > 0 && !bank4.item[num7].favorited && !bank4.item[num7].IsACoin)
22212 {
22213 int type2 = bank4.item[num7].type;
22214 int stack2 = bank4.item[num7].stack;
22215 bank4.item[num7] = Chest.PutItemInNearbyChest(bank4.item[num7], base.Center);
22216 if (bank4.item[num7].type == type2)
22217 {
22218 _ = bank4.item[num7].stack;
22219 }
22220 }
22221 }
22222 }
22223
22224 public void CheckDrowning()
22225 {
22226 bool flag = Collision.DrownCollision(position, width, height, gravDir);
22227 if (armor[0].type == 250 || armor[0].type == 4275)
22228 {
22229 flag = true;
22230 }
22231 if (inventory[selectedItem].type == 186 && itemAnimation == 0)
22232 {
22233 try
22234 {
22235 int num = (int)((position.X + (float)(width / 2) + (float)(6 * direction)) / 16f);
22236 int num2 = 0;
22237 if (gravDir == -1f)
22238 {
22239 num2 = height;
22240 }
22241 int num3 = (int)((position.Y + (float)num2 - 44f * gravDir) / 16f);
22242 if (Main.tile[num, num3] != null && Main.tile[num, num3].liquid < 128)
22243 {
22244 if (Main.tile[num, num3] == null)
22245 {
22246 Main.tile[num, num3] = new Tile();
22247 }
22248 if (!Main.tile[num, num3].active() || !Main.tileSolid[Main.tile[num, num3].type] || Main.tileSolidTop[Main.tile[num, num3].type])
22249 {
22250 flag = false;
22251 }
22252 }
22253 }
22254 catch
22255 {
22256 }
22257 }
22258 if (gills)
22259 {
22260 flag = Main.getGoodWorld && !flag;
22261 }
22262 if (shimmering)
22263 {
22264 flag = false;
22265 }
22266 if (mount.Active && mount.Type == 4)
22267 {
22268 flag = false;
22269 }
22270 if (Main.myPlayer == whoAmI)
22271 {
22272 if (accMerman)
22273 {
22274 if (flag)
22275 {
22276 merman = true;
22277 }
22278 flag = false;
22279 }
22280 if (flag)
22281 {
22282 breathCD++;
22283 if (breathCD >= breathCDMax)
22284 {
22285 breathCD = 0;
22286 breath--;
22287 if (breath == 0)
22288 {
22290 }
22291 if (breath <= 0)
22292 {
22293 lifeRegenTime = 0f;
22294 breath = 0;
22295 statLife -= 2;
22296 if (statLife <= 0)
22297 {
22298 statLife = 0;
22299 KillMe(PlayerDeathReason.ByOther(1), 10.0, 0);
22300 }
22301 }
22302 }
22303 }
22304 else
22305 {
22306 breath += 3;
22307 if (breath > breathMax)
22308 {
22309 breath = breathMax;
22310 }
22311 breathCD = 0;
22312 }
22313 }
22314 if (flag && Main.rand.Next(20) == 0 && !lavaWet && !honeyWet)
22315 {
22316 int num4 = 0;
22317 if (gravDir == -1f)
22318 {
22319 num4 += height - 12;
22320 }
22321 if (inventory[selectedItem].type == 186)
22322 {
22323 Dust.NewDust(new Vector2(position.X + (float)(10 * direction) + 4f, position.Y + (float)num4 - 54f * gravDir), width - 8, 8, 34, 0f, 0f, 0, default(Color), 1.2f);
22324 }
22325 else
22326 {
22327 Dust.NewDust(new Vector2(position.X + (float)(12 * direction), position.Y + (float)num4 + 4f * gravDir), width - 8, 8, 34, 0f, 0f, 0, default(Color), 1.2f);
22328 }
22329 }
22330 }
22331
22333 {
22334 if (shimmering)
22335 {
22336 return;
22337 }
22338 bool flag = false;
22339 if ((float)Main.rand.Next(2, 12) < Math.Abs(velocity.X))
22340 {
22341 flag = true;
22342 }
22343 if ((float)Main.rand.Next(2, 12) < velocity.Y)
22344 {
22345 flag = true;
22346 }
22347 if (flag && velocity.Y < 1f)
22348 {
22349 Point point = (base.Bottom + Vector2.UnitY).ToTileCoordinates();
22350 Point point2 = (base.BottomLeft + Vector2.UnitY).ToTileCoordinates();
22351 Point point3 = (base.BottomRight + Vector2.UnitY).ToTileCoordinates();
22353 {
22354 flag = false;
22355 }
22356 }
22357 if (!flag)
22358 {
22359 return;
22360 }
22361 Vector2 vector = position + velocity;
22362 flag = false;
22363 int num = (int)(vector.X / 16f);
22364 int num2 = (int)((vector.X + (float)width) / 16f);
22365 int num3 = (int)((position.Y + (float)height + 1f) / 16f);
22366 Rectangle rect = getRect();
22367 rect.Inflate(1, 1);
22368 for (int i = num; i <= num2; i++)
22369 {
22370 for (int j = num3; j <= num3 + 1 && Main.tile[i, j] != null; j++)
22371 {
22372 if (Main.tile[i, j].nactive() && !WorldGen.SolidTile(i, j - 1) && TileID.Sets.CrackedBricks[Main.tile[i, j].type] && new Rectangle(i * 16, j * 16, 16, 16).Intersects(rect))
22373 {
22374 flag = true;
22375 if (velocity.Y > 1f)
22376 {
22377 velocity.Y = 1f;
22378 }
22379 NetMessage.SendData(13, -1, -1, null, whoAmI);
22380 }
22381 }
22382 }
22383 if (!flag)
22384 {
22385 return;
22386 }
22387 num = (int)((vector.X - 16f - 8f) / 16f);
22388 num2 = (int)((vector.X + (float)width + 16f + 8f) / 16f);
22389 for (int k = num; k <= num2; k++)
22390 {
22391 for (int l = num3; l <= num3 + 2; l++)
22392 {
22393 if (Main.tile[k, l].nactive() && !WorldGen.SolidTile(k, l - 1) && TileID.Sets.CrackedBricks[Main.tile[k, l].type])
22394 {
22395 WorldGen.KillTile(k, l);
22396 if (Main.netMode == 1)
22397 {
22398 NetMessage.SendData(17, -1, -1, null, 20, k, l);
22399 }
22400 }
22401 }
22402 }
22403 }
22404
22405 public void CheckIceBreak()
22406 {
22407 if (!(velocity.Y > 7f))
22408 {
22409 return;
22410 }
22411 Vector2 vector = position + velocity;
22412 int num = (int)(vector.X / 16f);
22413 int num2 = (int)((vector.X + (float)width) / 16f);
22414 int num3 = (int)((position.Y + (float)height + 1f) / 16f);
22415 for (int i = num; i <= num2; i++)
22416 {
22417 for (int j = num3; j <= num3 + 1 && Main.tile[i, j] != null; j++)
22418 {
22419 if (Main.tile[i, j].nactive() && Main.tile[i, j].type == 162 && !WorldGen.SolidTile(i, j - 1))
22420 {
22421 WorldGen.KillTile(i, j);
22422 if (Main.netMode == 1)
22423 {
22424 NetMessage.SendData(17, -1, -1, null, 0, i, j);
22425 }
22426 }
22427 }
22428 }
22429 }
22430
22431 public void SlopeDownMovement()
22432 {
22433 sloping = false;
22434 if (!mount.Active || mount.Type != 48)
22435 {
22436 float y = velocity.Y;
22437 Vector4 vector = Collision.WalkDownSlope(position, velocity, width, height, gravity * gravDir);
22438 position.X = vector.X;
22439 position.Y = vector.Y;
22440 velocity.X = vector.Z;
22441 velocity.Y = vector.W;
22442 if (velocity.Y != y)
22443 {
22444 sloping = true;
22445 }
22446 }
22447 }
22448
22450 {
22451 int num = ((!onTrack) ? height : (height - 20));
22452 Vector2 vector = velocity;
22453 if (!noCollision)
22454 {
22455 velocity = Collision.TileCollision(position, velocity, width, num, fallThrough, ignorePlats, (int)gravDir);
22456 }
22457 Vector2 vector2 = velocity * 0.375f;
22458 if (velocity.X != vector.X)
22459 {
22460 vector2.X = velocity.X;
22461 }
22462 if (velocity.Y != vector.Y)
22463 {
22464 vector2.Y = velocity.Y;
22465 }
22466 position += vector2;
22467 if (shimmerImmune && !noCollision)
22468 {
22469 TryFloatingInFluid();
22470 }
22471 }
22472
22474 {
22475 int num = ((!onTrack) ? height : (height - 20));
22476 Vector2 vector = velocity;
22477 velocity = Collision.TileCollision(position, velocity, width, num, fallThrough, ignorePlats, (int)gravDir);
22478 Vector2 vector2 = velocity * 0.25f;
22479 if (velocity.X != vector.X)
22480 {
22481 vector2.X = velocity.X;
22482 }
22483 if (velocity.Y != vector.Y)
22484 {
22485 vector2.Y = velocity.Y;
22486 }
22487 position += vector2;
22488 TryFloatingInFluid();
22489 }
22490
22492 {
22493 int num = ((!onTrack) ? height : (height - 20));
22494 Vector2 vector = velocity;
22495 velocity = Collision.TileCollision(position, velocity, width, num, fallThrough, ignorePlats, (int)gravDir);
22496 Vector2 vector2 = velocity * 0.5f;
22497 if (velocity.X != vector.X)
22498 {
22499 vector2.X = velocity.X;
22500 }
22501 if (velocity.Y != vector.Y)
22502 {
22503 vector2.Y = velocity.Y;
22504 }
22505 position += vector2;
22506 TryFloatingInFluid();
22507 }
22508
22509 private void TryFloatingInFluid()
22510 {
22511 if (!ShouldFloatInWater)
22512 {
22513 return;
22514 }
22515 if (whoAmI == Main.myPlayer && sitting.isSitting)
22516 {
22517 sitting.SitUp(this);
22518 }
22519 if (Collision.GetWaterLine(base.Center.ToTileCoordinates(), out var waterLineHeight))
22520 {
22521 float num = base.Center.Y;
22522 if (mount.Active && mount.Type == 37)
22523 {
22524 num -= 6f;
22525 }
22526 float num2 = num + 8f;
22527 if (num2 + velocity.Y < waterLineHeight)
22528 {
22529 return;
22530 }
22531 if (num > waterLineHeight)
22532 {
22533 velocity.Y -= 0.4f;
22534 if (velocity.Y < -6f)
22535 {
22536 velocity.Y = -6f;
22537 }
22538 return;
22539 }
22540 velocity.Y = waterLineHeight - num2;
22541 if (velocity.Y < -3f)
22542 {
22543 velocity.Y = -3f;
22544 }
22545 if (velocity.Y == 0f)
22546 {
22547 velocity.Y = float.Epsilon;
22548 }
22549 }
22550 else
22551 {
22552 velocity.Y -= 0.4f;
22553 }
22554 }
22555
22556 public void DryCollision(bool fallThrough, bool ignorePlats)
22557 {
22558 int num = ((!onTrack) ? height : (height - 10));
22559 if (velocity.Length() > 16f)
22560 {
22561 Vector2 vector = Collision.TileCollision(position, velocity, width, num, fallThrough, ignorePlats, (int)gravDir);
22562 float num2 = velocity.Length();
22563 Vector2 vector2 = Vector2.Normalize(velocity);
22564 if (vector.Y == 0f)
22565 {
22566 vector2.Y = 0f;
22567 }
22569 bool flag = mount.Type == 7 || mount.Type == 8 || mount.Type == 12 || mount.Type == 44 || mount.Type == 49;
22570 _ = Vector2.Zero;
22571 while (num2 > 0f)
22572 {
22573 float num3 = num2;
22574 if (num3 > 16f)
22575 {
22576 num3 = 16f;
22577 }
22578 num2 -= num3;
22580 velocity = vector3;
22581 SlopeDownMovement();
22582 vector3 = velocity;
22583 if (velocity.Y == gravity && (!mount.Active || (!mount.Cart && mount.Type != 48 && !flag)))
22584 {
22585 Collision.StepDown(ref position, ref vector3, width, height, ref stepSpeed, ref gfxOffY, (int)gravDir, waterWalk || waterWalk2);
22586 }
22587 if (gravDir == -1f)
22588 {
22589 if ((carpetFrame != -1 || velocity.Y <= gravity) && !controlUp)
22590 {
22591 Collision.StepUp(ref position, ref vector3, width, height, ref stepSpeed, ref gfxOffY, (int)gravDir, controlUp);
22592 }
22593 }
22594 else if (flag || ((carpetFrame != -1 || velocity.Y >= gravity) && !controlDown && !mount.Cart))
22595 {
22596 Collision.StepUp(ref position, ref vector3, width, height, ref stepSpeed, ref gfxOffY, (int)gravDir, controlUp);
22597 }
22598 Vector2 vector4 = Collision.TileCollision(position, vector3, width, num, fallThrough, ignorePlats, (int)gravDir);
22599 if (Collision.up && gravDir == 1f)
22600 {
22601 jump = 0;
22602 }
22603 if (waterWalk || waterWalk2)
22604 {
22605 Vector2 vector5 = velocity;
22606 vector4 = Collision.WaterCollision(position, vector4, width, height, fallThrough, fall2: false, waterWalk);
22607 if (vector5 != velocity)
22608 {
22609 fallStart = (int)(position.Y / 16f);
22610 }
22611 }
22612 position += vector4;
22613 bool falling = false;
22614 if (vector4.Y > gravity)
22615 {
22616 falling = true;
22617 }
22618 if (vector4.Y < 0f - gravity)
22619 {
22620 falling = true;
22621 }
22622 velocity = vector4;
22623 UpdateTouchingTiles();
22624 TryBouncingBlocks(falling);
22625 TryLandingOnDetonator();
22626 SlopingCollision(fallThrough, ignorePlats);
22627 Collision.StepConveyorBelt(this, gravDir);
22628 vector4 = velocity;
22629 zero += vector4;
22630 }
22631 velocity = zero;
22632 return;
22633 }
22634 velocity = Collision.TileCollision(position, velocity, width, num, fallThrough, ignorePlats, (int)gravDir);
22635 if (Collision.up && gravDir == 1f)
22636 {
22637 jump = 0;
22638 }
22639 if (waterWalk || waterWalk2)
22640 {
22641 Vector2 vector6 = velocity;
22642 velocity = Collision.WaterCollision(position, velocity, width, height, fallThrough, fall2: false, waterWalk);
22643 if (vector6 != velocity)
22644 {
22645 fallStart = (int)(position.Y / 16f);
22646 }
22647 }
22648 position += velocity;
22649 }
22650
22652 {
22653 exitNormalX = (exitNormalY = 0);
22654 Vector2 vector = new Vector2(x * 16, y * 16);
22655 Vector2 vector2 = new Vector2(vector.X + 16f, vector.Y);
22656 Vector2 vector3 = new Vector2(vector.X, vector.Y + 16f);
22657 Vector2 vector4 = new Vector2(vector.X + 16f, vector.Y + 16f);
22658 int num = 0;
22659 int num2 = 0;
22660 switch (tile.blockType())
22661 {
22662 case 1:
22663 vector.Y += 8f;
22664 vector2.Y += 8f;
22665 break;
22666 case 3:
22667 vector.Y += 16f;
22668 num = -1;
22669 break;
22670 case 2:
22671 vector2.Y += 16f;
22672 num = 1;
22673 break;
22674 case 5:
22675 vector3.Y -= 16f;
22676 num2 = -1;
22677 break;
22678 case 4:
22679 vector4.Y -= 16f;
22680 num2 = 1;
22681 break;
22682 }
22683 Vector2 vector5 = new Vector2(0.0001f);
22684 _ = position - vector5;
22685 _ = base.Size + vector5 * 2f;
22686 Rectangle hitbox = base.Hitbox;
22688 float num3 = 4f;
22689 if (hitbox.Distance(surfaceCenter) <= num3)
22690 {
22691 exitNormalX = num;
22692 exitNormalY = -1;
22693 return true;
22694 }
22696 if (hitbox.Distance(surfaceCenter) <= num3)
22697 {
22698 exitNormalX = num2;
22699 exitNormalY = 1;
22700 return true;
22701 }
22702 if (vector != vector3)
22703 {
22705 if (hitbox.Distance(surfaceCenter) <= num3)
22706 {
22707 exitNormalX = -1;
22708 exitNormalY = 0;
22709 return true;
22710 }
22711 }
22712 if (vector2 != vector4)
22713 {
22715 if (hitbox.Distance(surfaceCenter) <= num3)
22716 {
22717 exitNormalX = 1;
22718 exitNormalY = 0;
22719 return true;
22720 }
22721 }
22722 return false;
22723 }
22724
22726 {
22727 if (ignorePlats || controlDown || grappling[0] >= 0 || gravDir == -1f)
22728 {
22729 stairFall = true;
22730 }
22731 Vector4 vector = Collision.SlopeCollision(position, velocity, width, height, gravity, stairFall);
22732 if (Collision.stairFall)
22733 {
22734 stairFall = true;
22735 }
22736 else if (!fallThrough)
22737 {
22738 stairFall = false;
22739 }
22740 if (Collision.stair && Math.Abs(vector.Y - position.Y) > 8f + Math.Abs(velocity.X))
22741 {
22742 gfxOffY -= vector.Y - position.Y;
22743 stepSpeed = 4f;
22744 }
22745 _ = velocity;
22746 position.X = vector.X;
22747 position.Y = vector.Y;
22748 velocity.X = vector.Z;
22749 velocity.Y = vector.W;
22750 if (gravDir == -1f && velocity.Y == 0.0101f)
22751 {
22752 velocity.Y = 0f;
22753 }
22754 }
22755
22756 public void FloorVisuals(bool Falling)
22757 {
22758 int num = (int)((position.X + (float)(width / 2)) / 16f);
22759 int num2 = (int)((position.Y + (float)height) / 16f);
22760 if (gravDir == -1f)
22761 {
22762 num2 = (int)(position.Y - 0.1f) / 16;
22763 }
22764 Tile floorTile = GetFloorTile(num, num2);
22765 int num3 = -1;
22766 if (floorTile != null)
22767 {
22768 num3 = floorTile.type;
22769 }
22770 if (num3 <= -1)
22771 {
22772 ResetFloorFlags();
22773 return;
22774 }
22775 sticky = num3 == 229;
22776 slippy = TileID.Sets.IceSkateSlippery[num3];
22777 slippy2 = num3 == 197;
22778 powerrun = num3 == 198;
22780 if (num3 == 666 && whoAmI == Main.myPlayer)
22781 {
22782 AddBuff(120, 180);
22783 }
22784 if (Main.tile[num - 1, num2].slope() != 0 || Main.tile[num, num2].slope() != 0 || Main.tile[num + 1, num2].slope() != 0)
22785 {
22786 num3 = -1;
22787 }
22788 if (!wet && !mount.Cart)
22789 {
22790 MakeFloorDust(Falling, num3, floorTile.color());
22791 }
22792 }
22793
22794 public void ResetFloorFlags()
22795 {
22796 slippy = false;
22797 slippy2 = false;
22798 sticky = false;
22799 powerrun = false;
22800 runningOnSand = false;
22801 }
22802
22803 public static Tile GetFloorTile(int x, int y)
22804 {
22805 Tile result = null;
22806 if (Main.tile[x - 1, y] == null)
22807 {
22808 Main.tile[x - 1, y] = new Tile();
22809 }
22810 if (Main.tile[x + 1, y] == null)
22811 {
22812 Main.tile[x + 1, y] = new Tile();
22813 }
22814 if (Main.tile[x, y] == null)
22815 {
22816 Main.tile[x, y] = new Tile();
22817 }
22818 if (Main.tile[x, y].nactive() && Main.tileSolid[Main.tile[x, y].type])
22819 {
22820 result = Main.tile[x, y];
22821 }
22822 else if (Main.tile[x - 1, y].nactive() && Main.tileSolid[Main.tile[x - 1, y].type])
22823 {
22824 result = Main.tile[x - 1, y];
22825 }
22826 else if (Main.tile[x + 1, y].nactive() && Main.tileSolid[Main.tile[x + 1, y].type])
22827 {
22828 result = Main.tile[x + 1, y];
22829 }
22830 return result;
22831 }
22832
22833 public static int GetFloorTileType(int x, int y)
22834 {
22835 return ((int?)GetFloorTile(x, y)?.type) ?? (-1);
22836 }
22837
22838 private void MakeFloorDust(bool Falling, int type, int paintColor)
22839 {
22840 if (type == 659 || type == 667)
22841 {
22842 bool flag = true;
22843 if (!Falling)
22844 {
22845 float num = Math.Abs(velocity.X) / 3f;
22846 if ((float)Main.rand.Next(100) > num * 50f)
22847 {
22848 flag = false;
22849 }
22850 }
22851 if (!flag)
22852 {
22853 return;
22854 }
22855 Vector2 positionInWorld = new Vector2(position.X, position.Y + (float)height - 2f) + new Vector2((float)width * Main.rand.NextFloat(), 6f * Main.rand.NextFloat());
22856 Vector2 movementVector = Main.rand.NextVector2Circular(0.8f, 0.8f);
22857 if (movementVector.Y > 0f)
22858 {
22859 movementVector.Y *= -1f;
22860 }
22862 {
22863 PositionInWorld = positionInWorld,
22864 MovementVector = movementVector
22865 }, whoAmI);
22866 }
22867 if (type != 147 && type != 25 && type != 53 && type != 189 && type != 0 && type != 123 && type != 57 && type != 112 && type != 116 && type != 196 && type != 193 && type != 195 && type != 197 && type != 199 && type != 229 && type != 234 && type != 371 && type != 460 && type != 666)
22868 {
22869 return;
22870 }
22871 int num2 = 1;
22872 if (Falling)
22873 {
22874 num2 = 20;
22875 if (type == 666)
22876 {
22877 SoundEngine.PlaySound(SoundID.Item177, (int)base.Center.X, (int)base.Bottom.Y);
22878 }
22879 }
22880 for (int i = 0; i < num2; i++)
22881 {
22882 bool flag2 = true;
22883 int num3 = 76;
22884 if (type == 666)
22885 {
22886 if (paintColor != 0)
22887 {
22888 break;
22889 }
22890 num3 = 322;
22891 }
22892 if (type == 53)
22893 {
22894 num3 = 32;
22895 }
22896 if (type == 189)
22897 {
22898 num3 = 16;
22899 }
22900 if (type == 0)
22901 {
22902 num3 = 0;
22903 }
22904 if (type == 123)
22905 {
22906 num3 = 53;
22907 }
22908 if (type == 57)
22909 {
22910 num3 = 36;
22911 }
22912 if (type == 112)
22913 {
22914 num3 = 14;
22915 }
22916 if (type == 234)
22917 {
22918 num3 = 122;
22919 }
22920 if (type == 116)
22921 {
22922 num3 = 51;
22923 }
22924 if (type == 196)
22925 {
22926 num3 = 108;
22927 }
22928 if (type == 193)
22929 {
22930 num3 = 4;
22931 }
22932 if (type == 195 || type == 199)
22933 {
22934 num3 = 5;
22935 }
22936 if (type == 197)
22937 {
22938 num3 = 4;
22939 }
22940 if (type == 229)
22941 {
22942 num3 = 153;
22943 }
22944 if (type == 371)
22945 {
22946 num3 = 243;
22947 }
22948 if (type == 460)
22949 {
22950 num3 = 108;
22951 }
22952 if (type == 25)
22953 {
22954 num3 = 37;
22955 }
22956 if (num3 == 32 && Main.rand.Next(2) == 0)
22957 {
22958 flag2 = false;
22959 }
22960 if (num3 == 14 && Main.rand.Next(2) == 0)
22961 {
22962 flag2 = false;
22963 }
22964 if (num3 == 51 && Main.rand.Next(2) == 0)
22965 {
22966 flag2 = false;
22967 }
22968 if (num3 == 36 && Main.rand.Next(2) == 0)
22969 {
22970 flag2 = false;
22971 }
22972 if (num3 == 0 && Main.rand.Next(3) != 0)
22973 {
22974 flag2 = false;
22975 }
22976 if (num3 == 53 && Main.rand.Next(3) != 0)
22977 {
22978 flag2 = false;
22979 }
22980 Color newColor = default(Color);
22981 if (type == 193)
22982 {
22983 newColor = new Color(30, 100, 255, 100);
22984 }
22985 if (type == 197)
22986 {
22987 newColor = new Color(97, 200, 255, 100);
22988 }
22989 if (type == 460)
22990 {
22991 newColor = new Color(100, 150, 130, 100);
22992 }
22993 if (!Falling)
22994 {
22995 float num4 = Math.Abs(velocity.X) / 3f;
22996 if ((float)Main.rand.Next(100) > num4 * 100f)
22997 {
22998 flag2 = false;
22999 }
23000 }
23001 if (!flag2)
23002 {
23003 continue;
23004 }
23005 float num5 = velocity.X;
23006 if (num5 > 6f)
23007 {
23008 num5 = 6f;
23009 }
23010 if (num5 < -6f)
23011 {
23012 num5 = -6f;
23013 }
23014 if (!(velocity.X != 0f || Falling))
23015 {
23016 continue;
23017 }
23018 int num6 = Dust.NewDust(new Vector2(position.X, position.Y + (float)height - 2f), width, 6, num3, 0f, 0f, 50, newColor);
23019 if (gravDir == -1f)
23020 {
23021 Main.dust[num6].position.Y -= height + 4;
23022 }
23023 if (num3 == 76)
23024 {
23025 Main.dust[num6].scale += (float)Main.rand.Next(3) * 0.1f;
23026 Main.dust[num6].noLight = true;
23027 }
23028 if (num3 == 16 || num3 == 108 || num3 == 153)
23029 {
23030 Main.dust[num6].scale += (float)Main.rand.Next(6) * 0.1f;
23031 }
23032 if (num3 == 37)
23033 {
23034 Main.dust[num6].scale += 0.25f;
23035 Main.dust[num6].alpha = 50;
23036 }
23037 if (num3 == 5)
23038 {
23039 Main.dust[num6].scale += (float)Main.rand.Next(2, 8) * 0.1f;
23040 }
23041 Main.dust[num6].noGravity = true;
23042 if (num3 == 322)
23043 {
23044 if (Main.rand.Next(4) == 0)
23045 {
23046 Main.dust[num6].noGravity = false;
23047 Main.dust[num6].scale *= 1.1f;
23048 }
23049 else
23050 {
23051 Main.dust[num6].scale *= 1.2f;
23052 }
23053 }
23054 if (num2 > 1)
23055 {
23056 Main.dust[num6].velocity.X *= 1.2f;
23057 Main.dust[num6].velocity.Y *= 0.8f;
23058 Main.dust[num6].velocity.Y -= 1f;
23059 Main.dust[num6].velocity *= 0.8f;
23060 Main.dust[num6].scale += (float)Main.rand.Next(3) * 0.1f;
23061 Main.dust[num6].velocity.X = (Main.dust[num6].position.X - (position.X + (float)(width / 2))) * 0.2f;
23062 if (Main.dust[num6].velocity.Y > 0f)
23063 {
23064 Main.dust[num6].velocity.Y *= -1f;
23065 }
23066 Main.dust[num6].velocity.X += num5 * 0.3f;
23067 }
23068 else
23069 {
23070 Main.dust[num6].velocity *= 0.2f;
23071 }
23072 Main.dust[num6].position.X -= num5 * 1f;
23073 if (gravDir == -1f)
23074 {
23075 Main.dust[num6].velocity.Y *= -1f;
23076 }
23077 }
23078 }
23079
23080 public void BordersMovement()
23081 {
23082 if (position.X < Main.leftWorld + 640f + 16f)
23083 {
23084 Main.cameraX = 0f;
23085 position.X = Main.leftWorld + 640f + 16f;
23086 velocity.X = 0f;
23087 }
23088 if (position.X + (float)width > Main.rightWorld - 640f - 32f)
23089 {
23090 Main.cameraX = 0f;
23091 position.X = Main.rightWorld - 640f - 32f - (float)width;
23092 velocity.X = 0f;
23093 }
23094 if (position.Y < Main.topWorld + 640f + 16f)
23095 {
23096 if (Main.remixWorld || forcedGravity > 0)
23097 {
23098 if (position.Y < Main.topWorld + 640f + 16f - (float)height && !dead)
23099 {
23100 KillMe(PlayerDeathReason.ByOther(19), 10.0, 0);
23101 }
23102 if (position.Y < Main.topWorld + 320f + 16f)
23103 {
23104 position.Y = Main.topWorld + 320f + 16f;
23105 if (velocity.Y < 0f)
23106 {
23107 velocity.Y = 0f;
23108 }
23109 gravDir = 1f;
23110 }
23111 }
23112 else
23113 {
23114 position.Y = Main.topWorld + 640f + 16f;
23115 if ((double)velocity.Y < 0.11)
23116 {
23117 velocity.Y = 0.11f;
23118 }
23119 gravDir = 1f;
23120 }
23122 }
23123 if (position.Y > Main.bottomWorld - 640f - 32f - (float)height)
23124 {
23125 position.Y = Main.bottomWorld - 640f - 32f - (float)height;
23126 velocity.Y = 0f;
23127 }
23128 if (position.Y > Main.bottomWorld - 640f - 150f - (float)height)
23129 {
23131 }
23132 }
23133
23134 public void CollectTaxes()
23135 {
23136 int num = Item.buyPrice(0, 0, 0, 50);
23137 int num2 = Item.buyPrice(0, 25);
23139 {
23140 num2 *= 2;
23141 num *= 2;
23142 }
23143 if (!NPC.taxCollector || taxMoney >= num2)
23144 {
23145 return;
23146 }
23147 int num3 = 0;
23148 for (int i = 0; i < 200; i++)
23149 {
23150 if (Main.npc[i].active && !Main.npc[i].homeless && !NPCID.Sets.IsTownPet[Main.npc[i].type] && NPC.TypeToDefaultHeadIndex(Main.npc[i].type) > 0)
23151 {
23152 num3++;
23153 }
23154 }
23155 taxMoney += num * num3;
23156 if (taxMoney > num2)
23157 {
23158 taxMoney = num2;
23159 }
23160 }
23161
23163 {
23164 _quickGrappleCooldown = 3;
23165 }
23166
23168 {
23169 bool flag = false;
23170 if (heldProj > -1 && Main.projectile[heldProj].IsInterruptible(this))
23171 {
23172 flag = true;
23173 }
23174 if (!flag)
23175 {
23176 return;
23177 }
23178 bool flag2 = false;
23179 if (PlayerInput.Triggers.Current.Hotbar1)
23180 {
23181 flag2 = true;
23182 }
23183 if (PlayerInput.Triggers.Current.Hotbar2)
23184 {
23185 flag2 = true;
23186 }
23187 if (PlayerInput.Triggers.Current.Hotbar3)
23188 {
23189 flag2 = true;
23190 }
23191 if (PlayerInput.Triggers.Current.Hotbar4)
23192 {
23193 flag2 = true;
23194 }
23195 if (PlayerInput.Triggers.Current.Hotbar5)
23196 {
23197 flag2 = true;
23198 }
23199 if (PlayerInput.Triggers.Current.Hotbar6)
23200 {
23201 flag2 = true;
23202 }
23203 if (PlayerInput.Triggers.Current.Hotbar7)
23204 {
23205 flag2 = true;
23206 }
23207 if (PlayerInput.Triggers.Current.Hotbar8)
23208 {
23209 flag2 = true;
23210 }
23211 if (PlayerInput.Triggers.Current.Hotbar9)
23212 {
23213 flag2 = true;
23214 }
23215 if (PlayerInput.Triggers.Current.Hotbar10)
23216 {
23217 flag2 = true;
23218 }
23219 bool flag3 = Main.hairWindow;
23220 if (flag3)
23221 {
23222 int y = Main.screenHeight / 2 + 60;
23224 }
23226 {
23227 int num = PlayerInput.Triggers.Current.HotbarPlus.ToInt() - PlayerInput.Triggers.Current.HotbarMinus.ToInt();
23228 if (PlayerInput.CurrentProfile.HotbarRadialHoldTimeRequired != -1)
23229 {
23230 num = PlayerInput.Triggers.JustReleased.HotbarPlus.ToInt() - PlayerInput.Triggers.JustReleased.HotbarMinus.ToInt();
23231 }
23232 if (PlayerInput.Triggers.Current.HotbarScrollCD != 0)
23233 {
23234 num = 0;
23235 }
23237 {
23238 num += PlayerInput.ScrollWheelDelta / -120;
23239 }
23240 if (num != 0)
23241 {
23242 num = ClampHotbarOffset(num);
23243 _ = selectedItem + num;
23244 flag2 = true;
23245 }
23246 }
23247 if (flag2 && heldProj > -1)
23248 {
23249 Main.projectile[heldProj].Interrupt(this);
23250 }
23251 }
23252
23253 private bool CanMoveForwardOnRope(int dir, int x, int y)
23254 {
23255 int num = x + dir;
23256 if (Main.tile[num, y] != null && Main.tile[num, y].active() && Main.tileRope[Main.tile[num, y].type])
23257 {
23258 int num2 = num * 16 + 8 - width / 2;
23259 float y2 = position.Y;
23260 y2 = y * 16 + 22;
23261 if ((!Main.tile[num, y - 1].active() || !Main.tileRope[Main.tile[num, y - 1].type]) && (!Main.tile[num, y + 1].active() || !Main.tileRope[Main.tile[num, y + 1].type]))
23262 {
23263 y2 = y * 16 + 22;
23264 }
23265 if (Collision.SolidCollision(new Vector2(num2, y2), width, height))
23266 {
23267 return false;
23268 }
23269 return true;
23270 }
23271 return false;
23272 }
23273
23274 public void UpdateHairDyeDust()
23275 {
23276 if (Main.netMode != 2 && !Main.gamePaused && !dead && !ghost && !stoned && !frozen && hairDye == ContentSamples.CommonlyUsedContentSamples.TeamDyeShaderIndex)
23277 {
23278 if (Main.rand.Next(45) == 0)
23279 {
23280 int type = Main.rand.Next(139, 143);
23281 int num = Dust.NewDust(position, width, 8, type, 0f, 0f, 0, default(Color), 1.2f);
23282 Main.dust[num].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
23283 Main.dust[num].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
23284 Main.dust[num].velocity.X += (float)Main.rand.Next(-50, 51) * 0.01f;
23285 Main.dust[num].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.01f;
23286 Main.dust[num].velocity.Y -= 1f;
23287 Main.dust[num].scale *= 0.7f + (float)Main.rand.Next(-30, 31) * 0.01f;
23288 Main.dust[num].velocity += velocity * 0.2f;
23289 }
23290 if (Main.rand.Next(225) == 0)
23291 {
23292 int type2 = Main.rand.Next(276, 283);
23293 int num2 = Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(8)), velocity, type2);
23294 Main.gore[num2].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
23295 Main.gore[num2].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
23296 Main.gore[num2].scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
23297 Main.gore[num2].velocity.X += (float)Main.rand.Next(-50, 51) * 0.01f;
23298 Main.gore[num2].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.01f;
23299 Main.gore[num2].velocity.Y -= 1f;
23300 Main.gore[num2].velocity += velocity * 0.2f;
23301 }
23302 }
23303 }
23304
23305 public void Update(int i)
23306 {
23307 if (i == Main.myPlayer && Main.netMode != 2)
23308 {
23310 }
23311 if (i == Main.myPlayer && Main.dontStarveWorld)
23312 {
23314 }
23315 maxFallSpeed = 10f;
23316 gravity = defaultGravity;
23317 jumpHeight = 15;
23318 jumpSpeed = 5.01f;
23319 maxRunSpeed = 3f;
23320 runAcceleration = 0.08f;
23321 runSlowdown = 0.2f;
23322 accRunSpeed = maxRunSpeed;
23323 if (!mount.Active || !mount.Cart)
23324 {
23325 onWrongGround = false;
23326 }
23327 heldProj = -1;
23328 instantMovementAccumulatedThisFrame = Vector2.Zero;
23329 if (PortalPhysicsEnabled)
23330 {
23331 maxFallSpeed = 35f;
23332 }
23333 if (shimmerWet || shimmering)
23334 {
23335 if (shimmering)
23336 {
23337 gravity *= 0.9f;
23338 maxFallSpeed *= 0.9f;
23339 }
23340 else
23341 {
23342 gravity = 0.15f;
23343 jumpHeight = 23;
23344 jumpSpeed = 5.51f;
23345 }
23346 }
23347 else if (wet)
23348 {
23349 if (honeyWet)
23350 {
23351 gravity = 0.1f;
23352 maxFallSpeed = 3f;
23353 }
23354 else if (merman)
23355 {
23356 gravity = 0.3f;
23357 maxFallSpeed = 7f;
23358 }
23359 else if (trident && !lavaWet)
23360 {
23361 gravity = 0.25f;
23362 maxFallSpeed = 6f;
23363 jumpHeight = 25;
23364 jumpSpeed = 5.51f;
23365 if (controlUp)
23366 {
23367 gravity = 0.1f;
23368 maxFallSpeed = 2f;
23369 }
23370 }
23371 else
23372 {
23373 gravity = 0.2f;
23374 maxFallSpeed = 5f;
23375 jumpHeight = 30;
23376 jumpSpeed = 6.01f;
23377 }
23378 }
23379 if (vortexDebuff)
23380 {
23381 gravity = 0f;
23382 }
23383 maxFallSpeed += 0.01f;
23384 bool flag = false;
23385 if (Main.myPlayer == i)
23386 {
23387 if (Main.mapFullscreen)
23388 {
23389 GamepadEnableGrappleCooldown();
23390 }
23391 else if (_quickGrappleCooldown > 0)
23392 {
23393 _quickGrappleCooldown--;
23394 }
23395 TileObject.objectPreview.Reset();
23397 {
23398 downedDD2EventAnyDifficulty = true;
23399 }
23400 autoReuseAllWeapons = Main.SettingsEnabled_AutoReuseAllItems;
23401 }
23402 if (NPC.freeCake && talkNPC >= 0 && Main.npc[talkNPC].type == 208)
23403 {
23404 NPC.freeCake = false;
23405 if (Main.netMode != 1)
23406 {
23407 Item.NewItem(new EntitySource_Gift(Main.npc[talkNPC]), (int)position.X, (int)position.Y, width, height, 3750);
23408 }
23409 }
23410 if (emoteTime > 0)
23411 {
23412 emoteTime--;
23413 }
23414 if (ghostDmg > 0f)
23415 {
23416 ghostDmg -= 6.6666665f;
23417 }
23418 if (ghostDmg < 0f)
23419 {
23420 ghostDmg = 0f;
23421 }
23422 if (Main.expertMode)
23423 {
23424 if (lifeSteal < 70f)
23425 {
23426 lifeSteal += 0.5f;
23427 }
23428 if (lifeSteal > 70f)
23429 {
23430 lifeSteal = 70f;
23431 }
23432 }
23433 else
23434 {
23435 if (lifeSteal < 80f)
23436 {
23437 lifeSteal += 0.6f;
23438 }
23439 if (lifeSteal > 80f)
23440 {
23441 lifeSteal = 80f;
23442 }
23443 }
23444 ResizeHitbox();
23445 if (mount.Active && mount.Type == 0)
23446 {
23447 int num = (int)(position.X + (float)(width / 2)) / 16;
23448 int j = (int)(position.Y + (float)(height / 2) - 14f) / 16;
23449 Lighting.AddLight(num, j, 0.5f, 0.2f, 0.05f);
23450 Lighting.AddLight(num + direction, j, 0.5f, 0.2f, 0.05f);
23451 Lighting.AddLight(num + direction * 2, j, 0.5f, 0.2f, 0.05f);
23452 }
23453 outOfRange = false;
23454 if (whoAmI != Main.myPlayer)
23455 {
23456 int num2 = (int)(position.X + (float)(width / 2)) / 16;
23457 int num3 = (int)(position.Y + (float)(height / 2)) / 16;
23458 if (!WorldGen.InWorld(num2, num3, 4))
23459 {
23460 flag = true;
23461 }
23462 else if (Main.tile[num2, num3] == null)
23463 {
23464 flag = true;
23465 }
23466 else if (Main.tile[num2 - 3, num3] == null)
23467 {
23468 flag = true;
23469 }
23470 else if (Main.tile[num2 + 3, num3] == null)
23471 {
23472 flag = true;
23473 }
23474 else if (Main.tile[num2, num3 - 3] == null)
23475 {
23476 flag = true;
23477 }
23478 else if (Main.tile[num2, num3 + 3] == null)
23479 {
23480 flag = true;
23481 }
23482 if (flag)
23483 {
23484 outOfRange = true;
23485 numMinions = 0;
23486 slotsMinions = 0f;
23487 itemAnimation = 0;
23488 UpdateBuffs(i);
23489 PlayerFrame();
23490 }
23491 }
23492 if (tankPet >= 0)
23493 {
23494 if (!tankPetReset)
23495 {
23496 tankPetReset = true;
23497 }
23498 else
23499 {
23500 tankPet = -1;
23501 }
23502 }
23503 if (i == Main.myPlayer)
23504 {
23505 IsVoidVaultEnabled = HasItem(4131);
23506 }
23507 if (chatOverhead.timeLeft > 0)
23508 {
23509 chatOverhead.timeLeft--;
23510 }
23511 if (snowBallLauncherInteractionCooldown > 0)
23512 {
23513 snowBallLauncherInteractionCooldown--;
23514 }
23515 environmentBuffImmunityTimer = Math.Max(0, environmentBuffImmunityTimer - 1);
23516 if (flag)
23517 {
23518 return;
23519 }
23520 UpdateHairDyeDust();
23521 UpdateMiscCounter();
23522 infernoCounter++;
23523 if (infernoCounter >= 180)
23524 {
23525 infernoCounter = 0;
23526 }
23527 timeSinceLastDashStarted++;
23528 if (timeSinceLastDashStarted >= 300)
23529 {
23530 timeSinceLastDashStarted = 300;
23531 }
23532 _framesLeftEligibleForDeadmansChestDeathAchievement--;
23533 if (_framesLeftEligibleForDeadmansChestDeathAchievement < 0)
23534 {
23535 _framesLeftEligibleForDeadmansChestDeathAchievement = 0;
23536 }
23537 if (titaniumStormCooldown > 0)
23538 {
23539 titaniumStormCooldown--;
23540 }
23541 if (starCloakCooldown > 0)
23542 {
23543 starCloakCooldown--;
23544 if (Main.rand.Next(5) == 0)
23545 {
23546 for (int k = 0; k < 2; k++)
23547 {
23548 Dust dust = Dust.NewDustDirect(position, width, height, 45, 0f, 0f, 255, default(Color), (float)Main.rand.Next(20, 26) * 0.1f);
23549 dust.noLight = true;
23550 dust.noGravity = true;
23551 dust.velocity *= 0.5f;
23552 dust.velocity.X = 0f;
23553 dust.velocity.Y -= 0.5f;
23554 }
23555 }
23556 if (starCloakCooldown == 0)
23557 {
23559 }
23560 }
23561 _timeSinceLastImmuneGet++;
23562 if (_timeSinceLastImmuneGet >= 10000)
23563 {
23564 _timeSinceLastImmuneGet = 10000;
23565 }
23566 float num4 = (float)Main.maxTilesX / 4200f;
23567 num4 *= num4;
23568 float num5 = (float)((double)(position.Y / 16f - (60f + 10f * num4)) / (Main.worldSurface / 6.0));
23569 if (Main.remixWorld)
23570 {
23571 num5 = (float)((double)(position.Y / 16f - (60f + 10f * num4)) / (Main.worldSurface / 1.0));
23572 }
23573 if (Main.remixWorld)
23574 {
23575 if ((double)num5 < 0.1)
23576 {
23577 num5 = 0.1f;
23578 }
23579 }
23580 else if ((double)num5 < 0.25)
23581 {
23582 num5 = 0.25f;
23583 }
23584 if (num5 > 1f)
23585 {
23586 num5 = 1f;
23587 }
23588 gravity *= num5;
23589 maxRegenDelay = (1f - (float)statMana / (float)statManaMax2) * 60f * 4f + 45f;
23590 maxRegenDelay *= 0.7f;
23591 UpdateSocialShadow();
23592 UpdateTeleportVisuals();
23593 whoAmI = i;
23594 if (whoAmI == Main.myPlayer)
23595 {
23596 if (!DD2Event.Ongoing)
23597 {
23598 PurgeDD2EnergyCrystals();
23599 }
23600 TryPortalJumping();
23601 if (whoAmI == Main.myPlayer)
23602 {
23603 doorHelper.Update(this);
23604 }
23605 }
23606 if (runSoundDelay > 0)
23607 {
23608 runSoundDelay--;
23609 }
23610 if (attackCD > 0)
23611 {
23612 attackCD--;
23613 }
23614 if (itemAnimation == 0)
23615 {
23616 attackCD = 0;
23617 }
23618 if (potionDelay > 0)
23619 {
23620 potionDelay--;
23621 }
23622 if (i == Main.myPlayer)
23623 {
23624 if (trashItem.type >= 1522 && trashItem.type <= 1527)
23625 {
23626 trashItem.SetDefaults();
23627 }
23628 if (trashItem.type == 3643)
23629 {
23630 trashItem.SetDefaults();
23631 }
23632 UpdateBiomes();
23633 UpdateMinionTarget();
23634 }
23635 if (ghost)
23636 {
23637 Ghost();
23638 return;
23639 }
23640 if (dead)
23641 {
23642 UpdateDead();
23643 ResetProjectileCaches();
23644 UpdateProjectileCaches(i);
23645 return;
23646 }
23647 TrySpawningFaelings();
23648 if (i == Main.myPlayer && hasLucyTheAxe)
23649 {
23651 }
23652 if (velocity.Y == 0f)
23653 {
23654 mount.FatigueRecovery();
23655 }
23656 if (i == Main.myPlayer && !isControlledByFilm)
23657 {
23658 ResetControls();
23659 if (Main.hasFocus)
23660 {
23662 {
23663 PlayerInput.Triggers.Current.CopyInto(this);
23664 LocalInputCache = new DirectionalInputSyncCache(this);
23665 if (Main.mapFullscreen)
23666 {
23667 if (controlUp)
23668 {
23669 Main.mapFullscreenPos.Y -= 1f * (16f / Main.mapFullscreenScale);
23670 }
23671 if (controlDown)
23672 {
23673 Main.mapFullscreenPos.Y += 1f * (16f / Main.mapFullscreenScale);
23674 }
23675 if (controlLeft)
23676 {
23677 Main.mapFullscreenPos.X -= 1f * (16f / Main.mapFullscreenScale);
23678 }
23679 if (controlRight)
23680 {
23681 Main.mapFullscreenPos.X += 1f * (16f / Main.mapFullscreenScale);
23682 }
23683 controlUp = false;
23684 controlLeft = false;
23685 controlDown = false;
23686 controlRight = false;
23687 controlJump = false;
23688 controlUseItem = false;
23689 controlUseTile = false;
23690 controlThrow = false;
23691 controlHook = false;
23692 controlTorch = false;
23693 controlSmart = false;
23694 controlMount = false;
23695 }
23696 if (isOperatingAnotherEntity)
23697 {
23698 controlUp = (controlDown = (controlLeft = (controlRight = (controlJump = false))));
23699 }
23700 if (controlQuickHeal)
23701 {
23702 if (releaseQuickHeal)
23703 {
23704 QuickHeal();
23705 }
23706 releaseQuickHeal = false;
23707 }
23708 else
23709 {
23710 releaseQuickHeal = true;
23711 }
23712 if (controlQuickMana)
23713 {
23714 if (releaseQuickMana)
23715 {
23716 QuickMana();
23717 }
23718 releaseQuickMana = false;
23719 }
23720 else
23721 {
23722 releaseQuickMana = true;
23723 }
23724 if (controlCreativeMenu)
23725 {
23726 if (releaseCreativeMenu)
23727 {
23728 ToggleCreativeMenu();
23729 }
23730 releaseCreativeMenu = false;
23731 }
23732 else
23733 {
23734 releaseCreativeMenu = true;
23735 }
23736 if (controlLeft && controlRight)
23737 {
23738 controlLeft = false;
23739 controlRight = false;
23740 }
23742 {
23744 {
23745 TryToToggleSmartCursor(ref Main.SmartCursorWanted_Mouse);
23746 }
23747 else if (PlayerInput.UsingGamepad)
23748 {
23749 TryToToggleSmartCursor(ref Main.SmartCursorWanted_GamePad);
23750 }
23751 else
23752 {
23753 TryToToggleSmartCursor(ref Main.SmartCursorWanted_Mouse);
23754 }
23755 }
23756 if (controlSmart)
23757 {
23758 releaseSmart = false;
23759 }
23760 else
23761 {
23762 releaseSmart = true;
23763 }
23764 if (controlMount)
23765 {
23766 if (releaseMount)
23767 {
23768 QuickMount();
23769 }
23770 releaseMount = false;
23771 }
23772 else
23773 {
23774 releaseMount = true;
23775 }
23776 if (Main.mapFullscreen)
23777 {
23778 if (mapZoomIn)
23779 {
23780 Main.mapFullscreenScale *= 1.05f;
23781 }
23782 if (mapZoomOut)
23783 {
23784 Main.mapFullscreenScale *= 0.95f;
23785 }
23786 }
23787 else
23788 {
23789 if (Main.mapStyle == 1)
23790 {
23791 if (mapZoomIn)
23792 {
23793 Main.mapMinimapScale *= 1.025f;
23794 }
23795 if (mapZoomOut)
23796 {
23797 Main.mapMinimapScale *= 0.975f;
23798 }
23799 if (mapAlphaUp)
23800 {
23801 Main.mapMinimapAlpha += 0.015f;
23802 }
23803 if (mapAlphaDown)
23804 {
23805 Main.mapMinimapAlpha -= 0.015f;
23806 }
23807 }
23808 else if (Main.mapStyle == 2)
23809 {
23810 if (mapZoomIn)
23811 {
23812 Main.mapOverlayScale *= 1.05f;
23813 }
23814 if (mapZoomOut)
23815 {
23816 Main.mapOverlayScale *= 0.95f;
23817 }
23818 if (mapAlphaUp)
23819 {
23820 Main.mapOverlayAlpha += 0.015f;
23821 }
23822 if (mapAlphaDown)
23823 {
23824 Main.mapOverlayAlpha -= 0.015f;
23825 }
23826 }
23827 if (mapStyle)
23828 {
23829 if (releaseMapStyle)
23830 {
23832 Main.mapStyle++;
23833 if (Main.mapStyle > 2)
23834 {
23835 Main.mapStyle = 0;
23836 }
23837 }
23838 releaseMapStyle = false;
23839 }
23840 else
23841 {
23842 releaseMapStyle = true;
23843 }
23844 }
23845 if (mapFullScreen)
23846 {
23847 if (releaseMapFullscreen)
23848 {
23849 if (Main.mapFullscreen)
23850 {
23852 Main.mapFullscreen = false;
23853 }
23854 else
23855 {
23856 TryOpeningFullscreenMap();
23857 }
23858 }
23859 releaseMapFullscreen = false;
23860 }
23861 else
23862 {
23863 releaseMapFullscreen = true;
23864 }
23865 }
23867 {
23868 PlayerInput.Triggers.Current.CopyIntoDuringChat(this);
23869 }
23870 if (confused)
23871 {
23872 bool flag2 = controlLeft;
23873 bool flag3 = controlUp;
23874 controlLeft = controlRight;
23875 controlRight = flag2;
23876 controlUp = controlRight;
23877 controlDown = flag3;
23878 }
23879 else if (cartFlip)
23880 {
23881 if (controlRight || controlLeft)
23882 {
23883 bool flag4 = controlLeft;
23884 controlLeft = controlRight;
23885 controlRight = flag4;
23886 }
23887 else
23888 {
23889 cartFlip = false;
23890 }
23891 }
23892 for (int l = 0; l < doubleTapCardinalTimer.Length; l++)
23893 {
23894 doubleTapCardinalTimer[l]--;
23895 if (doubleTapCardinalTimer[l] < 0)
23896 {
23897 doubleTapCardinalTimer[l] = 0;
23898 }
23899 }
23900 for (int m = 0; m < 4; m++)
23901 {
23902 bool flag5 = false;
23903 bool flag6 = false;
23904 switch (m)
23905 {
23906 case 0:
23907 flag5 = controlDown && releaseDown;
23908 flag6 = controlDown;
23909 break;
23910 case 1:
23911 flag5 = controlUp && releaseUp;
23912 flag6 = controlUp;
23913 break;
23914 case 2:
23915 flag5 = controlRight && releaseRight;
23916 flag6 = controlRight;
23917 break;
23918 case 3:
23919 flag5 = controlLeft && releaseLeft;
23920 flag6 = controlLeft;
23921 break;
23922 }
23923 if (flag5)
23924 {
23925 if (doubleTapCardinalTimer[m] > 0)
23926 {
23927 KeyDoubleTap(m);
23928 }
23929 else
23930 {
23931 doubleTapCardinalTimer[m] = 15;
23932 }
23933 }
23934 if (flag6)
23935 {
23936 holdDownCardinalTimer[m]++;
23937 KeyHoldDown(m, holdDownCardinalTimer[m]);
23938 }
23939 else
23940 {
23941 holdDownCardinalTimer[m] = 0;
23942 }
23943 }
23944 controlDownHold = holdDownCardinalTimer[0] >= 45;
23945 if (controlInv)
23946 {
23947 if (releaseInventory)
23948 {
23949 ToggleInv();
23950 }
23951 releaseInventory = false;
23952 }
23953 else
23954 {
23955 releaseInventory = true;
23956 }
23957 if (delayUseItem)
23958 {
23959 if (!controlUseItem)
23960 {
23961 delayUseItem = false;
23962 }
23963 controlUseItem = false;
23964 }
23965 if (itemAnimation == 0 && ItemTimeIsZero && reuseDelay == 0)
23966 {
23967 dropItemCheck();
23968 int num6 = selectedItem;
23969 bool flag7 = false;
23970 if (!Main.drawingPlayerChat && selectedItem != 58 && !Main.editSign && !Main.editChest)
23971 {
23972 if (PlayerInput.Triggers.Current.Hotbar1)
23973 {
23974 selectedItem = 0;
23975 flag7 = true;
23976 }
23977 if (PlayerInput.Triggers.Current.Hotbar2)
23978 {
23979 selectedItem = 1;
23980 flag7 = true;
23981 }
23982 if (PlayerInput.Triggers.Current.Hotbar3)
23983 {
23984 selectedItem = 2;
23985 flag7 = true;
23986 }
23987 if (PlayerInput.Triggers.Current.Hotbar4)
23988 {
23989 selectedItem = 3;
23990 flag7 = true;
23991 }
23992 if (PlayerInput.Triggers.Current.Hotbar5)
23993 {
23994 selectedItem = 4;
23995 flag7 = true;
23996 }
23997 if (PlayerInput.Triggers.Current.Hotbar6)
23998 {
23999 selectedItem = 5;
24000 flag7 = true;
24001 }
24002 if (PlayerInput.Triggers.Current.Hotbar7)
24003 {
24004 selectedItem = 6;
24005 flag7 = true;
24006 }
24007 if (PlayerInput.Triggers.Current.Hotbar8)
24008 {
24009 selectedItem = 7;
24010 flag7 = true;
24011 }
24012 if (PlayerInput.Triggers.Current.Hotbar9)
24013 {
24014 selectedItem = 8;
24015 flag7 = true;
24016 }
24017 if (PlayerInput.Triggers.Current.Hotbar10)
24018 {
24019 selectedItem = 9;
24020 flag7 = true;
24021 }
24022 int selectedBinding = DpadRadial.SelectedBinding;
24023 int selectedBinding2 = CircularRadial.SelectedBinding;
24024 _ = QuicksRadial.SelectedBinding;
24025 DpadRadial.Update();
24026 CircularRadial.Update();
24027 QuicksRadial.Update();
24028 if (CircularRadial.SelectedBinding >= 0 && selectedBinding2 != CircularRadial.SelectedBinding)
24029 {
24030 DpadRadial.ChangeSelection(-1);
24031 }
24032 if (DpadRadial.SelectedBinding >= 0 && selectedBinding != DpadRadial.SelectedBinding)
24033 {
24034 CircularRadial.ChangeSelection(-1);
24035 }
24036 if (QuicksRadial.SelectedBinding != -1 && PlayerInput.Triggers.JustReleased.RadialQuickbar && !PlayerInput.MiscSettingsTEMP.HotbarRadialShouldBeUsed)
24037 {
24038 switch (QuicksRadial.SelectedBinding)
24039 {
24040 case 0:
24041 QuickMount();
24042 break;
24043 case 1:
24044 QuickHeal();
24045 break;
24046 case 2:
24047 QuickBuff();
24048 break;
24049 case 3:
24050 QuickMana();
24051 break;
24052 }
24053 }
24054 if (controlTorch || flag7)
24055 {
24056 DpadRadial.ChangeSelection(-1);
24057 CircularRadial.ChangeSelection(-1);
24058 }
24059 if (controlTorch && flag7)
24060 {
24061 if (selectedItem != nonTorch)
24062 {
24064 }
24065 nonTorch = selectedItem;
24066 selectedItem = num6;
24067 flag7 = false;
24068 }
24069 }
24070 bool flag8 = Main.hairWindow;
24071 if (flag8)
24072 {
24073 int y = Main.screenHeight / 2 + 60;
24075 }
24076 if (flag7 && CaptureManager.Instance.Active)
24077 {
24078 CaptureManager.Instance.Active = false;
24079 }
24080 if (num6 != selectedItem)
24081 {
24083 }
24084 if (Main.mapFullscreen)
24085 {
24086 float num7 = PlayerInput.ScrollWheelDelta / 120;
24088 {
24089 num7 += (float)(PlayerInput.Triggers.Current.HotbarPlus.ToInt() - PlayerInput.Triggers.Current.HotbarMinus.ToInt()) * 0.1f;
24090 }
24091 Main.mapFullscreenScale *= 1f + num7 * 0.3f;
24092 }
24093 else if (CaptureManager.Instance.Active)
24094 {
24095 CaptureManager.Instance.Scrolling();
24096 }
24097 else if (!flag8)
24098 {
24099 if (!Main.playerInventory)
24100 {
24101 HandleHotbar();
24102 }
24103 else
24104 {
24105 int num8 = GetMouseScrollDelta();
24106 bool flag9 = true;
24107 if (Main.recBigList)
24108 {
24109 int num9 = 42;
24110 int num10 = 340;
24111 int num11 = 310;
24113 int num12 = (Main.screenWidth - num11 - 280) / num9;
24114 int num13 = (Main.screenHeight - num10 - 20) / num9;
24115 if (new Rectangle(num11, num10, num12 * num9, num13 * num9).Contains(Main.MouseScreen.ToPoint()))
24116 {
24117 num8 *= -1;
24118 int num14 = Math.Sign(num8);
24119 while (num8 != 0)
24120 {
24121 if (num8 < 0)
24122 {
24123 Main.recStart -= num12;
24124 if (Main.recStart < 0)
24125 {
24126 Main.recStart = 0;
24127 }
24128 }
24129 else
24130 {
24131 Main.recStart += num12;
24133 {
24134 Main.recStart = Main.numAvailableRecipes - num12;
24135 }
24136 }
24137 num8 -= num14;
24138 }
24139 }
24141 }
24142 if (flag9)
24143 {
24144 Main.focusRecipe += num8;
24146 {
24147 Main.focusRecipe = Main.numAvailableRecipes - 1;
24148 }
24149 if (Main.focusRecipe < 0)
24150 {
24151 Main.focusRecipe = 0;
24152 }
24153 }
24154 }
24155 }
24156 }
24157 else
24158 {
24159 bool flag10 = false;
24160 if (!Main.drawingPlayerChat && selectedItem != 58 && !Main.editSign && !Main.editChest)
24161 {
24162 int num15 = -1;
24163 if (Main.keyState.IsKeyDown(Keys.D1))
24164 {
24165 num15 = 0;
24166 flag10 = true;
24167 }
24168 if (Main.keyState.IsKeyDown(Keys.D2))
24169 {
24170 num15 = 1;
24171 flag10 = true;
24172 }
24173 if (Main.keyState.IsKeyDown(Keys.D3))
24174 {
24175 num15 = 2;
24176 flag10 = true;
24177 }
24178 if (Main.keyState.IsKeyDown(Keys.D4))
24179 {
24180 num15 = 3;
24181 flag10 = true;
24182 }
24183 if (Main.keyState.IsKeyDown(Keys.D5))
24184 {
24185 num15 = 4;
24186 flag10 = true;
24187 }
24188 if (Main.keyState.IsKeyDown(Keys.D6))
24189 {
24190 num15 = 5;
24191 flag10 = true;
24192 }
24193 if (Main.keyState.IsKeyDown(Keys.D7))
24194 {
24195 num15 = 6;
24196 flag10 = true;
24197 }
24198 if (Main.keyState.IsKeyDown(Keys.D8))
24199 {
24200 num15 = 7;
24201 flag10 = true;
24202 }
24203 if (Main.keyState.IsKeyDown(Keys.D9))
24204 {
24205 num15 = 8;
24206 flag10 = true;
24207 }
24208 if (Main.keyState.IsKeyDown(Keys.D0))
24209 {
24210 num15 = 9;
24211 flag10 = true;
24212 }
24213 if (flag10)
24214 {
24215 if (num15 != nonTorch)
24216 {
24218 }
24219 nonTorch = num15;
24220 }
24221 }
24222 }
24223 }
24224 if (selectedItem != 58)
24225 {
24226 SmartSelectLookup();
24227 }
24228 if (stoned != lastStoned)
24229 {
24230 if (whoAmI == Main.myPlayer && stoned)
24231 {
24232 int damage = (int)(20.0 * (double)Main.GameModeInfo.EnemyDamageMultiplier);
24233 Hurt(PlayerDeathReason.ByOther(5), damage, 0);
24234 }
24235 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
24236 for (int n = 0; n < 20; n++)
24237 {
24238 int num16 = Dust.NewDust(position, width, height, 1);
24239 if (Main.rand.Next(2) == 0)
24240 {
24241 Main.dust[num16].noGravity = true;
24242 }
24243 }
24244 }
24245 lastStoned = stoned;
24246 if (frozen || webbed || stoned)
24247 {
24248 controlJump = false;
24249 controlDown = false;
24250 controlLeft = false;
24251 controlRight = false;
24252 controlUp = false;
24253 controlUseItem = false;
24254 controlUseTile = false;
24255 controlThrow = false;
24256 gravDir = 1f;
24257 }
24258 if (!controlThrow)
24259 {
24260 releaseThrow = true;
24261 }
24262 else
24263 {
24264 releaseThrow = false;
24265 }
24266 if (controlDown && releaseDown)
24267 {
24268 if (tryKeepingHoveringUp)
24269 {
24270 tryKeepingHoveringUp = false;
24271 }
24272 else
24273 {
24274 tryKeepingHoveringDown = true;
24275 }
24276 }
24277 if (controlUp && releaseUp)
24278 {
24279 if (tryKeepingHoveringDown)
24280 {
24281 tryKeepingHoveringDown = false;
24282 }
24283 else
24284 {
24285 tryKeepingHoveringUp = true;
24286 }
24287 }
24288 if (velocity.Y == 0f)
24289 {
24290 tryKeepingHoveringUp = false;
24291 tryKeepingHoveringDown = false;
24292 }
24294 {
24295 tryKeepingHoveringUp = false;
24296 tryKeepingHoveringDown = false;
24297 }
24298 TrySyncingInput();
24300 {
24301 AdjTiles();
24302 }
24303 HandleBeingInChestRange();
24304 tileEntityAnchor.GetTileEntity()?.OnPlayerUpdate(this);
24305 }
24306 if (i == Main.myPlayer)
24307 {
24308 if (velocity.Y <= 0f)
24309 {
24310 fallStart2 = (int)(position.Y / 16f);
24311 }
24312 if (velocity.Y == 0f)
24313 {
24314 int num17 = 25;
24315 num17 += extraFall;
24316 int num18 = (int)(position.Y / 16f) - fallStart;
24317 if (mount.CanFly())
24318 {
24319 num18 = 0;
24320 }
24321 if (mount.Cart && Minecart.OnTrack(position, width, height))
24322 {
24323 num18 = 0;
24324 }
24325 if (mount.Type == 1)
24326 {
24327 num18 = 0;
24328 }
24329 if (num18 > 0 || (gravDir == -1f && num18 < 0))
24330 {
24331 int num19 = (int)(position.X / 16f);
24332 int num20 = (int)((position.X + (float)width) / 16f);
24333 int num21 = (int)((position.Y + (float)height + 1f) / 16f);
24334 if (gravDir == -1f)
24335 {
24336 num21 = (int)((position.Y - 1f) / 16f);
24337 }
24338 for (int num22 = num19; num22 <= num20; num22++)
24339 {
24340 if (Main.tile[num22, num21] != null && Main.tile[num22, num21].active() && (Main.tile[num22, num21].type == 189 || Main.tile[num22, num21].type == 196 || Main.tile[num22, num21].type == 460 || Main.tile[num22, num21].type == 666))
24341 {
24342 num18 = 0;
24343 break;
24344 }
24345 }
24346 }
24347 bool flag11 = false;
24348 for (int num23 = 3; num23 < 10; num23++)
24349 {
24350 if (armor[num23].stack > 0 && armor[num23].wingSlot > -1)
24351 {
24352 flag11 = true;
24353 }
24354 }
24355 if (stoned)
24356 {
24357 int num24 = (int)(((float)num18 * gravDir - 2f) * 20f);
24358 if (num24 > 0)
24359 {
24360 Hurt(PlayerDeathReason.ByOther(5), num24, 0);
24361 immune = false;
24362 }
24363 }
24364 else if (((gravDir == 1f && num18 > num17) || (gravDir == -1f && num18 < -num17)) && !noFallDmg && !flag11)
24365 {
24366 immune = false;
24367 int num25 = (int)((float)num18 * gravDir - (float)num17) * 10;
24368 if (mount.Active)
24369 {
24370 num25 = (int)((float)num25 * mount.FallDamage);
24371 }
24372 Hurt(PlayerDeathReason.ByOther(0), num25, 0);
24373 if (!dead && statLife <= statLifeMax2 / 10)
24374 {
24376 }
24377 }
24378 fallStart = (int)(position.Y / 16f);
24379 }
24380 if (jump > 0 || rocketDelay > 0 || wet || slowFall || (double)num5 < 0.8 || tongued)
24381 {
24382 fallStart = (int)(position.Y / 16f);
24383 }
24384 }
24385 if (Main.netMode != 1)
24386 {
24387 if (chest == -1 && lastChest >= 0 && Main.chest[lastChest] != null)
24388 {
24389 int x = Main.chest[lastChest].x;
24390 int y2 = Main.chest[lastChest].y;
24391 NPC.BigMimicSummonCheck(x, y2, this);
24392 }
24393 if (lastChest != chest && chest >= 0 && Main.chest[chest] != null)
24394 {
24395 int x2 = Main.chest[chest].x;
24396 int y3 = Main.chest[chest].y;
24397 Projectile.GasTrapCheck(x2, y3, this);
24398 ItemSlot.forceClearGlowsOnChest = true;
24399 }
24400 lastChest = chest;
24401 }
24402 if (mouseInterface)
24403 {
24404 delayUseItem = true;
24405 }
24406 tileTargetX = (int)(((float)Main.mouseX + Main.screenPosition.X) / 16f);
24407 tileTargetY = (int)(((float)Main.mouseY + Main.screenPosition.Y) / 16f);
24408 if (gravDir == -1f)
24409 {
24410 tileTargetY = (int)((Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16f);
24411 }
24412 if (tileTargetX >= Main.maxTilesX - 5)
24413 {
24414 tileTargetX = Main.maxTilesX - 5;
24415 }
24416 if (tileTargetY >= Main.maxTilesY - 5)
24417 {
24418 tileTargetY = Main.maxTilesY - 5;
24419 }
24420 if (tileTargetX < 5)
24421 {
24422 tileTargetX = 5;
24423 }
24424 if (tileTargetY < 5)
24425 {
24426 tileTargetY = 5;
24427 }
24428 if (Main.tile[tileTargetX - 1, tileTargetY] == null)
24429 {
24430 Main.tile[tileTargetX - 1, tileTargetY] = new Tile();
24431 }
24432 if (Main.tile[tileTargetX + 1, tileTargetY] == null)
24433 {
24434 Main.tile[tileTargetX + 1, tileTargetY] = new Tile();
24435 }
24436 if (Main.tile[tileTargetX, tileTargetY] == null)
24437 {
24438 Main.tile[tileTargetX, tileTargetY] = new Tile();
24439 }
24440 if (inventory[selectedItem].axe > 0 && !Main.tile[tileTargetX, tileTargetY].active() && inventory[selectedItem].createWall <= 0 && (inventory[selectedItem].hammer <= 0 || inventory[selectedItem].axe != 0))
24441 {
24442 if (Main.tile[tileTargetX - 1, tileTargetY].active() && Main.tile[tileTargetX - 1, tileTargetY].type == 323)
24443 {
24444 if (Main.tile[tileTargetX - 1, tileTargetY].frameY > 4)
24445 {
24446 tileTargetX--;
24447 }
24448 }
24449 else if (Main.tile[tileTargetX + 1, tileTargetY].active() && Main.tile[tileTargetX + 1, tileTargetY].type == 323 && Main.tile[tileTargetX + 1, tileTargetY].frameY < -4)
24450 {
24451 tileTargetX++;
24452 }
24453 }
24454 if (i == Main.myPlayer)
24455 {
24456 UpdateNearbyInteractibleProjectilesList();
24457 }
24458 try
24459 {
24460 if (whoAmI == Main.myPlayer && Main.instance.IsActive)
24461 {
24463 SmartInteractLookup();
24464 }
24465 }
24466 catch
24467 {
24468 Main.SmartCursorWanted_GamePad = false;
24469 Main.SmartCursorWanted_Mouse = false;
24470 }
24471 UpdateImmunity();
24472 if (petalTimer > 0)
24473 {
24474 petalTimer--;
24475 }
24476 if (shadowDodgeTimer > 0)
24477 {
24478 shadowDodgeTimer--;
24479 }
24480 if (boneGloveTimer > 0)
24481 {
24482 boneGloveTimer--;
24483 }
24484 if (crystalLeafCooldown > 0)
24485 {
24486 crystalLeafCooldown--;
24487 }
24488 if (jump > 0 || velocity.Y != 0f)
24489 {
24490 ResetFloorFlags();
24491 }
24492 bool flag12 = pStone;
24493 potionDelayTime = Item.potionDelay;
24494 restorationDelayTime = Item.restorationDelay;
24495 mushroomDelayTime = Item.mushroomDelay;
24496 if (pStone)
24497 {
24498 potionDelayTime = (int)((float)potionDelayTime * PhilosopherStoneDurationMultiplier);
24499 restorationDelayTime = (int)((float)restorationDelayTime * PhilosopherStoneDurationMultiplier);
24500 mushroomDelayTime = (int)((float)mushroomDelayTime * PhilosopherStoneDurationMultiplier);
24501 }
24502 if (yoraiz0rEye > 0)
24503 {
24504 Yoraiz0rEye();
24505 }
24506 ResetEffects();
24507 UpdateDyes();
24509 {
24510 creativeGodMode = true;
24511 }
24512 if (IsStandingStillForSpecialEffects && itemAnimation == 0)
24513 {
24514 afkCounter++;
24515 }
24516 else
24517 {
24518 afkCounter = 0;
24519 }
24520 meleeCrit += inventory[selectedItem].crit;
24521 magicCrit += inventory[selectedItem].crit;
24522 rangedCrit += inventory[selectedItem].crit;
24523 if (whoAmI == Main.myPlayer)
24524 {
24525 Main.musicBox2 = -1;
24526 if (Main.SceneMetrics.WaterCandleCount > 0)
24527 {
24528 AddBuff(86, 2, quiet: false);
24529 }
24530 if (Main.SceneMetrics.PeaceCandleCount > 0)
24531 {
24532 AddBuff(157, 2, quiet: false);
24533 }
24534 if (Main.SceneMetrics.ShadowCandleCount > 0)
24535 {
24536 AddBuff(350, 2, quiet: false);
24537 }
24538 if (Main.SceneMetrics.HasCampfire)
24539 {
24540 AddBuff(87, 2, quiet: false);
24541 }
24542 if (Main.SceneMetrics.HasCatBast)
24543 {
24544 AddBuff(215, 2, quiet: false);
24545 }
24546 if (Main.SceneMetrics.HasStarInBottle)
24547 {
24548 AddBuff(158, 2, quiet: false);
24549 }
24550 if (Main.SceneMetrics.HasHeartLantern)
24551 {
24552 AddBuff(89, 2, quiet: false);
24553 }
24554 if (Main.SceneMetrics.HasSunflower)
24555 {
24556 AddBuff(146, 2, quiet: false);
24557 }
24558 if (Main.SceneMetrics.hasBanner)
24559 {
24560 AddBuff(147, 2, quiet: false);
24561 }
24562 if (!behindBackWall && ZoneSandstorm)
24563 {
24564 AddBuff(194, 2, quiet: false);
24565 }
24566 }
24567 for (int num26 = 0; num26 < BuffID.Count; num26++)
24568 {
24569 buffImmune[num26] = false;
24570 }
24571 UpdateProjectileCaches(i);
24572 UpdateBuffs(i);
24573 if (whoAmI == Main.myPlayer)
24574 {
24575 if (!onFire && !poisoned)
24576 {
24577 trapDebuffSource = false;
24578 }
24579 UpdatePet(i);
24580 UpdatePetLight(i);
24581 isOperatingAnotherEntity = ownedProjectileCounts[1020] > 0;
24582 }
24583 bool flag13 = wet && !lavaWet && (!mount.Active || !mount.IsConsideredASlimeMount);
24584 if (accMerman && flag13)
24585 {
24586 releaseJump = true;
24587 wings = 0;
24588 merman = true;
24589 accFlipper = true;
24590 AddBuff(34, 2);
24591 }
24592 else
24593 {
24594 merman = false;
24595 }
24596 if (!flag13 && forceWerewolf)
24597 {
24598 forceMerman = false;
24599 }
24600 if (forceMerman && flag13)
24601 {
24602 wings = 0;
24603 }
24604 accMerman = false;
24605 hideMerman = false;
24606 forceMerman = false;
24607 if (wolfAcc && !merman && !Main.dayTime && !wereWolf)
24608 {
24609 AddBuff(28, 60);
24610 }
24611 wolfAcc = false;
24612 hideWolf = false;
24613 forceWerewolf = false;
24614 if (whoAmI == Main.myPlayer)
24615 {
24616 for (int num27 = 0; num27 < maxBuffs; num27++)
24617 {
24618 if (buffType[num27] > 0 && buffTime[num27] <= 0)
24619 {
24620 DelBuff(num27);
24621 }
24622 }
24623 }
24624 beetleDefense = false;
24625 beetleOffense = false;
24626 setSolar = false;
24627 head = armor[0].headSlot;
24628 body = armor[1].bodySlot;
24629 legs = armor[2].legSlot;
24630 ResetVisibleAccessories();
24631 if (MountFishronSpecialCounter > 0f)
24632 {
24633 MountFishronSpecialCounter -= 1f;
24634 }
24635 if (_portalPhysicsTime > 0)
24636 {
24637 _portalPhysicsTime--;
24638 }
24639 UpdateEquips(i);
24640 if (Main.npcShop <= 0)
24641 {
24642 discountAvailable = discountEquipped;
24643 }
24644 if (flag12 != pStone)
24645 {
24646 AdjustRemainingPotionSickness();
24647 }
24648 UpdatePermanentBoosters();
24649 UpdateLuck();
24650 shimmerUnstuckHelper.Update(this);
24651 UpdatePortableStoolUsage();
24652 if (velocity.Y == 0f || controlJump)
24653 {
24654 portalPhysicsFlag = false;
24655 }
24656 if (inventory[selectedItem].type == 3384 || portalPhysicsFlag)
24657 {
24658 _portalPhysicsTime = 30;
24659 }
24660 if (mount.Active)
24661 {
24662 mount.UpdateEffects(this);
24663 }
24664 gemCount++;
24665 if (gemCount >= 10)
24666 {
24667 gem = -1;
24668 ownedLargeGems = (byte)0;
24669 gemCount = 0;
24670 for (int num28 = 0; num28 <= 58; num28++)
24671 {
24672 if (inventory[num28].type == 0 || inventory[num28].stack == 0)
24673 {
24674 inventory[num28].TurnToAir();
24675 }
24676 if (inventory[num28].type >= 1522 && inventory[num28].type <= 1527)
24677 {
24678 gem = inventory[num28].type - 1522;
24679 ownedLargeGems[gem] = true;
24680 }
24681 if (inventory[num28].type == 3643)
24682 {
24683 gem = 6;
24684 ownedLargeGems[gem] = true;
24685 }
24686 }
24687 }
24688 UpdateArmorLights();
24689 UpdateArmorSets(i);
24690 if (shadowDodge && !onHitDodge)
24691 {
24692 ClearBuff(59);
24693 }
24694 if (maxTurretsOld != maxTurrets)
24695 {
24696 UpdateMaxTurrets();
24697 maxTurretsOld = maxTurrets;
24698 }
24699 if (shieldRaised)
24700 {
24701 statDefense += 20;
24702 }
24703 if ((merman || forceMerman) && flag13)
24704 {
24705 wings = 0;
24706 }
24707 if (invis)
24708 {
24709 if (itemAnimation == 0 && aggro > -750)
24710 {
24711 aggro = -750;
24712 }
24713 else if (aggro > -250)
24714 {
24715 aggro = -250;
24716 }
24717 }
24718 if (inventory[selectedItem].type == 3106)
24719 {
24720 if (itemAnimation > 0)
24721 {
24722 stealthTimer = 15;
24723 if (stealth > 0f)
24724 {
24725 stealth += 0.1f;
24726 }
24727 }
24728 else if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1 && (double)velocity.Y > -0.1 && (double)velocity.Y < 0.1 && !mount.Active)
24729 {
24730 if (stealthTimer == 0 && stealth > 0f)
24731 {
24732 stealth -= 0.02f;
24733 if ((double)stealth <= 0.0)
24734 {
24735 stealth = 0f;
24736 if (Main.netMode == 1)
24737 {
24738 NetMessage.SendData(84, -1, -1, null, whoAmI);
24739 }
24740 }
24741 }
24742 }
24743 else
24744 {
24745 if (stealth > 0f)
24746 {
24747 stealth += 0.1f;
24748 }
24749 if (mount.Active)
24750 {
24751 stealth = 1f;
24752 }
24753 }
24754 if (stealth > 1f)
24755 {
24756 stealth = 1f;
24757 }
24758 meleeDamage += (1f - stealth) * 3f;
24759 meleeCrit += (int)((1f - stealth) * 30f);
24760 if (meleeCrit > 100)
24761 {
24762 meleeCrit = 100;
24763 }
24764 aggro -= (int)((1f - stealth) * 750f);
24765 if (stealthTimer > 0)
24766 {
24767 stealthTimer--;
24768 }
24769 }
24770 else if (shroomiteStealth)
24771 {
24772 if (itemAnimation > 0)
24773 {
24774 stealthTimer = 5;
24775 }
24776 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1 && (double)velocity.Y > -0.1 && (double)velocity.Y < 0.1 && !mount.Active)
24777 {
24778 if (stealthTimer == 0 && stealth > 0f)
24779 {
24780 stealth -= 0.015f;
24781 if ((double)stealth <= 0.0)
24782 {
24783 stealth = 0f;
24784 if (Main.netMode == 1)
24785 {
24786 NetMessage.SendData(84, -1, -1, null, whoAmI);
24787 }
24788 }
24789 }
24790 }
24791 else
24792 {
24793 float num29 = Math.Abs(velocity.X) + Math.Abs(velocity.Y);
24794 stealth += num29 * 0.0075f;
24795 if (stealth > 1f)
24796 {
24797 stealth = 1f;
24798 }
24799 if (mount.Active)
24800 {
24801 stealth = 1f;
24802 }
24803 }
24804 rangedDamage += (1f - stealth) * 0.6f;
24805 rangedCrit += (int)((1f - stealth) * 10f);
24806 aggro -= (int)((1f - stealth) * 750f);
24807 if (stealthTimer > 0)
24808 {
24809 stealthTimer--;
24810 }
24811 }
24812 else if (setVortex)
24813 {
24814 bool flag14 = false;
24815 if (vortexStealthActive)
24816 {
24817 float num30 = stealth;
24818 stealth -= 0.04f;
24819 if (stealth < 0f)
24820 {
24821 stealth = 0f;
24822 }
24823 else
24824 {
24825 flag14 = true;
24826 }
24827 if (stealth == 0f && num30 != stealth && Main.netMode == 1)
24828 {
24829 NetMessage.SendData(84, -1, -1, null, whoAmI);
24830 }
24831 rangedDamage += (1f - stealth) * 0.8f;
24832 rangedCrit += (int)((1f - stealth) * 20f);
24833 aggro -= (int)((1f - stealth) * 1200f);
24834 accRunSpeed *= 0.3f;
24835 maxRunSpeed *= 0.3f;
24836 if (mount.Active)
24837 {
24838 vortexStealthActive = false;
24839 }
24840 }
24841 else
24842 {
24843 float num31 = stealth;
24844 stealth += 0.04f;
24845 if (stealth > 1f)
24846 {
24847 stealth = 1f;
24848 }
24849 else
24850 {
24851 flag14 = true;
24852 }
24853 if (stealth == 1f && num31 != stealth && Main.netMode == 1)
24854 {
24855 NetMessage.SendData(84, -1, -1, null, whoAmI);
24856 }
24857 }
24858 if (flag14)
24859 {
24860 if (Main.rand.Next(2) == 0)
24861 {
24862 Vector2 vector = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
24863 Dust obj2 = Main.dust[Dust.NewDust(base.Center - vector * 30f, 0, 0, 229)];
24864 obj2.noGravity = true;
24865 obj2.position = base.Center - vector * Main.rand.Next(5, 11);
24866 obj2.velocity = vector.RotatedBy(1.5707963705062866) * 4f;
24867 obj2.scale = 0.5f + Main.rand.NextFloat();
24868 obj2.fadeIn = 0.5f;
24869 }
24870 if (Main.rand.Next(2) == 0)
24871 {
24872 Vector2 vector2 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
24873 Dust obj3 = Main.dust[Dust.NewDust(base.Center - vector2 * 30f, 0, 0, 240)];
24874 obj3.noGravity = true;
24875 obj3.position = base.Center - vector2 * 12f;
24876 obj3.velocity = vector2.RotatedBy(-1.5707963705062866) * 2f;
24877 obj3.scale = 0.5f + Main.rand.NextFloat();
24878 obj3.fadeIn = 0.5f;
24879 }
24880 }
24881 }
24882 else
24883 {
24884 stealth = 1f;
24885 }
24886 if (manaSick)
24887 {
24888 magicDamage *= 1f - manaSickReduction;
24889 }
24890 float num32 = meleeSpeed - 1f;
24891 num32 *= ItemID.Sets.BonusMeleeSpeedMultiplier[inventory[selectedItem].type];
24892 meleeSpeed = 1f + num32;
24893 if (tileSpeed > 3f)
24894 {
24895 tileSpeed = 3f;
24896 }
24897 tileSpeed = 1f / tileSpeed;
24898 if (wallSpeed > 3f)
24899 {
24900 wallSpeed = 3f;
24901 }
24902 wallSpeed = 1f / wallSpeed;
24903 if (statManaMax2 > 400)
24904 {
24905 statManaMax2 = 400;
24906 }
24907 if (statDefense < 0)
24908 {
24909 statDefense = 0;
24910 }
24911 if (slowOgreSpit)
24912 {
24913 moveSpeed /= 3f;
24914 if (velocity.Y == 0f && Math.Abs(velocity.X) > 1f)
24915 {
24916 velocity.X /= 2f;
24917 }
24918 }
24919 else if (dazed)
24920 {
24921 moveSpeed /= 3f;
24922 }
24923 else if (slow)
24924 {
24925 moveSpeed /= 2f;
24926 }
24927 else if (chilled)
24928 {
24929 moveSpeed *= 0.75f;
24930 }
24931 if (shieldRaised)
24932 {
24933 moveSpeed /= 3f;
24934 if (velocity.Y == 0f && Math.Abs(velocity.X) > 3f)
24935 {
24936 velocity.X /= 2f;
24937 }
24938 }
24939 if (DD2Event.Ongoing)
24940 {
24942 if (DD2Event.ShouldBlockBuilding(base.Center))
24943 {
24944 noBuilding = true;
24945 AddBuff(199, 3);
24946 }
24947 }
24948 if ((double)pickSpeed < 0.3)
24949 {
24950 pickSpeed = 0.3f;
24951 }
24952 CapAttackSpeeds();
24953 UpdateLifeRegen();
24954 soulDrain = 0;
24955 UpdateManaRegen();
24956 if (manaRegenCount < 0)
24957 {
24958 manaRegenCount = 0;
24959 }
24960 if (statMana > statManaMax2)
24961 {
24962 statMana = statManaMax2;
24963 }
24964 runAcceleration *= moveSpeed;
24965 maxRunSpeed *= moveSpeed;
24966 UpdateJumpHeight();
24967 for (int num33 = 0; num33 < maxBuffs; num33++)
24968 {
24969 if (buffType[num33] > 0 && buffTime[num33] > 0 && buffImmune[buffType[num33]])
24970 {
24971 DelBuff(num33);
24972 }
24973 }
24974 if (brokenArmor)
24975 {
24976 statDefense /= 2;
24977 }
24978 if (witheredArmor)
24979 {
24980 statDefense /= 2;
24981 }
24982 if (witheredWeapon)
24983 {
24984 meleeDamage *= 0.5f;
24985 rangedDamage *= 0.5f;
24986 magicDamage *= 0.5f;
24987 minionDamage *= 0.5f;
24988 rangedMultDamage *= 0.5f;
24989 }
24990 lastTileRangeX = tileRangeX;
24991 lastTileRangeY = tileRangeY;
24992 if (mount.Active)
24993 {
24994 movementAbilitiesCache.CopyFrom(this);
24995 }
24996 else
24997 {
24998 movementAbilitiesCache.PasteInto(this);
24999 }
25000 if (mount.Active && mount.BlockExtraJumps)
25001 {
25002 canJumpAgain_Cloud = false;
25003 canJumpAgain_Sandstorm = false;
25004 canJumpAgain_Blizzard = false;
25005 canJumpAgain_Fart = false;
25006 canJumpAgain_Sail = false;
25007 canJumpAgain_Unicorn = false;
25008 canJumpAgain_Santank = false;
25009 canJumpAgain_WallOfFleshGoat = false;
25010 canJumpAgain_Basilisk = false;
25011 }
25012 else if (velocity.Y == 0f || sliding)
25013 {
25014 RefreshDoubleJumps();
25015 }
25016 else
25017 {
25018 if (!hasJumpOption_Cloud)
25019 {
25020 canJumpAgain_Cloud = false;
25021 }
25022 if (!hasJumpOption_Sandstorm)
25023 {
25024 canJumpAgain_Sandstorm = false;
25025 }
25026 if (!hasJumpOption_Blizzard)
25027 {
25028 canJumpAgain_Blizzard = false;
25029 }
25030 if (!hasJumpOption_Fart)
25031 {
25032 canJumpAgain_Fart = false;
25033 }
25034 if (!hasJumpOption_Sail)
25035 {
25036 canJumpAgain_Sail = false;
25037 }
25038 if (!hasJumpOption_Unicorn)
25039 {
25040 canJumpAgain_Unicorn = false;
25041 }
25042 if (!hasJumpOption_Santank)
25043 {
25044 canJumpAgain_Santank = false;
25045 }
25046 if (!hasJumpOption_WallOfFleshGoat)
25047 {
25048 canJumpAgain_WallOfFleshGoat = false;
25049 }
25050 if (!hasJumpOption_Basilisk)
25051 {
25052 canJumpAgain_Basilisk = false;
25053 }
25054 }
25055 if (!carpet)
25056 {
25057 canCarpet = false;
25058 carpetFrame = -1;
25059 }
25060 else if (velocity.Y == 0f || sliding)
25061 {
25062 canCarpet = true;
25063 carpetTime = 0;
25064 carpetFrame = -1;
25065 carpetFrameCounter = 0f;
25066 }
25067 if (gravDir == -1f)
25068 {
25069 canCarpet = false;
25070 }
25071 if (ropeCount > 0)
25072 {
25073 ropeCount--;
25074 }
25075 if (!pulley && !frozen && !webbed && !stoned && !controlJump && gravDir == 1f && ropeCount == 0 && grappling[0] == -1 && !tongued && !mount.Active)
25076 {
25077 FindPulley();
25078 }
25079 UpdatePettingAnimal();
25080 sitting.UpdateSitting(this);
25081 sleeping.UpdateState(this);
25082 eyeHelper.Update(this);
25083 if (pulley)
25084 {
25085 if (mount.Active)
25086 {
25087 pulley = false;
25088 }
25089 sandStorm = false;
25090 CancelAllJumpVisualEffects();
25091 int num34 = (int)(position.X + (float)(width / 2)) / 16;
25092 int num35 = (int)(position.Y - 8f) / 16;
25093 bool flag15 = false;
25094 if (pulleyDir == 0)
25095 {
25096 pulleyDir = 1;
25097 }
25098 if (pulleyDir == 1)
25099 {
25100 if (direction == -1 && controlLeft && (releaseLeft || leftTimer == 0))
25101 {
25102 pulleyDir = 2;
25103 flag15 = true;
25104 }
25105 else if ((direction == 1 && controlRight && releaseRight) || rightTimer == 0)
25106 {
25107 pulleyDir = 2;
25108 flag15 = true;
25109 }
25110 else
25111 {
25112 if (direction == 1 && controlLeft)
25113 {
25114 direction = -1;
25115 flag15 = true;
25116 }
25117 if (direction == -1 && controlRight)
25118 {
25119 direction = 1;
25120 flag15 = true;
25121 }
25122 }
25123 }
25124 else if (pulleyDir == 2)
25125 {
25126 if (direction == 1 && controlLeft)
25127 {
25128 flag15 = true;
25129 if (!Collision.SolidCollision(new Vector2(num34 * 16 + 8 - width / 2, position.Y), width, height))
25130 {
25131 pulleyDir = 1;
25132 direction = -1;
25133 flag15 = true;
25134 }
25135 }
25136 if (direction == -1 && controlRight)
25137 {
25138 flag15 = true;
25139 if (!Collision.SolidCollision(new Vector2(num34 * 16 + 8 - width / 2, position.Y), width, height))
25140 {
25141 pulleyDir = 1;
25142 direction = 1;
25143 flag15 = true;
25144 }
25145 }
25146 }
25147 int num36 = 1;
25148 if (controlLeft)
25149 {
25150 num36 = -1;
25151 }
25152 bool flag16 = CanMoveForwardOnRope(num36, num34, num35);
25153 if (controlLeft && direction == -1 && flag16)
25154 {
25155 instantMovementAccumulatedThisFrame.X += -1f;
25156 }
25157 if (controlRight && direction == 1 && flag16)
25158 {
25159 instantMovementAccumulatedThisFrame.X += 1f;
25160 }
25161 bool flag17 = false;
25162 if (!flag15 && ((controlLeft && (releaseLeft || leftTimer == 0)) || (controlRight && (releaseRight || rightTimer == 0))))
25163 {
25164 int num37 = num34 + num36;
25165 if (WorldGen.IsRope(num37, num35))
25166 {
25167 pulleyDir = 1;
25168 direction = num36;
25169 int num38 = num37 * 16 + 8 - width / 2;
25170 float y4 = position.Y;
25171 y4 = num35 * 16 + 22;
25172 if (Main.tile[num37, num35 - 1] == null)
25173 {
25174 Main.tile[num37, num35 - 1] = new Tile();
25175 }
25176 if (Main.tile[num37, num35 + 1] == null)
25177 {
25178 Main.tile[num37, num35 + 1] = new Tile();
25179 }
25180 if (WorldGen.IsRope(num37, num35 - 1) || WorldGen.IsRope(num37, num35 + 1))
25181 {
25182 y4 = num35 * 16 + 22;
25183 }
25184 if (Collision.SolidCollision(new Vector2(num38, y4), width, height))
25185 {
25186 pulleyDir = 2;
25187 direction = -num36;
25188 num38 = ((direction != 1) ? (num37 * 16 + 8 - width / 2 + -6) : (num37 * 16 + 8 - width / 2 + 6));
25189 }
25190 if (i == Main.myPlayer)
25191 {
25192 Main.cameraX = Main.cameraX + position.X - (float)num38;
25193 }
25194 position.X = num38;
25195 gfxOffY = position.Y - y4;
25196 position.Y = y4;
25197 flag17 = true;
25198 }
25199 }
25200 if (!flag17 && !flag15 && !controlUp && ((controlLeft && releaseLeft) || (controlRight && releaseRight)))
25201 {
25202 pulley = false;
25203 if (controlLeft && velocity.X == 0f)
25204 {
25205 velocity.X = -1f;
25206 }
25207 if (controlRight && velocity.X == 0f)
25208 {
25209 velocity.X = 1f;
25210 }
25211 }
25212 if (velocity.X != 0f)
25213 {
25214 pulley = false;
25215 }
25216 if (Main.tile[num34, num35] == null)
25217 {
25218 Main.tile[num34, num35] = new Tile();
25219 }
25220 if (!WorldGen.IsRope(num34, num35))
25221 {
25222 pulley = false;
25223 }
25224 if (gravDir != 1f)
25225 {
25226 pulley = false;
25227 }
25228 if (frozen || webbed || stoned)
25229 {
25230 pulley = false;
25231 }
25232 if (!pulley)
25233 {
25234 velocity.Y -= gravity;
25235 }
25236 if (controlJump)
25237 {
25238 pulley = false;
25239 jump = jumpHeight;
25240 velocity.Y = 0f - jumpSpeed;
25241 }
25242 }
25243 if (grapCount > 0)
25244 {
25245 pulley = false;
25246 }
25247 if (NPC.brainOfGravity >= 0 && NPC.brainOfGravity < 200 && Vector2.Distance(base.Center, Main.npc[NPC.brainOfGravity].Center) < 4000f)
25248 {
25249 forcedGravity = 10;
25250 }
25251 if (forcedGravity > 0)
25252 {
25253 gravDir = -1f;
25254 }
25255 if (pulley)
25256 {
25257 fallStart = (int)position.Y / 16;
25258 wingFrame = 0;
25259 if (wings == 4)
25260 {
25261 wingFrame = 3;
25262 }
25263 int num39 = (int)(position.X + (float)(width / 2)) / 16;
25264 int num40 = (int)(position.Y - 16f) / 16;
25265 int num41 = (int)(position.Y - 8f) / 16;
25266 bool flag18 = true;
25267 bool flag19 = false;
25268 if (WorldGen.IsRope(num39, num41 - 1) || WorldGen.IsRope(num39, num41 + 1))
25269 {
25270 flag19 = true;
25271 }
25272 if (Main.tile[num39, num40] == null)
25273 {
25274 Main.tile[num39, num40] = new Tile();
25275 }
25276 if (!WorldGen.IsRope(num39, num40))
25277 {
25278 flag18 = false;
25279 if (velocity.Y < 0f)
25280 {
25281 velocity.Y = 0f;
25282 }
25283 }
25284 if (flag19)
25285 {
25286 if (controlUp && flag18)
25287 {
25288 float x3 = position.X;
25289 float y5 = position.Y - Math.Abs(velocity.Y) - 2f;
25290 if (Collision.SolidCollision(new Vector2(x3, y5), width, height))
25291 {
25292 x3 = num39 * 16 + 8 - width / 2 + 6;
25293 if (!Collision.SolidCollision(new Vector2(x3, y5), width, (int)((float)height + Math.Abs(velocity.Y) + 2f)))
25294 {
25295 if (i == Main.myPlayer)
25296 {
25297 Main.cameraX = Main.cameraX + position.X - x3;
25298 }
25299 pulleyDir = 2;
25300 direction = 1;
25301 position.X = x3;
25302 velocity.X = 0f;
25303 }
25304 else
25305 {
25306 x3 = num39 * 16 + 8 - width / 2 + -6;
25307 if (!Collision.SolidCollision(new Vector2(x3, y5), width, (int)((float)height + Math.Abs(velocity.Y) + 2f)))
25308 {
25309 if (i == Main.myPlayer)
25310 {
25311 Main.cameraX = Main.cameraX + position.X - x3;
25312 }
25313 pulleyDir = 2;
25314 direction = -1;
25315 position.X = x3;
25316 velocity.X = 0f;
25317 }
25318 }
25319 }
25320 if (velocity.Y > 0f)
25321 {
25322 velocity.Y *= 0.7f;
25323 }
25324 if (velocity.Y > -3f)
25325 {
25326 velocity.Y -= 0.2f;
25327 }
25328 else
25329 {
25330 velocity.Y -= 0.02f;
25331 }
25332 if (velocity.Y < -8f)
25333 {
25334 velocity.Y = -8f;
25335 }
25336 }
25337 else if (controlDown)
25338 {
25339 float x4 = position.X;
25340 float y6 = position.Y;
25341 if (Collision.SolidCollision(new Vector2(x4, y6), width, (int)((float)height + Math.Abs(velocity.Y) + 2f)))
25342 {
25343 x4 = num39 * 16 + 8 - width / 2 + 6;
25344 if (!Collision.SolidCollision(new Vector2(x4, y6), width, (int)((float)height + Math.Abs(velocity.Y) + 2f)))
25345 {
25346 if (i == Main.myPlayer)
25347 {
25348 Main.cameraX = Main.cameraX + position.X - x4;
25349 }
25350 pulleyDir = 2;
25351 direction = 1;
25352 position.X = x4;
25353 velocity.X = 0f;
25354 }
25355 else
25356 {
25357 x4 = num39 * 16 + 8 - width / 2 + -6;
25358 if (!Collision.SolidCollision(new Vector2(x4, y6), width, (int)((float)height + Math.Abs(velocity.Y) + 2f)))
25359 {
25360 if (i == Main.myPlayer)
25361 {
25362 Main.cameraX = Main.cameraX + position.X - x4;
25363 }
25364 pulleyDir = 2;
25365 direction = -1;
25366 position.X = x4;
25367 velocity.X = 0f;
25368 }
25369 }
25370 }
25371 if (velocity.Y < 0f)
25372 {
25373 velocity.Y *= 0.7f;
25374 }
25375 if (velocity.Y < 3f)
25376 {
25377 velocity.Y += 0.2f;
25378 }
25379 else
25380 {
25381 velocity.Y += 0.1f;
25382 }
25383 if (velocity.Y > maxFallSpeed)
25384 {
25385 velocity.Y = maxFallSpeed;
25386 }
25387 }
25388 else
25389 {
25390 velocity.Y *= 0.7f;
25391 if ((double)velocity.Y > -0.1 && (double)velocity.Y < 0.1)
25392 {
25393 velocity.Y = 0f;
25394 }
25395 }
25396 }
25397 else if (controlDown)
25398 {
25399 ropeCount = 10;
25400 pulley = false;
25401 velocity.Y = 1f;
25402 }
25403 else
25404 {
25405 velocity.Y = 0f;
25406 position.Y = num40 * 16 + 22;
25407 }
25408 float num42 = num39 * 16 + 8 - width / 2;
25409 if (pulleyDir == 1)
25410 {
25411 num42 = num39 * 16 + 8 - width / 2;
25412 }
25413 if (pulleyDir == 2)
25414 {
25415 num42 = num39 * 16 + 8 - width / 2 + 6 * direction;
25416 }
25417 if (i == Main.myPlayer)
25418 {
25419 Main.cameraX += position.X - num42;
25420 Main.cameraX = MathHelper.Clamp(Main.cameraX, -32f, 32f);
25421 }
25422 position.X = num42;
25423 pulleyFrameCounter += Math.Abs(velocity.Y * 0.75f);
25424 if (velocity.Y != 0f)
25425 {
25426 pulleyFrameCounter += 0.75f;
25427 }
25428 if (pulleyFrameCounter > 10f)
25429 {
25430 pulleyFrame++;
25431 pulleyFrameCounter = 0f;
25432 }
25433 if (pulleyFrame > 1)
25434 {
25435 pulleyFrame = 0;
25436 }
25437 canCarpet = true;
25438 carpetFrame = -1;
25439 wingTime = wingTimeMax;
25440 rocketTime = rocketTimeMax;
25441 rocketDelay = 0;
25442 rocketFrame = false;
25443 canRocket = false;
25444 rocketRelease = false;
25445 DashMovement();
25446 UpdateControlHolds();
25447 }
25448 else if (grappling[0] == -1 && !tongued)
25449 {
25450 if (wingsLogic > 0 && velocity.Y != 0f && !merman && !mount.Active)
25451 {
25452 WingAirLogicTweaks();
25453 }
25454 if (empressBrooch)
25455 {
25456 runAcceleration *= 1.75f;
25457 }
25458 if (hasMagiluminescence && velocity.Y == 0f)
25459 {
25460 runAcceleration *= 1.75f;
25461 maxRunSpeed *= 1.15f;
25462 accRunSpeed *= 1.15f;
25463 runSlowdown *= 1.75f;
25464 }
25465 if (shadowArmor)
25466 {
25467 runAcceleration *= 1.75f;
25468 maxRunSpeed *= 1.15f;
25469 accRunSpeed *= 1.15f;
25470 runSlowdown *= 1.75f;
25471 }
25472 if (mount.Active && mount.Type == 43 && velocity.Y != 0f)
25473 {
25474 runSlowdown = 0f;
25475 }
25476 if (sticky)
25477 {
25478 maxRunSpeed *= 0.25f;
25479 runAcceleration *= 0.25f;
25480 runSlowdown *= 2f;
25481 if (velocity.X > maxRunSpeed)
25482 {
25483 velocity.X = maxRunSpeed;
25484 }
25485 if (velocity.X < 0f - maxRunSpeed)
25486 {
25487 velocity.X = 0f - maxRunSpeed;
25488 }
25489 }
25490 else if (powerrun)
25491 {
25492 maxRunSpeed *= 3.5f;
25493 runAcceleration *= 1f;
25494 runSlowdown *= 2f;
25495 }
25496 else if (runningOnSand && desertBoots)
25497 {
25498 float num43 = 1.75f;
25499 maxRunSpeed *= num43;
25500 accRunSpeed *= num43;
25501 runAcceleration *= num43;
25502 runSlowdown *= num43;
25503 }
25504 else if (slippy2)
25505 {
25506 runAcceleration *= 0.6f;
25507 runSlowdown = 0f;
25508 if (iceSkate)
25509 {
25510 runAcceleration *= 3.5f;
25511 maxRunSpeed *= 1.25f;
25512 }
25513 }
25514 else if (slippy)
25515 {
25516 runAcceleration *= 0.7f;
25517 if (iceSkate)
25518 {
25519 runAcceleration *= 3.5f;
25520 maxRunSpeed *= 1.25f;
25521 }
25522 else
25523 {
25524 runSlowdown *= 0.1f;
25525 }
25526 }
25527 if (sandStorm)
25528 {
25529 runAcceleration *= 1.5f;
25530 maxRunSpeed *= 2f;
25531 }
25532 if (isPerformingJump_Blizzard && hasJumpOption_Blizzard)
25533 {
25534 runAcceleration *= 3f;
25535 maxRunSpeed *= 1.5f;
25536 }
25537 if (isPerformingJump_Fart && hasJumpOption_Fart)
25538 {
25539 runAcceleration *= 3f;
25540 maxRunSpeed *= 1.75f;
25541 }
25542 if (isPerformingJump_Unicorn && hasJumpOption_Unicorn)
25543 {
25544 runAcceleration *= 3f;
25545 maxRunSpeed *= 1.5f;
25546 }
25547 if (isPerformingJump_Santank && hasJumpOption_Santank)
25548 {
25549 runAcceleration *= 3f;
25550 maxRunSpeed *= 1.5f;
25551 }
25552 if (isPerformingJump_WallOfFleshGoat && hasJumpOption_WallOfFleshGoat)
25553 {
25554 runAcceleration *= 3f;
25555 maxRunSpeed *= 1.5f;
25556 }
25557 if (isPerformingJump_Basilisk && hasJumpOption_Basilisk)
25558 {
25559 runAcceleration *= 3f;
25560 maxRunSpeed *= 1.5f;
25561 }
25562 if (isPerformingJump_Sail && hasJumpOption_Sail)
25563 {
25564 runAcceleration *= 1.5f;
25565 maxRunSpeed *= 1.25f;
25566 }
25567 if (carpetFrame != -1)
25568 {
25569 runAcceleration *= 1.25f;
25570 maxRunSpeed *= 1.5f;
25571 }
25572 if (inventory[selectedItem].type == 3106 && stealth < 1f)
25573 {
25574 float num44 = maxRunSpeed / 2f * (1f - stealth);
25575 maxRunSpeed -= num44;
25576 accRunSpeed = maxRunSpeed;
25577 }
25578 if (mount.Active)
25579 {
25580 rocketBoots = 0;
25581 vanityRocketBoots = 0;
25582 wings = 0;
25583 wingsLogic = 0;
25584 maxRunSpeed = mount.RunSpeed;
25585 accRunSpeed = mount.DashSpeed;
25586 runAcceleration = mount.Acceleration;
25587 if (mount.Type == 12 && !MountFishronSpecial)
25588 {
25589 runAcceleration /= 2f;
25590 maxRunSpeed /= 2f;
25591 }
25592 mount.AbilityRecovery();
25593 if (mount.Cart && velocity.Y == 0f)
25594 {
25595 if (!Minecart.OnTrack(position, width, height))
25596 {
25597 fullRotation = 0f;
25598 onWrongGround = true;
25599 runSlowdown = 0.2f;
25600 if ((controlLeft && releaseLeft) || (controlRight && releaseRight))
25601 {
25602 mount.Dismount(this);
25603 }
25604 }
25605 else
25606 {
25607 runSlowdown = runAcceleration;
25608 onWrongGround = false;
25609 }
25610 }
25611 if (mount.Type == 8)
25612 {
25613 mount.UpdateDrill(this, controlUp, controlDown);
25614 }
25615 }
25616 HorizontalMovement();
25617 bool flag20 = !mount.Active;
25618 if (forcedGravity > 0)
25619 {
25620 gravDir = -1f;
25621 }
25622 else if (gravControl && flag20)
25623 {
25624 if (controlUp && releaseUp)
25625 {
25626 if (gravDir == 1f)
25627 {
25628 gravDir = -1f;
25629 fallStart = (int)(position.Y / 16f);
25630 jump = 0;
25632 }
25633 else
25634 {
25635 gravDir = 1f;
25636 fallStart = (int)(position.Y / 16f);
25637 jump = 0;
25639 }
25640 }
25641 }
25642 else if (gravControl2 && flag20)
25643 {
25644 if (controlUp && releaseUp)
25645 {
25646 if (gravDir == 1f)
25647 {
25648 gravDir = -1f;
25649 fallStart = (int)(position.Y / 16f);
25650 jump = 0;
25652 }
25653 else
25654 {
25655 gravDir = 1f;
25656 fallStart = (int)(position.Y / 16f);
25657 jump = 0;
25659 }
25660 }
25661 }
25662 else
25663 {
25664 gravDir = 1f;
25665 }
25666 if (velocity.Y == 0f && mount.Active && mount.CanHover() && controlUp && releaseUp)
25667 {
25668 velocity.Y = 0f - (mount.Acceleration + gravity + 0.001f);
25669 }
25670 UpdateControlHolds();
25671 sandStorm = false;
25672 JumpMovement();
25673 if (wingsLogic == 0)
25674 {
25675 wingTime = 0f;
25676 }
25677 if (rocketBoots == 0)
25678 {
25679 rocketTime = 0;
25680 }
25681 if (jump == 0)
25682 {
25683 CancelAllJumpVisualEffects();
25684 }
25685 DashMovement();
25686 WallslideMovement();
25687 CarpetMovement();
25688 DoubleJumpVisuals();
25689 if (wingsLogic > 0 || mount.Active)
25690 {
25691 sandStorm = false;
25692 }
25693 if (((gravDir == 1f && velocity.Y > 0f - jumpSpeed) || (gravDir == -1f && velocity.Y < jumpSpeed)) && velocity.Y != 0f)
25694 {
25695 canRocket = true;
25696 }
25697 bool flag21 = false;
25698 if (((velocity.Y == 0f || sliding) && releaseJump) || (autoJump && justJumped))
25699 {
25700 mount.ResetFlightTime(velocity.X);
25701 wingTime = wingTimeMax;
25702 }
25703 if (wingsLogic > 0 && controlJump && wingTime > 0f && jump == 0 && velocity.Y != 0f)
25704 {
25705 flag21 = true;
25706 }
25707 if ((wingsLogic == 22 || wingsLogic == 28 || wingsLogic == 30 || wingsLogic == 32 || wingsLogic == 29 || wingsLogic == 33 || wingsLogic == 35 || wingsLogic == 37 || wingsLogic == 45) && controlJump && TryingToHoverDown && wingTime > 0f)
25708 {
25709 flag21 = true;
25710 }
25711 if (frozen || webbed || stoned)
25712 {
25713 if (mount.Active)
25714 {
25715 mount.Dismount(this);
25716 }
25717 velocity.Y += gravity;
25718 if (velocity.Y > maxFallSpeed)
25719 {
25720 velocity.Y = maxFallSpeed;
25721 }
25722 sandStorm = false;
25723 CancelAllJumpVisualEffects();
25724 }
25725 else
25726 {
25727 if (flag21)
25728 {
25729 WingAirVisuals();
25730 WingMovement();
25731 }
25732 WingFrame(flag21);
25733 if (wingsLogic > 0 && rocketBoots != 0 && velocity.Y != 0f && rocketTime != 0)
25734 {
25735 int num45 = 6;
25736 int num46 = rocketTime * num45;
25737 wingTime += num46;
25738 if (wingTime > (float)(wingTimeMax + num46))
25739 {
25740 wingTime = wingTimeMax + num46;
25741 }
25742 rocketTime = 0;
25743 }
25744 if (flag21 && wings != 4 && wings != 22 && wings != 0 && wings != 24 && wings != 28 && wings != 30 && wings != 33 && wings != 45)
25745 {
25746 bool flag22 = wingFrame == 3;
25747 if (wings == 43 || wings == 44)
25748 {
25749 flag22 = wingFrame == 4;
25750 }
25751 if (flag22)
25752 {
25753 if (!flapSound)
25754 {
25756 }
25757 flapSound = true;
25758 }
25759 else
25760 {
25761 flapSound = false;
25762 }
25763 }
25764 if (velocity.Y == 0f || sliding || (autoJump && justJumped))
25765 {
25766 rocketTime = rocketTimeMax;
25767 }
25768 if (empressBrooch)
25769 {
25770 rocketTime = rocketTimeMax;
25771 }
25772 if ((wingTime == 0f || wingsLogic == 0) && rocketBoots != 0 && controlJump && rocketDelay == 0 && canRocket && rocketRelease && !canJumpAgain_Cloud)
25773 {
25774 if (rocketTime > 0)
25775 {
25776 rocketTime--;
25777 rocketDelay = 10;
25778 if (rocketDelay2 <= 0)
25779 {
25780 if (rocketBoots == 1)
25781 {
25782 rocketDelay2 = 30;
25783 }
25784 else if (rocketBoots == 2 || rocketBoots == 5 || rocketBoots == 3 || rocketBoots == 4)
25785 {
25786 rocketDelay2 = 15;
25787 }
25788 }
25789 if (rocketSoundDelay <= 0)
25790 {
25791 if (vanityRocketBoots == 1 || vanityRocketBoots == 5)
25792 {
25793 rocketSoundDelay = 30;
25795 }
25796 else if (vanityRocketBoots == 2 || vanityRocketBoots == 3 || vanityRocketBoots == 4)
25797 {
25798 rocketSoundDelay = 15;
25800 }
25801 }
25802 }
25803 else
25804 {
25805 canRocket = false;
25806 }
25807 }
25808 if (rocketSoundDelay > 0)
25809 {
25810 rocketSoundDelay--;
25811 }
25812 if (rocketDelay2 > 0)
25813 {
25814 rocketDelay2--;
25815 }
25816 if (rocketDelay == 0)
25817 {
25818 rocketFrame = false;
25819 }
25820 if (rocketDelay > 0)
25821 {
25822 rocketFrame = true;
25823 RocketBootVisuals();
25824 if (rocketDelay == 0)
25825 {
25826 releaseJump = true;
25827 }
25828 rocketDelay--;
25829 velocity.Y -= 0.1f * gravDir;
25830 if (gravDir == 1f)
25831 {
25832 if (velocity.Y > 0f)
25833 {
25834 velocity.Y -= 0.5f;
25835 }
25836 else if ((double)velocity.Y > (double)(0f - jumpSpeed) * 0.5)
25837 {
25838 velocity.Y -= 0.1f;
25839 }
25840 if (velocity.Y < (0f - jumpSpeed) * 1.5f)
25841 {
25842 velocity.Y = (0f - jumpSpeed) * 1.5f;
25843 }
25844 }
25845 else
25846 {
25847 if (velocity.Y < 0f)
25848 {
25849 velocity.Y += 0.5f;
25850 }
25851 else if ((double)velocity.Y < (double)jumpSpeed * 0.5)
25852 {
25853 velocity.Y += 0.1f;
25854 }
25855 if (velocity.Y > jumpSpeed * 1.5f)
25856 {
25857 velocity.Y = jumpSpeed * 1.5f;
25858 }
25859 }
25860 }
25861 else if (!flag21)
25862 {
25863 if (mount.CanHover())
25864 {
25865 mount.Hover(this);
25866 }
25867 else if (mount.CanFly() && controlJump && jump == 0)
25868 {
25869 if (mount.Flight())
25870 {
25871 if (TryingToHoverDown)
25872 {
25873 velocity.Y *= 0.9f;
25874 if (velocity.Y > -1f && (double)velocity.Y < 0.5)
25875 {
25876 velocity.Y = 1E-05f;
25877 }
25878 }
25879 else
25880 {
25881 float num47 = jumpSpeed;
25882 if (mount.Type == 50)
25883 {
25884 num47 *= 0.5f;
25885 }
25886 if (velocity.Y > 0f)
25887 {
25888 velocity.Y -= 0.5f;
25889 }
25890 else if ((double)velocity.Y > (double)(0f - num47) * 1.5)
25891 {
25892 velocity.Y -= 0.1f;
25893 }
25894 if (velocity.Y < (0f - num47) * 1.5f)
25895 {
25896 velocity.Y = (0f - num47) * 1.5f;
25897 }
25898 }
25899 }
25900 else
25901 {
25902 velocity.Y += gravity / 3f * gravDir;
25903 if (gravDir == 1f)
25904 {
25905 if (velocity.Y > maxFallSpeed / 3f && !TryingToHoverDown)
25906 {
25907 velocity.Y = maxFallSpeed / 3f;
25908 }
25909 }
25910 else if (velocity.Y < (0f - maxFallSpeed) / 3f && !TryingToHoverUp)
25911 {
25912 velocity.Y = (0f - maxFallSpeed) / 3f;
25913 }
25914 }
25915 }
25916 else if (slowFall && !TryingToHoverDown)
25917 {
25918 if (TryingToHoverUp)
25919 {
25920 gravity = gravity / 10f * gravDir;
25921 }
25922 else
25923 {
25924 gravity = gravity / 3f * gravDir;
25925 }
25926 velocity.Y += gravity;
25927 }
25928 else if (wingsLogic > 0 && controlJump && velocity.Y > 0f)
25929 {
25930 bool noLightEmittence = wingsLogic != wings;
25931 fallStart = (int)(position.Y / 16f);
25932 if (velocity.Y > 0f)
25933 {
25934 if (wings == 10 && Main.rand.Next(3) == 0)
25935 {
25936 int num48 = 4;
25937 if (direction == 1)
25938 {
25939 num48 = -40;
25940 }
25941 int num49 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num48, position.Y + (float)(height / 2) - 15f), 30, 30, 76, 0f, 0f, 50, default(Color), 0.6f);
25942 Main.dust[num49].fadeIn = 1.1f;
25943 Main.dust[num49].noGravity = true;
25944 Main.dust[num49].noLight = true;
25945 Main.dust[num49].velocity *= 0.3f;
25946 Main.dust[num49].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
25947 }
25948 if (wings == 34 && ShouldDrawWingsThatAreAlwaysAnimated() && Main.rand.Next(3) == 0)
25949 {
25950 int num50 = 4;
25951 if (direction == 1)
25952 {
25953 num50 = -40;
25954 }
25955 int num51 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num50, position.Y + (float)(height / 2) - 15f), 30, 30, 261, 0f, 0f, 50, default(Color), 0.6f);
25956 Main.dust[num51].fadeIn = 1.1f;
25957 Main.dust[num51].noGravity = true;
25958 Main.dust[num51].noLight = true;
25959 Main.dust[num51].noLightEmittence = noLightEmittence;
25960 Main.dust[num51].velocity *= 0.3f;
25961 Main.dust[num51].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
25962 }
25963 if (wings == 40)
25964 {
25965 ShouldDrawWingsThatAreAlwaysAnimated();
25966 }
25967 if (wings == 44)
25968 {
25969 ShouldDrawWingsThatAreAlwaysAnimated();
25970 }
25971 if (wings == 9 && Main.rand.Next(3) == 0)
25972 {
25973 int num52 = 8;
25974 if (direction == 1)
25975 {
25976 num52 = -40;
25977 }
25978 int num53 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num52, position.Y + (float)(height / 2) - 15f), 30, 30, 6, 0f, 0f, 200, default(Color), 2f);
25979 Main.dust[num53].noGravity = true;
25980 Main.dust[num53].velocity *= 0.3f;
25981 Main.dust[num53].noLightEmittence = noLightEmittence;
25982 Main.dust[num53].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
25983 }
25984 if (wings == 29 && Main.rand.Next(3) == 0)
25985 {
25986 int num54 = 8;
25987 if (direction == 1)
25988 {
25989 num54 = -40;
25990 }
25991 int num55 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num54, position.Y + (float)(height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default(Color), 2.4f);
25992 Main.dust[num55].noGravity = true;
25993 Main.dust[num55].velocity *= 0.3f;
25994 Main.dust[num55].noLightEmittence = noLightEmittence;
25995 if (Main.rand.Next(10) == 0)
25996 {
25997 Main.dust[num55].fadeIn = 2f;
25998 }
25999 Main.dust[num55].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
26000 }
26001 if (wings == 6)
26002 {
26003 if (Main.rand.Next(10) == 0)
26004 {
26005 int num56 = 4;
26006 if (direction == 1)
26007 {
26008 num56 = -40;
26009 }
26010 int num57 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num56, position.Y + (float)(height / 2) - 12f), 30, 20, 55, 0f, 0f, 200);
26011 Main.dust[num57].noLightEmittence = noLightEmittence;
26012 Main.dust[num57].velocity *= 0.3f;
26013 Main.dust[num57].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
26014 }
26015 }
26016 else if (wings == 5 && Main.rand.Next(6) == 0)
26017 {
26018 int num58 = 6;
26019 if (direction == 1)
26020 {
26021 num58 = -30;
26022 }
26023 int num59 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num58, position.Y), 18, height, 58, 0f, 0f, 255, default(Color), 1.2f);
26024 Main.dust[num59].velocity *= 0.3f;
26025 Main.dust[num59].noLightEmittence = noLightEmittence;
26026 Main.dust[num59].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
26027 }
26028 if (wings == 4)
26029 {
26030 rocketDelay2--;
26031 if (rocketDelay2 <= 0)
26032 {
26034 rocketDelay2 = 60;
26035 }
26036 int type = 6;
26037 float scale = 1.5f;
26038 int alpha = 100;
26039 float x5 = position.X + (float)(width / 2) + 16f;
26040 if (direction > 0)
26041 {
26042 x5 = position.X + (float)(width / 2) - 26f;
26043 }
26044 float num60 = position.Y + (float)height - 18f;
26045 if (Main.rand.Next(2) == 1)
26046 {
26047 x5 = position.X + (float)(width / 2) + 8f;
26048 if (direction > 0)
26049 {
26050 x5 = position.X + (float)(width / 2) - 20f;
26051 }
26052 num60 += 6f;
26053 }
26054 int num61 = Dust.NewDust(new Vector2(x5, num60), 8, 8, type, 0f, 0f, alpha, default(Color), scale);
26055 Main.dust[num61].velocity.X *= 0.3f;
26056 Main.dust[num61].velocity.Y += 10f;
26057 Main.dust[num61].noGravity = true;
26058 Main.dust[num61].noLightEmittence = noLightEmittence;
26059 Main.dust[num61].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
26060 wingFrameCounter++;
26061 if (wingFrameCounter > 4)
26062 {
26063 wingFrame++;
26064 wingFrameCounter = 0;
26065 if (wingFrame >= 3)
26066 {
26067 wingFrame = 0;
26068 }
26069 }
26070 }
26071 else if (wings != 22 && wings != 28)
26072 {
26073 if (wings == 30)
26074 {
26075 wingFrameCounter++;
26076 int num62 = 5;
26077 if (wingFrameCounter >= num62 * 3)
26078 {
26079 wingFrameCounter = 0;
26080 }
26081 wingFrame = 1 + wingFrameCounter / num62;
26082 }
26083 else if (wings == 34)
26084 {
26085 wingFrameCounter++;
26086 int num63 = 7;
26087 if (wingFrameCounter >= num63 * 6)
26088 {
26089 wingFrameCounter = 0;
26090 }
26091 wingFrame = wingFrameCounter / num63;
26092 }
26093 else if (wings != 45)
26094 {
26095 if (wings == 40)
26096 {
26097 wingFrame = 0;
26098 }
26099 else if (wings == 44)
26100 {
26101 wingFrame = 2;
26102 }
26103 else if (wings == 39)
26104 {
26105 wingFrameCounter++;
26106 int num64 = 12;
26107 if (wingFrameCounter >= num64 * 6)
26108 {
26109 wingFrameCounter = 0;
26110 }
26111 wingFrame = wingFrameCounter / num64;
26112 }
26113 else if (wings == 26)
26114 {
26115 int num65 = 6;
26116 if (direction == 1)
26117 {
26118 num65 = -30;
26119 }
26120 int num66 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num65, position.Y), 18, height, 217, 0f, 0f, 100, default(Color), 1.4f);
26121 Main.dust[num66].noGravity = true;
26122 Main.dust[num66].noLight = true;
26123 Main.dust[num66].velocity /= 4f;
26124 Main.dust[num66].velocity -= velocity;
26125 Main.dust[num66].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
26126 if (Main.rand.Next(2) == 0)
26127 {
26128 num65 = -24;
26129 if (direction == 1)
26130 {
26131 num65 = 12;
26132 }
26133 float num67 = position.Y;
26134 if (gravDir == -1f)
26135 {
26136 num67 += (float)(height / 2);
26137 }
26138 num66 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num65, num67), 12, height / 2, 217, 0f, 0f, 100, default(Color), 1.4f);
26139 Main.dust[num66].noGravity = true;
26140 Main.dust[num66].noLight = true;
26141 Main.dust[num66].velocity /= 4f;
26142 Main.dust[num66].velocity -= velocity;
26143 Main.dust[num66].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
26144 }
26145 wingFrame = 2;
26146 }
26147 else if (wings == 37)
26148 {
26149 Color color = Color.Lerp(Color.Black, Color.White, Main.rand.NextFloat());
26150 int num68 = 6;
26151 if (direction == 1)
26152 {
26153 num68 = -30;
26154 }
26155 int num69 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num68, position.Y), 24, height, Utils.SelectRandom<int>(Main.rand, 31, 31, 31), 0f, 0f, 100, default(Color), 0.7f);
26156 Main.dust[num69].noGravity = true;
26157 Main.dust[num69].noLight = true;
26158 Main.dust[num69].velocity /= 4f;
26159 Main.dust[num69].velocity -= velocity;
26160 Main.dust[num69].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
26161 if (Main.dust[num69].type == 55)
26162 {
26163 Main.dust[num69].color = color;
26164 }
26165 if (Main.rand.Next(3) == 0)
26166 {
26167 num68 = -24;
26168 if (direction == 1)
26169 {
26170 num68 = 12;
26171 }
26172 float num70 = position.Y;
26173 if (gravDir == -1f)
26174 {
26175 num70 += (float)(height / 2);
26176 }
26177 num69 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num68, num70), 12, height / 2, Utils.SelectRandom<int>(Main.rand, 31, 31, 31), 0f, 0f, 140, default(Color), 0.7f);
26178 Main.dust[num69].noGravity = true;
26179 Main.dust[num69].noLight = true;
26180 Main.dust[num69].velocity /= 4f;
26181 Main.dust[num69].velocity -= velocity;
26182 Main.dust[num69].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
26183 if (Main.dust[num69].type == 55)
26184 {
26185 Main.dust[num69].color = color;
26186 }
26187 }
26188 wingFrame = 2;
26189 }
26190 else if (wings != 24)
26191 {
26192 if (wings == 43)
26193 {
26194 wingFrame = 1;
26195 }
26196 else if (wings == 12)
26197 {
26198 wingFrame = 3;
26199 }
26200 else
26201 {
26202 wingFrame = 2;
26203 }
26204 }
26205 }
26206 }
26207 }
26208 velocity.Y += gravity / 3f * gravDir;
26209 if (gravDir == 1f)
26210 {
26211 if (velocity.Y > maxFallSpeed / 3f && !TryingToHoverDown)
26212 {
26213 velocity.Y = maxFallSpeed / 3f;
26214 }
26215 }
26216 else if (velocity.Y < (0f - maxFallSpeed) / 3f && !TryingToHoverUp)
26217 {
26218 velocity.Y = (0f - maxFallSpeed) / 3f;
26219 }
26220 }
26221 else if (cartRampTime <= 0)
26222 {
26223 velocity.Y += gravity * gravDir;
26224 }
26225 else
26226 {
26227 cartRampTime--;
26228 }
26229 }
26230 if (!mount.Active || mount.Type != 5)
26231 {
26232 if (gravDir == 1f)
26233 {
26234 if (velocity.Y > maxFallSpeed)
26235 {
26236 velocity.Y = maxFallSpeed;
26237 }
26238 if (slowFall && velocity.Y > maxFallSpeed / 3f && !TryingToHoverDown)
26239 {
26240 velocity.Y = maxFallSpeed / 3f;
26241 }
26242 if (slowFall && velocity.Y > maxFallSpeed / 5f && TryingToHoverUp)
26243 {
26244 velocity.Y = maxFallSpeed / 10f;
26245 }
26246 }
26247 else
26248 {
26249 if (velocity.Y < 0f - maxFallSpeed)
26250 {
26251 velocity.Y = 0f - maxFallSpeed;
26252 }
26253 if (slowFall && velocity.Y < (0f - maxFallSpeed) / 3f && !TryingToHoverDown)
26254 {
26255 velocity.Y = (0f - maxFallSpeed) / 3f;
26256 }
26257 if (slowFall && velocity.Y < (0f - maxFallSpeed) / 5f && TryingToHoverUp)
26258 {
26259 velocity.Y = (0f - maxFallSpeed) / 10f;
26260 }
26261 }
26262 }
26263 }
26264 }
26265 else
26266 {
26267 UpdateControlHolds();
26268 }
26269 if (mount.Active)
26270 {
26271 wingFrame = 0;
26272 }
26273 if ((wingsLogic == 22 || wingsLogic == 28 || wingsLogic == 30 || wingsLogic == 31 || wingsLogic == 33 || wingsLogic == 35 || wingsLogic == 37 || wingsLogic == 45) && TryingToHoverDown && controlJump && wingTime > 0f && !merman)
26274 {
26275 float num71 = 0.9f;
26276 if (wingsLogic == 45)
26277 {
26278 num71 = 0.8f;
26279 }
26280 velocity.Y *= num71;
26281 if (velocity.Y > -2f && velocity.Y < 1f)
26282 {
26283 velocity.Y = 1E-05f;
26284 }
26285 }
26286 if (wingsLogic == 37 && TryingToHoverDown && controlJump && wingTime > 0f && !merman)
26287 {
26288 velocity.Y *= 0.92f;
26289 if (velocity.Y > -2f && velocity.Y < 1f)
26290 {
26291 velocity.Y = 1E-05f;
26292 }
26293 }
26294 GrabItems(i);
26295 LookForTileInteractions();
26296 if (tongued)
26297 {
26298 StopVanityActions();
26299 bool flag23 = false;
26300 if (Main.wofNPCIndex >= 0)
26301 {
26303 float num72 = nPC.Center.X + (float)(nPC.direction * 200);
26304 float y7 = nPC.Center.Y;
26305 Vector2 center = base.Center;
26306 float num73 = num72 - center.X;
26307 float num74 = y7 - center.Y;
26308 float num75 = (float)Math.Sqrt(num73 * num73 + num74 * num74);
26309 float num76 = 11f;
26310 if (Main.expertMode)
26311 {
26312 float value = 22f;
26313 float amount = Math.Min(1f, nPC.velocity.Length() / 5f);
26315 }
26316 float num77 = num75;
26317 if (num75 > num76)
26318 {
26319 num77 = num76 / num75;
26320 }
26321 else
26322 {
26323 num77 = 1f;
26324 flag23 = true;
26325 }
26326 num73 *= num77;
26327 num74 *= num77;
26328 velocity.X = num73;
26329 velocity.Y = num74;
26330 }
26331 else
26332 {
26333 flag23 = true;
26334 }
26335 if (flag23 && Main.myPlayer == whoAmI)
26336 {
26337 for (int num78 = 0; num78 < maxBuffs; num78++)
26338 {
26339 if (buffType[num78] == 38)
26340 {
26341 DelBuff(num78);
26342 }
26343 }
26344 }
26345 }
26346 if (Main.myPlayer == whoAmI)
26347 {
26348 WOFTongue();
26349 if (controlHook)
26350 {
26351 if (releaseHook)
26352 {
26353 QuickGrapple();
26354 }
26355 releaseHook = false;
26356 }
26357 else
26358 {
26359 releaseHook = true;
26360 }
26361 if (talkNPC >= 0)
26362 {
26363 Rectangle rectangle = new Rectangle((int)(position.X + (float)(width / 2) - (float)(tileRangeX * 16)), (int)(position.Y + (float)(height / 2) - (float)(tileRangeY * 16)), tileRangeX * 16 * 2, tileRangeY * 16 * 2);
26364 Rectangle value2 = new Rectangle((int)Main.npc[talkNPC].position.X, (int)Main.npc[talkNPC].position.Y, Main.npc[talkNPC].width, Main.npc[talkNPC].height);
26365 if (!rectangle.Intersects(value2) || chest != -1 || !Main.npc[talkNPC].active || tileEntityAnchor.InUse)
26366 {
26367 if (chest == -1)
26368 {
26370 }
26371 SetTalkNPC(-1);
26372 Main.npcChatCornerItem = 0;
26373 Main.npcChatText = "";
26374 }
26375 }
26376 if (sign >= 0)
26377 {
26378 Rectangle value3 = new Rectangle((int)(position.X + (float)(width / 2) - (float)(tileRangeX * 16)), (int)(position.Y + (float)(height / 2) - (float)(tileRangeY * 16)), tileRangeX * 16 * 2, tileRangeY * 16 * 2);
26379 try
26380 {
26381 bool flag24 = false;
26382 if (Main.sign[sign] == null)
26383 {
26384 flag24 = true;
26385 }
26386 if (!flag24 && !new Rectangle(Main.sign[sign].x * 16, Main.sign[sign].y * 16, 32, 32).Intersects(value3))
26387 {
26388 flag24 = true;
26389 }
26390 if (flag24)
26391 {
26393 sign = -1;
26394 Main.editSign = false;
26395 Main.npcChatText = "";
26396 }
26397 }
26398 catch
26399 {
26401 sign = -1;
26402 Main.editSign = false;
26403 Main.npcChatText = "";
26404 }
26405 }
26406 if (Main.editSign)
26407 {
26408 if (sign == -1)
26409 {
26410 Main.editSign = false;
26411 }
26412 else
26413 {
26415 }
26416 }
26417 else if (Main.editChest)
26418 {
26420 if (Main.player[Main.myPlayer].chest == -1)
26421 {
26422 Main.editChest = false;
26423 }
26424 }
26425 if (mount.Active && mount.Cart && velocity.Length() > 4f)
26426 {
26427 Rectangle rectangle2 = new Rectangle((int)position.X, (int)position.Y, width, height);
26428 if (velocity.X < -1f)
26429 {
26430 rectangle2.X -= 15;
26431 }
26432 if (velocity.X > 1f)
26433 {
26434 rectangle2.Width += 15;
26435 }
26436 if (velocity.X < -10f)
26437 {
26438 rectangle2.X -= 10;
26439 }
26440 if (velocity.X > 10f)
26441 {
26442 rectangle2.Width += 10;
26443 }
26444 if (velocity.Y < -1f)
26445 {
26446 rectangle2.Y -= 10;
26447 }
26448 if (velocity.Y > 1f)
26449 {
26450 rectangle2.Height += 10;
26451 }
26452 for (int num79 = 0; num79 < 200; num79++)
26453 {
26454 if (Main.npc[num79].active && !Main.npc[num79].dontTakeDamage && !Main.npc[num79].friendly && Main.npc[num79].immune[i] == 0 && CanNPCBeHitByPlayerOrPlayerProjectile(Main.npc[num79]) && rectangle2.Intersects(new Rectangle((int)Main.npc[num79].position.X, (int)Main.npc[num79].position.Y, Main.npc[num79].width, Main.npc[num79].height)))
26455 {
26456 float num80 = meleeCrit;
26457 if (num80 < (float)rangedCrit)
26458 {
26459 num80 = rangedCrit;
26460 }
26461 if (num80 < (float)magicCrit)
26462 {
26463 num80 = magicCrit;
26464 }
26465 bool crit = false;
26466 if ((float)Main.rand.Next(1, 101) <= num80)
26467 {
26468 crit = true;
26469 }
26470 float currentSpeed = velocity.Length() / maxRunSpeed;
26471 GetMinecartDamage(currentSpeed, out var damage2, out var knockback);
26472 int num81 = 1;
26473 if (velocity.X < 0f)
26474 {
26475 num81 = -1;
26476 }
26477 if (Main.npc[num79].knockBackResist < 1f && Main.npc[num79].knockBackResist > 0f)
26478 {
26479 knockback /= Main.npc[num79].knockBackResist;
26480 }
26481 if (whoAmI == Main.myPlayer)
26482 {
26483 ApplyDamageToNPC(Main.npc[num79], damage2, knockback, num81, crit);
26484 }
26485 Main.npc[num79].immune[i] = 30;
26486 if (!Main.npc[num79].active)
26487 {
26489 }
26490 }
26491 }
26492 }
26493 Update_NPCCollision();
26494 if (!shimmering)
26495 {
26496 Collision.HurtTile hurtTile = GetHurtTile();
26497 if (hurtTile.type >= 0)
26498 {
26499 ApplyTouchDamage(hurtTile.type, hurtTile.x, hurtTile.y);
26500 }
26501 }
26502 TryToShimmerUnstuck();
26503 }
26504 if (controlRight)
26505 {
26506 releaseRight = false;
26507 }
26508 else
26509 {
26510 releaseRight = true;
26511 rightTimer = 7;
26512 }
26513 if (controlLeft)
26514 {
26515 releaseLeft = false;
26516 }
26517 else
26518 {
26519 releaseLeft = true;
26520 leftTimer = 7;
26521 }
26522 releaseDown = !controlDown;
26523 if (rightTimer > 0)
26524 {
26525 rightTimer--;
26526 }
26527 else if (controlRight)
26528 {
26529 rightTimer = 7;
26530 }
26531 if (leftTimer > 0)
26532 {
26533 leftTimer--;
26534 }
26535 else if (controlLeft)
26536 {
26537 leftTimer = 7;
26538 }
26539 GrappleMovement();
26540 StickyMovement();
26541 CheckDrowning();
26542 if (gravDir == -1f)
26543 {
26544 waterWalk = false;
26545 waterWalk2 = false;
26546 }
26547 int num82 = height;
26548 if (waterWalk)
26549 {
26550 num82 -= 6;
26551 }
26552 bool flag25 = false;
26553 if (!shimmering)
26554 {
26555 flag25 = Collision.LavaCollision(position, width, num82);
26556 }
26557 if (flag25)
26558 {
26559 if (!lavaImmune && Main.myPlayer == i && hurtCooldowns[4] <= 0)
26560 {
26561 if (lavaTime > 0)
26562 {
26563 lavaTime--;
26564 }
26565 else
26566 {
26567 int num83 = 80;
26568 int num84 = 420;
26569 if (Main.remixWorld)
26570 {
26571 num83 = 200;
26572 num84 = 630;
26573 }
26574 if (!ashWoodBonus || !lavaRose)
26575 {
26576 if (ashWoodBonus)
26577 {
26578 if (Main.remixWorld)
26579 {
26580 num83 = 145;
26581 }
26582 num83 /= 2;
26583 num84 -= 210;
26584 }
26585 if (lavaRose)
26586 {
26587 num83 -= 45;
26588 num84 -= 210;
26589 }
26590 if (num83 > 0)
26591 {
26592 Hurt(PlayerDeathReason.ByOther(2), num83, 0, pvp: false, quiet: false, Crit: false, 4);
26593 }
26594 if (num84 > 0)
26595 {
26596 AddBuff(24, num84);
26597 }
26598 }
26599 }
26600 }
26601 lavaWet = true;
26602 }
26603 else
26604 {
26605 lavaWet = false;
26606 if (lavaTime < lavaMax)
26607 {
26608 lavaTime++;
26609 }
26610 }
26611 if (lavaTime > lavaMax)
26612 {
26613 lavaTime = lavaMax;
26614 }
26615 if (waterWalk2 && !waterWalk)
26616 {
26617 num82 -= 6;
26618 }
26619 bool num85 = Collision.WetCollision(position, width, height);
26620 bool flag26 = Collision.honey;
26621 bool shimmer = Collision.shimmer;
26622 if (shimmer)
26623 {
26624 shimmerWet = true;
26625 if (whoAmI == Main.myPlayer && !shimmerImmune && !shimmerUnstuckHelper.ShouldUnstuck)
26626 {
26627 int num86 = (int)(base.Center.X / 16f);
26628 int num87 = (int)((position.Y + 1f) / 16f);
26629 if (Main.tile[num86, num87] != null && Main.tile[num86, num87].shimmer() && Main.tile[num86, num87].liquid >= 0 && position.Y / 16f < (float)Main.UnderworldLayer)
26630 {
26631 AddBuff(353, 60);
26632 }
26633 }
26634 }
26635 if (flag26 && !shimmering)
26636 {
26637 AddBuff(48, 1800);
26638 honeyWet = true;
26639 }
26640 if (num85)
26641 {
26642 if ((onFire || onFire3) && !lavaWet)
26643 {
26644 for (int num88 = 0; num88 < maxBuffs; num88++)
26645 {
26646 int num89 = buffType[num88];
26647 if (num89 == 24 || num89 == 323)
26648 {
26649 DelBuff(num88);
26650 }
26651 }
26652 }
26653 if (!wet)
26654 {
26655 if (wetCount == 0)
26656 {
26657 wetCount = 10;
26658 if (!shimmering)
26659 {
26660 if (!flag25)
26661 {
26662 if (shimmerWet)
26663 {
26664 for (int num90 = 0; num90 < 50; num90++)
26665 {
26666 int num91 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2)), width + 12, 24, 308);
26667 Main.dust[num91].velocity.Y -= 4f;
26668 Main.dust[num91].velocity.X *= 2.5f;
26669 Main.dust[num91].scale = 0.8f;
26670 Main.dust[num91].noGravity = true;
26671 switch (Main.rand.Next(6))
26672 {
26673 case 0:
26674 Main.dust[num91].color = new Color(255, 255, 210);
26675 break;
26676 case 1:
26677 Main.dust[num91].color = new Color(190, 245, 255);
26678 break;
26679 case 2:
26680 Main.dust[num91].color = new Color(255, 150, 255);
26681 break;
26682 default:
26683 Main.dust[num91].color = new Color(190, 175, 255);
26684 break;
26685 }
26686 }
26687 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 2);
26688 }
26689 else if (honeyWet)
26690 {
26691 for (int num92 = 0; num92 < 20; num92++)
26692 {
26693 int num93 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 152);
26694 Main.dust[num93].velocity.Y -= 1f;
26695 Main.dust[num93].velocity.X *= 2.5f;
26696 Main.dust[num93].scale = 1.3f;
26697 Main.dust[num93].alpha = 100;
26698 Main.dust[num93].noGravity = true;
26699 }
26700 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
26701 }
26702 else
26703 {
26704 for (int num94 = 0; num94 < 50; num94++)
26705 {
26706 int num95 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, Dust.dustWater());
26707 Main.dust[num95].velocity.Y -= 3f;
26708 Main.dust[num95].velocity.X *= 2.5f;
26709 Main.dust[num95].scale = 0.8f;
26710 Main.dust[num95].alpha = 100;
26711 Main.dust[num95].noGravity = true;
26712 }
26713 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 0);
26714 }
26715 }
26716 else
26717 {
26718 for (int num96 = 0; num96 < 20; num96++)
26719 {
26720 int num97 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 35);
26721 Main.dust[num97].velocity.Y -= 1.5f;
26722 Main.dust[num97].velocity.X *= 2.5f;
26723 Main.dust[num97].scale = 1.3f;
26724 Main.dust[num97].alpha = 100;
26725 Main.dust[num97].noGravity = true;
26726 }
26727 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
26728 }
26729 }
26730 }
26731 wet = true;
26732 if (ShouldFloatInWater)
26733 {
26734 velocity.Y /= 2f;
26735 if (velocity.Y > 3f)
26736 {
26737 velocity.Y = 3f;
26738 }
26739 }
26740 }
26741 }
26742 else if (wet)
26743 {
26744 wet = false;
26745 if (jump > jumpHeight / 5 && wetSlime == 0)
26746 {
26747 jump = jumpHeight / 5;
26748 }
26749 if (wetCount == 0)
26750 {
26751 wetCount = 10;
26752 if (!shimmering)
26753 {
26754 if (!lavaWet)
26755 {
26756 if (shimmerWet)
26757 {
26758 for (int num98 = 0; num98 < 50; num98++)
26759 {
26760 int num99 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2)), width + 12, 24, 308);
26761 Main.dust[num99].velocity.Y -= 4f;
26762 Main.dust[num99].velocity.X *= 2.5f;
26763 Main.dust[num99].scale = 0.75f;
26764 Main.dust[num99].noGravity = true;
26765 switch (Main.rand.Next(6))
26766 {
26767 case 0:
26768 Main.dust[num99].color = new Color(255, 255, 210);
26769 break;
26770 case 1:
26771 Main.dust[num99].color = new Color(190, 245, 255);
26772 break;
26773 case 2:
26774 Main.dust[num99].color = new Color(255, 150, 255);
26775 break;
26776 default:
26777 Main.dust[num99].color = new Color(190, 175, 255);
26778 break;
26779 }
26780 }
26781 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 3);
26782 }
26783 else if (honeyWet)
26784 {
26785 for (int num100 = 0; num100 < 20; num100++)
26786 {
26787 int num101 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 152);
26788 Main.dust[num101].velocity.Y -= 1f;
26789 Main.dust[num101].velocity.X *= 2.5f;
26790 Main.dust[num101].scale = 1.3f;
26791 Main.dust[num101].alpha = 100;
26792 Main.dust[num101].noGravity = true;
26793 }
26794 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
26795 }
26796 else
26797 {
26798 for (int num102 = 0; num102 < 50; num102++)
26799 {
26800 int num103 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2)), width + 12, 24, Dust.dustWater());
26801 Main.dust[num103].velocity.Y -= 4f;
26802 Main.dust[num103].velocity.X *= 2.5f;
26803 Main.dust[num103].scale = 0.8f;
26804 Main.dust[num103].alpha = 100;
26805 Main.dust[num103].noGravity = true;
26806 }
26807 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 0);
26808 }
26809 }
26810 else
26811 {
26812 for (int num104 = 0; num104 < 20; num104++)
26813 {
26814 int num105 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 35);
26815 Main.dust[num105].velocity.Y -= 1.5f;
26816 Main.dust[num105].velocity.X *= 2.5f;
26817 Main.dust[num105].scale = 1.3f;
26818 Main.dust[num105].alpha = 100;
26819 Main.dust[num105].noGravity = true;
26820 }
26821 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
26822 }
26823 }
26824 }
26825 }
26826 if (!flag26)
26827 {
26828 honeyWet = false;
26829 }
26830 if (!shimmer)
26831 {
26832 shimmerWet = false;
26833 }
26834 if (!wet)
26835 {
26836 lavaWet = false;
26837 honeyWet = false;
26838 shimmerWet = false;
26839 }
26840 if (wetCount > 0)
26841 {
26842 wetCount--;
26843 }
26844 if (wetSlime > 0)
26845 {
26846 wetSlime--;
26847 }
26848 if (wet && mount.Active)
26849 {
26850 switch (mount.Type)
26851 {
26852 case 5:
26853 case 7:
26854 if (whoAmI == Main.myPlayer)
26855 {
26856 mount.Dismount(this);
26857 }
26858 break;
26859 case 3:
26860 case 50:
26861 wetSlime = 30;
26862 if (velocity.Y > 2f)
26863 {
26864 velocity.Y *= 0.9f;
26865 }
26866 velocity.Y -= 0.5f;
26867 if (velocity.Y < -4f)
26868 {
26869 velocity.Y = -4f;
26870 }
26871 break;
26872 }
26873 }
26874 if (Main.expertMode && ZoneSnow && wet && !lavaWet && !honeyWet && !arcticDivingGear && environmentBuffImmunityTimer == 0)
26875 {
26876 AddBuff(46, 150);
26877 }
26878 float num106 = 1f + Math.Abs(velocity.X) / 3f;
26879 if (gfxOffY > 0f)
26880 {
26881 gfxOffY -= num106 * stepSpeed;
26882 if (gfxOffY < 0f)
26883 {
26884 gfxOffY = 0f;
26885 }
26886 }
26887 else if (gfxOffY < 0f)
26888 {
26889 gfxOffY += num106 * stepSpeed;
26890 if (gfxOffY > 0f)
26891 {
26892 gfxOffY = 0f;
26893 }
26894 }
26895 if (gfxOffY > 32f)
26896 {
26897 gfxOffY = 32f;
26898 }
26899 if (gfxOffY < -32f)
26900 {
26901 gfxOffY = -32f;
26902 }
26903 if (Main.myPlayer == i)
26904 {
26905 if (!iceSkate)
26906 {
26907 CheckIceBreak();
26908 }
26909 CheckCrackedBrickBreak();
26910 }
26911 if (!shimmering)
26912 {
26913 SlopeDownMovement();
26914 bool flag27 = mount.Type == 7 || mount.Type == 8 || mount.Type == 12 || mount.Type == 44 || mount.Type == 49;
26915 if (velocity.Y == gravity && (!mount.Active || (!mount.Cart && mount.Type != 48 && !flag27)))
26916 {
26917 Collision.StepDown(ref position, ref velocity, width, height, ref stepSpeed, ref gfxOffY, (int)gravDir, waterWalk || waterWalk2);
26918 }
26919 if (gravDir == -1f)
26920 {
26921 if ((carpetFrame != -1 || velocity.Y <= gravity) && !controlUp)
26922 {
26923 Collision.StepUp(ref position, ref velocity, width, height, ref stepSpeed, ref gfxOffY, (int)gravDir, controlUp);
26924 }
26925 }
26926 else if ((carpetFrame != -1 || velocity.Y >= gravity) && !controlDown && !mount.Cart && !flag27 && grappling[0] == -1)
26927 {
26928 Collision.StepUp(ref position, ref velocity, width, height, ref stepSpeed, ref gfxOffY, (int)gravDir, controlUp);
26929 }
26930 }
26931 oldPosition = position;
26932 oldDirection = direction;
26933 bool falling = false;
26934 if (velocity.Y > gravity)
26935 {
26936 falling = true;
26937 }
26938 if (velocity.Y < 0f - gravity)
26939 {
26940 falling = true;
26941 }
26942 Vector2 vector3 = velocity;
26943 slideDir = 0;
26944 bool ignorePlats = false;
26945 bool fallThrough = controlDown;
26946 if ((gravDir == -1f) | (mount.Active && (mount.Cart || mount.Type == 12 || mount.Type == 7 || mount.Type == 8 || mount.Type == 23 || mount.Type == 44 || mount.Type == 48)) | GoingDownWithGrapple | pulley)
26947 {
26948 ignorePlats = true;
26949 fallThrough = true;
26950 }
26951 bool flag28 = onTrack;
26952 onTrack = false;
26953 bool flag29 = false;
26954 if (mount.Active && mount.Cart)
26955 {
26956 fartKartCloudDelay = Math.Max(0, fartKartCloudDelay - 1);
26957 float num107 = ((ignoreWater || merman) ? 1f : (shimmerWet ? 0.25f : (honeyWet ? 0.25f : ((!wet) ? 1f : 0.5f))));
26958 velocity *= num107;
26959 DelegateMethods.Minecart.rotation = fullRotation;
26960 DelegateMethods.Minecart.rotationOrigin = fullRotationOrigin;
26961 BitsByte bitsByte = Minecart.TrackCollision(this, ref position, ref velocity, ref lastBoost, width, height, controlDown, controlUp, fallStart2, trackOnly: false, mount.Delegations);
26962 if (bitsByte[0])
26963 {
26964 onTrack = true;
26965 gfxOffY = Minecart.TrackRotation(this, ref fullRotation, position + velocity, width, height, controlDown, controlUp, mount.Delegations);
26966 fullRotationOrigin = new Vector2(width / 2, height);
26967 }
26968 if (flag28 && !onTrack)
26969 {
26970 mount.Delegations.MinecartJumpingSound(this, position, width, height);
26971 }
26972 if (bitsByte[1])
26973 {
26974 if (controlLeft || controlRight)
26975 {
26976 if (cartFlip)
26977 {
26978 cartFlip = false;
26979 }
26980 else
26981 {
26982 cartFlip = true;
26983 }
26984 }
26985 if (velocity.X > 0f)
26986 {
26987 direction = 1;
26988 }
26989 else if (velocity.X < 0f)
26990 {
26991 direction = -1;
26992 }
26993 mount.Delegations.MinecartBumperSound(this, position, width, height);
26994 }
26995 velocity /= num107;
26996 if (bitsByte[3] && whoAmI == Main.myPlayer)
26997 {
26998 flag29 = true;
26999 }
27000 if (bitsByte[2])
27001 {
27002 cartRampTime = (int)(Math.Abs(velocity.X) / mount.RunSpeed * 20f);
27003 }
27004 if (bitsByte[4])
27005 {
27006 trackBoost -= 4f;
27007 }
27008 if (bitsByte[5])
27009 {
27010 trackBoost += 4f;
27011 }
27012 }
27013 bool flag30 = whoAmI == Main.myPlayer && !mount.Active;
27014 Vector2 vector4 = position;
27015 if (vortexDebuff)
27016 {
27017 velocity.Y = velocity.Y * 0.8f + (float)Math.Cos(base.Center.X % 120f / 120f * ((float)Math.PI * 2f)) * 5f * 0.2f;
27018 }
27019 if (tongued)
27020 {
27021 position += velocity;
27022 flag30 = false;
27023 }
27024 else if (shimmerWet || shimmering)
27025 {
27026 ShimmerCollision(fallThrough, ignorePlats, shimmering);
27027 }
27028 else if (honeyWet && !ignoreWater)
27029 {
27030 HoneyCollision(fallThrough, ignorePlats);
27031 }
27032 else if (wet && !merman && !ignoreWater && !trident)
27033 {
27034 WaterCollision(fallThrough, ignorePlats);
27035 }
27036 else
27037 {
27038 DryCollision(fallThrough, ignorePlats);
27039 if (mount.Active && mount.IsConsideredASlimeMount && velocity.Y != 0f && !SlimeDontHyperJump)
27040 {
27041 Vector2 vector5 = velocity;
27042 velocity.X = 0f;
27043 DryCollision(fallThrough, ignorePlats);
27044 velocity.X = vector5.X;
27045 }
27046 if (mount.Active && mount.Type == 43 && velocity.Y != 0f)
27047 {
27048 Vector2 vector6 = velocity;
27049 velocity.X = 0f;
27050 DryCollision(fallThrough, ignorePlats);
27051 velocity.X = vector6.X;
27052 }
27053 }
27054 UpdateTouchingTiles();
27055 TryBouncingBlocks(falling);
27056 TryLandingOnDetonator();
27057 if (!shimmering && !tongued)
27058 {
27059 SlopingCollision(fallThrough, ignorePlats);
27060 if (!isLockedToATile)
27061 {
27062 Collision.StepConveyorBelt(this, gravDir);
27063 }
27064 }
27065 if (flag30 && velocity.Y == 0f)
27066 {
27068 }
27069 if (flag29)
27070 {
27071 NetMessage.SendData(13, -1, -1, null, whoAmI);
27072 Minecart.HitTrackSwitch(new Vector2(position.X, position.Y), width, height);
27073 }
27074 if (vector3.X != velocity.X)
27075 {
27076 if (vector3.X < 0f)
27077 {
27078 slideDir = -1;
27079 }
27080 else if (vector3.X > 0f)
27081 {
27082 slideDir = 1;
27083 }
27084 }
27085 if (gravDir == 1f && Collision.up)
27086 {
27087 velocity.Y = 0.01f;
27088 if (!merman)
27089 {
27090 jump = 0;
27091 }
27092 }
27093 else if (gravDir == -1f && Collision.down)
27094 {
27095 velocity.Y = -0.01f;
27096 if (!merman)
27097 {
27098 jump = 0;
27099 }
27100 }
27101 if (velocity.Y == 0f && grappling[0] == -1)
27102 {
27103 FloorVisuals(falling);
27104 }
27105 if (whoAmI == Main.myPlayer && !shimmering)
27106 {
27107 Collision.SwitchTiles(position, width, height, oldPosition, 1);
27108 }
27110 BordersMovement();
27111 numMinions = 0;
27112 slotsMinions = 0f;
27113 if (Main.netMode != 2 && mount.Type != 8)
27114 {
27115 ItemCheck_ManageRightClickFeatures();
27116 }
27117 ItemCheckWrapped(i);
27118 PlayerFrame();
27119 if (mount.Type == 8)
27120 {
27121 mount.UseDrill(this);
27122 }
27123 if (statLife > statLifeMax2)
27124 {
27125 statLife = statLifeMax2;
27126 }
27127 if (statMana > statManaMax2)
27128 {
27129 statMana = statManaMax2;
27130 }
27131 grappling[0] = -1;
27132 grapCount = 0;
27133 UpdateReleaseUseTile();
27134 UpdateAdvancedShadows();
27135 }
27136
27138 {
27140 {
27141 if (controlSmart && releaseSmart)
27142 {
27145 }
27146 return;
27147 }
27148 if (controlSmart && releaseSmart)
27149 {
27151 }
27153 {
27154 smartCursorWanted = controlSmart;
27155 }
27156 else if (smartCursorWanted)
27157 {
27158 if (!controlSmart && !controlUseItem)
27159 {
27160 smartCursorWanted = false;
27161 }
27162 }
27163 else
27164 {
27165 smartCursorWanted = controlSmart;
27166 }
27167 }
27168
27169 private void TryToShimmerUnstuck()
27170 {
27171 timeShimmering = Utils.Clamp(timeShimmering + (shimmering ? 1 : (-10)), 0, 7200);
27172 bool flag = timeShimmering >= 3600;
27173 if ((LocalInputCache.controlLeft || LocalInputCache.controlRight || LocalInputCache.controlUp || LocalInputCache.controlDown) && timeShimmering >= 1200)
27174 {
27175 flag = true;
27176 }
27177 if (flag)
27178 {
27179 ShimmerUnstuck();
27180 }
27181 }
27182
27183 private void ShimmerUnstuck()
27184 {
27185 timeShimmering = 0;
27186 Vector2? vector = TryFindingShimmerFreeSpot();
27187 if (vector.HasValue)
27188 {
27189 velocity = new Vector2(0f, 0.0001f);
27190 Teleport(vector.Value + new Vector2(0f, -2f), 12);
27191 shimmering = false;
27192 shimmerWet = false;
27193 wet = false;
27194 ClearBuff(353);
27196 {
27197 PositionInWorld = base.Bottom
27198 });
27199 }
27200 else
27201 {
27202 if (Collision.WetCollision(position, width, height) && Collision.shimmer)
27203 {
27204 shimmerUnstuckHelper.StartUnstuck();
27205 }
27206 ClearBuff(353);
27208 {
27209 PositionInWorld = base.Bottom
27210 });
27211 }
27212 }
27213
27215 {
27216 Point point = base.Top.ToTileCoordinates();
27217 int num = 60;
27218 Vector2? result = null;
27219 bool allowSolidTop = true;
27220 for (int i = 1; i < num; i += 2)
27221 {
27223 if (vector.HasValue)
27224 {
27225 result = vector.Value;
27226 break;
27227 }
27228 }
27229 FindSpawn();
27230 if (!CheckSpawn(SpawnX, SpawnY))
27231 {
27232 SpawnX = -1;
27233 SpawnY = -1;
27234 }
27235 if (!result.HasValue && SpawnX != -1 && SpawnY != -1)
27236 {
27237 for (int j = 1; j < num; j += 2)
27238 {
27240 if (vector2.HasValue)
27241 {
27242 result = vector2.Value;
27243 break;
27244 }
27245 }
27246 }
27247 if (!result.HasValue)
27248 {
27249 for (int k = 1; k < num; k += 2)
27250 {
27252 if (vector3.HasValue)
27253 {
27254 result = vector3.Value;
27255 break;
27256 }
27257 }
27258 }
27259 return result;
27260 }
27261
27263 {
27264 if (whoAmI == Main.myPlayer)
27265 {
27266 int num = FindBuffIndex(21);
27267 if (num != -1)
27268 {
27269 float num2 = buffTime[num];
27270 float philosopherStoneDurationMultiplier = PhilosopherStoneDurationMultiplier;
27272 buffTime[num] = (int)num2;
27273 }
27274 }
27275 }
27276
27278 {
27279 Collision.HurtTile result = Collision.HurtTiles(position, width, (!mount.Active || !mount.Cart) ? height : (height - 16), this);
27280 if (result.type >= 0)
27281 {
27282 return result;
27283 }
27284 foreach (Point touchedTile in TouchedTiles)
27285 {
27286 Tile tile = Main.tile[touchedTile.X, touchedTile.Y];
27287 if (tile != null && tile.active() && tile.nactive() && !TileID.Sets.Suffocate[tile.type] && Collision.CanTileHurt(tile.type, touchedTile.X, touchedTile.Y, this))
27288 {
27290 result2.type = tile.type;
27291 result2.x = touchedTile.X;
27292 result2.y = touchedTile.Y;
27293 return result2;
27294 }
27295 }
27296 return result;
27297 }
27298
27299 private void ApplyTouchDamage(int tileId, int x, int y)
27300 {
27302 {
27303 AddBuff(67, 20);
27304 }
27306 {
27307 if (suffocateDelay < 5)
27308 {
27309 suffocateDelay++;
27310 }
27311 else
27312 {
27313 AddBuff(68, 1);
27314 }
27315 }
27316 else
27317 {
27318 suffocateDelay = 0;
27319 }
27321 {
27322 AddBuff(30, Main.rand.Next(240, 600));
27323 }
27325 if (num > 0)
27326 {
27327 num = Main.DamageVar(num, 0f - luck);
27328 Hurt(PlayerDeathReason.ByOther(3), num, 0, pvp: false, quiet: false, Crit: false, 0);
27329 }
27331 {
27332 WorldGen.KillTile(x, y);
27333 if (Main.netMode == 1 && !Main.tile[x, y].active())
27334 {
27335 NetMessage.SendData(17, -1, -1, null, 4, x, y);
27336 }
27337 }
27338 }
27339
27340 private void CapAttackSpeeds()
27341 {
27342 float num = meleeSpeed;
27343 meleeSpeed = TurnAttackSpeedToUseTimeMultiplier(num);
27344 summonerWeaponSpeedBonus = TurnAttackSpeedToUseTimeMultiplier(num + summonerWeaponSpeedBonus);
27345 }
27346
27348 {
27349 if (speed > 3f)
27350 {
27351 speed = 3f;
27352 }
27353 if (speed != 0f)
27354 {
27355 speed = 1f / speed;
27356 }
27357 return speed;
27358 }
27359
27360 public void UpdateLuck()
27361 {
27362 UpdateLuckFactors();
27363 RecalculateLuck();
27364 if (luckNeedsSync && whoAmI == Main.myPlayer)
27365 {
27366 luckNeedsSync = false;
27367 NetMessage.SendData(134, -1, -1, null, whoAmI);
27368 }
27369 }
27370
27371 private void ResetControls()
27372 {
27373 controlUp = false;
27374 controlLeft = false;
27375 controlDown = false;
27376 controlRight = false;
27377 controlJump = false;
27378 controlUseItem = false;
27379 controlUseTile = false;
27380 controlThrow = false;
27381 controlInv = false;
27382 controlHook = false;
27383 controlTorch = false;
27384 controlSmart = false;
27385 controlMount = false;
27386 controlQuickHeal = false;
27387 controlQuickMana = false;
27388 controlCreativeMenu = false;
27389 mapStyle = false;
27390 mapAlphaDown = false;
27391 mapAlphaUp = false;
27392 mapFullScreen = false;
27393 mapZoomIn = false;
27394 mapZoomOut = false;
27395 }
27396
27397 private void UpdateControlHolds()
27398 {
27399 if (whoAmI == Main.myPlayer)
27400 {
27401 if (controlUp && releaseUp)
27402 {
27403 FlexibleWandCycleOffset--;
27404 }
27405 if (controlDown && releaseDown)
27406 {
27407 FlexibleWandCycleOffset++;
27408 }
27409 }
27410 if (controlUp)
27411 {
27412 releaseUp = false;
27413 }
27414 else
27415 {
27416 releaseUp = true;
27417 }
27418 }
27419
27421 {
27422 if (Main.mapEnabled)
27423 {
27424 Main.playerInventory = false;
27425 sign = -1;
27426 Main.editSign = false;
27427 SetTalkNPC(-1);
27428 Main.npcChatCornerItem = 0;
27430 Main.mapFullscreenScale = 2.5f;
27431 Main.mapFullscreen = true;
27432 Main.resetMapFull = true;
27433 Main.buffString = string.Empty;
27434 releaseInventory = false;
27435 }
27436 }
27437
27438 public void UpdateLuckFactors()
27439 {
27440 UpdateLadyBugLuckTime();
27441 UpdateCoinLuck();
27442 if (whoAmI == Main.myPlayer)
27443 {
27444 float num = torchLuck;
27445 TryRecalculatingTorchLuck();
27446 if (torchLuck != num)
27447 {
27448 luckNeedsSync = true;
27449 }
27450 }
27451 }
27452
27453 public void RecalculateLuck()
27454 {
27455 luck = GetLadyBugLuck() * 0.2f + torchLuck * 0.2f;
27456 luck += (float)(int)luckPotion * 0.1f;
27457 if (usedGalaxyPearl)
27458 {
27459 luck += 0.03f;
27460 }
27462 {
27463 luck += 0.3f;
27464 }
27465 if (HasGardenGnomeNearby)
27466 {
27467 luck += 0.2f;
27468 }
27469 luck += equipmentBasedLuckBonus;
27470 luck += CalculateCoinLuck();
27471 }
27472
27473 public static int GetMouseScrollDelta()
27474 {
27475 return PlayerInput.ScrollWheelDelta / 120;
27476 }
27477
27479 {
27480 bool flag = portableStoolInfo.HasAStool && controlUp && !gravControl && !mount.Active && velocity.X == 0f && velocity.Y == 0f && !pulley && grappling[0] == -1;
27481 if (flag)
27482 {
27483 flag = CanFitSpace(portableStoolInfo.HeightBoost);
27484 }
27485 if (flag)
27486 {
27487 portableStoolInfo.IsInUse = true;
27488 ResizeHitbox();
27489 }
27490 }
27491
27492 private void ResizeHitbox()
27493 {
27494 position.Y += height;
27495 height = 42 + HeightOffsetBoost;
27496 position.Y -= height;
27497 }
27498
27500 {
27501 bool flag = !tileInteractAttempted;
27502 if (_lockTileInteractionsTimer > 0 && !releaseUseTile)
27503 {
27504 flag = false;
27505 }
27506 releaseUseTile = flag;
27507 if (_lockTileInteractionsTimer > 0)
27508 {
27509 _lockTileInteractionsTimer--;
27510 }
27511 }
27512
27513 private void GetMinecartDamage(float currentSpeed, out int damage, out float knockback)
27514 {
27515 switch (mount.Type)
27516 {
27517 default:
27518 damage = Main.DamageVar(25f + 55f * currentSpeed, luck);
27519 break;
27520 case 11:
27521 case 15:
27522 case 16:
27523 case 18:
27524 case 19:
27525 case 20:
27526 case 21:
27527 case 22:
27528 case 24:
27529 case 25:
27530 case 26:
27531 case 27:
27532 case 28:
27533 case 29:
27534 case 30:
27535 case 31:
27536 case 32:
27537 case 33:
27538 case 34:
27539 case 35:
27540 case 36:
27541 case 38:
27542 case 39:
27543 case 51:
27544 case 53:
27545 damage = Main.DamageVar(25f + 55f * currentSpeed, luck);
27546 break;
27547 case 13:
27548 damage = Main.DamageVar(15f + 30f * currentSpeed, luck);
27549 break;
27550 }
27551 if (UsingSuperCart)
27552 {
27553 damage = Main.DamageVar(50f + 100f * currentSpeed, luck);
27554 }
27555 knockback = 10f + 40f * currentSpeed;
27556 if (Main.hardMode)
27557 {
27558 damage = (int)((double)damage * 1.5);
27559 }
27560 if (Main.expertMode)
27561 {
27562 damage = (int)((double)damage * 1.5);
27563 }
27564 }
27565
27566 public void UpdateMiscCounter()
27567 {
27568 miscCounter++;
27569 if (miscCounter >= 300)
27570 {
27571 miscCounter = 0;
27572 }
27573 }
27574
27575 private void WingAirLogicTweaks()
27576 {
27577 if (wingsLogic < 1)
27578 {
27579 return;
27580 }
27581 WingStats wingStats = GetWingStats(wingsLogic);
27582 bool flag = TryingToHoverDown && controlJump && wingTime > 0f;
27583 if (wingStats.HasDownHoverStats && flag)
27584 {
27585 if (wingStats.DownHoverSpeedOverride != -1f)
27586 {
27587 accRunSpeed = wingStats.DownHoverSpeedOverride;
27588 }
27589 runAcceleration *= wingStats.DownHoverAccelerationMult;
27590 }
27591 else
27592 {
27593 if (wingStats.AccRunSpeedOverride != -1f && wingStats.AccRunSpeedOverride > accRunSpeed)
27594 {
27595 accRunSpeed = wingStats.AccRunSpeedOverride;
27596 }
27597 runAcceleration *= wingStats.AccRunAccelerationMult;
27598 }
27599 if (wingsLogic == 45 && (float)timeSinceLastDashStarted >= 60f)
27600 {
27601 runSlowdown *= 6f;
27602 }
27603 }
27604
27605 private void RocketBootVisuals()
27606 {
27607 int num = height;
27608 if (gravDir == -1f)
27609 {
27610 num = 4;
27611 }
27612 for (int i = 0; i < 2; i++)
27613 {
27614 int num2 = ((i == 0) ? 2 : (-2));
27615 Rectangle r = ((i != 0) ? new Rectangle((int)position.X + width - 4, (int)position.Y + num - 10, 8, 8) : new Rectangle((int)position.X - 4, (int)position.Y + num - 10, 8, 8));
27616 if (direction == -1)
27617 {
27618 r.X -= 4;
27619 }
27620 int type = 6;
27621 float scale = 2.5f;
27622 int alpha = 100;
27623 float num3 = 1f;
27624 Vector2 vector = new Vector2((float)(-num2) - velocity.X * 0.3f, 2f * gravDir - velocity.Y * 0.3f);
27625 Dust dust;
27626 switch (vanityRocketBoots)
27627 {
27628 case 5:
27629 type = 6;
27630 scale = 2.5f;
27631 break;
27632 case 1:
27633 if (socialShadowRocketBoots)
27634 {
27635 type = 27;
27636 scale = 1.5f;
27637 }
27638 break;
27639 case 3:
27640 type = 76;
27641 scale = 1f;
27642 alpha = 20;
27643 break;
27644 case 2:
27645 if (fairyBoots)
27646 {
27647 type = Main.rand.NextFromList(new short[6] { 61, 61, 61, 242, 64, 63 });
27648 scale = 2f;
27649 alpha = 120;
27650 }
27651 else
27652 {
27653 type = 16;
27654 scale = 1.5f;
27655 alpha = 20;
27656 }
27657 break;
27658 case 4:
27659 {
27660 int num4 = Main.rand.Next(6);
27661 r.Y += 2 * (int)gravDir;
27662 if (num4 == 0 || num4 == 1)
27663 {
27664 dust = Dust.NewDustDirect(r.TopLeft(), r.Width, r.Height, 278, 0f, 0f, 100, Color.Lerp(Color.LimeGreen, Color.White, Main.rand.NextFloat() * 0.3f));
27665 dust.shader = GameShaders.Armor.GetSecondaryShader(cShoe, this);
27666 dust.scale = 0.66f;
27667 dust.noGravity = true;
27668 dust.velocity *= 0.25f;
27669 dust.velocity -= velocity * 0.5f;
27670 dust.velocity += vector * 0.5f;
27671 dust.position += dust.velocity * 4f;
27672 if (Main.rand.Next(5) == 0)
27673 {
27674 dust.fadeIn = 0.8f;
27675 }
27676 continue;
27677 }
27678 type = 107;
27679 alpha = 100;
27680 scale = 0.7f;
27681 num3 = 0.5f;
27682 break;
27683 }
27684 }
27685 dust = Dust.NewDustDirect(r.TopLeft(), r.Width, r.Height, type, 0f, 0f, alpha, default(Color), scale);
27686 dust.shader = GameShaders.Armor.GetSecondaryShader(cShoe, this);
27687 dust.velocity += vector;
27688 dust.velocity *= num3;
27689 switch (vanityRocketBoots)
27690 {
27691 case 5:
27692 dust.noGravity = true;
27693 break;
27694 case 1:
27695 dust.noGravity = true;
27696 break;
27697 case 2:
27698 dust.velocity *= 0.1f;
27699 break;
27700 case 3:
27701 dust.velocity *= 0.05f;
27702 dust.velocity.Y += 0.15f;
27703 dust.noLight = true;
27704 if (Main.rand.Next(2) == 0)
27705 {
27706 dust.noGravity = true;
27707 dust.scale = 1.75f;
27708 }
27709 break;
27710 }
27711 if (fairyBoots)
27712 {
27713 dust.noGravity = true;
27714 dust.noLightEmittence = true;
27715 }
27716 }
27717 }
27718
27719 public void WingFrame(bool wingFlap)
27720 {
27721 bool flag = wingsLogic != wings;
27722 if (wings == 4)
27723 {
27724 if (wingFlap || jump > 0)
27725 {
27726 rocketDelay2--;
27727 if (rocketDelay2 <= 0)
27728 {
27730 rocketDelay2 = 60;
27731 }
27732 int num = 2;
27733 if (TryingToHoverUp)
27734 {
27735 num = 4;
27736 }
27737 for (int i = 0; i < num; i++)
27738 {
27739 int type = 6;
27740 if (head == 41)
27741 {
27742 _ = body;
27743 _ = 24;
27744 }
27745 float scale = 1.75f;
27746 int alpha = 100;
27747 float x = position.X + (float)(width / 2) + 16f;
27748 if (direction > 0)
27749 {
27750 x = position.X + (float)(width / 2) - 26f;
27751 }
27752 float num2 = position.Y + (float)height - 18f;
27753 if (i == 1 || i == 3)
27754 {
27755 x = position.X + (float)(width / 2) + 8f;
27756 if (direction > 0)
27757 {
27758 x = position.X + (float)(width / 2) - 20f;
27759 }
27760 num2 += 6f;
27761 }
27762 if (i > 1)
27763 {
27764 num2 += velocity.Y;
27765 }
27766 int num3 = Dust.NewDust(new Vector2(x, num2), 8, 8, type, 0f, 0f, alpha, default(Color), scale);
27767 Main.dust[num3].velocity.X *= 0.1f;
27768 Main.dust[num3].velocity.Y = Main.dust[num3].velocity.Y * 1f + 2f * gravDir - velocity.Y * 0.3f;
27769 Main.dust[num3].noGravity = true;
27770 Main.dust[num3].noLightEmittence = flag;
27771 Main.dust[num3].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
27772 if (num == 4)
27773 {
27774 Main.dust[num3].velocity.Y += 6f;
27775 }
27776 }
27777 wingFrameCounter++;
27778 if (wingFrameCounter > 4)
27779 {
27780 wingFrame++;
27781 wingFrameCounter = 0;
27782 if (wingFrame >= 3)
27783 {
27784 wingFrame = 0;
27785 }
27786 }
27787 }
27788 else if (!controlJump || velocity.Y == 0f)
27789 {
27790 wingFrame = 3;
27791 }
27792 return;
27793 }
27794 if (wings == 28 && ShouldDrawWingsThatAreAlwaysAnimated())
27795 {
27796 if (!flag && velocity.Y != 0f)
27797 {
27798 Lighting.AddLight(base.Bottom, 0.3f, 0.1f, 0.4f);
27799 }
27800 return;
27801 }
27802 if (wings == 22)
27803 {
27804 if (!controlJump)
27805 {
27806 wingFrame = 0;
27807 wingFrameCounter = 0;
27808 }
27809 else if (wingTime > 0f)
27810 {
27811 if (TryingToHoverDown)
27812 {
27813 if (velocity.X != 0f)
27814 {
27815 wingFrameCounter++;
27816 int num4 = 2;
27817 if (wingFrameCounter < num4)
27818 {
27819 wingFrame = 1;
27820 return;
27821 }
27822 if (wingFrameCounter < num4 * 2)
27823 {
27824 wingFrame = 2;
27825 return;
27826 }
27827 if (wingFrameCounter < num4 * 3)
27828 {
27829 wingFrame = 3;
27830 return;
27831 }
27832 if (wingFrameCounter < num4 * 4 - 1)
27833 {
27834 wingFrame = 2;
27835 return;
27836 }
27837 wingFrame = 2;
27838 wingFrameCounter = 0;
27839 }
27840 else
27841 {
27842 wingFrameCounter++;
27843 int num5 = 6;
27844 if (wingFrameCounter < num5)
27845 {
27846 wingFrame = 4;
27847 return;
27848 }
27849 if (wingFrameCounter < num5 * 2)
27850 {
27851 wingFrame = 5;
27852 return;
27853 }
27854 if (wingFrameCounter < num5 * 3 - 1)
27855 {
27856 wingFrame = 4;
27857 return;
27858 }
27859 wingFrame = 4;
27860 wingFrameCounter = 0;
27861 }
27862 }
27863 else
27864 {
27865 wingFrameCounter++;
27866 int num6 = 2;
27867 if (wingFrameCounter < num6)
27868 {
27869 wingFrame = 4;
27870 return;
27871 }
27872 if (wingFrameCounter < num6 * 2)
27873 {
27874 wingFrame = 5;
27875 return;
27876 }
27877 if (wingFrameCounter < num6 * 3)
27878 {
27879 wingFrame = 6;
27880 return;
27881 }
27882 if (wingFrameCounter < num6 * 4 - 1)
27883 {
27884 wingFrame = 5;
27885 return;
27886 }
27887 wingFrame = 5;
27888 wingFrameCounter = 0;
27889 }
27890 }
27891 else
27892 {
27893 wingFrameCounter++;
27894 int num7 = 6;
27895 if (wingFrameCounter < num7)
27896 {
27897 wingFrame = 4;
27898 return;
27899 }
27900 if (wingFrameCounter < num7 * 2)
27901 {
27902 wingFrame = 5;
27903 return;
27904 }
27905 if (wingFrameCounter < num7 * 3 - 1)
27906 {
27907 wingFrame = 4;
27908 return;
27909 }
27910 wingFrame = 4;
27911 wingFrameCounter = 0;
27912 }
27913 return;
27914 }
27915 if (wings == 12)
27916 {
27917 if (wingFlap || jump > 0)
27918 {
27919 wingFrameCounter++;
27920 int num8 = 5;
27921 if (wingFrameCounter < num8)
27922 {
27923 wingFrame = 1;
27924 return;
27925 }
27926 if (wingFrameCounter < num8 * 2)
27927 {
27928 wingFrame = 2;
27929 return;
27930 }
27931 if (wingFrameCounter < num8 * 3)
27932 {
27933 wingFrame = 3;
27934 return;
27935 }
27936 if (wingFrameCounter < num8 * 4 - 1)
27937 {
27938 wingFrame = 2;
27939 return;
27940 }
27941 wingFrame = 2;
27942 wingFrameCounter = 0;
27943 }
27944 else if (velocity.Y != 0f)
27945 {
27946 wingFrame = 2;
27947 }
27948 else
27949 {
27950 wingFrame = 0;
27951 }
27952 return;
27953 }
27954 if (wings == 24)
27955 {
27956 if (wingFlap || jump > 0)
27957 {
27958 wingFrameCounter++;
27959 int num9 = 1;
27960 if (wingFrameCounter < num9)
27961 {
27962 wingFrame = 1;
27963 return;
27964 }
27965 if (wingFrameCounter < num9 * 2)
27966 {
27967 wingFrame = 2;
27968 return;
27969 }
27970 if (wingFrameCounter < num9 * 3)
27971 {
27972 wingFrame = 3;
27973 return;
27974 }
27975 wingFrame = 2;
27976 if (wingFrameCounter >= num9 * 4 - 1)
27977 {
27978 wingFrameCounter = 0;
27979 }
27980 }
27981 else if (velocity.Y != 0f)
27982 {
27983 if (controlJump)
27984 {
27985 wingFrameCounter++;
27986 int num10 = 3;
27987 if (wingFrameCounter < num10)
27988 {
27989 wingFrame = 1;
27990 return;
27991 }
27992 if (wingFrameCounter < num10 * 2)
27993 {
27994 wingFrame = 2;
27995 return;
27996 }
27997 if (wingFrameCounter < num10 * 3)
27998 {
27999 wingFrame = 3;
28000 return;
28001 }
28002 wingFrame = 2;
28003 if (wingFrameCounter >= num10 * 4 - 1)
28004 {
28005 wingFrameCounter = 0;
28006 }
28007 }
28008 else if (wingTime == 0f)
28009 {
28010 wingFrame = 0;
28011 }
28012 else
28013 {
28014 wingFrame = 1;
28015 }
28016 }
28017 else
28018 {
28019 wingFrame = 0;
28020 }
28021 return;
28022 }
28023 if (wings == 30)
28024 {
28025 bool flag2 = false;
28026 if (wingFlap || jump > 0)
28027 {
28028 wingFrameCounter++;
28029 int num11 = 2;
28030 if (wingFrameCounter >= num11 * 3)
28031 {
28032 wingFrameCounter = 0;
28033 }
28034 wingFrame = 1 + wingFrameCounter / num11;
28035 flag2 = true;
28036 }
28037 else if (velocity.Y != 0f)
28038 {
28039 if (controlJump)
28040 {
28041 wingFrameCounter++;
28042 int num12 = 2;
28043 if (wingFrameCounter >= num12 * 3)
28044 {
28045 wingFrameCounter = 0;
28046 }
28047 wingFrame = 1 + wingFrameCounter / num12;
28048 flag2 = true;
28049 }
28050 else if (wingTime == 0f)
28051 {
28052 wingFrame = 0;
28053 }
28054 else
28055 {
28056 wingFrame = 0;
28057 }
28058 }
28059 else
28060 {
28061 wingFrame = 0;
28062 }
28063 if (!flag2)
28064 {
28065 return;
28066 }
28067 for (int j = 0; j < 4; j++)
28068 {
28069 if (Main.rand.Next(4) == 0)
28070 {
28071 Vector2 vector = (-0.74539816f + (float)Math.PI / 8f * (float)j + 0.03f * (float)j).ToRotationVector2() * new Vector2(-direction * 20, 20f);
28072 Dust dust = Main.dust[Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100, Color.White, 0.8f)];
28073 dust.noGravity = true;
28074 dust.noLightEmittence = flag;
28075 dust.position = base.Center + vector;
28076 dust.velocity = DirectionTo(dust.position) * 2f;
28077 if (Main.rand.Next(10) != 0)
28078 {
28079 dust.customData = this;
28080 }
28081 else
28082 {
28083 dust.fadeIn = 0.5f;
28084 }
28085 dust.shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28086 }
28087 }
28088 for (int k = 0; k < 4; k++)
28089 {
28090 if (Main.rand.Next(8) == 0)
28091 {
28092 Vector2 vector2 = (-0.7053982f + (float)Math.PI / 8f * (float)k + 0.03f * (float)k).ToRotationVector2() * new Vector2(direction * 20, 24f) + new Vector2((float)(-direction) * 16f, 0f);
28093 Dust dust2 = Main.dust[Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100, Color.White, 0.5f)];
28094 dust2.noGravity = true;
28095 dust2.noLightEmittence = flag;
28096 dust2.position = base.Center + vector2;
28097 dust2.velocity = Vector2.Normalize(dust2.position - base.Center - new Vector2((float)(-direction) * 16f, 0f)) * 2f;
28098 dust2.position += dust2.velocity * 5f;
28099 if (Main.rand.Next(10) != 0)
28100 {
28101 dust2.customData = this;
28102 }
28103 else
28104 {
28105 dust2.fadeIn = 0.5f;
28106 }
28107 dust2.shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28108 }
28109 }
28110 return;
28111 }
28112 if (wings == 34 && ShouldDrawWingsThatAreAlwaysAnimated())
28113 {
28114 if (wingFlap || jump > 0)
28115 {
28116 wingFrameCounter++;
28117 int num13 = 4;
28118 if (wingFrameCounter >= num13 * 6)
28119 {
28120 wingFrameCounter = 0;
28121 }
28122 wingFrame = wingFrameCounter / num13;
28123 }
28124 else if (velocity.Y != 0f)
28125 {
28126 if (controlJump)
28127 {
28128 wingFrameCounter++;
28129 int num14 = 9;
28130 if (wingFrameCounter >= num14 * 6)
28131 {
28132 wingFrameCounter = 0;
28133 }
28134 wingFrame = wingFrameCounter / num14;
28135 }
28136 else
28137 {
28138 wingFrameCounter++;
28139 int num15 = 6;
28140 if (wingFrameCounter >= num15 * 6)
28141 {
28142 wingFrameCounter = 0;
28143 }
28144 wingFrame = wingFrameCounter / num15;
28145 }
28146 }
28147 else
28148 {
28149 wingFrameCounter++;
28150 int num16 = 4;
28151 if (wingFrameCounter >= num16 * 6)
28152 {
28153 wingFrameCounter = 0;
28154 }
28155 wingFrame = wingFrameCounter / num16;
28156 }
28157 return;
28158 }
28159 if (wings == 45 && ShouldDrawWingsThatAreAlwaysAnimated())
28160 {
28161 if (wingTime > 0f)
28162 {
28163 rocketDelay2--;
28164 if (rocketDelay2 <= 0)
28165 {
28167 rocketDelay2 = 30;
28168 }
28169 }
28170 if (velocity.Y == 0f)
28171 {
28172 wingFrameCounter = 0;
28173 wingFrame = 0;
28174 }
28175 else
28176 {
28177 wingFrameCounter++;
28178 int num17 = 3;
28179 if (wingTime == 0f)
28180 {
28181 num17 = 5;
28182 }
28183 if (wingFrameCounter >= num17 * 6)
28184 {
28185 wingFrameCounter = 0;
28186 }
28187 wingFrame = wingFrameCounter / num17;
28188 }
28189 if (Main.netMode != 2 && Main.rand.Next(8) == 0)
28190 {
28192 Dust dust3 = Dust.NewDustDirect(r.TopLeft(), r.Width, r.Height, 43, 0f, 0f, 0, Color.White * 0.5f, 0.2f);
28193 dust3.fadeIn = 0.4f;
28194 dust3.velocity += velocity;
28195 dust3.velocity *= 0.35f;
28196 dust3.shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28197 }
28198 return;
28199 }
28200 if (wings == 44 && ShouldDrawWingsThatAreAlwaysAnimated())
28201 {
28202 int num18 = 5;
28203 if (wingFlap || jump > 0)
28204 {
28205 wingFrameCounter++;
28206 if (wingFrameCounter >= num18 * 6)
28207 {
28208 wingFrameCounter = 0;
28209 }
28210 wingFrame = 1 + wingFrameCounter / num18;
28211 }
28212 else if (velocity.Y != 0f)
28213 {
28214 if (controlJump)
28215 {
28216 wingFrame = 2;
28217 }
28218 else if (ShouldFloatInWater && wet)
28219 {
28220 wingFrame = 0;
28221 }
28222 else
28223 {
28224 wingFrame = 3;
28225 }
28226 }
28227 else
28228 {
28229 wingFrameCounter++;
28230 if (wingFrameCounter >= num18 * 6)
28231 {
28232 wingFrameCounter = 0;
28233 }
28234 wingFrame = 1 + wingFrameCounter / num18;
28235 }
28236 return;
28237 }
28238 if (wings == 39 && ShouldDrawWingsThatAreAlwaysAnimated())
28239 {
28240 if (wingFlap || jump > 0)
28241 {
28242 wingFrameCounter++;
28243 int num19 = 4;
28244 if (wingFrameCounter >= num19 * 6)
28245 {
28246 wingFrameCounter = 0;
28247 }
28248 wingFrame = wingFrameCounter / num19;
28249 }
28250 else if (velocity.Y != 0f)
28251 {
28252 if (controlJump)
28253 {
28254 wingFrameCounter++;
28255 int num20 = 9;
28256 if (wingFrameCounter >= num20 * 6)
28257 {
28258 wingFrameCounter = 0;
28259 }
28260 wingFrame = wingFrameCounter / num20;
28261 }
28262 else
28263 {
28264 wingFrameCounter++;
28265 int num21 = 6;
28266 if (wingFrameCounter >= num21 * 6)
28267 {
28268 wingFrameCounter = 0;
28269 }
28270 wingFrame = wingFrameCounter / num21;
28271 }
28272 }
28273 else
28274 {
28275 wingFrameCounter++;
28276 int num22 = 4;
28277 if (wingFrameCounter >= num22 * 6)
28278 {
28279 wingFrameCounter = 0;
28280 }
28281 wingFrame = wingFrameCounter / num22;
28282 }
28283 int num23 = 1;
28284 if (wingFrame == 3)
28285 {
28286 num23 = 5;
28287 }
28288 if (velocity.Y == 0f)
28289 {
28290 num23 = 0;
28291 }
28292 Rectangle r2 = Utils.CenteredRectangle((gravDir == 1f) ? (base.Bottom + new Vector2(0f, -10f)) : (base.Top + new Vector2(0f, 10f)), new Vector2(50f, 20f));
28293 for (int l = 0; l < num23; l++)
28294 {
28295 Dust dust4 = Dust.NewDustDirect(r2.TopLeft(), r2.Width, r2.Height, 31, 0f, 0f, 0, Color.Black);
28296 dust4.scale = 0.7f;
28297 dust4.velocity *= 0.4f;
28298 dust4.velocity.Y += gravDir * 0.5f;
28299 dust4.shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28300 }
28301 return;
28302 }
28303 if (wings == 33)
28304 {
28305 bool flag3 = false;
28306 if (wingFlap || jump > 0)
28307 {
28308 flag3 = true;
28309 }
28310 else if (velocity.Y != 0f && controlJump)
28311 {
28312 flag3 = true;
28313 }
28314 if (!flag3)
28315 {
28316 return;
28317 }
28318 Color newColor = Main.hslToRgb(Main.rgbToHsl(eyeColor).X, 1f, 0.5f);
28319 int num24 = ((direction != 1) ? (-4) : 0);
28320 int num25 = ((gravDir == 1f) ? height : 0);
28321 for (int m = 0; m < 2; m++)
28322 {
28323 Dust dust5 = Main.dust[Dust.NewDust(position, width, height, 182, velocity.X, velocity.Y, 127, newColor)];
28324 dust5.noGravity = true;
28325 dust5.fadeIn = 1f;
28326 dust5.scale = 1f;
28327 dust5.noLight = true;
28328 dust5.noLightEmittence = flag;
28329 dust5.shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28330 switch (m)
28331 {
28332 case 0:
28333 dust5.position = new Vector2(position.X + (float)num24, position.Y + (float)num25);
28334 dust5.velocity.X = dust5.velocity.X * 1f - 2f - velocity.X * 0.3f;
28335 dust5.velocity.Y = dust5.velocity.Y * 1f + 2f * gravDir - velocity.Y * 0.3f;
28336 break;
28337 case 1:
28338 dust5.position = new Vector2(position.X + (float)width + (float)num24, position.Y + (float)num25);
28339 dust5.velocity.X = dust5.velocity.X * 1f + 2f - velocity.X * 0.3f;
28340 dust5.velocity.Y = dust5.velocity.Y * 1f + 2f * gravDir - velocity.Y * 0.3f;
28341 break;
28342 }
28343 if (dust5.dustIndex != 6000)
28344 {
28346 dust6.scale *= 0.65f;
28347 dust6.fadeIn *= 0.65f;
28348 dust6.color = new Color(255, 255, 255, 255);
28349 dust5.noLight = true;
28350 dust5.noLightEmittence = flag;
28351 dust5.shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28352 }
28353 }
28354 return;
28355 }
28356 if (wings == 38)
28357 {
28358 bool flag4 = false;
28359 if (wingFlap || jump > 0)
28360 {
28361 wingFrameCounter++;
28362 if (wingFrameCounter >= 32)
28363 {
28364 wingFrameCounter = 0;
28365 }
28366 wingFrame = 1 + wingFrameCounter / 8;
28367 if (wingFrame == 4)
28368 {
28369 wingFrame = 2;
28370 }
28371 flag4 = true;
28372 }
28373 else if (velocity.Y != 0f)
28374 {
28375 if (controlJump)
28376 {
28377 wingFrameCounter++;
28378 if (wingFrameCounter >= 32)
28379 {
28380 wingFrameCounter = 0;
28381 }
28382 wingFrame = 1 + wingFrameCounter / 8;
28383 if (wingFrame == 4)
28384 {
28385 wingFrame = 2;
28386 }
28387 flag4 = true;
28388 }
28389 else
28390 {
28391 wingFrame = 0;
28392 }
28393 }
28394 else
28395 {
28396 wingFrame = 0;
28397 }
28398 if (!flag4)
28399 {
28400 return;
28401 }
28402 Vector2 vector3 = new Vector2(direction, gravDir);
28403 Vector2 value = velocity * 0.5f;
28404 int type2 = 267;
28405 int num26 = miscCounter * direction;
28406 for (int n = 0; n < 3; n++)
28407 {
28409 switch (n)
28410 {
28411 case 1:
28412 vector4 = velocity * -0.33f;
28413 break;
28414 case 2:
28415 vector4 = velocity * -0.66f;
28416 break;
28417 }
28418 Vector2 vector5 = new Vector2(-39f, 6f) * vector3 + new Vector2(2f, 0f).RotatedBy((float)num26 / -15f * ((float)Math.PI * 2f));
28419 Dust dust7 = Dust.NewDustPerfect(base.Center + vector5 + vector4, type2, value, 0, underShirtColor);
28420 dust7.noGravity = true;
28421 dust7.noLight = true;
28422 dust7.noLightEmittence = flag;
28423 dust7.scale = 0.47f;
28424 dust7.shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28425 vector5 = new Vector2(-23f, 2f) * vector3 + new Vector2(2f, 0f).RotatedBy((float)num26 / -15f * ((float)Math.PI * 2f));
28426 Dust dust8 = Dust.NewDustPerfect(base.Center + vector5 + vector4, type2, value, 0, underShirtColor);
28427 dust8.noGravity = true;
28428 dust8.noLight = true;
28429 dust8.noLightEmittence = flag;
28430 dust8.scale = 0.35f;
28431 dust8.shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28432 vector5 = new Vector2(-31f, -6f) * vector3 + new Vector2(2f, 0f).RotatedBy((float)num26 / -20f * ((float)Math.PI * 2f));
28433 Dust dust9 = Dust.NewDustPerfect(base.Center + vector5 + vector4, type2, value, 0, underShirtColor);
28434 dust9.noGravity = true;
28435 dust9.noLight = true;
28436 dust9.noLightEmittence = flag;
28437 dust9.scale = 0.49f;
28438 dust9.shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28439 }
28440 return;
28441 }
28442 int num27 = 4;
28443 int num28 = 4;
28444 int num29 = 0;
28445 if (wings == 43)
28446 {
28447 num28 = 7;
28448 num29 = 1;
28449 num27 = 3;
28450 }
28451 if (wings == 32)
28452 {
28453 num27 = 3;
28454 }
28455 if (wingFlap || jump > 0)
28456 {
28457 wingFrameCounter++;
28458 if (wingFrameCounter > num27)
28459 {
28460 wingFrame++;
28461 wingFrameCounter = 0;
28462 if (wingFrame >= num28)
28463 {
28464 wingFrame = num29;
28465 }
28466 }
28467 }
28468 else if (velocity.Y != 0f)
28469 {
28470 wingFrame = 1;
28471 if (wings == 32)
28472 {
28473 wingFrame = 3;
28474 }
28475 if (wings == 43)
28476 {
28477 wingFrame = 2;
28478 if (ShouldFloatInWater && wet)
28479 {
28480 wingFrame = 0;
28481 }
28482 }
28483 if (wings == 29 && Main.rand.Next(5) == 0)
28484 {
28485 int num30 = 4;
28486 if (direction == 1)
28487 {
28488 num30 = -40;
28489 }
28490 int num31 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num30, position.Y + (float)(height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default(Color), 2.4f);
28491 Main.dust[num31].noGravity = true;
28492 Main.dust[num31].noLightEmittence = flag;
28493 Main.dust[num31].velocity *= 0.3f;
28494 if (Main.rand.Next(10) == 0)
28495 {
28496 Main.dust[num31].fadeIn = 2f;
28497 }
28498 Main.dust[num31].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28499 }
28500 }
28501 else
28502 {
28503 wingFrame = 0;
28504 }
28505 }
28506
28508 {
28509 if ((velocity.Y != 0f || grappling[0] != -1) && (!wet || !ShouldFloatInWater))
28510 {
28511 return !mount.Active;
28512 }
28513 return false;
28514 }
28515
28516 private void WingAirVisuals()
28517 {
28518 bool noLightEmittence = wingsLogic != wings;
28519 if (wings == 10 && Main.rand.Next(2) == 0)
28520 {
28521 int num = 4;
28522 if (direction == 1)
28523 {
28524 num = -40;
28525 }
28526 int num2 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num, position.Y + (float)(height / 2) - 15f), 30, 30, 76, 0f, 0f, 50, default(Color), 0.6f);
28527 Main.dust[num2].fadeIn = 1.1f;
28528 Main.dust[num2].noGravity = true;
28529 Main.dust[num2].noLight = true;
28530 Main.dust[num2].velocity *= 0.3f;
28531 Main.dust[num2].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28532 }
28533 if (wings == 34 && Main.rand.Next(2) == 0)
28534 {
28535 int num3 = 4;
28536 if (direction == 1)
28537 {
28538 num3 = -40;
28539 }
28540 int num4 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num3, position.Y + (float)(height / 2) - 15f), 30, 30, 261, 0f, 0f, 50, default(Color), 0.6f);
28541 Main.dust[num4].fadeIn = 1.1f;
28542 Main.dust[num4].noGravity = true;
28543 Main.dust[num4].noLight = true;
28544 Main.dust[num4].noLightEmittence = noLightEmittence;
28545 Main.dust[num4].velocity *= 0.3f;
28546 Main.dust[num4].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28547 }
28548 _ = wings;
28549 _ = 40;
28550 _ = wings;
28551 _ = 44;
28552 if (wings == 9 && Main.rand.Next(2) == 0)
28553 {
28554 int num5 = 4;
28555 if (direction == 1)
28556 {
28557 num5 = -40;
28558 }
28559 int num6 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num5, position.Y + (float)(height / 2) - 15f), 30, 30, 6, 0f, 0f, 200, default(Color), 2f);
28560 Main.dust[num6].noGravity = true;
28561 Main.dust[num6].noLightEmittence = noLightEmittence;
28562 Main.dust[num6].velocity *= 0.3f;
28563 Main.dust[num6].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28564 }
28565 if (wings == 6 && Main.rand.Next(4) == 0)
28566 {
28567 int num7 = 4;
28568 if (direction == 1)
28569 {
28570 num7 = -40;
28571 }
28572 int num8 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num7, position.Y + (float)(height / 2) - 15f), 30, 30, 55, 0f, 0f, 200);
28573 Main.dust[num8].velocity *= 0.3f;
28574 Main.dust[num8].noLightEmittence = noLightEmittence;
28575 Main.dust[num8].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28576 }
28577 if (wings == 5 && Main.rand.Next(3) == 0)
28578 {
28579 int num9 = 6;
28580 if (direction == 1)
28581 {
28582 num9 = -30;
28583 }
28584 int num10 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num9, position.Y), 18, height, 58, 0f, 0f, 255, default(Color), 1.2f);
28585 Main.dust[num10].noLightEmittence = noLightEmittence;
28586 Main.dust[num10].velocity *= 0.3f;
28587 Main.dust[num10].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28588 }
28589 if (wings == 26)
28590 {
28591 int num11 = 6;
28592 if (direction == 1)
28593 {
28594 num11 = -30;
28595 }
28596 int num12 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num11, position.Y), 18, height, 217, 0f, 0f, 100, default(Color), 1.4f);
28597 Main.dust[num12].noGravity = true;
28598 Main.dust[num12].noLight = true;
28599 Main.dust[num12].velocity /= 4f;
28600 Main.dust[num12].velocity -= velocity;
28601 Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28602 if (Main.rand.Next(2) == 0)
28603 {
28604 num11 = -24;
28605 if (direction == 1)
28606 {
28607 num11 = 12;
28608 }
28609 float num13 = position.Y;
28610 if (gravDir == -1f)
28611 {
28612 num13 += (float)(height / 2);
28613 }
28614 num12 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num11, num13), 12, height / 2, 217, 0f, 0f, 100, default(Color), 1.4f);
28615 Main.dust[num12].noGravity = true;
28616 Main.dust[num12].noLight = true;
28617 Main.dust[num12].velocity /= 4f;
28618 Main.dust[num12].velocity -= velocity;
28619 Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28620 }
28621 }
28622 if (wings == 37)
28623 {
28624 int num14 = 6;
28625 if (direction == 1)
28626 {
28627 num14 = -30;
28628 }
28629 Dust dust = Dust.NewDustDirect(new Vector2(position.X + (float)(width / 2) + (float)num14, position.Y), 24, height, Utils.SelectRandom<int>(Main.rand, 31, 31, 31), 0f, 0f, 100);
28630 dust.noGravity = true;
28631 dust.noLight = true;
28632 dust.velocity /= 4f;
28633 dust.velocity -= velocity / 2f;
28634 dust.shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28635 if (dust.type == 55)
28636 {
28637 dust.noGravity = true;
28638 dust.velocity *= 2f;
28639 dust.color = Color.Red;
28640 }
28641 if (Main.rand.Next(3) == 0)
28642 {
28643 num14 = -24;
28644 if (direction == 1)
28645 {
28646 num14 = 12;
28647 }
28648 float num15 = position.Y;
28649 if (gravDir == -1f)
28650 {
28651 num15 += (float)(height / 2);
28652 }
28653 dust = Dust.NewDustDirect(new Vector2(position.X + (float)(width / 2) + (float)num14, num15), 16, height / 2, Utils.SelectRandom<int>(Main.rand, 31, 31, 31), 0f, 0f, 100);
28654 dust.noGravity = true;
28655 dust.noLight = true;
28656 dust.velocity /= 4f;
28657 dust.velocity -= velocity / 2f;
28658 dust.shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28659 if (dust.type == 55)
28660 {
28661 dust.noGravity = true;
28662 dust.velocity *= 2f;
28663 dust.color = Color.Red;
28664 }
28665 }
28666 }
28667 if (wings == 29 && Main.rand.Next(3) == 0)
28668 {
28669 int num16 = 4;
28670 if (direction == 1)
28671 {
28672 num16 = -40;
28673 }
28674 int num17 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num16, position.Y + (float)(height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default(Color), 2.4f);
28675 Main.dust[num17].noGravity = true;
28676 Main.dust[num17].velocity *= 0.3f;
28677 Main.dust[num17].noLightEmittence = noLightEmittence;
28678 if (Main.rand.Next(10) == 0)
28679 {
28680 Main.dust[num17].fadeIn = 2f;
28681 }
28682 Main.dust[num17].shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28683 }
28684 if (wings != 31)
28685 {
28686 return;
28687 }
28688 if (Main.rand.Next(6) == 0)
28689 {
28690 int num18 = 4;
28691 if (direction == 1)
28692 {
28693 num18 = -40;
28694 }
28695 Dust obj = Main.dust[Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num18, position.Y + (float)(height / 2) - 15f), 30, 30, 86)];
28696 obj.noGravity = true;
28697 obj.scale = 1f;
28698 obj.fadeIn = 1.2f;
28699 obj.velocity *= 0.2f;
28700 obj.noLight = true;
28701 obj.shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28702 }
28703 if (Main.rand.Next(3) == 0)
28704 {
28705 int num19 = 4;
28706 if (direction == 1)
28707 {
28708 num19 = -40;
28709 }
28710 Dust obj2 = Main.dust[Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num19, position.Y + (float)(height / 2) - 15f), 30, 30, 240)];
28711 obj2.noGravity = true;
28712 obj2.scale = 1.2f;
28713 obj2.velocity *= 0.2f;
28714 obj2.alpha = 200;
28715 obj2.shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28716 }
28717 if (Main.rand.Next(2) != 0)
28718 {
28719 return;
28720 }
28721 if (Main.rand.Next(6) == 0)
28722 {
28723 int num20 = -24;
28724 if (direction == 1)
28725 {
28726 num20 = 12;
28727 }
28728 float num21 = position.Y;
28729 if (gravDir == -1f)
28730 {
28731 num21 += (float)(height / 2);
28732 }
28733 Dust obj3 = Main.dust[Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num20, num21), 12, height / 2, 86)];
28734 obj3.noGravity = true;
28735 obj3.scale = 1f;
28736 obj3.fadeIn = 1.2f;
28737 obj3.velocity *= 0.2f;
28738 obj3.noLight = true;
28739 obj3.shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28740 }
28741 if (Main.rand.Next(3) == 0)
28742 {
28743 int num20 = -24;
28744 if (direction == 1)
28745 {
28746 num20 = 12;
28747 }
28748 float num22 = position.Y;
28749 if (gravDir == -1f)
28750 {
28751 num22 += (float)(height / 2);
28752 }
28753 Dust obj4 = Main.dust[Dust.NewDust(new Vector2(position.X + (float)(width / 2) + (float)num20, num22), 12, height / 2, 240)];
28754 obj4.noGravity = true;
28755 obj4.scale = 1.2f;
28756 obj4.velocity *= 0.2f;
28757 obj4.alpha = 200;
28758 obj4.shader = GameShaders.Armor.GetSecondaryShader(cWings, this);
28759 }
28760 }
28761
28763 {
28764 if (chest != -1)
28765 {
28766 if (chest != -2)
28767 {
28768 piggyBankProjTracker.Clear();
28769 }
28770 if (chest != -5)
28771 {
28772 voidLensChest.Clear();
28773 }
28774 bool flag = false;
28775 int projectileLocalIndex = piggyBankProjTracker.ProjectileLocalIndex;
28776 if (projectileLocalIndex >= 0)
28777 {
28778 flag = true;
28780 {
28782 chest = -1;
28784 }
28785 else
28786 {
28787 int num = (int)(((double)position.X + (double)width * 0.5) / 16.0);
28788 int num2 = (int)(((double)position.Y + (double)height * 0.5) / 16.0);
28789 Vector2 vector = Main.projectile[projectileLocalIndex].Hitbox.ClosestPointInRect(base.Center);
28790 chestX = (int)vector.X / 16;
28791 chestY = (int)vector.Y / 16;
28792 if (num < chestX - tileRangeX || num > chestX + tileRangeX + 1 || num2 < chestY - tileRangeY || num2 > chestY + tileRangeY + 1)
28793 {
28794 if (chest != -1)
28795 {
28797 }
28798 chest = -1;
28800 }
28801 }
28802 }
28803 int projectileLocalIndex2 = voidLensChest.ProjectileLocalIndex;
28804 if (projectileLocalIndex2 >= 0)
28805 {
28806 flag = true;
28808 {
28810 chest = -1;
28812 }
28813 else
28814 {
28815 int num3 = (int)(((double)position.X + (double)width * 0.5) / 16.0);
28816 int num4 = (int)(((double)position.Y + (double)height * 0.5) / 16.0);
28817 Vector2 vector2 = Main.projectile[projectileLocalIndex2].Hitbox.ClosestPointInRect(base.Center);
28818 chestX = (int)vector2.X / 16;
28819 chestY = (int)vector2.Y / 16;
28820 if (num3 < chestX - tileRangeX || num3 > chestX + tileRangeX + 1 || num4 < chestY - tileRangeY || num4 > chestY + tileRangeY + 1)
28821 {
28822 if (chest != -1)
28823 {
28825 }
28826 chest = -1;
28828 }
28829 }
28830 }
28831 if (flag)
28832 {
28833 return;
28834 }
28835 if (!IsInInteractionRangeToMultiTileHitbox(chestX, chestY))
28836 {
28837 if (chest != -1)
28838 {
28840 }
28841 chest = -1;
28843 }
28844 else if (!Main.tile[chestX, chestY].active())
28845 {
28847 chest = -1;
28849 }
28850 }
28851 else
28852 {
28853 piggyBankProjTracker.Clear();
28854 voidLensChest.Clear();
28855 }
28856 }
28857
28859 {
28860 int num = (int)(((double)position.X + (double)width * 0.5) / 16.0);
28861 int num2 = (int)(((double)position.Y + (double)height * 0.5) / 16.0);
28864 if (tile.type == 463 || tile.type == 491)
28865 {
28866 r = new Rectangle(chestPointX * 16 - 16, chestPointY * 16 - 32, 48, 64);
28867 }
28868 if (TileID.Sets.BasicChest[tile.type] || tile.type == 97)
28869 {
28870 r = new Rectangle(chestPointX * 16, chestPointY * 16, 32, 32);
28871 }
28872 if (tile.type == 88)
28873 {
28874 r = new Rectangle(chestPointX * 16, chestPointY * 16, 48, 32);
28875 }
28876 if (tile.type == 29)
28877 {
28878 r = new Rectangle(chestPointX * 16, chestPointY * 16, 32, 16);
28879 }
28880 r.Inflate(-1, -1);
28881 Point point = r.ClosestPointInRect(base.Center).ToTileCoordinates();
28882 chestPointX = point.X;
28883 chestPointY = point.Y;
28884 return num >= chestPointX - tileRangeX && num <= chestPointX + tileRangeX + 1 && num2 >= chestPointY - tileRangeY && num2 <= chestPointY + tileRangeY + 1;
28885 }
28886
28888 {
28889 handon = -1;
28890 handoff = -1;
28891 back = -1;
28892 front = -1;
28893 shoe = -1;
28894 waist = -1;
28895 shield = -1;
28896 neck = -1;
28897 face = -1;
28898 balloon = -1;
28899 backpack = -1;
28900 tail = -1;
28901 faceHead = -1;
28902 faceFlower = -1;
28903 balloonFront = -1;
28904 beard = -1;
28905 }
28906
28907 public void UpdateArmorLights()
28908 {
28909 if (vortexStealthActive)
28910 {
28911 return;
28912 }
28913 float num = 0f;
28914 float num2 = 0f;
28915 float num3 = 0f;
28916 switch (head)
28917 {
28918 case 11:
28919 num = 0.92f;
28920 num2 = 0.8f;
28921 num3 = 0.65f;
28922 break;
28923 case 216:
28924 num = 0.7f;
28925 num2 = 0.95f;
28926 num3 = 0.82f;
28927 break;
28928 case 169:
28929 num = 0f;
28930 num2 = 0.36f;
28931 num3 = 0.4f;
28932 break;
28933 case 170:
28934 num = 0.4f;
28935 num2 = 0.16f;
28936 num3 = 0.36f;
28937 break;
28938 case 171:
28939 num = 0.5f;
28940 num2 = 0.25f;
28941 num3 = 0.05f;
28942 break;
28943 case 189:
28944 num = 0.9f;
28945 num2 = 0.9f;
28946 num3 = 0.7f;
28947 break;
28948 case 178:
28949 num = 0.1f;
28950 num2 = 0.2f;
28951 num3 = 0.3f;
28952 break;
28953 case 211:
28954 num = 0.2f;
28955 num2 = 0.4f;
28956 num3 = 0.8f;
28957 break;
28958 }
28959 float num4 = 0f;
28960 float num5 = 0f;
28961 float num6 = 0f;
28962 switch (body)
28963 {
28964 case 175:
28965 num4 = 0f;
28966 num5 = 0.36f;
28967 num6 = 0.4f;
28968 break;
28969 case 176:
28970 num4 = 0.4f;
28971 num5 = 0.16f;
28972 num6 = 0.36f;
28973 break;
28974 case 177:
28975 num4 = 0.5f;
28976 num5 = 0.25f;
28977 num6 = 0.05f;
28978 break;
28979 case 190:
28980 num = 0.9f;
28981 num2 = 0.9f;
28982 num3 = 0.7f;
28983 break;
28984 case 205:
28985 num4 = 0.2f;
28986 num5 = 0.4f;
28987 num6 = 0.8f;
28988 break;
28989 }
28990 float num7 = 0f;
28991 float num8 = 0f;
28992 float num9 = 0f;
28993 switch (legs)
28994 {
28995 case 110:
28996 num7 = 0f;
28997 num8 = 0.36f;
28998 num9 = 0.4f;
28999 break;
29000 case 111:
29001 num7 = 0.4f;
29002 num8 = 0.16f;
29003 num9 = 0.36f;
29004 break;
29005 case 112:
29006 num7 = 0.5f;
29007 num8 = 0.25f;
29008 num9 = 0.05f;
29009 break;
29010 case 130:
29011 num = 0.9f;
29012 num2 = 0.9f;
29013 num3 = 0.7f;
29014 break;
29015 }
29016 if (num != 0f || num2 != 0f || num3 != 0f)
29017 {
29018 float num10 = 1f;
29019 if (num == num4 && num2 == num5 && num3 == num6)
29020 {
29021 num10 += 0.5f;
29022 }
29023 if (num == num7 && num2 == num8 && num3 == num9)
29024 {
29025 num10 += 0.5f;
29026 }
29027 Vector2 spinningpoint = new Vector2(width / 2 + 8 * direction, 2f);
29028 if (fullRotation != 0f)
29029 {
29030 spinningpoint = spinningpoint.RotatedBy(fullRotation, fullRotationOrigin);
29031 }
29032 int i = (int)(position.X + spinningpoint.X) / 16;
29033 int j = (int)(position.Y + spinningpoint.Y) / 16;
29034 Lighting.AddLight(i, j, num * num10, num2 * num10, num3 * num10);
29035 }
29036 if (num4 != 0f || num5 != 0f || num6 != 0f)
29037 {
29038 float num11 = 1f;
29039 if (num4 == num && num5 == num2 && num6 == num3)
29040 {
29041 num11 += 0.5f;
29042 }
29043 if (num4 == num7 && num5 == num8 && num6 == num9)
29044 {
29045 num11 += 0.5f;
29046 }
29047 Vector2 spinningpoint2 = new Vector2(width / 2 + 8, height / 2);
29048 if (fullRotation != 0f)
29049 {
29050 spinningpoint2 = spinningpoint2.RotatedBy(fullRotation, fullRotationOrigin);
29051 }
29052 int i2 = (int)(position.X + spinningpoint2.X) / 16;
29053 int j2 = (int)(position.Y + spinningpoint2.Y) / 16;
29055 }
29056 if (num7 != 0f || num8 != 0f || num9 != 0f)
29057 {
29058 float num12 = 1f;
29059 if (num7 == num4 && num8 == num5 && num9 == num6)
29060 {
29061 num12 += 0.5f;
29062 }
29063 if (num7 == num && num8 == num2 && num9 == num3)
29064 {
29065 num12 += 0.5f;
29066 }
29067 Vector2 spinningpoint3 = new Vector2(width / 2 + 8 * direction, (float)height * 0.75f);
29068 if (fullRotation != 0f)
29069 {
29070 spinningpoint3 = spinningpoint3.RotatedBy(fullRotation, fullRotationOrigin);
29071 }
29072 int i3 = (int)(position.X + spinningpoint3.X) / 16;
29073 int j3 = (int)(position.Y + spinningpoint3.Y) / 16;
29075 }
29076 }
29077
29079 {
29080 if (creativeGodMode)
29081 {
29082 return;
29083 }
29084 Rectangle rectangle = new Rectangle((int)position.X, (int)position.Y, width, height);
29085 for (int i = 0; i < 200; i++)
29086 {
29087 if (!Main.npc[i].active || Main.npc[i].friendly || Main.npc[i].damage <= 0)
29088 {
29089 continue;
29090 }
29091 int specialHitSetter = -1;
29092 switch (Main.npc[i].type)
29093 {
29094 case 396:
29095 case 397:
29096 case 398:
29097 case 400:
29098 case 401:
29099 specialHitSetter = 1;
29100 break;
29101 case 636:
29102 specialHitSetter = 1;
29103 if (Main.npc[i].ai[0] == 0f || Main.npc[i].ai[0] == 10f)
29104 {
29105 continue;
29106 }
29107 break;
29108 }
29109 if ((specialHitSetter == -1 && immune) || (dash == 2 && i == eocHit && eocDash > 0) || npcTypeNoAggro[Main.npc[i].type])
29110 {
29111 continue;
29112 }
29113 float damageMultiplier = 1f;
29114 Main.npc[i].position += Main.npc[i].netOffset;
29115 Rectangle npcRect = new Rectangle((int)Main.npc[i].position.X, (int)Main.npc[i].position.Y, Main.npc[i].width, Main.npc[i].height);
29117 if (rectangle.Intersects(npcRect))
29118 {
29119 if (npcTypeNoAggro[Main.npc[i].type])
29120 {
29121 continue;
29122 }
29123 bool flag = true;
29124 bool flag2 = false;
29125 bool num = CanParryAgainst(rectangle, npcRect, Main.npc[i].velocity);
29126 float num2 = thorns;
29127 float knockback = 10f;
29128 if (turtleThorns)
29129 {
29130 num2 = 2f;
29131 }
29132 if (num)
29133 {
29134 num2 = 2f;
29135 knockback = 5f;
29136 flag = false;
29137 flag2 = true;
29138 }
29139 int num3 = -1;
29140 if (Main.npc[i].position.X + (float)(Main.npc[i].width / 2) < position.X + (float)(width / 2))
29141 {
29142 num3 = 1;
29143 }
29144 int num4 = Main.DamageVar((float)Main.npc[i].damage * damageMultiplier, 0f - luck);
29145 int num5 = Item.NPCtoBanner(Main.npc[i].BannerID());
29146 if (num5 > 0 && HasNPCBannerBuff(num5))
29147 {
29148 num4 = ((!Main.expertMode) ? ((int)((float)num4 * ItemID.Sets.BannerStrength[Item.BannerToItem(num5)].NormalDamageReceived)) : ((int)((float)num4 * ItemID.Sets.BannerStrength[Item.BannerToItem(num5)].ExpertDamageReceived)));
29149 }
29150 bool flag3 = !immune;
29151 if (specialHitSetter >= 0)
29152 {
29153 flag3 = hurtCooldowns[specialHitSetter] == 0;
29154 }
29155 if (whoAmI == Main.myPlayer && num2 > 0f && flag3 && !Main.npc[i].dontTakeDamage)
29156 {
29157 int num6 = (int)((float)num4 * num2);
29158 if (num6 > 1000)
29159 {
29160 num6 = 1000;
29161 }
29162 ApplyDamageToNPC(Main.npc[i], num6, knockback, -num3, crit: false);
29163 }
29164 if (whoAmI == Main.myPlayer && cactusThorns && flag3 && !Main.npc[i].dontTakeDamage)
29165 {
29166 int damage = 15;
29167 if (Main.masterMode)
29168 {
29169 damage = 45;
29170 }
29171 else if (Main.expertMode)
29172 {
29173 damage = 30;
29174 }
29175 ApplyDamageToNPC(Main.npc[i], damage, knockback, -num3, crit: false);
29176 }
29177 if (resistCold && Main.npc[i].coldDamage)
29178 {
29179 num4 = (int)((float)num4 * 0.7f);
29180 }
29181 if (flag && Hurt(dodgeable: Main.npc[i].IsDamageDodgeable(), damageSource: PlayerDeathReason.ByNPC(i), Damage: num4, hitDirection: num3, pvp: false, quiet: false, Crit: false, cooldownCounter: specialHitSetter) > 0.0 && !dead && !flag2)
29182 {
29183 StatusFromNPC(Main.npc[i]);
29184 }
29185 if (num)
29186 {
29187 GiveImmuneTimeForCollisionAttack(longInvince ? 60 : 30);
29188 AddBuff(198, 300, quiet: false);
29189 }
29190 }
29191 Main.npc[i].position -= Main.npc[i].netOffset;
29192 }
29193 }
29194
29196 {
29197 if (shieldParryTimeLeft > 0 && Math.Sign(enemyRect.Center.X - blockingPlayerRect.Center.X) == direction && enemyVelocity != Vector2.Zero)
29198 {
29199 return !immune;
29200 }
29201 return false;
29202 }
29203
29205 {
29206 if (trashItem.type == 3822)
29207 {
29208 trashItem.TurnToAir();
29209 }
29210 if (Main.myPlayer == whoAmI && Main.mouseItem.type == 3822)
29211 {
29212 Main.mouseItem.TurnToAir();
29213 }
29214 for (int i = 0; i < 59; i++)
29215 {
29216 Item item = inventory[i];
29217 if (item.stack > 0 && item.type == 3822)
29218 {
29219 item.TurnToAir();
29220 }
29221 }
29222 if (this.chest == -2)
29223 {
29224 Chest chest = bank;
29225 for (int j = 0; j < 40; j++)
29226 {
29227 if (chest.item[j].stack > 0 && chest.item[j].type == 3822)
29228 {
29229 chest.item[j].TurnToAir();
29230 }
29231 }
29232 }
29233 if (this.chest == -4)
29234 {
29235 Chest chest2 = bank3;
29236 for (int k = 0; k < 40; k++)
29237 {
29238 if (chest2.item[k].stack > 0 && chest2.item[k].type == 3822)
29239 {
29240 chest2.item[k].TurnToAir();
29241 }
29242 }
29243 }
29244 if (this.chest == -5)
29245 {
29246 Chest chest3 = bank4;
29247 for (int l = 0; l < 40; l++)
29248 {
29249 if (chest3.item[l].stack > 0 && chest3.item[l].type == 3822)
29250 {
29251 chest3.item[l].TurnToAir();
29252 }
29253 }
29254 }
29255 if (this.chest == -3)
29256 {
29257 Chest chest4 = bank2;
29258 for (int m = 0; m < 40; m++)
29259 {
29260 if (chest4.item[m].stack > 0 && chest4.item[m].type == 3822)
29261 {
29262 chest4.item[m].TurnToAir();
29263 }
29264 }
29265 }
29266 if (this.chest <= -1)
29267 {
29268 return;
29269 }
29270 Chest chest5 = Main.chest[this.chest];
29271 for (int n = 0; n < 40; n++)
29272 {
29273 if (chest5.item[n].stack > 0 && chest5.item[n].type == 3822)
29274 {
29275 chest5.item[n].TurnToAir();
29276 if (Main.netMode == 1)
29277 {
29278 NetMessage.SendData(32, -1, -1, null, this.chest, n);
29279 }
29280 }
29281 }
29282 }
29283
29285 {
29286 bool flag = selectedItem != 58 && controlUseTile && Main.myPlayer == whoAmI && !tileInteractionHappened && releaseUseItem && !controlUseItem && !mouseInterface && !CaptureManager.Instance.Active && !Main.HoveringOverAnNPC && !Main.SmartInteractShowingGenuine;
29287 bool flag2 = flag;
29288 if (!ItemID.Sets.ItemsThatAllowRepeatedRightClick[inventory[selectedItem].type] && !Main.mouseRightRelease)
29289 {
29290 flag2 = false;
29291 }
29292 if (flag2 && altFunctionUse == 0)
29293 {
29294 for (int i = 0; i < _projectilesToInteractWith.Count; i++)
29295 {
29296 Projectile projectile = Main.projectile[_projectilesToInteractWith[i]];
29297 if (projectile.Hitbox.Contains(Main.MouseWorld.ToPoint()) || Main.SmartInteractProj == projectile.whoAmI)
29298 {
29299 flag = false;
29300 flag2 = false;
29301 break;
29302 }
29303 }
29304 }
29305 if (flag2 && altFunctionUse == 0 && itemTime == 0 && itemAnimation == 0)
29306 {
29307 int num = -1;
29308 int type = 7;
29309 switch (inventory[selectedItem].type)
29310 {
29311 case 5324:
29312 num = 5329;
29313 type = 22;
29314 break;
29315 case 5329:
29316 num = 5330;
29317 type = 22;
29318 break;
29319 case 5330:
29320 num = 5324;
29321 type = 22;
29322 break;
29323 case 4346:
29324 num = 5391;
29325 type = 22;
29326 break;
29327 case 5391:
29328 num = 4346;
29329 type = 22;
29330 break;
29331 case 5325:
29332 num = 4131;
29333 break;
29334 case 4131:
29335 num = 5325;
29336 break;
29337 case 5323:
29338 num = 5455;
29339 break;
29340 case 5455:
29341 num = 5323;
29342 break;
29343 case 4767:
29344 num = 5453;
29345 break;
29346 case 5453:
29347 num = 4767;
29348 break;
29349 case 5309:
29350 num = 5454;
29351 break;
29352 case 5454:
29353 num = 5309;
29354 break;
29355 case 5358:
29356 num = 5360;
29357 type = 22;
29358 break;
29359 case 5360:
29360 num = 5361;
29361 type = 22;
29362 break;
29363 case 5361:
29364 num = 5359;
29365 type = 22;
29366 break;
29367 case 5359:
29368 num = 5358;
29369 type = 22;
29370 break;
29371 case 5437:
29372 num = 5358;
29373 type = 22;
29374 break;
29375 }
29376 if (num != -1)
29377 {
29378 releaseUseTile = false;
29379 Main.mouseRightRelease = false;
29381 inventory[selectedItem].ChangeItemType(num);
29383 }
29384 }
29385 if (flag2 && altFunctionUse == 0 && inventory[selectedItem].type == 3384)
29386 {
29387 altFunctionUse = 1;
29388 controlUseItem = true;
29389 }
29390 if (flag2 && altFunctionUse == 0 && inventory[selectedItem].type == 3858)
29391 {
29392 altFunctionUse = 1;
29393 controlUseItem = true;
29394 }
29395 if (flag2 && altFunctionUse == 0 && inventory[selectedItem].type == 4673)
29396 {
29397 altFunctionUse = 1;
29398 controlUseItem = true;
29399 }
29400 if (flag2 && altFunctionUse == 0 && inventory[selectedItem].type == 3852 && itemAnimation == 0)
29401 {
29402 altFunctionUse = 1;
29403 controlUseItem = true;
29404 }
29405 if (flag2 && altFunctionUse == 0 && inventory[selectedItem].shoot > 0 && ProjectileID.Sets.TurretFeature[inventory[selectedItem].shoot])
29406 {
29407 altFunctionUse = 1;
29408 controlUseItem = true;
29409 }
29410 if (flag2 && altFunctionUse == 0 && inventory[selectedItem].shoot > 0 && ProjectileID.Sets.MinionTargettingFeature[inventory[selectedItem].shoot])
29411 {
29412 altFunctionUse = 1;
29413 controlUseItem = true;
29414 }
29415 if (!controlUseItem && altFunctionUse == 1)
29416 {
29417 altFunctionUse = 0;
29418 }
29419 ItemCheck_ManageRightClickFeatures_ShieldRaise(flag);
29420 }
29421
29423 {
29424 bool mouseRight = PlayerInput.Triggers.JustPressed.MouseRight;
29425 if (whoAmI != Main.myPlayer)
29426 {
29427 mouseRight = shieldRaised;
29428 theGeneralCheck = shieldRaised;
29429 }
29430 bool shouldGuard = false;
29431 bool flag = inventory[selectedItem].type == 3823 || inventory[selectedItem].type == 4760;
29432 if (theGeneralCheck && flag && hasRaisableShield && !mount.Active && (itemAnimation == 0 || mouseRight))
29433 {
29434 shouldGuard = true;
29435 }
29436 if (shield_parry_cooldown > 0)
29437 {
29438 shield_parry_cooldown--;
29439 if (shield_parry_cooldown == 0)
29440 {
29441 SoundEngine.PlaySound(25, base.Center);
29442 for (int i = 0; i < 10; i++)
29443 {
29444 int num = Dust.NewDust(base.Center + new Vector2(direction * 6 + ((direction == -1) ? (-10) : 0), -14f), 10, 16, 45, 0f, 0f, 255, new Color(255, 100, 0, 127), (float)Main.rand.Next(10, 16) * 0.1f);
29445 Main.dust[num].noLight = true;
29446 Main.dust[num].noGravity = true;
29447 Main.dust[num].velocity *= 0.5f;
29448 }
29449 }
29450 }
29451 if (shieldParryTimeLeft > 0 && ++shieldParryTimeLeft > 20)
29452 {
29453 shieldParryTimeLeft = 0;
29454 }
29455 TryTogglingShield(shouldGuard);
29456 }
29457
29459 {
29460 if (shouldGuard == shieldRaised)
29461 {
29462 return;
29463 }
29464 shieldRaised = shouldGuard;
29465 if (shieldRaised)
29466 {
29467 if (shield_parry_cooldown == 0)
29468 {
29469 shieldParryTimeLeft = 1;
29470 }
29471 itemAnimation = 0;
29472 itemTime = 0;
29473 reuseDelay = 0;
29474 }
29475 else
29476 {
29477 shield_parry_cooldown = 15;
29478 shieldParryTimeLeft = 0;
29479 ApplyAttackCooldown(20);
29480 }
29481 }
29482
29483 private void HandleHotbar()
29484 {
29485 int num = PlayerInput.Triggers.Current.HotbarPlus.ToInt() - PlayerInput.Triggers.Current.HotbarMinus.ToInt();
29486 if (PlayerInput.CurrentProfile.HotbarAllowsRadial && num != 0 && PlayerInput.Triggers.Current.HotbarHoldTime > PlayerInput.CurrentProfile.HotbarRadialHoldTimeRequired && PlayerInput.CurrentProfile.HotbarRadialHoldTimeRequired != -1)
29487 {
29488 PlayerInput.MiscSettingsTEMP.HotbarRadialShouldBeUsed = true;
29489 PlayerInput.Triggers.Current.HotbarScrollCD = 2;
29490 }
29491 if (PlayerInput.CurrentProfile.HotbarRadialHoldTimeRequired != -1)
29492 {
29493 num = PlayerInput.Triggers.JustReleased.HotbarPlus.ToInt() - PlayerInput.Triggers.JustReleased.HotbarMinus.ToInt();
29494 if (PlayerInput.Triggers.Current.HotbarScrollCD == 1 && num != 0)
29495 {
29496 num = 0;
29497 }
29498 }
29499 if (PlayerInput.Triggers.Current.HotbarScrollCD == 0 && num != 0)
29500 {
29501 HotbarOffset += num;
29502 PlayerInput.Triggers.Current.HotbarScrollCD = 8;
29503 }
29505 {
29506 HotbarOffset += PlayerInput.ScrollWheelDelta / -120;
29507 }
29508 ScrollHotbar(HotbarOffset);
29509 HotbarOffset = 0;
29510 }
29511
29512 private void ItemCheckWrapped(int i)
29513 {
29514 int num;
29515 if (!controlLeft && !controlRight && !controlUp && !controlDown && PlayerInput.UsingGamepad && Main.SmartCursorIsUsed)
29516 {
29517 num = ((PlayerInput.GamepadThumbstickRight.Length() < 0.05f) ? 1 : 0);
29518 if (num != 0)
29519 {
29520 ForceForwardCursor(state: true);
29521 }
29522 }
29523 else
29524 {
29525 num = 0;
29526 }
29527 int num2;
29528 if (PlayerInput.smartSelectPointer.ShouldBeUsed())
29529 {
29530 num2 = ((!Main.SmartCursorIsUsed) ? 1 : 0);
29531 if (num2 != 0)
29532 {
29533 ForceSmartSelectCursor(state: true);
29534 }
29535 }
29536 else
29537 {
29538 num2 = 0;
29539 }
29541 int stack = inventory[selectedItem].stack;
29542 if (Main.ignoreErrors)
29543 {
29544 ItemCheck();
29545 }
29546 else
29547 {
29548 ItemCheck();
29549 }
29550 if (stack != inventory[selectedItem].stack)
29551 {
29553 }
29555 if (num2 != 0)
29556 {
29557 ForceSmartSelectCursor(state: false);
29558 }
29559 if (num != 0)
29560 {
29561 ForceForwardCursor(state: false);
29562 }
29563 if (itemAnimation == 0)
29564 {
29565 lastVisualizedSelectedItem = HeldItem.Clone();
29566 }
29567 }
29568
29569 private void ForceForwardCursor(bool state)
29570 {
29571 if (state != _forceForwardCursor)
29572 {
29573 _forceForwardCursor = state;
29574 if (state)
29575 {
29576 _inputMouseCoordsForward = new Point(PlayerInput.MouseX, PlayerInput.MouseY);
29577 _mainMouseCoordsForward = new Point(Main.mouseX, Main.mouseY);
29578 Point point = (base.Center - Main.screenPosition + new Vector2(direction * 200, 0f)).ToPoint();
29579 Main.mouseX = (PlayerInput.MouseX = point.X);
29580 Main.mouseY = (PlayerInput.MouseY = point.Y);
29581 }
29582 else
29583 {
29584 PlayerInput.MouseX = _inputMouseCoordsForward.X;
29585 PlayerInput.MouseY = _inputMouseCoordsForward.Y;
29586 Main.mouseX = _mainMouseCoordsForward.X;
29587 Main.mouseY = _mainMouseCoordsForward.Y;
29588 }
29589 }
29590 }
29591
29593 {
29594 if (state != _forceSmartSelectCursor)
29595 {
29596 _forceSmartSelectCursor = state;
29597 if (state)
29598 {
29599 _inputMouseCoordsSmartSelect = new Point(PlayerInput.MouseX, PlayerInput.MouseY);
29600 _mainMouseCoordsSmartSelect = new Point(Main.mouseX, Main.mouseY);
29601 _tileTargetSmartSelect = new Point(tileTargetX, tileTargetY);
29602 Point p = PlayerInput.smartSelectPointer.GetPointerPosition().ToPoint();
29603 Main.mouseX = (PlayerInput.MouseX = p.X);
29604 Main.mouseY = (PlayerInput.MouseY = p.Y);
29605 Point point = (p.ToVector2() + Main.screenPosition).ToTileCoordinates();
29606 tileTargetX = point.X;
29607 tileTargetY = point.Y;
29608 }
29609 else
29610 {
29611 PlayerInput.MouseX = _inputMouseCoordsSmartSelect.X;
29612 PlayerInput.MouseY = _inputMouseCoordsSmartSelect.Y;
29613 Main.mouseX = _mainMouseCoordsSmartSelect.X;
29614 Main.mouseY = _mainMouseCoordsSmartSelect.Y;
29615 tileTargetX = _tileTargetSmartSelect.X;
29616 tileTargetY = _tileTargetSmartSelect.Y;
29617 }
29618 }
29619 }
29620
29621 public void ScrollHotbar(int Offset)
29622 {
29623 Offset = ClampHotbarOffset(Offset);
29624 selectedItem += Offset;
29625 if (Offset != 0)
29626 {
29628 int num = selectedItem - Offset;
29629 DpadRadial.ChangeSelection(-1);
29630 CircularRadial.ChangeSelection(-1);
29631 selectedItem = num + Offset;
29632 nonTorch = -1;
29633 }
29634 if (changeItem >= 0)
29635 {
29636 if (selectedItem != changeItem)
29637 {
29639 }
29640 selectedItem = changeItem;
29641 changeItem = -1;
29642 }
29643 if (itemAnimation == 0 && selectedItem != 58)
29644 {
29645 while (selectedItem > 9)
29646 {
29647 selectedItem -= 10;
29648 }
29649 while (selectedItem < 0)
29650 {
29651 selectedItem += 10;
29652 }
29653 }
29654 }
29655
29656 private static int ClampHotbarOffset(int Offset)
29657 {
29658 while (Offset > 9)
29659 {
29660 Offset -= 10;
29661 }
29662 while (Offset < 0)
29663 {
29664 Offset += 10;
29665 }
29666 return Offset;
29667 }
29668
29670 {
29671 return _projectilesToInteractWith;
29672 }
29673
29675 {
29676 releaseUseTile = false;
29677 _lockTileInteractionsTimer = 3;
29678 PlayerInput.LockGamepadTileUseButton = true;
29679 }
29680
29682 {
29683 if (Main.netMode == 2 || Main.myPlayer != whoAmI || Main.mapFullscreen || Main.InGameUI.CurrentState == Main.BestiaryUI)
29684 {
29685 return;
29686 }
29687 int smartInteractX = tileTargetX;
29688 int smartInteractY = tileTargetY;
29690 {
29693 }
29694 bool flag = controlUseTile;
29696 {
29697 flag = false;
29698 }
29699 if (Main.gamePaused)
29700 {
29701 flag = false;
29702 }
29703 if (releaseUseTile)
29704 {
29705 tileInteractionHappened = false;
29706 }
29707 tileInteractAttempted = flag;
29708 if (tileInteractAttempted && releaseUseTile)
29709 {
29710 if (Main.instance.currentNPCShowingChatBubble > -1 && (talkNPC == -1 || !Main.npcChatRelease))
29711 {
29712 tileInteractAttempted = true;
29713 releaseUseTile = false;
29714 }
29716 {
29717 tileInteractAttempted = true;
29718 releaseUseTile = false;
29719 }
29720 }
29721 if (IsInTileInteractionRange(smartInteractX, smartInteractY, TileReachCheckSettings.Simple))
29722 {
29723 TileInteractionsCheckLongDistance(tileTargetX, tileTargetY);
29724 TileInteractionsCheck(smartInteractX, smartInteractY);
29725 }
29726 else
29727 {
29728 TileInteractionsCheckLongDistance(smartInteractX, smartInteractY);
29729 }
29730 TryInteractingWithMinecartTrackInNearbyArea(smartInteractX, smartInteractY);
29731 }
29732
29734 {
29735 if ((mount.Active && MountID.Sets.Cart[mount.Type]) || !botherWithUnaimedMinecartTracks || tileInteractionHappened || Main.SmartInteractShowingGenuine || Main.SmartInteractNPC != -1 || Main.SmartInteractProj != -1 || !WorldGen.InWorld(selectedTargetX, selectedTargetY, 10) || gravDir != 1f)
29736 {
29737 return;
29738 }
29739 int num = 2;
29740 for (int i = selectedTargetX - num; i <= selectedTargetX + num; i++)
29741 {
29742 for (int j = selectedTargetY - num; j <= selectedTargetY + num; j++)
29743 {
29744 if (!IsInTileInteractionRange(i, j, TileReachCheckSettings.Simple))
29745 {
29746 continue;
29747 }
29748 Tile tile = Main.tile[i, j];
29749 if (tile == null)
29750 {
29751 continue;
29752 }
29753 if (tile.active() && tile.type == 314)
29754 {
29755 if (!cursorItemIconEnabled)
29756 {
29757 noThrow = 2;
29758 cursorItemIconEnabled = true;
29759 cursorItemIconID = 2343;
29760 }
29761 if (tileInteractAttempted)
29762 {
29763 TileInteractionsCheck(i, j);
29764 }
29765 }
29766 if (tileInteractionHappened)
29767 {
29768 return;
29769 }
29770 }
29771 }
29772 }
29773
29775 {
29776 int num = (int)(((double)position.X + (double)width * 0.5) / 16.0);
29777 int num2 = (int)(((double)position.Y + (double)height * 0.5) / 16.0);
29778 Tile tile = Main.tile[interactX, interactY];
29779 settings.GetRanges(this, out var x, out var y);
29780 if (tile.type == 597)
29781 {
29782 if (interactX < num)
29783 {
29784 interactX += 2;
29785 }
29786 if (interactY < num2)
29787 {
29788 interactY += 3;
29789 }
29790 Point point = position.ToTileCoordinates();
29791 Point point2 = base.BottomRight.ToTileCoordinates();
29792 if (point2.X >= interactX - x + 1 && point.X <= interactX + x - 1 && point2.Y >= interactY - y + 2)
29793 {
29794 return point.Y <= interactY + y - 1;
29795 }
29796 return false;
29797 }
29798 if (tile.type == 475)
29799 {
29800 if (num >= interactX - x - 1 && num <= interactX + x + 2 && num2 >= interactY - y - 1)
29801 {
29802 return num2 <= interactY + y + 2;
29803 }
29804 return false;
29805 }
29806 if (tile.type == 470)
29807 {
29808 if (num >= interactX - x - 1 && num <= interactX + x + 1 && num2 >= interactY - y - 1)
29809 {
29810 return num2 <= interactY + y + 2;
29811 }
29812 return false;
29813 }
29815 {
29816 return num2 <= interactY + y + 1;
29817 }
29818 return false;
29819 }
29820
29822 {
29823 settings.GetRanges(this, out var x, out var y);
29824 if (position.X / 16f - (float)x <= (float)targetX && (position.X + (float)width) / 16f + (float)x - 1f >= (float)targetX && position.Y / 16f - (float)y <= (float)targetY)
29825 {
29826 return (position.Y + (float)height) / 16f + (float)y - 2f >= (float)targetY;
29827 }
29828 return false;
29829 }
29830
29831 public void TileInteractionsCheck(int myX, int myY)
29832 {
29833 if (Main.tile[myX, myY] == null)
29834 {
29835 Main.tile[myX, myY] = new Tile();
29836 }
29837 if (Main.tile[myX, myY].active())
29838 {
29839 TileInteractionsMouseOver(myX, myY);
29840 TileInteractionsUse(myX, myY);
29841 }
29842 }
29843
29845 {
29846 if (!WorldGen.InWorld(myX, myY, 10) || Main.tile[myX, myY] == null || !Main.tile[myX, myY].active())
29847 {
29848 return;
29849 }
29850 if (TileID.Sets.BasicChest[Main.tile[myX, myY].type])
29851 {
29852 TileInteractionsMouseOver_Containers(myX, myY);
29853 if (cursorItemIconText == "")
29854 {
29855 cursorItemIconEnabled = false;
29856 cursorItemIconID = 0;
29857 }
29858 }
29859 if (Main.tile[myX, myY].type == 88)
29860 {
29861 Tile tile = Main.tile[myX, myY];
29862 int num = myY;
29863 int x = myX - tile.frameX % 54 / 18;
29864 if (tile.frameY % 36 != 0)
29865 {
29866 num--;
29867 }
29868 int num2 = Chest.FindChest(x, num);
29869 cursorItemIconID = -1;
29870 if (num2 < 0)
29871 {
29872 cursorItemIconText = Lang.dresserType[0].Value;
29873 }
29874 else
29875 {
29876 if (Main.chest[num2].name != "")
29877 {
29878 cursorItemIconText = Main.chest[num2].name;
29879 }
29880 else
29881 {
29882 cursorItemIconText = Lang.dresserType[tile.frameX / 54].Value;
29883 }
29884 if (cursorItemIconText == Lang.dresserType[tile.frameX / 54].Value)
29885 {
29886 cursorItemIconID = Chest.dresserTypeToIcon[tile.frameX / 54];
29887 cursorItemIconText = "";
29888 }
29889 }
29890 noThrow = 2;
29891 cursorItemIconEnabled = true;
29892 if (cursorItemIconText == "")
29893 {
29894 cursorItemIconEnabled = false;
29895 cursorItemIconID = 0;
29896 }
29897 }
29898 if (Main.tileSign[Main.tile[myX, myY].type])
29899 {
29900 noThrow = 2;
29901 int num3 = Main.tile[myX, myY].frameX / 18;
29902 int num4 = Main.tile[myX, myY].frameY / 18;
29903 num3 %= 2;
29904 int num5 = myX - num3;
29905 int num6 = myY - num4;
29906 Main.signBubble = true;
29907 Main.signX = num5 * 16 + 16;
29908 Main.signY = num6 * 16;
29909 int num7 = Sign.ReadSign(num5, num6, CreateIfMissing: false);
29910 if (num7 != -1 && tileTargetX >= num5 && tileTargetY >= num6 && tileTargetX <= num5 + 1 && tileTargetY <= num6 + 1)
29911 {
29912 Main.signHover = num7;
29913 cursorItemIconEnabled = false;
29914 cursorItemIconID = -1;
29915 }
29916 }
29917 }
29918
29919 private void TileInteractionsUse(int myX, int myY)
29920 {
29921 if (WiresUI.Open || ownedProjectileCounts[651] > 0)
29922 {
29923 return;
29924 }
29925 bool flag = releaseUseTile;
29926 if (!tileInteractAttempted)
29927 {
29928 return;
29929 }
29930 bool flag2 = false;
29931 if (Main.tile[myX, myY].type == 212 && snowBallLauncherInteractionCooldown <= 0)
29932 {
29933 flag2 = true;
29934 snowBallLauncherInteractionCooldown = 7;
29936 int num = Main.tile[myX, myY].frameX / 18;
29937 int num2 = 0;
29938 while (num >= 3)
29939 {
29940 num2++;
29941 num -= 3;
29942 }
29943 num = myX - num;
29944 int num3;
29945 for (num3 = Main.tile[myX, myY].frameY / 18; num3 >= 3; num3 -= 3)
29946 {
29947 }
29948 num3 = myY - num3;
29949 float num4 = 12f + (float)Main.rand.Next(450) * 0.01f;
29950 float num5 = Main.rand.Next(85, 105);
29951 float num6 = Main.rand.Next(-35, 11);
29952 int type = 166;
29953 int damage = 35;
29954 float knockBack = 3.5f;
29955 Vector2 vector = new Vector2((num + 2) * 16 - 8, (num3 + 2) * 16 - 8 - 4);
29956 if (num2 == 0)
29957 {
29958 num5 *= -1f;
29959 vector.X -= 14f;
29960 vector.X -= 2f;
29961 }
29962 else
29963 {
29964 vector.X += 14f;
29965 }
29966 float num7 = num5;
29967 float num8 = num6;
29968 float num9 = (float)Math.Sqrt(num7 * num7 + num8 * num8);
29969 num9 = num4 / num9;
29970 num7 *= num9;
29971 num8 *= num9;
29972 int num10 = Projectile.NewProjectile(GetProjectileSource_TileInteraction(num, num3), vector.X, vector.Y, num7, num8, type, damage, knockBack, Main.myPlayer, -Main.rand.Next(0, 16));
29973 Main.projectile[num10].originatedFromActivableTile = true;
29974 }
29975 if (flag)
29976 {
29977 if (Main.tile[myX, myY].type == 132 || Main.tile[myX, myY].type == 136 || Main.tile[myX, myY].type == 144)
29978 {
29979 flag2 = true;
29981 NetMessage.SendData(59, -1, -1, null, myX, myY);
29982 }
29983 else if (Main.tile[myX, myY].type == 597)
29984 {
29985 flag2 = true;
29986 TryOpeningFullscreenMap();
29987 }
29988 else if (Main.tile[myX, myY].type == 441 || Main.tile[myX, myY].type == 468)
29989 {
29990 flag2 = true;
29991 int num11;
29992 for (num11 = Main.tile[myX, myY].frameX / 18; num11 > 1; num11 -= 2)
29993 {
29994 }
29995 num11 = myX - num11;
29996 int num12 = myY - Main.tile[myX, myY].frameY / 18;
30000 NetMessage.SendData(59, -1, -1, null, myX, myY);
30001 }
30002 else if (Main.tile[myX, myY].type == 139)
30003 {
30004 flag2 = true;
30005 SoundEngine.PlaySound(28, myX * 16, myY * 16, 0);
30007 }
30008 else if (Main.tile[myX, myY].type == 215)
30009 {
30010 flag2 = true;
30011 SoundEngine.PlaySound(28, myX * 16, myY * 16, 0);
30012 int num13 = Main.tile[myX, myY].frameX % 54 / 18;
30013 int num14 = Main.tile[myX, myY].frameY % 36 / 18;
30014 int num15 = myX - num13;
30015 int num16 = myY - num14;
30016 int num17 = 36;
30017 if (Main.tile[num15, num16].frameY >= 36)
30018 {
30019 num17 = -36;
30020 }
30021 for (int i = num15; i < num15 + 3; i++)
30022 {
30023 for (int j = num16; j < num16 + 2; j++)
30024 {
30025 Main.tile[i, j].frameY = (short)(Main.tile[i, j].frameY + num17);
30026 }
30027 }
30029 }
30030 else if (Main.tile[myX, myY].type == 207)
30031 {
30032 flag2 = true;
30033 SoundEngine.PlaySound(28, myX * 16, myY * 16, 0);
30035 }
30036 else if (Main.tile[myX, myY].type == 410 || Main.tile[myX, myY].type == 480 || Main.tile[myX, myY].type == 509 || Main.tile[myX, myY].type == 657 || Main.tile[myX, myY].type == 658)
30037 {
30038 flag2 = true;
30039 SoundEngine.PlaySound(28, myX * 16, myY * 16, 0);
30040 GamepadEnableGrappleCooldown();
30042 }
30043 else if (Main.tile[myX, myY].type == 455)
30044 {
30045 flag2 = true;
30046 SoundEngine.PlaySound(28, myX * 16, myY * 16, 0);
30047 GamepadEnableGrappleCooldown();
30049 }
30050 else if (Main.tile[myX, myY].type == 216)
30051 {
30052 flag2 = true;
30054 }
30055 else if (Main.tile[myX, myY].type == 386 || Main.tile[myX, myY].type == 387)
30056 {
30057 flag2 = true;
30058 bool flag3 = Main.tile[myX, myY].type == 387;
30059 int num18 = WorldGen.ShiftTrapdoor(myX, myY, (float)(myY * 16) > base.Center.Y).ToInt();
30060 if (num18 == 0)
30061 {
30062 num18 = -WorldGen.ShiftTrapdoor(myX, myY, (float)(myY * 16) <= base.Center.Y).ToInt();
30063 }
30064 if (num18 != 0)
30065 {
30066 NetMessage.SendData(19, -1, -1, null, 2 + (!flag3).ToInt(), myX, myY, num18 * Math.Sign((float)(myY * 16) - base.Center.Y));
30067 }
30068 }
30069 else if (Main.tile[myX, myY].type == 388 || Main.tile[myX, myY].type == 389)
30070 {
30071 flag2 = true;
30072 bool flag4 = Main.tile[myX, myY].type == 389;
30074 {
30075 NetMessage.SendData(19, -1, -1, null, 4 + flag4.ToInt(), myX, myY);
30076 }
30077 }
30078 else if (Main.tile[myX, myY].type == 15 || Main.tile[myX, myY].type == 497)
30079 {
30080 if (IsWithinSnappngRangeToTile(myX, myY, 40))
30081 {
30082 flag2 = true;
30083 GamepadEnableGrappleCooldown();
30084 sitting.SitDown(this, myX, myY);
30085 }
30086 }
30087 else if (Main.tile[myX, myY].type == 89 || Main.tile[myX, myY].type == 102 || Main.tile[myX, myY].type == 487)
30088 {
30089 if (IsWithinSnappngRangeToTile(myX, myY, 40))
30090 {
30091 flag2 = true;
30092 GamepadEnableGrappleCooldown();
30093 sitting.SitDown(this, myX, myY);
30094 }
30095 }
30096 else if (Main.tile[myX, myY].type == 335)
30097 {
30098 flag2 = true;
30100 }
30101 else if (Main.tile[myX, myY].type == 411 && Main.tile[myX, myY].frameX < 36)
30102 {
30103 flag2 = true;
30105 NetMessage.SendData(59, -1, -1, null, myX, myY);
30106 }
30107 else if (Main.tile[myX, myY].type == 494)
30108 {
30109 flag2 = true;
30110 for (int k = 0; k < 1000; k++)
30111 {
30112 if (ProjectileID.Sets.IsAGolfBall[Main.projectile[k].type] && Main.projectile[k].owner == whoAmI)
30113 {
30114 Main.projectile[k].Kill();
30115 }
30116 }
30117 GetPreferredGolfBallToUse(out var projType);
30118 Projectile.NewProjectile(GetProjectileSource_TileInteraction(myX, myY), (float)(myX * 16) + 8.5f, myY * 16 + 6, 0f, 0f, projType, 0, 0f, whoAmI, 0f, -1f);
30119 }
30120 else if (Main.tile[myX, myY].type == 338)
30121 {
30122 flag2 = true;
30123 int num19 = myY;
30124 if (Main.tile[myX, num19].frameY == 18)
30125 {
30126 num19--;
30127 }
30128 bool flag5 = false;
30129 for (int l = 0; l < 1000; l++)
30130 {
30131 if (Main.projectile[l].active && Main.projectile[l].aiStyle == 73 && Main.projectile[l].ai[0] == (float)myX && Main.projectile[l].ai[1] == (float)num19)
30132 {
30133 flag5 = true;
30134 break;
30135 }
30136 }
30137 if (!flag5)
30138 {
30139 int num20 = Projectile.NewProjectile(GetProjectileSource_TileInteraction(myX, num19), myX * 16 + 8, num19 * 16 + 2, 0f, 0f, 419 + Main.rand.Next(4), 0, 0f, whoAmI, myX, num19);
30140 Main.projectile[num20].originatedFromActivableTile = true;
30141 }
30142 }
30143 else if (Main.tile[myX, myY].type == 33 || Main.tile[myX, myY].type == 49 || Main.tile[myX, myY].type == 372 || Main.tile[myX, myY].type == 174 || Main.tile[myX, myY].type == 646)
30144 {
30145 short num21 = 18;
30146 Tile tile = Main.tile[myX, myY];
30147 if (tile.frameX > 0)
30148 {
30149 num21 = -18;
30150 }
30151 tile.frameX += num21;
30153 flag2 = true;
30154 GamepadEnableGrappleCooldown();
30155 }
30156 else if (Main.tile[myX, myY].type == 4 || Main.tile[myX, myY].type == 13 || (Main.tile[myX, myY].type == 50 && Main.tile[myX, myY].frameX == 90))
30157 {
30159 if (Main.netMode == 1)
30160 {
30161 NetMessage.SendData(17, -1, -1, null, 0, myX, myY);
30162 }
30163 flag2 = true;
30164 GamepadEnableGrappleCooldown();
30165 }
30166 else if (Main.tile[myX, myY].type == 466)
30167 {
30168 flag2 = true;
30169 GamepadEnableGrappleCooldown();
30170 int num22 = myY;
30172 if (tileSafely.frameY == 0)
30173 {
30174 num22 += 3;
30175 }
30176 if (tileSafely.frameY == 18)
30177 {
30178 num22 += 2;
30179 }
30180 if (tileSafely.frameY == 36)
30181 {
30182 num22++;
30183 }
30184 if (DD2Event.Ongoing)
30185 {
30187 }
30188 else
30189 {
30190 bool flag6 = !DD2Event.Ongoing && !NPC.AnyNPCs(548) && !Main.pumpkinMoon && !Main.snowMoon;
30191 if (flag6)
30192 {
30193 flag6 = HasItem(3828);
30194 }
30195 if (flag6)
30196 {
30198 if (!flag6)
30199 {
30201 }
30202 }
30203 if (flag6)
30204 {
30205 flag6 = ConsumeItem(3828, reverseOrder: true);
30206 }
30207 if (flag6)
30208 {
30209 DD2Event.SummonCrystal(myX, num22, whoAmI);
30210 }
30211 }
30212 }
30213 else if (Main.tile[myX, myY].type == 334)
30214 {
30215 flag2 = true;
30216 if (ItemFitsWeaponRack(inventory[selectedItem]))
30217 {
30218 GamepadEnableGrappleCooldown();
30219 PlaceWeapon(myX, myY);
30220 }
30221 else
30222 {
30223 int num23 = myX;
30224 int num24 = myY;
30225 if (Main.tile[myX, myY].frameY == 0)
30226 {
30227 num24++;
30228 }
30229 if (Main.tile[myX, myY].frameY == 36)
30230 {
30231 num24--;
30232 }
30233 int frameX = Main.tile[myX, num24].frameX;
30234 int num25 = Main.tile[myX, num24].frameX;
30235 int num26 = 0;
30236 while (num25 >= 5000)
30237 {
30238 num25 -= 5000;
30239 num26++;
30240 }
30241 if (num26 != 0)
30242 {
30243 num25 = (num26 - 1) * 18;
30244 }
30245 num25 %= 54;
30246 if (num25 == 18)
30247 {
30248 frameX = Main.tile[myX - 1, num24].frameX;
30249 num23--;
30250 }
30251 if (num25 == 36)
30252 {
30253 frameX = Main.tile[myX - 2, num24].frameX;
30254 num23 -= 2;
30255 }
30256 if (frameX >= 5000)
30257 {
30258 GamepadEnableGrappleCooldown();
30259 WorldGen.KillTile(myX, num24, fail: true);
30260 if (Main.netMode == 1)
30261 {
30262 NetMessage.SendData(17, -1, -1, null, 0, myX, num24, 1f);
30263 }
30264 }
30265 }
30266 }
30267 else if (Main.tile[myX, myY].type == 440)
30268 {
30269 flag2 = true;
30270 int num27 = Main.tile[myX, myY].frameX / 54;
30271 int num28 = Main.tile[myX, myY].frameY / 54;
30272 _ = Main.tile[myX, myY].frameX % 54 / 18;
30273 _ = Main.tile[myX, myY].frameY % 54 / 18;
30274 int num29 = -1;
30275 switch (num27)
30276 {
30277 case 0:
30278 num29 = 1526;
30279 break;
30280 case 1:
30281 num29 = 1524;
30282 break;
30283 case 2:
30284 num29 = 1525;
30285 break;
30286 case 3:
30287 num29 = 1523;
30288 break;
30289 case 4:
30290 num29 = 1522;
30291 break;
30292 case 5:
30293 num29 = 1527;
30294 break;
30295 case 6:
30296 num29 = 3643;
30297 break;
30298 }
30299 if (num29 != -1)
30300 {
30301 if (num28 == 0 && HasItem(num29) && selectedItem != 58)
30302 {
30303 GamepadEnableGrappleCooldown();
30304 if (Main.netMode != 1)
30305 {
30306 ConsumeItem(num29);
30307 WorldGen.ToggleGemLock(myX, myY, on: true);
30308 }
30309 else
30310 {
30311 ConsumeItem(num29);
30312 NetMessage.SendData(105, -1, -1, null, myX, myY, 1f);
30313 }
30314 }
30315 else if (num28 == 1)
30316 {
30317 GamepadEnableGrappleCooldown();
30318 if (Main.netMode != 1)
30319 {
30320 WorldGen.ToggleGemLock(myX, myY, on: false);
30321 }
30322 else
30323 {
30324 NetMessage.SendData(105, -1, -1, null, myX, myY);
30325 }
30326 }
30327 }
30328 }
30329 else if (Main.tile[myX, myY].type == 395)
30330 {
30331 flag2 = true;
30333 }
30334 else if (Main.tile[myX, myY].type == 520)
30335 {
30336 flag2 = true;
30338 }
30339 else if (Main.tile[myX, myY].type == 471)
30340 {
30341 flag2 = true;
30343 }
30344 else if (Main.tile[myX, myY].type == 470)
30345 {
30346 flag2 = true;
30348 }
30349 else if (Main.tile[myX, myY].type == 475)
30350 {
30351 flag2 = true;
30353 }
30354 else if (Main.tile[myX, myY].type == 125)
30355 {
30356 flag2 = true;
30357 AddBuff(29, 108000);
30359 }
30360 else if (Main.tile[myX, myY].type == 621)
30361 {
30362 flag2 = true;
30363 AddBuff(192, 7200);
30365 }
30366 else if (Main.tile[myX, myY].type == 464)
30367 {
30368 flag2 = true;
30369 AddBuff(348, 108000);
30371 }
30372 else if (Main.tile[myX, myY].type == 377)
30373 {
30374 flag2 = true;
30375 AddBuff(159, 108000);
30377 }
30378 else if (Main.tile[myX, myY].type == 354)
30379 {
30380 flag2 = true;
30381 AddBuff(150, 108000);
30383 }
30384 else if (Main.tile[myX, myY].type == 287)
30385 {
30386 flag2 = true;
30387 AddBuff(93, 108000);
30389 }
30390 else if (Main.tile[myX, myY].type == 356)
30391 {
30392 flag2 = true;
30394 {
30395 Main.Sundialing();
30397 }
30398 }
30399 else if (Main.tile[myX, myY].type == 663)
30400 {
30401 flag2 = true;
30403 {
30404 Main.Moondialing();
30406 }
30407 }
30408 else if (Main.tile[myX, myY].type == 79)
30409 {
30410 flag2 = true;
30411 int num30 = myX;
30412 int num31 = myY;
30413 num30 += Main.tile[myX, myY].frameX / 18 * -1;
30414 if (Main.tile[myX, myY].frameX >= 72)
30415 {
30416 num30 += 4;
30417 num30++;
30418 }
30419 else
30420 {
30421 num30 += 2;
30422 }
30423 int num32 = Main.tile[myX, myY].frameY / 18;
30424 int num33 = 0;
30425 while (num32 > 1)
30426 {
30427 num32 -= 2;
30428 num33++;
30429 }
30430 num31 -= num32;
30431 num31 += 2;
30432 if (!IsHoveringOverABottomSideOfABed(myX, myY))
30433 {
30434 if (IsWithinSnappngRangeToTile(myX, myY, 96))
30435 {
30436 flag2 = true;
30437 GamepadEnableGrappleCooldown();
30438 sleeping.StartSleeping(this, myX, myY);
30439 }
30440 }
30441 else
30442 {
30443 FindSpawn();
30444 if (SpawnX == num30 && SpawnY == num31)
30445 {
30446 RemoveSpawn();
30447 Main.NewText(Language.GetTextValue("Game.SpawnPointRemoved"), byte.MaxValue, 240, 20);
30448 }
30449 else if (CheckSpawn(num30, num31))
30450 {
30451 ChangeSpawn(num30, num31);
30452 Main.NewText(Language.GetTextValue("Game.SpawnPointSet"), byte.MaxValue, 240, 20);
30453 }
30454 }
30455 }
30456 else if (Main.tileSign[Main.tile[myX, myY].type])
30457 {
30458 flag2 = true;
30459 bool flag7 = true;
30460 if (sign >= 0 && Sign.ReadSign(myX, myY, CreateIfMissing: false) == sign)
30461 {
30462 sign = -1;
30463 Main.npcChatText = "";
30464 Main.editSign = false;
30466 flag7 = false;
30467 }
30468 if (flag7)
30469 {
30470 if (Main.netMode == 0)
30471 {
30472 SetTalkNPC(-1);
30473 Main.npcChatCornerItem = 0;
30474 Main.playerInventory = false;
30475 Main.editSign = false;
30476 int num34 = Sign.ReadSign(myX, myY);
30477 if (num34 < 0)
30478 {
30479 return;
30480 }
30482 sign = num34;
30483 Main.npcChatText = Main.sign[num34].text;
30484 }
30485 else
30486 {
30487 int num35 = Main.tile[myX, myY].frameX / 18;
30488 int num36 = Main.tile[myX, myY].frameY / 18;
30489 while (num35 > 1)
30490 {
30491 num35 -= 2;
30492 }
30493 int num37 = myX - num35;
30494 int num38 = myY - num36;
30495 if (Main.tileSign[Main.tile[num37, num38].type])
30496 {
30497 NetMessage.SendData(46, -1, -1, null, num37, num38);
30498 }
30499 }
30500 }
30501 }
30502 else if (Main.tile[myX, myY].type == 104)
30503 {
30504 flag2 = true;
30505 string textValue = Language.GetTextValue("GameUI.TimeAtMorning");
30506 double num39 = Main.time;
30507 if (!Main.dayTime)
30508 {
30509 num39 += 54000.0;
30510 }
30511 num39 = num39 / 86400.0 * 24.0;
30512 double num40 = 7.5;
30513 num39 = num39 - num40 - 12.0;
30514 if (num39 < 0.0)
30515 {
30516 num39 += 24.0;
30517 }
30518 if (num39 >= 12.0)
30519 {
30520 textValue = Language.GetTextValue("GameUI.TimePastMorning");
30521 }
30522 int num41 = (int)num39;
30523 double num42 = (int)((num39 - (double)num41) * 60.0);
30524 string text = string.Concat(num42);
30525 if (num42 < 10.0)
30526 {
30527 text = "0" + text;
30528 }
30529 if (num41 > 12)
30530 {
30531 num41 -= 12;
30532 }
30533 if (num41 == 0)
30534 {
30535 num41 = 12;
30536 }
30537 Main.NewText(Language.GetTextValue("Game.Time", num41 + ":" + text + " " + textValue), byte.MaxValue, 240, 20);
30538 }
30539 else if (Main.tile[myX, myY].type == 237)
30540 {
30541 flag2 = true;
30542 bool flag8 = false;
30543 if (!NPC.AnyNPCs(245) && Main.hardMode && NPC.downedPlantBoss)
30544 {
30545 for (int m = 0; m < 58; m++)
30546 {
30547 if (inventory[m].type == 1293)
30548 {
30549 inventory[m].stack--;
30550 if (inventory[m].stack <= 0)
30551 {
30552 inventory[m].SetDefaults();
30553 }
30554 flag8 = true;
30555 break;
30556 }
30557 }
30558 }
30559 if (flag8)
30560 {
30561 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
30562 if (Main.netMode != 1)
30563 {
30564 NPC.SpawnOnPlayer(whoAmI, 245);
30565 }
30566 else
30567 {
30568 NetMessage.SendData(61, -1, -1, null, whoAmI, 245f);
30569 }
30570 }
30571 }
30572 else if (Main.tile[myX, myY].type == 10)
30573 {
30574 flag2 = true;
30576 {
30577 int num43 = 1141;
30578 bool flag9 = false;
30579 for (int n = 0; n < 58; n++)
30580 {
30581 if (inventory[n].type == num43 && inventory[n].stack > 0)
30582 {
30583 flag9 = true;
30584 inventory[n].stack--;
30585 if (inventory[n].stack <= 0)
30586 {
30587 inventory[n] = new Item();
30588 }
30590 if (Main.netMode == 1)
30591 {
30592 NetMessage.SendData(52, -1, -1, null, whoAmI, 2f, myX, myY);
30593 }
30594 }
30595 }
30596 if (!flag9 && useVoidBag())
30597 {
30598 for (int num44 = 0; num44 < 40; num44++)
30599 {
30600 if (bank4.item[num44].type == num43 && bank4.item[num44].stack > 0)
30601 {
30602 bank4.item[num44].stack--;
30603 if (bank4.item[num44].stack <= 0)
30604 {
30605 bank4.item[num44] = new Item();
30606 }
30608 if (Main.netMode == 1)
30609 {
30610 NetMessage.SendData(52, -1, -1, null, whoAmI, 2f, myX, myY);
30611 }
30612 }
30613 }
30614 }
30615 }
30616 else
30617 {
30618 WorldGen.OpenDoor(myX, myY, direction);
30619 if (Main.tile[myX, myY].type != 10)
30620 {
30621 NetMessage.SendData(19, -1, -1, null, 0, myX, myY, direction);
30622 }
30623 else
30624 {
30625 WorldGen.OpenDoor(myX, myY, -direction);
30626 if (Main.tile[myX, myY].type != 10)
30627 {
30628 NetMessage.SendData(19, -1, -1, null, 0, myX, myY, -direction);
30629 }
30630 }
30631 }
30632 }
30633 else if (Main.tile[myX, myY].type == 11)
30634 {
30635 flag2 = true;
30636 if (WorldGen.CloseDoor(myX, myY))
30637 {
30638 NetMessage.SendData(19, -1, -1, null, 1, myX, myY, direction);
30639 }
30640 }
30641 else if (Main.tile[myX, myY].type == 88)
30642 {
30643 flag2 = true;
30644 int num45 = Main.tile[myX, myY].frameX / 18;
30645 num45 %= 3;
30646 num45 = myX - num45;
30647 int num46 = myY - Main.tile[myX, myY].frameY / 18;
30648 if (Main.tile[myX, myY].frameY == 0)
30649 {
30651 Main.mouseRightRelease = false;
30652 CloseSign();
30653 SetTalkNPC(-1);
30654 Main.npcChatCornerItem = 0;
30655 Main.npcChatText = "";
30656 if (Main.editChest)
30657 {
30659 Main.editChest = false;
30660 Main.npcChatText = string.Empty;
30661 }
30662 if (editedChestName)
30663 {
30664 NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[chest].name), chest, 1f);
30665 editedChestName = false;
30666 }
30667 if (Main.netMode == 1)
30668 {
30669 if (num45 == chestX && num46 == chestY && chest != -1)
30670 {
30671 chest = -1;
30674 }
30675 else
30676 {
30677 NetMessage.SendData(31, -1, -1, null, num45, num46);
30678 Main.stackSplit = 600;
30679 }
30680 }
30681 else
30682 {
30683 piggyBankProjTracker.Clear();
30684 voidLensChest.Clear();
30686 if (num47 != -1)
30687 {
30688 Main.stackSplit = 600;
30689 if (num47 == chest)
30690 {
30691 chest = -1;
30694 }
30695 else if (num47 != chest && chest == -1)
30696 {
30697 OpenChest(num45, num46, num47);
30699 }
30700 else
30701 {
30702 OpenChest(num45, num46, num47);
30704 }
30706 }
30707 }
30708 }
30709 else
30710 {
30711 Main.playerInventory = false;
30712 chest = -1;
30714 SetTalkNPC(-1);
30715 Main.npcChatCornerItem = 0;
30716 Main.npcChatText = "";
30717 Main.interactedDresserTopLeftX = num45;
30718 Main.interactedDresserTopLeftY = num46;
30720 }
30721 }
30722 else if (Main.tile[myX, myY].type == 209)
30723 {
30724 flag2 = true;
30725 Tile tile2 = Main.tile[myX, myY];
30726 int num48 = tile2.frameX % 72 / 18;
30727 int num49 = tile2.frameY % 54 / 18;
30728 int num50 = myX - num48;
30729 int num51 = myY - num49;
30730 int num52 = tile2.frameY / 54;
30731 int num53 = tile2.frameX / 72;
30732 int num54 = -1;
30733 if (num48 == 1 || num48 == 2)
30734 {
30735 num54 = num49;
30736 }
30737 int num55 = 0;
30738 if (num48 == 3 || (num48 == 2 && num53 != 3 && num53 != 4))
30739 {
30740 num55 = -54;
30741 }
30742 if (num48 == 0 || (num48 == 1 && num53 != 3 && num53 != 4))
30743 {
30744 num55 = 54;
30745 }
30746 if (num52 >= 8 && num55 > 0)
30747 {
30748 num55 = 0;
30749 }
30750 if (num52 == 0 && num55 < 0)
30751 {
30752 num55 = 0;
30753 }
30754 bool flag10 = false;
30755 if (num55 != 0)
30756 {
30757 for (int num56 = num50; num56 < num50 + 4; num56++)
30758 {
30759 for (int num57 = num51; num57 < num51 + 3; num57++)
30760 {
30761 Main.tile[num56, num57].frameY = (short)(Main.tile[num56, num57].frameY + num55);
30762 }
30763 }
30764 flag10 = true;
30765 }
30766 if ((num53 == 3 || num53 == 4) && (num54 == 1 || num54 == 0))
30767 {
30768 num55 = ((num53 == 3) ? 72 : (-72));
30769 for (int num58 = num50; num58 < num50 + 4; num58++)
30770 {
30771 for (int num59 = num51; num59 < num51 + 3; num59++)
30772 {
30773 Main.tile[num58, num59].frameX = (short)(Main.tile[num58, num59].frameX + num55);
30774 }
30775 }
30776 flag10 = true;
30777 }
30778 if (flag10)
30779 {
30781 }
30782 if (num54 != -1)
30783 {
30784 bool flag11 = false;
30785 if ((num53 == 3 || num53 == 4) && num54 == 2)
30786 {
30787 flag11 = true;
30788 }
30789 if (flag11)
30790 {
30791 WorldGen.ShootFromCannon(num50, num51, num52, num53 + 1, 0, 0f, whoAmI, fromWire: false);
30792 }
30793 }
30794 }
30795 else if (Main.tile[myX, myY].type == 510 || Main.tile[myX, myY].type == 511)
30796 {
30797 flag2 = true;
30798 Tile tile3 = Main.tile[myX, myY];
30799 int num60 = tile3.frameX % 36 / 18;
30800 int num61 = tile3.frameY % 36 / 18;
30801 int num62 = myX - num60;
30802 int num63 = myY - num61;
30803 int num64 = tile3.frameY / 36;
30804 _ = tile3.frameX / 36;
30805 int num65 = 0;
30806 if (num60 == 0)
30807 {
30808 num65 = -36;
30809 }
30810 if (num60 == 1)
30811 {
30812 num65 = 36;
30813 }
30814 if (num64 >= 7 && num65 > 0)
30815 {
30816 num65 = -252;
30817 }
30818 if (num64 == 0 && num65 < 0)
30819 {
30820 num65 = 252;
30821 }
30822 bool flag12 = false;
30823 if (num65 != 0)
30824 {
30825 for (int num66 = num62; num66 < num62 + 2; num66++)
30826 {
30827 for (int num67 = num63; num67 < num63 + 2; num67++)
30828 {
30829 Main.tile[num66, num67].frameY = (short)(Main.tile[num66, num67].frameY + num65);
30830 }
30831 }
30832 flag12 = true;
30833 }
30834 if (flag12)
30835 {
30837 }
30838 }
30839 else if (TileID.Sets.BasicChest[Main.tile[myX, myY].type] || Main.tile[myX, myY].type == 29 || Main.tile[myX, myY].type == 97 || Main.tile[myX, myY].type == 463 || Main.tile[myX, myY].type == 491)
30840 {
30841 flag2 = true;
30842 Main.mouseRightRelease = false;
30843 int num68 = 0;
30844 int num69;
30845 for (num69 = Main.tile[myX, myY].frameX / 18; num69 > 1; num69 -= 2)
30846 {
30847 }
30848 num69 = myX - num69;
30849 int num70 = myY - Main.tile[myX, myY].frameY / 18;
30850 if (Main.tile[myX, myY].type == 29)
30851 {
30852 num68 = 1;
30853 }
30854 else if (Main.tile[myX, myY].type == 97)
30855 {
30856 num68 = 2;
30857 }
30858 else if (Main.tile[myX, myY].type == 463)
30859 {
30860 num68 = 3;
30861 num69 = ((Main.tile[myX, myY].frameX != 36) ? (num69 + 1) : (num69 - 1));
30862 num70 += 2;
30863 }
30864 else if (Main.tile[myX, myY].type == 491)
30865 {
30866 num68 = 4;
30867 num69 = ((Main.tile[myX, myY].frameX != 36) ? (num69 + 1) : (num69 - 1));
30868 num70 += 2;
30869 }
30870 CloseSign();
30871 SetTalkNPC(-1);
30872 Main.npcChatCornerItem = 0;
30873 Main.npcChatText = "";
30874 if (Main.editChest)
30875 {
30877 Main.editChest = false;
30878 Main.npcChatText = string.Empty;
30879 }
30880 if (editedChestName)
30881 {
30882 NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(Main.chest[chest].name), chest, 1f);
30883 editedChestName = false;
30884 }
30886 if (Main.netMode == 1 && num68 == 0 && !flag13)
30887 {
30888 if (num69 == chestX && num70 == chestY && chest != -1)
30889 {
30890 chest = -1;
30893 }
30894 else
30895 {
30897 {
30898 _framesLeftEligibleForDeadmansChestDeathAchievement = 600;
30899 }
30900 NetMessage.SendData(31, -1, -1, null, num69, num70);
30901 Main.stackSplit = 600;
30902 }
30903 }
30904 else
30905 {
30906 int num71 = -1;
30907 switch (num68)
30908 {
30909 case 1:
30910 num71 = -2;
30911 break;
30912 case 2:
30913 num71 = -3;
30914 break;
30915 case 3:
30916 num71 = -4;
30917 break;
30918 case 4:
30919 if (disableVoidBag < 0)
30920 {
30921 num71 = -5;
30922 }
30923 break;
30924 default:
30925 {
30926 bool flag14 = false;
30927 if (Chest.IsLocked(num69, num70))
30928 {
30929 int type2 = Main.tile[num69, num70].type;
30930 int num72 = 327;
30931 switch (type2)
30932 {
30933 case 21:
30934 if (Main.tile[num69, num70].frameX >= 144 && Main.tile[num69, num70].frameX <= 178)
30935 {
30936 num72 = 329;
30937 }
30938 if (Main.tile[num69, num70].frameX >= 828 && Main.tile[num69, num70].frameX <= 1006)
30939 {
30940 int num74 = Main.tile[num69, num70].frameX / 18;
30941 int num75 = 0;
30942 while (num74 >= 2)
30943 {
30944 num74 -= 2;
30945 num75++;
30946 }
30947 num75 -= 23;
30948 num72 = 1533 + num75;
30949 }
30950 break;
30951 case 467:
30952 {
30953 int num73 = Main.tile[num69, num70].frameX / 36;
30954 if (num73 == 13)
30955 {
30956 num72 = 4714;
30957 }
30958 break;
30959 }
30960 }
30961 flag14 = true;
30962 bool flag15 = false;
30963 bool flag16 = num72 != 329;
30964 for (int num76 = 0; num76 < 58; num76++)
30965 {
30966 if (inventory[num76].type != num72 || inventory[num76].stack <= 0 || !Chest.Unlock(num69, num70))
30967 {
30968 continue;
30969 }
30970 flag15 = true;
30971 if (flag16)
30972 {
30973 inventory[num76].stack--;
30974 if (inventory[num76].stack <= 0)
30975 {
30976 inventory[num76] = new Item();
30977 }
30978 }
30979 if (Main.netMode == 1)
30980 {
30981 NetMessage.SendData(52, -1, -1, null, whoAmI, 1f, num69, num70);
30982 }
30983 }
30984 if (!flag15 && useVoidBag())
30985 {
30986 for (int num77 = 0; num77 < 40; num77++)
30987 {
30988 if (bank4.item[num77].type != num72 || bank4.item[num77].stack <= 0 || !Chest.Unlock(num69, num70))
30989 {
30990 continue;
30991 }
30992 if (num72 != 329)
30993 {
30994 bank4.item[num77].stack--;
30995 if (bank4.item[num77].stack <= 0)
30996 {
30997 bank4.item[num77] = new Item();
30998 }
30999 }
31000 if (Main.netMode == 1)
31001 {
31002 NetMessage.SendData(52, -1, -1, null, whoAmI, 1f, num69, num70);
31003 }
31004 }
31005 }
31006 }
31007 if (!flag14)
31008 {
31010 }
31011 break;
31012 }
31013 }
31014 if (num71 != -1)
31015 {
31016 Main.stackSplit = 600;
31018 if (num71 == chest)
31019 {
31020 chest = -1;
31022 }
31023 else if (num71 != chest && chest == -1)
31024 {
31025 OpenChest(num69, num70, num71);
31027 if (Main.tile[num69, num70].frameX >= 36 && Main.tile[num69, num70].frameX < 72)
31028 {
31030 }
31031 }
31032 else
31033 {
31034 OpenChest(num69, num70, num71);
31036 }
31037 if (num78)
31038 {
31040 NetMessage.SendData(59, -1, -1, null, myX, myY);
31041 _framesLeftEligibleForDeadmansChestDeathAchievement = 600;
31042 }
31044 }
31045 }
31046 }
31047 else if (Main.tile[myX, myY].type == 314 && gravDir == 1f)
31048 {
31049 flag2 = true;
31050 bool flag17 = true;
31051 if (mount.Active)
31052 {
31053 if (mount.Cart)
31054 {
31055 flag17 = false;
31056 }
31057 else
31058 {
31059 mount.Dismount(this);
31060 }
31061 }
31062 if (flag17)
31063 {
31064 LaunchMinecartHook(myX, myY);
31065 }
31066 }
31067 }
31068 if (flag2)
31069 {
31070 tileInteractionHappened = true;
31071 }
31072 }
31073
31074 private static bool IsHoveringOverABottomSideOfABed(int myX, int myY)
31075 {
31076 short frameX = Main.tile[myX, myY].frameX;
31077 bool flag = frameX / 72 == 1;
31078 bool flag2 = frameX % 72 < 36;
31079 if (flag)
31080 {
31081 flag2 = !flag2;
31082 }
31083 return flag2;
31084 }
31085
31086 public void PetAnimal(int animalNpcIndex)
31087 {
31091 bool flag = CanSnapToPosition(offset);
31093 {
31094 flag = false;
31095 }
31096 if (!flag)
31097 {
31098 return;
31099 }
31100 if (isPettingAnimal && base.Bottom == playerPositionWhenPetting)
31101 {
31102 StopPettingAnimal();
31103 return;
31104 }
31105 StopVanityActions();
31106 RemoveAllGrapplingHooks();
31107 if (mount.Active)
31108 {
31109 mount.Dismount(this);
31110 }
31111 base.Bottom = playerPositionWhenPetting;
31112 ChangeDir(targetDirection);
31113 isPettingAnimal = true;
31114 isTheAnimalBeingPetSmall = isPetSmall;
31115 velocity = Vector2.Zero;
31116 gravDir = 1f;
31117 if (whoAmI == Main.myPlayer)
31118 {
31120 }
31121 }
31122
31124 {
31126 targetDirection = ((nPC.Center.X > base.Center.X) ? 1 : (-1));
31127 int num = 36;
31128 isPetSmall = false;
31129 switch (nPC.type)
31130 {
31131 case 637:
31132 isPetSmall = true;
31133 num = 28;
31134 break;
31135 case 656:
31136 isPetSmall = true;
31137 num = 24;
31138 break;
31139 case 670:
31140 case 678:
31141 case 679:
31142 case 680:
31143 case 681:
31144 case 683:
31145 isPetSmall = true;
31146 num = 26;
31147 break;
31148 case 682:
31149 isPetSmall = true;
31150 num = 22;
31151 break;
31152 case 684:
31153 isPetSmall = true;
31154 num = 20;
31155 break;
31156 }
31157 playerPositionWhenPetting = nPC.Bottom + new Vector2(-targetDirection * num, 0f);
31158 }
31159
31161 {
31162 if (Collision.SolidCollision(position + offset, width, height))
31163 {
31164 return false;
31165 }
31166 bool canSnapToPosition = Collision.CanHit(position, width, height, position + offset, width, height);
31167 if (!canSnapToPosition)
31168 {
31169 TryAllowingSnappingToPosition(ref canSnapToPosition, position, position + offset);
31170 if (!canSnapToPosition)
31171 {
31172 int num = Math.Sign(offset.X);
31173 if (num != 0)
31174 {
31175 Vector2 vector = new Vector2(num * width, 0f);
31176 if (Collision.TileCollision(position, vector, width, height, fallThrough: true, fall2: true, (int)gravDir) == vector)
31177 {
31178 TryAllowingSnappingToPosition(ref canSnapToPosition, position + vector, position + offset);
31179 }
31180 }
31181 }
31182 }
31183 return canSnapToPosition;
31184 }
31185
31187 {
31188 Vector2 vector = new Vector2(width - 2, 0f);
31189 canSnapToPosition = Collision.CanHit(pos1 + vector, 2, height, pos2, 2, height);
31190 if (!canSnapToPosition)
31191 {
31192 canSnapToPosition = Collision.CanHit(pos1 + vector, 2, height, pos2 + vector, 2, height);
31193 }
31194 if (!canSnapToPosition)
31195 {
31196 canSnapToPosition = Collision.CanHit(pos1, 2, height, pos2, 2, height);
31197 }
31198 if (!canSnapToPosition)
31199 {
31200 canSnapToPosition = Collision.CanHit(pos1, 2, height, pos2 + vector, 2, height);
31201 }
31202 }
31203
31205 {
31206 StopPettingAnimal();
31207 sitting.SitUp(this, multiplayerBroadcast);
31208 sleeping.StopSleeping(this, multiplayerBroadcast);
31209 }
31210
31211 private void StopPettingAnimal()
31212 {
31213 isPettingAnimal = false;
31214 isTheAnimalBeingPetSmall = false;
31215 }
31216
31217 private void UpdatePettingAnimal()
31218 {
31219 if (!isPettingAnimal)
31220 {
31221 return;
31222 }
31223 if (talkNPC == -1)
31224 {
31225 StopPettingAnimal();
31226 return;
31227 }
31228 int num = Math.Sign(Main.npc[talkNPC].Center.X - base.Center.X);
31229 if (controlLeft || controlRight || controlUp || controlDown || controlJump || pulley || mount.Active || num != direction)
31230 {
31231 StopPettingAnimal();
31232 return;
31233 }
31234 GetPettingInfo(talkNPC, out var _, out var playerPositionWhenPetting, out var _);
31235 if (base.Bottom.Distance(playerPositionWhenPetting) > 2f)
31236 {
31237 StopPettingAnimal();
31238 }
31239 }
31240
31241 private void OpenChest(int x, int y, int newChest)
31242 {
31243 if (chest != -1 && Main.myPlayer == whoAmI)
31244 {
31245 for (int i = 0; i < 40; i++)
31246 {
31247 ItemSlot.SetGlow(i, -1f, chest: true);
31248 }
31249 }
31250 chest = newChest;
31251 Main.playerInventory = true;
31254 {
31255 PlayerInput.Triggers.JustPressed.Grapple = false;
31256 }
31257 Main.recBigList = false;
31258 chestX = x;
31259 chestY = y;
31260 }
31261
31262 public void CloseSign()
31263 {
31264 if (sign > -1)
31265 {
31267 sign = -1;
31268 Main.editSign = false;
31269 Main.npcChatText = string.Empty;
31270 }
31271 }
31272
31273 private void LaunchMinecartHook(int myX, int myY)
31274 {
31276 vector = new Vector2(myX * 16 + 8, myY * 16 + 8);
31277 if (direction > 0)
31278 {
31279 minecartLeft = false;
31280 }
31281 else
31282 {
31283 minecartLeft = true;
31284 }
31285 RemoveAllGrapplingHooks();
31286 Projectile.NewProjectile(GetProjectileSource_TileInteraction(myX, myY), vector.X, vector.Y, 0f, 0f, 403, 0, 0f, whoAmI);
31287 releaseHook = false;
31288 }
31289
31291 {
31292 ClearGrapplingBlacklist();
31293 grappling[0] = -1;
31294 grapCount = 0;
31295 for (int i = 0; i < 1000; i++)
31296 {
31297 if (Main.projectile[i].active && Main.projectile[i].owner == whoAmI && Main.projectile[i].aiStyle == 7)
31298 {
31299 Main.projectile[i].Kill();
31300 }
31301 }
31302 }
31303
31305 {
31306 for (int i = 0; i < 1000; i++)
31307 {
31308 if (Main.projectile[i].active && Main.projectile[i].owner == whoAmI && Main.projectile[i].bobber)
31309 {
31310 Main.projectile[i].Kill();
31311 }
31312 }
31313 }
31314
31315 private void TileInteractionsMouseOver(int myX, int myY)
31316 {
31317 if (myX != tileTargetX || myY != tileTargetY)
31318 {
31319 return;
31320 }
31321 if (Main.tile[myX, myY].type == 79)
31322 {
31323 if (!IsHoveringOverABottomSideOfABed(myX, myY))
31324 {
31325 if (IsWithinSnappngRangeToTile(myX, myY, 96))
31326 {
31327 noThrow = 2;
31328 cursorItemIconEnabled = true;
31329 cursorItemIconID = 5013;
31330 }
31331 }
31332 else
31333 {
31334 noThrow = 2;
31335 cursorItemIconEnabled = true;
31336 int num = Main.tile[myX, myY].frameY / 36;
31337 switch (num)
31338 {
31339 case 0:
31340 cursorItemIconID = 224;
31341 break;
31342 case 1:
31343 cursorItemIconID = 644;
31344 break;
31345 case 2:
31346 cursorItemIconID = 645;
31347 break;
31348 case 3:
31349 cursorItemIconID = 646;
31350 break;
31351 case 4:
31352 cursorItemIconID = 920;
31353 break;
31354 case 5:
31355 cursorItemIconID = 1470;
31356 break;
31357 case 6:
31358 cursorItemIconID = 1471;
31359 break;
31360 case 7:
31361 cursorItemIconID = 1472;
31362 break;
31363 case 8:
31364 cursorItemIconID = 1473;
31365 break;
31366 case 9:
31367 cursorItemIconID = 1719;
31368 break;
31369 case 10:
31370 cursorItemIconID = 1720;
31371 break;
31372 case 11:
31373 cursorItemIconID = 1721;
31374 break;
31375 case 12:
31376 cursorItemIconID = 1722;
31377 break;
31378 case 13:
31379 case 14:
31380 case 15:
31381 case 16:
31382 case 17:
31383 case 18:
31384 cursorItemIconID = 2066 + num - 13;
31385 break;
31386 default:
31387 if (num >= 19 && num <= 20)
31388 {
31389 cursorItemIconID = 2139 + num - 19;
31390 break;
31391 }
31392 switch (num)
31393 {
31394 case 21:
31395 cursorItemIconID = 2231;
31396 break;
31397 case 22:
31398 cursorItemIconID = 2520;
31399 break;
31400 case 23:
31401 cursorItemIconID = 2538;
31402 break;
31403 case 24:
31404 cursorItemIconID = 2553;
31405 break;
31406 case 25:
31407 cursorItemIconID = 2568;
31408 break;
31409 case 26:
31410 cursorItemIconID = 2669;
31411 break;
31412 case 27:
31413 cursorItemIconID = 2811;
31414 break;
31415 case 28:
31416 cursorItemIconID = 3162;
31417 break;
31418 case 29:
31419 cursorItemIconID = 3164;
31420 break;
31421 case 30:
31422 cursorItemIconID = 3163;
31423 break;
31424 case 31:
31425 cursorItemIconID = 3897;
31426 break;
31427 case 32:
31428 cursorItemIconID = 3932;
31429 break;
31430 case 33:
31431 cursorItemIconID = 3959;
31432 break;
31433 case 34:
31434 cursorItemIconID = 4146;
31435 break;
31436 case 35:
31437 cursorItemIconID = 4167;
31438 break;
31439 case 36:
31440 cursorItemIconID = 4188;
31441 break;
31442 case 37:
31443 cursorItemIconID = 4209;
31444 break;
31445 case 38:
31446 cursorItemIconID = 4299;
31447 break;
31448 case 39:
31449 cursorItemIconID = 4567;
31450 break;
31451 case 40:
31452 cursorItemIconID = 5149;
31453 break;
31454 case 41:
31455 cursorItemIconID = 5170;
31456 break;
31457 case 42:
31458 cursorItemIconID = 5191;
31459 break;
31460 default:
31461 cursorItemIconID = 646;
31462 break;
31463 }
31464 break;
31465 }
31466 }
31467 }
31468 if (Main.tile[myX, myY].type == 597)
31469 {
31472 noThrow = 2;
31473 cursorItemIconEnabled = true;
31474 cursorItemIconID = pylonItemTypeFromTileStyle;
31475 if (pylonStyleFromTile == 1)
31476 {
31477 cursorItemIconID = 4875;
31478 }
31479 if (pylonStyleFromTile == 2)
31480 {
31481 cursorItemIconID = 4916;
31482 }
31483 if (pylonStyleFromTile == 3)
31484 {
31485 cursorItemIconID = 4917;
31486 }
31487 if (pylonStyleFromTile == 4)
31488 {
31489 cursorItemIconID = 4918;
31490 }
31491 if (pylonStyleFromTile == 5)
31492 {
31493 cursorItemIconID = 4919;
31494 }
31495 if (pylonStyleFromTile == 6)
31496 {
31497 cursorItemIconID = 4920;
31498 }
31499 if (pylonStyleFromTile == 7)
31500 {
31501 cursorItemIconID = 4921;
31502 }
31503 if (pylonStyleFromTile == 8)
31504 {
31505 cursorItemIconID = 4951;
31506 }
31507 }
31508 if (Main.tile[myX, myY].type == 621)
31509 {
31510 noThrow = 2;
31511 cursorItemIconEnabled = true;
31512 cursorItemIconID = 3750;
31513 }
31514 if (Main.tile[myX, myY].type == 464)
31515 {
31516 noThrow = 2;
31517 cursorItemIconEnabled = true;
31518 cursorItemIconID = 3814;
31519 }
31520 if (Main.tile[myX, myY].type == 33)
31521 {
31522 noThrow = 2;
31523 cursorItemIconEnabled = true;
31524 cursorItemIconID = 105;
31525 int num2 = Main.tile[myX, myY].frameY / 22;
31526 if (num2 == 1)
31527 {
31528 cursorItemIconID = 1405;
31529 }
31530 if (num2 == 2)
31531 {
31532 cursorItemIconID = 1406;
31533 }
31534 if (num2 == 3)
31535 {
31536 cursorItemIconID = 1407;
31537 }
31538 if (num2 >= 4 && num2 <= 13)
31539 {
31540 cursorItemIconID = 2045 + num2 - 4;
31541 }
31542 if (num2 >= 14 && num2 <= 16)
31543 {
31544 cursorItemIconID = 2153 + num2 - 14;
31545 }
31546 if (num2 == 17)
31547 {
31548 cursorItemIconID = 2236;
31549 }
31550 if (num2 == 18)
31551 {
31552 cursorItemIconID = 2523;
31553 }
31554 if (num2 == 19)
31555 {
31556 cursorItemIconID = 2542;
31557 }
31558 if (num2 == 20)
31559 {
31560 cursorItemIconID = 2556;
31561 }
31562 if (num2 == 21)
31563 {
31564 cursorItemIconID = 2571;
31565 }
31566 if (num2 == 22)
31567 {
31568 cursorItemIconID = 2648;
31569 }
31570 if (num2 == 23)
31571 {
31572 cursorItemIconID = 2649;
31573 }
31574 if (num2 == 24)
31575 {
31576 cursorItemIconID = 2650;
31577 }
31578 switch (num2)
31579 {
31580 case 25:
31581 cursorItemIconID = 2651;
31582 break;
31583 case 26:
31584 cursorItemIconID = 2818;
31585 break;
31586 case 27:
31587 cursorItemIconID = 3171;
31588 break;
31589 case 28:
31590 cursorItemIconID = 3173;
31591 break;
31592 case 29:
31593 cursorItemIconID = 3172;
31594 break;
31595 case 30:
31596 cursorItemIconID = 3890;
31597 break;
31598 case 31:
31599 cursorItemIconID = 3936;
31600 break;
31601 case 32:
31602 cursorItemIconID = 3962;
31603 break;
31604 case 33:
31605 cursorItemIconID = 4150;
31606 break;
31607 case 34:
31608 cursorItemIconID = 4171;
31609 break;
31610 case 35:
31611 cursorItemIconID = 4192;
31612 break;
31613 case 36:
31614 cursorItemIconID = 4213;
31615 break;
31616 case 37:
31617 cursorItemIconID = 4303;
31618 break;
31619 case 38:
31620 cursorItemIconID = 4571;
31621 break;
31622 case 39:
31623 cursorItemIconID = 5153;
31624 break;
31625 case 40:
31626 cursorItemIconID = 5174;
31627 break;
31628 case 41:
31629 cursorItemIconID = 5195;
31630 break;
31631 }
31632 }
31633 if (Main.tile[myX, myY].type == 21)
31634 {
31635 TileInteractionsMouseOver_Containers(myX, myY);
31636 }
31637 if (Main.tile[myX, myY].type == 467)
31638 {
31639 TileInteractionsMouseOver_Containers(myX, myY);
31640 }
31641 if (Main.tile[myX, myY].type == 441)
31642 {
31643 Tile tile = Main.tile[myX, myY];
31644 int num3 = myX;
31645 int num4 = myY;
31646 if (tile.frameX % 36 != 0)
31647 {
31648 num3--;
31649 }
31650 if (tile.frameY % 36 != 0)
31651 {
31652 num4--;
31653 }
31654 cursorItemIconID = -1;
31655 cursorItemIconID = Chest.chestTypeToIcon[tile.frameX / 36];
31656 noThrow = 2;
31657 cursorItemIconEnabled = true;
31658 }
31659 if (Main.tile[myX, myY].type == 468)
31660 {
31661 Tile tile2 = Main.tile[myX, myY];
31662 int num5 = myX;
31663 int num6 = myY;
31664 if (tile2.frameX % 36 != 0)
31665 {
31666 num5--;
31667 }
31668 if (tile2.frameY % 36 != 0)
31669 {
31670 num6--;
31671 }
31672 cursorItemIconID = -1;
31673 cursorItemIconID = Chest.chestTypeToIcon2[tile2.frameX / 36];
31674 noThrow = 2;
31675 cursorItemIconEnabled = true;
31676 }
31677 if (Main.tile[myX, myY].type == 88)
31678 {
31679 Tile tile3 = Main.tile[myX, myY];
31680 int num7 = myY;
31681 int x = myX - tile3.frameX % 54 / 18;
31682 if (tile3.frameY % 36 != 0)
31683 {
31684 num7--;
31685 }
31686 int num8 = Chest.FindChest(x, num7);
31687 cursorItemIconID = -1;
31688 if (num8 < 0)
31689 {
31690 cursorItemIconText = Lang.dresserType[0].Value;
31691 }
31692 else
31693 {
31694 if (Main.chest[num8].name != "")
31695 {
31696 cursorItemIconText = Main.chest[num8].name;
31697 }
31698 else
31699 {
31700 cursorItemIconText = Lang.dresserType[tile3.frameX / 54].Value;
31701 }
31702 if (cursorItemIconText == Lang.dresserType[tile3.frameX / 54].Value)
31703 {
31704 cursorItemIconID = Chest.dresserTypeToIcon[tile3.frameX / 54];
31705 cursorItemIconText = "";
31706 }
31707 }
31708 noThrow = 2;
31709 cursorItemIconEnabled = true;
31710 if (Main.tile[myX, myY].frameY > 0)
31711 {
31712 cursorItemIconID = 269;
31713 cursorItemIconText = "";
31714 }
31715 }
31716 if (Main.tile[myX, myY].type == 10 || Main.tile[myX, myY].type == 11)
31717 {
31718 Tile tile4 = Main.tile[myX, myY];
31719 noThrow = 2;
31720 cursorItemIconEnabled = true;
31721 int num9 = tile4.frameY;
31722 int num10 = 0;
31723 while (num9 >= 54)
31724 {
31725 num9 -= 54;
31726 num10++;
31727 }
31728 if (tile4.type == 10)
31729 {
31730 num10 += 36 * (tile4.frameX / 54);
31731 }
31732 if (tile4.type == 11)
31733 {
31734 num10 += 36 * (tile4.frameX / 72);
31735 }
31736 switch (num10)
31737 {
31738 case 0:
31739 cursorItemIconID = 25;
31740 break;
31741 case 9:
31742 cursorItemIconID = 837;
31743 break;
31744 case 10:
31745 cursorItemIconID = 912;
31746 break;
31747 case 11:
31748 cursorItemIconID = 1141;
31749 break;
31750 case 12:
31751 cursorItemIconID = 1137;
31752 break;
31753 case 13:
31754 cursorItemIconID = 1138;
31755 break;
31756 case 14:
31757 cursorItemIconID = 1139;
31758 break;
31759 case 15:
31760 cursorItemIconID = 1140;
31761 break;
31762 case 16:
31763 cursorItemIconID = 1411;
31764 break;
31765 case 17:
31766 cursorItemIconID = 1412;
31767 break;
31768 case 18:
31769 cursorItemIconID = 1413;
31770 break;
31771 case 19:
31772 cursorItemIconID = 1458;
31773 break;
31774 case 20:
31775 case 21:
31776 case 22:
31777 case 23:
31778 cursorItemIconID = 1709 + num10 - 20;
31779 break;
31780 default:
31781 switch (num10)
31782 {
31783 case 24:
31784 cursorItemIconID = 1793;
31785 break;
31786 case 25:
31787 cursorItemIconID = 1815;
31788 break;
31789 case 26:
31790 cursorItemIconID = 1924;
31791 break;
31792 case 27:
31793 cursorItemIconID = 2044;
31794 break;
31795 case 28:
31796 cursorItemIconID = 2265;
31797 break;
31798 case 29:
31799 cursorItemIconID = 2528;
31800 break;
31801 case 30:
31802 cursorItemIconID = 2561;
31803 break;
31804 case 31:
31805 cursorItemIconID = 2576;
31806 break;
31807 case 32:
31808 cursorItemIconID = 2815;
31809 break;
31810 case 33:
31811 cursorItemIconID = 3129;
31812 break;
31813 case 34:
31814 cursorItemIconID = 3131;
31815 break;
31816 case 35:
31817 cursorItemIconID = 3130;
31818 break;
31819 case 36:
31820 cursorItemIconID = 3888;
31821 break;
31822 case 37:
31823 cursorItemIconID = 3941;
31824 break;
31825 case 38:
31826 cursorItemIconID = 3967;
31827 break;
31828 case 39:
31829 cursorItemIconID = 4155;
31830 break;
31831 case 40:
31832 cursorItemIconID = 4176;
31833 break;
31834 case 41:
31835 cursorItemIconID = 4197;
31836 break;
31837 case 42:
31838 cursorItemIconID = 4218;
31839 break;
31840 case 43:
31841 cursorItemIconID = 4307;
31842 break;
31843 case 44:
31844 cursorItemIconID = 4415;
31845 break;
31846 case 45:
31847 cursorItemIconID = 4576;
31848 break;
31849 case 46:
31850 cursorItemIconID = 5158;
31851 break;
31852 case 47:
31853 cursorItemIconID = 5179;
31854 break;
31855 case 48:
31856 cursorItemIconID = 5200;
31857 break;
31858 case 4:
31859 case 5:
31860 case 6:
31861 case 7:
31862 case 8:
31863 cursorItemIconID = 812 + num10;
31864 break;
31865 default:
31866 cursorItemIconID = 649 + num10;
31867 break;
31868 }
31869 break;
31870 }
31871 }
31872 if (Main.tile[myX, myY].type == 104)
31873 {
31874 noThrow = 2;
31875 cursorItemIconEnabled = true;
31876 switch (Main.tile[myX, myY].frameX / 36)
31877 {
31878 case 0:
31879 cursorItemIconID = 359;
31880 break;
31881 case 1:
31882 cursorItemIconID = 2237;
31883 break;
31884 case 2:
31885 cursorItemIconID = 2238;
31886 break;
31887 case 3:
31888 cursorItemIconID = 2239;
31889 break;
31890 case 4:
31891 cursorItemIconID = 2240;
31892 break;
31893 case 5:
31894 cursorItemIconID = 2241;
31895 break;
31896 case 6:
31897 cursorItemIconID = 2560;
31898 break;
31899 case 7:
31900 cursorItemIconID = 2575;
31901 break;
31902 case 8:
31903 cursorItemIconID = 2591;
31904 break;
31905 case 9:
31906 cursorItemIconID = 2592;
31907 break;
31908 case 10:
31909 cursorItemIconID = 2593;
31910 break;
31911 case 11:
31912 cursorItemIconID = 2594;
31913 break;
31914 case 12:
31915 cursorItemIconID = 2595;
31916 break;
31917 case 13:
31918 cursorItemIconID = 2596;
31919 break;
31920 case 14:
31921 cursorItemIconID = 2597;
31922 break;
31923 case 15:
31924 cursorItemIconID = 2598;
31925 break;
31926 case 16:
31927 cursorItemIconID = 2599;
31928 break;
31929 case 17:
31930 cursorItemIconID = 2600;
31931 break;
31932 case 18:
31933 cursorItemIconID = 2601;
31934 break;
31935 case 19:
31936 cursorItemIconID = 2602;
31937 break;
31938 case 20:
31939 cursorItemIconID = 2603;
31940 break;
31941 case 21:
31942 cursorItemIconID = 2604;
31943 break;
31944 case 22:
31945 cursorItemIconID = 2605;
31946 break;
31947 case 23:
31948 cursorItemIconID = 2606;
31949 break;
31950 case 24:
31951 cursorItemIconID = 2809;
31952 break;
31953 case 25:
31954 cursorItemIconID = 3126;
31955 break;
31956 case 26:
31957 cursorItemIconID = 3128;
31958 break;
31959 case 27:
31960 cursorItemIconID = 3127;
31961 break;
31962 case 28:
31963 cursorItemIconID = 3898;
31964 break;
31965 case 29:
31966 cursorItemIconID = 3899;
31967 break;
31968 case 30:
31969 cursorItemIconID = 3900;
31970 break;
31971 case 31:
31972 cursorItemIconID = 3901;
31973 break;
31974 case 32:
31975 cursorItemIconID = 3902;
31976 break;
31977 case 33:
31978 cursorItemIconID = 3940;
31979 break;
31980 case 34:
31981 cursorItemIconID = 3966;
31982 break;
31983 case 35:
31984 cursorItemIconID = 4154;
31985 break;
31986 case 36:
31987 cursorItemIconID = 4175;
31988 break;
31989 case 37:
31990 cursorItemIconID = 4196;
31991 break;
31992 case 38:
31993 cursorItemIconID = 4217;
31994 break;
31995 case 39:
31996 cursorItemIconID = 4306;
31997 break;
31998 case 40:
31999 cursorItemIconID = 4575;
32000 break;
32001 case 41:
32002 cursorItemIconID = 5157;
32003 break;
32004 case 42:
32005 cursorItemIconID = 5178;
32006 break;
32007 case 43:
32008 cursorItemIconID = 5199;
32009 break;
32010 }
32011 }
32012 if (Main.tile[myX, myY].type == 356)
32013 {
32014 noThrow = 2;
32015 cursorItemIconEnabled = true;
32016 cursorItemIconID = 3064;
32017 }
32018 if (Main.tile[myX, myY].type == 663)
32019 {
32020 noThrow = 2;
32021 cursorItemIconEnabled = true;
32022 cursorItemIconID = 5381;
32023 }
32024 if (Main.tile[myX, myY].type == 377)
32025 {
32026 noThrow = 2;
32027 cursorItemIconEnabled = true;
32028 cursorItemIconID = 3198;
32029 }
32030 if (Main.tile[myX, myY].type == 209)
32031 {
32032 noThrow = 2;
32033 cursorItemIconEnabled = true;
32034 if (Main.tile[myX, myY].frameX < 72)
32035 {
32036 cursorItemIconID = 928;
32037 }
32038 else if (Main.tile[myX, myY].frameX < 144)
32039 {
32040 cursorItemIconID = 1337;
32041 }
32042 else if (Main.tile[myX, myY].frameX < 216)
32043 {
32044 cursorItemIconID = 3369;
32045 }
32046 else if (Main.tile[myX, myY].frameX < 360)
32047 {
32048 cursorItemIconID = 3664;
32049 }
32050 int num11;
32051 for (num11 = Main.tile[myX, myY].frameX / 18; num11 >= 4; num11 -= 4)
32052 {
32053 }
32054 if (num11 < 2)
32055 {
32056 cursorItemIconReversed = true;
32057 }
32058 else
32059 {
32060 cursorItemIconReversed = false;
32061 }
32062 }
32063 if (Main.tile[myX, myY].type == 216)
32064 {
32065 noThrow = 2;
32066 cursorItemIconEnabled = true;
32067 int num12 = Main.tile[myX, myY].frameY;
32068 int num13 = 0;
32069 while (num12 >= 40)
32070 {
32071 num12 -= 40;
32072 num13++;
32073 }
32074 cursorItemIconID = 970 + num13;
32075 }
32076 if (Main.tile[myX, myY].type == 387 || Main.tile[myX, myY].type == 386)
32077 {
32078 noThrow = 2;
32079 cursorItemIconEnabled = true;
32080 int x2 = 0;
32081 int y = 0;
32082 WorldGen.GetTopLeftAndStyles(ref x2, ref y, 2, 1 + (Main.tile[myX, myY].type == 386).ToInt(), 18, 18);
32083 cursorItemIconID = 3239;
32084 }
32085 if (Main.tile[myX, myY].type == 389 || Main.tile[myX, myY].type == 388)
32086 {
32087 noThrow = 2;
32088 cursorItemIconEnabled = true;
32089 cursorItemIconID = 3240;
32090 }
32091 if (Main.tile[myX, myY].type == 335)
32092 {
32093 noThrow = 2;
32094 cursorItemIconEnabled = true;
32095 cursorItemIconID = 2700;
32096 }
32097 if (Main.tile[myX, myY].type == 15 && IsWithinSnappngRangeToTile(myX, myY, 40))
32098 {
32099 noThrow = 2;
32100 cursorItemIconEnabled = true;
32101 cursorItemIconID = WorldGen.GetItemDrop_Chair(Main.tile[myX, myY].frameY / 40);
32102 if (Main.tile[myX, myY].frameX / 18 < 1)
32103 {
32104 cursorItemIconReversed = true;
32105 }
32106 }
32107 if (Main.tile[myX, myY].type == 102 && IsWithinSnappngRangeToTile(myX, myY, 40))
32108 {
32109 noThrow = 2;
32110 cursorItemIconEnabled = true;
32111 cursorItemIconID = 355;
32112 }
32113 if (Main.tile[myX, myY].type == 89 && IsWithinSnappngRangeToTile(myX, myY, 40))
32114 {
32115 noThrow = 2;
32116 cursorItemIconEnabled = true;
32117 cursorItemIconID = WorldGen.GetItemDrop_Benches(Main.tile[myX, myY].frameX / 54);
32118 }
32119 if (Main.tile[myX, myY].type == 487 && IsWithinSnappngRangeToTile(myX, myY, 40))
32120 {
32121 noThrow = 2;
32122 cursorItemIconEnabled = true;
32123 cursorItemIconID = WorldGen.GetItemDrop_PicnicTables(Main.tile[myX, myY].frameX / 72);
32124 }
32125 if (Main.tile[myX, myY].type == 497 && IsWithinSnappngRangeToTile(myX, myY, 40))
32126 {
32127 noThrow = 2;
32128 cursorItemIconEnabled = true;
32129 cursorItemIconID = WorldGen.GetItemDrop_Toilet(Main.tile[myX, myY].frameY / 40);
32130 if (Main.tile[myX, myY].frameX / 18 < 1)
32131 {
32132 cursorItemIconReversed = true;
32133 }
32134 }
32135 if (Main.tile[myX, myY].type == 410)
32136 {
32137 noThrow = 2;
32138 cursorItemIconEnabled = true;
32139 cursorItemIconID = 3536 + Math.Min(Main.tile[myX, myY].frameX / 36, 3);
32140 }
32141 if (Main.tile[myX, myY].type == 480)
32142 {
32143 noThrow = 2;
32144 cursorItemIconEnabled = true;
32145 cursorItemIconID = 4054;
32146 }
32147 if (Main.tile[myX, myY].type == 509)
32148 {
32149 noThrow = 2;
32150 cursorItemIconEnabled = true;
32151 cursorItemIconID = 4318;
32152 }
32153 if (Main.tile[myX, myY].type == 657)
32154 {
32155 noThrow = 2;
32156 cursorItemIconEnabled = true;
32157 cursorItemIconID = 5345;
32158 }
32159 if (Main.tile[myX, myY].type == 658)
32160 {
32161 noThrow = 2;
32162 cursorItemIconEnabled = true;
32163 cursorItemIconID = 5347;
32164 }
32165 if (Main.tile[myX, myY].type == 463)
32166 {
32167 noThrow = 2;
32168 cursorItemIconEnabled = true;
32169 cursorItemIconID = 3813;
32170 }
32171 if (Main.tile[myX, myY].type == 491)
32172 {
32173 noThrow = 2;
32174 cursorItemIconEnabled = true;
32175 cursorItemIconID = 4076;
32176 }
32177 if (Main.tile[myX, myY].type == 494)
32178 {
32179 noThrow = 2;
32180 cursorItemIconEnabled = true;
32181 cursorItemIconID = 4089;
32182 }
32183 if (Main.tile[myX, myY].type == 411 && Main.tile[myX, myY].frameX < 36)
32184 {
32185 noThrow = 2;
32186 cursorItemIconEnabled = true;
32187 cursorItemIconID = 3545;
32188 }
32189 if (Main.tile[myX, myY].type == 338)
32190 {
32191 noThrow = 2;
32192 cursorItemIconEnabled = true;
32193 cursorItemIconID = 2738;
32194 }
32195 if (Main.tile[myX, myY].type == 455)
32196 {
32197 noThrow = 2;
32198 cursorItemIconEnabled = true;
32199 cursorItemIconID = 3747;
32200 }
32201 if ((Main.tile[myX, myY].type == 219 || Main.tile[myX, myY].type == 642) && (inventory[selectedItem].type == 424 || inventory[selectedItem].type == 1103 || inventory[selectedItem].type == 2339 || inventory[selectedItem].type == 2338 || inventory[selectedItem].type == 2337))
32202 {
32203 noThrow = 2;
32204 cursorItemIconEnabled = true;
32205 cursorItemIconID = inventory[selectedItem].type;
32206 }
32207 if (Main.tile[myX, myY].type == 212)
32208 {
32209 noThrow = 2;
32210 cursorItemIconEnabled = true;
32211 cursorItemIconID = 949;
32212 }
32213 if (Main.tile[myX, myY].type == 314 && gravDir == 1f)
32214 {
32215 noThrow = 2;
32216 cursorItemIconEnabled = true;
32217 cursorItemIconID = 2343;
32218 }
32219 if (Main.tile[myX, myY].type == 215)
32220 {
32221 noThrow = 2;
32222 cursorItemIconEnabled = true;
32223 int num14 = Main.tile[myX, myY].frameX / 54;
32224 switch (num14)
32225 {
32226 case 0:
32227 cursorItemIconID = 966;
32228 break;
32229 case 14:
32230 cursorItemIconID = 5299;
32231 break;
32232 case 15:
32233 cursorItemIconID = 5357;
32234 break;
32235 case 8:
32236 case 9:
32237 case 10:
32238 case 11:
32239 case 12:
32240 case 13:
32241 cursorItemIconID = 4689 + num14 - 8;
32242 break;
32243 default:
32244 switch (num14)
32245 {
32246 case 7:
32247 cursorItemIconID = 3724;
32248 break;
32249 case 6:
32250 cursorItemIconID = 3723;
32251 break;
32252 case 5:
32253 cursorItemIconID = 3050;
32254 break;
32255 default:
32256 cursorItemIconID = 3046 + num14 - 1;
32257 break;
32258 }
32259 break;
32260 }
32261 }
32262 if (Main.tile[myX, myY].type == 4)
32263 {
32264 noThrow = 2;
32265 cursorItemIconEnabled = true;
32266 int num15 = Main.tile[myX, myY].frameY / 22;
32267 switch (num15)
32268 {
32269 case 0:
32270 cursorItemIconID = 8;
32271 break;
32272 case 8:
32273 cursorItemIconID = 523;
32274 break;
32275 case 9:
32276 cursorItemIconID = 974;
32277 break;
32278 case 10:
32279 cursorItemIconID = 1245;
32280 break;
32281 case 11:
32282 cursorItemIconID = 1333;
32283 break;
32284 case 12:
32285 cursorItemIconID = 2274;
32286 break;
32287 case 13:
32288 cursorItemIconID = 3004;
32289 break;
32290 case 14:
32291 cursorItemIconID = 3045;
32292 break;
32293 case 15:
32294 cursorItemIconID = 3114;
32295 break;
32296 case 16:
32297 cursorItemIconID = 4383;
32298 break;
32299 case 17:
32300 cursorItemIconID = 4384;
32301 break;
32302 case 18:
32303 cursorItemIconID = 4385;
32304 break;
32305 case 19:
32306 cursorItemIconID = 4386;
32307 break;
32308 case 20:
32309 cursorItemIconID = 4387;
32310 break;
32311 case 21:
32312 cursorItemIconID = 4388;
32313 break;
32314 case 22:
32315 cursorItemIconID = 5293;
32316 break;
32317 case 23:
32318 cursorItemIconID = 5353;
32319 break;
32320 default:
32321 cursorItemIconID = 426 + num15;
32322 break;
32323 }
32324 }
32325 if (Main.tile[myX, myY].type == 13)
32326 {
32327 noThrow = 2;
32328 cursorItemIconEnabled = true;
32329 switch (Main.tile[myX, myY].frameX / 18)
32330 {
32331 case 1:
32332 cursorItemIconID = 28;
32333 break;
32334 case 2:
32335 cursorItemIconID = 110;
32336 break;
32337 case 3:
32338 cursorItemIconID = 350;
32339 break;
32340 case 4:
32341 cursorItemIconID = 351;
32342 break;
32343 case 5:
32344 cursorItemIconID = 2234;
32345 break;
32346 case 6:
32347 cursorItemIconID = 2244;
32348 break;
32349 case 7:
32350 cursorItemIconID = 2257;
32351 break;
32352 case 8:
32353 cursorItemIconID = 2258;
32354 break;
32355 default:
32356 cursorItemIconID = 31;
32357 break;
32358 }
32359 }
32360 if (Main.tile[myX, myY].type == 29)
32361 {
32362 noThrow = 2;
32363 cursorItemIconEnabled = true;
32364 cursorItemIconID = 87;
32365 }
32366 if (Main.tile[myX, myY].type == 97)
32367 {
32368 noThrow = 2;
32369 cursorItemIconEnabled = true;
32370 cursorItemIconID = 346;
32371 }
32372 if (Main.tile[myX, myY].type == 510)
32373 {
32374 noThrow = 2;
32375 cursorItemIconEnabled = true;
32376 cursorItemIconID = 4319;
32377 int num16;
32378 for (num16 = Main.tile[myX, myY].frameX / 18; num16 >= 2; num16 -= 2)
32379 {
32380 }
32381 if (num16 == 0)
32382 {
32383 cursorItemIconReversed = true;
32384 }
32385 else
32386 {
32387 cursorItemIconReversed = false;
32388 }
32389 }
32390 if (Main.tile[myX, myY].type == 511)
32391 {
32392 noThrow = 2;
32393 cursorItemIconEnabled = true;
32394 cursorItemIconID = 4320;
32395 int num17;
32396 for (num17 = Main.tile[myX, myY].frameX / 18; num17 >= 2; num17 -= 2)
32397 {
32398 }
32399 if (num17 == 0)
32400 {
32401 cursorItemIconReversed = true;
32402 }
32403 else
32404 {
32405 cursorItemIconReversed = false;
32406 }
32407 }
32408 if (Main.tile[myX, myY].type == 49)
32409 {
32410 noThrow = 2;
32411 cursorItemIconEnabled = true;
32412 cursorItemIconID = 148;
32413 }
32414 if (Main.tile[myX, myY].type == 372)
32415 {
32416 noThrow = 2;
32417 cursorItemIconEnabled = true;
32418 cursorItemIconID = 3117;
32419 }
32420 if (Main.tile[myX, myY].type == 646)
32421 {
32422 noThrow = 2;
32423 cursorItemIconEnabled = true;
32424 cursorItemIconID = 5322;
32425 }
32426 if (Main.tile[myX, myY].type == 174)
32427 {
32428 noThrow = 2;
32429 cursorItemIconEnabled = true;
32430 cursorItemIconID = 713;
32431 }
32432 if (Main.tile[myX, myY].type == 50)
32433 {
32434 noThrow = 2;
32435 if (Main.tile[myX, myY].frameX == 90)
32436 {
32437 cursorItemIconEnabled = true;
32438 cursorItemIconID = 165;
32439 }
32440 }
32441 if (Main.tile[myX, myY].type == 139)
32442 {
32443 noThrow = 2;
32444 int num18 = 0;
32445 for (int num19 = Main.tile[myX, myY].frameY / 18; num19 >= 2; num19 -= 2)
32446 {
32447 num18++;
32448 }
32449 cursorItemIconEnabled = true;
32450 if (num18 == 28)
32451 {
32452 cursorItemIconID = 1963;
32453 }
32454 else if (num18 == 29)
32455 {
32456 cursorItemIconID = 1964;
32457 }
32458 else if (num18 == 30)
32459 {
32460 cursorItemIconID = 1965;
32461 }
32462 else if (num18 == 31)
32463 {
32464 cursorItemIconID = 2742;
32465 }
32466 else if (num18 == 32)
32467 {
32468 cursorItemIconID = 3044;
32469 }
32470 else if (num18 == 33)
32471 {
32472 cursorItemIconID = 3235;
32473 }
32474 else if (num18 == 34)
32475 {
32476 cursorItemIconID = 3236;
32477 }
32478 else if (num18 == 35)
32479 {
32480 cursorItemIconID = 3237;
32481 }
32482 else if (num18 == 36)
32483 {
32484 cursorItemIconID = 3370;
32485 }
32486 else if (num18 == 37)
32487 {
32488 cursorItemIconID = 3371;
32489 }
32490 else if (num18 == 38)
32491 {
32492 cursorItemIconID = 3796;
32493 }
32494 else if (num18 == 39)
32495 {
32496 cursorItemIconID = 3869;
32497 }
32498 else if (num18 == 40)
32499 {
32500 cursorItemIconID = 4082;
32501 }
32502 else if (num18 == 41)
32503 {
32504 cursorItemIconID = 4078;
32505 }
32506 else if (num18 == 42)
32507 {
32508 cursorItemIconID = 4079;
32509 }
32510 else if (num18 == 43)
32511 {
32512 cursorItemIconID = 4077;
32513 }
32514 else if (num18 == 44)
32515 {
32516 cursorItemIconID = 4080;
32517 }
32518 else if (num18 == 45)
32519 {
32520 cursorItemIconID = 4081;
32521 }
32522 else if (num18 == 46)
32523 {
32524 cursorItemIconID = 4237;
32525 }
32526 else if (num18 == 47)
32527 {
32528 cursorItemIconID = 4356;
32529 }
32530 else if (num18 == 48)
32531 {
32532 cursorItemIconID = 4357;
32533 }
32534 else if (num18 == 49)
32535 {
32536 cursorItemIconID = 4358;
32537 }
32538 else if (num18 == 50)
32539 {
32540 cursorItemIconID = 4421;
32541 }
32542 else if (num18 == 51)
32543 {
32544 cursorItemIconID = 4606;
32545 }
32546 else if (num18 == 52)
32547 {
32548 cursorItemIconID = 4979;
32549 }
32550 else if (num18 == 53)
32551 {
32552 cursorItemIconID = 4985;
32553 }
32554 else if (num18 == 54)
32555 {
32556 cursorItemIconID = 4990;
32557 }
32558 else if (num18 == 55)
32559 {
32560 cursorItemIconID = 4991;
32561 }
32562 else if (num18 == 56)
32563 {
32564 cursorItemIconID = 4992;
32565 }
32566 else if (num18 == 57)
32567 {
32568 cursorItemIconID = 5006;
32569 }
32570 else if (num18 == 58)
32571 {
32572 cursorItemIconID = 5014;
32573 }
32574 else if (num18 == 59)
32575 {
32576 cursorItemIconID = 5015;
32577 }
32578 else if (num18 == 60)
32579 {
32580 cursorItemIconID = 5016;
32581 }
32582 else if (num18 == 61)
32583 {
32584 cursorItemIconID = 5017;
32585 }
32586 else if (num18 == 62)
32587 {
32588 cursorItemIconID = 5018;
32589 }
32590 else if (num18 == 63)
32591 {
32592 cursorItemIconID = 5019;
32593 }
32594 else if (num18 == 64)
32595 {
32596 cursorItemIconID = 5020;
32597 }
32598 else if (num18 == 65)
32599 {
32600 cursorItemIconID = 5021;
32601 }
32602 else if (num18 == 66)
32603 {
32604 cursorItemIconID = 5022;
32605 }
32606 else if (num18 == 67)
32607 {
32608 cursorItemIconID = 5023;
32609 }
32610 else if (num18 == 68)
32611 {
32612 cursorItemIconID = 5024;
32613 }
32614 else if (num18 == 69)
32615 {
32616 cursorItemIconID = 5025;
32617 }
32618 else if (num18 == 70)
32619 {
32620 cursorItemIconID = 5026;
32621 }
32622 else if (num18 == 71)
32623 {
32624 cursorItemIconID = 5027;
32625 }
32626 else if (num18 == 72)
32627 {
32628 cursorItemIconID = 5028;
32629 }
32630 else if (num18 == 73)
32631 {
32632 cursorItemIconID = 5029;
32633 }
32634 else if (num18 == 74)
32635 {
32636 cursorItemIconID = 5030;
32637 }
32638 else if (num18 == 75)
32639 {
32640 cursorItemIconID = 5031;
32641 }
32642 else if (num18 == 76)
32643 {
32644 cursorItemIconID = 5032;
32645 }
32646 else if (num18 == 77)
32647 {
32648 cursorItemIconID = 5033;
32649 }
32650 else if (num18 == 78)
32651 {
32652 cursorItemIconID = 5034;
32653 }
32654 else if (num18 == 79)
32655 {
32656 cursorItemIconID = 5035;
32657 }
32658 else if (num18 == 80)
32659 {
32660 cursorItemIconID = 5036;
32661 }
32662 else if (num18 == 81)
32663 {
32664 cursorItemIconID = 5037;
32665 }
32666 else if (num18 == 82)
32667 {
32668 cursorItemIconID = 5038;
32669 }
32670 else if (num18 == 83)
32671 {
32672 cursorItemIconID = 5039;
32673 }
32674 else if (num18 == 84)
32675 {
32676 cursorItemIconID = 5040;
32677 }
32678 else if (num18 == 85)
32679 {
32680 cursorItemIconID = 5044;
32681 }
32682 else if (num18 == 86)
32683 {
32684 cursorItemIconID = 5112;
32685 }
32686 else if (num18 == 87)
32687 {
32688 cursorItemIconID = 5362;
32689 }
32690 else if (num18 >= 13)
32691 {
32692 cursorItemIconID = 1596 + num18 - 13;
32693 }
32694 else
32695 {
32696 cursorItemIconID = 562 + num18;
32697 }
32698 }
32699 if (Main.tile[myX, myY].type == 207)
32700 {
32701 noThrow = 2;
32702 int num20 = 0;
32703 for (int num21 = Main.tile[myX, myY].frameX / 18; num21 >= 2; num21 -= 2)
32704 {
32705 num20++;
32706 }
32707 cursorItemIconEnabled = true;
32708 switch (num20)
32709 {
32710 case 0:
32711 cursorItemIconID = 909;
32712 break;
32713 case 1:
32714 cursorItemIconID = 910;
32715 break;
32716 case 2:
32717 cursorItemIconID = 940;
32718 break;
32719 case 3:
32720 cursorItemIconID = 941;
32721 break;
32722 case 4:
32723 cursorItemIconID = 942;
32724 break;
32725 case 5:
32726 cursorItemIconID = 943;
32727 break;
32728 case 6:
32729 cursorItemIconID = 944;
32730 break;
32731 case 7:
32732 cursorItemIconID = 945;
32733 break;
32734 case 8:
32735 cursorItemIconID = 4922;
32736 break;
32737 case 9:
32738 cursorItemIconID = 4417;
32739 break;
32740 }
32741 }
32742 if (Main.tileSign[Main.tile[myX, myY].type])
32743 {
32744 noThrow = 2;
32745 int num22 = Main.tile[myX, myY].frameX / 18;
32746 int num23 = Main.tile[myX, myY].frameY / 18;
32747 num22 %= 2;
32748 int num24 = myX - num22;
32749 int num25 = myY - num23;
32750 Main.signBubble = true;
32751 Main.signX = num24 * 16 + 16;
32752 Main.signY = num25 * 16;
32753 int num26 = Sign.ReadSign(num24, num25, CreateIfMissing: false);
32754 if (num26 != -1)
32755 {
32756 Main.signHover = num26;
32757 }
32758 if (num26 != -1)
32759 {
32760 Main.signHover = num26;
32761 cursorItemIconEnabled = false;
32762 cursorItemIconID = -1;
32763 }
32764 }
32765 if (Main.tile[myX, myY].type == 237)
32766 {
32767 noThrow = 2;
32768 cursorItemIconEnabled = true;
32769 cursorItemIconID = 1293;
32770 }
32771 if (Main.tile[myX, myY].type == 466)
32772 {
32773 noThrow = 2;
32774 cursorItemIconEnabled = true;
32775 cursorItemIconID = 3828;
32776 }
32777 if (Main.tile[myX, myY].type == 125)
32778 {
32779 noThrow = 2;
32780 cursorItemIconEnabled = true;
32781 cursorItemIconID = 487;
32782 }
32783 if (Main.tile[myX, myY].type == 354)
32784 {
32785 noThrow = 2;
32786 cursorItemIconEnabled = true;
32787 cursorItemIconID = 2999;
32788 }
32789 if (Main.tile[myX, myY].type == 287)
32790 {
32791 noThrow = 2;
32792 cursorItemIconEnabled = true;
32793 cursorItemIconID = 2177;
32794 }
32795 if (Main.tile[myX, myY].type == 132)
32796 {
32797 noThrow = 2;
32798 cursorItemIconEnabled = true;
32799 cursorItemIconID = 513;
32800 }
32801 if (Main.tile[myX, myY].type == 136)
32802 {
32803 noThrow = 2;
32804 cursorItemIconEnabled = true;
32805 cursorItemIconID = 538;
32806 }
32807 if (Main.tile[myX, myY].type == 144)
32808 {
32809 noThrow = 2;
32810 cursorItemIconEnabled = true;
32811 int num27 = Main.tile[myX, myY].frameX / 18;
32812 if (num27 < 3)
32813 {
32814 cursorItemIconID = 583 + num27;
32815 }
32816 else
32817 {
32818 cursorItemIconID = 4484 + (num27 - 3);
32819 }
32820 }
32821 if (Main.tile[myX, myY].type == 440)
32822 {
32823 int num28 = Main.tile[myX, myY].frameX / 54;
32824 int num29 = Main.tile[myX, myY].frameY / 54;
32825 int num30 = -1;
32826 switch (num28)
32827 {
32828 case 0:
32829 num30 = 1526;
32830 break;
32831 case 1:
32832 num30 = 1524;
32833 break;
32834 case 2:
32835 num30 = 1525;
32836 break;
32837 case 3:
32838 num30 = 1523;
32839 break;
32840 case 4:
32841 num30 = 1522;
32842 break;
32843 case 5:
32844 num30 = 1527;
32845 break;
32846 case 6:
32847 num30 = 3643;
32848 break;
32849 }
32850 if (num30 != -1 && (num29 == 1 || HasItem(num30)))
32851 {
32852 noThrow = 2;
32853 cursorItemIconEnabled = true;
32854 cursorItemIconID = num30;
32855 }
32856 }
32857 else if (Main.tile[myX, myY].type == 470)
32858 {
32859 noThrow = 2;
32860 int num31 = Main.tile[myX, myY].frameX % 136 / 34;
32861 if (num31 < 2)
32862 {
32863 cursorItemIconEnabled = true;
32864 cursorItemIconID = 498;
32865 }
32866 else if (num31 < 4)
32867 {
32868 cursorItemIconEnabled = true;
32869 cursorItemIconID = 1989;
32870 }
32871 }
32872 else if (Main.tile[myX, myY].type == 475)
32873 {
32874 noThrow = 2;
32875 cursorItemIconEnabled = true;
32876 cursorItemIconID = 3977;
32877 }
32878 else if (Main.tile[myX, myY].type == 520)
32879 {
32880 noThrow = 2;
32881 int num32 = TEFoodPlatter.Find(myX, myY);
32882 if (num32 != -1)
32883 {
32884 cursorItemIconEnabled = true;
32886 cursorItemIconID = tEFoodPlatter.item.type;
32887 }
32888 }
32889 else if (Main.tile[myX, myY].type == 395)
32890 {
32891 noThrow = 2;
32892 int num33 = myX;
32893 int num34 = myY;
32894 int num35 = Main.tile[myX, myY].frameX;
32895 int num36 = Main.tile[myX, myY].frameY;
32896 while (num36 > 0)
32897 {
32898 num36 -= 18;
32899 num34--;
32900 }
32901 while (num35 >= 36)
32902 {
32903 num35 -= 36;
32904 }
32905 while (num35 > 0)
32906 {
32907 num35 -= 18;
32908 num33--;
32909 }
32911 if (num37 != -1)
32912 {
32913 cursorItemIconEnabled = true;
32915 cursorItemIconID = tEItemFrame.item.type;
32916 }
32917 }
32918 else if (Main.tile[myX, myY].type == 471)
32919 {
32920 noThrow = 2;
32921 int num38 = myX;
32922 int num39 = myY;
32923 int num40 = Main.tile[myX, myY].frameX;
32924 int num41 = Main.tile[myX, myY].frameY;
32925 while (num41 > 0)
32926 {
32927 num41 -= 18;
32928 num39--;
32929 }
32930 while (num40 >= 54)
32931 {
32932 num40 -= 54;
32933 }
32934 while (num40 > 0)
32935 {
32936 num40 -= 18;
32937 num38--;
32938 }
32940 if (num42 != -1)
32941 {
32942 cursorItemIconEnabled = true;
32944 cursorItemIconID = tEWeaponsRack.item.type;
32945 }
32946 }
32947 else if (Main.tile[myX, myY].type == 334)
32948 {
32949 noThrow = 2;
32950 }
32951 if (PlayerInput.UsingGamepad && cursorItemIconText.Length == 0)
32952 {
32953 cursorItemIconEnabled = false;
32954 cursorItemIconID = 0;
32955 }
32956 }
32957
32959 {
32960 return difficulty switch
32961 {
32962 1 => Main.mcColor,
32963 2 => Main.hcColor,
32964 _ => Color.White,
32965 };
32966 }
32967
32969 {
32972 Tile tile = Main.tile[myX, myY];
32973 if (tile.type == 467)
32974 {
32977 }
32978 int num = myX;
32979 int num2 = myY;
32980 if (tile.frameX % 36 != 0)
32981 {
32982 num--;
32983 }
32984 if (tile.frameY % 36 != 0)
32985 {
32986 num2--;
32987 }
32988 int num3 = Chest.FindChest(num, num2);
32989 cursorItemIconID = -1;
32990 if (num3 < 0)
32991 {
32992 cursorItemIconText = array[0].Value;
32993 }
32994 else
32995 {
32996 if (Main.chest[num3].name != "")
32997 {
32998 cursorItemIconText = Main.chest[num3].name;
32999 }
33000 else
33001 {
33002 cursorItemIconText = array[tile.frameX / 36].Value;
33003 }
33004 if (cursorItemIconText == array[tile.frameX / 36].Value)
33005 {
33006 cursorItemIconID = array2[tile.frameX / 36];
33007 cursorItemIconText = "";
33008 }
33009 }
33010 if (cursorItemIconID == 3988)
33011 {
33012 cursorItemIconID = 306;
33013 }
33014 noThrow = 2;
33015 cursorItemIconEnabled = true;
33016 }
33017
33019 {
33020 if (whoAmI == Main.myPlayer && velocity.Y >= 3f)
33021 {
33022 Point point = (base.Bottom + new Vector2(0f, 0.01f)).ToTileCoordinates();
33023 Tile tileSafely = Framing.GetTileSafely(point.X, point.Y);
33024 if (tileSafely.active() && tileSafely.type == 411 && tileSafely.frameY == 0 && tileSafely.frameX < 36)
33025 {
33026 Wiring.HitSwitch(point.X, point.Y);
33027 NetMessage.SendData(59, -1, -1, null, point.X, point.Y);
33028 }
33029 }
33030 }
33031
33032 private void TryBouncingBlocks(bool Falling)
33033 {
33034 bool num = !wet && !shimmering && (velocity.Y >= 5f || velocity.Y <= -5f);
33035 bool flag = false;
33036 bool flag2 = false;
33037 float num2 = 1f;
33038 if (!num)
33039 {
33040 return;
33041 }
33042 bool flag3 = false;
33043 int num3 = 0;
33044 foreach (Point touchedTile in TouchedTiles)
33045 {
33046 Tile tile = Main.tile[touchedTile.X, touchedTile.Y];
33047 if (tile != null && tile.active() && tile.nactive() && (flag || Main.tileBouncy[tile.type]))
33048 {
33049 flag3 = true;
33050 num3 = touchedTile.Y;
33051 break;
33052 }
33053 }
33054 if (!flag3)
33055 {
33056 return;
33057 }
33058 velocity.Y *= -0.8f;
33059 if (controlJump)
33060 {
33061 velocity.Y = MathHelper.Clamp(velocity.Y, -13f, 13f);
33062 }
33063 position.Y = num3 * 16 - ((velocity.Y < 0f) ? height : (-16));
33064 FloorVisuals(Falling);
33065 if (flag2)
33066 {
33067 Vector2 vector = (fullRotation - (float)Math.PI / 2f).ToRotationVector2();
33068 if (vector.Y > 0f)
33069 {
33070 vector.Y *= -1f;
33071 }
33072 vector.Y = vector.Y * 0.5f + -0.5f;
33073 float num4 = 0f - vector.Y;
33074 if (num4 < 0f)
33075 {
33076 num4 = 0f;
33077 }
33078 float num5 = num4 * 1.5f + 1f;
33079 float value = Math.Abs(velocity.Y) * num5 * num2;
33080 value = MathHelper.Clamp(value, 2f, 16f);
33081 velocity = vector * value;
33082 float num6 = 20f;
33083 Vector2 vector2 = base.Center + (fullRotation + (float)Math.PI / 2f).ToRotationVector2() * num6;
33084 vector2 = base.Bottom;
33086 {
33087 PositionInWorld = vector2
33088 }, whoAmI);
33089 }
33090 velocity.Y = MathHelper.Clamp(velocity.Y, -20f, 20f);
33091 if (velocity.Y * gravDir < 0f)
33092 {
33093 fallStart = (int)position.Y / 16;
33094 }
33095 }
33096
33098 {
33099 if (preventAllItemPickups)
33100 {
33102 }
33103 return true;
33104 }
33105
33106 private void GrabItems(int i)
33107 {
33108 for (int j = 0; j < 400; j++)
33109 {
33110 Item item = Main.item[j];
33111 if (!item.active || item.shimmerTime != 0f || item.noGrabDelay != 0 || item.playerIndexTheItemIsReservedFor != i || !CanAcceptItemIntoInventory(item) || (item.shimmered && !((double)item.velocity.Length() < 0.2)))
33112 {
33113 continue;
33114 }
33115 int itemGrabRange = GetItemGrabRange(item);
33116 Rectangle hitbox = item.Hitbox;
33117 if (base.Hitbox.Intersects(hitbox))
33118 {
33119 if (i == Main.myPlayer && (inventory[selectedItem].type != 0 || itemAnimation <= 0))
33120 {
33121 item = PickupItem(i, j, item);
33122 }
33123 }
33124 else
33125 {
33126 if (!new Rectangle((int)position.X - itemGrabRange, (int)position.Y - itemGrabRange, width + itemGrabRange * 2, height + itemGrabRange * 2).Intersects(hitbox))
33127 {
33128 continue;
33129 }
33130 ItemSpaceStatus status = ItemSpace(item);
33131 if (CanPullItem(item, status))
33132 {
33133 item.shimmered = false;
33134 item.beingGrabbed = true;
33135 bool flag = false;
33137 {
33138 flag = true;
33139 }
33140 if (flag)
33141 {
33142 PullItem_Pickup(item, 7f, 1);
33143 }
33144 else if (manaMagnet && (item.type == 184 || item.type == 1735 || item.type == 1868))
33145 {
33146 PullItem_Pickup(item, 12f, 5);
33147 }
33148 else if (lifeMagnet && (item.type == 58 || item.type == 1734 || item.type == 1867))
33149 {
33150 PullItem_Pickup(item, 15f, 5);
33151 }
33152 else if (ItemID.Sets.NebulaPickup[item.type])
33153 {
33154 PullItem_Pickup(item, 12f, 5);
33155 }
33156 else if (status.ItemIsGoingToVoidVault)
33157 {
33158 PullItem_ToVoidVault(item);
33159 }
33160 else if (goldRing && item.IsACoin)
33161 {
33162 PullItem_Pickup(item, 12f, 5);
33163 }
33164 else
33165 {
33166 PullItem_Common(item, 0.75f);
33167 }
33168 }
33169 }
33170 }
33171 }
33172
33174 {
33175 PullItem_Pickup(itemToPickUp, 12f, 5);
33176 }
33177
33179 {
33180 if ((double)position.X + (double)width * 0.5 > (double)itemToPickUp.position.X + (double)itemToPickUp.width * 0.5)
33181 {
33182 if (itemToPickUp.velocity.X < itemGrabSpeedMax + velocity.X)
33183 {
33184 itemToPickUp.velocity.X += itemGrabSpeed;
33185 }
33186 if (itemToPickUp.velocity.X < 0f)
33187 {
33188 itemToPickUp.velocity.X += itemGrabSpeed * xPullSpeed;
33189 }
33190 }
33191 else
33192 {
33193 if (itemToPickUp.velocity.X > 0f - itemGrabSpeedMax + velocity.X)
33194 {
33195 itemToPickUp.velocity.X -= itemGrabSpeed;
33196 }
33197 if (itemToPickUp.velocity.X > 0f)
33198 {
33199 itemToPickUp.velocity.X -= itemGrabSpeed * xPullSpeed;
33200 }
33201 }
33202 if ((double)position.Y + (double)height * 0.5 > (double)itemToPickUp.position.Y + (double)itemToPickUp.height * 0.5)
33203 {
33204 if (itemToPickUp.velocity.Y < itemGrabSpeedMax)
33205 {
33206 itemToPickUp.velocity.Y += itemGrabSpeed;
33207 }
33208 if (itemToPickUp.velocity.Y < 0f)
33209 {
33210 itemToPickUp.velocity.Y += itemGrabSpeed * xPullSpeed;
33211 }
33212 }
33213 else
33214 {
33215 if (itemToPickUp.velocity.Y > 0f - itemGrabSpeedMax)
33216 {
33217 itemToPickUp.velocity.Y -= itemGrabSpeed;
33218 }
33219 if (itemToPickUp.velocity.Y > 0f)
33220 {
33221 itemToPickUp.velocity.Y -= itemGrabSpeed * xPullSpeed;
33222 }
33223 }
33224 }
33225
33226 private void PullItem_Pickup(Item itemToPickUp, float speed, int acc)
33227 {
33228 Vector2 vector = new Vector2(itemToPickUp.position.X + (float)(itemToPickUp.width / 2), itemToPickUp.position.Y + (float)(itemToPickUp.height / 2));
33229 float num = base.Center.X - vector.X;
33230 float num2 = base.Center.Y - vector.Y;
33231 float num3 = (float)Math.Sqrt(num * num + num2 * num2);
33232 num3 = speed / num3;
33233 num *= num3;
33234 num2 *= num3;
33235 itemToPickUp.velocity.X = (itemToPickUp.velocity.X * (float)(acc - 1) + num) / (float)acc;
33236 itemToPickUp.velocity.Y = (itemToPickUp.velocity.Y * (float)(acc - 1) + num2) / (float)acc;
33237 }
33238
33240 {
33242 {
33243 SoundEngine.PlaySound(7, (int)position.X, (int)position.Y);
33244 int num = itemToPickUp.buffType;
33245 itemToPickUp = new Item();
33246 if (Main.netMode == 1)
33247 {
33248 NetMessage.SendData(102, -1, -1, null, playerIndex, num, base.Center.X, base.Center.Y);
33249 }
33250 else
33251 {
33252 NebulaLevelup(num);
33253 }
33254 }
33255 if (itemToPickUp.type == 58 || itemToPickUp.type == 1734 || itemToPickUp.type == 1867)
33256 {
33257 SoundEngine.PlaySound(7, (int)position.X, (int)position.Y);
33258 Heal(20);
33259 itemToPickUp = new Item();
33260 }
33261 else if (itemToPickUp.type == 184 || itemToPickUp.type == 1735 || itemToPickUp.type == 1868)
33262 {
33263 SoundEngine.PlaySound(7, (int)position.X, (int)position.Y);
33264 statMana += 100;
33265 if (Main.myPlayer == whoAmI)
33266 {
33267 ManaEffect(100);
33268 }
33269 if (statMana > statManaMax2)
33270 {
33271 statMana = statManaMax2;
33272 }
33273 itemToPickUp = new Item();
33274 }
33275 else if (itemToPickUp.type == 4143)
33276 {
33277 SoundEngine.PlaySound(7, (int)position.X, (int)position.Y);
33278 statMana += 50;
33279 if (Main.myPlayer == whoAmI)
33280 {
33281 ManaEffect(50);
33282 }
33283 if (statMana > statManaMax2)
33284 {
33285 statMana = statManaMax2;
33286 }
33287 itemToPickUp = new Item();
33288 }
33289 else
33290 {
33292 }
33294 if (Main.netMode == 1)
33295 {
33296 NetMessage.SendData(21, -1, -1, null, worldItemArrayIndex);
33297 }
33298 return itemToPickUp;
33299 }
33300
33301 public void Heal(int amount)
33302 {
33303 statLife += amount;
33304 if (Main.myPlayer == whoAmI)
33305 {
33306 HealEffect(amount);
33307 }
33308 if (statLife > statLifeMax2)
33309 {
33310 statLife = statLifeMax2;
33311 }
33312 }
33313
33315 {
33316 int num = defaultItemGrabRange;
33317 if (goldRing && item.IsACoin)
33318 {
33319 num += Item.coinGrabRange;
33320 }
33321 if (manaMagnet && (item.type == 184 || item.type == 1735 || item.type == 1868))
33322 {
33323 num += Item.manaGrabRange;
33324 }
33325 if (item.type == 4143)
33326 {
33327 num += Item.manaGrabRange;
33328 }
33329 if (lifeMagnet && (item.type == 58 || item.type == 1734 || item.type == 1867))
33330 {
33331 num += Item.lifeGrabRange;
33332 }
33333 if (treasureMagnet)
33334 {
33335 num += Item.treasureGrabRange;
33336 }
33337 if (item.type == 3822)
33338 {
33339 num += 50;
33340 }
33341 if (ItemID.Sets.NebulaPickup[item.type])
33342 {
33343 num += 100;
33344 }
33346 {
33347 num += 240;
33348 }
33349 return num;
33350 }
33351
33352 public bool SellItem(Item item, int stack = -1)
33353 {
33354 GetItemExpectedPrice(item, out var calcForSelling, out var calcForBuying);
33355 if (calcForSelling <= 0)
33356 {
33357 return false;
33358 }
33359 if (stack == -1)
33360 {
33361 stack = item.stack;
33362 }
33363 Item[] array = new Item[58];
33364 for (int i = 0; i < 58; i++)
33365 {
33366 array[i] = new Item();
33367 array[i] = inventory[i].Clone();
33368 }
33369 long num = calcForSelling / 5;
33370 if (num < 1)
33371 {
33372 num = 1L;
33373 }
33374 long num2 = num;
33375 num *= stack;
33376 int amount = Main.shopSellbackHelper.GetAmount(item);
33377 if (amount > 0)
33378 {
33379 num += (-num2 + calcForBuying) * Math.Min(amount, item.stack);
33380 }
33381 bool flag = false;
33382 while (num >= 1000000 && !flag)
33383 {
33384 int num3 = -1;
33385 for (int num4 = 53; num4 >= 0; num4--)
33386 {
33387 if (num3 == -1 && (inventory[num4].type == 0 || inventory[num4].stack == 0))
33388 {
33389 num3 = num4;
33390 }
33391 while (inventory[num4].type == 74 && inventory[num4].stack < inventory[num4].maxStack && num >= 1000000)
33392 {
33393 inventory[num4].stack++;
33394 num -= 1000000;
33395 DoCoins(num4);
33396 if (inventory[num4].stack == 0 && num3 == -1)
33397 {
33398 num3 = num4;
33399 }
33400 }
33401 }
33402 if (num >= 1000000)
33403 {
33404 if (num3 == -1)
33405 {
33406 flag = true;
33407 continue;
33408 }
33409 inventory[num3].SetDefaults(74);
33410 num -= 1000000;
33411 }
33412 }
33413 while (num >= 10000 && !flag)
33414 {
33415 int num5 = -1;
33416 for (int num6 = 53; num6 >= 0; num6--)
33417 {
33418 if (num5 == -1 && (inventory[num6].type == 0 || inventory[num6].stack == 0))
33419 {
33420 num5 = num6;
33421 }
33422 while (inventory[num6].type == 73 && inventory[num6].stack < inventory[num6].maxStack && num >= 10000)
33423 {
33424 inventory[num6].stack++;
33425 num -= 10000;
33426 DoCoins(num6);
33427 if (inventory[num6].stack == 0 && num5 == -1)
33428 {
33429 num5 = num6;
33430 }
33431 }
33432 }
33433 if (num >= 10000)
33434 {
33435 if (num5 == -1)
33436 {
33437 flag = true;
33438 continue;
33439 }
33440 inventory[num5].SetDefaults(73);
33441 num -= 10000;
33442 }
33443 }
33444 while (num >= 100 && !flag)
33445 {
33446 int num7 = -1;
33447 for (int num8 = 53; num8 >= 0; num8--)
33448 {
33449 if (num7 == -1 && (inventory[num8].type == 0 || inventory[num8].stack == 0))
33450 {
33451 num7 = num8;
33452 }
33453 while (inventory[num8].type == 72 && inventory[num8].stack < inventory[num8].maxStack && num >= 100)
33454 {
33455 inventory[num8].stack++;
33456 num -= 100;
33457 DoCoins(num8);
33458 if (inventory[num8].stack == 0 && num7 == -1)
33459 {
33460 num7 = num8;
33461 }
33462 }
33463 }
33464 if (num >= 100)
33465 {
33466 if (num7 == -1)
33467 {
33468 flag = true;
33469 continue;
33470 }
33471 inventory[num7].SetDefaults(72);
33472 num -= 100;
33473 }
33474 }
33475 while (num >= 1 && !flag)
33476 {
33477 int num9 = -1;
33478 for (int num10 = 53; num10 >= 0; num10--)
33479 {
33480 if (num9 == -1 && (inventory[num10].type == 0 || inventory[num10].stack == 0))
33481 {
33482 num9 = num10;
33483 }
33484 while (inventory[num10].type == 71 && inventory[num10].stack < inventory[num10].maxStack && num >= 1)
33485 {
33486 inventory[num10].stack++;
33487 num--;
33488 DoCoins(num10);
33489 if (inventory[num10].stack == 0 && num9 == -1)
33490 {
33491 num9 = num10;
33492 }
33493 }
33494 }
33495 if (num >= 1)
33496 {
33497 if (num9 == -1)
33498 {
33499 flag = true;
33500 continue;
33501 }
33502 inventory[num9].SetDefaults(71);
33503 num--;
33504 }
33505 }
33506 if (flag)
33507 {
33508 for (int j = 0; j < 58; j++)
33509 {
33510 inventory[j] = array[j].Clone();
33511 }
33512 return false;
33513 }
33514 return true;
33515 }
33516
33517 public void RefreshItems(bool onlyIfVariantChanged = true)
33518 {
33519 if (onlyIfVariantChanged && whoAmI == Main.myPlayer)
33520 {
33522 }
33523 RefreshItems(inventory, onlyIfVariantChanged);
33524 RefreshItems(armor, onlyIfVariantChanged);
33525 RefreshItems(dye, onlyIfVariantChanged);
33526 RefreshItems(miscEquips, onlyIfVariantChanged);
33527 RefreshItems(miscDyes, onlyIfVariantChanged);
33528 RefreshItems(bank.item, onlyIfVariantChanged);
33529 RefreshItems(bank2.item, onlyIfVariantChanged);
33530 RefreshItems(bank3.item, onlyIfVariantChanged);
33531 RefreshItems(bank4.item, onlyIfVariantChanged);
33532 RefreshItems(_temporaryItemSlots, onlyIfVariantChanged);
33533 }
33534
33536 {
33537 for (int i = 0; i < array.Length; i++)
33538 {
33539 array[i]?.Refresh(onlyIfVariantChanged);
33540 }
33541 }
33542
33544 {
33545 if (item.shopSpecialCurrency != -1)
33546 {
33548 return;
33549 }
33550 int storeValue = item.GetStoreValue();
33553 if (discountAvailable)
33554 {
33555 if (!item.buyOnce)
33556 {
33557 calcForBuying = (int)((float)calcForBuying * 0.8f);
33558 }
33559 if (item.isAShopItem)
33560 {
33562 }
33563 }
33564 if (item.buyOnce)
33565 {
33566 calcForBuying = (int)Math.Round((double)calcForBuying / currentShoppingSettings.PriceAdjustment);
33567 calcForSelling = (int)Math.Round((double)calcForSelling / currentShoppingSettings.PriceAdjustment);
33568 }
33569 else
33570 {
33571 calcForBuying = (int)Math.Round((double)calcForBuying * currentShoppingSettings.PriceAdjustment);
33572 calcForSelling = (int)Math.Round((double)calcForSelling / currentShoppingSettings.PriceAdjustment);
33573 }
33574 if (item.buyOnce)
33575 {
33576 calcForBuying /= 5L;
33577 if (storeValue != 0 && calcForBuying < 1)
33578 {
33579 calcForBuying = 1L;
33580 }
33581 }
33582 }
33583
33584 public bool BuyItem(long price, int customCurrency = -1)
33585 {
33586 if (customCurrency != -1)
33587 {
33589 }
33590 bool overFlowing;
33591 long num = Utils.CoinsCount(out overFlowing, inventory, 58, 57, 56, 55, 54);
33592 long num2 = Utils.CoinsCount(out overFlowing, bank.item);
33593 long num3 = Utils.CoinsCount(out overFlowing, bank2.item);
33594 long num4 = Utils.CoinsCount(out overFlowing, bank3.item);
33595 long num5 = Utils.CoinsCount(out overFlowing, bank4.item);
33597 {
33598 return false;
33599 }
33608 list.Add(inventory);
33609 list.Add(bank.item);
33610 list.Add(bank2.item);
33611 list.Add(bank3.item);
33612 list.Add(bank4.item);
33613 for (int i = 0; i < list.Count; i++)
33614 {
33615 dictionary[i] = new List<int>();
33616 }
33617 dictionary[0] = new List<int> { 58, 57, 56, 55, 54 };
33618 for (int j = 0; j < list.Count; j++)
33619 {
33620 for (int k = 0; k < list[j].Length; k++)
33621 {
33622 if (!dictionary[j].Contains(k) && list[j][k].IsACoin)
33623 {
33624 list3.Add(new Point(j, k));
33625 }
33626 }
33627 }
33628 int num6 = 0;
33629 for (int num7 = list[num6].Length - 1; num7 >= 0; num7--)
33630 {
33631 if (!dictionary[num6].Contains(num7) && (list[num6][num7].type == 0 || list[num6][num7].stack == 0))
33632 {
33633 list2.Add(new Point(num6, num7));
33634 }
33635 }
33636 num6 = 1;
33637 for (int num8 = list[num6].Length - 1; num8 >= 0; num8--)
33638 {
33639 if (!dictionary[num6].Contains(num8) && (list[num6][num8].type == 0 || list[num6][num8].stack == 0))
33640 {
33641 list4.Add(new Point(num6, num8));
33642 }
33643 }
33644 num6 = 2;
33645 for (int num9 = list[num6].Length - 1; num9 >= 0; num9--)
33646 {
33647 if (!dictionary[num6].Contains(num9) && (list[num6][num9].type == 0 || list[num6][num9].stack == 0))
33648 {
33649 list5.Add(new Point(num6, num9));
33650 }
33651 }
33652 num6 = 3;
33653 for (int num10 = list[num6].Length - 1; num10 >= 0; num10--)
33654 {
33655 if (!dictionary[num6].Contains(num10) && (list[num6][num10].type == 0 || list[num6][num10].stack == 0))
33656 {
33657 list6.Add(new Point(num6, num10));
33658 }
33659 }
33660 num6 = 4;
33661 for (int num11 = list[num6].Length - 1; num11 >= 0; num11--)
33662 {
33663 if (!dictionary[num6].Contains(num11) && (list[num6][num11].type == 0 || list[num6][num11].stack == 0))
33664 {
33665 list7.Add(new Point(num6, num11));
33666 }
33667 }
33668 if (TryPurchasing(price, list, list3, list2, list4, list5, list6, list7))
33669 {
33670 return false;
33671 }
33672 return true;
33673 }
33674
33676 {
33677 long num = price;
33679 bool result = false;
33680 while (num > 0)
33681 {
33682 long num2 = 1000000L;
33683 for (int i = 0; i < 4; i++)
33684 {
33685 if (num >= num2)
33686 {
33687 foreach (Point slotCoin in slotCoins)
33688 {
33689 if (inv[slotCoin.X][slotCoin.Y].type == 74 - i)
33690 {
33691 long num3 = num / num2;
33692 dictionary[slotCoin] = inv[slotCoin.X][slotCoin.Y].Clone();
33693 if (num3 < inv[slotCoin.X][slotCoin.Y].stack)
33694 {
33695 inv[slotCoin.X][slotCoin.Y].stack -= (int)num3;
33696 }
33697 else
33698 {
33699 inv[slotCoin.X][slotCoin.Y].SetDefaults();
33701 }
33702 num -= num2 * (dictionary[slotCoin].stack - inv[slotCoin.X][slotCoin.Y].stack);
33703 }
33704 }
33705 }
33706 num2 /= 100;
33707 }
33708 if (num <= 0)
33709 {
33710 continue;
33711 }
33712 if (slotsEmpty.Count > 0)
33713 {
33715 Point item = new Point(-1, -1);
33716 for (int j = 0; j < inv.Count; j++)
33717 {
33718 num2 = 10000L;
33719 for (int k = 0; k < 3; k++)
33720 {
33721 if (num >= num2)
33722 {
33723 foreach (Point slotCoin2 in slotCoins)
33724 {
33725 if (slotCoin2.X == j && inv[slotCoin2.X][slotCoin2.Y].type == 74 - k && inv[slotCoin2.X][slotCoin2.Y].stack >= 1)
33726 {
33728 if (j == 1 && slotEmptyBank.Count > 0)
33729 {
33731 }
33732 if (j == 2 && slotEmptyBank2.Count > 0)
33733 {
33735 }
33736 if (j == 3 && slotEmptyBank3.Count > 0)
33737 {
33739 }
33740 if (j == 4 && slotEmptyBank4.Count > 0)
33741 {
33743 }
33744 if (--inv[slotCoin2.X][slotCoin2.Y].stack <= 0)
33745 {
33746 inv[slotCoin2.X][slotCoin2.Y].SetDefaults();
33748 }
33749 dictionary[list[0]] = inv[list[0].X][list[0].Y].Clone();
33750 inv[list[0].X][list[0].Y].SetDefaults(73 - k);
33751 inv[list[0].X][list[0].Y].stack = 100;
33752 item = list[0];
33753 list.RemoveAt(0);
33754 break;
33755 }
33756 }
33757 }
33758 if (item.X != -1 || item.Y != -1)
33759 {
33760 break;
33761 }
33762 num2 /= 100;
33763 }
33764 for (int l = 0; l < 2; l++)
33765 {
33766 if (item.X != -1 || item.Y != -1)
33767 {
33768 continue;
33769 }
33770 foreach (Point slotCoin3 in slotCoins)
33771 {
33772 if (slotCoin3.X == j && inv[slotCoin3.X][slotCoin3.Y].type == 73 + l && inv[slotCoin3.X][slotCoin3.Y].stack >= 1)
33773 {
33775 if (j == 1 && slotEmptyBank.Count > 0)
33776 {
33778 }
33779 if (j == 2 && slotEmptyBank2.Count > 0)
33780 {
33782 }
33783 if (j == 3 && slotEmptyBank3.Count > 0)
33784 {
33786 }
33787 if (j == 4 && slotEmptyBank4.Count > 0)
33788 {
33790 }
33791 if (--inv[slotCoin3.X][slotCoin3.Y].stack <= 0)
33792 {
33793 inv[slotCoin3.X][slotCoin3.Y].SetDefaults();
33795 }
33796 dictionary[list2[0]] = inv[list2[0].X][list2[0].Y].Clone();
33797 inv[list2[0].X][list2[0].Y].SetDefaults(72 + l);
33798 inv[list2[0].X][list2[0].Y].stack = 100;
33799 item = list2[0];
33800 list2.RemoveAt(0);
33801 break;
33802 }
33803 }
33804 }
33805 if (item.X != -1 && item.Y != -1)
33806 {
33808 break;
33809 }
33810 }
33816 continue;
33817 }
33819 {
33820 inv[item2.Key.X][item2.Key.Y] = item2.Value.Clone();
33821 }
33822 result = true;
33823 break;
33824 }
33825 return result;
33826 }
33827
33828 public void AdjTiles()
33829 {
33830 int num = 4;
33831 int num2 = 3;
33832 if (ateArtisanBread)
33833 {
33834 num += 4;
33835 num2 += 4;
33836 }
33837 for (int i = 0; i < TileID.Count; i++)
33838 {
33839 oldAdjTile[i] = adjTile[i];
33840 adjTile[i] = false;
33841 }
33842 oldAdjWater = adjWater;
33843 adjWater = false;
33844 oldAdjHoney = adjHoney;
33845 adjHoney = false;
33846 oldAdjLava = adjLava;
33847 adjLava = false;
33848 alchemyTable = false;
33849 int num3 = (int)((position.X + (float)(width / 2)) / 16f);
33850 int num4 = (int)((position.Y + (float)height) / 16f);
33851 for (int j = num3 - num; j <= num3 + num; j++)
33852 {
33853 for (int k = num4 - num2; k < num4 + num2; k++)
33854 {
33855 if (Main.tile[j, k].active())
33856 {
33857 adjTile[Main.tile[j, k].type] = true;
33858 switch (Main.tile[j, k].type)
33859 {
33860 case 77:
33861 case 302:
33862 adjTile[17] = true;
33863 break;
33864 case 133:
33865 adjTile[17] = true;
33866 adjTile[77] = true;
33867 break;
33868 case 134:
33869 adjTile[16] = true;
33870 break;
33871 case 354:
33872 case 469:
33873 case 487:
33874 adjTile[14] = true;
33875 break;
33876 case 355:
33877 adjTile[13] = true;
33878 adjTile[14] = true;
33879 alchemyTable = true;
33880 break;
33881 }
33882 }
33883 if (Main.tile[j, k].liquid > 200 && Main.tile[j, k].liquidType() == 0)
33884 {
33885 adjWater = true;
33886 }
33887 if (Main.tile[j, k].liquid > 200 && Main.tile[j, k].liquidType() == 2)
33888 {
33889 adjHoney = true;
33890 }
33891 if (Main.tile[j, k].liquid > 200 && Main.tile[j, k].liquidType() == 1)
33892 {
33893 adjLava = true;
33894 }
33895 }
33896 }
33897 if (!Main.playerInventory)
33898 {
33899 return;
33900 }
33901 bool flag = false;
33902 for (int l = 0; l < TileID.Count; l++)
33903 {
33904 if (oldAdjTile[l] != adjTile[l])
33905 {
33906 flag = true;
33907 break;
33908 }
33909 }
33910 if (adjWater != oldAdjWater)
33911 {
33912 flag = true;
33913 }
33914 if (adjHoney != oldAdjHoney)
33915 {
33916 flag = true;
33917 }
33918 if (adjLava != oldAdjLava)
33919 {
33920 flag = true;
33921 }
33922 if (flag)
33923 {
33925 }
33926 }
33927
33929 {
33930 Point point = position.ToTileCoordinates();
33931 Point point2 = base.BottomRight.ToTileCoordinates();
33932 settings.GetRanges(this, out var x, out var y);
33933 int num = Utils.Clamp(point.X - x + 1, 0, Main.maxTilesX - 1);
33934 int num2 = Utils.Clamp(point2.X + x - 1, 0, Main.maxTilesX - 1);
33935 int num3 = Utils.Clamp(point.Y - y + 1, 0, Main.maxTilesY - 1);
33936 int num4 = Utils.Clamp(point2.Y + y - 2, 0, Main.maxTilesY - 1);
33937 for (int i = num; i <= num2; i++)
33938 {
33939 for (int j = num3; j <= num4; j++)
33940 {
33941 Tile tile = Main.tile[i, j];
33942 if (tile != null && tile.active() && tile.type == targetTileType)
33943 {
33944 return true;
33945 }
33946 }
33947 }
33948 return false;
33949 }
33950
33951 public void DisplayDollUpdate()
33952 {
33953 if (!Main.gamePaused)
33954 {
33955 UpdateMiscCounter();
33956 }
33957 }
33958
33959 public bool IsColorfulDye(int dye)
33960 {
33961 if (dye > 0)
33962 {
33963 return ItemID.Sets.ColorfulDyeValues[dye];
33964 }
33965 return false;
33966 }
33967
33969 {
33970 bool result = hasFootball && !pulley && !compositeBackArm.enabled;
33971 if (HeldItem.type == 4743 && itemAnimation > 0)
33972 {
33973 result = false;
33974 }
33975 return result;
33976 }
33977
33978 public void PlayerFrame()
33979 {
33980 if (swimTime > 0)
33981 {
33982 swimTime--;
33983 if (!wet)
33984 {
33985 swimTime = 0;
33986 }
33987 }
33988 head = armor[0].headSlot;
33989 body = armor[1].bodySlot;
33990 legs = armor[2].legSlot;
33991 if (armor[10].headSlot >= 0)
33992 {
33993 head = armor[10].headSlot;
33994 }
33995 if (armor[11].bodySlot >= 0)
33996 {
33997 body = armor[11].bodySlot;
33998 }
33999 if (armor[12].legSlot >= 0)
34000 {
34001 legs = armor[12].legSlot;
34002 }
34003 if (!dead)
34004 {
34005 UpdateVisibleAccessories();
34006 }
34007 wearsRobe = false;
34008 bool somethingSpecial = false;
34010 request.Head = head;
34011 request.Body = body;
34012 request.Legs = legs;
34013 request.Male = Male;
34014 request.ArmorSlotRequested = 1;
34015 int num = SetMatch(request, ref wearsRobe);
34016 if (num != -1)
34017 {
34018 legs = num;
34019 }
34020 request = default(SetMatchRequest);
34021 request.Head = head;
34022 request.Body = body;
34023 request.Legs = legs;
34024 request.Male = Male;
34025 request.ArmorSlotRequested = 2;
34026 num = SetMatch(request, ref somethingSpecial);
34027 if (num != -1)
34028 {
34029 legs = num;
34030 }
34031 request = default(SetMatchRequest);
34032 request.Head = head;
34033 request.Body = body;
34034 request.Legs = legs;
34035 request.Male = Male;
34036 request.ArmorSlotRequested = 0;
34037 num = SetMatch(request, ref somethingSpecial);
34038 if (num != -1)
34039 {
34040 head = num;
34041 }
34042 if (body == 93)
34043 {
34044 shield = 0;
34045 handoff = 0;
34046 }
34047 if (body > 0 && ArmorIDs.Body.Sets.DisableHandOnAndOffAccDraw[body])
34048 {
34049 handon = 0;
34050 handoff = 0;
34051 }
34052 if (body > 0 && waist > 0 && ArmorIDs.Body.Sets.DisableBeltAccDraw[body] && ArmorIDs.Waist.Sets.IsABelt[waist])
34053 {
34054 waist = 0;
34055 }
34056 if (!dead && body >= 0)
34057 {
34059 if (b != -1)
34060 {
34062 {
34063 backpack = b;
34064 cBackpack = cBody;
34065 }
34067 {
34068 tail = b;
34069 cTail = cBody;
34070 }
34071 else if (back == -1)
34072 {
34073 back = b;
34074 cBack = cBody;
34075 }
34076 }
34077 sbyte b2 = (sbyte)ArmorIDs.Body.Sets.IncludedCapeFront[body];
34078 if (b2 != -1 && front == -1)
34079 {
34080 front = b2;
34081 cFront = cBody;
34082 }
34084 if (!includeCapeFrontAndBackInfo.Invalid && back == -1 && front == -1)
34085 {
34086 front = includeCapeFrontAndBackInfo.frontCape;
34087 cFront = cBody;
34088 sbyte backCape = includeCapeFrontAndBackInfo.backCape;
34089 if (ArmorIDs.Back.Sets.DrawInBackpackLayer[backCape])
34090 {
34091 backpack = backCape;
34092 cBackpack = cBody;
34093 }
34094 else if (ArmorIDs.Back.Sets.DrawInTailLayer[backCape])
34095 {
34096 tail = backCape;
34097 cTail = cBody;
34098 }
34099 else if (!sitting.isSitting)
34100 {
34101 back = backCape;
34102 cBack = cBody;
34103 }
34104 }
34105 }
34106 if (legs == 67)
34107 {
34108 shoe = 0;
34109 }
34110 if (legs == 140)
34111 {
34112 shoe = 0;
34113 }
34114 bool flag = false;
34115 if ((wereWolf || forceWerewolf) && !hideWolf)
34116 {
34117 legs = 20;
34118 body = 21;
34119 head = 38;
34120 flag = true;
34121 }
34122 bool flag2 = wet && !lavaWet && (!mount.Active || !mount.IsConsideredASlimeMount);
34123 if (merman || forceMerman)
34124 {
34125 if (!hideMerman)
34126 {
34127 head = 39;
34128 legs = 21;
34129 body = 22;
34130 flag = true;
34131 }
34132 if (flag2)
34133 {
34134 wings = 0;
34135 }
34136 }
34137 socialShadowRocketBoots = false;
34138 socialIgnoreLight = false;
34139 socialGhost = false;
34140 armorEffectDrawShadow = false;
34141 armorEffectDrawShadowSubtle = false;
34142 armorEffectDrawOutlines = false;
34143 armorEffectDrawShadowLokis = false;
34144 armorEffectDrawShadowBasilisk = false;
34145 armorEffectDrawOutlinesForbidden = false;
34146 armorEffectDrawShadowEOCShield = false;
34147 if (!isDisplayDollOrInanimate)
34148 {
34149 if (head == 101 && body == 66 && legs == 55)
34150 {
34151 socialGhost = true;
34152 }
34153 if (head == 156 && body == 66 && legs == 55)
34154 {
34155 socialGhost = true;
34156 }
34157 SetArmorEffectVisuals(this);
34158 }
34159 hermesStepSound.SoundType = 17;
34160 hermesStepSound.SoundStyle = -1;
34161 hermesStepSound.IntendedCooldown = 9;
34162 if (head == 99 && body == 65 && legs == 54)
34163 {
34164 turtleArmor = true;
34165 }
34166 if (head == 162 && body == 170 && legs == 105)
34167 {
34168 spiderArmor = true;
34169 }
34170 ApplyArmorSoundAndDustChanges();
34171 if (legs == 140)
34172 {
34173 hermesStepSound.SoundType = 2;
34174 hermesStepSound.SoundStyle = 24;
34175 hermesStepSound.IntendedCooldown = 6;
34176 }
34177 if (flag)
34178 {
34179 face = -1;
34180 faceFlower = -1;
34181 faceHead = -1;
34182 }
34183 if (head > 0 && face > 0)
34184 {
34185 if (ArmorIDs.Face.Sets.OverrideHelmet[face])
34186 {
34187 head = -1;
34188 faceHead = -1;
34189 }
34191 {
34192 face = -1;
34193 }
34194 }
34195 if (head > 0 && faceHead > 0 && ArmorIDs.Head.Sets.UseAltFaceHeadDraw[head])
34196 {
34197 sbyte b3 = (sbyte)ArmorIDs.Face.Sets.AltFaceHead[faceHead];
34198 if (b3 > 0)
34199 {
34200 faceHead = b3;
34201 }
34202 }
34203 if (webbed || frozen || stoned || (Main.gamePaused && !Main.gameMenu))
34204 {
34205 return;
34206 }
34207 if (head == 267 && body == 236 && (legs == 219 || legs == 220) && miscCounter % 15 == 0 && Main.rand.Next(3) == 0)
34208 {
34209 Vector2 center = base.Center;
34210 float num2 = 1f + Main.rand.NextFloat() * 0.5f;
34211 if (Main.rand.Next(2) == 0)
34212 {
34213 num2 *= -1f;
34214 }
34215 center += new Vector2(num2 * -25f, -8f);
34216 Dust obj = Main.dust[Dust.NewDust(center, 2, 2, 304, 0f, 0f, 100)];
34217 obj.rotation = Main.rand.NextFloat() * ((float)Math.PI * 2f);
34218 obj.alpha = 254;
34219 obj.velocity.X = num2 * 0.2f;
34220 obj.noGravity = true;
34221 obj.customData = this;
34222 obj.shader = GameShaders.Armor.GetSecondaryShader(cBody, this);
34223 }
34224 if (!isDisplayDollOrInanimate)
34225 {
34226 if (((body == 68 && legs == 57 && head == 106) || (body == 74 && legs == 63 && head == 106)) && Main.rand.Next(10) == 0)
34227 {
34228 int num3 = Dust.NewDust(new Vector2(position.X - velocity.X * 2f, position.Y - 2f - velocity.Y * 2f), width, height, 43, 0f, 0f, 100, new Color(255, 0, 255), 0.3f);
34229 Main.dust[num3].fadeIn = 0.8f;
34230 Main.dust[num3].noGravity = true;
34231 Main.dust[num3].velocity *= 2f;
34232 Main.dust[num3].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34233 }
34234 if (wings == 27 && wingsLogic == wings)
34235 {
34236 float num4 = 0.4f * stealth;
34237 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, num4, num4 * 0.9f, num4 * 0.2f);
34238 }
34239 if (head == 5 && body == 5 && legs == 5)
34240 {
34241 socialShadowRocketBoots = true;
34242 }
34243 if (head == 5 && body == 5 && legs == 5 && Main.rand.Next(10) == 0)
34244 {
34245 int num5 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 14, 0f, 0f, 200, default(Color), 1.2f);
34246 Main.dust[num5].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34247 }
34248 if (head == 76 && body == 49 && legs == 45)
34249 {
34250 socialShadowRocketBoots = true;
34251 }
34252 if (head == 74 && body == 48 && legs == 44)
34253 {
34254 socialShadowRocketBoots = true;
34255 }
34256 if (head == 74 && body == 48 && legs == 44 && Main.rand.Next(10) == 0)
34257 {
34258 int num6 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 14, 0f, 0f, 200, default(Color), 1.2f);
34259 Main.dust[num6].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34260 }
34261 if (head == 57 && body == 37 && legs == 35)
34262 {
34263 int maxValue = 10;
34264 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) > 1f)
34265 {
34266 maxValue = 2;
34267 }
34268 if (Main.rand.Next(maxValue) == 0)
34269 {
34270 int num7 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 115, 0f, 0f, 140, default(Color), 0.75f);
34271 Main.dust[num7].noGravity = true;
34272 Main.dust[num7].fadeIn = 1.5f;
34273 Main.dust[num7].velocity *= 0.3f;
34274 Main.dust[num7].velocity += velocity * 0.2f;
34275 Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34276 }
34277 }
34278 if (head == 6 && body == 6 && legs == 6 && Math.Abs(velocity.X) + Math.Abs(velocity.Y) > 1f && !rocketFrame)
34279 {
34280 for (int i = 0; i < 2; i++)
34281 {
34282 int num8 = Dust.NewDust(new Vector2(position.X - velocity.X * 2f, position.Y - 2f - velocity.Y * 2f), width, height, 6, 0f, 0f, 100, default(Color), 2f);
34283 Main.dust[num8].noGravity = true;
34284 Main.dust[num8].noLight = true;
34285 Main.dust[num8].velocity.X -= velocity.X * 0.5f;
34286 Main.dust[num8].velocity.Y -= velocity.Y * 0.5f;
34287 Main.dust[num8].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34288 }
34289 }
34290 if (head == 8 && body == 8 && legs == 8 && Math.Abs(velocity.X) + Math.Abs(velocity.Y) > 1f)
34291 {
34292 int num9 = Dust.NewDust(new Vector2(position.X - velocity.X * 2f, position.Y - 2f - velocity.Y * 2f), width, height, 40, 0f, 0f, 50, default(Color), 1.4f);
34293 Main.dust[num9].noGravity = true;
34294 Main.dust[num9].velocity.X = velocity.X * 0.25f;
34295 Main.dust[num9].velocity.Y = velocity.Y * 0.25f;
34296 Main.dust[num9].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34297 }
34298 if (head == 9 && body == 9 && legs == 9 && Math.Abs(velocity.X) + Math.Abs(velocity.Y) > 1f && !rocketFrame)
34299 {
34300 for (int j = 0; j < 2; j++)
34301 {
34302 int num10 = Dust.NewDust(new Vector2(position.X - velocity.X * 2f, position.Y - 2f - velocity.Y * 2f), width, height, 6, 0f, 0f, 100, default(Color), 2f);
34303 Main.dust[num10].noGravity = true;
34304 Main.dust[num10].noLight = true;
34305 Main.dust[num10].velocity.X -= velocity.X * 0.5f;
34306 Main.dust[num10].velocity.Y -= velocity.Y * 0.5f;
34307 Main.dust[num10].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34308 }
34309 }
34310 if (body == 18 && legs == 17 && (head == 32 || head == 33 || head == 34) && Main.rand.Next(10) == 0)
34311 {
34312 int num11 = Dust.NewDust(new Vector2(position.X - velocity.X * 2f, position.Y - 2f - velocity.Y * 2f), width, height, 43, 0f, 0f, 100, default(Color), 0.3f);
34313 Main.dust[num11].fadeIn = 0.8f;
34314 Main.dust[num11].velocity *= 0f;
34315 Main.dust[num11].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34316 }
34317 if ((body == 24 || body == 229) && (legs == 23 || legs == 212) && (head == 43 || head == 41 || head == 42 || head == 254 || head == 255 || head == 256 || head == 257 || head == 258) && velocity.X != 0f && velocity.Y != 0f && Main.rand.Next(10) == 0)
34318 {
34319 int num12 = Dust.NewDust(new Vector2(position.X - velocity.X * 2f, position.Y - 2f - velocity.Y * 2f), width, height, 43, 0f, 0f, 100, default(Color), 0.3f);
34320 Main.dust[num12].fadeIn = 0.8f;
34321 Main.dust[num12].velocity *= 0f;
34322 Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34323 }
34324 if (body == 36 && head == 56 && velocity.X != 0f && velocity.Y == 0f)
34325 {
34326 for (int k = 0; k < 2; k++)
34327 {
34328 int num13 = Dust.NewDust(new Vector2(position.X, position.Y + (float)((gravDir == 1f) ? (height - 2) : (-4))), width, 6, 106, 0f, 0f, 100, default(Color), 0.1f);
34329 Main.dust[num13].fadeIn = 1f;
34330 Main.dust[num13].noGravity = true;
34331 Main.dust[num13].velocity *= 0.2f;
34332 Main.dust[num13].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34333 }
34334 }
34335 if (body == 27 && head == 46 && legs == 26 && velocity.X != 0f && velocity.Y == 0f && miscCounter % 2 == 0)
34336 {
34337 for (int l = 0; l < 2; l++)
34338 {
34339 int num14 = ((l != 0) ? Dust.NewDust(new Vector2(position.X + (float)(width / 2), position.Y + (float)height + gfxOffY), width / 2, 6, 76, 0f, 0f, 0, default(Color), 1.35f) : Dust.NewDust(new Vector2(position.X, position.Y + (float)height + gfxOffY), width / 2, 6, 76, 0f, 0f, 0, default(Color), 1.35f));
34340 Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20, 40) * 0.01f;
34341 Main.dust[num14].noGravity = true;
34342 Main.dust[num14].noLight = true;
34343 Main.dust[num14].velocity *= 0.001f;
34344 Main.dust[num14].velocity.Y -= 0.003f;
34345 Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34346 }
34347 }
34348 }
34349 drawingFootball = false;
34350 if (ShouldDrawFootball())
34351 {
34352 SetCompositeArmBack(enabled: true, CompositeArmStretchAmount.Full, (float)Math.PI / 10f * (float)direction * -1f);
34353 drawingFootball = true;
34354 }
34355 Item.GetDrawHitbox(HeldItem.type, this);
34356 bool flag3 = CanVisuallyHoldItem(HeldItem);
34357 bool flag4 = HeldItem.type != 4952;
34358 if (mount.Active)
34359 {
34360 legFrameCounter = 0.0;
34361 legFrame.Y = legFrame.Height * 6;
34362 if (mount.Type == 23 || mount.Type == 45 || mount.Type == 48)
34363 {
34364 ref Rectangle reference = ref legFrame;
34365 _ = legFrame;
34366 reference.Y = 0;
34367 }
34368 if (velocity.Y != 0f)
34369 {
34370 if (mount.FlyTime > 0 && jump == 0 && controlJump && !mount.CanHover())
34371 {
34372 if (mount.Type == 0)
34373 {
34374 if (direction > 0)
34375 {
34376 if (Main.rand.Next(4) == 0)
34377 {
34378 int num15 = Dust.NewDust(new Vector2(base.Center.X - 22f, position.Y + (float)height - 6f), 20, 10, 64, velocity.X * 0.25f, velocity.Y * 0.25f, 255);
34379 Main.dust[num15].velocity *= 0.1f;
34380 Main.dust[num15].noLight = true;
34381 }
34382 if (Main.rand.Next(4) == 0)
34383 {
34384 int num16 = Dust.NewDust(new Vector2(base.Center.X + 12f, position.Y + (float)height - 6f), 20, 10, 64, velocity.X * 0.25f, velocity.Y * 0.25f, 255);
34385 Main.dust[num16].velocity *= 0.1f;
34386 Main.dust[num16].noLight = true;
34387 }
34388 }
34389 else
34390 {
34391 if (Main.rand.Next(4) == 0)
34392 {
34393 int num17 = Dust.NewDust(new Vector2(base.Center.X - 32f, position.Y + (float)height - 6f), 20, 10, 64, velocity.X * 0.25f, velocity.Y * 0.25f, 255);
34394 Main.dust[num17].velocity *= 0.1f;
34395 Main.dust[num17].noLight = true;
34396 }
34397 if (Main.rand.Next(4) == 0)
34398 {
34399 int num18 = Dust.NewDust(new Vector2(base.Center.X + 2f, position.Y + (float)height - 6f), 20, 10, 64, velocity.X * 0.25f, velocity.Y * 0.25f, 255);
34400 Main.dust[num18].velocity *= 0.1f;
34401 Main.dust[num18].noLight = true;
34402 }
34403 }
34404 }
34405 mount.TryBeginningFlight(this, 3);
34406 mount.UpdateFrame(this, 3, velocity);
34407 mount.TryLanding(this);
34408 }
34409 else if (wet)
34410 {
34411 mount.UpdateFrame(this, 4, velocity);
34412 }
34413 else
34414 {
34415 mount.TryBeginningFlight(this, 2);
34416 mount.UpdateFrame(this, 2, velocity);
34417 mount.TryLanding(this);
34418 }
34419 }
34420 else
34421 {
34422 mount.UpdateFrame(this, mount.GetIntendedGroundedFrame(this), velocity);
34423 }
34424 }
34425 else if (legs != 140)
34426 {
34427 if (swimTime > 0)
34428 {
34429 legFrameCounter += 2.0;
34430 while (legFrameCounter > 8.0)
34431 {
34432 legFrameCounter -= 8.0;
34433 legFrame.Y += legFrame.Height;
34434 }
34435 if (legFrame.Y < legFrame.Height * 7)
34436 {
34437 legFrame.Y = legFrame.Height * 19;
34438 }
34439 else if (legFrame.Y > legFrame.Height * 19)
34440 {
34441 legFrame.Y = legFrame.Height * 7;
34442 }
34443 }
34444 else if (velocity.Y != 0f || grappling[0] > -1)
34445 {
34446 legFrameCounter = 0.0;
34447 legFrame.Y = legFrame.Height * 5;
34448 if ((wings == 22 || wings == 28 || wings == 45) && ShouldDrawWingsThatAreAlwaysAnimated())
34449 {
34450 legFrame.Y = 0;
34451 }
34452 }
34453 else if (velocity.X != 0f)
34454 {
34455 if ((slippy || slippy2 || windPushed) && !controlLeft && !controlRight)
34456 {
34457 legFrameCounter = 0.0;
34458 ref Rectangle reference2 = ref legFrame;
34459 _ = legFrame;
34460 reference2.Y = 0;
34461 }
34462 else
34463 {
34464 legFrameCounter += (double)Math.Abs(velocity.X) * 1.3;
34465 while (legFrameCounter > 8.0)
34466 {
34467 legFrameCounter -= 8.0;
34468 legFrame.Y += legFrame.Height;
34469 }
34470 if (legFrame.Y < legFrame.Height * 7)
34471 {
34472 legFrame.Y = legFrame.Height * 19;
34473 }
34474 else if (legFrame.Y > legFrame.Height * 19)
34475 {
34476 legFrame.Y = legFrame.Height * 7;
34477 }
34478 }
34479 }
34480 else
34481 {
34482 legFrameCounter = 0.0;
34483 ref Rectangle reference3 = ref legFrame;
34484 _ = legFrame;
34485 reference3.Y = 0;
34486 }
34487 }
34488 if (carpetFrame >= 0)
34489 {
34490 legFrameCounter = 0.0;
34491 ref Rectangle reference4 = ref legFrame;
34492 _ = legFrame;
34493 reference4.Y = 0;
34494 }
34495 if (sandStorm)
34496 {
34497 if (grappling[0] >= 0)
34498 {
34499 sandStorm = false;
34500 }
34501 if (miscCounter % 4 == 0 && itemAnimation == 0)
34502 {
34503 ChangeDir(direction * -1);
34504 if (inventory[selectedItem].holdStyle == 2)
34505 {
34506 if (inventory[selectedItem].type == 946 || inventory[selectedItem].type == 4707)
34507 {
34508 itemLocation.X = position.X + (float)width * 0.5f - (float)(16 * direction);
34509 }
34510 if (inventory[selectedItem].type == 186)
34511 {
34512 itemLocation.X = position.X + (float)width * 0.5f + (float)(6 * direction);
34513 itemRotation = 0.79f * (float)(-direction);
34514 }
34515 }
34516 }
34517 legFrameCounter = 0.0;
34518 ref Rectangle reference5 = ref legFrame;
34519 _ = legFrame;
34520 reference5.Y = 0;
34521 }
34522 else if (itemAnimation > 0 && inventory[selectedItem].useStyle != 10 && flag4)
34523 {
34524 if (inventory[selectedItem].useStyle == 1 || inventory[selectedItem].type == 0)
34525 {
34526 if ((double)itemAnimation < (double)itemAnimationMax * 0.333)
34527 {
34528 bodyFrame.Y = bodyFrame.Height * 3;
34529 }
34530 else if ((double)itemAnimation < (double)itemAnimationMax * 0.666)
34531 {
34532 bodyFrame.Y = bodyFrame.Height * 2;
34533 }
34534 else
34535 {
34536 bodyFrame.Y = bodyFrame.Height;
34537 }
34538 }
34539 else if (inventory[selectedItem].useStyle == 7)
34540 {
34541 if ((double)itemAnimation > (double)itemAnimationMax * 0.5)
34542 {
34543 bodyFrame.Y = bodyFrame.Height * 3;
34544 }
34545 else
34546 {
34547 bodyFrame.Y = bodyFrame.Height * 2;
34548 }
34549 }
34550 else if (inventory[selectedItem].useStyle == 2)
34551 {
34552 bodyFrame.Y = bodyFrame.Height * 3;
34553 }
34554 else if (inventory[selectedItem].useStyle == 11)
34555 {
34556 if ((double)itemAnimation > (double)itemAnimationMax * 0.5)
34557 {
34558 bodyFrame.Y = bodyFrame.Height * 4;
34559 }
34560 else if ((double)itemAnimation > (double)itemAnimationMax * 0.15)
34561 {
34562 bodyFrame.Y = bodyFrame.Height * 3;
34563 }
34564 else
34565 {
34566 bodyFrame.Y = bodyFrame.Height * 2;
34567 }
34568 }
34569 else if (inventory[selectedItem].useStyle == 9)
34570 {
34571 bodyFrame.Y = 0;
34572 }
34573 else if (inventory[selectedItem].useStyle == 6)
34574 {
34575 float num19 = 1f - (float)itemAnimation / (float)itemAnimationMax;
34576 num19 *= 6f;
34577 if (num19 > 1f)
34578 {
34579 num19 = 1f;
34580 }
34581 if (num19 >= 0.5f)
34582 {
34583 bodyFrame.Y = bodyFrame.Height * 3;
34584 }
34585 else
34586 {
34587 bodyFrame.Y = bodyFrame.Height * 2;
34588 }
34589 }
34590 else if (inventory[selectedItem].useStyle == 3)
34591 {
34592 if ((double)itemAnimation > (double)itemAnimationMax * 0.666)
34593 {
34594 bodyFrame.Y = bodyFrame.Height * 3;
34595 }
34596 else
34597 {
34598 bodyFrame.Y = bodyFrame.Height * 3;
34599 }
34600 }
34601 else if (inventory[selectedItem].useStyle == 4)
34602 {
34603 bodyFrame.Y = bodyFrame.Height * 2;
34604 }
34605 else if (inventory[selectedItem].useStyle == 8)
34606 {
34607 bodyFrame.Y = 0;
34608 }
34609 else if (inventory[selectedItem].useStyle == 12)
34610 {
34611 bodyFrame.Y = bodyFrame.Height * 3;
34612 }
34613 else if (inventory[selectedItem].useStyle == 13)
34614 {
34615 if ((double)itemAnimation < (double)itemAnimationMax * 0.333)
34616 {
34617 bodyFrame.Y = bodyFrame.Height * 3;
34618 }
34619 else if ((double)itemAnimation < (double)itemAnimationMax * 0.666)
34620 {
34621 bodyFrame.Y = bodyFrame.Height * 2;
34622 }
34623 else
34624 {
34625 bodyFrame.Y = bodyFrame.Height;
34626 }
34627 }
34628 else if (inventory[selectedItem].useStyle == 5)
34629 {
34630 if (inventory[selectedItem].type == 281 || inventory[selectedItem].type == 986)
34631 {
34632 bodyFrame.Y = bodyFrame.Height * 2;
34633 }
34634 else
34635 {
34636 float num20 = itemRotation * (float)direction;
34637 bodyFrame.Y = bodyFrame.Height * 3;
34638 if ((double)num20 < -0.75)
34639 {
34640 bodyFrame.Y = bodyFrame.Height * 2;
34641 if (gravDir == -1f)
34642 {
34643 bodyFrame.Y = bodyFrame.Height * 4;
34644 }
34645 }
34646 if ((double)num20 > 0.6)
34647 {
34648 bodyFrame.Y = bodyFrame.Height * 4;
34649 if (gravDir == -1f)
34650 {
34651 bodyFrame.Y = bodyFrame.Height * 2;
34652 }
34653 }
34654 }
34655 }
34656 }
34657 else if (pulley)
34658 {
34659 if (pulleyDir == 2)
34660 {
34661 bodyFrame.Y = bodyFrame.Height;
34662 }
34663 else
34664 {
34665 bodyFrame.Y = bodyFrame.Height * 2;
34666 }
34667 }
34668 else if (flag3 && inventory[selectedItem].holdStyle == 1 && (!wet || !inventory[selectedItem].noWet) && (!happyFunTorchTime || inventory[selectedItem].createTile != 4))
34669 {
34670 bodyFrame.Y = bodyFrame.Height * 3;
34671 }
34672 else if (flag3 && inventory[selectedItem].holdStyle == 2 && (!wet || !inventory[selectedItem].noWet))
34673 {
34674 bodyFrame.Y = bodyFrame.Height * 2;
34675 }
34676 else if (flag3 && inventory[selectedItem].holdStyle == 3)
34677 {
34678 bodyFrame.Y = bodyFrame.Height * 3;
34679 }
34680 else if (flag3 && inventory[selectedItem].holdStyle == 5)
34681 {
34682 bodyFrame.Y = bodyFrame.Height * 3;
34683 }
34684 else if (flag3 && inventory[selectedItem].holdStyle == 7)
34685 {
34686 bodyFrame.Y = bodyFrame.Height * 11;
34687 }
34688 else if (flag3 && inventory[selectedItem].holdStyle == 4 && velocity.Y == 0f && gravDir == 1f)
34689 {
34690 ref Rectangle reference6 = ref bodyFrame;
34691 _ = bodyFrame;
34692 reference6.Y = 0;
34693 }
34694 else if (shieldRaised)
34695 {
34696 bodyFrame.Y = bodyFrame.Height * 10;
34697 }
34698 else if (mount.Active)
34699 {
34700 bodyFrameCounter = 0.0;
34701 bodyFrame.Y = bodyFrame.Height * mount.BodyFrame;
34702 }
34703 else if (grappling[0] >= 0)
34704 {
34705 sandStorm = false;
34706 CancelAllJumpVisualEffects();
34707 Vector2 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
34708 float num21 = 0f;
34709 float num22 = 0f;
34710 for (int m = 0; m < grapCount; m++)
34711 {
34712 num21 += Main.projectile[grappling[m]].position.X + (float)(Main.projectile[grappling[m]].width / 2);
34713 num22 += Main.projectile[grappling[m]].position.Y + (float)(Main.projectile[grappling[m]].height / 2);
34714 }
34715 num21 /= (float)grapCount;
34716 num22 /= (float)grapCount;
34717 num21 -= vector.X;
34718 num22 -= vector.Y;
34719 if (num22 < 0f && Math.Abs(num22) > Math.Abs(num21))
34720 {
34721 bodyFrame.Y = bodyFrame.Height * 2;
34722 if (gravDir == -1f)
34723 {
34724 bodyFrame.Y = bodyFrame.Height * 4;
34725 }
34726 }
34727 else if (num22 > 0f && Math.Abs(num22) > Math.Abs(num21))
34728 {
34729 bodyFrame.Y = bodyFrame.Height * 4;
34730 if (gravDir == -1f)
34731 {
34732 bodyFrame.Y = bodyFrame.Height * 2;
34733 }
34734 }
34735 else
34736 {
34737 bodyFrame.Y = bodyFrame.Height * 3;
34738 }
34739 }
34740 else if (wet && ShouldFloatInWater)
34741 {
34742 bodyFrame.Y = bodyFrame.Height * 10;
34743 }
34744 else if (swimTime > 0)
34745 {
34746 if (swimTime > 20)
34747 {
34748 ref Rectangle reference7 = ref bodyFrame;
34749 _ = bodyFrame;
34750 reference7.Y = 0;
34751 }
34752 else if (swimTime > 10)
34753 {
34754 bodyFrame.Y = bodyFrame.Height * 5;
34755 }
34756 else
34757 {
34758 ref Rectangle reference8 = ref bodyFrame;
34759 _ = bodyFrame;
34760 reference8.Y = 0;
34761 }
34762 }
34763 else if (velocity.Y != 0f)
34764 {
34765 if (sliding)
34766 {
34767 bodyFrame.Y = bodyFrame.Height * 3;
34768 }
34769 else if (sandStorm || carpetFrame >= 0)
34770 {
34771 bodyFrame.Y = bodyFrame.Height * 6;
34772 }
34773 else if (eocDash > 0)
34774 {
34775 bodyFrame.Y = bodyFrame.Height * 6;
34776 }
34777 else if (wings > 0)
34778 {
34779 if (wings == 22 || wings == 28 || wings == 45)
34780 {
34781 bodyFrame.Y = 0;
34782 }
34783 else if (velocity.Y > 0f)
34784 {
34785 if (controlJump)
34786 {
34787 bodyFrame.Y = bodyFrame.Height * 6;
34788 }
34789 else
34790 {
34791 bodyFrame.Y = bodyFrame.Height * 5;
34792 }
34793 }
34794 else
34795 {
34796 bodyFrame.Y = bodyFrame.Height * 6;
34797 }
34798 }
34799 else
34800 {
34801 bodyFrame.Y = bodyFrame.Height * 5;
34802 }
34803 bodyFrameCounter = 0.0;
34804 }
34805 else if (velocity.X != 0f)
34806 {
34807 if (legs == 140)
34808 {
34809 bodyFrameCounter += Math.Abs(velocity.X) * 0.5f;
34810 while (bodyFrameCounter > 8.0)
34811 {
34812 bodyFrameCounter -= 8.0;
34813 bodyFrame.Y += bodyFrame.Height;
34814 }
34815 if (bodyFrame.Y < bodyFrame.Height * 7)
34816 {
34817 bodyFrame.Y = bodyFrame.Height * 19;
34818 }
34819 else if (bodyFrame.Y > bodyFrame.Height * 19)
34820 {
34821 bodyFrame.Y = bodyFrame.Height * 7;
34822 }
34823 }
34824 else
34825 {
34826 bodyFrameCounter += (double)Math.Abs(velocity.X) * 1.5;
34827 bodyFrame.Y = legFrame.Y;
34828 }
34829 }
34830 else
34831 {
34832 bodyFrameCounter = 0.0;
34833 ref Rectangle reference9 = ref bodyFrame;
34834 _ = bodyFrame;
34835 reference9.Y = 0;
34836 }
34837 if (legs == 140)
34838 {
34839 legFrameCounter = 0.0;
34840 legFrame.Y = legFrame.Height * (velocity.Y != 0f).ToInt();
34841 int num23 = bodyFrame.Y / bodyFrame.Height;
34842 if (Main.OffsetsPlayerHeadgear[num23].Y == 0f)
34843 {
34844 legFrame.Y = legFrame.Height * 7;
34845 }
34846 if (wings == 22 || wings == 28)
34847 {
34848 legFrame.Y = 0;
34849 }
34850 }
34851 if (legs == 217 && (sitting.isSitting || sleeping.isSleeping))
34852 {
34853 legFrameCounter = 0.0;
34854 legFrame.Y = legFrame.Height * 5;
34855 }
34856 if (head == 259 && !skipAnimatingValuesInPlayerFrame)
34857 {
34858 rabbitOrderFrame.Update();
34859 }
34860 }
34861
34863 {
34864 isPerformingJump_Cloud = false;
34865 isPerformingJump_Sandstorm = false;
34866 isPerformingJump_Blizzard = false;
34867 isPerformingJump_Fart = false;
34868 isPerformingJump_Sail = false;
34869 isPerformingJump_Unicorn = false;
34870 isPerformingJump_Santank = false;
34871 }
34872
34874 {
34875 sailDash = false;
34876 coldDash = false;
34877 desertDash = false;
34878 fairyBoots = false;
34879 hellfireTreads = false;
34880 }
34881
34883 {
34884 switch (item.type)
34885 {
34886 case 5139:
34887 overrideFishingBobber = 986;
34888 break;
34889 case 5140:
34890 overrideFishingBobber = 987;
34891 break;
34892 case 5141:
34893 overrideFishingBobber = 988;
34894 break;
34895 case 5142:
34896 overrideFishingBobber = 989;
34897 break;
34898 case 5143:
34899 overrideFishingBobber = 990;
34900 break;
34901 case 5144:
34902 overrideFishingBobber = 991;
34903 break;
34904 case 5145:
34905 overrideFishingBobber = 992;
34906 break;
34907 case 5146:
34908 overrideFishingBobber = 993;
34909 break;
34910 }
34911 }
34912
34914 {
34915 switch (item.type)
34916 {
34917 case 128:
34918 vanityRocketBoots = 1;
34919 break;
34920 case 54:
34921 CancelAllBootRunVisualEffects();
34922 break;
34923 case 405:
34924 case 898:
34925 CancelAllBootRunVisualEffects();
34926 vanityRocketBoots = 2;
34927 break;
34928 case 4874:
34929 CancelAllBootRunVisualEffects();
34930 vanityRocketBoots = 5;
34931 hellfireTreads = true;
34932 break;
34933 case 1862:
34934 CancelAllBootRunVisualEffects();
34935 vanityRocketBoots = 3;
34936 break;
34937 case 5000:
34938 CancelAllBootRunVisualEffects();
34939 vanityRocketBoots = 4;
34940 break;
34941 case 3200:
34942 case 3990:
34943 CancelAllBootRunVisualEffects();
34944 sailDash = true;
34945 break;
34946 case 1579:
34947 CancelAllBootRunVisualEffects();
34948 coldDash = true;
34949 break;
34950 case 4055:
34951 CancelAllBootRunVisualEffects();
34952 desertDash = true;
34953 break;
34954 case 3993:
34955 CancelAllBootRunVisualEffects();
34956 fairyBoots = true;
34957 vanityRocketBoots = 2;
34958 break;
34959 }
34960 }
34961
34963 {
34964 for (int i = 3; i < 10; i++)
34965 {
34966 if (!IsItemSlotUnlockedAndUsable(i))
34967 {
34968 continue;
34969 }
34970 Item item = armor[i];
34971 if (eocDash > 0 && shield == -1 && item.shieldSlot != -1)
34972 {
34973 shield = item.shieldSlot;
34974 if (cShieldFallback != -1)
34975 {
34976 cShield = cShieldFallback;
34977 }
34978 }
34979 if (shieldRaised && shield == -1 && item.shieldSlot != -1)
34980 {
34981 shield = item.shieldSlot;
34982 if (cShieldFallback != -1)
34983 {
34984 cShield = cShieldFallback;
34985 }
34986 }
34987 if (ItemIsVisuallyIncompatible(item))
34988 {
34989 continue;
34990 }
34991 if (item.wingSlot > 0)
34992 {
34993 if (hideVisibleAccessory[i] && (velocity.Y == 0f || mount.Active))
34994 {
34995 continue;
34996 }
34997 wings = item.wingSlot;
34998 }
34999 if (!hideVisibleAccessory[i])
35000 {
35001 UpdateVisibleAccessory(i, item);
35002 }
35003 }
35004 for (int j = 13; j < 20; j++)
35005 {
35006 if (IsItemSlotUnlockedAndUsable(j))
35007 {
35008 Item item2 = armor[j];
35009 if (!ItemIsVisuallyIncompatible(item2))
35010 {
35011 UpdateVisibleAccessory(j, item2);
35012 }
35013 }
35014 }
35015 int type = HeldItem.type;
35016 if (type == 4760 && ownedProjectileCounts[866] < 1)
35017 {
35018 shield = 9;
35019 cShield = 0;
35020 }
35021 }
35022
35024 {
35025 if (compositeBackArm.enabled && item.shieldSlot > 0)
35026 {
35027 return true;
35028 }
35029 if (item.shieldSlot > 0 && ItemID.Sets.IsFood[HeldItem.type])
35030 {
35031 return true;
35032 }
35033 if (body == 96 && item.backSlot > 0 && item.backSlot < ArmorIDs.Back.Count && ArmorIDs.Back.Sets.DrawInTailLayer[item.backSlot])
35034 {
35035 return true;
35036 }
35037 if (legs > 0 && ArmorIDs.Legs.Sets.IncompatibleWithFrogLeg[legs] && item.shoeSlot == 15)
35038 {
35039 return true;
35040 }
35041 if (item.balloonSlot == 18 && (body == 93 || body == 83))
35042 {
35043 return true;
35044 }
35045 return false;
35046 }
35047
35049 {
35050 if ((uint)(accFrontSlot - 1) <= 4u || accFrontSlot == 8)
35051 {
35052 return true;
35053 }
35054 return false;
35055 }
35056
35058 {
35059 if (item.stringColor > 0)
35060 {
35061 stringColor = item.stringColor;
35062 }
35063 if (item.handOnSlot > 0)
35064 {
35065 handon = item.handOnSlot;
35066 }
35067 if (item.handOffSlot > 0)
35068 {
35069 handoff = item.handOffSlot;
35070 }
35071 if (item.backSlot > 0)
35072 {
35074 {
35075 backpack = item.backSlot;
35076 }
35077 else if (ArmorIDs.Back.Sets.DrawInTailLayer[item.backSlot])
35078 {
35079 tail = item.backSlot;
35080 }
35081 else
35082 {
35083 back = item.backSlot;
35084 front = -1;
35085 }
35086 }
35087 if (item.frontSlot > 0)
35088 {
35089 front = item.frontSlot;
35090 }
35091 if (sitting.isSitting)
35092 {
35093 back = -1;
35094 }
35095 if (item.shoeSlot > 0)
35096 {
35097 shoe = item.shoeSlot;
35098 if (!Male && ArmorIDs.Shoe.Sets.MaleToFemaleID[shoe] > 0)
35099 {
35100 shoe = (sbyte)ArmorIDs.Shoe.Sets.MaleToFemaleID[shoe];
35101 }
35102 }
35103 if (item.waistSlot > 0)
35104 {
35105 waist = item.waistSlot;
35106 }
35107 if (item.shieldSlot > 0)
35108 {
35109 shield = item.shieldSlot;
35110 }
35111 if (item.neckSlot > 0)
35112 {
35113 neck = item.neckSlot;
35114 }
35115 if (item.faceSlot > 0)
35116 {
35118 {
35119 faceHead = item.faceSlot;
35120 }
35121 else if (ArmorIDs.Face.Sets.DrawInFaceFlowerLayer[item.faceSlot])
35122 {
35123 faceFlower = item.faceSlot;
35124 }
35125 else
35126 {
35127 face = item.faceSlot;
35128 }
35129 }
35130 if (item.balloonSlot > 0)
35131 {
35133 {
35134 balloonFront = item.balloonSlot;
35135 }
35136 else
35137 {
35138 balloon = item.balloonSlot;
35139 }
35140 }
35141 if (item.beardSlot > 0)
35142 {
35143 beard = item.beardSlot;
35144 }
35145 if (item.wingSlot > 0)
35146 {
35147 wings = item.wingSlot;
35148 }
35149 if (item.type == 3580)
35150 {
35151 yoraiz0rEye = itemSlot - 2;
35152 }
35153 if (item.type == 3581)
35154 {
35155 yoraiz0rDarkness = true;
35156 }
35157 if (item.type == 3929)
35158 {
35159 leinforsHair = true;
35160 }
35161 if (item.type == 4404)
35162 {
35163 hasFloatingTube = true;
35164 }
35165 if (item.type == 4563)
35166 {
35167 hasUnicornHorn = true;
35168 }
35169 if (item.type == 1987)
35170 {
35171 hasAngelHalo = true;
35172 }
35173 if (item.type == 5075)
35174 {
35175 hasRainbowCursor = true;
35176 }
35177 }
35178
35179 public void SetArmorEffectVisuals(Player drawPlayer)
35180 {
35181 if (drawPlayer.head == 111 && drawPlayer.body == 73 && drawPlayer.legs == 62)
35182 {
35183 armorEffectDrawShadowSubtle = true;
35184 armorEffectDrawOutlines = true;
35185 }
35186 if (drawPlayer.head == 134 && drawPlayer.body == 95 && drawPlayer.legs == 79)
35187 {
35188 armorEffectDrawShadowSubtle = true;
35189 armorEffectDrawOutlines = true;
35190 }
35191 if (drawPlayer.head == 107 && drawPlayer.body == 69 && drawPlayer.legs == 58)
35192 {
35193 armorEffectDrawShadowSubtle = true;
35194 armorEffectDrawShadow = true;
35195 }
35196 if (drawPlayer.head == 108 && drawPlayer.body == 70 && drawPlayer.legs == 59)
35197 {
35198 armorEffectDrawShadowSubtle = true;
35199 armorEffectDrawShadow = true;
35200 }
35201 if (drawPlayer.head == 109 && drawPlayer.body == 71 && drawPlayer.legs == 60)
35202 {
35203 armorEffectDrawShadowSubtle = true;
35204 armorEffectDrawShadow = true;
35205 }
35206 if (drawPlayer.head == 110 && drawPlayer.body == 72 && drawPlayer.legs == 61)
35207 {
35208 armorEffectDrawShadowSubtle = true;
35209 armorEffectDrawShadow = true;
35210 }
35211 if (drawPlayer.head == 193 && drawPlayer.body == 194 && drawPlayer.legs == 134)
35212 {
35213 armorEffectDrawShadowSubtle = true;
35214 armorEffectDrawShadowLokis = true;
35215 armorEffectDrawOutlines = true;
35216 }
35217 if (drawPlayer.mount.Active && drawPlayer.mount.Type == 3 && drawPlayer.velocity.Y != 0f && !drawPlayer.SlimeDontHyperJump)
35218 {
35219 armorEffectDrawShadow = true;
35220 }
35221 if (drawPlayer.mount.Active && drawPlayer.mount.Type == 10 && Math.Abs(drawPlayer.velocity.X) > drawPlayer.mount.DashSpeed - drawPlayer.mount.RunSpeed / 2f)
35222 {
35223 armorEffectDrawShadow = true;
35224 }
35225 if (drawPlayer.mount.Active && drawPlayer.mount.Type == 44 && Math.Abs(drawPlayer.velocity.X) > drawPlayer.mount.DashSpeed - drawPlayer.mount.RunSpeed / 4f)
35226 {
35227 armorEffectDrawShadow = true;
35228 }
35229 if (drawPlayer.mount.Active && drawPlayer.mount.Type == 45 && Math.Abs(drawPlayer.velocity.X) > drawPlayer.mount.DashSpeed * 0.9f)
35230 {
35231 armorEffectDrawShadow = true;
35232 }
35233 if (drawPlayer.mount.Active && drawPlayer.mount.Type == 14 && Math.Abs(drawPlayer.velocity.X) > drawPlayer.mount.RunSpeed / 2f)
35234 {
35235 armorEffectDrawShadowBasilisk = true;
35236 }
35237 if (drawPlayer.mount.Active && drawPlayer.mount.Type == 48)
35238 {
35239 armorEffectDrawOutlines = true;
35240 armorEffectDrawShadow = true;
35241 }
35242 if (drawPlayer.body == 67 && drawPlayer.legs == 56 && drawPlayer.head >= 103 && drawPlayer.head <= 105)
35243 {
35244 armorEffectDrawShadow = true;
35245 }
35246 if ((drawPlayer.head == 78 || drawPlayer.head == 79 || drawPlayer.head == 80) && drawPlayer.body == 51 && drawPlayer.legs == 47)
35247 {
35248 armorEffectDrawShadowSubtle = true;
35249 }
35250 if (drawPlayer.head == 200 && drawPlayer.body == 198 && drawPlayer.legs == 142)
35251 {
35252 armorEffectDrawShadowLokis = true;
35253 armorEffectDrawOutlinesForbidden = true;
35254 }
35255 if (drawPlayer.head == 171 && drawPlayer.body == 177 && drawPlayer.legs == 112)
35256 {
35257 armorEffectDrawShadow = true;
35258 armorEffectDrawOutlines = true;
35259 }
35260 if (drawPlayer.head == 169 && drawPlayer.body == 175 && drawPlayer.legs == 110)
35261 {
35262 armorEffectDrawShadow = true;
35263 }
35264 if (drawPlayer.head == 170 && drawPlayer.body == 176 && drawPlayer.legs == 111)
35265 {
35266 armorEffectDrawShadowLokis = true;
35267 armorEffectDrawOutlines = true;
35268 }
35269 if (drawPlayer.body == 209 && drawPlayer.legs == 159)
35270 {
35271 armorEffectDrawShadow = true;
35272 }
35273 if (drawPlayer.eocDash > 0)
35274 {
35275 armorEffectDrawShadowEOCShield = true;
35276 }
35277 else if (drawPlayer.dashDelay < 0)
35278 {
35279 armorEffectDrawShadow = true;
35280 }
35281 if (drawPlayer.head == 5 && drawPlayer.body == 5 && drawPlayer.legs == 5)
35282 {
35283 armorEffectDrawShadow = true;
35284 }
35285 if (drawPlayer.head == 74 && drawPlayer.body == 48 && drawPlayer.legs == 44)
35286 {
35287 armorEffectDrawShadow = true;
35288 }
35289 if (drawPlayer.head == 76 && drawPlayer.body == 49 && drawPlayer.legs == 45)
35290 {
35291 armorEffectDrawShadow = true;
35292 }
35293 if (drawPlayer.head == 7 && drawPlayer.body == 7 && drawPlayer.legs == 7)
35294 {
35295 armorEffectDrawShadow = true;
35296 }
35297 if (drawPlayer.head == 22 && drawPlayer.body == 14 && drawPlayer.legs == 14)
35298 {
35299 armorEffectDrawShadow = true;
35300 }
35301 if (drawPlayer.dye[0].dye == 30 && drawPlayer.dye[1].dye == 30 && drawPlayer.dye[2].dye == 30 && drawPlayer.head == 4 && drawPlayer.body == 27 && drawPlayer.legs == 26)
35302 {
35303 armorEffectDrawShadow = true;
35304 armorEffectDrawOutlines = true;
35305 }
35306 if (drawPlayer.head == 189 && drawPlayer.body == 190 && drawPlayer.legs == 130)
35307 {
35308 armorEffectDrawOutlines = true;
35309 }
35310 if (drawPlayer.body == 17 && drawPlayer.legs == 16 && (drawPlayer.head == 29 || drawPlayer.head == 30 || drawPlayer.head == 31))
35311 {
35312 armorEffectDrawShadow = true;
35313 }
35314 if (drawPlayer.body == 19 && drawPlayer.legs == 18 && (drawPlayer.head == 35 || drawPlayer.head == 36 || drawPlayer.head == 37))
35315 {
35316 armorEffectDrawOutlines = true;
35317 }
35318 if ((drawPlayer.body == 24 || drawPlayer.body == 229) && (drawPlayer.legs == 23 || drawPlayer.legs == 212) && (drawPlayer.head == 43 || drawPlayer.head == 41 || drawPlayer.head == 42 || drawPlayer.head == 254 || drawPlayer.head == 255 || drawPlayer.head == 256 || drawPlayer.head == 257 || drawPlayer.head == 258))
35319 {
35320 armorEffectDrawOutlines = true;
35321 armorEffectDrawShadow = true;
35322 }
35323 if (drawPlayer.head == 157 && drawPlayer.legs == 98 && drawPlayer.body != 105)
35324 {
35325 _ = drawPlayer.body;
35326 _ = 106;
35327 }
35328 if (drawPlayer.body == 36 && drawPlayer.head == 56)
35329 {
35330 armorEffectDrawOutlines = true;
35331 }
35332 if (drawPlayer.head == 267)
35333 {
35334 yoraiz0rDarkness = true;
35335 }
35336 if (drawPlayer.stoned || drawPlayer.stealth != 1f)
35337 {
35338 armorEffectDrawOutlines = false;
35339 armorEffectDrawShadow = false;
35340 armorEffectDrawShadowSubtle = false;
35341 }
35342 }
35343
35345 {
35346 int armorSlotRequested = request.ArmorSlotRequested;
35347 int num = -1;
35348 bool male = request.Male;
35349 num = armorSlotRequested switch
35350 {
35351 1 => request.Body,
35352 2 => request.Legs,
35353 _ => request.Head,
35354 };
35355 int num2 = -1;
35356 if (armorSlotRequested == 0 && num == 201)
35357 {
35358 num2 = (male ? 201 : 202);
35359 }
35360 if (armorSlotRequested == 1)
35361 {
35362 bool flag = true;
35363 switch (num)
35364 {
35365 case 15:
35366 num2 = 88;
35367 break;
35368 case 36:
35369 num2 = 89;
35370 break;
35371 case 41:
35372 num2 = 97;
35373 break;
35374 case 42:
35375 num2 = 90;
35376 break;
35377 case 58:
35378 num2 = 91;
35379 break;
35380 case 59:
35381 num2 = 92;
35382 break;
35383 case 60:
35384 num2 = 93;
35385 break;
35386 case 61:
35387 num2 = 94;
35388 break;
35389 case 62:
35390 num2 = 95;
35391 break;
35392 case 63:
35393 num2 = 96;
35394 break;
35395 case 77:
35396 num2 = 121;
35397 break;
35398 case 165:
35399 num2 = ((!male) ? 99 : 118);
35400 break;
35401 case 166:
35402 flag = false;
35403 num2 = ((!male) ? 100 : 119);
35404 break;
35405 case 167:
35406 num2 = (male ? 101 : 102);
35407 break;
35408 case 180:
35409 num2 = 115;
35410 break;
35411 case 181:
35412 num2 = 116;
35413 break;
35414 case 183:
35415 num2 = (male ? 136 : 123);
35416 break;
35417 case 191:
35418 num2 = 131;
35419 break;
35420 case 93:
35421 num2 = 165;
35422 break;
35423 case 90:
35424 num2 = 166;
35425 break;
35426 case 88:
35427 num2 = 168;
35428 break;
35429 case 81:
35430 if (request.Legs == 0)
35431 {
35432 num2 = 169;
35433 }
35434 break;
35435 case 213:
35436 num2 = 187;
35437 break;
35438 case 215:
35439 num2 = 189;
35440 break;
35441 case 219:
35442 num2 = 196;
35443 break;
35444 case 221:
35445 num2 = 199;
35446 break;
35447 case 223:
35448 num2 = 204;
35449 break;
35450 case 231:
35451 num2 = 214;
35452 break;
35453 case 232:
35454 num2 = 215;
35455 break;
35456 case 233:
35457 num2 = 216;
35458 break;
35459 case 241:
35460 num2 = 229;
35461 break;
35462 }
35463 if (num2 != -1)
35464 {
35465 somethingSpecial = flag;
35466 }
35467 }
35468 if (armorSlotRequested == 2)
35469 {
35470 switch (num)
35471 {
35472 case 83:
35473 if (male)
35474 {
35475 num2 = 117;
35476 }
35477 break;
35478 case 84:
35479 if (male)
35480 {
35481 num2 = 120;
35482 }
35483 break;
35484 case 132:
35485 if (male)
35486 {
35487 num2 = 135;
35488 }
35489 break;
35490 case 57:
35491 if (male)
35492 {
35493 num2 = 137;
35494 }
35495 break;
35496 case 180:
35497 if (!male)
35498 {
35499 num2 = 179;
35500 }
35501 break;
35502 case 184:
35503 if (!male)
35504 {
35505 num2 = 183;
35506 }
35507 break;
35508 case 146:
35509 num2 = (male ? 146 : 147);
35510 break;
35511 case 154:
35512 num2 = (male ? 155 : 154);
35513 break;
35514 case 158:
35515 if (male)
35516 {
35517 num2 = 157;
35518 }
35519 break;
35520 case 191:
35521 if (!male)
35522 {
35523 num2 = 192;
35524 }
35525 break;
35526 case 193:
35527 if (!male)
35528 {
35529 num2 = 194;
35530 }
35531 break;
35532 case 197:
35533 if (!male)
35534 {
35535 num2 = 198;
35536 }
35537 break;
35538 case 203:
35539 if (!male)
35540 {
35541 num2 = 202;
35542 }
35543 break;
35544 case 208:
35545 if (!male)
35546 {
35547 num2 = 207;
35548 }
35549 break;
35550 case 219:
35551 if (!male)
35552 {
35553 num2 = 220;
35554 }
35555 break;
35556 case 232:
35557 if (!male)
35558 {
35559 num2 = 233;
35560 }
35561 break;
35562 }
35563 }
35564 return num2;
35565 }
35566
35567 public void Teleport(Vector2 newPos, int Style = 0, int extraInfo = 0)
35568 {
35569 try
35570 {
35571 _funkytownAchievementCheckCooldown = 100;
35572 environmentBuffImmunityTimer = 4;
35573 if (Style != 10)
35574 {
35575 RemoveAllGrapplingHooks();
35576 }
35577 StopVanityActions();
35578 if (shimmering || shimmerWet)
35579 {
35580 shimmering = false;
35581 shimmerWet = false;
35582 wet = false;
35583 ClearBuff(353);
35584 }
35585 int extraInfo2 = 0;
35586 if (Style == 4)
35587 {
35588 extraInfo2 = lastPortalColorIndex;
35589 }
35590 if (Style == 9)
35591 {
35592 lastTeleportPylonStyleUsed = extraInfo;
35593 extraInfo2 = lastTeleportPylonStyleUsed;
35594 }
35595 float num = MathHelper.Clamp(1f - teleportTime * 0.99f, 0.01f, 1f);
35596 Vector2 otherPosition = position;
35597 Main.TeleportEffect(getRect(), Style, extraInfo2, num, TeleportationSide.Entry, newPos);
35598 float num2 = Vector2.Distance(position, newPos);
35600 position = newPos;
35601 if (Style == 8)
35602 {
35605 }
35606 fallStart = (int)(position.Y / 16f);
35607 if (whoAmI == Main.myPlayer)
35608 {
35609 bool flag = false;
35610 if (num2 < new Vector2(Main.screenWidth, Main.screenHeight).Length() / 2f + 100f)
35611 {
35612 int time = 0;
35613 if (Style == 1)
35614 {
35615 time = 10;
35616 }
35617 Main.SetCameraLerp(0.1f, time);
35618 flag = true;
35619 }
35620 else
35621 {
35623 Main.BlackFadeIn = 255;
35624 Lighting.Clear();
35625 Main.screenLastPosition = Main.screenPosition;
35626 Main.screenPosition.X = position.X + (float)(width / 2) - (float)(Main.screenWidth / 2);
35627 Main.screenPosition.Y = position.Y + (float)(height / 2) - (float)(Main.screenHeight / 2);
35628 Main.instantBGTransitionCounter = 10;
35629 ForceUpdateBiomes();
35630 }
35631 if (num > 0.1f || !flag || Style != 0)
35632 {
35633 if (Main.mapTime < 5)
35634 {
35635 Main.mapTime = 5;
35636 }
35637 Main.maxQ = true;
35638 Main.renderNow = true;
35639 }
35640 }
35641 if (Style == 4)
35642 {
35643 lastPortalColorIndex = extraInfo;
35644 extraInfo2 = lastPortalColorIndex;
35645 portalPhysicsFlag = true;
35646 gravity = 0f;
35647 }
35649 ResetAdvancedShadows();
35650 for (int i = 0; i < 3; i++)
35651 {
35652 UpdateSocialShadow();
35653 }
35654 oldPosition = position + BlehOldPositionFixer;
35655 Main.TeleportEffect(getRect(), Style, extraInfo2, num, TeleportationSide.Exit, otherPosition);
35656 teleportTime = 1f;
35657 teleportStyle = Style;
35658 }
35659 catch
35660 {
35661 }
35662 }
35663
35665 {
35666 RemoveAllGrapplingHooks();
35667 PotionOfReturnOriginalUsePosition = base.Bottom;
35668 bool flag = immune;
35669 int num = immuneTime;
35670 StopVanityActions(multiplayerBroadcast: false);
35671 Spawn(PlayerSpawnContext.RecallFromItem);
35672 PotionOfReturnHomePosition = base.Bottom;
35673 NetMessage.SendData(13, -1, whoAmI, null, whoAmI);
35674 immune = flag;
35675 immuneTime = num;
35676 }
35677
35679 {
35680 if (PotionOfReturnOriginalUsePosition.HasValue)
35681 {
35682 Vector2 newPos = PotionOfReturnOriginalUsePosition.Value + base.Size * new Vector2(-0.5f, -1f);
35683 int num = 8;
35684 Teleport(newPos, num);
35685 NetMessage.SendData(65, -1, -1, null, 0, whoAmI, newPos.X, newPos.Y, num);
35686 PotionOfReturnOriginalUsePosition = null;
35687 PotionOfReturnHomePosition = null;
35688 }
35689 }
35690
35691 public void AutoFinchStaff()
35692 {
35693 int num = FindItem(4281);
35694 if (num != -1)
35695 {
35696 Item item = inventory[num];
35697 AddBuff(item.buffType, 3600, quiet: false);
35698 }
35699 }
35700
35701 public void Spawn(PlayerSpawnContext context)
35702 {
35703 Main.LocalPlayer.creativeInterface = false;
35704 _funkytownAchievementCheckCooldown = 100;
35705 bool flag = false;
35706 if (context == PlayerSpawnContext.SpawningIntoWorld)
35707 {
35708 if (Main.netMode == 0 && unlockedBiomeTorches)
35709 {
35710 NPC nPC = new NPC();
35711 nPC.SetDefaults(664);
35712 Main.BestiaryTracker.Kills.RegisterKill(nPC);
35713 }
35714 if (dead)
35715 {
35716 AdjustRespawnTimerForWorldJoining(this);
35717 if (dead)
35718 {
35719 flag = true;
35720 }
35721 }
35722 }
35723 StopVanityActions();
35724 if (whoAmI == Main.myPlayer)
35725 {
35727 }
35728 if (whoAmI == Main.myPlayer)
35729 {
35730 if (Main.mapTime < 5)
35731 {
35732 Main.mapTime = 5;
35733 }
35734 Main.instantBGTransitionCounter = 10;
35735 FindSpawn();
35736 if (!CheckSpawn(SpawnX, SpawnY))
35737 {
35738 SpawnX = -1;
35739 SpawnY = -1;
35740 }
35741 Main.maxQ = true;
35743 }
35744 if (Main.netMode == 1 && whoAmI == Main.myPlayer)
35745 {
35746 NetMessage.SendData(12, -1, -1, null, Main.myPlayer, (int)(byte)context);
35747 }
35748 headPosition = Vector2.Zero;
35749 bodyPosition = Vector2.Zero;
35750 legPosition = Vector2.Zero;
35751 headRotation = 0f;
35752 bodyRotation = 0f;
35753 legRotation = 0f;
35754 rabbitOrderFrame.Reset();
35755 lavaTime = lavaMax;
35756 if (!flag)
35757 {
35758 if (statLife <= 0)
35759 {
35760 int num = statLifeMax2 / 2;
35761 statLife = 100;
35762 if (num > statLife)
35763 {
35764 statLife = num;
35765 }
35766 breath = breathMax;
35767 if (spawnMax)
35768 {
35769 statLife = statLifeMax2;
35770 statMana = statManaMax2;
35771 }
35772 }
35773 immune = true;
35774 dead = false;
35775 immuneTime = 0;
35776 }
35777 active = true;
35778 Vector2 value = position;
35779 if (SpawnX >= 0 && SpawnY >= 0)
35780 {
35781 _ = SpawnX;
35782 _ = SpawnY;
35783 Spawn_SetPosition(SpawnX, SpawnY);
35784 }
35785 else
35786 {
35787 Spawn_SetPositionAtWorldSpawn();
35788 }
35789 wet = false;
35790 wetCount = 0;
35791 lavaWet = false;
35792 fallStart = (int)(position.Y / 16f);
35793 fallStart2 = fallStart;
35794 velocity.X = 0f;
35795 velocity.Y = 0f;
35796 ResetAdvancedShadows();
35797 for (int i = 0; i < 3; i++)
35798 {
35799 UpdateSocialShadow();
35800 }
35801 oldPosition = position + BlehOldPositionFixer;
35802 SetTalkNPC(-1);
35803 if (whoAmI == Main.myPlayer)
35804 {
35805 Main.npcChatCornerItem = 0;
35806 }
35807 if (!flag)
35808 {
35809 if (pvpDeath)
35810 {
35811 pvpDeath = false;
35812 immuneTime = 300;
35813 statLife = statLifeMax;
35814 }
35815 else if (context == PlayerSpawnContext.ReviveFromDeath)
35816 {
35817 immuneTime = 180;
35818 }
35819 else
35820 {
35821 immuneTime = 60;
35822 }
35823 if (immuneTime > 0 && !hostile)
35824 {
35825 immuneNoBlink = true;
35826 }
35827 }
35828 if (whoAmI == Main.myPlayer)
35829 {
35830 bool flag2 = Vector2.Distance(value, position) < new Vector2(Main.screenWidth, Main.screenHeight).Length() / 2f + 100f;
35831 if (flag2)
35832 {
35833 Main.SetCameraLerp(0.1f, 0);
35834 flag2 = true;
35835 }
35836 else
35837 {
35838 Main.BlackFadeIn = 255;
35839 Lighting.Clear();
35840 Main.screenLastPosition = Main.screenPosition;
35841 Main.instantBGTransitionCounter = 10;
35842 }
35843 if (!flag2)
35844 {
35845 Main.renderNow = true;
35846 }
35847 if (Main.netMode == 1)
35848 {
35850 }
35851 if (true && !flag2)
35852 {
35853 Main.screenPosition.X = position.X + (float)(width / 2) - (float)(Main.screenWidth / 2);
35854 Main.screenPosition.Y = position.Y + (float)(height / 2) - (float)(Main.screenHeight / 2);
35855 ForceUpdateBiomes();
35856 }
35857 }
35858 if (flag)
35859 {
35860 immuneAlpha = 255;
35861 }
35862 UpdateGraveyard(now: true);
35863 if (whoAmI == Main.myPlayer && context == PlayerSpawnContext.ReviveFromDeath && difficulty == 3)
35864 {
35865 AutoFinchStaff();
35866 }
35867 if (whoAmI == Main.myPlayer && context == PlayerSpawnContext.SpawningIntoWorld)
35868 {
35870 RefreshItems();
35871 SetPlayerDataToOutOfClassFields();
35872 Main.LocalGolfState.SetScoreTime();
35873 Main.ActivePlayerFileData.StartPlayTimer();
35874 Hooks.EnterWorld(whoAmI);
35875 }
35876 }
35877
35879 {
35880 int spawnTileX = Main.spawnTileX;
35881 int num = Main.spawnTileY;
35882 if (!Spawn_IsAreaAValidWorldSpawn(spawnTileX, num))
35883 {
35884 bool flag = false;
35885 if (!flag)
35886 {
35887 for (int i = 0; i < 30; i++)
35888 {
35889 if (Spawn_IsAreaAValidWorldSpawn(spawnTileX, num - i))
35890 {
35891 num -= i;
35892 flag = true;
35893 break;
35894 }
35895 }
35896 }
35897 if (!flag)
35898 {
35899 for (int j = 0; j < 30; j++)
35900 {
35901 if (Spawn_IsAreaAValidWorldSpawn(spawnTileX, num - j))
35902 {
35903 num -= j;
35904 flag = true;
35905 break;
35906 }
35907 }
35908 }
35909 if (flag)
35910 {
35911 floorX = spawnTileX;
35912 floorY = num;
35913 return true;
35914 }
35915 return false;
35916 }
35917 num = Spawn_DescendFromDefaultSpace(spawnTileX, num);
35918 floorX = spawnTileX;
35919 floorY = num;
35920 return false;
35921 }
35922
35924 {
35925 int floorX = Main.spawnTileX;
35926 int floorY = Main.spawnTileY;
35927 bool num = Spawn_GetPositionAtWorldSpawn(ref floorX, ref floorY);
35928 Spawn_SetPosition(floorX, floorY);
35929 if (num && !Spawn_IsAreaAValidWorldSpawn(floorX, floorY))
35930 {
35931 Spawn_ForceClearArea(floorX, floorY);
35932 }
35933 }
35934
35935 private static int Spawn_DescendFromDefaultSpace(int x, int y)
35936 {
35937 for (int i = 0; i < 50; i++)
35938 {
35939 bool flag = false;
35940 for (int j = -1; j <= 1; j++)
35941 {
35942 Tile tile = Main.tile[x + j, y + i];
35943 if (tile.nactive() && (Main.tileSolid[tile.type] || !Main.tileSolidTop[tile.type]))
35944 {
35945 flag = true;
35946 break;
35947 }
35948 }
35949 if (flag)
35950 {
35951 y += i;
35952 break;
35953 }
35954 }
35955 return y;
35956 }
35957
35958 private static void Spawn_ForceClearArea(int floorX, int floorY)
35959 {
35960 for (int i = floorX - 1; i < floorX + 2; i++)
35961 {
35962 for (int j = floorY - 3; j < floorY; j++)
35963 {
35964 if (Main.tile[i, j] != null)
35965 {
35966 if (Main.tile[i, j].nactive() && Main.tileSolid[Main.tile[i, j].type] && !Main.tileSolidTop[Main.tile[i, j].type])
35967 {
35968 WorldGen.KillTile(i, j);
35969 }
35970 if (Main.tile[i, j].liquid > 0)
35971 {
35972 Main.tile[i, j].lava(lava: false);
35973 Main.tile[i, j].liquid = 0;
35975 }
35976 }
35977 }
35978 }
35979 }
35980
35982 {
35983 for (int i = floorX - 1; i < floorX + 2; i++)
35984 {
35985 for (int j = floorY - 3; j < floorY; j++)
35986 {
35987 if (Main.tile[i, j] != null)
35988 {
35989 if (Main.tile[i, j].nactive() && Main.tileSolid[Main.tile[i, j].type] && !Main.tileSolidTop[Main.tile[i, j].type])
35990 {
35991 return false;
35992 }
35993 if (Main.tile[i, j].liquid > 0)
35994 {
35995 return false;
35996 }
35997 }
35998 }
35999 }
36000 return true;
36001 }
36002
36003 private void Spawn_SetPosition(int floorX, int floorY)
36004 {
36005 position.X = floorX * 16 + 8 - width / 2;
36006 position.Y = floorY * 16 - height;
36007 }
36008
36009 public void SetImmuneTimeForAllTypes(int time)
36010 {
36011 immune = true;
36012 immuneTime = time;
36013 for (int i = 0; i < hurtCooldowns.Length; i++)
36014 {
36015 hurtCooldowns[i] = time;
36016 }
36017 }
36018
36019 public void ShadowDodge()
36020 {
36021 SetImmuneTimeForAllTypes(longInvince ? 120 : 80);
36022 if (whoAmI != Main.myPlayer)
36023 {
36024 return;
36025 }
36026 for (int i = 0; i < maxBuffs; i++)
36027 {
36028 if (buffTime[i] > 0 && buffType[i] == 59)
36029 {
36030 DelBuff(i);
36031 }
36032 }
36033 PutHallowedArmorSetBonusOnCooldown();
36034 NetMessage.SendData(62, -1, -1, null, whoAmI, 2f);
36035 }
36036
36038 {
36039 shadowDodgeTimer = 1800;
36040 }
36041
36043 {
36044 SetImmuneTimeForAllTypes(longInvince ? 120 : 80);
36045 brainOfConfusionDodgeAnimationCounter = 300;
36046 if (whoAmI == Main.myPlayer)
36047 {
36048 AddBuff(321, 240, quiet: false);
36049 NetMessage.SendData(62, -1, -1, null, whoAmI, 4f);
36050 }
36051 }
36052
36053 public void NinjaDodge()
36054 {
36055 SetImmuneTimeForAllTypes(longInvince ? 120 : 80);
36056 for (int i = 0; i < 100; i++)
36057 {
36058 int num = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 2f);
36059 Main.dust[num].position.X += Main.rand.Next(-20, 21);
36060 Main.dust[num].position.Y += Main.rand.Next(-20, 21);
36061 Main.dust[num].velocity *= 0.4f;
36062 Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f;
36063 Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(cWaist, this);
36064 if (Main.rand.Next(2) == 0)
36065 {
36066 Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f;
36067 Main.dust[num].noGravity = true;
36068 }
36069 }
36070 int num2 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
36071 Main.gore[num2].scale = 1.5f;
36072 Main.gore[num2].velocity.X = (float)Main.rand.Next(-50, 51) * 0.01f;
36073 Main.gore[num2].velocity.Y = (float)Main.rand.Next(-50, 51) * 0.01f;
36074 Main.gore[num2].velocity *= 0.4f;
36075 num2 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
36076 Main.gore[num2].scale = 1.5f;
36077 Main.gore[num2].velocity.X = 1.5f + (float)Main.rand.Next(-50, 51) * 0.01f;
36078 Main.gore[num2].velocity.Y = 1.5f + (float)Main.rand.Next(-50, 51) * 0.01f;
36079 Main.gore[num2].velocity *= 0.4f;
36080 num2 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
36081 Main.gore[num2].scale = 1.5f;
36082 Main.gore[num2].velocity.X = -1.5f - (float)Main.rand.Next(-50, 51) * 0.01f;
36083 Main.gore[num2].velocity.Y = 1.5f + (float)Main.rand.Next(-50, 51) * 0.01f;
36084 Main.gore[num2].velocity *= 0.4f;
36085 num2 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
36086 Main.gore[num2].scale = 1.5f;
36087 Main.gore[num2].velocity.X = 1.5f + (float)Main.rand.Next(-50, 51) * 0.01f;
36088 Main.gore[num2].velocity.Y = -1.5f - (float)Main.rand.Next(-50, 51) * 0.01f;
36089 Main.gore[num2].velocity *= 0.4f;
36090 num2 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
36091 Main.gore[num2].scale = 1.5f;
36092 Main.gore[num2].velocity.X = -1.5f - (float)Main.rand.Next(-50, 51) * 0.01f;
36093 Main.gore[num2].velocity.Y = -1.5f - (float)Main.rand.Next(-50, 51) * 0.01f;
36094 Main.gore[num2].velocity *= 0.4f;
36095 if (whoAmI == Main.myPlayer)
36096 {
36097 NetMessage.SendData(62, -1, -1, null, whoAmI, 1f);
36098 }
36099 }
36100
36102 {
36103 int num = armor[0].headSlot;
36104 int num2 = armor[1].bodySlot;
36105 int num3 = armor[2].legSlot;
36106 if (armor[10].headSlot >= 0)
36107 {
36108 num = armor[10].headSlot;
36109 }
36110 if (armor[11].bodySlot >= 0)
36111 {
36112 num2 = armor[11].bodySlot;
36113 }
36114 if (armor[12].legSlot >= 0)
36115 {
36116 num3 = armor[12].legSlot;
36117 }
36118 if ((wereWolf || forceWerewolf) && !hideWolf)
36119 {
36120 num3 = 20;
36121 num2 = 21;
36122 num = 38;
36123 }
36124 if ((num == 75 || num == 7) && num2 == 7 && num3 == 7)
36125 {
36126 boneArmor = true;
36127 }
36128 if (num2 == 27 && num == 46 && num3 == 26)
36129 {
36130 frostArmor = true;
36131 }
36132 }
36133
36134 public double Hurt(PlayerDeathReason damageSource, int Damage, int hitDirection, bool pvp = false, bool quiet = false, bool Crit = false, int cooldownCounter = -1, bool dodgeable = true)
36135 {
36136 if (shimmering && AllowShimmerDodge(damageSource, cooldownCounter, dodgeable))
36137 {
36138 return 0.0;
36139 }
36140 if (creativeGodMode)
36141 {
36142 return 0.0;
36143 }
36144 bool flag = !immune;
36145 bool flag2 = false;
36147 switch (cooldownCounter)
36148 {
36149 case 0:
36150 case 1:
36151 case 3:
36152 case 4:
36153 flag = hurtCooldowns[cooldownCounter] <= 0;
36154 break;
36155 case 2:
36156 flag2 = true;
36157 cooldownCounter = -1;
36158 break;
36159 }
36160 if (flag)
36161 {
36162 if (dodgeable)
36163 {
36164 if (whoAmI == Main.myPlayer && blackBelt && Main.rand.Next(10) == 0)
36165 {
36166 NinjaDodge();
36167 return 0.0;
36168 }
36169 if (whoAmI == Main.myPlayer && brainOfConfusionItem != null && !brainOfConfusionItem.IsAir && Main.rand.Next(6) == 0 && FindBuffIndex(321) == -1)
36170 {
36171 BrainOfConfusionDodge();
36172 return 0.0;
36173 }
36174 if (whoAmI == Main.myPlayer && shadowDodge)
36175 {
36176 ShadowDodge();
36177 return 0.0;
36178 }
36179 }
36180 if (whoAmI == Main.myPlayer && panic)
36181 {
36182 AddBuff(63, 480);
36183 }
36184 if (whoAmI == Main.myPlayer && setSquireT2)
36185 {
36186 AddBuff(205, 300);
36187 }
36188 stealth = 1f;
36189 if (Main.netMode == 1)
36190 {
36191 NetMessage.SendData(84, -1, -1, null, whoAmI);
36192 }
36193 int num = Damage;
36194 double num2 = Main.CalculateDamagePlayersTake(num, statDefense);
36195 if (Crit)
36196 {
36197 num *= 2;
36198 }
36199 if (num2 >= 1.0)
36200 {
36201 if (whoAmI == Main.myPlayer)
36202 {
36204 if (hasFootball)
36205 {
36206 for (int i = 0; i < 59; i++)
36207 {
36208 if (inventory[i].stack > 0 && inventory[i].type == 4743)
36209 {
36210 Projectile.NewProjectile(GetProjectileSource_Misc(12), base.Center, new Vector2(-hitDirection * 4, -6f), 861, 0, 0f, whoAmI, 0f, 1f);
36211 inventory[i].SetDefaults();
36212 if (i == 58)
36213 {
36214 Main.mouseItem = new Item();
36215 }
36216 }
36217 }
36218 }
36219 }
36220 if (inventory[selectedItem].type == 4790 || inventory[selectedItem].type == 4788 || inventory[selectedItem].type == 4789)
36221 {
36222 for (int j = 0; j < 1000; j++)
36223 {
36224 if (Main.projectile[j].active && Main.projectile[j].owner == whoAmI && (Main.projectile[j].type == 879 || Main.projectile[j].type == 877 || Main.projectile[j].type == 878))
36225 {
36226 Main.projectile[j].active = false;
36227 }
36228 }
36229 }
36230 if (invis)
36231 {
36232 for (int k = 0; k < maxBuffs; k++)
36233 {
36234 if (buffType[k] == 10)
36235 {
36236 DelBuff(k);
36237 }
36238 }
36239 }
36240 num2 = (int)((double)(1f - endurance) * num2);
36241 if (num2 < 1.0)
36242 {
36243 num2 = 1.0;
36244 }
36245 if (ConsumeSolarFlare())
36246 {
36247 float num3 = 0.2f;
36248 num2 = (int)((double)(1f - num3) * num2);
36249 if (num2 < 1.0)
36250 {
36251 num2 = 1.0;
36252 }
36253 if (whoAmI == Main.myPlayer)
36254 {
36255 IEntitySource spawnSource = GetProjectileSource_SetBonus(1);
36256 Entity entity = null;
36257 if (damageSource.TryGetCausingEntity(out entity))
36258 {
36259 spawnSource = GetProjectileSource_OnHurt(entity, 1);
36260 }
36261 int num4 = Projectile.NewProjectile(spawnSource, base.Center.X, base.Center.Y, 0f, 0f, 608, (int)(150f * meleeDamage), 15f, Main.myPlayer);
36262 Main.projectile[num4].netUpdate = true;
36263 Main.projectile[num4].Kill();
36264 }
36265 }
36266 if (beetleDefense && beetleOrbs > 0)
36267 {
36268 float num5 = 0.15f * (float)beetleOrbs;
36269 num2 = (int)((double)(1f - num5) * num2);
36270 beetleOrbs--;
36271 for (int l = 0; l < maxBuffs; l++)
36272 {
36273 if (buffType[l] >= 95 && buffType[l] <= 97)
36274 {
36275 DelBuff(l);
36276 }
36277 }
36278 if (beetleOrbs > 0)
36279 {
36280 AddBuff(95 + beetleOrbs - 1, 5, quiet: false);
36281 }
36282 beetleCounter = 0f;
36283 if (num2 < 1.0)
36284 {
36285 num2 = 1.0;
36286 }
36287 }
36288 if (magicCuffs)
36289 {
36290 int num6 = num;
36291 statMana += num6;
36292 if (statMana > statManaMax2)
36293 {
36294 statMana = statManaMax2;
36295 }
36296 ManaEffect(num6);
36297 }
36298 if (defendedByPaladin)
36299 {
36300 if (whoAmI != Main.myPlayer)
36301 {
36302 if (Main.player[Main.myPlayer].hasPaladinShield)
36303 {
36304 Player player = Main.player[Main.myPlayer];
36305 if (player.team == team && team != 0)
36306 {
36307 float num7 = player.Distance(base.Center);
36308 bool flag3 = num7 < 800f;
36309 if (flag3)
36310 {
36311 for (int m = 0; m < 255; m++)
36312 {
36313 if (m != Main.myPlayer && Main.player[m].active && !Main.player[m].dead && !Main.player[m].immune && Main.player[m].hasPaladinShield && Main.player[m].team == team && (float)Main.player[m].statLife > (float)Main.player[m].statLifeMax2 * 0.25f)
36314 {
36315 float num8 = Main.player[m].Distance(base.Center);
36316 if (num7 > num8 || (num7 == num8 && m < Main.myPlayer))
36317 {
36318 flag3 = false;
36319 break;
36320 }
36321 }
36322 }
36323 }
36324 if (flag3)
36325 {
36326 int damage = (int)(num2 * 0.25);
36327 num2 = (int)(num2 * 0.75);
36328 player.Hurt(PlayerDeathReason.LegacyEmpty(), damage, 0);
36329 }
36330 }
36331 }
36332 }
36333 else
36334 {
36335 bool flag4 = false;
36336 for (int n = 0; n < 255; n++)
36337 {
36338 if (n != Main.myPlayer && Main.player[n].active && !Main.player[n].dead && !Main.player[n].immune && Main.player[n].hasPaladinShield && Main.player[n].team == team && (float)Main.player[n].statLife > (float)Main.player[n].statLifeMax2 * 0.25f)
36339 {
36340 flag4 = true;
36341 break;
36342 }
36343 }
36344 if (flag4)
36345 {
36346 num2 = (int)(num2 * 0.75);
36347 }
36348 }
36349 }
36350 if (brainOfConfusionItem != null && !brainOfConfusionItem.IsAir && Main.myPlayer == whoAmI)
36351 {
36352 for (int num9 = 0; num9 < 200; num9++)
36353 {
36354 if (!Main.npc[num9].active || Main.npc[num9].friendly)
36355 {
36356 continue;
36357 }
36358 int num10 = 300;
36359 num10 += (int)num2 * 2;
36360 if (Main.rand.Next(500) < num10)
36361 {
36362 float num11 = (Main.npc[num9].Center - base.Center).Length();
36363 float num12 = Main.rand.Next(200 + (int)num2 / 2, 301 + (int)num2 * 2);
36364 if (num12 > 500f)
36365 {
36366 num12 = 500f + (num12 - 500f) * 0.75f;
36367 }
36368 if (num12 > 700f)
36369 {
36370 num12 = 700f + (num12 - 700f) * 0.5f;
36371 }
36372 if (num12 > 900f)
36373 {
36374 num12 = 900f + (num12 - 900f) * 0.25f;
36375 }
36376 if (num11 < num12)
36377 {
36378 float num13 = Main.rand.Next(90 + (int)num2 / 3, 300 + (int)num2 / 2);
36379 Main.npc[num9].AddBuff(31, (int)num13);
36380 }
36381 }
36382 }
36383 Projectile.NewProjectile(GetProjectileSource_Accessory(brainOfConfusionItem), base.Center.X + (float)Main.rand.Next(-40, 40), base.Center.Y - (float)Main.rand.Next(20, 60), velocity.X * 0.3f, velocity.Y * 0.3f, 565, 0, 0f, whoAmI);
36384 }
36385 if (Main.netMode == 1 && whoAmI == Main.myPlayer && !quiet)
36386 {
36387 if (!noKnockback && hitDirection != 0 && (!mount.Active || !mount.Cart))
36388 {
36389 NetMessage.SendData(13, -1, -1, null, whoAmI);
36390 }
36391 NetMessage.SendData(16, -1, -1, null, whoAmI);
36393 }
36394 Color color = (Crit ? CombatText.DamagedFriendlyCrit : CombatText.DamagedFriendly);
36395 CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, width, height), color, (int)num2, Crit);
36396 statLife -= (int)num2;
36397 switch (cooldownCounter)
36398 {
36399 case -1:
36400 {
36401 immune = true;
36402 int num14 = 0;
36403 num14 = (pvp ? 8 : ((num2 != 1.0) ? (longInvince ? 80 : 40) : (longInvince ? 40 : 20)));
36404 immuneTime = num14;
36405 break;
36406 }
36407 case 0:
36408 if (num2 == 1.0)
36409 {
36410 hurtCooldowns[cooldownCounter] = (longInvince ? 40 : 20);
36411 }
36412 else
36413 {
36414 hurtCooldowns[cooldownCounter] = (longInvince ? 80 : 40);
36415 }
36416 break;
36417 case 1:
36418 case 3:
36419 case 4:
36420 if (num2 == 1.0)
36421 {
36422 hurtCooldowns[cooldownCounter] = (longInvince ? 40 : 20);
36423 }
36424 else
36425 {
36426 hurtCooldowns[cooldownCounter] = (longInvince ? 80 : 40);
36427 }
36428 break;
36429 }
36430 lifeRegenTime = 0f;
36431 int? sourceProjectileType = damageSource.SourceProjectileType;
36433 {
36434 mount.Dismount(this);
36435 }
36436 if (whoAmI == Main.myPlayer)
36437 {
36438 if (starCloakItem != null && !starCloakItem.IsAir && (cooldownCounter == -1 || cooldownCounter == 1))
36439 {
36440 for (int num15 = 0; num15 < 3; num15++)
36441 {
36442 float x = position.X + (float)Main.rand.Next(-400, 400);
36443 float y = position.Y - (float)Main.rand.Next(500, 800);
36444 Vector2 vector = new Vector2(x, y);
36445 float num16 = position.X + (float)(width / 2) - vector.X;
36446 float num17 = position.Y + (float)(height / 2) - vector.Y;
36447 num16 += (float)Main.rand.Next(-100, 101);
36448 float num18 = (float)Math.Sqrt(num16 * num16 + num17 * num17);
36449 num18 = 23f / num18;
36450 num16 *= num18;
36451 num17 *= num18;
36452 int type = 726;
36453 Item item = starCloakItem;
36454 if (starCloakItem_starVeilOverrideItem != null)
36455 {
36456 item = starCloakItem_starVeilOverrideItem;
36457 type = 725;
36458 }
36459 if (starCloakItem_beeCloakOverrideItem != null)
36460 {
36461 item = starCloakItem_beeCloakOverrideItem;
36462 type = 724;
36463 }
36464 if (starCloakItem_manaCloakOverrideItem != null)
36465 {
36466 item = starCloakItem_manaCloakOverrideItem;
36467 type = 723;
36468 }
36469 int num19 = 75;
36470 if (Main.masterMode)
36471 {
36472 num19 *= 3;
36473 }
36474 else if (Main.expertMode)
36475 {
36476 num19 *= 2;
36477 }
36478 Projectile.NewProjectile(GetProjectileSource_Accessory(item), x, y, num16, num17, type, num19, 5f, whoAmI, 0f, position.Y);
36479 }
36480 }
36481 if (honeyCombItem != null && !honeyCombItem.IsAir)
36482 {
36483 int num20 = 1;
36484 if (Main.rand.Next(3) == 0)
36485 {
36486 num20++;
36487 }
36488 if (Main.rand.Next(3) == 0)
36489 {
36490 num20++;
36491 }
36492 if (strongBees && Main.rand.Next(3) == 0)
36493 {
36494 num20++;
36495 }
36496 float num21 = 13f;
36497 if (strongBees)
36498 {
36499 num21 = 18f;
36500 }
36501 if (Main.masterMode)
36502 {
36503 num21 *= 2f;
36504 }
36505 else if (Main.expertMode)
36506 {
36507 num21 *= 1.5f;
36508 }
36509 IEntitySource projectileSource_Accessory = GetProjectileSource_Accessory(honeyCombItem);
36510 for (int num22 = 0; num22 < num20; num22++)
36511 {
36512 float speedX = (float)Main.rand.Next(-35, 36) * 0.02f;
36513 float speedY = (float)Main.rand.Next(-35, 36) * 0.02f;
36514 Projectile.NewProjectile(projectileSource_Accessory, position.X, position.Y, speedX, speedY, beeType(), beeDamage((int)num21), beeKB(0f), Main.myPlayer);
36515 }
36516 AddBuff(48, 300);
36517 }
36518 }
36519 StopVanityActions();
36520 if (flag2 && hitDirection != 0)
36521 {
36522 if (!mount.Active || !mount.Cart)
36523 {
36524 float num23 = 10.5f;
36525 float y2 = -7.5f;
36526 if (noKnockback)
36527 {
36528 num23 = 2.5f;
36529 y2 = -1.5f;
36530 }
36531 velocity.X = num23 * (float)hitDirection;
36532 velocity.Y = y2;
36533 fallStart = (int)(position.Y / 16f);
36534 }
36535 }
36536 else if (!noKnockback && hitDirection != 0 && (!mount.Active || !mount.Cart))
36537 {
36538 velocity.X = 4.5f * (float)hitDirection;
36539 velocity.Y = -3.5f;
36540 fallStart = (int)(position.Y / 16f);
36541 }
36542 if (stoned)
36543 {
36544 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
36545 }
36546 else if (mount.Active && mount.Type == 52)
36547 {
36548 SoundEngine.PlaySound(3, (int)position.X, (int)position.Y, 6);
36549 }
36550 else if ((wereWolf || forceWerewolf) && !hideWolf)
36551 {
36552 SoundEngine.PlaySound(3, (int)position.X, (int)position.Y, 6);
36553 }
36554 else if (frostArmor)
36555 {
36557 }
36558 else if (boneArmor)
36559 {
36560 SoundEngine.PlaySound(3, (int)position.X, (int)position.Y, 2);
36561 }
36562 else if (Main.dontStarveWorld && !Main.remixWorld)
36563 {
36565 }
36566 else
36567 {
36568 SoundEngine.PlaySound(Male ? 1 : 20, position);
36569 }
36570 eyeHelper.BlinkBecausePlayerGotHurt();
36571 if (statLife > 0)
36572 {
36573 double num24 = num2 / (double)statLifeMax2 * 100.0;
36574 float num25 = 2 * hitDirection;
36575 float num26 = 0f;
36576 if (flag2)
36577 {
36578 num24 *= 12.0;
36579 num26 = 6f;
36580 }
36581 for (int num27 = 0; (double)num27 < num24; num27++)
36582 {
36583 if (stoned)
36584 {
36585 Dust.NewDust(position, width, height, 1, num25 + (float)hitDirection * num26 * Main.rand.NextFloat(), -2f);
36586 }
36587 else if (frostArmor)
36588 {
36589 int num28 = Dust.NewDust(position, width, height, 135, num25 + (float)hitDirection * num26 * Main.rand.NextFloat(), -2f);
36590 Main.dust[num28].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
36591 }
36592 else if (boneArmor)
36593 {
36594 int num29 = Dust.NewDust(position, width, height, 26, num25 + (float)hitDirection * num26 * Main.rand.NextFloat(), -2f);
36595 Main.dust[num29].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
36596 }
36597 else
36598 {
36599 Dust.NewDust(position, width, height, 5, num25 + (float)hitDirection * num26 * Main.rand.NextFloat(), -2f);
36600 }
36601 }
36602 }
36603 else
36604 {
36605 statLife = 0;
36606 if (whoAmI == Main.myPlayer)
36607 {
36608 KillMe(damageSource, num2, hitDirection, pvp);
36609 }
36610 }
36611 }
36612 if (pvp)
36613 {
36614 num2 = Main.CalculateDamagePlayersTakeInPVP(num, statDefense);
36615 }
36616 return num2;
36617 }
36618 return 0.0;
36619 }
36620
36622 {
36623 if (!dodgeable)
36624 {
36625 return false;
36626 }
36627 if (cooldownCounter == 1)
36628 {
36629 return false;
36630 }
36631 Entity entity = null;
36632 if (!damageSource.TryGetCausingEntity(out entity))
36633 {
36634 return true;
36635 }
36636 if (entity is NPC { active: not false } nPC && (nPC.boss || NPC.GetNPCInvasionGroup(nPC.type) != 0 || NPCID.Sets.CanHitPastShimmer[nPC.type]))
36637 {
36638 return false;
36639 }
36640 if (entity is Projectile { active: not false } projectile && ProjectileID.Sets.CanHitPastShimmer[projectile.type])
36641 {
36642 return false;
36643 }
36644 return true;
36645 }
36646
36647 public void KillMeForGood()
36648 {
36650 if (!activePlayerFileData.ServerSideCharacter)
36651 {
36652 bool isCloudSave = activePlayerFileData.IsCloudSave;
36654 {
36656 }
36658 {
36660 }
36661 Main.ActivePlayerFileData = new PlayerFileData();
36662 }
36663 }
36664
36665 public void KillMe(PlayerDeathReason damageSource, double dmg, int hitDirection, bool pvp = false)
36666 {
36667 if (creativeGodMode || dead)
36668 {
36669 return;
36670 }
36671 StopVanityActions();
36672 if (pvp)
36673 {
36674 pvpDeath = true;
36675 }
36676 if (trapDebuffSource)
36677 {
36679 }
36680 if (Main.myPlayer == whoAmI && _framesLeftEligibleForDeadmansChestDeathAchievement > 0)
36681 {
36683 }
36684 if (whoAmI == Main.myPlayer)
36685 {
36687 }
36688 if (pvpDeath)
36689 {
36690 numberOfDeathsPVP++;
36691 }
36692 else
36693 {
36694 numberOfDeathsPVE++;
36695 }
36696 lastDeathPostion = base.Center;
36697 lastDeathTime = DateTime.Now;
36698 showLastDeath = true;
36699 bool overFlowing;
36700 long coinsOwned = Utils.CoinsCount(out overFlowing, inventory);
36701 if (Main.myPlayer == whoAmI)
36702 {
36703 lostCoins = coinsOwned;
36704 lostCoinString = Main.ValueToCoins(lostCoins);
36705 }
36706 if (Main.myPlayer == whoAmI)
36707 {
36708 EndOngoingTorchGodEvent();
36709 }
36710 if (Main.myPlayer == whoAmI)
36711 {
36712 Main.mapFullscreen = false;
36713 }
36714 if (Main.myPlayer == whoAmI)
36715 {
36716 trashItem.SetDefaults();
36717 if (difficulty == 0 || difficulty == 3)
36718 {
36719 for (int i = 0; i < 59; i++)
36720 {
36721 if (inventory[i].stack > 0 && ((inventory[i].type >= 1522 && inventory[i].type <= 1527) || inventory[i].type == 3643))
36722 {
36723 int num = Item.NewItem(GetItemSource_Death(), (int)position.X, (int)position.Y, width, height, inventory[i].type);
36724 Main.item[num].netDefaults(inventory[i].netID);
36725 Main.item[num].Prefix(inventory[i].prefix);
36726 Main.item[num].stack = inventory[i].stack;
36727 Main.item[num].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f;
36728 Main.item[num].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f;
36729 Main.item[num].noGrabDelay = 100;
36730 Main.item[num].favorited = false;
36731 Main.item[num].newAndShiny = false;
36732 if (Main.netMode == 1)
36733 {
36734 NetMessage.SendData(21, -1, -1, null, num);
36735 }
36736 inventory[i].SetDefaults();
36737 }
36738 }
36739 }
36740 else if (difficulty == 1)
36741 {
36742 DropItems();
36743 }
36744 else if (difficulty == 2)
36745 {
36746 DropItems();
36747 KillMeForGood();
36748 }
36749 }
36751 {
36753 }
36754 else
36755 {
36756 SoundEngine.PlaySound(5, (int)position.X, (int)position.Y);
36757 }
36759 {
36760 for (int j = 0; j < 85; j++)
36761 {
36762 int type = Main.rand.Next(139, 143);
36763 int num2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, type, 0f, -10f, 0, default(Color), 1.2f);
36764 Main.dust[num2].velocity.X += (float)Main.rand.Next(-50, 51) * 0.01f;
36765 Main.dust[num2].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.01f;
36766 Main.dust[num2].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
36767 Main.dust[num2].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
36768 Main.dust[num2].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f;
36769 Main.dust[num2].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f;
36770 Main.dust[num2].scale *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
36771 }
36772 for (int k = 0; k < 40; k++)
36773 {
36774 int type2 = Main.rand.Next(276, 283);
36775 int num3 = Gore.NewGore(position, new Vector2(0f, -10f), type2);
36776 Main.gore[num3].velocity.X += (float)Main.rand.Next(-50, 51) * 0.01f;
36777 Main.gore[num3].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.01f;
36778 Main.gore[num3].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
36779 Main.gore[num3].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
36780 Main.gore[num3].scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
36781 Main.gore[num3].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f;
36782 Main.gore[num3].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f;
36783 }
36784 }
36785 headVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f;
36786 bodyVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f;
36787 legVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f;
36788 headVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * hitDirection);
36789 bodyVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * hitDirection);
36790 legVelocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + (float)(2 * hitDirection);
36791 if (stoned)
36792 {
36793 headPosition = Vector2.Zero;
36794 bodyPosition = Vector2.Zero;
36795 legPosition = Vector2.Zero;
36796 }
36797 for (int l = 0; l < 100; l++)
36798 {
36799 if (stoned)
36800 {
36801 Dust.NewDust(position, width, height, 1, 2 * hitDirection, -2f);
36802 }
36803 else if (frostArmor)
36804 {
36805 int num4 = Dust.NewDust(position, width, height, 135, 2 * hitDirection, -2f);
36806 Main.dust[num4].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
36807 }
36808 else if (boneArmor)
36809 {
36810 int num5 = Dust.NewDust(position, width, height, 26, 2 * hitDirection, -2f);
36811 Main.dust[num5].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
36812 }
36813 else
36814 {
36815 Dust.NewDust(position, width, height, 5, 2 * hitDirection, -2f);
36816 }
36817 }
36818 mount.Dismount(this);
36819 dead = true;
36820 respawnTimer = GetRespawnTime(pvp);
36821 immuneAlpha = 0;
36822 if (!ChildSafety.Disabled)
36823 {
36824 immuneAlpha = 255;
36825 }
36826 palladiumRegen = false;
36827 iceBarrier = false;
36828 crystalLeaf = false;
36829 NetworkText deathText = damageSource.GetDeathText(name);
36830 if (Main.netMode == 2)
36831 {
36833 }
36834 else if (Main.netMode == 0)
36835 {
36836 Main.NewText(deathText.ToString(), 225, 25, 25);
36837 }
36838 if (Main.netMode == 1 && whoAmI == Main.myPlayer)
36839 {
36841 }
36842 if (whoAmI == Main.myPlayer && (difficulty == 0 || difficulty == 3))
36843 {
36844 if (!pvp)
36845 {
36846 DropCoins();
36847 }
36848 else
36849 {
36850 lostCoins = 0L;
36851 lostCoinString = Main.ValueToCoins(lostCoins);
36852 }
36853 }
36854 DropTombstone(coinsOwned, deathText, hitDirection);
36855 if (whoAmI != Main.myPlayer)
36856 {
36857 return;
36858 }
36859 try
36860 {
36862 }
36863 catch
36864 {
36865 }
36866 }
36867
36868 private int GetRespawnTime(bool pvp)
36869 {
36870 int num = 600;
36871 bool flag = false;
36872 if (Main.netMode != 0 && !pvp)
36873 {
36874 for (int i = 0; i < 200; i++)
36875 {
36876 if (Main.npc[i].active && (Main.npc[i].boss || Main.npc[i].type == 13 || Main.npc[i].type == 14 || Main.npc[i].type == 15) && Math.Abs(base.Center.X - Main.npc[i].Center.X) + Math.Abs(base.Center.Y - Main.npc[i].Center.Y) < 4000f)
36877 {
36878 flag = true;
36879 break;
36880 }
36881 }
36882 }
36883 if (flag)
36884 {
36885 num += 600;
36886 }
36887 if (Main.expertMode)
36888 {
36889 num = (int)((double)num * 1.5);
36890 }
36891 if (flag && Main.getGoodWorld && Main.netMode != 0)
36892 {
36893 bool flag2 = false;
36894 for (int j = 0; j < 255; j++)
36895 {
36896 if (j != whoAmI && Main.player[j].active)
36897 {
36898 flag2 = true;
36899 break;
36900 }
36901 }
36902 if (flag2)
36903 {
36904 num *= 2;
36905 }
36906 }
36907 return num;
36908 }
36909
36911 {
36912 if (Main.netMode != 1)
36913 {
36914 float num;
36915 for (num = (float)Main.rand.Next(-35, 36) * 0.1f; num < 2f && num > -2f; num += (float)Main.rand.Next(-30, 31) * 0.1f)
36916 {
36917 }
36918 int num2 = Main.rand.Next(6);
36919 if (coinsOwned <= 100000)
36920 {
36921 num2 = ((num2 != 0) ? (200 + num2) : 43);
36922 }
36923 else
36924 {
36925 num2 = Main.rand.Next(5);
36926 num2 += 527;
36927 }
36928 IEntitySource projectileSource_Misc = GetProjectileSource_Misc(9);
36929 int damage = 0;
36930 int num3 = 0;
36931 if (Main.getGoodWorld)
36932 {
36933 damage = 70;
36934 num3 = 10;
36935 }
36936 int num4 = whoAmI;
36937 int num5 = ((!Main.getGoodWorld) ? Projectile.NewProjectile(projectileSource_Misc, position.X + (float)(width / 2), position.Y + (float)(height / 2), (float)Main.rand.Next(10, 30) * 0.1f * (float)hitDirection + num, (float)Main.rand.Next(-40, -20) * 0.1f, num2, damage, num3, Main.myPlayer, num4) : Projectile.NewProjectile(projectileSource_Misc, position.X + (float)(width / 2), position.Y + (float)(height / 2), ((float)Main.rand.Next(10, 30) * 0.1f * (float)hitDirection + num) * 1.5f, (float)Main.rand.Next(-40, -20) * 0.1f * 1.5f, num2, damage, num3, Main.myPlayer, num4));
36939 string text = now.ToString("D");
36940 if (GameCulture.FromCultureName(GameCulture.CultureName.English).IsActive)
36941 {
36942 text = now.ToString("MMMM d, yyy");
36943 }
36944 string miscText = deathText.ToString() + "\n" + text;
36945 Main.projectile[num5].miscText = miscText;
36946 }
36947 }
36948
36950 {
36951 if (status.CanTakeItem)
36952 {
36953 return CanAcceptItemIntoInventory(item);
36954 }
36955 return false;
36956 }
36957
36959 {
36960 if (ItemID.Sets.IsAPickup[newItem.type])
36961 {
36962 return new ItemSpaceStatus(CanTakeItem: true);
36963 }
36964 if (newItem.uniqueStack && HasItem(newItem.type))
36965 {
36966 return new ItemSpaceStatus(CanTakeItem: false);
36967 }
36968 int num = 50;
36969 if (newItem.IsACoin)
36970 {
36971 num = 54;
36972 }
36973 for (int i = 0; i < num; i++)
36974 {
36975 if (CanItemSlotAccept(inventory[i], newItem))
36976 {
36977 return new ItemSpaceStatus(CanTakeItem: true);
36978 }
36979 }
36980 if (newItem.ammo > 0 && !newItem.notAmmo)
36981 {
36982 for (int j = 54; j < 58; j++)
36983 {
36984 if (CanGoIntoAmmoOnPickup(inventory[j], newItem))
36985 {
36986 return new ItemSpaceStatus(CanTakeItem: true);
36987 }
36988 }
36989 }
36990 for (int k = 54; k < 58; k++)
36991 {
36992 if (inventory[k].type > 0 && inventory[k].stack < inventory[k].maxStack && newItem.IsTheSameAs(inventory[k]))
36993 {
36994 return new ItemSpaceStatus(CanTakeItem: true);
36995 }
36996 }
36997 if (ItemSpaceForCofveve(newItem))
36998 {
36999 return new ItemSpaceStatus(CanTakeItem: true, ItemIsGoingToVoidVault: true);
37000 }
37001 return new ItemSpaceStatus(CanTakeItem: false);
37002 }
37003
37005 {
37006 if (!IsVoidVaultEnabled)
37007 {
37008 return false;
37009 }
37010 if (!CanVoidVaultAccept(newItem))
37011 {
37012 return false;
37013 }
37014 Item[] item = bank4.item;
37015 for (int i = 0; i < item.Length; i++)
37016 {
37017 if (CanItemSlotAccept(item[i], newItem))
37018 {
37019 return true;
37020 }
37021 }
37022 return false;
37023 }
37024
37026 {
37027 if (theSlot.type == 0)
37028 {
37029 return true;
37030 }
37031 if (theSlot.stack < theSlot.maxStack && theItemToAccept.IsTheSameAs(theSlot))
37032 {
37033 return true;
37034 }
37035 return false;
37036 }
37037
37039 {
37040 if (!theItemToAccept.CanFillEmptyAmmoSlot() && theSlot.type == 0)
37041 {
37042 return false;
37043 }
37044 return CanItemSlotAccept(theSlot, theItemToAccept);
37045 }
37046
37047 public void DoCoins(int i)
37048 {
37049 if (inventory[i].stack != 100 || (inventory[i].type != 71 && inventory[i].type != 72 && inventory[i].type != 73))
37050 {
37051 return;
37052 }
37053 inventory[i].SetDefaults(inventory[i].type + 1);
37054 for (int j = 0; j < 54; j++)
37055 {
37056 if (inventory[j].IsTheSameAs(inventory[i]) && j != i && inventory[j].type == inventory[i].type && inventory[j].stack < inventory[j].maxStack)
37057 {
37058 inventory[j].stack++;
37059 inventory[i].SetDefaults();
37060 inventory[i].active = false;
37061 inventory[i].TurnToAir();
37062 DoCoins(j);
37063 }
37064 }
37065 }
37066
37068 {
37069 for (int i = 54; i < 58; i++)
37070 {
37071 if (inventory[i].type <= 0 || inventory[i].stack >= inventory[i].maxStack || !newItem.IsTheSameAs(inventory[i]))
37072 {
37073 continue;
37074 }
37075 SoundEngine.PlaySound(7, (int)position.X, (int)position.Y);
37076 if (newItem.stack + inventory[i].stack <= inventory[i].maxStack)
37077 {
37078 inventory[i].stack += newItem.stack;
37079 if (!settings.NoText)
37080 {
37081 PopupText.NewText(PopupTextContext.RegularItemPickup, newItem, newItem.stack);
37082 }
37083 DoCoins(i);
37084 if (plr == Main.myPlayer)
37085 {
37087 }
37088 settings.HandlePostAction(inventory[i]);
37089 return new Item();
37090 }
37091 newItem.stack -= inventory[i].maxStack - inventory[i].stack;
37092 if (!settings.NoText)
37093 {
37094 PopupText.NewText(PopupTextContext.RegularItemPickup, newItem, inventory[i].maxStack - inventory[i].stack);
37095 }
37096 inventory[i].stack = inventory[i].maxStack;
37097 DoCoins(i);
37098 if (plr == Main.myPlayer)
37099 {
37101 }
37102 settings.HandlePostAction(inventory[i]);
37103 }
37104 if (newItem.CanFillEmptyAmmoSlot())
37105 {
37106 for (int j = 54; j < 58; j++)
37107 {
37108 if (inventory[j].type == 0)
37109 {
37110 newItem.shimmered = false;
37111 inventory[j] = newItem;
37112 if (!settings.NoText)
37113 {
37114 PopupText.NewText(PopupTextContext.RegularItemPickup, newItem, newItem.stack);
37115 }
37116 DoCoins(j);
37117 SoundEngine.PlaySound(7, (int)position.X, (int)position.Y);
37118 if (plr == Main.myPlayer)
37119 {
37121 }
37122 settings.HandlePostAction(inventory[j]);
37123 return new Item();
37124 }
37125 }
37126 }
37127 return newItem;
37128 }
37129
37131 {
37132 bool isACoin = newItem.IsACoin;
37133 Item item = newItem;
37134 int num = 50;
37135 if (newItem.noGrabDelay > 0)
37136 {
37137 return item;
37138 }
37139 int num2 = 0;
37140 if (newItem.uniqueStack && HasItem(newItem.type))
37141 {
37142 return item;
37143 }
37144 if (isACoin)
37145 {
37146 num2 = -4;
37147 num = 54;
37148 }
37149 if (item.FitsAmmoSlot())
37150 {
37151 item = FillAmmo(plr, item, settings);
37152 if (item.type == 0 || item.stack == 0)
37153 {
37154 return new Item();
37155 }
37156 }
37157 for (int i = num2; i < 50; i++)
37158 {
37159 int num3 = i;
37160 if (num3 < 0)
37161 {
37162 num3 = 54 + i;
37163 }
37164 if (GetItem_FillIntoOccupiedSlot(plr, newItem, settings, item, num3))
37165 {
37166 return new Item();
37167 }
37168 }
37169 if (!isACoin && newItem.useStyle != 0)
37170 {
37171 for (int j = 0; j < 10; j++)
37172 {
37173 if (GetItem_FillEmptyInventorySlot(plr, newItem, settings, item, j))
37174 {
37175 return new Item();
37176 }
37177 }
37178 }
37179 if (newItem.favorited)
37180 {
37181 for (int k = 0; k < num; k++)
37182 {
37183 if (GetItem_FillEmptyInventorySlot(plr, newItem, settings, item, k))
37184 {
37185 return new Item();
37186 }
37187 }
37188 }
37189 else
37190 {
37191 for (int num4 = num - 1; num4 >= 0; num4--)
37192 {
37193 if (GetItem_FillEmptyInventorySlot(plr, newItem, settings, item, num4))
37194 {
37195 return new Item();
37196 }
37197 }
37198 }
37199 if (settings.CanGoIntoVoidVault && IsVoidVaultEnabled && CanVoidVaultAccept(newItem) && GetItem_VoidVault(plr, bank4.item, newItem, settings, item))
37200 {
37201 return new Item();
37202 }
37203 return item;
37204 }
37205
37206 private bool GetItem_VoidVault(int plr, Item[] inventory, Item newItem, GetItemSettings settings, Item returnItem)
37207 {
37208 if (!CanVoidVaultAccept(newItem))
37209 {
37210 return false;
37211 }
37212 for (int i = 0; i < inventory.Length; i++)
37213 {
37214 if (GetItem_FillIntoOccupiedSlot_VoidBag(plr, inventory, newItem, settings, returnItem, i))
37215 {
37216 return true;
37217 }
37218 }
37219 for (int j = 0; j < inventory.Length; j++)
37220 {
37221 if (GetItem_FillEmptyInventorySlot_VoidBag(plr, inventory, newItem, settings, returnItem, j))
37222 {
37223 return true;
37224 }
37225 }
37226 return false;
37227 }
37228
37230 {
37231 if (item.questItem)
37232 {
37233 return false;
37234 }
37235 int type = item.type;
37236 if (type == 3822)
37237 {
37238 return false;
37239 }
37240 return true;
37241 }
37242
37244 {
37245 if (inv[i].type > 0 && inv[i].stack < inv[i].maxStack && returnItem.IsTheSameAs(inv[i]))
37246 {
37247 if (newItem.IsACoin)
37248 {
37249 SoundEngine.PlaySound(38, (int)position.X, (int)position.Y);
37250 }
37251 else
37252 {
37253 SoundEngine.PlaySound(7, (int)position.X, (int)position.Y);
37254 }
37255 if (returnItem.stack + inv[i].stack <= inv[i].maxStack)
37256 {
37257 inv[i].stack += returnItem.stack;
37258 if (!settings.NoText)
37259 {
37260 PopupText.NewText(PopupTextContext.ItemPickupToVoidContainer, newItem, returnItem.stack, noStack: false, settings.LongText);
37261 }
37263 settings.HandlePostAction(inv[i]);
37264 return true;
37265 }
37266 AchievementsHelper.NotifyItemPickup(this, returnItem, inv[i].maxStack - inv[i].stack);
37267 returnItem.stack -= inv[i].maxStack - inv[i].stack;
37268 if (!settings.NoText)
37269 {
37270 PopupText.NewText(PopupTextContext.ItemPickupToVoidContainer, newItem, inv[i].maxStack - inv[i].stack, noStack: false, settings.LongText);
37271 }
37272 inv[i].stack = inv[i].maxStack;
37273 settings.HandlePostAction(inv[i]);
37274 }
37275 return false;
37276 }
37277
37279 {
37280 if (inventory[i].type > 0 && inventory[i].stack < inventory[i].maxStack && returnItem.IsTheSameAs(inventory[i]))
37281 {
37282 if (newItem.IsACoin)
37283 {
37284 SoundEngine.PlaySound(38, (int)position.X, (int)position.Y);
37285 }
37286 else
37287 {
37288 SoundEngine.PlaySound(7, (int)position.X, (int)position.Y);
37289 }
37290 if (returnItem.stack + inventory[i].stack <= inventory[i].maxStack)
37291 {
37292 inventory[i].stack += returnItem.stack;
37293 if (!settings.NoText)
37294 {
37295 PopupText.NewText(PopupTextContext.RegularItemPickup, newItem, returnItem.stack, noStack: false, settings.LongText);
37296 }
37297 DoCoins(i);
37298 if (plr == Main.myPlayer)
37299 {
37301 }
37303 settings.HandlePostAction(inventory[i]);
37304 return true;
37305 }
37306 AchievementsHelper.NotifyItemPickup(this, returnItem, inventory[i].maxStack - inventory[i].stack);
37307 returnItem.stack -= inventory[i].maxStack - inventory[i].stack;
37308 if (!settings.NoText)
37309 {
37310 PopupText.NewText(PopupTextContext.RegularItemPickup, newItem, inventory[i].maxStack - inventory[i].stack, noStack: false, settings.LongText);
37311 }
37312 inventory[i].stack = inventory[i].maxStack;
37313 DoCoins(i);
37314 if (plr == Main.myPlayer)
37315 {
37317 }
37318 settings.HandlePostAction(inventory[i]);
37319 }
37320 return false;
37321 }
37322
37324 {
37325 if (inv[i].type != 0)
37326 {
37327 return false;
37328 }
37329 if (newItem.IsACoin)
37330 {
37331 SoundEngine.PlaySound(38, (int)position.X, (int)position.Y);
37332 }
37333 else
37334 {
37335 SoundEngine.PlaySound(7, (int)position.X, (int)position.Y);
37336 }
37337 returnItem.shimmered = false;
37338 inv[i] = returnItem;
37339 if (!settings.NoText)
37340 {
37341 PopupText.NewText(PopupTextContext.ItemPickupToVoidContainer, newItem, newItem.stack, noStack: false, settings.LongText);
37342 }
37343 DoCoins(i);
37344 if (plr == Main.myPlayer)
37345 {
37347 }
37349 settings.HandlePostAction(inv[i]);
37350 return true;
37351 }
37352
37354 {
37355 if (inventory[i].type != 0)
37356 {
37357 return false;
37358 }
37359 if (newItem.IsACoin)
37360 {
37361 SoundEngine.PlaySound(38, (int)position.X, (int)position.Y);
37362 }
37363 else
37364 {
37365 SoundEngine.PlaySound(7, (int)position.X, (int)position.Y);
37366 }
37367 returnItem.shimmered = false;
37368 inventory[i] = returnItem;
37369 if (!settings.NoText)
37370 {
37371 PopupText.NewText(PopupTextContext.RegularItemPickup, newItem, newItem.stack, noStack: false, settings.LongText);
37372 }
37373 DoCoins(i);
37374 if (plr == Main.myPlayer)
37375 {
37377 }
37379 if (plr == Main.myPlayer && newItem.type == 5095)
37380 {
37381 LucyAxeMessage.Create(LucyAxeMessage.MessageSource.PickedUp, base.Top, new Vector2(0f, -7f));
37382 }
37383 settings.HandlePostAction(inventory[i]);
37384 return true;
37385 }
37386
37387 public void PlaceThing(ref ItemCheckContext context)
37388 {
37389 if (itemTime == 0)
37390 {
37391 dontConsumeWand = false;
37392 }
37393 PlaceThing_Paintbrush();
37394 PlaceThing_PaintRoller();
37395 PlaceThing_PaintScrapper();
37396 PlaceThing_CannonBall();
37397 PlaceThing_XMasTreeTops();
37398 PlaceThing_ItemInExtractinator(ref context);
37399 PlaceThing_LockChest();
37400 if (!noBuilding)
37401 {
37402 PlaceThing_Tiles();
37403 PlaceThing_Walls();
37404 }
37405 }
37406
37407 private void PlaceThing_Walls()
37408 {
37409 if (inventory[selectedItem].createWall < 0 || !(position.X / 16f - (float)tileRangeX - (float)inventory[selectedItem].tileBoost - (float)blockRange <= (float)tileTargetX) || !((position.X + (float)width) / 16f + (float)tileRangeX + (float)inventory[selectedItem].tileBoost - 1f + (float)blockRange >= (float)tileTargetX) || !(position.Y / 16f - (float)tileRangeY - (float)inventory[selectedItem].tileBoost - (float)blockRange <= (float)tileTargetY) || !((position.Y + (float)height) / 16f + (float)tileRangeY + (float)inventory[selectedItem].tileBoost - 2f + (float)blockRange >= (float)tileTargetY))
37410 {
37411 return;
37412 }
37413 cursorItemIconEnabled = true;
37414 if (!ItemTimeIsZero || itemAnimation <= 0 || !controlUseItem || (!Main.tile[tileTargetX + 1, tileTargetY].active() && Main.tile[tileTargetX + 1, tileTargetY].wall <= 0 && !Main.tile[tileTargetX - 1, tileTargetY].active() && Main.tile[tileTargetX - 1, tileTargetY].wall <= 0 && !Main.tile[tileTargetX, tileTargetY + 1].active() && Main.tile[tileTargetX, tileTargetY + 1].wall <= 0 && !Main.tile[tileTargetX, tileTargetY - 1].active() && Main.tile[tileTargetX, tileTargetY - 1].wall <= 0) || Main.tile[tileTargetX, tileTargetY].wall == inventory[selectedItem].createWall)
37415 {
37416 return;
37417 }
37418 bool flag = true;
37419 if (TileReplacementEnabled)
37420 {
37421 flag = PlaceThing_TryReplacingWalls(flag);
37422 }
37423 if (!flag)
37424 {
37425 return;
37426 }
37427 WorldGen.PlaceWall(tileTargetX, tileTargetY, inventory[selectedItem].createWall);
37428 if (Main.tile[tileTargetX, tileTargetY].wall == inventory[selectedItem].createWall)
37429 {
37430 ApplyItemTime(inventory[selectedItem], wallSpeed);
37431 if (Main.netMode == 1)
37432 {
37433 NetMessage.SendData(17, -1, -1, null, 3, tileTargetX, tileTargetY, inventory[selectedItem].createWall);
37434 }
37435 PlaceThing_Walls_FillEmptySpace();
37436 if (autoPaint && builderAccStatus[3] == 0)
37437 {
37438 TryPainting(tileTargetX, tileTargetY, paintingAWall: true, applyItemAnimation: false);
37439 }
37440 }
37441 }
37442
37444 {
37445 if (inventory[selectedItem].stack <= 1)
37446 {
37447 return;
37448 }
37449 int createWall = inventory[selectedItem].createWall;
37450 for (int i = 0; i < 4; i++)
37451 {
37452 int num = tileTargetX;
37453 int num2 = tileTargetY;
37454 if (i == 0)
37455 {
37456 num--;
37457 }
37458 if (i == 1)
37459 {
37460 num++;
37461 }
37462 if (i == 2)
37463 {
37464 num2--;
37465 }
37466 if (i == 3)
37467 {
37468 num2++;
37469 }
37470 if (Main.tile[num, num2].wall != 0)
37471 {
37472 continue;
37473 }
37474 int num3 = 0;
37475 for (int j = 0; j < 4; j++)
37476 {
37477 int num4 = num;
37478 int num5 = num2;
37479 if (j == 0)
37480 {
37481 num4--;
37482 }
37483 if (j == 1)
37484 {
37485 num4++;
37486 }
37487 if (j == 2)
37488 {
37489 num5--;
37490 }
37491 if (j == 3)
37492 {
37493 num5++;
37494 }
37495 if (Main.tile[num4, num5].wall == createWall)
37496 {
37497 num3++;
37498 }
37499 }
37500 if (num3 != 4)
37501 {
37502 continue;
37503 }
37504 WorldGen.PlaceWall(num, num2, createWall);
37505 if (Main.tile[num, num2].wall == createWall)
37506 {
37507 inventory[selectedItem].stack--;
37508 if (inventory[selectedItem].stack == 0)
37509 {
37510 inventory[selectedItem].SetDefaults();
37511 }
37512 if (Main.netMode == 1)
37513 {
37514 NetMessage.SendData(17, -1, -1, null, 3, num, num2, createWall);
37515 }
37516 if (autoPaint && builderAccStatus[3] == 0)
37517 {
37518 TryPainting(num, num2, paintingAWall: true, applyItemAnimation: false);
37519 }
37520 }
37521 }
37522 }
37523
37524 private void PlaceThing_Tiles()
37525 {
37526 Item item = inventory[selectedItem];
37527 int tileToCreate = item.createTile;
37528 if (tileToCreate < 0 || !(position.X / 16f - (float)tileRangeX - (float)item.tileBoost - (float)blockRange <= (float)tileTargetX) || !((position.X + (float)width) / 16f + (float)tileRangeX + (float)item.tileBoost - 1f + (float)blockRange >= (float)tileTargetX) || !(position.Y / 16f - (float)tileRangeY - (float)item.tileBoost - (float)blockRange <= (float)tileTargetY) || !((position.Y + (float)height) / 16f + (float)tileRangeY + (float)item.tileBoost - 2f + (float)blockRange >= (float)tileTargetY))
37529 {
37530 return;
37531 }
37532 cursorItemIconEnabled = true;
37533 bool flag = PlaceThing_Tiles_CheckLavaBlocking();
37534 bool canUse = true;
37535 canUse = PlaceThing_Tiles_CheckGamepadTorchUsability(canUse);
37536 canUse = PlaceThing_Tiles_CheckWandUsability(canUse);
37537 canUse = PlaceThing_Tiles_CheckRopeUsability(canUse);
37538 canUse = PlaceThing_Tiles_CheckFlexibleWand(canUse);
37539 if (TileReplacementEnabled)
37540 {
37541 canUse = PlaceThing_TryReplacingTiles(canUse);
37542 }
37543 Tile tile = Main.tile[tileTargetX, tileTargetY];
37544 if (tile.active())
37545 {
37546 if (tileToCreate == 23 && tile.type == 59)
37547 {
37548 tileToCreate = 661;
37549 }
37550 if (tileToCreate == 199 && tile.type == 59)
37551 {
37552 tileToCreate = 662;
37553 }
37554 }
37555 if (canUse && ((!tile.active() && !flag) || (Main.tileCut[tile.type] && tile.type != 484) || (tile.type >= 373 && tile.type <= 375) || tile.type == 461 || tileToCreate == 199 || tileToCreate == 23 || tileToCreate == 662 || tileToCreate == 661 || tileToCreate == 2 || tileToCreate == 109 || tileToCreate == 60 || tileToCreate == 70 || tileToCreate == 633 || Main.tileMoss[tileToCreate] || TileID.Sets.BreakableWhenPlacing[tile.type]) && ItemTimeIsZero && itemAnimation > 0 && controlUseItem)
37556 {
37557 bool canPlace = false;
37558 bool newObjectType = false;
37559 bool? overrideCanPlace = null;
37560 int? forcedRandom = null;
37561 TileObject objectData = default(TileObject);
37563 if (overrideCanPlace.HasValue)
37564 {
37565 canPlace = overrideCanPlace.Value;
37566 }
37568 {
37569 newObjectType = true;
37570 canPlace = TileObject.CanPlace(tileTargetX, tileTargetY, (ushort)tileToCreate, previewPlaceStyle, direction, out objectData, onlyCheck: false, forcedRandom);
37571 PlaceThing_Tiles_BlockPlacementIfOverPlayers(ref canPlace, ref objectData);
37572 PlaceThing_Tiles_BlockPlacementForRepeatedPigronatas(ref canPlace, ref objectData);
37573 PlaceThing_Tiles_BlockPlacementForRepeatedPumpkins(ref canPlace, ref objectData);
37574 PlaceThing_Tiles_BlockPlacementForRepeatedCoralAndBeachPiles(ref canPlace, ref objectData);
37575 }
37576 else
37577 {
37578 canPlace = PlaceThing_Tiles_BlockPlacementForAssortedThings(canPlace);
37579 }
37580 if (canPlace)
37581 {
37582 PlaceThing_Tiles_PlaceIt(newObjectType, objectData, tileToCreate);
37583 }
37584 }
37585 }
37586
37587 private bool ModifyFlexibleWandPlacementInfo(ref int tileType, ref int tileStyle, ref int? forcedRandom)
37588 {
37590 if (flexibleTileWand == null)
37591 {
37592 return true;
37593 }
37594 if (whoAmI == Main.myPlayer)
37595 {
37596 Point point = new Point(tileTargetX, tileTargetY);
37597 if (FlexibleWandLastPosition != point)
37598 {
37599 FlexibleWandLastPosition = point;
37600 FlexibleWandRandomSeed = Main.rand.Next();
37601 }
37602 }
37603 if (flexibleTileWand.TryGetPlacementOption(this, FlexibleWandRandomSeed, FlexibleWandCycleOffset, out var option, out var _))
37604 {
37605 tileType = option.TileIdToPlace;
37606 tileStyle = option.TileStyleToPlace;
37607 forcedRandom = FlexibleWandCycleOffset;
37608 return true;
37609 }
37610 return false;
37611 }
37612
37614 {
37615 if (canUse && itemAnimation > 0 && ItemTimeIsZero && controlUseItem && PlaceThing_ValidWallForReplacement() && WorldGen.NearFriendlyWall(tileTargetX, tileTargetY) && WorldGen.ReplaceWall(tileTargetX, tileTargetY, (ushort)HeldItem.createWall))
37616 {
37617 canUse = false;
37618 ApplyItemTime(HeldItem, wallSpeed);
37619 NetMessage.SendData(17, -1, -1, null, 22, tileTargetX, tileTargetY, HeldItem.createWall);
37620 if (autoPaint && builderAccStatus[3] == 0)
37621 {
37622 TryPainting(tileTargetX, tileTargetY, paintingAWall: true, applyItemAnimation: false);
37623 }
37624 }
37625 return canUse;
37626 }
37627
37629 {
37630 _ = Main.tile[tileTargetX, tileTargetY];
37631 return Main.tile[tileTargetX, tileTargetY].wall > 0;
37632 }
37633
37635 {
37636 bool flag = PlaceThing_ValidTileForReplacement();
37637 if (flag)
37638 {
37639 TileObject.objectPreview.Reset();
37640 }
37641 if (controlUseItem && canUse && Main.tile[tileTargetX, tileTargetY].active() && itemAnimation > 0 && ItemTimeIsZero && flag)
37642 {
37643 Item bestPickaxe = GetBestPickaxe();
37644 if (bestPickaxe == null)
37645 {
37646 return false;
37647 }
37648 Tile tile = Main.tile[tileTargetX, tileTargetY];
37649 _ = tile.type;
37650 int num = hitReplace.HitObject(tileTargetX, tileTargetY, 1);
37651 int pickaxeDamage = GetPickaxeDamage(tileTargetX, tileTargetY, bestPickaxe.pick, num, tile);
37652 if (pickaxeDamage == 0)
37653 {
37654 return false;
37655 }
37656 if (!WorldGen.IsTileReplacable(tileTargetX, tileTargetY))
37657 {
37658 return false;
37659 }
37660 if (0 == 0)
37661 {
37662 if (hitReplace.AddDamage(num, pickaxeDamage) < 100)
37663 {
37664 int num2 = WorldGen.KillTile_GetTileDustAmount(fail: true, tile);
37665 for (int i = 0; i < num2; i++)
37666 {
37667 WorldGen.KillTile_MakeTileDust(tileTargetX, tileTargetY, tile);
37668 }
37669 WorldGen.KillTile_PlaySounds(tileTargetX, tileTargetY, fail: true, tile);
37670 if (HeldItem.consumable)
37671 {
37672 HeldItem.stack++;
37673 }
37674 dontConsumeWand = true;
37675 ApplyItemTime(bestPickaxe, pickSpeed);
37676 SetItemAnimation((int)((float)bestPickaxe.useTime * pickSpeed));
37677 return false;
37678 }
37679 ClearMiningCacheAt(tileTargetX, tileTargetY, 1);
37680 }
37681 int[,] typeCaches = PlaceThing_Tiles_GetAutoAccessoryCache();
37682 ushort num3 = (ushort)HeldItem.createTile;
37683 int num4 = HeldItem.placeStyle;
37684 if (UsingBiomeTorches && num3 == 4)
37685 {
37686 num4 = BiomeTorchPlaceStyle(num4);
37687 }
37688 if (UsingBiomeTorches && num3 == 215)
37689 {
37690 num4 = BiomeCampfirePlaceStyle(num4);
37691 }
37692 if (WorldGen.ReplaceTile(tileTargetX, tileTargetY, num3, num4))
37693 {
37694 canUse = false;
37695 NetMessage.SendData(17, -1, -1, null, 21, tileTargetX, tileTargetY, (int)num3, num4);
37696 ApplyItemTime(HeldItem);
37697 SetItemAnimation(HeldItem.useAnimation);
37698 PlaceThing_Tiles_PlaceIt_AutoPaintAndActuate(typeCaches, num3);
37699 }
37700 }
37701 return canUse;
37702 }
37703
37705 {
37706 int createTile = HeldItem.createTile;
37707 int num = HeldItem.placeStyle;
37708 if (UsingBiomeTorches && createTile == 4)
37709 {
37710 num = BiomeTorchPlaceStyle(num);
37711 }
37712 if (UsingBiomeTorches && createTile == 215)
37713 {
37714 num = BiomeCampfirePlaceStyle(num);
37715 }
37716 Tile tile = Main.tile[tileTargetX, tileTargetY];
37717 if (WorldGen.WouldTileReplacementBeBlockedByLiquid(tileTargetX, tileTargetY, 1))
37718 {
37719 return false;
37720 }
37721 if (ItemID.Sets.SortingPriorityRopes[HeldItem.type] != -1)
37722 {
37723 return false;
37724 }
37725 if (Main.tileMoss[createTile])
37726 {
37727 return false;
37728 }
37730 {
37731 return false;
37732 }
37734 {
37735 return false;
37736 }
37737 if (!PlaceThing_CheckSpecificValidtyCaseForBlockSwap(createTile, tile.type))
37738 {
37739 return false;
37740 }
37741 if (Main.tileCut[tile.type])
37742 {
37743 return false;
37744 }
37745 if (TileID.Sets.Platforms[tile.type] && tile.type == createTile)
37746 {
37747 return tile.frameY != num * 18;
37748 }
37749 if (tile.type == 4 && tile.type == createTile)
37750 {
37751 return tile.frameY != num * 22;
37752 }
37753 if (tile.type == 215 && tile.type == createTile)
37754 {
37755 return tile.frameX / 54 != num;
37756 }
37757 if (TileID.Sets.BasicChest[tile.type] && TileID.Sets.BasicChest[createTile])
37758 {
37759 if (tile.frameX / 36 == num)
37760 {
37761 return tile.type != createTile;
37762 }
37763 return true;
37764 }
37765 if (TileID.Sets.BasicDresser[tile.type] && TileID.Sets.BasicDresser[createTile])
37766 {
37767 if (tile.frameX / 54 == num)
37768 {
37769 return tile.type != createTile;
37770 }
37771 return true;
37772 }
37773 bool flag = false;
37774 if (Main.tileRope[tile.type])
37775 {
37776 if (createTile != 314 && !TileID.Sets.Platforms[createTile])
37777 {
37778 return false;
37779 }
37780 flag = true;
37781 }
37782 if (!flag && Main.tileFrameImportant[createTile] && !TileID.Sets.Platforms[createTile])
37783 {
37784 return false;
37785 }
37786 if (Main.tile[tileTargetX, tileTargetY].type == createTile)
37787 {
37788 return false;
37789 }
37790 if (Main.tile[tileTargetX, tileTargetY].type == 230 && Main.getGoodWorld)
37791 {
37792 return false;
37793 }
37795 {
37796 WorldGen.KillTile_GetItemDrops(tileTargetX, tileTargetY, tile, out var dropItem, out var _, out var _, out var _);
37797 if (dropItem == HeldItem.type)
37798 {
37799 return false;
37800 }
37801 }
37802 if (!WorldGen.WouldTileReplacementWork((ushort)createTile, tileTargetX, tileTargetY))
37803 {
37804 return false;
37805 }
37806 return true;
37807 }
37808
37810 {
37813 if (flag2)
37814 {
37815 Item bestPickaxe = GetBestPickaxe();
37816 if (bestPickaxe != null && bestPickaxe.pick >= 110)
37817 {
37818 flag2 = false;
37819 }
37820 }
37821 if (flag2 && tileTargetY > 0)
37822 {
37823 Tile tile = Main.tile[tileTargetX, tileTargetY - 1];
37824 bool flag3 = false;
37825 if (tile != null)
37826 {
37827 flag3 |= !tile.active();
37828 flag3 |= tile.active() && !TileID.Sets.Falling[tile.type];
37829 }
37830 if (flag3)
37831 {
37832 flag2 = false;
37833 }
37834 }
37835 if (flag2)
37836 {
37837 return false;
37838 }
37839 return true;
37840 }
37841
37843 {
37844 Item item = null;
37845 for (int i = 0; i < 50; i++)
37846 {
37847 if (inventory[i].stack > 0 && inventory[i].pick > 0 && (item == null || inventory[i].pick > item.pick))
37848 {
37849 item = inventory[i];
37850 }
37851 }
37852 return item;
37853 }
37854
37856 {
37857 int num = inventory[selectedItem].placeStyle;
37858 if (!newObjectType)
37859 {
37860 num = PlaceThing_Tiles_PlaceIt_GetLegacyTileStyle(num);
37861 }
37862 int[,] typeCaches = PlaceThing_Tiles_GetAutoAccessoryCache();
37863 bool forced = false;
37864 bool flag;
37865 if (newObjectType)
37866 {
37867 flag = TileObject.Place(data);
37868 WorldGen.SquareTileFrame(tileTargetX, tileTargetY);
37870 {
37871 SoundEngine.PlaySound(0, tileTargetX * 16, tileTargetY * 16);
37872 }
37873 }
37874 else
37875 {
37876 if (UsingBiomeTorches && tileToCreate == 4 && num == 0)
37877 {
37878 num = BiomeTorchPlaceStyle(num);
37879 }
37880 flag = WorldGen.PlaceTile(tileTargetX, tileTargetY, tileToCreate, mute: false, forced, whoAmI, num);
37881 }
37882 if (flag)
37883 {
37884 ApplyItemTime(inventory[selectedItem], tileSpeed);
37885 if (newObjectType)
37886 {
37887 TileObjectData.CallPostPlacementPlayerHook(tileTargetX, tileTargetY, tileToCreate, num, direction, data.alternate, data);
37888 if (Main.netMode == 1 && !Main.tileContainer[tileToCreate] && tileToCreate != 423)
37889 {
37890 NetMessage.SendObjectPlacement(-1, tileTargetX, tileTargetY, data.type, data.style, data.alternate, data.random, direction);
37891 }
37892 }
37893 else
37894 {
37895 NetMessage.SendData(17, -1, -1, null, 1, tileTargetX, tileTargetY, tileToCreate, num);
37896 PlaceThing_Tiles_PlaceIt_SpinChairs();
37897 PlaceThing_Tiles_PlaceIt_SpinBedsAndBaths();
37898 }
37899 PlaceThing_Tiles_PlaceIt_AdjustPlants();
37900 PlaceThing_Tiles_PlaceIt_SpinTraps();
37901 PlaceThing_Tiles_PlaceIt_TriggerLogicLamp();
37902 PlaceThing_Tiles_PlaceIt_SpinSmartPlatform();
37903 PlaceThing_Tiles_PlaceIt_ConsumeFlexibleWandMaterial();
37904 PlaceThing_Tiles_PlaceIt_UnslopeForSolids();
37905 PlaceThing_Tiles_PlaceIt_KillGrassForSolids();
37906 PlaceThing_Tiles_PlaceIt_AutoPaintAndActuate(typeCaches, tileToCreate);
37907 if (PlayerInput.UsingGamepad && ItemID.Sets.SingleUseInGamepad[inventory[selectedItem].type] && Main.myPlayer == whoAmI && !Main.SmartCursorIsUsed)
37908 {
37909 Main.blockMouse = true;
37910 }
37911 }
37912 return data;
37913 }
37914
37916 {
37917 FlexibleTileWand flexibleTileWand = inventory[selectedItem].GetFlexibleTileWand();
37918 if (flexibleTileWand != null && flexibleTileWand.TryGetPlacementOption(this, FlexibleWandRandomSeed, FlexibleWandCycleOffset, out var _, out var itemToConsume))
37919 {
37920 itemToConsume.stack--;
37921 if (itemToConsume.stack <= 0)
37922 {
37923 itemToConsume.TurnToAir();
37924 }
37925 }
37926 }
37927
37928 public int BiomeTorchPlaceStyle(int style)
37929 {
37930 if (!UsingBiomeTorches || style != 0)
37931 {
37932 return style;
37933 }
37934 if (ZoneShimmer)
37935 {
37936 style = 23;
37937 }
37938 else if (ZoneLihzhardTemple)
37939 {
37940 style = 21;
37941 }
37942 else if (ZoneDungeon)
37943 {
37944 style = 13;
37945 }
37946 else if (position.Y > (float)(Main.UnderworldLayer * 16))
37947 {
37948 style = 7;
37949 }
37950 else if (ZoneHallow)
37951 {
37952 style = 20;
37953 }
37954 else if (ZoneCorrupt)
37955 {
37956 style = 18;
37957 }
37958 else if (ZoneCrimson)
37959 {
37960 style = 19;
37961 }
37962 else if (ZoneSnow)
37963 {
37964 style = 9;
37965 }
37966 else if (ZoneGlowshroom)
37967 {
37968 style = 22;
37969 }
37970 else if (ZoneJungle)
37971 {
37972 style = 21;
37973 }
37974 else if ((ZoneDesert && (double)position.Y < Main.worldSurface * 16.0) || ZoneUndergroundDesert)
37975 {
37976 style = 16;
37977 }
37978 else if (ZoneDesert && Main.remixWorld)
37979 {
37980 style = 16;
37981 }
37982 return style;
37983 }
37984
37985 public int BiomeTorchHoldStyle(int style)
37986 {
37987 if (!UsingBiomeTorches || style != 8)
37988 {
37989 return style;
37990 }
37991 if (ZoneShimmer)
37992 {
37993 style = 5353;
37994 }
37995 else if (ZoneLihzhardTemple)
37996 {
37997 style = 4388;
37998 }
37999 else if (ZoneDungeon)
38000 {
38001 style = 3004;
38002 }
38003 else if (position.Y > (float)(Main.UnderworldLayer * 16))
38004 {
38005 style = 433;
38006 }
38007 else if (ZoneHallow)
38008 {
38009 style = 4387;
38010 }
38011 else if (ZoneCorrupt)
38012 {
38013 style = 4385;
38014 }
38015 else if (ZoneCrimson)
38016 {
38017 style = 4386;
38018 }
38019 else if (ZoneSnow)
38020 {
38021 style = 974;
38022 }
38023 else if (ZoneGlowshroom)
38024 {
38025 style = 5293;
38026 }
38027 else if (ZoneJungle)
38028 {
38029 style = 4388;
38030 }
38031 else if ((ZoneDesert && (double)position.Y < Main.worldSurface * 16.0) || ZoneUndergroundDesert)
38032 {
38033 style = 4383;
38034 }
38035 else if (ZoneDesert && Main.remixWorld)
38036 {
38037 style = 4383;
38038 }
38039 return style;
38040 }
38041
38042 public int BiomeCampfirePlaceStyle(int style)
38043 {
38044 if (!UsingBiomeTorches || style != 0)
38045 {
38046 return style;
38047 }
38048 if (ZoneShimmer)
38049 {
38050 style = 15;
38051 }
38052 else if (ZoneLihzhardTemple)
38053 {
38054 style = 13;
38055 }
38056 else if (ZoneDungeon)
38057 {
38058 style = 7;
38059 }
38060 else if (position.Y > (float)(Main.UnderworldLayer * 16))
38061 {
38062 style = 2;
38063 }
38064 else if (ZoneHallow)
38065 {
38066 style = 12;
38067 }
38068 else if (ZoneCorrupt)
38069 {
38070 style = 10;
38071 }
38072 else if (ZoneCrimson)
38073 {
38074 style = 11;
38075 }
38076 else if (ZoneSnow)
38077 {
38078 style = 3;
38079 }
38080 else if (ZoneGlowshroom)
38081 {
38082 style = 14;
38083 }
38084 else if (ZoneJungle)
38085 {
38086 style = 13;
38087 }
38088 else if ((ZoneDesert && (double)position.Y < Main.worldSurface * 16.0) || ZoneUndergroundDesert)
38089 {
38090 style = 8;
38091 }
38092 else if (ZoneDesert && Main.remixWorld)
38093 {
38094 style = 8;
38095 }
38096 return style;
38097 }
38098
38100 {
38101 if (!UsingBiomeTorches || itemType != 966)
38102 {
38103 return itemType;
38104 }
38105 if (ZoneShimmer)
38106 {
38107 itemType = 5357;
38108 }
38109 else if (ZoneLihzhardTemple)
38110 {
38111 itemType = 4694;
38112 }
38113 else if (ZoneDungeon)
38114 {
38115 itemType = 3724;
38116 }
38117 else if (position.Y > (float)(Main.UnderworldLayer * 16))
38118 {
38119 itemType = 3047;
38120 }
38121 else if (ZoneHallow)
38122 {
38123 itemType = 4693;
38124 }
38125 else if (ZoneCorrupt)
38126 {
38127 itemType = 4691;
38128 }
38129 else if (ZoneCrimson)
38130 {
38131 itemType = 4692;
38132 }
38133 else if (ZoneSnow)
38134 {
38135 itemType = 3048;
38136 }
38137 else if (ZoneJungle)
38138 {
38139 itemType = 4694;
38140 }
38141 else if (ZoneGlowshroom)
38142 {
38143 itemType = 5299;
38144 }
38145 else if ((ZoneDesert && (double)position.Y < Main.worldSurface * 16.0) || ZoneUndergroundDesert)
38146 {
38147 itemType = 4689;
38148 }
38149 else if (ZoneDesert && Main.remixWorld)
38150 {
38151 itemType = 4689;
38152 }
38153 return itemType;
38154 }
38155
38157 {
38158 int[,] array = null;
38159 if (autoPaint || autoActuator)
38160 {
38161 array = new int[11, 11];
38162 for (int i = 0; i < 11; i++)
38163 {
38164 for (int j = 0; j < 11; j++)
38165 {
38166 int num = tileTargetX - 5 + i;
38167 int num2 = tileTargetY - 5 + j;
38168 if (Main.tile[num, num2].active())
38169 {
38170 array[i, j] = Main.tile[num, num2].type;
38171 }
38172 else
38173 {
38174 array[i, j] = -1;
38175 }
38176 }
38177 }
38178 }
38179 return array;
38180 }
38181
38183 {
38184 int createTile = inventory[selectedItem].createTile;
38185 if (createTile == 36)
38186 {
38187 style = Main.rand.Next(7);
38188 }
38189 if (createTile == 212 && direction > 0)
38190 {
38191 style = 1;
38192 }
38193 if (createTile == 141)
38194 {
38195 style = Main.rand.Next(2);
38196 }
38197 if (createTile == 128 || createTile == 269 || createTile == 334)
38198 {
38199 style = ((direction >= 0) ? 1 : (-1));
38200 }
38201 if (createTile == 241 && inventory[selectedItem].placeStyle == 0)
38202 {
38203 style = Main.rand.Next(0, 9);
38204 }
38205 if (createTile == 35 && inventory[selectedItem].placeStyle == 0)
38206 {
38207 style = Main.rand.Next(9);
38208 }
38209 if (createTile == 314 && style == 2 && direction == 1)
38210 {
38211 style++;
38212 }
38213 if (createTile == 129)
38214 {
38215 style = (short)Main.rand.Next(18);
38216 }
38217 return style;
38218 }
38219
38221 {
38222 if (!Main.tileSolid[inventory[selectedItem].createTile] || (inventory[selectedItem].createTile >= 0 && TileID.Sets.Platforms[inventory[selectedItem].createTile]))
38223 {
38224 return;
38225 }
38226 int num = tileTargetX;
38227 int num2 = tileTargetY + 1;
38228 if (Main.tile[num, num2] != null && !TileID.Sets.Platforms[Main.tile[num, num2].type] && (Main.tile[num, num2].topSlope() || Main.tile[num, num2].halfBrick()))
38229 {
38230 WorldGen.SlopeTile(num, num2);
38231 if (Main.netMode == 1)
38232 {
38233 NetMessage.SendData(17, -1, -1, null, 14, num, num2);
38234 }
38235 }
38236 num = tileTargetX;
38237 num2 = tileTargetY - 1;
38238 if (Main.tile[num, num2] != null && !TileID.Sets.Platforms[Main.tile[num, num2].type] && Main.tile[num, num2].bottomSlope())
38239 {
38240 WorldGen.SlopeTile(num, num2);
38241 if (Main.netMode == 1)
38242 {
38243 NetMessage.SendData(17, -1, -1, null, 14, num, num2);
38244 }
38245 }
38246 }
38247
38249 {
38250 if (!Main.tileSolid[inventory[selectedItem].createTile])
38251 {
38252 return;
38253 }
38254 for (int i = tileTargetX - 1; i <= tileTargetX + 1; i++)
38255 {
38256 for (int j = tileTargetY - 1; j <= tileTargetY + 1; j++)
38257 {
38258 Tile tile = Main.tile[i, j];
38259 if (!tile.active() || inventory[selectedItem].createTile == tile.type || (tile.type != 2 && tile.type != 23 && tile.type != 60 && tile.type != 70 && tile.type != 109 && tile.type != 199 && tile.type != 477 && tile.type != 492 && tile.type != 633))
38260 {
38261 continue;
38262 }
38263 bool flag = true;
38264 for (int k = i - 1; k <= i + 1; k++)
38265 {
38266 for (int l = j - 1; l <= j + 1; l++)
38267 {
38268 if (!WorldGen.SolidTile(k, l))
38269 {
38270 flag = false;
38271 }
38272 }
38273 }
38274 if (flag)
38275 {
38276 WorldGen.KillTile(i, j, fail: true);
38277 if (Main.netMode == 1)
38278 {
38279 NetMessage.SendData(17, -1, -1, null, 0, i, j, 1f);
38280 }
38281 }
38282 }
38283 }
38284 }
38285
38287 {
38288 if (!autoPaint && !autoActuator)
38289 {
38290 return;
38291 }
38292 int num = 0;
38293 int num2 = 0;
38294 int num3 = 11;
38295 int num4 = 11;
38296 bool flag = TileID.Sets.Platforms[Main.tile[tileTargetX, tileTargetY].type];
38297 bool flag2 = TileID.Sets.Platforms[Main.tile[tileTargetX, tileTargetY].type] && TileID.Sets.Platforms[tileToCreate];
38298 if (!Main.tileFrameImportant[Main.tile[tileTargetX, tileTargetY].type] || flag)
38299 {
38300 num = (num2 = 5);
38301 num3 = (num4 = 6);
38302 }
38303 for (int i = num; i < num3; i++)
38304 {
38305 for (int j = num2; j < num4; j++)
38306 {
38307 int num5 = tileTargetX - 5 + i;
38308 int num6 = tileTargetY - 5 + j;
38309 if ((!Main.tile[num5, num6].active() && typeCaches[i, j] == -1) || (Main.tile[num5, num6].active() && !flag2 && (typeCaches[i, j] == Main.tile[num5, num6].type || Main.tile[num5, num6].type != tileToCreate)))
38310 {
38311 continue;
38312 }
38313 if (autoPaint && builderAccStatus[3] == 0)
38314 {
38315 TryPainting(num5, num6, paintingAWall: false, applyItemAnimation: false);
38316 }
38317 if (!autoActuator || builderAccStatus[2] != 0)
38318 {
38319 continue;
38320 }
38322 ushort type = Main.tile[num5, num6].type;
38323 if (type == 314 || (uint)(type - 386) <= 3u)
38324 {
38325 flag3 = false;
38326 }
38327 if (!flag3)
38328 {
38329 continue;
38330 }
38331 int num7 = FindItem(849);
38332 if (num7 > -1 && WorldGen.PlaceActuator(num5, num6))
38333 {
38334 NetMessage.SendData(17, -1, -1, null, 8, num5, num6);
38335 inventory[num7].stack--;
38336 if (inventory[num7].stack <= 0)
38337 {
38338 inventory[num7].SetDefaults();
38339 }
38340 }
38341 }
38342 }
38343 }
38344
38346 {
38347 if (inventory[selectedItem].createTile < 0 || !TileID.Sets.Platforms[inventory[selectedItem].createTile] || !Main.SmartCursorIsUsed)
38348 {
38349 return;
38350 }
38351 int num = tileTargetX;
38352 int num2 = tileTargetY;
38353 int num3 = -1;
38354 int num4 = 0;
38355 int num5 = 0;
38356 bool flag = true;
38357 for (int i = -1; i < 2; i++)
38358 {
38359 for (int j = -1; j < 2; j++)
38360 {
38361 if ((i != 0 || j != 0) && TileID.Sets.Platforms[Main.tile[num + i, num2 + j].type])
38362 {
38363 flag = false;
38364 }
38365 }
38366 }
38367 if (flag)
38368 {
38369 return;
38370 }
38371 Tile tile = Main.tile[num - 1, num2 - 1];
38372 if (tile.active() && TileID.Sets.Platforms[tile.type] && tile.slope() != 2)
38373 {
38374 num4++;
38375 }
38376 tile = Main.tile[num - 1, num2 + 1];
38377 if (tile.active() && TileID.Sets.Platforms[tile.type] && tile.slope() != 1)
38378 {
38379 num5++;
38380 }
38381 tile = Main.tile[num + 1, num2 - 1];
38382 if (tile.active() && TileID.Sets.Platforms[tile.type] && tile.slope() != 1)
38383 {
38384 num5++;
38385 }
38386 tile = Main.tile[num + 1, num2 + 1];
38387 if (tile.active() && TileID.Sets.Platforms[tile.type] && tile.slope() != 2)
38388 {
38389 num4++;
38390 }
38391 tile = Main.tile[num - 1, num2];
38392 if (WorldGen.SolidTile(tile))
38393 {
38394 num4++;
38395 if (TileID.Sets.Platforms[tile.type] && tile.slope() == 0)
38396 {
38397 num4++;
38398 }
38399 }
38400 tile = Main.tile[num + 1, num2];
38401 if (WorldGen.SolidTile(tile))
38402 {
38403 num5++;
38404 if (TileID.Sets.Platforms[tile.type] && tile.slope() == 0)
38405 {
38406 num5++;
38407 }
38408 }
38409 if (num4 > num5)
38410 {
38411 num3 = 1;
38412 }
38413 else if (num5 > num4)
38414 {
38415 num3 = 2;
38416 }
38417 tile = Main.tile[num - 1, num2];
38418 if (tile.active() && TileID.Sets.Platforms[tile.type])
38419 {
38420 num3 = 0;
38421 }
38422 tile = Main.tile[num + 1, num2];
38423 if (tile.active() && TileID.Sets.Platforms[tile.type])
38424 {
38425 num3 = 0;
38426 }
38427 int num6 = 0;
38428 int num7 = 0;
38429 if (num3 != -1)
38430 {
38431 WorldGen.SlopeTile(num, num2, num3, noEffects: true);
38432 int num8 = Main.tile[num, num2].slope();
38433 if (Main.netMode == 1)
38434 {
38435 NetMessage.SendData(17, -1, -1, null, 14, tileTargetX, tileTargetY, num8);
38436 }
38437 if (num3 == 1)
38438 {
38439 num6 = -1;
38440 num7 = -1;
38441 }
38442 else
38443 {
38444 num6 = 1;
38445 num7 = -1;
38446 }
38447 tile = Main.tile[num + num6, num2 + num7];
38448 if (tile.active() && TileID.Sets.Platforms[tile.type] && tile.slope() == 0 && (!Main.tile[num + num6 + num6, num2 + num7].active() || !TileID.Sets.Platforms[Main.tile[num + num6 + num6, num2 + num7].type] || !Main.tile[num + num6 + num6, num2 + num7].halfBrick()))
38449 {
38450 WorldGen.SlopeTile(num + num6, num2 + num7, num3);
38451 num8 = tile.slope();
38452 if (Main.netMode == 1)
38453 {
38454 NetMessage.SendData(17, -1, -1, null, 14, num + num6, num2 + num7, num8);
38455 }
38456 }
38457 if (num3 == 1)
38458 {
38459 num6 = 1;
38460 num7 = 1;
38461 }
38462 else
38463 {
38464 num6 = -1;
38465 num7 = 1;
38466 }
38467 tile = Main.tile[num + num6, num2 + num7];
38468 if (tile.active() && TileID.Sets.Platforms[tile.type] && tile.slope() == 0 && WorldGen.PlatformProperSides(num + num6, num2 + num7, acceptNonOpposing: true) <= 0)
38469 {
38470 WorldGen.SlopeTile(num + num6, num2 + num7, num3);
38471 num8 = tile.slope();
38472 if (Main.netMode == 1)
38473 {
38474 NetMessage.SendData(17, -1, -1, null, 14, num + num6, num2 + num7, num8);
38475 }
38476 }
38477 return;
38478 }
38479 num3 = 0;
38480 int num9 = 0;
38481 num6 = -1;
38482 tile = Main.tile[num + num6, num2];
38483 if (tile.active() && TileID.Sets.Platforms[tile.type] && tile.slope() != 0)
38484 {
38485 int num10 = (tile.slope() == 1).ToDirectionInt() * num6;
38486 num3 = ((num10 != -1) ? tile.slope() : 0);
38487 bool flag2 = true;
38488 if (Main.tile[num + num6 * 2, num2 + num10].active() && TileID.Sets.Platforms[Main.tile[num + num6 * 2, num2].type] && num3 == Main.tile[num + num6 * 2, num2 + num10].slope())
38489 {
38490 flag2 = false;
38491 }
38492 if (Main.tile[num, num2 - num10].active() && TileID.Sets.Platforms[Main.tile[num, num2 - num10].type] && tile.slope() == Main.tile[num, num2 - num10].slope())
38493 {
38494 flag2 = false;
38495 }
38496 if (flag2)
38497 {
38498 WorldGen.SlopeTile(num + num6, num2, num3);
38499 num9 = tile.slope();
38500 if (Main.netMode == 1)
38501 {
38502 NetMessage.SendData(17, -1, -1, null, 14, num + num6, num2, num9);
38503 }
38504 }
38505 }
38506 num6 = 1;
38507 num7 = 0;
38508 tile = Main.tile[num + num6, num2 + num7];
38509 if (tile.active() && TileID.Sets.Platforms[tile.type] && tile.slope() != 0)
38510 {
38511 int num11 = (tile.slope() == 1).ToDirectionInt() * num6;
38512 num3 = ((num11 != -1) ? tile.slope() : 0);
38513 bool flag3 = true;
38514 if (Main.tile[num + num6 * 2, num2 + num11].active() && TileID.Sets.Platforms[Main.tile[num + num6 * 2, num2].type] && num3 == Main.tile[num + num6 * 2, num2 + num11].slope())
38515 {
38516 flag3 = false;
38517 }
38518 if (Main.tile[num, num2 - num11].active() && TileID.Sets.Platforms[Main.tile[num, num2 - num11].type] && tile.slope() == Main.tile[num, num2 - num11].slope())
38519 {
38520 flag3 = false;
38521 }
38522 if (flag3)
38523 {
38524 WorldGen.SlopeTile(num + num6, num2, num3);
38525 num9 = tile.slope();
38526 if (Main.netMode == 1)
38527 {
38528 NetMessage.SendData(17, -1, -1, null, 14, num + num6, num2, num9);
38529 }
38530 }
38531 }
38532 if (num4 != num5 || WorldGen.PlatformProperSides(num, num2) != 0)
38533 {
38534 return;
38535 }
38536 tile = Main.tile[num, num2 + 1];
38537 if (tile.active() && !tile.halfBrick() && tile.slope() == 0 && Main.tileSolid[tile.type])
38538 {
38539 num3 = ((direction != 1) ? 1 : 2);
38540 WorldGen.SlopeTile(num, num2, num3);
38541 num9 = Main.tile[num, num2].slope();
38542 if (Main.netMode == 1)
38543 {
38544 NetMessage.SendData(17, -1, -1, null, 14, tileTargetX, tileTargetY, num9);
38545 }
38546 }
38547 }
38548
38550 {
38551 if (inventory[selectedItem].createTile == 419)
38552 {
38553 if (Main.netMode == 1)
38554 {
38555 NetMessage.SendData(17, -1, -1, null, 18, tileTargetX, tileTargetY);
38556 }
38557 else
38558 {
38559 Wiring.PokeLogicGate(tileTargetX, tileTargetY);
38560 }
38561 }
38562 }
38563
38565 {
38566 if ((inventory[selectedItem].createTile == 79 || inventory[selectedItem].createTile == 90) && Main.netMode == 1)
38567 {
38568 NetMessage.SendTileSquare(-1, tileTargetX, tileTargetY, 5);
38569 }
38570 }
38571
38573 {
38574 if (inventory[selectedItem].createTile == 15)
38575 {
38576 if (direction == 1)
38577 {
38578 Main.tile[tileTargetX, tileTargetY].frameX += 18;
38579 Main.tile[tileTargetX, tileTargetY - 1].frameX += 18;
38580 }
38581 if (Main.netMode == 1)
38582 {
38583 NetMessage.SendTileSquare(-1, tileTargetX - 1, tileTargetY - 1, 3);
38584 }
38585 }
38586 }
38587
38589 {
38590 if (inventory[selectedItem].createTile == 137)
38591 {
38592 if (direction == 1)
38593 {
38594 Main.tile[tileTargetX, tileTargetY].frameX += 18;
38595 }
38596 if (Main.netMode == 1)
38597 {
38598 NetMessage.SendTileSquare(-1, tileTargetX, tileTargetY);
38599 }
38600 }
38601 }
38602
38604 {
38605 if (inventory[selectedItem].createTile != 3)
38606 {
38607 return;
38608 }
38609 FlowerPacketInfo flowerPacketInfo = ItemID.Sets.flowerPacketInfo[inventory[selectedItem].type];
38610 if (flowerPacketInfo == null)
38611 {
38612 return;
38613 }
38614 List<int> stylesOnPurity = flowerPacketInfo.stylesOnPurity;
38615 if (stylesOnPurity.Count != 0)
38616 {
38617 int num = stylesOnPurity[Main.rand.Next(stylesOnPurity.Count)];
38618 Main.tile[tileTargetX, tileTargetY].frameX = (short)(num * 18);
38619 if (Main.netMode == 1)
38620 {
38621 NetMessage.SendTileSquare(-1, tileTargetX, tileTargetY);
38622 }
38623 }
38624 }
38625
38627 {
38628 bool flag = inventory[selectedItem].type == 213 || inventory[selectedItem].type == 5295;
38629 if (flag && !placed && Main.tile[tileTargetX, tileTargetY].type == 1 && Main.tile[tileTargetX, tileTargetY].active())
38630 {
38631 int num = 0;
38632 int num2 = 0;
38633 Point point = base.Center.ToTileCoordinates();
38635 WorldUtils.Gen(new Point(point.X - 25, point.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(182, 515, 180, 513, 179, 512, 183, 516, 181, 514, 381, 517, 534, 535, 536, 537, 539, 540, 625, 626, 627, 628).Output(dictionary));
38637 {
38638 if (item.Value > num2)
38639 {
38640 num2 = item.Value;
38641 num = item.Key;
38642 }
38643 }
38644 switch (num)
38645 {
38646 case 515:
38647 num = 182;
38648 break;
38649 case 513:
38650 num = 180;
38651 break;
38652 case 512:
38653 num = 179;
38654 break;
38655 case 516:
38656 num = 183;
38657 break;
38658 case 514:
38659 num = 181;
38660 break;
38661 case 517:
38662 num = 381;
38663 break;
38664 case 535:
38665 num = 534;
38666 break;
38667 case 537:
38668 num = 536;
38669 break;
38670 case 540:
38671 num = 539;
38672 break;
38673 case 626:
38674 num = 625;
38675 break;
38676 case 628:
38677 num = 627;
38678 break;
38679 }
38680 if (num2 == 0)
38681 {
38682 num = Utils.SelectRandom<int>(Main.rand, 182, 180, 179, 183, 181);
38683 }
38684 if (num != 0)
38685 {
38686 Main.tile[tileTargetX, tileTargetY].type = (ushort)num;
38687 WorldGen.SquareTileFrame(tileTargetX, tileTargetY);
38688 NetMessage.SendTileSquare(-1, tileTargetX, tileTargetY);
38689 placed = true;
38690 }
38691 }
38692 if (flag && !placed && Main.tile[tileTargetX, tileTargetY].type == 38 && Main.tile[tileTargetX, tileTargetY].active())
38693 {
38694 int num3 = 0;
38695 int num4 = 0;
38696 Point point2 = base.Center.ToTileCoordinates();
38698 WorldUtils.Gen(new Point(point2.X - 25, point2.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(182, 515, 180, 513, 179, 512, 183, 516, 181, 514, 381, 517, 534, 535, 536, 537, 539, 540, 625, 626, 627, 628).Output(dictionary2));
38700 {
38701 if (item2.Value > num4)
38702 {
38703 num4 = item2.Value;
38704 num3 = item2.Key;
38705 }
38706 }
38707 switch (num3)
38708 {
38709 case 182:
38710 num3 = 515;
38711 break;
38712 case 180:
38713 num3 = 513;
38714 break;
38715 case 179:
38716 num3 = 512;
38717 break;
38718 case 183:
38719 num3 = 516;
38720 break;
38721 case 181:
38722 num3 = 514;
38723 break;
38724 case 381:
38725 num3 = 517;
38726 break;
38727 case 534:
38728 num3 = 535;
38729 break;
38730 case 536:
38731 num3 = 537;
38732 break;
38733 case 539:
38734 num3 = 540;
38735 break;
38736 case 625:
38737 num3 = 626;
38738 break;
38739 case 627:
38740 num3 = 628;
38741 break;
38742 }
38743 if (num4 == 0)
38744 {
38745 num3 = Utils.SelectRandom<int>(Main.rand, 515, 513, 512, 516, 514);
38746 }
38747 if (num3 != 0)
38748 {
38749 Main.tile[tileTargetX, tileTargetY].type = (ushort)num3;
38750 WorldGen.SquareTileFrame(tileTargetX, tileTargetY);
38751 NetMessage.SendTileSquare(-1, tileTargetX, tileTargetY);
38752 placed = true;
38753 }
38754 }
38755 return placed;
38756 }
38757
38759 {
38760 bool flag = inventory[selectedItem].type == 213 || inventory[selectedItem].type == 5295;
38761 if (flag)
38762 {
38763 if (Main.tile[tileTargetX, tileTargetY].type == 0 || Main.tile[tileTargetX, tileTargetY].type == 1 || Main.tile[tileTargetX, tileTargetY].type == 38)
38764 {
38765 canPlace = true;
38766 }
38767 }
38768 else if (inventory[selectedItem].createTile == 2 || inventory[selectedItem].createTile == 109)
38769 {
38770 if (Main.tile[tileTargetX, tileTargetY].nactive() && Main.tile[tileTargetX, tileTargetY].type == 0)
38771 {
38772 canPlace = true;
38773 }
38774 }
38775 else if (inventory[selectedItem].createTile == 23 || inventory[selectedItem].createTile == 199)
38776 {
38777 if (Main.tile[tileTargetX, tileTargetY].nactive())
38778 {
38779 if (Main.tile[tileTargetX, tileTargetY].type == 0)
38780 {
38781 canPlace = true;
38782 }
38783 else if (Main.tile[tileTargetX, tileTargetY].type == 59)
38784 {
38785 canPlace = true;
38786 }
38787 }
38788 }
38789 else if (inventory[selectedItem].createTile == 227)
38790 {
38791 canPlace = true;
38792 }
38793 else if (inventory[selectedItem].createTile >= 373 && inventory[selectedItem].createTile <= 375)
38794 {
38795 int num = tileTargetX;
38796 int num2 = tileTargetY - 1;
38797 if (Main.tile[num, num2].nactive() && Main.tileSolid[Main.tile[num, num2].type] && !Main.tileSolidTop[Main.tile[num, num2].type])
38798 {
38799 canPlace = true;
38800 }
38801 }
38802 else if (inventory[selectedItem].createTile == 461)
38803 {
38804 int num3 = tileTargetX;
38805 int num4 = tileTargetY - 1;
38806 if (Main.tile[num3, num4].nactive() && Main.tileSolid[Main.tile[num3, num4].type] && !Main.tileSolidTop[Main.tile[num3, num4].type])
38807 {
38808 canPlace = true;
38809 }
38810 }
38811 else if (inventory[selectedItem].createTile == 60 || inventory[selectedItem].createTile == 70 || inventory[selectedItem].createTile == 661 || inventory[selectedItem].createTile == 662)
38812 {
38813 if (Main.tile[tileTargetX, tileTargetY].nactive() && Main.tile[tileTargetX, tileTargetY].type == 59)
38814 {
38815 canPlace = true;
38816 }
38817 }
38818 else if (inventory[selectedItem].createTile == 4 || inventory[selectedItem].createTile == 136)
38819 {
38820 if (Main.tile[tileTargetX, tileTargetY].wall > 0)
38821 {
38822 canPlace = true;
38823 }
38824 else
38825 {
38826 if (!WorldGen.SolidTileNoAttach(tileTargetX, tileTargetY + 1) && !WorldGen.SolidTileNoAttach(tileTargetX - 1, tileTargetY) && !WorldGen.SolidTileNoAttach(tileTargetX + 1, tileTargetY))
38827 {
38828 if (!WorldGen.SolidTileNoAttach(tileTargetX, tileTargetY + 1) && (Main.tile[tileTargetX, tileTargetY + 1].halfBrick() || Main.tile[tileTargetX, tileTargetY + 1].slope() != 0))
38829 {
38830 if (!TileID.Sets.Platforms[Main.tile[tileTargetX, tileTargetY + 1].type])
38831 {
38832 WorldGen.SlopeTile(tileTargetX, tileTargetY + 1);
38833 if (Main.netMode == 1)
38834 {
38835 NetMessage.SendData(17, -1, -1, null, 14, tileTargetX, tileTargetY + 1);
38836 }
38837 }
38838 }
38839 else if (!WorldGen.SolidTileNoAttach(tileTargetX, tileTargetY + 1) && !WorldGen.SolidTileNoAttach(tileTargetX - 1, tileTargetY) && (Main.tile[tileTargetX - 1, tileTargetY].halfBrick() || Main.tile[tileTargetX - 1, tileTargetY].slope() != 0))
38840 {
38841 if (!TileID.Sets.Platforms[Main.tile[tileTargetX - 1, tileTargetY].type])
38842 {
38843 WorldGen.SlopeTile(tileTargetX - 1, tileTargetY);
38844 if (Main.netMode == 1)
38845 {
38846 NetMessage.SendData(17, -1, -1, null, 14, tileTargetX - 1, tileTargetY);
38847 }
38848 }
38849 }
38850 else if (!WorldGen.SolidTileNoAttach(tileTargetX, tileTargetY + 1) && !WorldGen.SolidTileNoAttach(tileTargetX + 1, tileTargetY) && (Main.tile[tileTargetX + 1, tileTargetY].halfBrick() || Main.tile[tileTargetX + 1, tileTargetY].slope() != 0) && !TileID.Sets.Platforms[Main.tile[tileTargetX + 1, tileTargetY].type])
38851 {
38852 WorldGen.SlopeTile(tileTargetX + 1, tileTargetY);
38853 if (Main.netMode == 1)
38854 {
38855 NetMessage.SendData(17, -1, -1, null, 14, tileTargetX + 1, tileTargetY);
38856 }
38857 }
38858 }
38859 int num5 = Main.tile[tileTargetX, tileTargetY + 1].type;
38860 if (Main.tile[tileTargetX, tileTargetY].halfBrick())
38861 {
38862 num5 = -1;
38863 }
38864 int num6 = Main.tile[tileTargetX - 1, tileTargetY].type;
38865 int num7 = Main.tile[tileTargetX + 1, tileTargetY].type;
38866 int tree = Main.tile[tileTargetX - 1, tileTargetY - 1].type;
38867 int tree2 = Main.tile[tileTargetX + 1, tileTargetY - 1].type;
38868 int tree3 = Main.tile[tileTargetX - 1, tileTargetY - 1].type;
38869 int tree4 = Main.tile[tileTargetX + 1, tileTargetY + 1].type;
38870 if (!Main.tile[tileTargetX, tileTargetY + 1].nactive())
38871 {
38872 num5 = -1;
38873 }
38874 if (!Main.tile[tileTargetX - 1, tileTargetY].nactive())
38875 {
38876 num6 = -1;
38877 }
38878 if (!Main.tile[tileTargetX + 1, tileTargetY].nactive())
38879 {
38880 num7 = -1;
38881 }
38882 if (!Main.tile[tileTargetX - 1, tileTargetY - 1].nactive())
38883 {
38884 tree = -1;
38885 }
38886 if (!Main.tile[tileTargetX + 1, tileTargetY - 1].nactive())
38887 {
38888 tree2 = -1;
38889 }
38890 if (!Main.tile[tileTargetX - 1, tileTargetY + 1].nactive())
38891 {
38892 tree3 = -1;
38893 }
38894 if (!Main.tile[tileTargetX + 1, tileTargetY + 1].nactive())
38895 {
38896 tree4 = -1;
38897 }
38898 if (num5 >= 0 && Main.tileSolid[num5] && (!Main.tileNoAttach[num5] || (num5 >= 0 && TileID.Sets.Platforms[num5])))
38899 {
38900 canPlace = true;
38901 }
38903 {
38904 canPlace = true;
38905 }
38907 {
38908 canPlace = true;
38909 }
38910 }
38911 }
38912 else if (inventory[selectedItem].createTile == 78 || inventory[selectedItem].createTile == 98 || inventory[selectedItem].createTile == 100 || inventory[selectedItem].createTile == 173 || inventory[selectedItem].createTile == 174 || inventory[selectedItem].createTile == 324)
38913 {
38914 if (Main.tile[tileTargetX, tileTargetY + 1].nactive() && (Main.tileSolid[Main.tile[tileTargetX, tileTargetY + 1].type] || Main.tileTable[Main.tile[tileTargetX, tileTargetY + 1].type]))
38915 {
38916 canPlace = true;
38917 }
38918 }
38919 else if (inventory[selectedItem].createTile == 419)
38920 {
38921 if (Main.tile[tileTargetX, tileTargetY + 1].active() && (Main.tile[tileTargetX, tileTargetY + 1].type == 419 || (inventory[selectedItem].placeStyle != 2 && Main.tile[tileTargetX, tileTargetY + 1].type == 420)))
38922 {
38923 canPlace = true;
38924 }
38925 }
38926 else if (inventory[selectedItem].createTile == 13 || inventory[selectedItem].createTile == 29 || inventory[selectedItem].createTile == 33 || inventory[selectedItem].createTile == 49 || inventory[selectedItem].createTile == 50 || inventory[selectedItem].createTile == 103)
38927 {
38928 if (Main.tile[tileTargetX, tileTargetY + 1].nactive() && Main.tileTable[Main.tile[tileTargetX, tileTargetY + 1].type])
38929 {
38930 canPlace = true;
38931 }
38932 }
38933 else if (inventory[selectedItem].createTile == 275 || inventory[selectedItem].createTile == 276 || inventory[selectedItem].createTile == 277)
38934 {
38935 canPlace = true;
38936 }
38937 else if (inventory[selectedItem].createTile == 51 || inventory[selectedItem].createTile == 330 || inventory[selectedItem].createTile == 331 || inventory[selectedItem].createTile == 332 || inventory[selectedItem].createTile == 333 || inventory[selectedItem].createTile == 336 || inventory[selectedItem].createTile == 340 || inventory[selectedItem].createTile == 342 || inventory[selectedItem].createTile == 341 || inventory[selectedItem].createTile == 343 || inventory[selectedItem].createTile == 344 || inventory[selectedItem].createTile == 379 || inventory[selectedItem].createTile == 351)
38938 {
38939 if (Main.tile[tileTargetX + 1, tileTargetY].active() || Main.tile[tileTargetX + 1, tileTargetY].wall > 0 || Main.tile[tileTargetX - 1, tileTargetY].active() || Main.tile[tileTargetX - 1, tileTargetY].wall > 0 || Main.tile[tileTargetX, tileTargetY + 1].active() || Main.tile[tileTargetX, tileTargetY + 1].wall > 0 || Main.tile[tileTargetX, tileTargetY - 1].active() || Main.tile[tileTargetX, tileTargetY - 1].wall > 0)
38940 {
38941 canPlace = true;
38942 }
38943 }
38944 else if (inventory[selectedItem].createTile == 314)
38945 {
38946 for (int i = tileTargetX - 1; i <= tileTargetX + 1; i++)
38947 {
38948 for (int j = tileTargetY - 1; j <= tileTargetY + 1; j++)
38949 {
38950 Tile tile = Main.tile[i, j];
38951 if (tile.active() || tile.wall > 0)
38952 {
38953 canPlace = true;
38954 break;
38955 }
38956 }
38957 }
38958 }
38959 else
38960 {
38961 Tile tile2 = Main.tile[tileTargetX - 1, tileTargetY];
38962 Tile tile3 = Main.tile[tileTargetX + 1, tileTargetY];
38963 Tile tile4 = Main.tile[tileTargetX, tileTargetY - 1];
38964 Tile tile5 = Main.tile[tileTargetX, tileTargetY + 1];
38965 if ((tile3.active() && (Main.tileSolid[tile3.type] || TileID.Sets.IsBeam[tile3.type] || Main.tileRope[tile3.type] || tile3.type == 314)) || tile3.wall > 0 || (tile2.active() && (Main.tileSolid[tile2.type] || TileID.Sets.IsBeam[tile2.type] || Main.tileRope[tile2.type] || tile2.type == 314)) || tile2.wall > 0 || (tile5.active() && (Main.tileSolid[tile5.type] || TileID.Sets.IsBeam[tile5.type] || Main.tileRope[tile5.type] || tile5.type == 314)) || tile5.wall > 0 || (tile4.active() && (Main.tileSolid[tile4.type] || TileID.Sets.IsBeam[tile4.type] || Main.tileRope[tile4.type] || tile4.type == 314)) || tile4.wall > 0)
38966 {
38967 canPlace = true;
38968 }
38969 else if (Main.tile[tileTargetX, tileTargetY].wall > 0)
38970 {
38971 canPlace = true;
38972 }
38973 }
38974 if (flag && Main.tile[tileTargetX, tileTargetY].active())
38975 {
38976 int num8 = tileTargetX;
38977 int num9 = tileTargetY;
38978 if (Main.tile[num8, num9].type == 3 || Main.tile[num8, num9].type == 73 || Main.tile[num8, num9].type == 84)
38979 {
38980 WorldGen.KillTile(tileTargetX, tileTargetY);
38981 if (!Main.tile[tileTargetX, tileTargetY].active() && Main.netMode == 1)
38982 {
38983 NetMessage.SendData(17, -1, -1, null, 0, tileTargetX, tileTargetY);
38984 }
38985 }
38986 else if (Main.tile[num8, num9].type == 83)
38987 {
38988 bool flag2 = false;
38989 int num10 = Main.tile[num8, num9].frameX / 18;
38990 if (num10 == 0 && Main.dayTime)
38991 {
38992 flag2 = true;
38993 }
38994 if (num10 == 1 && !Main.dayTime)
38995 {
38996 flag2 = true;
38997 }
38998 if (num10 == 3 && !Main.dayTime && (Main.bloodMoon || Main.moonPhase == 0))
38999 {
39000 flag2 = true;
39001 }
39002 if (num10 == 4 && (Main.raining || Main.cloudAlpha > 0f))
39003 {
39004 flag2 = true;
39005 }
39006 if (num10 == 5 && !Main.raining && Main.dayTime && Main.time > 40500.0)
39007 {
39008 flag2 = true;
39009 }
39010 if (flag2)
39011 {
39012 WorldGen.KillTile(tileTargetX, tileTargetY);
39013 NetMessage.SendData(17, -1, -1, null, 0, tileTargetX, tileTargetY);
39014 }
39015 }
39016 }
39017 if (Main.tileAlch[inventory[selectedItem].createTile])
39018 {
39019 canPlace = true;
39020 }
39021 if (Main.tile[tileTargetX, tileTargetY].active() && (Main.tileCut[Main.tile[tileTargetX, tileTargetY].type] || TileID.Sets.BreakableWhenPlacing[Main.tile[tileTargetX, tileTargetY].type] || (Main.tile[tileTargetX, tileTargetY].type >= 373 && Main.tile[tileTargetX, tileTargetY].type <= 375) || Main.tile[tileTargetX, tileTargetY].type == 461))
39022 {
39023 if (Main.tile[tileTargetX, tileTargetY].type != inventory[selectedItem].createTile)
39024 {
39025 bool num11 = Main.tile[tileTargetX, tileTargetY + 1].type != 78 && Main.tile[tileTargetX, tileTargetY + 1].type != 380 && Main.tile[tileTargetX, tileTargetY + 1].type != 579;
39026 bool flag3 = Main.tile[tileTargetX, tileTargetY].type == 3 || Main.tile[tileTargetX, tileTargetY].type == 73;
39027 bool flag4 = Main.tileAlch[Main.tile[tileTargetX, tileTargetY].type] && WorldGen.IsHarvestableHerbWithSeed(Main.tile[tileTargetX, tileTargetY].type, Main.tile[tileTargetX, tileTargetY].frameX / 18);
39028 bool flag5 = Main.tileAlch[inventory[selectedItem].createTile];
39029 if (num11 || ((flag3 || flag4) && flag5))
39030 {
39031 WorldGen.KillTile(tileTargetX, tileTargetY);
39032 if (!Main.tile[tileTargetX, tileTargetY].active() && Main.netMode == 1)
39033 {
39034 NetMessage.SendData(17, -1, -1, null, 0, tileTargetX, tileTargetY);
39035 }
39036 }
39037 else
39038 {
39039 canPlace = false;
39040 }
39041 }
39042 else
39043 {
39044 canPlace = false;
39045 }
39046 }
39047 if (!canPlace && inventory[selectedItem].createTile >= 0 && TileID.Sets.Platforms[inventory[selectedItem].createTile])
39048 {
39049 for (int k = tileTargetX - 1; k <= tileTargetX + 1; k++)
39050 {
39051 for (int l = tileTargetY - 1; l <= tileTargetY + 1; l++)
39052 {
39053 if (Main.tile[k, l].active())
39054 {
39055 canPlace = true;
39056 break;
39057 }
39058 }
39059 }
39060 }
39061 if (inventory[selectedItem].createTile == 3)
39062 {
39063 canPlace = WorldGen.IsFitToPlaceFlowerIn(tileTargetX, tileTargetY, 3);
39064 if (canPlace)
39065 {
39066 WorldGen.KillTile(tileTargetX, tileTargetY);
39067 if (Main.netMode == 1 && !Main.tile[tileTargetX, tileTargetY].active())
39068 {
39069 NetMessage.SendData(17, -1, -1, null, 0, tileTargetX, tileTargetY);
39070 }
39071 }
39072 }
39073 return canPlace;
39074 }
39075
39077 {
39078 if (data.type != 254)
39079 {
39080 return;
39081 }
39082 for (int i = -1; i < 1; i++)
39083 {
39084 for (int j = 0; j < 2; j++)
39085 {
39086 if (!WorldGen.CanCutTile(tileTargetX + j, tileTargetY + i, TileCuttingContext.TilePlacement))
39087 {
39088 canPlace = false;
39089 }
39090 }
39091 }
39092 }
39093
39095 {
39096 if (data.type == 81 || data.type == 324)
39097 {
39098 Tile tile = Main.tile[tileTargetX, tileTargetY];
39099 if (tile.active() && (Main.tileCut[tile.type] || TileID.Sets.BreakableWhenPlacing[tile.type] || (tile.type >= 373 && tile.type <= 375) || tile.type == 461))
39100 {
39101 canPlace = false;
39102 }
39103 }
39104 }
39105
39107 {
39108 if (data.type != 454)
39109 {
39110 return;
39111 }
39112 for (int i = -2; i < 2; i++)
39113 {
39114 Tile tile = Main.tile[tileTargetX + i, tileTargetY];
39115 if (tile.active() && tile.type == 454)
39116 {
39117 canPlace = false;
39118 }
39119 }
39120 }
39121
39123 {
39124 int num = 0;
39125 int num2 = 0;
39126 int x = 0;
39127 int y = 0;
39128 switch (data.type)
39129 {
39130 case 138:
39131 case 664:
39132 num = 32;
39133 num2 = 32;
39134 x = data.xCoord * 16;
39135 y = data.yCoord * 16;
39136 break;
39137 case 484:
39138 num = 32;
39139 num2 = 32;
39140 x = data.xCoord * 16;
39141 y = data.yCoord * 16;
39142 break;
39143 case 235:
39144 num = 48;
39145 num2 = 16;
39146 x = data.xCoord * 16;
39147 y = data.yCoord * 16;
39148 break;
39149 case 476:
39150 num = 16;
39151 num2 = 16;
39152 x = data.xCoord * 16;
39153 y = data.yCoord * 16;
39154 break;
39155 case 387:
39156 num = 32;
39157 num2 = 16;
39158 x = data.xCoord * 16;
39159 y = data.yCoord * 16;
39160 break;
39161 }
39162 if (num == 0 || num2 == 0)
39163 {
39164 return;
39165 }
39166 Rectangle value = new Rectangle(x, y, num, num2);
39167 for (int i = 0; i < 255; i++)
39168 {
39169 Player player = Main.player[i];
39170 if (player.active && !player.dead && !player.ghost && player.Hitbox.Intersects(value))
39171 {
39172 canPlace = false;
39173 break;
39174 }
39175 }
39176 }
39177
39179 {
39180 bool result = false;
39181 if (Main.tile[tileTargetX, tileTargetY].liquid > 0 && Main.tile[tileTargetX, tileTargetY].lava())
39182 {
39183 if (Main.tileSolid[inventory[selectedItem].createTile])
39184 {
39185 result = true;
39186 }
39187 else if (!TileObjectData.CheckLiquidPlacement(inventory[selectedItem].createTile, inventory[selectedItem].placeStyle, Main.tile[tileTargetX, tileTargetY]))
39188 {
39189 result = true;
39190 }
39191 }
39192 return result;
39193 }
39194
39196 {
39197 if (Main.tileRope[inventory[selectedItem].createTile] && canUse && Main.tile[tileTargetX, tileTargetY].active() && Main.tileRope[Main.tile[tileTargetX, tileTargetY].type])
39198 {
39199 int num = tileTargetY;
39200 int num2 = tileTargetX;
39201 bool flag = inventory[selectedItem].createTile == 214;
39202 while (Main.tile[num2, num].active() && (Main.tileRope[Main.tile[num2, num].type] || Main.tile[num2, num].type == 314 || TileID.Sets.Platforms[Main.tile[num2, num].type]) && num < Main.maxTilesY - 5 && Main.tile[num2, num + 2] != null && (flag || !Main.tile[num2, num + 1].lava()))
39203 {
39204 num++;
39205 if (Main.tile[num2, num] == null)
39206 {
39207 canUse = false;
39208 num = tileTargetY;
39209 break;
39210 }
39211 }
39212 if (!Main.tile[num2, num].active())
39213 {
39214 tileTargetY = num;
39215 }
39216 }
39217 return canUse;
39218 }
39219
39221 {
39224 return inventory[selectedItem].GetFlexibleTileWand()?.TryGetPlacementOption(this, FlexibleWandRandomSeed, FlexibleWandCycleOffset, out option, out itemToConsume) ?? canUse;
39225 }
39226
39228 {
39229 if (inventory[selectedItem].tileWand > 0)
39230 {
39231 int tileWand = inventory[selectedItem].tileWand;
39232 canUse = false;
39233 for (int i = 0; i < 58; i++)
39234 {
39235 if (tileWand == inventory[i].type && inventory[i].stack > 0)
39236 {
39237 canUse = true;
39238 break;
39239 }
39240 }
39241 }
39242 return canUse;
39243 }
39244
39246 {
39247 if (PlayerInput.UsingGamepad && inventory[selectedItem].createTile == 4 && Main.SmartCursorIsUsed && !Main.SmartCursorShowing)
39248 {
39249 canUse = false;
39250 }
39251 return canUse;
39252 }
39253
39255 {
39256 Tile tile = Main.tile[tileTargetX, tileTargetY];
39257 Item item = inventory[selectedItem];
39258 if (!tile.active() || item.type != 5328 || !TileID.Sets.IsAContainer[tile.type] || !(position.X / 16f - (float)tileRangeX - (float)item.tileBoost - (float)blockRange <= (float)tileTargetX) || !((position.X + (float)width) / 16f + (float)tileRangeX + (float)item.tileBoost - 1f + (float)blockRange >= (float)tileTargetX) || !(position.Y / 16f - (float)tileRangeY - (float)item.tileBoost - (float)blockRange <= (float)tileTargetY) || !((position.Y + (float)height) / 16f + (float)tileRangeY + (float)item.tileBoost - 2f + (float)blockRange >= (float)tileTargetY) || !ItemTimeIsZero || itemAnimation <= 0 || !controlUseItem)
39259 {
39260 return;
39261 }
39262 Tile tileSafely = Framing.GetTileSafely(tileTargetX, tileTargetY);
39263 int type = tileSafely.type;
39264 int num = tileSafely.frameX / 36;
39265 switch (type)
39266 {
39267 case 21:
39268 switch (num)
39269 {
39270 default:
39271 return;
39272 case 1:
39273 case 3:
39274 case 18:
39275 case 19:
39276 case 20:
39277 case 21:
39278 case 22:
39279 case 35:
39280 case 37:
39281 case 39:
39282 break;
39283 }
39284 break;
39285 case 467:
39286 if (num != 12)
39287 {
39288 return;
39289 }
39290 break;
39291 }
39292 if (inventory[selectedItem].stack <= 0)
39293 {
39294 return;
39295 }
39296 int num2;
39297 for (num2 = Main.tile[tileTargetX, tileTargetY].frameX / 18; num2 > 1; num2 -= 2)
39298 {
39299 }
39300 num2 = tileTargetX - num2;
39301 int num3 = tileTargetY - Main.tile[tileTargetX, tileTargetY].frameY / 18;
39302 if (Chest.Lock(num2, num3))
39303 {
39304 inventory[selectedItem].stack--;
39305 if (inventory[selectedItem].stack <= 0)
39306 {
39307 inventory[selectedItem] = new Item();
39308 }
39309 if (Main.netMode == 1)
39310 {
39311 NetMessage.SendData(52, -1, -1, null, whoAmI, 3f, num2, num3);
39312 }
39313 }
39314 }
39315
39317 {
39318 Tile tile = Main.tile[tileTargetX, tileTargetY];
39319 Item item = inventory[selectedItem];
39320 if (!tile.active() || !(position.X / 16f - (float)tileRangeX - (float)item.tileBoost - (float)blockRange <= (float)tileTargetX) || !((position.X + (float)width) / 16f + (float)tileRangeX + (float)item.tileBoost - 1f + (float)blockRange >= (float)tileTargetX) || !(position.Y / 16f - (float)tileRangeY - (float)item.tileBoost - (float)blockRange <= (float)tileTargetY) || !((position.Y + (float)height) / 16f + (float)tileRangeY + (float)item.tileBoost - 2f + (float)blockRange >= (float)tileTargetY) || !ItemTimeIsZero || itemAnimation <= 0 || !controlUseItem)
39321 {
39322 return;
39323 }
39324 float num = 1f;
39325 if (tile.type == 642)
39326 {
39327 num *= 0.33f;
39328 }
39329 ItemTrader itemTrader = TryGettingItemTraderFromBlock(tile);
39330 if (itemTrader != null && itemTrader.TryGetTradeOption(item, out var option))
39331 {
39333 ApplyItemTime(item, num);
39334 context.SkipItemConsumption = true;
39335 item.stack -= option.TakingItemStack;
39336 if (item.stack <= 0)
39337 {
39338 item.TurnToAir();
39339 }
39340 DropItemFromExtractinator(option.GivingITemType, option.GivingItemStack);
39341 }
39342 else if (ItemID.Sets.ExtractinatorMode[item.type] >= 0 && (tile.type == 219 || tile.type == 642))
39343 {
39344 ApplyItemTime(item, num);
39347 ExtractinatorUse(extractType, tile.type);
39348 }
39349 }
39350
39352 {
39353 ItemTrader result = null;
39354 if (targetBlock.type == 642)
39355 {
39357 }
39358 return result;
39359 }
39360
39362 {
39363 if (inventory[selectedItem].type < 1874 || inventory[selectedItem].type > 1905 || !Main.tile[tileTargetX, tileTargetY].active() || Main.tile[tileTargetX, tileTargetY].type != 171 || !(position.X / 16f - (float)tileRangeX - (float)inventory[selectedItem].tileBoost - (float)blockRange <= (float)tileTargetX) || !((position.X + (float)width) / 16f + (float)tileRangeX + (float)inventory[selectedItem].tileBoost - 1f + (float)blockRange >= (float)tileTargetX) || !(position.Y / 16f - (float)tileRangeY - (float)inventory[selectedItem].tileBoost - (float)blockRange <= (float)tileTargetY) || !((position.Y + (float)height) / 16f + (float)tileRangeY + (float)inventory[selectedItem].tileBoost - 2f + (float)blockRange >= (float)tileTargetY) || !ItemTimeIsZero || itemAnimation <= 0 || !controlUseItem)
39364 {
39365 return;
39366 }
39367 int type = inventory[selectedItem].type;
39368 if (type >= 1874 && type <= 1877)
39369 {
39370 type -= 1873;
39371 if (WorldGen.checkXmasTreeDrop(tileTargetX, tileTargetY, 0) != type)
39372 {
39373 ApplyItemTime(inventory[selectedItem]);
39374 WorldGen.dropXmasTree(tileTargetX, tileTargetY, 0);
39375 WorldGen.setXmasTree(tileTargetX, tileTargetY, 0, type);
39376 int num = tileTargetX;
39377 int num2 = tileTargetY;
39378 if (Main.tile[tileTargetX, tileTargetY].frameX < 10)
39379 {
39380 num -= Main.tile[tileTargetX, tileTargetY].frameX;
39381 num2 -= Main.tile[tileTargetX, tileTargetY].frameY;
39382 }
39383 NetMessage.SendTileSquare(-1, num, num2);
39384 }
39385 }
39386 else if (type >= 1878 && type <= 1883)
39387 {
39388 type -= 1877;
39389 if (WorldGen.checkXmasTreeDrop(tileTargetX, tileTargetY, 1) != type)
39390 {
39391 ApplyItemTime(inventory[selectedItem]);
39392 WorldGen.dropXmasTree(tileTargetX, tileTargetY, 1);
39393 WorldGen.setXmasTree(tileTargetX, tileTargetY, 1, type);
39394 int num3 = tileTargetX;
39395 int num4 = tileTargetY;
39396 if (Main.tile[tileTargetX, tileTargetY].frameX < 10)
39397 {
39398 num3 -= Main.tile[tileTargetX, tileTargetY].frameX;
39399 num4 -= Main.tile[tileTargetX, tileTargetY].frameY;
39400 }
39402 }
39403 }
39404 else if (type >= 1884 && type <= 1894)
39405 {
39406 type -= 1883;
39407 if (WorldGen.checkXmasTreeDrop(tileTargetX, tileTargetY, 2) != type)
39408 {
39409 ApplyItemTime(inventory[selectedItem]);
39410 WorldGen.dropXmasTree(tileTargetX, tileTargetY, 2);
39411 WorldGen.setXmasTree(tileTargetX, tileTargetY, 2, type);
39412 int num5 = tileTargetX;
39413 int num6 = tileTargetY;
39414 if (Main.tile[tileTargetX, tileTargetY].frameX < 10)
39415 {
39416 num5 -= Main.tile[tileTargetX, tileTargetY].frameX;
39417 num6 -= Main.tile[tileTargetX, tileTargetY].frameY;
39418 }
39420 }
39421 }
39422 else
39423 {
39424 if (type < 1895 || type > 1905)
39425 {
39426 return;
39427 }
39428 type -= 1894;
39429 if (WorldGen.checkXmasTreeDrop(tileTargetX, tileTargetY, 3) != type)
39430 {
39431 ApplyItemTime(inventory[selectedItem]);
39432 WorldGen.dropXmasTree(tileTargetX, tileTargetY, 3);
39433 WorldGen.setXmasTree(tileTargetX, tileTargetY, 3, type);
39434 int num7 = tileTargetX;
39435 int num8 = tileTargetY;
39436 if (Main.tile[tileTargetX, tileTargetY].frameX < 10)
39437 {
39438 num7 -= Main.tile[tileTargetX, tileTargetY].frameX;
39439 num8 -= Main.tile[tileTargetX, tileTargetY].frameY;
39440 }
39442 }
39443 }
39444 }
39445
39447 {
39448 if ((inventory[selectedItem].type == 929 || inventory[selectedItem].type == 1338 || inventory[selectedItem].type == 1345) && position.X / 16f - (float)tileRangeX - (float)inventory[selectedItem].tileBoost - (float)blockRange <= (float)tileTargetX && (position.X + (float)width) / 16f + (float)tileRangeX + (float)inventory[selectedItem].tileBoost - 1f + (float)blockRange >= (float)tileTargetX && position.Y / 16f - (float)tileRangeY - (float)inventory[selectedItem].tileBoost - (float)blockRange <= (float)tileTargetY && (position.Y + (float)height) / 16f + (float)tileRangeY + (float)inventory[selectedItem].tileBoost - 2f + (float)blockRange >= (float)tileTargetY)
39449 {
39450 int num = tileTargetX;
39451 int num2 = tileTargetY;
39452 if (Main.tile[num, num2].active() && Main.tile[num, num2].type == 209)
39453 {
39454 ShootFromCannon(num, num2);
39455 }
39456 }
39457 }
39458
39460 {
39461 if (ItemID.Sets.IsPaintScraper[inventory[selectedItem].type] && position.X / 16f - (float)tileRangeX - (float)inventory[selectedItem].tileBoost - (float)blockRange <= (float)tileTargetX && (position.X + (float)width) / 16f + (float)tileRangeX + (float)inventory[selectedItem].tileBoost - 1f + (float)blockRange >= (float)tileTargetX && position.Y / 16f - (float)tileRangeY - (float)inventory[selectedItem].tileBoost - (float)blockRange <= (float)tileTargetY && (position.Y + (float)height) / 16f + (float)tileRangeY + (float)inventory[selectedItem].tileBoost - 2f + (float)blockRange >= (float)tileTargetY)
39462 {
39463 int num = tileTargetX;
39464 int num2 = tileTargetY;
39465 if (Main.tile[num, num2] != null)
39466 {
39467 PlaceThing_PaintScrapper_TryScrapping(num, num2);
39468 PlaceThing_PaintScrapper_LongMoss(num, num2);
39469 }
39470 }
39471 }
39472
39473 private void PlaceThing_PaintScrapper_LongMoss(int x, int y)
39474 {
39475 if (Main.tile[x, y].type != 184)
39476 {
39477 return;
39478 }
39479 cursorItemIconEnabled = true;
39480 if (!ItemTimeIsZero || itemAnimation <= 0 || !controlUseItem)
39481 {
39482 return;
39483 }
39484 _ = Main.tile[x, y].type;
39485 int frameX = Main.tile[x, y].frameX;
39486 WorldGen.KillTile(x, y);
39487 if (Main.tile[x, y].active())
39488 {
39489 return;
39490 }
39491 ApplyItemTime(inventory[selectedItem]);
39492 if (Main.netMode == 1)
39493 {
39494 NetMessage.SendData(17, -1, -1, null, 0, x, y);
39495 }
39496 if (Main.rand.Next(9) == 0)
39497 {
39498 int type = 4349 + frameX / 22;
39499 switch (frameX / 22)
39500 {
39501 case 6:
39502 type = 4377;
39503 break;
39504 case 7:
39505 type = 4378;
39506 break;
39507 case 8:
39508 type = 4389;
39509 break;
39510 case 9:
39511 type = 5127;
39512 break;
39513 case 10:
39514 type = 5128;
39515 break;
39516 }
39517 int number = Item.NewItem(new EntitySource_ItemUse(this, HeldItem), x * 16, y * 16, 16, 16, type);
39518 NetMessage.SendData(21, -1, -1, null, number, 1f);
39519 }
39520 }
39521
39522 private void PlaceThing_PaintScrapper_TryScrapping(int x, int y)
39523 {
39524 Tile tile = Main.tile[x, y];
39525 if ((0u | ((tile.wall > 0 && (tile.wallColor() > 0 || tile.invisibleWall() || tile.fullbrightWall())) ? 1u : 0u) | ((tile.active() && (tile.color() > 0 || tile.invisibleBlock() || tile.fullbrightBlock())) ? 1u : 0u)) == 0)
39526 {
39527 return;
39528 }
39529 cursorItemIconEnabled = true;
39530 if (ItemTimeIsZero && itemAnimation > 0 && controlUseItem)
39531 {
39532 if (WorldGen.paintTile(x, y, 0, broadCast: true) || WorldGen.paintCoatTile(x, y, 0, broadcast: true))
39533 {
39534 ApplyItemTime(inventory[selectedItem], tileSpeed);
39535 }
39536 else if (WorldGen.paintWall(x, y, 0, broadCast: true) || WorldGen.paintCoatWall(x, y, 0, broadcast: true))
39537 {
39538 ApplyItemTime(inventory[selectedItem], wallSpeed);
39539 }
39540 }
39541 }
39542
39544 {
39545 if ((inventory[selectedItem].type != 1072 && inventory[selectedItem].type != 1544) || !(position.X / 16f - (float)tileRangeX - (float)inventory[selectedItem].tileBoost - (float)blockRange <= (float)tileTargetX) || !((position.X + (float)width) / 16f + (float)tileRangeX + (float)inventory[selectedItem].tileBoost - 1f + (float)blockRange >= (float)tileTargetX) || !(position.Y / 16f - (float)tileRangeY - (float)inventory[selectedItem].tileBoost - (float)blockRange <= (float)tileTargetY) || !((position.Y + (float)height) / 16f + (float)tileRangeY + (float)inventory[selectedItem].tileBoost - 2f + (float)blockRange >= (float)tileTargetY))
39546 {
39547 return;
39548 }
39549 int num = tileTargetX;
39550 int num2 = tileTargetY;
39551 if (Main.tile[num, num2] != null && Main.tile[num, num2].wall > 0)
39552 {
39553 cursorItemIconEnabled = true;
39554 if (ItemTimeIsZero && itemAnimation > 0 && controlUseItem)
39555 {
39556 TryPainting(num, num2, paintingAWall: true);
39557 }
39558 }
39559 }
39560
39562 {
39563 if ((inventory[selectedItem].type != 1071 && inventory[selectedItem].type != 1543) || !(position.X / 16f - (float)tileRangeX - (float)inventory[selectedItem].tileBoost - (float)blockRange <= (float)tileTargetX) || !((position.X + (float)width) / 16f + (float)tileRangeX + (float)inventory[selectedItem].tileBoost - 1f + (float)blockRange >= (float)tileTargetX) || !(position.Y / 16f - (float)tileRangeY - (float)inventory[selectedItem].tileBoost - (float)blockRange <= (float)tileTargetY) || !((position.Y + (float)height) / 16f + (float)tileRangeY + (float)inventory[selectedItem].tileBoost - 2f + (float)blockRange >= (float)tileTargetY))
39564 {
39565 return;
39566 }
39567 int num = tileTargetX;
39568 int num2 = tileTargetY;
39569 if (Main.tile[num, num2] != null && Main.tile[num, num2].active())
39570 {
39571 cursorItemIconEnabled = true;
39572 if (ItemTimeIsZero && itemAnimation > 0 && controlUseItem)
39573 {
39574 TryPainting(num, num2);
39575 }
39576 }
39577 }
39578
39580 {
39581 for (int i = 54; i < 58; i++)
39582 {
39583 if (inventory[i].stack > 0 && inventory[i].PaintOrCoating)
39584 {
39585 return inventory[i];
39586 }
39587 }
39588 for (int j = 0; j < 58; j++)
39589 {
39590 if (inventory[j].stack > 0 && inventory[j].PaintOrCoating)
39591 {
39592 return inventory[j];
39593 }
39594 }
39595 return null;
39596 }
39597
39598 private void TryPainting(int x, int y, bool paintingAWall = false, bool applyItemAnimation = true)
39599 {
39600 Item item = FindPaintOrCoating();
39601 if (item != null)
39602 {
39603 if (item.paintCoating != 0)
39604 {
39605 ApplyCoating(x, y, paintingAWall, applyItemAnimation, item);
39606 }
39607 if (item.paint != 0)
39608 {
39609 ApplyPaint(x, y, paintingAWall, applyItemAnimation, item);
39610 }
39611 }
39612 }
39613
39614 private void ApplyCoating(int x, int y, bool paintingAWall, bool applyItemAnimation, Item targetItem)
39615 {
39616 byte paintCoating = targetItem.paintCoating;
39617 if (paintingAWall)
39618 {
39619 if (WorldGen.paintCoatWall(x, y, paintCoating, broadcast: true))
39620 {
39621 targetItem.stack--;
39622 if (targetItem.stack <= 0)
39623 {
39624 targetItem.SetDefaults();
39625 }
39627 {
39628 ApplyItemTime(inventory[selectedItem], wallSpeed);
39629 }
39630 }
39631 }
39632 else if (WorldGen.paintCoatTile(x, y, paintCoating, broadcast: true))
39633 {
39634 targetItem.stack--;
39635 if (targetItem.stack <= 0)
39636 {
39637 targetItem.SetDefaults();
39638 }
39640 {
39641 ApplyItemTime(inventory[selectedItem], tileSpeed);
39642 }
39643 }
39644 }
39645
39646 private void ApplyPaint(int x, int y, bool paintingAWall, bool applyItemAnimation, Item targetItem)
39647 {
39648 byte paint = targetItem.paint;
39649 if (paintingAWall)
39650 {
39651 if (Main.tile[x, y].wallColor() != paint && WorldGen.paintWall(x, y, paint, broadCast: true))
39652 {
39653 targetItem.stack--;
39654 if (targetItem.stack <= 0)
39655 {
39656 targetItem.SetDefaults();
39657 }
39659 {
39660 ApplyItemTime(inventory[selectedItem], wallSpeed);
39661 }
39662 }
39663 }
39664 else if (Main.tile[x, y].color() != paint && WorldGen.paintTile(x, y, paint, broadCast: true))
39665 {
39666 targetItem.stack--;
39667 if (targetItem.stack <= 0)
39668 {
39669 targetItem.SetDefaults();
39670 }
39672 {
39673 ApplyItemTime(inventory[selectedItem], tileSpeed);
39674 }
39675 }
39676 }
39677
39678 private void ShootFromCannon(int x, int y)
39679 {
39680 int num = 0;
39681 int num2 = Main.tile[x, y].frameX / 72;
39682 int type = inventory[selectedItem].type;
39683 if (num2 == 0 && type == 929)
39684 {
39685 num = 1;
39686 }
39687 else if (num2 == 1 && type == 1338)
39688 {
39689 num = 2;
39690 }
39691 else if (num2 == 2 && type == 1345)
39692 {
39693 num = 3;
39694 }
39695 if (num <= 0 || (num == 2 && !WorldGen.BunnyCannonCanFire()))
39696 {
39697 return;
39698 }
39699 cursorItemIconEnabled = true;
39700 if (ItemTimeIsZero && itemAnimation > 0 && controlUseItem)
39701 {
39702 int num3 = Main.tile[x, y].frameX / 18;
39703 int num4 = 0;
39704 int num5 = 0;
39705 while (num3 >= 4)
39706 {
39707 num4++;
39708 num3 -= 4;
39709 }
39710 num3 = x - num3;
39711 int num6;
39712 for (num6 = Main.tile[x, y].frameY / 18; num6 >= 3; num6 -= 3)
39713 {
39714 num5++;
39715 }
39716 num6 = y - num6;
39717 ApplyItemTime(inventory[selectedItem]);
39718 WorldGen.ShootFromCannon(num3, num6, num5, num, inventory[selectedItem].damage, 8f, Main.myPlayer, fromWire: false);
39719 }
39720 }
39721
39723 {
39724 int num = 5000;
39725 int num2 = 25;
39726 int num3 = 50;
39727 int num4 = -1;
39728 int num5 = -1;
39729 int num6 = -1;
39730 int num7 = 1;
39731 switch (extractType)
39732 {
39733 case 1:
39734 num /= 3;
39735 num2 *= 2;
39736 num3 = 20;
39737 num4 = 10;
39738 break;
39739 case 2:
39740 num = -1;
39741 num2 = -1;
39742 num3 = -1;
39743 num4 = -1;
39744 num5 = 1;
39745 num7 = -1;
39746 break;
39747 case 3:
39748 num = -1;
39749 num2 = -1;
39750 num3 = -1;
39751 num4 = -1;
39752 num5 = -1;
39753 num7 = -1;
39754 num6 = 1;
39755 break;
39756 }
39757 int num8 = -1;
39758 int num9 = 1;
39759 if (num4 != -1 && Main.rand.Next(num4) == 0)
39760 {
39761 num8 = 3380;
39762 if (Main.rand.Next(5) == 0)
39763 {
39764 num9 += Main.rand.Next(2);
39765 }
39766 if (Main.rand.Next(10) == 0)
39767 {
39768 num9 += Main.rand.Next(3);
39769 }
39770 if (Main.rand.Next(15) == 0)
39771 {
39772 num9 += Main.rand.Next(4);
39773 }
39774 }
39775 else if (num7 != -1 && Main.rand.Next(2) == 0)
39776 {
39777 if (Main.rand.Next(12000) == 0)
39778 {
39779 num8 = 74;
39780 if (Main.rand.Next(14) == 0)
39781 {
39782 num9 += Main.rand.Next(0, 2);
39783 }
39784 if (Main.rand.Next(14) == 0)
39785 {
39786 num9 += Main.rand.Next(0, 2);
39787 }
39788 if (Main.rand.Next(14) == 0)
39789 {
39790 num9 += Main.rand.Next(0, 2);
39791 }
39792 }
39793 else if (Main.rand.Next(800) == 0)
39794 {
39795 num8 = 73;
39796 if (Main.rand.Next(6) == 0)
39797 {
39798 num9 += Main.rand.Next(1, 21);
39799 }
39800 if (Main.rand.Next(6) == 0)
39801 {
39802 num9 += Main.rand.Next(1, 21);
39803 }
39804 if (Main.rand.Next(6) == 0)
39805 {
39806 num9 += Main.rand.Next(1, 21);
39807 }
39808 if (Main.rand.Next(6) == 0)
39809 {
39810 num9 += Main.rand.Next(1, 21);
39811 }
39812 if (Main.rand.Next(6) == 0)
39813 {
39814 num9 += Main.rand.Next(1, 20);
39815 }
39816 }
39817 else if (Main.rand.Next(60) == 0)
39818 {
39819 num8 = 72;
39820 if (Main.rand.Next(4) == 0)
39821 {
39822 num9 += Main.rand.Next(5, 26);
39823 }
39824 if (Main.rand.Next(4) == 0)
39825 {
39826 num9 += Main.rand.Next(5, 26);
39827 }
39828 if (Main.rand.Next(4) == 0)
39829 {
39830 num9 += Main.rand.Next(5, 26);
39831 }
39832 if (Main.rand.Next(4) == 0)
39833 {
39834 num9 += Main.rand.Next(5, 25);
39835 }
39836 }
39837 else
39838 {
39839 num8 = 71;
39840 if (Main.rand.Next(3) == 0)
39841 {
39842 num9 += Main.rand.Next(10, 26);
39843 }
39844 if (Main.rand.Next(3) == 0)
39845 {
39846 num9 += Main.rand.Next(10, 26);
39847 }
39848 if (Main.rand.Next(3) == 0)
39849 {
39850 num9 += Main.rand.Next(10, 26);
39851 }
39852 if (Main.rand.Next(3) == 0)
39853 {
39854 num9 += Main.rand.Next(10, 25);
39855 }
39856 }
39857 }
39858 else if (num != -1 && Main.rand.Next(num) == 0)
39859 {
39860 num8 = 1242;
39861 }
39862 else if (num5 != -1)
39863 {
39864 num8 = ((Main.rand.Next(4) != 1) ? 2674 : ((Main.rand.Next(3) != 1) ? 2006 : ((Main.rand.Next(3) == 1) ? 2675 : 2002)));
39865 }
39866 else if (num6 != -1 && extractinatorBlockType == 642)
39867 {
39868 num8 = ((Main.rand.Next(10) == 1) ? (Main.rand.Next(5) switch
39869 {
39870 0 => 4354,
39871 1 => 4389,
39872 2 => 4377,
39873 3 => 5127,
39874 _ => 4378,
39875 }) : (Main.rand.Next(5) switch
39876 {
39877 0 => 4349,
39878 1 => 4350,
39879 2 => 4351,
39880 3 => 4352,
39881 _ => 4353,
39882 }));
39883 }
39884 else if (num6 != -1)
39885 {
39886 num8 = Main.rand.Next(5) switch
39887 {
39888 0 => 4349,
39889 1 => 4350,
39890 2 => 4351,
39891 3 => 4352,
39892 _ => 4353,
39893 };
39894 }
39895 else if (num2 != -1 && Main.rand.Next(num2) == 0)
39896 {
39897 num8 = Main.rand.Next(6) switch
39898 {
39899 0 => 181,
39900 1 => 180,
39901 2 => 177,
39902 3 => 179,
39903 4 => 178,
39904 _ => 182,
39905 };
39906 if (Main.rand.Next(20) == 0)
39907 {
39908 num9 += Main.rand.Next(0, 2);
39909 }
39910 if (Main.rand.Next(30) == 0)
39911 {
39912 num9 += Main.rand.Next(0, 3);
39913 }
39914 if (Main.rand.Next(40) == 0)
39915 {
39916 num9 += Main.rand.Next(0, 4);
39917 }
39918 if (Main.rand.Next(50) == 0)
39919 {
39920 num9 += Main.rand.Next(0, 5);
39921 }
39922 if (Main.rand.Next(60) == 0)
39923 {
39924 num9 += Main.rand.Next(0, 6);
39925 }
39926 }
39927 else if (num3 != -1 && Main.rand.Next(num3) == 0)
39928 {
39929 num8 = 999;
39930 if (Main.rand.Next(20) == 0)
39931 {
39932 num9 += Main.rand.Next(0, 2);
39933 }
39934 if (Main.rand.Next(30) == 0)
39935 {
39936 num9 += Main.rand.Next(0, 3);
39937 }
39938 if (Main.rand.Next(40) == 0)
39939 {
39940 num9 += Main.rand.Next(0, 4);
39941 }
39942 if (Main.rand.Next(50) == 0)
39943 {
39944 num9 += Main.rand.Next(0, 5);
39945 }
39946 if (Main.rand.Next(60) == 0)
39947 {
39948 num9 += Main.rand.Next(0, 6);
39949 }
39950 }
39951 else if (Main.rand.Next(3) == 0)
39952 {
39953 if (Main.rand.Next(5000) == 0)
39954 {
39955 num8 = 74;
39956 if (Main.rand.Next(10) == 0)
39957 {
39958 num9 += Main.rand.Next(0, 3);
39959 }
39960 if (Main.rand.Next(10) == 0)
39961 {
39962 num9 += Main.rand.Next(0, 3);
39963 }
39964 if (Main.rand.Next(10) == 0)
39965 {
39966 num9 += Main.rand.Next(0, 3);
39967 }
39968 if (Main.rand.Next(10) == 0)
39969 {
39970 num9 += Main.rand.Next(0, 3);
39971 }
39972 if (Main.rand.Next(10) == 0)
39973 {
39974 num9 += Main.rand.Next(0, 3);
39975 }
39976 }
39977 else if (Main.rand.Next(400) == 0)
39978 {
39979 num8 = 73;
39980 if (Main.rand.Next(5) == 0)
39981 {
39982 num9 += Main.rand.Next(1, 21);
39983 }
39984 if (Main.rand.Next(5) == 0)
39985 {
39986 num9 += Main.rand.Next(1, 21);
39987 }
39988 if (Main.rand.Next(5) == 0)
39989 {
39990 num9 += Main.rand.Next(1, 21);
39991 }
39992 if (Main.rand.Next(5) == 0)
39993 {
39994 num9 += Main.rand.Next(1, 21);
39995 }
39996 if (Main.rand.Next(5) == 0)
39997 {
39998 num9 += Main.rand.Next(1, 20);
39999 }
40000 }
40001 else if (Main.rand.Next(30) == 0)
40002 {
40003 num8 = 72;
40004 if (Main.rand.Next(3) == 0)
40005 {
40006 num9 += Main.rand.Next(5, 26);
40007 }
40008 if (Main.rand.Next(3) == 0)
40009 {
40010 num9 += Main.rand.Next(5, 26);
40011 }
40012 if (Main.rand.Next(3) == 0)
40013 {
40014 num9 += Main.rand.Next(5, 26);
40015 }
40016 if (Main.rand.Next(3) == 0)
40017 {
40018 num9 += Main.rand.Next(5, 25);
40019 }
40020 }
40021 else
40022 {
40023 num8 = 71;
40024 if (Main.rand.Next(2) == 0)
40025 {
40026 num9 += Main.rand.Next(10, 26);
40027 }
40028 if (Main.rand.Next(2) == 0)
40029 {
40030 num9 += Main.rand.Next(10, 26);
40031 }
40032 if (Main.rand.Next(2) == 0)
40033 {
40034 num9 += Main.rand.Next(10, 26);
40035 }
40036 if (Main.rand.Next(2) == 0)
40037 {
40038 num9 += Main.rand.Next(10, 25);
40039 }
40040 }
40041 }
40042 else if (extractinatorBlockType == 642)
40043 {
40044 num8 = Main.rand.Next(14) switch
40045 {
40046 0 => 12,
40047 1 => 11,
40048 2 => 14,
40049 3 => 13,
40050 4 => 699,
40051 5 => 700,
40052 6 => 701,
40053 7 => 702,
40054 8 => 364,
40055 9 => 1104,
40056 10 => 365,
40057 11 => 1105,
40058 12 => 366,
40059 _ => 1106,
40060 };
40061 if (Main.rand.Next(20) == 0)
40062 {
40063 num9 += Main.rand.Next(0, 2);
40064 }
40065 if (Main.rand.Next(30) == 0)
40066 {
40067 num9 += Main.rand.Next(0, 3);
40068 }
40069 if (Main.rand.Next(40) == 0)
40070 {
40071 num9 += Main.rand.Next(0, 4);
40072 }
40073 if (Main.rand.Next(50) == 0)
40074 {
40075 num9 += Main.rand.Next(0, 5);
40076 }
40077 if (Main.rand.Next(60) == 0)
40078 {
40079 num9 += Main.rand.Next(0, 6);
40080 }
40081 }
40082 else
40083 {
40084 num8 = Main.rand.Next(8) switch
40085 {
40086 0 => 12,
40087 1 => 11,
40088 2 => 14,
40089 3 => 13,
40090 4 => 699,
40091 5 => 700,
40092 6 => 701,
40093 _ => 702,
40094 };
40095 if (Main.rand.Next(20) == 0)
40096 {
40097 num9 += Main.rand.Next(0, 2);
40098 }
40099 if (Main.rand.Next(30) == 0)
40100 {
40101 num9 += Main.rand.Next(0, 3);
40102 }
40103 if (Main.rand.Next(40) == 0)
40104 {
40105 num9 += Main.rand.Next(0, 4);
40106 }
40107 if (Main.rand.Next(50) == 0)
40108 {
40109 num9 += Main.rand.Next(0, 5);
40110 }
40111 if (Main.rand.Next(60) == 0)
40112 {
40113 num9 += Main.rand.Next(0, 6);
40114 }
40115 }
40116 if (num8 > 0)
40117 {
40118 DropItemFromExtractinator(num8, num9);
40119 }
40120 }
40121
40122 private void DropItemFromExtractinator(int itemType, int stack)
40123 {
40126 {
40127 vector = base.Center;
40128 }
40129 int number = Item.NewItem(GetItemSource_TileInteraction(tileTargetX, tileTargetY), (int)vector.X, (int)vector.Y, 1, 1, itemType, stack, noBroadcast: false, -1);
40130 if (Main.netMode == 1)
40131 {
40132 NetMessage.SendData(21, -1, -1, null, number, 1f);
40133 }
40134 }
40135
40136 public void ChangeDir(int dir)
40137 {
40138 if (!pulley || pulleyDir != 2)
40139 {
40140 direction = dir;
40141 }
40142 else
40143 {
40144 if (pulleyDir == 2 && dir == direction)
40145 {
40146 return;
40147 }
40148 int num = (int)(position.X + (float)(width / 2)) / 16 * 16 + 8 - width / 2;
40149 if (!Collision.SolidCollision(new Vector2(num, position.Y), width, height))
40150 {
40151 if (whoAmI == Main.myPlayer)
40152 {
40153 Main.cameraX = Main.cameraX + position.X - (float)num;
40154 }
40155 pulleyDir = 1;
40156 position.X = num;
40157 direction = dir;
40158 }
40159 }
40160 }
40161
40163 {
40164 return new Rectangle((int)position.X, (int)position.Y, width, height);
40165 }
40166
40167 public void HorsemansBlade_SpawnPumpkin(int npcIndex, int dmg, float kb)
40168 {
40169 Vector2 center = Main.npc[npcIndex].Center;
40172 int num = Main.rand.Next(100, 300);
40173 int num2 = Main.rand.Next(100, 300);
40174 num = ((Main.rand.Next(2) != 0) ? (num + (logicCheckScreenWidth / 2 - num)) : (num - (logicCheckScreenWidth / 2 + num)));
40175 num2 = ((Main.rand.Next(2) != 0) ? (num2 + (logicCheckScreenHeight / 2 - num2)) : (num2 - (logicCheckScreenHeight / 2 + num2)));
40176 num += (int)position.X;
40177 num2 += (int)position.Y;
40178 Vector2 vector = new Vector2(num, num2);
40179 float num3 = center.X - vector.X;
40180 float num4 = center.Y - vector.Y;
40181 float num5 = (float)Math.Sqrt(num3 * num3 + num4 * num4);
40182 num5 = 8f / num5;
40183 num3 *= num5;
40184 num4 *= num5;
40185 Projectile.NewProjectile(GetProjectileSource_Item(HeldItem), num, num2, num3, num4, 321, dmg, kb, whoAmI, npcIndex);
40186 }
40187
40189 {
40190 for (int i = 0; i < 58; i++)
40191 {
40192 Item item = inventory[i];
40193 if (item.stack > 0 && item.type == type && item.stack < item.maxStack)
40194 {
40195 item.stack++;
40196 return;
40197 }
40198 }
40199 if (theSelectedItem >= 0 && (inventory[theSelectedItem].type == 0 || inventory[theSelectedItem].stack <= 0))
40200 {
40201 inventory[theSelectedItem].SetDefaults(type);
40202 return;
40203 }
40204 Item item2 = new Item();
40205 item2.SetDefaults(type);
40206 if (GetItem(whoAmI, item2, GetItemSettings.ItemCreatedFromItemUsage).stack > 0)
40207 {
40208 Item item3 = item2;
40209 if (theSelectedItem != -1)
40210 {
40211 item3 = inventory[theSelectedItem];
40212 }
40213 int number = Item.NewItem(new EntitySource_ItemUse(this, item3), (int)position.X, (int)position.Y, width, height, type, 1, noBroadcast: false, 0, noGrabDelay: true);
40214 if (Main.netMode == 1)
40215 {
40216 NetMessage.SendData(21, -1, -1, null, number, 1f);
40217 }
40218 }
40219 else
40220 {
40221 item2.position.X = base.Center.X - (float)(item2.width / 2);
40222 item2.position.Y = base.Center.Y - (float)(item2.height / 2);
40223 item2.active = true;
40224 PopupText.NewText(PopupTextContext.RegularItemPickup, item2, 0);
40225 }
40226 }
40227
40229 {
40230 int type = item.type;
40231 for (int i = 0; i < 200; i++)
40232 {
40233 NPC nPC = Main.npc[i];
40234 if (nPC.active && ((type == 43 && nPC.type == 4) || (type == 70 && nPC.type == 13) || ((type == 560) & (nPC.type == 50)) || (type == 544 && nPC.type == 125) || (type == 544 && nPC.type == 126) || (type == 556 && nPC.type == 134) || (type == 557 && nPC.type == 127) || (type == 1133 && nPC.type == 222) || (type == 1331 && nPC.type == 266) || (type == 4988 && nPC.type == 657) || (type == 5120 && nPC.type == 668)))
40235 {
40236 return false;
40237 }
40238 }
40239 return true;
40240 }
40241
40243 {
40245 Fishing_GetBestFishingPole(out result.PolePower, out result.PoleItemType);
40246 Fishing_GetBait(out result.BaitPower, out result.BaitItemType);
40247 if (result.BaitItemType == 2673)
40248 {
40249 return result;
40250 }
40251 if (result.BaitPower == 0 || result.PolePower == 0)
40252 {
40253 return result;
40254 }
40255 int num = 0;
40256 if (FindBuffIndex(25) != -1)
40257 {
40258 num += 5;
40259 }
40260 if (canFloatInWater && wet)
40261 {
40262 num += 5;
40263 }
40264 if (sitting.TryGetSittingBlock(this, out var tile) && ((tile.type == 15 && tile.frameY / 40 == 1) || tile.type == 497))
40265 {
40266 num += 5;
40267 }
40268 int num2 = result.BaitPower + result.PolePower + fishingSkill + num;
40269 result.LevelMultipliers = Fishing_GetPowerMultiplier();
40270 result.FinalFishingLevel = (int)((float)num2 * result.LevelMultipliers);
40271 return result;
40272 }
40273
40274 private static float Fishing_GetPowerMultiplier()
40275 {
40276 float num = 1f;
40277 if (Main.raining)
40278 {
40279 num *= 1.2f;
40280 }
40281 if (Main.cloudBGAlpha > 0f)
40282 {
40283 num *= 1.1f;
40284 }
40285 if (Main.dayTime && (Main.time < 5400.0 || Main.time > 48600.0))
40286 {
40287 num *= 1.3f;
40288 }
40289 if (Main.dayTime && Main.time > 16200.0 && Main.time < 37800.0)
40290 {
40291 num *= 0.8f;
40292 }
40293 if (!Main.dayTime && Main.time > 6480.0 && Main.time < 25920.0)
40294 {
40295 num *= 0.8f;
40296 }
40297 if (Main.moonPhase == 0)
40298 {
40299 num *= 1.1f;
40300 }
40301 if (Main.moonPhase == 1 || Main.moonPhase == 7)
40302 {
40303 num *= 1.05f;
40304 }
40305 if (Main.moonPhase == 3 || Main.moonPhase == 5)
40306 {
40307 num *= 0.95f;
40308 }
40309 if (Main.moonPhase == 4)
40310 {
40311 num *= 0.9f;
40312 }
40313 if (Main.bloodMoon)
40314 {
40315 num *= 1.1f;
40316 }
40317 return num;
40318 }
40319
40321 {
40322 baitPower = 0;
40323 baitType = 0;
40324 for (int i = 54; i < 58; i++)
40325 {
40326 if (inventory[i].stack > 0 && inventory[i].bait > 0)
40327 {
40328 baitPower = inventory[i].bait;
40329 baitType = inventory[i].type;
40330 break;
40331 }
40332 }
40333 if (baitPower != 0 || baitType != 0)
40334 {
40335 return;
40336 }
40337 for (int j = 0; j < 50; j++)
40338 {
40339 if (inventory[j].stack > 0 && inventory[j].bait > 0)
40340 {
40341 baitPower = inventory[j].bait;
40342 baitType = inventory[j].type;
40343 break;
40344 }
40345 }
40346 }
40347
40349 {
40350 fishingPolePower = inventory[selectedItem].fishingPole;
40351 fishingPoleType = inventory[selectedItem].type;
40352 if (fishingPolePower != 0)
40353 {
40354 return;
40355 }
40356 for (int i = 0; i < 58; i++)
40357 {
40358 if (inventory[i].fishingPole > fishingPolePower)
40359 {
40360 fishingPolePower = inventory[i].fishingPole;
40361 fishingPoleType = inventory[i].type;
40362 }
40363 }
40364 }
40365
40366 public bool HasUnityPotion()
40367 {
40368 for (int i = 0; i < 58; i++)
40369 {
40370 if (inventory[i].type == 2997 && inventory[i].stack > 0)
40371 {
40372 return true;
40373 }
40374 }
40375 if (useVoidBag())
40376 {
40377 for (int j = 0; j < 40; j++)
40378 {
40379 if (bank4.item[j].type == 2997 && bank4.item[j].stack > 0)
40380 {
40381 return true;
40382 }
40383 }
40384 }
40385 return false;
40386 }
40387
40388 public void TakeUnityPotion()
40389 {
40390 for (int i = 0; i < 58; i++)
40391 {
40392 if (inventory[i].type == 2997 && inventory[i].stack > 0)
40393 {
40394 inventory[i].stack--;
40395 if (inventory[i].stack <= 0)
40396 {
40397 inventory[i].SetDefaults();
40398 }
40399 return;
40400 }
40401 }
40402 if (!useVoidBag())
40403 {
40404 return;
40405 }
40406 for (int j = 0; j < 40; j++)
40407 {
40408 if (bank4.item[j].type == 2997 && bank4.item[j].stack > 0)
40409 {
40410 bank4.item[j].stack--;
40411 if (bank4.item[j].stack <= 0)
40412 {
40413 bank4.item[j].SetDefaults();
40414 }
40415 break;
40416 }
40417 }
40418 }
40419
40421 {
40422 int num = 3;
40423 if (Main.netMode == 0)
40424 {
40425 Teleport(telePos, num);
40426 }
40427 else
40428 {
40429 NetMessage.SendData(65, -1, -1, null, 2, whoAmI, telePos.X, telePos.Y, num);
40430 }
40431 }
40432
40434 {
40435 int requiredDD2CrystalsToUse = GetRequiredDD2CrystalsToUse(item);
40436 for (int i = 0; i < requiredDD2CrystalsToUse; i++)
40437 {
40438 ConsumeItem(3822, reverseOrder: true);
40439 }
40440 }
40441
40443 {
40444 if (!DD2Event.Ongoing)
40445 {
40446 return true;
40447 }
40448 int requiredDD2CrystalsToUse = GetRequiredDD2CrystalsToUse(item);
40449 return CountItem(3822, requiredDD2CrystalsToUse) >= requiredDD2CrystalsToUse;
40450 }
40451
40453 {
40454 switch (item.type)
40455 {
40456 case 3818:
40457 case 3819:
40458 case 3820:
40459 return 10;
40460 case 3824:
40461 case 3825:
40462 case 3826:
40463 return 10;
40464 case 3832:
40465 case 3833:
40466 case 3834:
40467 return 10;
40468 case 3829:
40469 case 3830:
40470 case 3831:
40471 return 10;
40472 default:
40473 return 0;
40474 }
40475 }
40476
40478 {
40479 int damage = 70;
40480 float knockBack = 1.5f;
40481 if (Main.rand.Next(15) != 0)
40482 {
40483 return;
40484 }
40485 int num = 0;
40486 for (int i = 0; i < 1000; i++)
40487 {
40488 if (Main.projectile[i].active && Main.projectile[i].owner == whoAmI && (Main.projectile[i].type == 567 || Main.projectile[i].type == 568))
40489 {
40490 num++;
40491 }
40492 }
40493 if (Main.rand.Next(15) < num || num >= 10)
40494 {
40495 return;
40496 }
40497 int num2 = 50;
40498 int num3 = 24;
40499 int num4 = 90;
40500 for (int j = 0; j < num2; j++)
40501 {
40502 int num5 = Main.rand.Next(200 - j * 2, 400 + j * 2);
40503 Vector2 center = base.Center;
40504 center.X += Main.rand.Next(-num5, num5 + 1);
40505 center.Y += Main.rand.Next(-num5, num5 + 1);
40507 {
40508 continue;
40509 }
40510 center.X += num3 / 2;
40511 center.Y += num3 / 2;
40512 if (!Collision.CanHit(new Vector2(base.Center.X, position.Y), 1, 1, center, 1, 1) && !Collision.CanHit(new Vector2(base.Center.X, position.Y - 50f), 1, 1, center, 1, 1))
40513 {
40514 continue;
40515 }
40516 int num6 = (int)center.X / 16;
40517 int num7 = (int)center.Y / 16;
40518 bool flag = false;
40519 if (Main.rand.Next(3) == 0 && Main.tile[num6, num7] != null && Main.tile[num6, num7].wall > 0)
40520 {
40521 flag = true;
40522 }
40523 else
40524 {
40525 center.X -= num4 / 2;
40526 center.Y -= num4 / 2;
40528 {
40529 center.X += num4 / 2;
40530 center.Y += num4 / 2;
40531 flag = true;
40532 }
40533 else if (Main.tile[num6, num7] != null && Main.tile[num6, num7].active() && Main.tile[num6, num7].type == 19)
40534 {
40535 flag = true;
40536 }
40537 }
40538 if (!flag)
40539 {
40540 continue;
40541 }
40542 for (int k = 0; k < 1000; k++)
40543 {
40544 if (Main.projectile[k].active && Main.projectile[k].owner == whoAmI && Main.projectile[k].aiStyle == 105 && (center - Main.projectile[k].Center).Length() < 48f)
40545 {
40546 flag = false;
40547 break;
40548 }
40549 }
40550 if (flag && Main.myPlayer == whoAmI)
40551 {
40552 Projectile.NewProjectile(GetProjectileSource_Accessory(sourceItem), center.X, center.Y, 0f, 0f, 567 + Main.rand.Next(2), damage, knockBack, whoAmI);
40553 break;
40554 }
40555 }
40556 }
40557
40559 {
40560 if (Main.myPlayer != whoAmI)
40561 {
40562 return;
40563 }
40564 volatileGelatinCounter++;
40565 if (volatileGelatinCounter <= 40)
40566 {
40567 return;
40568 }
40569 volatileGelatinCounter = 0;
40570 int damage = 65;
40571 float knockBack = 7f;
40572 float num = 640f;
40573 NPC nPC = null;
40574 for (int i = 0; i < 200; i++)
40575 {
40576 NPC nPC2 = Main.npc[i];
40577 if (nPC2 != null && nPC2.active && nPC2.CanBeChasedBy(this) && Collision.CanHit(this, nPC2))
40578 {
40579 float num2 = Vector2.Distance(nPC2.Center, base.Center);
40580 if (num2 < num)
40581 {
40582 num = num2;
40583 nPC = nPC2;
40584 }
40585 }
40586 }
40587 if (nPC != null)
40588 {
40589 Vector2 v = nPC.Center - base.Center;
40590 v = v.SafeNormalize(Vector2.Zero) * 12f;
40591 v.Y -= 1.3f;
40592 Projectile.NewProjectile(GetProjectileSource_Accessory(sourceItem), base.Center.X, base.Center.Y, v.X, v.Y, 937, damage, knockBack, whoAmI);
40593 }
40594 }
40595
40596 public bool CanHit(Entity ent)
40597 {
40598 if (!Collision.CanHit(position, width, height, ent.position, ent.width, ent.height) && !Collision.CanHitLine(base.Center + new Vector2(direction * width / 2, gravDir * (float)(-height) / 3f), 0, 0, ent.Center + new Vector2(0f, -ent.height / 3), 0, 0) && !Collision.CanHitLine(base.Center + new Vector2(direction * width / 2, gravDir * (float)(-height) / 3f), 0, 0, ent.Center, 0, 0))
40599 {
40600 return Collision.CanHitLine(base.Center + new Vector2(direction * width / 2, 0f), 0, 0, ent.Center + new Vector2(0f, ent.height / 3), 0, 0);
40601 }
40602 return true;
40603 }
40604
40606 {
40607 if (Main.dedServ)
40608 {
40609 return Rectangle.Empty;
40610 }
40611 Main.instance.LoadItem(type);
40612 if (ItemID.Sets.IsFood[type])
40613 {
40614 return TextureAssets.Item[type].Frame(1, 3, 0, 1);
40615 }
40616 if (Main.itemAnimations[type] != null)
40617 {
40618 return Main.itemAnimations[type].GetFrame(TextureAssets.Item[type].Value);
40619 }
40620 return TextureAssets.Item[type].Frame();
40621 }
40622
40624 {
40625 float scale = item.scale;
40626 if (item.melee)
40627 {
40628 ApplyMeleeScale(ref scale);
40629 }
40630 return scale;
40631 }
40632
40633 public void ApplyMeleeScale(ref float scale)
40634 {
40635 if (meleeScaleGlove)
40636 {
40637 scale *= 1.1f;
40638 }
40639 }
40640
40642 {
40644 Vector2 vector = v.SafeNormalize(Vector2.Zero);
40645 vector.Y -= 1f;
40646 float num = v.Length();
40647 num = (float)Math.Pow(num / 700f, 2.0) * 700f;
40648 targetPos.Y += vector.Y * num * rangeCompensation * 1f;
40649 targetPos.X += (0f - vector.X) * num * rangeCompensation * 1f;
40650 return targetPos;
40651 }
40652
40653 public void ItemCheck()
40654 {
40655 if (CCed)
40656 {
40657 channel = false;
40658 itemAnimation = (itemAnimationMax = 0);
40659 return;
40660 }
40661 float heightOffsetHitboxCenter = HeightOffsetHitboxCenter;
40662 Item item = inventory[selectedItem];
40663 ItemCheckContext context = default(ItemCheckContext);
40664 bool flag = false;
40665 if (Main.myPlayer == whoAmI)
40666 {
40668 {
40669 controlUseItem = true;
40670 flag = true;
40671 }
40672 if (!cursorItemIconEnabled && item.stack > 0 && item.fishingPole > 0)
40673 {
40674 Fishing_GetBait(out var _, out var baitType);
40675 if (baitType > 0)
40676 {
40677 cursorItemIconEnabled = true;
40678 cursorItemIconID = baitType;
40679 cursorItemIconPush = 6;
40680 }
40681 }
40682 if (!cursorItemIconEnabled && item.stack > 0 && (item.type == 779 || item.type == 5134))
40683 {
40684 for (int i = 54; i < 58; i++)
40685 {
40686 if (inventory[i].ammo == item.useAmmo && inventory[i].stack > 0)
40687 {
40688 cursorItemIconEnabled = true;
40689 cursorItemIconID = inventory[i].type;
40690 cursorItemIconPush = 10;
40691 break;
40692 }
40693 }
40694 if (!cursorItemIconEnabled)
40695 {
40696 for (int j = 0; j < 54; j++)
40697 {
40698 if (inventory[j].ammo == item.useAmmo && inventory[j].stack > 0)
40699 {
40700 cursorItemIconEnabled = true;
40701 cursorItemIconID = inventory[j].type;
40702 cursorItemIconPush = 10;
40703 break;
40704 }
40705 }
40706 }
40707 }
40708 }
40709 ItemCheck_HandleMount();
40710 int weaponDamage = GetWeaponDamage(item);
40711 ItemCheck_HandleMPItemAnimation(item);
40712 ItemCheck_HackHoldStyles(item);
40713 if (itemAnimation < 0)
40714 {
40715 itemAnimation = 0;
40716 }
40717 if (itemTime < 0)
40718 {
40719 itemTime = 0;
40720 }
40721 if (itemAnimation == 0 && reuseDelay > 0)
40722 {
40723 ApplyReuseDelay();
40724 }
40725 UpdatePlacementPreview(item);
40726 if (itemAnimation == 0 && altFunctionUse == 2)
40727 {
40728 altFunctionUse = 0;
40729 }
40730 bool flag2 = true;
40731 if (gravDir == -1f && GolfHelper.IsPlayerHoldingClub(this))
40732 {
40733 flag2 = false;
40734 }
40735 if (flag2 && controlUseItem && releaseUseItem && itemAnimation == 0 && item.useStyle != 0)
40736 {
40737 if (altFunctionUse == 1)
40738 {
40739 altFunctionUse = 2;
40740 }
40741 if (item.shoot == 0)
40742 {
40743 itemRotation = 0f;
40744 }
40745 bool flag3 = ItemCheck_CheckCanUse(item);
40746 if (item.potion && flag3)
40747 {
40748 ApplyPotionDelay(item);
40749 }
40750 if (item.mana > 0 && flag3 && whoAmI == Main.myPlayer && item.buffType != 0 && item.buffTime != 0)
40751 {
40752 AddBuff(item.buffType, item.buffTime);
40753 }
40754 if (item.shoot <= 0 || !ProjectileID.Sets.MinionTargettingFeature[item.shoot] || altFunctionUse != 2)
40755 {
40756 ItemCheck_ApplyPetBuffs(item);
40757 }
40758 if (whoAmI == Main.myPlayer && gravDir == 1f && item.mountType != -1 && mount.CanMount(item.mountType, this))
40759 {
40760 mount.SetMount(item.mountType, this);
40761 }
40762 if ((item.shoot <= 0 || !ProjectileID.Sets.MinionTargettingFeature[item.shoot] || altFunctionUse != 2) && flag3 && whoAmI == Main.myPlayer && item.shoot >= 0 && item.shoot < ProjectileID.Count && (ProjectileID.Sets.LightPet[item.shoot] || Main.projPet[item.shoot]))
40763 {
40764 FreeUpPetsAndMinions(item);
40765 }
40766 if (flag3)
40767 {
40768 ItemCheck_StartActualUse(item);
40769 }
40770 }
40771 bool flag4 = controlUseItem;
40772 if (mount.Active && mount.Type == 8)
40773 {
40774 flag4 = controlUseItem || controlUseTile;
40775 }
40776 if (!flag4)
40777 {
40778 channel = false;
40779 }
40780 Item item2 = ((itemAnimation > 0) ? lastVisualizedSelectedItem : item);
40782 compositeFrontArm.enabled = false;
40783 compositeBackArm.enabled = false;
40784 if (itemAnimation > 0)
40785 {
40786 if (item.mana > 0)
40787 {
40788 ItemCheck_ApplyManaRegenDelay(item);
40789 }
40790 if (Main.dedServ)
40791 {
40792 itemHeight = item.height;
40793 itemWidth = item.width;
40794 }
40795 else
40796 {
40797 itemHeight = drawHitbox.Height;
40798 itemWidth = drawHitbox.Width;
40799 }
40800 itemAnimation--;
40801 if (itemAnimation == 0 && whoAmI == Main.myPlayer)
40802 {
40804 }
40805 }
40806 releaseUseItem = !controlUseItem;
40807 if (itemTime > 0)
40808 {
40809 itemTime--;
40810 if (ItemTimeIsZero && whoAmI == Main.myPlayer && !JustDroppedAnItem)
40811 {
40812 int type = item.type;
40813 if (type == 65 || type == 724 || type == 989 || type == 1226)
40814 {
40815 EmitMaxManaEffect();
40816 }
40817 }
40818 }
40819 if (itemAnimation > 0)
40820 {
40821 ItemCheck_ApplyUseStyle(heightOffsetHitboxCenter, item2, drawHitbox);
40822 }
40823 else
40824 {
40825 ItemCheck_ApplyHoldStyle(heightOffsetHitboxCenter, item2, drawHitbox);
40826 }
40827 if (!JustDroppedAnItem)
40828 {
40829 ItemCheck_EmitHeldItemLight(item);
40830 ItemCheck_EmitFoodParticles(item);
40831 ItemCheck_EmitDrinkParticles(item);
40832 if (whoAmI == Main.myPlayer)
40833 {
40834 ItemCheck_OwnerOnlyCode(ref context, item, weaponDamage, drawHitbox);
40835 }
40836 if (ItemTimeIsZero && itemAnimation > 0)
40837 {
40838 if (item.hairDye >= 0)
40839 {
40840 ApplyItemTime(item);
40841 if (whoAmI == Main.myPlayer)
40842 {
40843 hairDye = (byte)item.hairDye;
40844 NetMessage.SendData(4, -1, -1, null, whoAmI);
40845 }
40846 }
40847 if (item.healLife > 0 || item.healMana > 0)
40848 {
40849 ApplyLifeAndOrMana(item);
40850 ApplyItemTime(item);
40851 if (Main.myPlayer == whoAmI && item.type == 126 && breath == 0)
40852 {
40854 }
40855 }
40856 if (item.buffType > 0)
40857 {
40858 if (whoAmI == Main.myPlayer && item.buffType != 90 && item.buffType != 27)
40859 {
40860 AddBuff(item.buffType, item.buffTime);
40861 }
40862 ApplyItemTime(item);
40863 }
40864 if (item.type == 678)
40865 {
40866 if (Main.getGoodWorld)
40867 {
40868 ApplyItemTime(item);
40869 if (whoAmI == Main.myPlayer)
40870 {
40871 for (int k = 0; k < 3; k++)
40872 {
40873 int type2 = 0;
40874 int timeToAdd = 108000;
40875 switch (Main.rand.Next(18))
40876 {
40877 case 0:
40878 type2 = 16;
40879 break;
40880 case 1:
40881 type2 = 111;
40882 break;
40883 case 2:
40884 type2 = 114;
40885 break;
40886 case 3:
40887 type2 = 8;
40888 break;
40889 case 4:
40890 type2 = 105;
40891 break;
40892 case 5:
40893 type2 = 17;
40894 break;
40895 case 6:
40896 type2 = 116;
40897 break;
40898 case 7:
40899 type2 = 5;
40900 break;
40901 case 8:
40902 type2 = 113;
40903 break;
40904 case 9:
40905 type2 = 7;
40906 break;
40907 case 10:
40908 type2 = 6;
40909 break;
40910 case 11:
40911 type2 = 104;
40912 break;
40913 case 12:
40914 type2 = 115;
40915 break;
40916 case 13:
40917 type2 = 2;
40918 break;
40919 case 14:
40920 type2 = 9;
40921 break;
40922 case 15:
40923 type2 = 3;
40924 break;
40925 case 16:
40926 type2 = 117;
40927 break;
40928 case 17:
40929 type2 = 1;
40930 break;
40931 }
40932 AddBuff(type2, timeToAdd);
40933 }
40934 }
40935 }
40936 else
40937 {
40938 ApplyItemTime(item);
40939 if (whoAmI == Main.myPlayer)
40940 {
40941 AddBuff(20, 216000);
40942 AddBuff(22, 216000);
40943 AddBuff(23, 216000);
40944 AddBuff(24, 216000);
40945 AddBuff(30, 216000);
40946 AddBuff(31, 216000);
40947 AddBuff(32, 216000);
40948 AddBuff(33, 216000);
40949 AddBuff(35, 216000);
40950 AddBuff(36, 216000);
40951 AddBuff(68, 216000);
40952 }
40953 }
40954 }
40955 }
40956 if ((item.type == 50 || item.type == 3124 || item.type == 3199 || item.type == 5358) && itemAnimation > 0)
40957 {
40958 if (Main.rand.Next(2) == 0)
40959 {
40960 Dust.NewDust(position, width, height, 15, 0f, 0f, 150, default(Color), 1.1f);
40961 }
40962 if (ItemTimeIsZero)
40963 {
40964 ApplyItemTime(item);
40965 }
40966 else if (itemTime == item.useTime / 2)
40967 {
40968 for (int l = 0; l < 70; l++)
40969 {
40970 Dust.NewDust(position, width, height, 15, velocity.X * 0.5f, velocity.Y * 0.5f, 150, default(Color), 1.5f);
40971 }
40972 RemoveAllGrapplingHooks();
40973 Spawn(PlayerSpawnContext.RecallFromItem);
40974 for (int m = 0; m < 70; m++)
40975 {
40976 Dust.NewDust(position, width, height, 15, 0f, 0f, 150, default(Color), 1.5f);
40977 }
40978 }
40979 }
40980 if ((item.type == 4263 || item.type == 5360) && itemAnimation > 0)
40981 {
40982 Vector2 vector = Vector2.UnitY.RotatedBy((float)itemAnimation * ((float)Math.PI * 2f) / 30f) * new Vector2(15f, 0f);
40983 for (int n = 0; n < 2; n++)
40984 {
40985 if (Main.rand.Next(3) == 0)
40986 {
40987 Dust dust = Dust.NewDustPerfect(base.Bottom + vector, Dust.dustWater());
40988 dust.velocity.Y *= 0f;
40989 dust.velocity.Y -= 4.5f;
40990 dust.velocity.X *= 1.5f;
40991 dust.scale = 0.8f;
40992 dust.alpha = 130;
40993 dust.noGravity = true;
40994 dust.fadeIn = 1.1f;
40995 }
40996 }
40997 if (ItemTimeIsZero)
40998 {
40999 ApplyItemTime(item);
41000 }
41001 else if (itemTime == item.useTime / 2)
41002 {
41003 if (Main.netMode == 0)
41004 {
41005 MagicConch();
41006 }
41007 else if (Main.netMode == 1 && whoAmI == Main.myPlayer)
41008 {
41009 NetMessage.SendData(73, -1, -1, null, 1);
41010 }
41011 }
41012 }
41013 if ((item.type == 4819 || item.type == 5361) && itemAnimation > 0)
41014 {
41015 Vector2 vector2 = Vector2.UnitY.RotatedBy((float)itemAnimation * ((float)Math.PI * 2f) / 30f) * new Vector2(15f, 0f);
41016 for (int num = 0; num < 2; num++)
41017 {
41018 if (Main.rand.Next(3) == 0)
41019 {
41020 Dust dust2 = Dust.NewDustPerfect(base.Bottom + vector2, 35);
41021 dust2.velocity.Y *= 0f;
41022 dust2.velocity.Y -= 4.5f;
41023 dust2.velocity.X *= 1.5f;
41024 dust2.scale = 0.8f;
41025 dust2.alpha = 130;
41026 dust2.noGravity = true;
41027 dust2.fadeIn = 1.1f;
41028 }
41029 }
41030 if (ItemTimeIsZero)
41031 {
41032 ApplyItemTime(item);
41033 }
41034 else if (itemTime == item.useTime / 2)
41035 {
41036 if (Main.netMode == 0)
41037 {
41038 DemonConch();
41039 }
41040 else if (Main.netMode == 1 && whoAmI == Main.myPlayer)
41041 {
41042 NetMessage.SendData(73, -1, -1, null, 2);
41043 }
41044 }
41045 }
41046 if (item.type == 5359 && itemAnimation > 0)
41047 {
41048 if (Main.rand.Next(2) == 0)
41049 {
41050 int num2 = Main.rand.Next(4);
41051 Color color = Color.Green;
41052 switch (num2)
41053 {
41054 case 0:
41055 case 1:
41056 color = new Color(100, 255, 100);
41057 break;
41058 case 2:
41059 color = Color.Yellow;
41060 break;
41061 case 3:
41062 color = Color.White;
41063 break;
41064 }
41065 Dust dust3 = Dust.NewDustPerfect(Main.rand.NextVector2FromRectangle(base.Hitbox), 267);
41066 dust3.noGravity = true;
41067 dust3.color = color;
41068 dust3.velocity *= 2f;
41069 dust3.scale = 0.8f + Main.rand.NextFloat() * 0.6f;
41070 }
41071 if (ItemTimeIsZero)
41072 {
41073 ApplyItemTime(item);
41074 }
41075 else if (itemTime == item.useTime / 2)
41076 {
41077 if (Main.netMode == 0)
41078 {
41079 Shellphone_Spawn();
41080 }
41081 else if (Main.netMode == 1 && whoAmI == Main.myPlayer)
41082 {
41083 NetMessage.SendData(73, -1, -1, null, 3);
41084 }
41085 }
41086 }
41087 if (item.type == 2350 && itemAnimation > 0)
41088 {
41089 if (ItemTimeIsZero)
41090 {
41091 ApplyItemTime(item);
41093 for (int num3 = 0; num3 < 10; num3++)
41094 {
41095 Main.dust[Dust.NewDust(position, width, height, 15, velocity.X * 0.2f, velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f;
41096 }
41097 }
41098 else if (itemTime == 20)
41099 {
41100 SoundEngine.PlaySound(HeldItem.UseSound, position);
41101 for (int num4 = 0; num4 < 70; num4++)
41102 {
41103 Main.dust[Dust.NewDust(position, width, height, 15, velocity.X * 0.2f, velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f;
41104 }
41105 RemoveAllGrapplingHooks();
41106 bool flag5 = immune;
41107 int num5 = immuneTime;
41108 Spawn(PlayerSpawnContext.RecallFromItem);
41109 immune = flag5;
41110 immuneTime = num5;
41111 for (int num6 = 0; num6 < 70; num6++)
41112 {
41113 Main.dust[Dust.NewDust(position, width, height, 15, 0f, 0f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f;
41114 }
41115 if (item.stack > 0)
41116 {
41117 item.stack--;
41118 }
41119 }
41120 }
41121 if (item.type == 4870 && itemAnimation > 0)
41122 {
41123 if (ItemTimeIsZero)
41124 {
41125 ApplyItemTime(item);
41127 for (int num7 = 0; num7 < 10; num7++)
41128 {
41129 Main.dust[Dust.NewDust(position, width, height, 15, velocity.X * 0.2f, velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f;
41130 }
41131 }
41132 else if (itemTime == 20)
41133 {
41134 SoundEngine.PlaySound(HeldItem.UseSound, position);
41135 for (int num8 = 0; num8 < 70; num8++)
41136 {
41137 Main.dust[Dust.NewDust(position, width, height, 15, velocity.X * 0.2f, velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f;
41138 }
41139 if (whoAmI == Main.myPlayer)
41140 {
41141 DoPotionOfReturnTeleportationAndSetTheComebackPoint();
41142 }
41143 for (int num9 = 0; num9 < 70; num9++)
41144 {
41145 Main.dust[Dust.NewDust(position, width, height, 15, 0f, 0f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f;
41146 }
41147 if (item.stack > 0)
41148 {
41149 item.stack--;
41150 }
41151 }
41152 }
41153 if (item.type == 2351 && itemAnimation > 0)
41154 {
41155 if (ItemTimeIsZero)
41156 {
41157 ApplyItemTime(item);
41158 }
41159 else if (itemTime == 2)
41160 {
41161 if (Main.netMode == 0)
41162 {
41163 TeleportationPotion();
41164 }
41165 else if (Main.netMode == 1 && whoAmI == Main.myPlayer)
41166 {
41167 NetMessage.SendData(73);
41168 }
41169 if (item.stack > 0)
41170 {
41171 item.stack--;
41172 }
41173 }
41174 }
41175 if (item.type == 2756 && itemAnimation > 0)
41176 {
41177 if (ItemTimeIsZero)
41178 {
41179 ApplyItemTime(item);
41180 }
41181 else if (itemTime == 2)
41182 {
41183 if (whoAmI == Main.myPlayer)
41184 {
41185 Male = !Male;
41186 if (Main.netMode == 1)
41187 {
41188 NetMessage.SendData(4, -1, -1, null, whoAmI);
41189 }
41190 }
41191 if (item.stack > 0)
41192 {
41193 item.stack--;
41194 }
41195 }
41196 else
41197 {
41198 float num10 = item.useTime;
41199 num10 = (num10 - (float)itemTime) / num10;
41200 float num11 = 44f;
41201 float num12 = (float)Math.PI * 3f;
41202 Vector2 vector3 = new Vector2(15f, 0f).RotatedBy(num12 * num10);
41203 vector3.X *= direction;
41204 for (int num13 = 0; num13 < 2; num13++)
41205 {
41206 int type3 = 221;
41207 if (num13 == 1)
41208 {
41209 vector3.X *= -1f;
41210 type3 = 219;
41211 }
41212 Vector2 vector4 = new Vector2(vector3.X, num11 * (1f - num10) - num11 + (float)(height / 2));
41213 vector4 += base.Center;
41214 int num14 = Dust.NewDust(vector4, 0, 0, type3, 0f, 0f, 100);
41215 Main.dust[num14].position = vector4;
41216 Main.dust[num14].noGravity = true;
41217 Main.dust[num14].velocity = Vector2.Zero;
41218 Main.dust[num14].scale = 1.3f;
41219 Main.dust[num14].customData = this;
41220 }
41221 }
41222 }
41223 if (whoAmI == Main.myPlayer)
41224 {
41225 if ((itemTimeMax != 0 && itemTime == itemTimeMax) | (!item.IsAir && item.IsNotTheSameAs(lastVisualizedSelectedItem)))
41226 {
41227 lastVisualizedSelectedItem = item.Clone();
41228 }
41229 }
41230 else
41231 {
41232 lastVisualizedSelectedItem = item.Clone();
41233 }
41234 if (whoAmI == Main.myPlayer)
41235 {
41236 if (!dontConsumeWand && itemTime == (int)((float)item.useTime * tileSpeed) && item.tileWand > 0)
41237 {
41238 int tileWand = item.tileWand;
41239 for (int num15 = 0; num15 < 58; num15++)
41240 {
41241 if (tileWand == inventory[num15].type && inventory[num15].stack > 0)
41242 {
41243 inventory[num15].stack--;
41244 if (inventory[num15].stack <= 0)
41245 {
41246 inventory[num15] = new Item();
41247 }
41248 break;
41249 }
41250 }
41251 }
41252 if (itemTimeMax != 0 && itemTime == itemTimeMax && item.consumable && !context.SkipItemConsumption)
41253 {
41254 bool flag6 = true;
41255 if (item.ranged)
41256 {
41257 if (huntressAmmoCost90 && Main.rand.Next(10) == 0)
41258 {
41259 flag6 = false;
41260 }
41261 if (chloroAmmoCost80 && Main.rand.Next(5) == 0)
41262 {
41263 flag6 = false;
41264 }
41265 if (ammoCost80 && Main.rand.Next(5) == 0)
41266 {
41267 flag6 = false;
41268 }
41269 if (ammoCost75 && Main.rand.Next(4) == 0)
41270 {
41271 flag6 = false;
41272 }
41273 }
41274 if (item.IsACoin)
41275 {
41276 flag6 = true;
41277 }
41278 bool? flag7 = ItemID.Sets.ForceConsumption[item.type];
41279 if (flag7.HasValue)
41280 {
41281 flag6 = flag7.Value;
41282 }
41283 if (flag6)
41284 {
41285 if (item.stack > 0)
41286 {
41287 item.stack--;
41288 }
41289 if (item.stack <= 0)
41290 {
41291 itemTime = itemAnimation;
41292 Main.blockMouse = true;
41293 }
41294 }
41295 }
41296 if (item.stack <= 0 && itemAnimation == 0)
41297 {
41298 inventory[selectedItem] = new Item();
41299 }
41300 if (selectedItem == 58 && itemAnimation != 0)
41301 {
41302 Main.mouseItem = item.Clone();
41303 }
41304 }
41305 }
41306 if (itemAnimation == 0)
41307 {
41308 JustDroppedAnItem = false;
41309 }
41310 if (whoAmI == Main.myPlayer && flag)
41311 {
41313 }
41314 }
41315
41317 {
41318 if (Main.myPlayer == whoAmI && itemAnimation == 0)
41319 {
41320 Tile targetTile = Main.tile[tileTargetX, tileTargetY];
41323 {
41324 TileObject.CanPlace(tileTargetX, tileTargetY, tileToCreate, previewPlaceStyle, direction, out var _, onlyCheck: true, forcedRandom);
41325 }
41326 }
41327 }
41328
41330 {
41331 tileToCreate = sItem.createTile;
41332 previewPlaceStyle = sItem.placeStyle;
41333 overrideCanPlace = null;
41334 forcedRandom = null;
41335 if (UsingBiomeTorches && tileToCreate == 215 && previewPlaceStyle == 0)
41336 {
41337 previewPlaceStyle = BiomeCampfirePlaceStyle(previewPlaceStyle);
41338 }
41339 if (targetTile != null && targetTile.active())
41340 {
41341 ushort type = targetTile.type;
41342 if (tileToCreate == 23 && type == 59)
41343 {
41344 tileToCreate = 661;
41345 }
41346 if (tileToCreate == 199 && type == 59)
41347 {
41348 tileToCreate = 662;
41349 }
41350 }
41351 if (!ModifyFlexibleWandPlacementInfo(ref tileToCreate, ref previewPlaceStyle, ref forcedRandom))
41352 {
41353 overrideCanPlace = false;
41354 }
41355 }
41356
41358 {
41359 bool flag = true;
41360 int type = sItem.type;
41361 if ((type == 65 || type == 676 || type == 723 || type == 724 || type == 757 || type == 674 || type == 675 || type == 989 || type == 1226 || type == 1227) && !ItemAnimationJustStarted)
41362 {
41363 flag = false;
41364 }
41365 if (type == 5097 && ItemAnimationJustStarted)
41366 {
41367 _batbatCanHeal = true;
41368 }
41369 if (type == 5094 && ItemAnimationJustStarted)
41370 {
41371 _spawnTentacleSpikes = true;
41372 }
41373 if (type == 795 && ItemAnimationJustStarted)
41374 {
41375 _spawnBloodButcherer = true;
41376 }
41377 if (type == 121 && ItemAnimationJustStarted)
41378 {
41379 _spawnVolcanoExplosion = true;
41380 }
41381 if (type == 155 && ItemAnimationJustStarted)
41382 {
41383 _spawnMuramasaCut = true;
41384 }
41385 if (type == 3852)
41386 {
41387 if (itemAnimation < itemAnimationMax - 12)
41388 {
41389 flag = false;
41390 }
41391 if (altFunctionUse == 2 && !ItemAnimationJustStarted)
41392 {
41393 flag = false;
41394 }
41395 }
41396 if (type == 4956 && itemAnimation < itemAnimationMax - 3 * sItem.useTime)
41397 {
41398 flag = false;
41399 }
41400 if (type == 4952 && itemAnimation < itemAnimationMax - 8)
41401 {
41402 flag = false;
41403 }
41404 if (type == 4953 && itemAnimation < itemAnimationMax - 10)
41405 {
41406 flag = false;
41407 }
41408 if (type == 5451 && ownedProjectileCounts[1020] > 0)
41409 {
41410 flag = false;
41411 }
41412 ItemCheck_TurretAltFeatureUse(sItem, flag);
41413 ItemCheck_MinionAltFeatureUse(sItem, flag);
41414 bool flag2 = itemAnimation > 0 && ItemTimeIsZero && flag;
41415 if (sItem.shootsEveryUse)
41416 {
41417 flag2 = ItemAnimationJustStarted;
41418 }
41419 if (sItem.shoot > 0 && flag2)
41420 {
41421 ItemCheck_Shoot(whoAmI, sItem, weaponDamage);
41422 }
41423 ItemCheck_UseWiringTools(sItem);
41424 ItemCheck_UseLawnMower(sItem);
41425 ItemCheck_PlayInstruments(sItem);
41426 ItemCheck_UseBuckets(sItem);
41427 if (!channel)
41428 {
41429 toolTime = itemTime;
41430 }
41431 else
41432 {
41433 toolTime--;
41434 if (toolTime < 0)
41435 {
41436 toolTime = sItem.useTime;
41437 }
41438 }
41439 ItemCheck_TryDestroyingDrones(sItem);
41440 ItemCheck_UseMiningTools(sItem);
41441 ItemCheck_UseTeleportRod(sItem);
41442 ItemCheck_UseLifeCrystal(sItem);
41443 ItemCheck_UseLifeFruit(sItem);
41444 ItemCheck_UseManaCrystal(sItem);
41445 ItemCheck_UseDemonHeart(sItem);
41446 ItemCheck_UseMinecartPowerUp(sItem);
41447 ItemCheck_UseTorchGodsFavor(sItem);
41448 ItemCheck_UseArtisanLoaf(sItem);
41449 ItemCheck_UseEventItems(sItem);
41450 ItemCheck_UseBossSpawners(whoAmI, sItem);
41451 ItemCheck_UseCombatBook(sItem);
41452 ItemCheck_UsePeddlersSatchel(sItem);
41453 ItemCheck_UsePetLicenses(sItem);
41454 ItemCheck_UseShimmerPermanentItems(sItem);
41455 if (sItem.type == 4095 && itemAnimation == 2)
41456 {
41457 Main.LocalGolfState.ResetGolfBall();
41458 }
41459 PlaceThing(ref context);
41460 if (sItem.makeNPC > 0)
41461 {
41462 if (!Main.GamepadDisableCursorItemIcon && position.X / 16f - (float)tileRangeX - (float)sItem.tileBoost <= (float)tileTargetX && (position.X + (float)width) / 16f + (float)tileRangeX + (float)sItem.tileBoost - 1f >= (float)tileTargetX && position.Y / 16f - (float)tileRangeY - (float)sItem.tileBoost <= (float)tileTargetY && (position.Y + (float)height) / 16f + (float)tileRangeY + (float)sItem.tileBoost - 2f >= (float)tileTargetY)
41463 {
41464 cursorItemIconEnabled = true;
41466 }
41467 if (ItemTimeIsZero && itemAnimation > 0 && controlUseItem)
41468 {
41469 ItemCheck_ReleaseCritter(sItem);
41470 }
41471 }
41472 if (boneGloveItem != null && !boneGloveItem.IsAir && boneGloveTimer == 0 && itemAnimation > 0 && sItem.damage > 0)
41473 {
41474 boneGloveTimer = 60;
41475 Vector2 center = base.Center;
41476 Vector2 vector = DirectionTo(ApplyRangeCompensation(0.2f, center, Main.MouseWorld)) * 10f;
41477 Projectile.NewProjectile(GetProjectileSource_Accessory(boneGloveItem), center.X, center.Y, vector.X, vector.Y, 532, 25, 5f, whoAmI);
41478 }
41479 if (((sItem.damage < 0 || sItem.type <= 0 || sItem.noMelee) && sItem.type != 1450 && sItem.type != 1991 && sItem.type != 3183 && sItem.type != 4821 && sItem.type != 3542 && sItem.type != 3779) || itemAnimation <= 0)
41480 {
41481 return;
41482 }
41483 ItemCheck_GetMeleeHitbox(sItem, heldItemFrame, out var dontAttack, out var itemRectangle);
41484 if (dontAttack)
41485 {
41486 return;
41487 }
41488 itemRectangle = ItemCheck_EmitUseVisuals(sItem, itemRectangle);
41489 if (Main.myPlayer == whoAmI && (sItem.type == 1991 || sItem.type == 3183 || sItem.type == 4821))
41490 {
41491 itemRectangle = ItemCheck_CatchCritters(sItem, itemRectangle);
41492 }
41493 if (sItem.type == 3183 || sItem.type == 4821)
41494 {
41495 bool[] shouldIgnore = ItemCheck_GetTileCutIgnoreList(sItem);
41496 ItemCheck_CutTiles(sItem, itemRectangle, shouldIgnore);
41497 }
41498 if (sItem.damage > 0)
41499 {
41500 UpdateMeleeHitCooldowns();
41501 float knockBack = sItem.knockBack;
41502 float num = 1f;
41503 if (kbGlove)
41504 {
41505 num += 1f;
41506 }
41507 if (kbBuff)
41508 {
41509 num += 0.5f;
41510 }
41511 knockBack *= num;
41512 if (inventory[selectedItem].type == 3106)
41513 {
41514 knockBack += knockBack * (1f - stealth);
41515 }
41516 bool[] shouldIgnore2 = ItemCheck_GetTileCutIgnoreList(sItem);
41517 ItemCheck_CutTiles(sItem, itemRectangle, shouldIgnore2);
41518 ItemCheck_MeleeHitNPCs(sItem, itemRectangle, weaponDamage, knockBack);
41519 ItemCheck_MeleeHitPVP(sItem, itemRectangle, weaponDamage, knockBack);
41520 ItemCheck_EmitHammushProjectiles(whoAmI, sItem, itemRectangle, weaponDamage);
41521 }
41522 }
41523
41525 {
41526 if (itemAnimation < 1)
41527 {
41528 return;
41529 }
41531 if (array != null && array.Length != 0 && Main.rand.Next(2) != 0)
41532 {
41533 Vector2? mouthPosition = MouthPosition;
41534 if (mouthPosition.HasValue)
41535 {
41536 Vector2 vector = mouthPosition.Value + Main.rand.NextVector2Square(-4f, 4f);
41537 Vector2 spinningpoint = new Vector2(direction, (0f - gravDir) * 0.8f);
41538 Dust.NewDustPerfect(vector, 284, 1.3f * spinningpoint.RotatedBy((float)Math.PI / 5f * Main.rand.NextFloatDirection()), 0, array[Main.rand.Next(array.Length)], 0.8f + 0.2f * Main.rand.NextFloat()).fadeIn = 0f;
41539 }
41540 }
41541 }
41542
41544 {
41545 if (itemAnimation < 1)
41546 {
41547 return;
41548 }
41550 if (array != null && array.Length != 0)
41551 {
41552 Vector2? mouthPosition = MouthPosition;
41553 if (mouthPosition.HasValue)
41554 {
41555 Vector2 vector = mouthPosition.Value + Main.rand.NextVector2Square(-4f, 4f);
41556 Vector2 spinningpoint = new Vector2((float)direction * 0.1f, (0f - gravDir) * 0.1f);
41557 Dust.NewDustPerfect(vector, 284, 1.3f * spinningpoint.RotatedBy(-(float)Math.PI / 5f * Main.rand.NextFloatDirection()), 0, array[Main.rand.Next(array.Length)] * 0.7f, 0.8f + 0.2f * Main.rand.NextFloat()).fadeIn = 0f;
41558 }
41559 }
41560 }
41561
41563 {
41564 if (!ItemTimeIsZero || itemAnimation <= 0 || (sItem.type != 43 && sItem.type != 70 && sItem.type != 544 && sItem.type != 556 && sItem.type != 557 && sItem.type != 560 && sItem.type != 1133 && sItem.type != 1331 && sItem.type != 4988 && sItem.type != 5120 && sItem.type != 5334) || !SummonItemCheck(sItem))
41565 {
41566 return;
41567 }
41568 if (sItem.type == 560)
41569 {
41570 ApplyItemTime(sItem);
41571 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41572 if (Main.netMode != 1)
41573 {
41575 }
41576 else
41577 {
41578 NetMessage.SendData(61, -1, -1, null, whoAmI, 50f);
41579 }
41580 }
41581 else if (sItem.type == 43)
41582 {
41583 if (!Main.IsItDay())
41584 {
41585 ApplyItemTime(sItem);
41586 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41587 if (Main.netMode != 1)
41588 {
41590 }
41591 else
41592 {
41593 NetMessage.SendData(61, -1, -1, null, whoAmI, 4f);
41594 }
41595 }
41596 }
41597 else if (sItem.type == 70)
41598 {
41599 if (ZoneCorrupt)
41600 {
41601 ApplyItemTime(sItem);
41602 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41603 if (Main.netMode != 1)
41604 {
41606 }
41607 else
41608 {
41609 NetMessage.SendData(61, -1, -1, null, whoAmI, 13f);
41610 }
41611 }
41612 }
41613 else if (sItem.type == 544)
41614 {
41616 {
41617 ApplyItemTime(sItem);
41618 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41619 if (Main.netMode != 1)
41620 {
41623 }
41624 else
41625 {
41626 NetMessage.SendData(61, -1, -1, null, whoAmI, 125f);
41627 NetMessage.SendData(61, -1, -1, null, whoAmI, 126f);
41628 }
41629 }
41630 }
41631 else if (sItem.type == 556)
41632 {
41634 {
41635 ApplyItemTime(sItem);
41636 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41637 if (Main.netMode != 1)
41638 {
41640 }
41641 else
41642 {
41643 NetMessage.SendData(61, -1, -1, null, whoAmI, 134f);
41644 }
41645 }
41646 }
41647 else if (sItem.type == 557)
41648 {
41650 {
41651 ApplyItemTime(sItem);
41652 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41653 if (Main.netMode != 1)
41654 {
41656 }
41657 else
41658 {
41659 NetMessage.SendData(61, -1, -1, null, whoAmI, 127f);
41660 }
41661 }
41662 }
41663 else if (sItem.type == 5334)
41664 {
41665 if (NPC.SpawnMechQueen(whoAmI))
41666 {
41667 ApplyItemTime(sItem);
41668 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41669 }
41670 }
41671 else if (sItem.type == 1133)
41672 {
41673 ApplyItemTime(sItem);
41674 SoundEngine.PlaySound(SoundID.Item173, (int)position.X, (int)position.Y);
41675 if (Main.netMode != 1)
41676 {
41678 }
41679 else
41680 {
41681 NetMessage.SendData(61, -1, -1, null, whoAmI, 222f);
41682 }
41683 }
41684 else if (sItem.type == 1331)
41685 {
41686 if (ZoneCrimson)
41687 {
41688 ApplyItemTime(sItem);
41689 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41690 if (Main.netMode != 1)
41691 {
41693 }
41694 else
41695 {
41696 NetMessage.SendData(61, -1, -1, null, whoAmI, 266f);
41697 }
41698 }
41699 }
41700 else if (sItem.type == 4988)
41701 {
41702 if (ZoneHallow)
41703 {
41704 ApplyItemTime(sItem);
41705 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41706 if (Main.netMode != 1)
41707 {
41709 }
41710 else
41711 {
41712 NetMessage.SendData(61, -1, -1, null, whoAmI, 657f);
41713 }
41714 }
41715 }
41716 else if (sItem.type == 5120 && ZoneSnow)
41717 {
41718 ApplyItemTime(sItem);
41719 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41720 if (Main.netMode != 1)
41721 {
41723 }
41724 else
41725 {
41726 NetMessage.SendData(61, -1, -1, null, whoAmI, 668f);
41727 }
41728 }
41729 }
41730
41732 {
41733 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 361 && Main.CanStartInvasion(1, ignoreDelay: true))
41734 {
41735 ApplyItemTime(sItem);
41736 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41737 if (Main.netMode != 1)
41738 {
41739 if (Main.invasionType == 0)
41740 {
41741 Main.invasionDelay = 0;
41743 }
41744 }
41745 else
41746 {
41747 NetMessage.SendData(61, -1, -1, null, whoAmI, -1f);
41748 }
41749 }
41750 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 602 && Main.CanStartInvasion(2, ignoreDelay: true))
41751 {
41752 ApplyItemTime(sItem);
41753 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41754 if (Main.netMode != 1)
41755 {
41756 if (Main.invasionType == 0)
41757 {
41758 Main.invasionDelay = 0;
41760 }
41761 }
41762 else
41763 {
41764 NetMessage.SendData(61, -1, -1, null, whoAmI, -2f);
41765 }
41766 }
41767 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 1315 && Main.CanStartInvasion(3, ignoreDelay: true))
41768 {
41769 ApplyItemTime(sItem);
41770 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41771 if (Main.netMode != 1)
41772 {
41773 if (Main.invasionType == 0)
41774 {
41775 Main.invasionDelay = 0;
41777 }
41778 }
41779 else
41780 {
41781 NetMessage.SendData(61, -1, -1, null, whoAmI, -3f);
41782 }
41783 }
41784 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 1844 && !Main.dayTime && !Main.pumpkinMoon && !Main.snowMoon && !DD2Event.Ongoing)
41785 {
41786 ApplyItemTime(sItem);
41787 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41788 if (Main.netMode != 1)
41789 {
41790 Main.NewText(Lang.misc[31].Value, 50, byte.MaxValue, 130);
41792 }
41793 else
41794 {
41795 NetMessage.SendData(61, -1, -1, null, whoAmI, -4f);
41796 }
41797 }
41798 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 2767 && Main.dayTime && !Main.eclipse)
41799 {
41800 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41801 ApplyItemTime(sItem);
41802 if (Main.netMode == 0)
41803 {
41804 Main.eclipse = true;
41805 if (Main.remixWorld)
41806 {
41807 Main.NewText(Lang.misc[106].Value, 50, byte.MaxValue, 130);
41808 }
41809 else
41810 {
41811 Main.NewText(Lang.misc[20].Value, 50, byte.MaxValue, 130);
41812 }
41813 }
41814 else
41815 {
41816 NetMessage.SendData(61, -1, -1, null, whoAmI, -6f);
41817 }
41818 }
41819 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 4271 && !Main.dayTime && !Main.bloodMoon)
41820 {
41821 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41822 ApplyItemTime(sItem);
41823 if (Main.netMode == 0)
41824 {
41826 Main.bloodMoon = true;
41827 if (Main.GetMoonPhase() == MoonPhase.Empty)
41828 {
41829 Main.moonPhase = 5;
41830 }
41831 Main.NewText(Lang.misc[8].Value, 50, byte.MaxValue, 130);
41832 }
41833 else
41834 {
41835 NetMessage.SendData(61, -1, -1, null, whoAmI, -10f);
41836 }
41837 }
41838 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 3601 && NPC.downedGolemBoss && Main.hardMode && !NPC.AnyDanger() && !NPC.AnyoneNearCultists())
41839 {
41840 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41841 ApplyItemTime(sItem);
41842 if (Main.netMode == 0)
41843 {
41845 }
41846 else
41847 {
41848 NetMessage.SendData(61, -1, -1, null, whoAmI, -8f);
41849 }
41850 }
41851 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 1958 && !Main.dayTime && !Main.pumpkinMoon && !Main.snowMoon && !DD2Event.Ongoing)
41852 {
41853 ApplyItemTime(sItem);
41854 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
41855 if (Main.netMode != 1)
41856 {
41857 Main.NewText(Lang.misc[34].Value, 50, byte.MaxValue, 130);
41859 }
41860 else
41861 {
41862 NetMessage.SendData(61, -1, -1, null, whoAmI, -5f);
41863 }
41864 }
41865 }
41866
41868 {
41869 if (sItem.makeNPC == 614)
41870 {
41871 ApplyItemTime(sItem);
41872 NPC.ReleaseNPC((int)base.Center.X, (int)base.Bottom.Y, sItem.makeNPC, sItem.placeStyle, whoAmI);
41873 }
41874 else if (position.X / 16f - (float)tileRangeX - (float)sItem.tileBoost <= (float)tileTargetX && (position.X + (float)width) / 16f + (float)tileRangeX + (float)sItem.tileBoost - 1f >= (float)tileTargetX && position.Y / 16f - (float)tileRangeY - (float)sItem.tileBoost <= (float)tileTargetY && (position.Y + (float)height) / 16f + (float)tileRangeY + (float)sItem.tileBoost - 2f >= (float)tileTargetY)
41875 {
41876 int num = Main.mouseX + (int)Main.screenPosition.X;
41877 int num2 = Main.mouseY + (int)Main.screenPosition.Y;
41878 int i = num / 16;
41879 int j = num2 / 16;
41880 if (!WorldGen.SolidTile(i, j))
41881 {
41882 ApplyItemTime(sItem);
41883 NPC.ReleaseNPC(num, num2, sItem.makeNPC, sItem.placeStyle, whoAmI);
41884 }
41885 }
41886 }
41887
41888 private void ItemCheck_MeleeHitPVP(Item sItem, Rectangle itemRectangle, int damage, float knockBack)
41889 {
41890 if (!hostile)
41891 {
41892 return;
41893 }
41894 for (int i = 0; i < 255; i++)
41895 {
41896 Player player = Main.player[i];
41897 if (i == whoAmI || !player.active || !player.hostile || player.immune || player.dead || (team != 0 && team == player.team) || !itemRectangle.Intersects(player.Hitbox) || !CanHit(player))
41898 {
41899 continue;
41900 }
41901 bool flag = false;
41902 if (Main.rand.Next(1, 101) <= 10)
41903 {
41904 flag = true;
41905 }
41906 int num = Main.DamageVar(damage, luck);
41907 StatusToPlayerPvP(sItem.type, i);
41908 OnHit(player.Center.X, player.Center.Y, player);
41910 int num2 = (int)player.Hurt(playerDeathReason, num, direction, pvp: true, quiet: false, flag);
41911 if (inventory[selectedItem].type == 3211)
41912 {
41913 Vector2 vector = new Vector2(direction * 100 + Main.rand.Next(-25, 26), Main.rand.Next(-75, 76));
41914 vector.Normalize();
41915 vector *= (float)Main.rand.Next(30, 41) * 0.1f;
41917 vector2 = (vector2 + player.Center * 2f) / 3f;
41918 Projectile.NewProjectile(GetProjectileSource_Item(HeldItem), vector2.X, vector2.Y, vector.X, vector.Y, 524, (int)((double)damage * 0.7), knockBack * 0.7f, whoAmI);
41919 }
41920 if (sItem.type == 5097)
41921 {
41922 BatBat_TryLifeLeeching(player);
41923 }
41924 if (beetleOffense)
41925 {
41926 beetleCounter += num2;
41927 beetleCountdown = 0;
41928 }
41929 if (meleeEnchant == 7)
41930 {
41931 Projectile.NewProjectile(GetProjectileSource_Misc(8), player.Center.X, player.Center.Y, player.velocity.X, player.velocity.Y, 289, 0, 0f, whoAmI);
41932 }
41933 if (sItem.type == 1123)
41934 {
41935 int num3 = Main.rand.Next(1, 4);
41936 if (strongBees && Main.rand.Next(3) == 0)
41937 {
41938 num3++;
41939 }
41940 for (int j = 0; j < num3; j++)
41941 {
41942 float num4 = (float)(direction * 2) + (float)Main.rand.Next(-35, 36) * 0.02f;
41943 float num5 = (float)Main.rand.Next(-35, 36) * 0.02f;
41944 num4 *= 0.2f;
41945 num5 *= 0.2f;
41946 int num6 = Projectile.NewProjectile(GetProjectileSource_Item(sItem), itemRectangle.X + itemRectangle.Width / 2, itemRectangle.Y + itemRectangle.Height / 2, num4, num5, beeType(), beeDamage(num / 3), beeKB(0f), whoAmI);
41947 Main.projectile[num6].melee = true;
41948 }
41949 }
41950 if (inventory[selectedItem].type == 3106)
41951 {
41952 stealth = 1f;
41953 if (Main.netMode == 1)
41954 {
41955 NetMessage.SendData(84, -1, -1, null, whoAmI);
41956 }
41957 }
41958 if (Main.netMode != 0)
41959 {
41960 NetMessage.SendPlayerHurt(i, playerDeathReason, num, direction, flag, pvp: true, -1);
41961 }
41962 ApplyAttackCooldown();
41963 }
41964 }
41965
41966 private void Volcano_TrySpawningVolcano(NPC npc, Item sItem, float damage, float knockBack, Rectangle itemRectangle)
41967 {
41968 if (_spawnVolcanoExplosion && Main.myPlayer == whoAmI && (npc == null || npc.HittableForOnHitRewards()))
41969 {
41970 Vector2 center = npc.Center;
41971 int num = 2;
41972 Projectile.NewProjectile(GetProjectileSource_Item(sItem), center.X, center.Y, 0f, -1f * gravDir, 978, (int)damage, knockBack, whoAmI, 0f, num);
41973 _spawnVolcanoExplosion = false;
41974 }
41975 }
41976
41977 private void TentacleSpike_TrySpiking(NPC npc, Item sItem, float damage, float knockBack)
41978 {
41979 if (_spawnTentacleSpikes && Main.myPlayer == whoAmI && (npc == null || npc.CanBeChasedBy(this)))
41980 {
41981 Vector2 v = npc.Center - MountedCenter;
41982 v = v.SafeNormalize(Vector2.Zero);
41983 Vector2 vector = npc.Hitbox.ClosestPointInRect(MountedCenter) + v;
41984 Vector2 vector2 = (npc.Center - vector) * 0.8f;
41985 int num = Projectile.NewProjectile(GetProjectileSource_Item(sItem), vector.X, vector.Y, vector2.X, vector2.Y, 971, (int)damage, knockBack, whoAmI, 1f, npc.whoAmI);
41986 Main.projectile[num].StatusNPC(npc.whoAmI);
41987 Projectile.KillOldestJavelin(num, 971, npc.whoAmI, _tentacleSpikesMax5);
41988 _spawnTentacleSpikes = false;
41989 }
41990 }
41991
41992 private void BloodButcherer_TryButchering(NPC npc, Item sItem, float damage, float knockBack)
41993 {
41994 if (_spawnBloodButcherer && Main.myPlayer == whoAmI && (npc == null || npc.CanBeChasedBy(this)))
41995 {
41996 Vector2 v = npc.Center - MountedCenter;
41997 v = v.SafeNormalize(Vector2.Zero);
41998 Vector2 vector = npc.Hitbox.ClosestPointInRect(MountedCenter) + v;
41999 Vector2 spinningpoint = (npc.Center - vector) * 0.8f;
42000 spinningpoint = spinningpoint.RotatedBy(Main.rand.NextFloatDirection() * (float)Math.PI * 0.25f);
42001 int num = Projectile.NewProjectile(GetProjectileSource_Item(sItem), vector.X, vector.Y, spinningpoint.X, spinningpoint.Y, 975, (int)damage, knockBack, whoAmI, 1f, npc.whoAmI);
42002 Main.projectile[num].StatusNPC(npc.whoAmI);
42003 Projectile.KillOldestJavelin(num, 975, npc.whoAmI, _bloodButchererMax5);
42004 _spawnBloodButcherer = false;
42005 }
42006 }
42007
42008 private void BatBat_TryLifeLeeching(Entity entity)
42009 {
42010 if (_batbatCanHeal && statLife < statLifeMax2 && (!(entity is NPC nPC) || nPC.HittableForOnHitRewards()))
42011 {
42012 _batbatCanHeal = false;
42013 Heal(1);
42014 }
42015 }
42016
42018 {
42019 return Main.SceneMetrics.NPCBannerBuff[bannerType];
42020 }
42021
42023 {
42024 if (Main.myPlayer == whoAmI)
42025 {
42026 for (int i = 0; i < 200; i++)
42027 {
42028 meleeNPCHitCooldown[i] = 0;
42029 }
42030 }
42031 }
42032
42034 {
42035 if (Main.myPlayer == whoAmI)
42036 {
42037 for (int i = 0; i < 200; i++)
42038 {
42039 meleeNPCHitCooldown[i]--;
42040 }
42041 }
42042 }
42043
42045 {
42046 return meleeNPCHitCooldown[npcIndex] <= 0;
42047 }
42048
42050 {
42051 meleeNPCHitCooldown[npcIndex] = timeInFrames;
42052 }
42053
42054 private void ItemCheck_MeleeHitNPCs(Item sItem, Rectangle itemRectangle, int originalDamage, float knockBack)
42055 {
42056 for (int i = 0; i < 200; i++)
42057 {
42058 NPC nPC = Main.npc[i];
42059 if (nPC.active && nPC.immune[whoAmI] == 0 && CanHitNPCWithMeleeHit(i) && attackCD <= 0)
42060 {
42061 nPC.position += nPC.netOffset;
42062 ProcessHitAgainstNPC(sItem, itemRectangle, originalDamage, knockBack, i);
42063 nPC.position -= nPC.netOffset;
42064 }
42065 }
42066 }
42067
42069 {
42070 NPC nPC = Main.npc[npcIndex];
42071 Hurt(PlayerDeathReason.ByNPC(npcIndex), (int)((double)nPC.damage * 1.3), -direction);
42072 SetMeleeHitCooldown(npcIndex, itemAnimation);
42073 ApplyAttackCooldown();
42074 }
42075
42076 private void ProcessHitAgainstNPC(Item sItem, Rectangle itemRectangle, int originalDamage, float knockBack, int npcIndex)
42077 {
42078 NPC nPC = Main.npc[npcIndex];
42079 if (nPC.dontTakeDamage || !CanNPCBeHitByPlayerOrPlayerProjectile(nPC))
42080 {
42081 if (NPCID.Sets.ZappingJellyfish[nPC.type] && itemRectangle.Intersects(nPC.Hitbox) && (nPC.noTileCollide || CanHit(nPC)))
42082 {
42083 TakeDamageFromJellyfish(npcIndex);
42084 }
42085 }
42086 else
42087 {
42088 if (nPC.friendly && (nPC.type != 22 || !killGuide) && (nPC.type != 54 || !killClothier) && (!nPC.isLikeATownNPC || sItem.type != 5129))
42089 {
42090 return;
42091 }
42092 Rectangle rectangle = new Rectangle((int)nPC.position.X, (int)nPC.position.Y, nPC.width, nPC.height);
42093 bool flag = itemRectangle.Intersects(rectangle);
42094 int type = sItem.type;
42095 if (type == 121)
42096 {
42097 GetPointOnSwungItemPath(70f, 70f, 0f, GetAdjustedItemScale(sItem), out var location, out var outwardDirection);
42098 GetPointOnSwungItemPath(70f, 70f, 0.9f, GetAdjustedItemScale(sItem), out var location2, out outwardDirection);
42100 flag = ((!_spawnVolcanoExplosion) ? (flag || flag2) : flag2);
42101 }
42102 if (!flag || (!nPC.noTileCollide && !CanHit(nPC)))
42103 {
42104 return;
42105 }
42106 int num = originalDamage;
42107 bool flag3 = false;
42108 int weaponCrit = GetWeaponCrit(sItem);
42109 if (Main.rand.Next(1, 101) <= weaponCrit)
42110 {
42111 flag3 = true;
42112 }
42113 int num2 = Item.NPCtoBanner(nPC.BannerID());
42114 if (num2 > 0 && HasNPCBannerBuff(num2))
42115 {
42116 num = ((!Main.expertMode) ? ((int)((float)num * ItemID.Sets.BannerStrength[Item.BannerToItem(num2)].NormalDamageDealt)) : ((int)((float)num * ItemID.Sets.BannerStrength[Item.BannerToItem(num2)].ExpertDamageDealt)));
42117 }
42118 if (parryDamageBuff && sItem.melee)
42119 {
42120 num *= 5;
42121 parryDamageBuff = false;
42122 ClearBuff(198);
42123 }
42124 if (sItem.type == 426 && (float)nPC.life >= (float)nPC.lifeMax * 0.9f)
42125 {
42126 num = (int)((float)num * 2.5f);
42127 }
42128 if (sItem.type == 5096)
42129 {
42130 int num3 = 0;
42131 if (FindBuffIndex(26) != -1)
42132 {
42133 num3 = 1;
42134 }
42135 if (FindBuffIndex(206) != -1)
42136 {
42137 num3 = 2;
42138 }
42139 if (FindBuffIndex(207) != -1)
42140 {
42141 num3 = 3;
42142 }
42143 float num4 = 1f + 0.05f * (float)num3;
42144 num = (int)((float)num * num4);
42145 }
42146 if (sItem.type == 671)
42147 {
42148 float t = (float)nPC.life / (float)nPC.lifeMax;
42149 float lerpValue = Utils.GetLerpValue(1f, 0.1f, t, clamped: true);
42150 float num5 = 1f * lerpValue;
42151 num = (int)((float)num * (1f + num5));
42152 Vector2 point = itemRectangle.Center.ToVector2();
42153 Vector2 positionInWorld = nPC.Hitbox.ClosestPointInRect(point);
42155 {
42156 PositionInWorld = positionInWorld
42157 }, whoAmI);
42158 }
42159 int num6 = Main.DamageVar(num, luck);
42160 float armorPenetrationPercent = 0f;
42161 if (sItem.type == 5129 && nPC.isLikeATownNPC)
42162 {
42164 if (nPC.type == 18)
42165 {
42166 num6 *= 2;
42167 }
42168 }
42169 if (sItem.type == 3258)
42170 {
42172 particleOrchestraSettings.PositionInWorld = nPC.Center;
42175 }
42176 if (sItem.type == 5382)
42177 {
42179 particleOrchestraSettings.PositionInWorld = nPC.Center;
42182 }
42183 if (sItem.type == 5129)
42184 {
42186 particleOrchestraSettings.PositionInWorld = nPC.Center;
42189 }
42190 StatusToNPC(sItem.type, npcIndex);
42191 if (nPC.life > 5)
42192 {
42193 OnHit(nPC.Center.X, nPC.Center.Y, nPC);
42194 }
42195 num6 += nPC.checkArmorPenetration(armorPenetration, armorPenetrationPercent);
42197 int dmgDone = (int)nPC.StrikeNPC(num6, knockBack, direction, flag3);
42198 ApplyNPCOnHitEffects(sItem, itemRectangle, num, knockBack, npcIndex, num6, dmgDone);
42199 int num7 = Item.NPCtoBanner(nPC.BannerID());
42200 if (num7 >= 0)
42201 {
42202 lastCreatureHit = num7;
42203 }
42204 if (Main.netMode != 0)
42205 {
42206 if (flag3)
42207 {
42208 NetMessage.SendData(28, -1, -1, null, npcIndex, num6, knockBack, direction, 1);
42209 }
42210 else
42211 {
42212 NetMessage.SendData(28, -1, -1, null, npcIndex, num6, knockBack, direction);
42213 }
42214 }
42215 if (accDreamCatcher)
42216 {
42217 addDPS(num6);
42218 }
42219 SetMeleeHitCooldown(npcIndex, itemAnimation);
42220 if (attempt.DidNPCDie())
42221 {
42222 OnKillNPC(ref attempt, sItem);
42223 }
42224 ApplyAttackCooldown();
42225 }
42226 }
42227
42229 {
42230 attackCD = Math.Max(1, (int)((double)itemAnimationMax * 0.33));
42231 }
42232
42234 {
42235 if (attackCD < frames)
42236 {
42237 attackCD = frames;
42238 }
42239 }
42240
42241 private void ApplyNPCOnHitEffects(Item sItem, Rectangle itemRectangle, int damage, float knockBack, int npcIndex, int dmgRandomized, int dmgDone)
42242 {
42243 bool flag = !Main.npc[npcIndex].immortal;
42244 if (sItem.type == 3211)
42245 {
42246 Vector2 vector = new Vector2(direction * 100 + Main.rand.Next(-25, 26), Main.rand.Next(-75, 76));
42247 vector.Normalize();
42248 vector *= (float)Main.rand.Next(30, 41) * 0.1f;
42250 vector2 = (vector2 + Main.npc[npcIndex].Center * 2f) / 3f;
42251 Projectile.NewProjectile(GetProjectileSource_Item(sItem), vector2.X, vector2.Y, vector.X, vector.Y, 524, (int)((double)damage * 0.5), knockBack * 0.7f, whoAmI);
42252 }
42253 if (beetleOffense && flag)
42254 {
42255 beetleCounter += dmgDone;
42256 beetleCountdown = 0;
42257 }
42258 if (meleeEnchant == 7)
42259 {
42260 Projectile.NewProjectile(GetProjectileSource_Misc(8), Main.npc[npcIndex].Center.X, Main.npc[npcIndex].Center.Y, Main.npc[npcIndex].velocity.X, Main.npc[npcIndex].velocity.Y, 289, 0, 0f, whoAmI);
42261 }
42262 if (sItem.type == 3106)
42263 {
42264 stealth = 1f;
42265 if (Main.netMode == 1)
42266 {
42267 NetMessage.SendData(84, -1, -1, null, whoAmI);
42268 }
42269 }
42270 if (sItem.type == 5094)
42271 {
42272 TentacleSpike_TrySpiking(Main.npc[npcIndex], sItem, damage, knockBack);
42273 }
42274 if (sItem.type == 795)
42275 {
42276 BloodButcherer_TryButchering(Main.npc[npcIndex], sItem, damage, knockBack);
42277 }
42278 if (sItem.type == 121)
42279 {
42280 Volcano_TrySpawningVolcano(Main.npc[npcIndex], sItem, (int)((float)damage * 0.75f), knockBack, itemRectangle);
42281 }
42282 if (sItem.type == 5097)
42283 {
42284 BatBat_TryLifeLeeching(Main.npc[npcIndex]);
42285 }
42286 if (sItem.type == 1123 && flag)
42287 {
42288 int num = Main.rand.Next(1, 4);
42289 if (strongBees && Main.rand.Next(3) == 0)
42290 {
42291 num++;
42292 }
42293 for (int i = 0; i < num; i++)
42294 {
42295 float num2 = (float)(direction * 2) + (float)Main.rand.Next(-35, 36) * 0.02f;
42296 float num3 = (float)Main.rand.Next(-35, 36) * 0.02f;
42297 num2 *= 0.2f;
42298 num3 *= 0.2f;
42299 int num4 = Projectile.NewProjectile(GetProjectileSource_Item(sItem), itemRectangle.X + itemRectangle.Width / 2, itemRectangle.Y + itemRectangle.Height / 2, num2, num3, beeType(), beeDamage(dmgRandomized / 3), beeKB(0f), whoAmI);
42300 Main.projectile[num4].melee = true;
42301 }
42302 }
42303 if (sItem.type == 155 && flag && _spawnMuramasaCut)
42304 {
42305 _spawnMuramasaCut = false;
42306 int num5 = Main.rand.Next(1, 4);
42307 num5 = 1;
42308 for (int j = 0; j < num5; j++)
42309 {
42310 NPC nPC = Main.npc[npcIndex];
42311 Rectangle hitbox = nPC.Hitbox;
42312 hitbox.Inflate(30, 16);
42313 hitbox.Y -= 8;
42314 Vector2 vector3 = Main.rand.NextVector2FromRectangle(hitbox);
42315 Vector2 vector4 = hitbox.Center.ToVector2();
42316 Vector2 spinningpoint = (vector4 - vector3).SafeNormalize(new Vector2(direction, gravDir)) * 8f;
42317 Main.rand.NextFloat();
42318 float num6 = (float)(Main.rand.Next(2) * 2 - 1) * ((float)Math.PI / 5f + (float)Math.PI * 4f / 5f * Main.rand.NextFloat());
42319 num6 *= 0.5f;
42320 spinningpoint = spinningpoint.RotatedBy(0.7853981852531433);
42321 int num7 = 3;
42322 int num8 = 10 * num7;
42323 int num9 = 5;
42324 int num10 = num9 * num7;
42325 vector3 = vector4;
42326 for (int k = 0; k < num10; k++)
42327 {
42329 spinningpoint = spinningpoint.RotatedBy((0f - num6) / (float)num8);
42330 }
42331 vector3 += nPC.velocity * num9;
42332 Projectile.NewProjectile(GetProjectileSource_Item(sItem), vector3, spinningpoint, 977, (int)((float)dmgRandomized * 0.5f), 0f, whoAmI, num6);
42333 }
42334 }
42335 if (Main.npc[npcIndex].value > 0f && hasLuckyCoin && Main.rand.Next(5) == 0)
42336 {
42337 int type = 71;
42338 if (Main.rand.Next(10) == 0)
42339 {
42340 type = 72;
42341 }
42342 if (Main.rand.Next(100) == 0)
42343 {
42344 type = 73;
42345 }
42346 int num11 = Item.NewItem(GetItemSource_OnHit(Main.npc[npcIndex], 2), (int)Main.npc[npcIndex].position.X, (int)Main.npc[npcIndex].position.Y, Main.npc[npcIndex].width, Main.npc[npcIndex].height, type);
42347 Main.item[num11].stack = Main.rand.Next(1, 11);
42348 Main.item[num11].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f;
42349 Main.item[num11].velocity.X = (float)Main.rand.Next(10, 31) * 0.2f * (float)direction;
42350 Main.item[num11].timeLeftInWhichTheItemCannotBeTakenByEnemies = 60;
42351 if (Main.netMode == 1)
42352 {
42353 NetMessage.SendData(148, -1, -1, null, num11);
42354 }
42355 }
42356 }
42357
42359 {
42360 if (sItem.type != 787)
42361 {
42362 return;
42363 }
42364 int num = itemAnimationMax;
42365 if (itemAnimation != (int)((double)num * 0.1) && itemAnimation != (int)((double)num * 0.3) && itemAnimation != (int)((double)num * 0.5) && itemAnimation != (int)((double)num * 0.7) && itemAnimation != (int)((double)num * 0.9))
42366 {
42367 return;
42368 }
42369 float num2 = 0f;
42370 float num3 = 0f;
42371 float num4 = 0f;
42372 float num5 = 0f;
42373 if (itemAnimation == (int)((double)num * 0.9))
42374 {
42375 num2 = -7f;
42376 }
42377 if (itemAnimation == (int)((double)num * 0.7))
42378 {
42379 num2 = -6f;
42380 num3 = 2f;
42381 }
42382 if (itemAnimation == (int)((double)num * 0.5))
42383 {
42384 num2 = -4f;
42385 num3 = 4f;
42386 }
42387 if (itemAnimation == (int)((double)num * 0.3))
42388 {
42389 num2 = -2f;
42390 num3 = 6f;
42391 }
42392 if (itemAnimation == (int)((double)num * 0.1))
42393 {
42394 num3 = 7f;
42395 }
42396 if (itemAnimation == (int)((double)num * 0.7))
42397 {
42398 num5 = 26f;
42399 }
42400 if (itemAnimation == (int)((double)num * 0.3))
42401 {
42402 num5 -= 4f;
42403 num4 -= 20f;
42404 }
42405 if (itemAnimation == (int)((double)num * 0.1))
42406 {
42407 num4 += 6f;
42408 }
42409 if (direction == -1)
42410 {
42411 if (itemAnimation == (int)((double)num * 0.9))
42412 {
42413 num5 -= 8f;
42414 }
42415 if (itemAnimation == (int)((double)num * 0.7))
42416 {
42417 num5 -= 6f;
42418 }
42419 }
42420 num2 *= 1.5f;
42421 num3 *= 1.5f;
42422 num5 *= (float)direction;
42423 num4 *= gravDir;
42424 Projectile.NewProjectile(GetProjectileSource_Item(sItem), (float)(itemRectangle.X + itemRectangle.Width / 2) + num5, (float)(itemRectangle.Y + itemRectangle.Height / 2) + num4, (float)direction * num3, num2 * gravDir, 131, damage / 2, 0f, i);
42425 }
42426
42428 {
42429 bool allowRegrowth = false;
42430 int type = sItem.type;
42431 if (type == 213 || type == 5295)
42432 {
42433 allowRegrowth = true;
42434 }
42435 return GetTileCutIgnorance(allowRegrowth, fromTrap: false);
42436 }
42437
42439 {
42440 bool[] result = TileID.Sets.TileCutIgnore.None;
42441 if (allowRegrowth)
42442 {
42444 }
42445 if (!fromTrap && dontHurtNature)
42446 {
42448 }
42449 return result;
42450 }
42451
42453 {
42454 int minX = itemRectangle.X / 16;
42455 int maxX = (itemRectangle.X + itemRectangle.Width) / 16 + 1;
42456 int minY = itemRectangle.Y / 16;
42457 int maxY = (itemRectangle.Y + itemRectangle.Height) / 16 + 1;
42459 for (int i = minX; i < maxX; i++)
42460 {
42461 for (int j = minY; j < maxY; j++)
42462 {
42463 if (Main.tile[i, j] == null || !Main.tileCut[Main.tile[i, j].type] || shouldIgnore[Main.tile[i, j].type] || !WorldGen.CanCutTile(i, j, TileCuttingContext.AttackMelee))
42464 {
42465 continue;
42466 }
42467 if (sItem.type == 1786)
42468 {
42469 ushort type = Main.tile[i, j].type;
42470 WorldGen.KillTile(i, j);
42471 if (!Main.tile[i, j].active())
42472 {
42473 int num = 0;
42474 switch (type)
42475 {
42476 case 3:
42477 case 24:
42478 case 61:
42479 case 110:
42480 case 201:
42481 case 529:
42482 case 637:
42483 num = Main.rand.Next(1, 3);
42484 break;
42485 case 73:
42486 case 74:
42487 case 113:
42488 num = Main.rand.Next(2, 5);
42489 break;
42490 }
42491 if (num > 0)
42492 {
42493 int number = Item.NewItem(new EntitySource_ItemUse(this, sItem), i * 16, j * 16, 16, 16, 1727, num);
42494 if (Main.netMode == 1)
42495 {
42496 NetMessage.SendData(21, -1, -1, null, number, 1f);
42497 }
42498 }
42499 }
42500 if (Main.netMode == 1)
42501 {
42502 NetMessage.SendData(17, -1, -1, null, 0, i, j);
42503 }
42504 }
42505 else
42506 {
42507 WorldGen.KillTile(i, j);
42508 if (Main.netMode == 1)
42509 {
42510 NetMessage.SendData(17, -1, -1, null, 0, i, j);
42511 }
42512 }
42513 }
42514 }
42515 }
42516
42518 {
42519 bool flag = sItem.type == 3183 || sItem.type == 4821;
42520 for (int i = 0; i < 200; i++)
42521 {
42522 if (!Main.npc[i].active || Main.npc[i].catchItem <= 0)
42523 {
42524 continue;
42525 }
42526 Rectangle value = new Rectangle((int)Main.npc[i].position.X, (int)Main.npc[i].position.Y, Main.npc[i].width, Main.npc[i].height);
42527 if (!itemRectangle.Intersects(value))
42528 {
42529 continue;
42530 }
42531 if (!flag && ItemID.Sets.IsLavaBait[Main.npc[i].catchItem])
42532 {
42533 if (Main.myPlayer == whoAmI && Hurt(PlayerDeathReason.ByNPC(i), 1, (Main.npc[i].Center.X < base.Center.X) ? 1 : (-1), pvp: false, quiet: false, Crit: false, 3) > 0.0 && !dead)
42534 {
42535 AddBuff(24, 300, quiet: false);
42536 }
42537 }
42538 else if (Main.npc[i].type == 585 || Main.npc[i].type == 583 || Main.npc[i].type == 584)
42539 {
42540 if (Main.npc[i].ai[2] <= 1f)
42541 {
42542 NPC.CatchNPC(i, whoAmI);
42543 }
42544 }
42545 else
42546 {
42547 NPC.CatchNPC(i, whoAmI);
42548 }
42549 }
42550 return itemRectangle;
42551 }
42552
42554 {
42555 float num = (float)Math.Sqrt(spriteWidth * spriteWidth + spriteHeight * spriteHeight);
42556 float num2 = (float)(direction == 1).ToInt() * ((float)Math.PI / 2f);
42557 if (gravDir == -1f)
42558 {
42559 num2 += (float)Math.PI / 2f * (float)direction;
42560 }
42561 outwardDirection = itemRotation.ToRotationVector2().RotatedBy(3.926991f + num2);
42562 location = RotatedRelativePoint(itemLocation + outwardDirection * num * normalizedPointOnPath * itemScale);
42563 }
42564
42566 {
42567 if (sItem.type == 989 && Main.rand.Next(5) == 0)
42568 {
42569 int num = Main.rand.Next(3);
42570 int num2 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, num switch
42571 {
42572 0 => 15,
42573 1 => 57,
42574 _ => 58,
42575 }, direction * 2, 0f, 150, default(Color), 1.3f);
42576 Main.dust[num2].velocity *= 0.2f;
42577 }
42578 if (sItem.type == 2880 && Main.rand.Next(2) == 0)
42579 {
42580 int type = Utils.SelectRandom<int>(Main.rand, 226, 229);
42581 int num3 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, type, direction * 2, 0f, 150);
42582 Main.dust[num3].velocity *= 0.2f;
42583 Main.dust[num3].noGravity = true;
42584 }
42585 if ((sItem.type == 44 || sItem.type == 45 || sItem.type == 103 || sItem.type == 104) && Main.rand.Next(15) == 0)
42586 {
42587 Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 14, direction * 2, 0f, 150, default(Color), 1.3f);
42588 }
42589 if (sItem.type == 46 && Main.rand.Next(15) == 0)
42590 {
42591 Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 14, direction * 2, 0f, 150, default(Color), 1.3f);
42592 }
42593 if (sItem.type == 273 || sItem.type == 675)
42594 {
42595 if (Main.rand.Next(5) == 0)
42596 {
42597 Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 14, direction * 2, 0f, 150, default(Color), 1.4f);
42598 }
42599 int num4 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 27, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 1.2f);
42600 Main.dust[num4].noGravity = true;
42601 Main.dust[num4].velocity.X /= 2f;
42602 Main.dust[num4].velocity.Y /= 2f;
42603 }
42604 if (sItem.type == 723 && Main.rand.Next(2) == 0)
42605 {
42606 int num5 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 64, 0f, 0f, 150, default(Color), 1.2f);
42607 Main.dust[num5].noGravity = true;
42608 }
42609 if (sItem.type == 65)
42610 {
42611 if (Main.rand.Next(5) == 0)
42612 {
42613 Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 58, 0f, 0f, 150, default(Color), 1.2f);
42614 }
42615 if (Main.rand.Next(10) == 0)
42616 {
42617 Gore.NewGore(new Vector2(itemRectangle.X, itemRectangle.Y), default(Vector2), Main.rand.Next(16, 18));
42618 }
42619 }
42620 if (sItem.type == 3065)
42621 {
42622 int num6 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 58, 0f, 0f, 150, default(Color), 1.2f);
42623 Main.dust[num6].velocity *= 0.5f;
42624 if (Main.rand.Next(8) == 0)
42625 {
42626 int num7 = Gore.NewGore(new Vector2(itemRectangle.Center.X, itemRectangle.Center.Y), default(Vector2), 16);
42627 Main.gore[num7].velocity *= 0.5f;
42628 Main.gore[num7].velocity += new Vector2(direction, 0f);
42629 }
42630 }
42631 if (sItem.type == 190)
42632 {
42633 int num8 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 40, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 0, default(Color), 1.2f);
42634 Main.dust[num8].noGravity = true;
42635 }
42636 else if (sItem.type == 213 || sItem.type == 5295)
42637 {
42638 int num9 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 3, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 0, default(Color), 1.2f);
42639 Main.dust[num9].noGravity = true;
42640 }
42641 if (sItem.type == 121)
42642 {
42643 for (int i = 0; i < 2; i++)
42644 {
42645 GetPointOnSwungItemPath(70f, 70f, 0.2f + 0.8f * Main.rand.NextFloat(), GetAdjustedItemScale(sItem), out var location, out var outwardDirection);
42646 Vector2 vector = outwardDirection.RotatedBy((float)Math.PI / 2f * (float)direction * gravDir);
42647 Dust.NewDustPerfect(location, 6, vector * 4f, 100, default(Color), 2.5f).noGravity = true;
42648 }
42649 }
42650 if (sItem.type == 122 || sItem.type == 217)
42651 {
42652 int num10 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 6, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 1.9f);
42653 Main.dust[num10].noGravity = true;
42654 }
42655 if (sItem.type == 155)
42656 {
42657 int num11 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 172, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 0.9f);
42658 Main.dust[num11].noGravity = true;
42659 Main.dust[num11].velocity *= 0.1f;
42660 }
42661 if (sItem.type == 676 && Main.rand.Next(3) == 0)
42662 {
42663 int num12 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 67, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 90, default(Color), 1.5f);
42664 Main.dust[num12].noGravity = true;
42665 Main.dust[num12].velocity *= 0.2f;
42666 }
42667 if (sItem.type == 3063)
42668 {
42669 int num13 = Dust.NewDust(itemRectangle.TopLeft(), itemRectangle.Width, itemRectangle.Height, 66, 0f, 0f, 150, Color.Transparent, 0.85f);
42670 Main.dust[num13].color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f);
42671 Main.dust[num13].noGravity = true;
42672 Main.dust[num13].velocity /= 2f;
42673 }
42674 if (sItem.type == 3823)
42675 {
42676 Dust dust = Dust.NewDustDirect(itemRectangle.TopLeft(), itemRectangle.Width, itemRectangle.Height, 6, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, Color.Transparent, 0.7f);
42677 dust.noGravity = true;
42678 dust.velocity *= 2f;
42679 dust.fadeIn = 0.9f;
42680 }
42681 if (sItem.type == 724 && Main.rand.Next(5) == 0)
42682 {
42683 int num14 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 67, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 90, default(Color), 1.5f);
42684 Main.dust[num14].noGravity = true;
42685 Main.dust[num14].velocity *= 0.2f;
42686 }
42687 if (sItem.type >= 795 && sItem.type <= 802)
42688 {
42689 for (int j = 0; j < 2; j++)
42690 {
42691 GetPointOnSwungItemPath(60f, 60f, 0.2f + 0.8f * Main.rand.NextFloat(), GetAdjustedItemScale(sItem), out var location2, out var outwardDirection2);
42692 Vector2 vector2 = outwardDirection2.RotatedBy((float)Math.PI / 2f * (float)direction * gravDir);
42693 Dust.NewDustPerfect(location2, 5, vector2 * 2f, 100, default(Color), 0.7f + Main.rand.NextFloat() * 0.6f);
42694 if (Main.rand.Next(20) == 0)
42695 {
42696 int num15 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 115, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 140, default(Color), 0.7f);
42697 Main.dust[num15].position = location2;
42698 Main.dust[num15].fadeIn = 1.2f;
42699 Main.dust[num15].noGravity = true;
42700 Main.dust[num15].velocity *= 0.25f;
42701 Main.dust[num15].velocity += vector2 * 5f;
42702 }
42703 }
42704 }
42705 if (sItem.type == 367)
42706 {
42707 int num16 = 0;
42708 if (Main.rand.Next(3) == 0)
42709 {
42710 num16 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 57, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 1.1f);
42711 Main.dust[num16].noGravity = true;
42712 Main.dust[num16].velocity.X /= 2f;
42713 Main.dust[num16].velocity.Y /= 2f;
42714 Main.dust[num16].velocity.X += direction * 2;
42715 }
42716 if (Main.rand.Next(4) == 0)
42717 {
42718 num16 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 43, 0f, 0f, 254, default(Color), 0.3f);
42719 Main.dust[num16].velocity *= 0f;
42720 }
42721 }
42722 else if (sItem.type != 368)
42723 {
42724 _ = sItem.type;
42725 _ = 674;
42726 }
42727 if (sItem.type == 4258 || sItem.type == 4259 || (sItem.type >= 198 && sItem.type <= 203) || (sItem.type >= 3764 && sItem.type <= 3769))
42728 {
42729 float num17 = 0.5f;
42730 float num18 = 0.5f;
42731 float num19 = 0.5f;
42732 if (sItem.type == 198 || sItem.type == 3764)
42733 {
42734 num17 *= 0.1f;
42735 num18 *= 0.5f;
42736 num19 *= 1.2f;
42737 }
42738 else if (sItem.type == 199 || sItem.type == 3765)
42739 {
42740 num17 *= 1f;
42741 num18 *= 0.2f;
42742 num19 *= 0.1f;
42743 }
42744 else if (sItem.type == 200 || sItem.type == 3766)
42745 {
42746 num17 *= 0.1f;
42747 num18 *= 1f;
42748 num19 *= 0.2f;
42749 }
42750 else if (sItem.type == 201 || sItem.type == 3767)
42751 {
42752 num17 *= 0.8f;
42753 num18 *= 0.1f;
42754 num19 *= 1f;
42755 }
42756 else if (sItem.type == 202 || sItem.type == 3768)
42757 {
42758 num17 *= 0.8f;
42759 num18 *= 0.9f;
42760 num19 *= 1f;
42761 }
42762 else if (sItem.type == 203 || sItem.type == 3769)
42763 {
42764 num17 *= 0.8f;
42765 num18 *= 0.8f;
42766 num19 *= 0f;
42767 }
42768 else if (sItem.type == 4258 || sItem.type == 4259)
42769 {
42770 num17 *= 0.9f;
42771 num18 *= 0.5f;
42772 num19 *= 0f;
42773 }
42774 Lighting.AddLight((int)((itemLocation.X + 6f + velocity.X) / 16f), (int)((itemLocation.Y - 14f) / 16f), num17, num18, num19);
42775 }
42776 if (frostBurn && sItem.melee && !sItem.noMelee && !sItem.noUseGraphic && Main.rand.Next(2) == 0)
42777 {
42778 int num20 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 135, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 2.5f);
42779 Main.dust[num20].noGravity = true;
42780 Main.dust[num20].velocity *= 0.7f;
42781 Main.dust[num20].velocity.Y -= 0.5f;
42782 }
42783 if (sItem.melee && !sItem.noMelee && !sItem.noUseGraphic && meleeEnchant > 0)
42784 {
42785 if (meleeEnchant == 1)
42786 {
42787 if (Main.rand.Next(3) == 0)
42788 {
42789 int num21 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 171, 0f, 0f, 100);
42790 Main.dust[num21].noGravity = true;
42791 Main.dust[num21].fadeIn = 1.5f;
42792 Main.dust[num21].velocity *= 0.25f;
42793 }
42794 }
42795 else if (meleeEnchant == 2)
42796 {
42797 if (Main.rand.Next(2) == 0)
42798 {
42799 int num22 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 75, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 2.5f);
42800 Main.dust[num22].noGravity = true;
42801 Main.dust[num22].velocity *= 0.7f;
42802 Main.dust[num22].velocity.Y -= 0.5f;
42803 }
42804 }
42805 else if (meleeEnchant == 3)
42806 {
42807 if (Main.rand.Next(2) == 0)
42808 {
42809 int num23 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 6, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 2.5f);
42810 Main.dust[num23].noGravity = true;
42811 Main.dust[num23].velocity *= 0.7f;
42812 Main.dust[num23].velocity.Y -= 0.5f;
42813 }
42814 }
42815 else if (meleeEnchant == 4)
42816 {
42817 int num24 = 0;
42818 if (Main.rand.Next(2) == 0)
42819 {
42820 num24 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 57, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 1.1f);
42821 Main.dust[num24].noGravity = true;
42822 Main.dust[num24].velocity.X /= 2f;
42823 Main.dust[num24].velocity.Y /= 2f;
42824 }
42825 }
42826 else if (meleeEnchant == 5)
42827 {
42828 if (Main.rand.Next(2) == 0)
42829 {
42830 int num25 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 169, 0f, 0f, 100);
42831 Main.dust[num25].velocity.X += direction;
42832 Main.dust[num25].velocity.Y += 0.2f;
42833 Main.dust[num25].noGravity = true;
42834 }
42835 }
42836 else if (meleeEnchant == 6)
42837 {
42838 if (Main.rand.Next(2) == 0)
42839 {
42840 int num26 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 135, 0f, 0f, 100);
42841 Main.dust[num26].velocity.X += direction;
42842 Main.dust[num26].velocity.Y += 0.2f;
42843 Main.dust[num26].noGravity = true;
42844 }
42845 }
42846 else if (meleeEnchant == 7)
42847 {
42848 if (Main.rand.Next(20) == 0)
42849 {
42850 int type2 = Main.rand.Next(139, 143);
42851 int num27 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, type2, velocity.X, velocity.Y, 0, default(Color), 1.2f);
42852 Main.dust[num27].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
42853 Main.dust[num27].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
42854 Main.dust[num27].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f;
42855 Main.dust[num27].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f;
42856 Main.dust[num27].scale *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
42857 }
42858 if (Main.rand.Next(40) == 0)
42859 {
42860 int type3 = Main.rand.Next(276, 283);
42861 int num28 = Gore.NewGore(new Vector2(itemRectangle.X, itemRectangle.Y), velocity, type3);
42862 Main.gore[num28].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
42863 Main.gore[num28].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
42864 Main.gore[num28].scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
42865 Main.gore[num28].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f;
42866 Main.gore[num28].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f;
42867 }
42868 }
42869 else if (meleeEnchant == 8 && Main.rand.Next(4) == 0)
42870 {
42871 int num29 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 46, 0f, 0f, 100);
42872 Main.dust[num29].noGravity = true;
42873 Main.dust[num29].fadeIn = 1.5f;
42874 Main.dust[num29].velocity *= 0.25f;
42875 }
42876 }
42877 if (magmaStone && sItem.melee && !sItem.noMelee && !sItem.noUseGraphic && Main.rand.Next(3) != 0)
42878 {
42879 int num30 = Dust.NewDust(new Vector2(itemRectangle.X, itemRectangle.Y), itemRectangle.Width, itemRectangle.Height, 6, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 2.5f);
42880 Main.dust[num30].noGravity = true;
42881 Main.dust[num30].velocity.X *= 2f;
42882 Main.dust[num30].velocity.Y *= 2f;
42883 }
42884 return itemRectangle;
42885 }
42886
42888 {
42889 dontAttack = false;
42890 itemRectangle = new Rectangle((int)itemLocation.X, (int)itemLocation.Y, 32, 32);
42891 if (!Main.dedServ)
42892 {
42893 int num = heldItemFrame.Width;
42894 int num2 = heldItemFrame.Height;
42895 switch (sItem.type)
42896 {
42897 case 5094:
42898 num -= 10;
42899 num2 -= 10;
42900 break;
42901 case 5095:
42902 num -= 10;
42903 num2 -= 10;
42904 break;
42905 case 5096:
42906 num -= 12;
42907 num2 -= 12;
42908 break;
42909 case 5097:
42910 num -= 8;
42911 num2 -= 8;
42912 break;
42913 }
42914 itemRectangle = new Rectangle((int)itemLocation.X, (int)itemLocation.Y, num, num2);
42915 }
42916 float adjustedItemScale = GetAdjustedItemScale(sItem);
42917 itemRectangle.Width = (int)((float)itemRectangle.Width * adjustedItemScale);
42918 itemRectangle.Height = (int)((float)itemRectangle.Height * adjustedItemScale);
42919 if (direction == -1)
42920 {
42921 itemRectangle.X -= itemRectangle.Width;
42922 }
42923 if (gravDir == 1f)
42924 {
42925 itemRectangle.Y -= itemRectangle.Height;
42926 }
42927 if (sItem.useStyle == 1)
42928 {
42929 if ((double)itemAnimation < (double)itemAnimationMax * 0.333)
42930 {
42931 if (direction == -1)
42932 {
42933 itemRectangle.X -= (int)((double)itemRectangle.Width * 1.4 - (double)itemRectangle.Width);
42934 }
42935 itemRectangle.Width = (int)((double)itemRectangle.Width * 1.4);
42936 itemRectangle.Y += (int)((double)itemRectangle.Height * 0.5 * (double)gravDir);
42937 itemRectangle.Height = (int)((double)itemRectangle.Height * 1.1);
42938 }
42939 else if (!((double)itemAnimation < (double)itemAnimationMax * 0.666))
42940 {
42941 if (direction == 1)
42942 {
42943 itemRectangle.X -= (int)((double)itemRectangle.Width * 1.2);
42944 }
42945 itemRectangle.Width *= 2;
42946 itemRectangle.Y -= (int)(((double)itemRectangle.Height * 1.4 - (double)itemRectangle.Height) * (double)gravDir);
42947 itemRectangle.Height = (int)((double)itemRectangle.Height * 1.4);
42948 }
42949 }
42950 else if (sItem.useStyle == 3)
42951 {
42952 if ((double)itemAnimation > (double)itemAnimationMax * 0.666)
42953 {
42954 dontAttack = true;
42955 }
42956 else
42957 {
42958 if (direction == -1)
42959 {
42960 itemRectangle.X -= (int)((double)itemRectangle.Width * 1.4 - (double)itemRectangle.Width);
42961 }
42962 itemRectangle.Width = (int)((double)itemRectangle.Width * 1.4);
42963 itemRectangle.Y += (int)((double)itemRectangle.Height * 0.6);
42964 itemRectangle.Height = (int)((double)itemRectangle.Height * 0.6);
42965 if (sItem.type == 946 || sItem.type == 4707)
42966 {
42967 itemRectangle.Height += 14;
42968 itemRectangle.Width -= 10;
42969 if (direction == -1)
42970 {
42971 itemRectangle.X += 10;
42972 }
42973 }
42974 }
42975 }
42976 if (sItem.type == 1450 && Main.rand.Next(3) == 0)
42977 {
42978 int num3 = -1;
42979 float x = itemRectangle.X + Main.rand.Next(itemRectangle.Width);
42980 float y = itemRectangle.Y + Main.rand.Next(itemRectangle.Height);
42981 if (Main.rand.Next(500) == 0)
42982 {
42983 num3 = Gore.NewGore(new Vector2(x, y), default(Vector2), 415, (float)Main.rand.Next(51, 101) * 0.01f);
42984 }
42985 else if (Main.rand.Next(250) == 0)
42986 {
42987 num3 = Gore.NewGore(new Vector2(x, y), default(Vector2), 414, (float)Main.rand.Next(51, 101) * 0.01f);
42988 }
42989 else if (Main.rand.Next(80) == 0)
42990 {
42991 num3 = Gore.NewGore(new Vector2(x, y), default(Vector2), 413, (float)Main.rand.Next(51, 101) * 0.01f);
42992 }
42993 else if (Main.rand.Next(10) == 0)
42994 {
42995 num3 = Gore.NewGore(new Vector2(x, y), default(Vector2), 412, (float)Main.rand.Next(51, 101) * 0.01f);
42996 }
42997 else if (Main.rand.Next(3) == 0)
42998 {
42999 num3 = Gore.NewGore(new Vector2(x, y), default(Vector2), 411, (float)Main.rand.Next(51, 101) * 0.01f);
43000 }
43001 if (num3 >= 0)
43002 {
43003 Main.gore[num3].velocity.X += direction * 2;
43004 Main.gore[num3].velocity.Y *= 0.3f;
43005 }
43006 }
43007 if (sItem.type == 3542)
43008 {
43009 dontAttack = true;
43010 }
43011 if (sItem.type == 3779)
43012 {
43013 dontAttack = true;
43014 Vector2 vector = itemLocation + new Vector2(direction * 30, -8f);
43015 Vector2 vector2 = vector - position;
43016 for (float num4 = 0f; num4 < 1f; num4 += 0.2f)
43017 {
43018 Vector2 vector3 = Vector2.Lerp(oldPosition + vector2 + new Vector2(0f, gfxOffY), vector, num4);
43019 Dust obj = Main.dust[Dust.NewDust(vector - Vector2.One * 8f, 16, 16, 27, 0f, -2f)];
43020 obj.noGravity = true;
43021 obj.position = vector3;
43022 obj.velocity = new Vector2(0f, (0f - gravDir) * 2f);
43023 obj.scale = 1.2f;
43024 obj.alpha = 200;
43025 }
43026 }
43027 }
43028
43030 {
43031 if (sItem.type == 3335 && itemAnimation > 0 && !extraAccessory && Main.expertMode && ItemTimeIsZero)
43032 {
43033 ApplyItemTime(sItem);
43034 extraAccessory = true;
43035 NetMessage.SendData(4, -1, -1, null, whoAmI);
43036 }
43037 }
43038
43040 {
43041 if (sItem.type == 5289 && itemAnimation > 0 && ItemTimeIsZero)
43042 {
43043 ApplyItemTime(sItem);
43044 if (!unlockedSuperCart)
43045 {
43046 unlockedSuperCart = true;
43047 NetMessage.SendData(4, -1, -1, null, whoAmI);
43048 }
43049 QuickSpawnItem(GetItemSource_OpenItem(5289), 3353);
43050 }
43051 }
43052
43054 {
43055 if (sItem.type == 5326 && itemAnimation > 0 && !ateArtisanBread && ItemTimeIsZero)
43056 {
43057 ApplyItemTime(sItem);
43058 ateArtisanBread = true;
43059 NetMessage.SendData(4, -1, -1, null, whoAmI);
43060 }
43061 }
43062
43064 {
43065 if (sItem.type == 5043 && itemAnimation > 0 && !unlockedBiomeTorches && ItemTimeIsZero)
43066 {
43067 ApplyItemTime(sItem);
43068 unlockedBiomeTorches = true;
43069 UsingBiomeTorches = true;
43071 if (Main.netMode == 0)
43072 {
43073 NPC nPC = new NPC();
43074 nPC.SetDefaults(664);
43075 Main.BestiaryTracker.Kills.RegisterKill(nPC);
43076 }
43077 NetMessage.SendData(4, -1, -1, null, whoAmI);
43078 NetMessage.SendData(51, -1, -1, null, whoAmI, 5f);
43079 }
43080 }
43081
43083 {
43084 if (sItem.type != 5451 || ownedProjectileCounts[1020] <= 0 || !controlUseItem || !ItemTimeIsZero || mouseInterface)
43085 {
43086 return;
43087 }
43088 for (int i = 0; i < 1000; i++)
43089 {
43090 Projectile projectile = Main.projectile[i];
43091 if (projectile.owner == whoAmI && projectile.type == 1020)
43092 {
43093 projectile.Kill();
43094 }
43095 }
43096 releaseUseItem = false;
43097 }
43098
43100 {
43101 if (sItem.type == 109 && itemAnimation > 0 && statManaMax < 200 && ItemTimeIsZero)
43102 {
43103 ApplyItemTime(sItem);
43104 statManaMax += 20;
43105 statManaMax2 += 20;
43106 statMana += 20;
43107 if (Main.myPlayer == whoAmI)
43108 {
43109 ManaEffect(20);
43110 }
43112 }
43113 }
43114
43116 {
43117 if (sItem.type == 1291 && itemAnimation > 0 && statLifeMax >= 400 && statLifeMax < 500 && ItemTimeIsZero)
43118 {
43119 ApplyItemTime(sItem);
43120 statLifeMax += 5;
43121 statLifeMax2 += 5;
43122 statLife += 5;
43123 if (Main.myPlayer == whoAmI)
43124 {
43125 HealEffect(5);
43126 }
43128 }
43129 }
43130
43132 {
43133 if (sItem.type == 29 && itemAnimation > 0 && statLifeMax < 400 && ItemTimeIsZero)
43134 {
43135 ApplyItemTime(sItem);
43136 statLifeMax += 20;
43137 statLifeMax2 += 20;
43138 statLife += 20;
43139 if (Main.myPlayer == whoAmI)
43140 {
43141 HealEffect(20);
43142 }
43144 }
43145 }
43146
43148 {
43149 if (!NPC.combatBookWasUsed && sItem.type == 4382 && itemAnimation > 0 && ItemTimeIsZero)
43150 {
43151 ApplyItemTime(sItem);
43152 if (Main.netMode == 0)
43153 {
43154 NPC.combatBookWasUsed = true;
43155 Main.NewText(Language.GetTextValue("Misc.CombatBookUsed"), 50, byte.MaxValue, 130);
43156 }
43157 else
43158 {
43159 NetMessage.SendData(61, -1, -1, null, whoAmI, -11f);
43160 }
43161 }
43162 if (!NPC.combatBookVolumeTwoWasUsed && sItem.type == 5336 && itemAnimation > 0 && ItemTimeIsZero)
43163 {
43164 ApplyItemTime(sItem);
43165 if (Main.netMode == 0)
43166 {
43167 NPC.combatBookVolumeTwoWasUsed = true;
43168 Main.NewText(Language.GetTextValue("Misc.CombatBookVolumeTwoUsed"), 50, byte.MaxValue, 130);
43169 }
43170 else
43171 {
43172 NetMessage.SendData(61, -1, -1, null, whoAmI, -17f);
43173 }
43174 }
43175 }
43176
43178 {
43179 if (sItem.type == 4829 && itemAnimation > 0)
43180 {
43181 LicenseOrExchangePet(sItem, ref NPC.boughtCat, 637, "Misc.LicenseCatUsed", -12);
43182 }
43183 if (sItem.type == 4830 && itemAnimation > 0)
43184 {
43185 LicenseOrExchangePet(sItem, ref NPC.boughtDog, 638, "Misc.LicenseDogUsed", -13);
43186 }
43187 if (sItem.type == 4910 && itemAnimation > 0)
43188 {
43189 LicenseOrExchangePet(sItem, ref NPC.boughtBunny, 656, "Misc.LicenseBunnyUsed", -14);
43190 }
43191 }
43192
43194 {
43195 if (!NPC.peddlersSatchelWasUsed && sItem.type == 5343 && itemAnimation > 0 && ItemTimeIsZero)
43196 {
43197 ApplyItemTime(sItem);
43198 if (Main.netMode == 0)
43199 {
43200 NPC.peddlersSatchelWasUsed = true;
43201 Main.NewText(Language.GetTextValue("Misc.PeddlersSatchelUsed"), 50, byte.MaxValue, 130);
43202 }
43203 else
43204 {
43205 NetMessage.SendData(61, -1, -1, null, whoAmI, -18f);
43206 }
43207 }
43208 }
43209
43211 {
43212 if (sItem.type == 5337 && itemAnimation > 0 && !usedAegisCrystal && ItemTimeIsZero)
43213 {
43214 ApplyItemTime(sItem);
43215 usedAegisCrystal = true;
43216 NetMessage.SendData(4, -1, -1, null, whoAmI);
43217 }
43218 if (sItem.type == 5338 && itemAnimation > 0 && !usedAegisFruit && ItemTimeIsZero)
43219 {
43220 ApplyItemTime(sItem);
43221 usedAegisFruit = true;
43222 NetMessage.SendData(4, -1, -1, null, whoAmI);
43223 }
43224 if (sItem.type == 5339 && itemAnimation > 0 && !usedArcaneCrystal && ItemTimeIsZero)
43225 {
43226 ApplyItemTime(sItem);
43227 usedArcaneCrystal = true;
43228 NetMessage.SendData(4, -1, -1, null, whoAmI);
43229 }
43230 if (sItem.type == 5340 && itemAnimation > 0 && !usedGalaxyPearl && ItemTimeIsZero)
43231 {
43232 ApplyItemTime(sItem);
43233 usedGalaxyPearl = true;
43234 NetMessage.SendData(4, -1, -1, null, whoAmI);
43235 }
43236 if (sItem.type == 5341 && itemAnimation > 0 && !usedGummyWorm && ItemTimeIsZero)
43237 {
43238 ApplyItemTime(sItem);
43239 usedGummyWorm = true;
43240 NetMessage.SendData(4, -1, -1, null, whoAmI);
43241 }
43242 if (sItem.type == 5342 && itemAnimation > 0 && !usedAmbrosia && ItemTimeIsZero)
43243 {
43244 ApplyItemTime(sItem);
43245 usedAmbrosia = true;
43246 NetMessage.SendData(4, -1, -1, null, whoAmI);
43247 }
43248 }
43249
43251 {
43252 if (ItemTimeIsZero && (!petBoughtFlag || NPC.AnyNPCs(npcType)))
43253 {
43254 ApplyItemTime(sItem);
43256 }
43257 }
43258
43260 {
43261 Vector2 center = base.Center;
43263 float num = Math.Abs(vector.X);
43264 float num2 = Math.Abs(vector.Y);
43265 float num3 = 1f;
43266 if (num > 960f)
43267 {
43268 float num4 = 960f / num;
43269 if (num3 > num4)
43270 {
43271 num3 = num4;
43272 }
43273 }
43274 if (num2 > 600f)
43275 {
43276 float num5 = 600f / num2;
43277 if (num3 > num5)
43278 {
43279 num3 = num5;
43280 }
43281 }
43284 }
43285
43287 {
43288 if (Main.myPlayer != whoAmI || (sItem.type != 1326 && sItem.type != 5335) || itemAnimation <= 0 || !ItemTimeIsZero)
43289 {
43290 return;
43291 }
43292 ApplyItemTime(sItem);
43293 Vector2 pointPoisition = default(Vector2);
43294 pointPoisition.X = (float)Main.mouseX + Main.screenPosition.X;
43295 if (gravDir == 1f)
43296 {
43297 pointPoisition.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)height;
43298 }
43299 else
43300 {
43301 pointPoisition.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
43302 }
43303 pointPoisition.X -= width / 2;
43304 LimitPointToPlayerReachableArea(ref pointPoisition);
43305 if (!(pointPoisition.X > 50f) || !(pointPoisition.X < (float)(Main.maxTilesX * 16 - 50)) || !(pointPoisition.Y > 50f) || !(pointPoisition.Y < (float)(Main.maxTilesY * 16 - 50)))
43306 {
43307 return;
43308 }
43309 int num = (int)(pointPoisition.X / 16f);
43310 int num2 = (int)(pointPoisition.Y / 16f);
43311 if ((Main.tile[num, num2].wall == 87 && !NPC.downedPlantBoss && (Main.remixWorld || (double)num2 > Main.worldSurface)) || Collision.SolidCollision(pointPoisition, width, height))
43312 {
43313 return;
43314 }
43315 Teleport(pointPoisition, 1);
43316 NetMessage.SendData(65, -1, -1, null, 0, whoAmI, pointPoisition.X, pointPoisition.Y, 1);
43317 if (sItem.type != 1326)
43318 {
43319 return;
43320 }
43321 if (chaosState)
43322 {
43323 statLife -= statLifeMax2 / 7;
43325 if (Main.rand.Next(2) == 0)
43326 {
43327 damageSource = PlayerDeathReason.ByOther(Male ? 14 : 15);
43328 }
43329 if (statLife <= 0)
43330 {
43331 KillMe(damageSource, 1.0, 0);
43332 }
43333 lifeRegenCount = 0;
43334 lifeRegenTime = 0f;
43335 }
43336 AddBuff(88, 360);
43337 }
43338
43340 {
43341 if (!Main.tileHammer[targetTile.type] && !Main.tileSolid[targetTile.type] && targetTile.type != 314 && targetTile.type != 424 && targetTile.type != 442)
43342 {
43343 return targetTile.type != 351;
43344 }
43345 return false;
43346 }
43347
43348 private void UseShovel(Player user, Item item, int sX, int sY)
43349 {
43350 for (int i = sX - 1; i <= sX + 1; i++)
43351 {
43352 for (int j = sY - 1; j <= sY + 1; j++)
43353 {
43354 DamageTileWithShovel(user, item, i, j);
43355 }
43356 }
43357 itemTime = (int)((float)item.useTime * pickSpeed);
43358 }
43359
43360 private void DamageTileWithShovel(Player user, Item item, int x, int y)
43361 {
43364 {
43365 int pickPower = 30;
43366 if (tileSafely.active() && (TileID.Sets.Conversion.Grass[tileSafely.type] || TileID.Sets.Conversion.JungleGrass[tileSafely.type] || tileSafely.type == 70 || tileSafely.type == 633))
43367 {
43368 PickTile(x, y, 100);
43369 }
43370 PickTile(x, y, pickPower);
43371 }
43372 }
43373
43375 {
43377 if (sItem.type == 4711)
43378 {
43380 specialToolUsageSettings2.IsAValidTool = true;
43381 specialToolUsageSettings2.UsageAction = UseShovel;
43383 }
43384 if (sItem.pick <= 0 && sItem.axe <= 0 && sItem.hammer <= 0 && !specialToolUsageSettings.IsAValidTool)
43385 {
43386 return;
43387 }
43388 bool flag = IsTargetTileInItemRange(sItem);
43389 if (noBuilding)
43390 {
43391 flag = false;
43392 }
43393 if (flag && specialToolUsageSettings.UsageCondition != null)
43394 {
43395 flag = specialToolUsageSettings.UsageCondition(this, sItem, tileTargetX, tileTargetY);
43396 }
43397 if (toolTime == 0 && itemAnimation > 0 && controlUseItem)
43398 {
43399 Tile tile = Main.tile[tileTargetX, tileTargetY];
43400 if (!tile.active() || IsTilePoundable(tile))
43401 {
43402 poundRelease = false;
43403 }
43404 }
43405 if (!flag)
43406 {
43407 return;
43408 }
43410 {
43411 cursorItemIconEnabled = true;
43413 }
43414 bool canHitWalls = false;
43415 if (toolTime == 0 && itemAnimation > 0 && controlUseItem)
43416 {
43417 if (specialToolUsageSettings.UsageAction != null)
43418 {
43419 specialToolUsageSettings.UsageAction(this, sItem, tileTargetX, tileTargetY);
43420 return;
43421 }
43422 ItemCheck_UseMiningTools_ActuallyUseMiningTool(sItem, out canHitWalls, tileTargetX, tileTargetY);
43423 }
43424 if (releaseUseItem)
43425 {
43426 poundRelease = true;
43427 }
43428 if (toolTime == 0 && itemAnimation > 0 && controlUseItem && canHitWalls)
43429 {
43430 ItemCheck_UseMiningTools_TryFindingWallToHammer(out var wX, out var wY);
43431 ItemCheck_UseMiningTools_TryHittingWall(sItem, wX, wY);
43432 }
43433 }
43434
43436 {
43437 int num = -1;
43438 int num2 = 0;
43439 canHitWalls = true;
43440 Tile tile = Main.tile[x, y];
43441 if (!tile.active())
43442 {
43443 return;
43444 }
43445 if ((sItem.pick > 0 && !Main.tileAxe[tile.type] && !Main.tileHammer[tile.type]) || (sItem.axe > 0 && Main.tileAxe[tile.type]) || (sItem.hammer > 0 && Main.tileHammer[tile.type]))
43446 {
43447 canHitWalls = false;
43448 }
43449 num = hitTile.HitObject(x, y, 1);
43450 if (Main.tileNoFail[tile.type])
43451 {
43452 num2 = 100;
43453 }
43454 if (Main.tileHammer[tile.type])
43455 {
43456 canHitWalls = false;
43457 if (sItem.hammer > 0)
43458 {
43459 num2 += sItem.hammer;
43460 if (!WorldGen.CanKillTile(x, y))
43461 {
43462 num2 = 0;
43463 }
43464 if (tile.type == 26 && (sItem.hammer < 80 || !Main.hardMode))
43465 {
43466 num2 = 0;
43467 Hurt(PlayerDeathReason.ByOther(4), statLife / 2, -direction);
43468 }
43469 AchievementsHelper.CurrentlyMining = true;
43470 if (hitTile.AddDamage(num, num2) >= 100)
43471 {
43472 ClearMiningCacheAt(x, y, 1);
43473 WorldGen.KillTile(x, y);
43474 if (Main.netMode == 1)
43475 {
43476 NetMessage.SendData(17, -1, -1, null, 0, x, y);
43477 }
43478 }
43479 else
43480 {
43481 WorldGen.KillTile(x, y, fail: true);
43482 if (Main.netMode == 1)
43483 {
43484 NetMessage.SendData(17, -1, -1, null, 0, x, y, 1f);
43485 }
43486 }
43487 if (num2 != 0)
43488 {
43489 hitTile.Prune();
43490 }
43491 ApplyItemTime(sItem);
43492 AchievementsHelper.CurrentlyMining = false;
43493 }
43494 }
43495 else if (Main.tileAxe[tile.type])
43496 {
43497 num2 = ((tile.type != 80) ? (num2 + (int)((float)sItem.axe * 1.2f)) : (num2 + (int)((float)(sItem.axe * 3) * 1.2f)));
43498 if (Main.getGoodWorld)
43499 {
43500 num2 = (int)((double)num2 * 1.3);
43501 }
43502 if (sItem.axe > 0)
43503 {
43504 AchievementsHelper.CurrentlyMining = true;
43505 if (!WorldGen.CanKillTile(x, y))
43506 {
43507 num2 = 0;
43508 }
43509 if (Main.dontStarveWorld && Main.myPlayer == whoAmI && num2 > 0 && tile.type == 80)
43510 {
43511 Hurt(PlayerDeathReason.ByOther(3), Main.DamageVar(6f, luck), 0, pvp: false, quiet: false, Crit: false, 0);
43512 }
43513 if (hitTile.AddDamage(num, num2) >= 100)
43514 {
43515 if (whoAmI == Main.myPlayer && sItem.type == 5095 && (TileID.Sets.IsATreeTrunk[tile.type] || tile.type == 323 || tile.type == 80))
43516 {
43518 if (TileID.Sets.CountsAsGemTree[tile.type])
43519 {
43520 source = LucyAxeMessage.MessageSource.ChoppedGemTree;
43521 }
43522 if (tile.type == 80)
43523 {
43524 source = LucyAxeMessage.MessageSource.ChoppedCactus;
43525 LucyAxeMessage.TryCreatingMessageWithCooldown(source, base.Top, new Vector2(direction * 7, -7f), 420);
43526 }
43527 else
43528 {
43529 LucyAxeMessage.Create(source, base.Top, new Vector2(direction * 7, -7f));
43530 }
43531 }
43532 ClearMiningCacheAt(x, y, 1);
43533 bool flag = IsBottomOfTreeTrunkNoRoots(x, y);
43534 WorldGen.KillTile(x, y);
43535 if (Main.netMode == 1)
43536 {
43537 NetMessage.SendData(17, -1, -1, null, 0, x, y);
43538 }
43539 if (sItem.type == 5295 && flag)
43540 {
43541 TryReplantingTree();
43542 }
43543 }
43544 else
43545 {
43546 WorldGen.KillTile(x, y, fail: true);
43547 if (Main.netMode == 1)
43548 {
43549 NetMessage.SendData(17, -1, -1, null, 0, x, y, 1f);
43550 }
43551 }
43552 if (num2 != 0)
43553 {
43554 hitTile.Prune();
43555 }
43556 ApplyItemTime(sItem);
43557 AchievementsHelper.CurrentlyMining = false;
43558 }
43559 }
43560 else if (sItem.pick > 0)
43561 {
43562 PickTile(x, y, sItem.pick);
43563 }
43564 if (sItem.pick > 0)
43565 {
43566 itemTime = (int)((float)sItem.useTime * pickSpeed);
43567 }
43568 ItemCheck_UseMiningTools_TryPoundingTile(sItem, num, ref canHitWalls, x, y);
43569 }
43570
43571 private bool IsBottomOfTreeTrunkNoRoots(int x, int y)
43572 {
43573 Tile tile = Main.tile[x, y];
43574 if (!tile.active())
43575 {
43576 return false;
43577 }
43578 if (!TileID.Sets.IsATreeTrunk[tile.type] && tile.type != 323)
43579 {
43580 return false;
43581 }
43582 short frameX = tile.frameX;
43583 short frameY = tile.frameY;
43584 ushort type = tile.type;
43585 if (type != 323 && frameY >= 132 && frameY <= 176 && (frameX == 22 || frameX == 44))
43586 {
43587 return false;
43588 }
43589 return true;
43590 }
43591
43592 private void TryReplantingTree()
43593 {
43594 ushort type = 20;
43595 int style = 0;
43596 if (!TileObject.CanPlace(tileTargetX, tileTargetY, type, style, direction, out var objectData))
43597 {
43598 return;
43599 }
43600 bool num = TileObject.Place(objectData);
43601 WorldGen.SquareTileFrame(tileTargetX, tileTargetY);
43602 if (num)
43603 {
43604 TileObjectData.CallPostPlacementPlayerHook(tileTargetX, tileTargetY, type, style, direction, objectData.alternate, objectData);
43605 if (Main.netMode == 1)
43606 {
43607 NetMessage.SendObjectPlacement(-1, tileTargetX, tileTargetY, objectData.type, objectData.style, objectData.alternate, objectData.random, direction);
43608 }
43609 }
43610 }
43611
43613 {
43614 wX = tileTargetX;
43615 wY = tileTargetY;
43616 bool flag = true;
43617 if (Main.tile[wX, wY].wall > 0)
43618 {
43619 if (!Main.wallHouse[Main.tile[wX, wY].wall])
43620 {
43621 for (int i = wX - 1; i < wX + 2; i++)
43622 {
43623 for (int j = wY - 1; j < wY + 2; j++)
43624 {
43625 if (Main.tile[i, j].wall != Main.tile[wX, wY].wall)
43626 {
43627 flag = false;
43628 break;
43629 }
43630 }
43631 }
43632 }
43633 else
43634 {
43635 flag = false;
43636 }
43637 }
43638 if (!flag || Main.tile[wX, wY].active())
43639 {
43640 return;
43641 }
43642 int num = -1;
43643 if ((double)(((float)Main.mouseX + Main.screenPosition.X) / 16f) < Math.Round(((float)Main.mouseX + Main.screenPosition.X) / 16f))
43644 {
43645 num = 0;
43646 }
43647 int num2 = -1;
43648 if ((double)(((float)Main.mouseY + Main.screenPosition.Y) / 16f) < Math.Round(((float)Main.mouseY + Main.screenPosition.Y) / 16f))
43649 {
43650 num2 = 0;
43651 }
43652 for (int k = tileTargetX + num; k <= tileTargetX + num + 1; k++)
43653 {
43654 for (int l = tileTargetY + num2; l <= tileTargetY + num2 + 1; l++)
43655 {
43656 if (!flag)
43657 {
43658 continue;
43659 }
43660 wX = k;
43661 wY = l;
43662 if (Main.tile[wX, wY].wall <= 0)
43663 {
43664 continue;
43665 }
43666 if (!Main.wallHouse[Main.tile[wX, wY].wall])
43667 {
43668 for (int m = wX - 1; m < wX + 2; m++)
43669 {
43670 for (int n = wY - 1; n < wY + 2; n++)
43671 {
43672 if (Main.tile[m, n].wall != Main.tile[wX, wY].wall)
43673 {
43674 flag = false;
43675 break;
43676 }
43677 }
43678 }
43679 }
43680 else
43681 {
43682 flag = false;
43683 }
43684 }
43685 }
43686 }
43687
43689 {
43690 if (Main.tile[wX, wY].wall > 0 && (!Main.tile[wX, wY].active() || wX != tileTargetX || wY != tileTargetY || (!Main.tileHammer[Main.tile[wX, wY].type] && !poundRelease)) && toolTime == 0 && itemAnimation > 0 && controlUseItem && sItem.hammer > 0 && CanPlayerSmashWall(wX, wY))
43691 {
43692 int damage = (int)((float)sItem.hammer * 1.5f);
43693 PickWall(wX, wY, damage);
43694 itemTime = sItem.useTime / 2;
43695 }
43696 }
43697
43698 public static bool CanPlayerSmashWall(int X, int Y)
43699 {
43700 bool result = true;
43701 if (!Main.wallHouse[Main.tile[X, Y].wall])
43702 {
43703 result = false;
43704 for (int i = X - 1; i < X + 2; i++)
43705 {
43706 for (int j = Y - 1; j < Y + 2; j++)
43707 {
43708 if (Main.tile[i, j].wall == 0 || Main.wallHouse[Main.tile[i, j].wall])
43709 {
43710 result = true;
43711 break;
43712 }
43713 }
43714 }
43715 }
43716 return result;
43717 }
43718
43719 public void PickWall(int x, int y, int damage)
43720 {
43721 int tileId = hitTile.HitObject(x, y, 2);
43722 if (hitTile.AddDamage(tileId, damage) >= 100)
43723 {
43724 hitTile.Clear(tileId);
43725 ClearMiningCacheAt(x, y, 2);
43726 WorldGen.KillWall(x, y);
43727 if (Main.netMode == 1)
43728 {
43729 NetMessage.SendData(17, -1, -1, null, 2, x, y);
43730 }
43731 }
43732 else
43733 {
43734 WorldGen.KillWall(x, y, fail: true);
43735 if (Main.netMode == 1)
43736 {
43737 NetMessage.SendData(17, -1, -1, null, 2, x, y, 1f);
43738 }
43739 }
43740 if (damage != 0)
43741 {
43742 hitTile.Prune();
43743 }
43744 }
43745
43747 {
43748 Tile tile = Main.tile[x, y];
43749 if (sItem.hammer > 0 && tile.active() && (Main.tileSolid[tile.type] || tile.type == 314 || tile.type == 351 || tile.type == 424 || tile.type == 442) && poundRelease)
43750 {
43751 hitWall = false;
43752 ApplyItemTime(sItem);
43753 int damageAmount = 100;
43754 if (WorldGen.IsLockedDoor(x, y - 1) || WorldGen.IsLockedDoor(x, y + 1))
43755 {
43756 damageAmount = 0;
43757 }
43758 if (hitTile.AddDamage(tileHitId, damageAmount) >= 100)
43759 {
43760 ClearMiningCacheAt(x, y, 1);
43761 if (!poundRelease)
43762 {
43763 return;
43764 }
43765 if (TileID.Sets.Platforms[Main.tile[x, y].type])
43766 {
43767 if (tile.halfBrick())
43768 {
43769 WorldGen.PoundTile(x, y);
43770 if (Main.netMode == 1)
43771 {
43772 NetMessage.SendData(17, -1, -1, null, 7, x, y, 1f);
43773 }
43774 }
43775 else
43776 {
43777 int num = 1;
43778 int slope = 2;
43779 if (TileID.Sets.Platforms[Main.tile[x + 1, y - 1].type] || TileID.Sets.Platforms[Main.tile[x - 1, y + 1].type] || (WorldGen.SolidTile(x + 1, y) && !WorldGen.SolidTile(x - 1, y)))
43780 {
43781 num = 2;
43782 slope = 1;
43783 }
43784 if (Main.tile[x, y].slope() == 0)
43785 {
43786 WorldGen.SlopeTile(x, y, num);
43787 int num2 = Main.tile[x, y].slope();
43788 if (Main.netMode == 1)
43789 {
43790 NetMessage.SendData(17, -1, -1, null, 14, x, y, num2);
43791 }
43792 }
43793 else if (Main.tile[x, y].slope() == num)
43794 {
43795 WorldGen.SlopeTile(x, y, slope);
43796 int num3 = Main.tile[x, y].slope();
43797 if (Main.netMode == 1)
43798 {
43799 NetMessage.SendData(17, -1, -1, null, 14, x, y, num3);
43800 }
43801 }
43802 else
43803 {
43804 WorldGen.SlopeTile(x, y);
43805 int num4 = Main.tile[x, y].slope();
43806 if (Main.netMode == 1)
43807 {
43808 NetMessage.SendData(17, -1, -1, null, 14, x, y, num4);
43809 }
43810 WorldGen.PoundTile(x, y);
43811 if (Main.netMode == 1)
43812 {
43813 NetMessage.SendData(17, -1, -1, null, 7, x, y, 1f);
43814 }
43815 }
43816 }
43817 }
43818 else if (Main.tile[x, y].type == 314)
43819 {
43820 if (Minecart.FrameTrack(x, y, pound: true) && Main.netMode == 1)
43821 {
43822 NetMessage.SendData(17, -1, -1, null, 15, x, y, 1f);
43823 }
43824 }
43825 else if (Main.tile[x, y].type == 137)
43826 {
43827 int num5 = 0;
43828 switch (Main.tile[x, y].frameY / 18)
43829 {
43830 case 0:
43831 case 1:
43832 case 2:
43833 case 5:
43834 switch (Main.tile[x, y].frameX / 18)
43835 {
43836 case 0:
43837 num5 = 2;
43838 break;
43839 case 1:
43840 num5 = 3;
43841 break;
43842 case 2:
43843 num5 = 4;
43844 break;
43845 case 3:
43846 num5 = 5;
43847 break;
43848 case 4:
43849 num5 = 1;
43850 break;
43851 case 5:
43852 num5 = 0;
43853 break;
43854 }
43855 break;
43856 case 3:
43857 case 4:
43858 switch (Main.tile[x, y].frameX / 18)
43859 {
43860 case 0:
43861 case 1:
43862 num5 = 3;
43863 break;
43864 case 3:
43865 num5 = 2;
43866 break;
43867 case 2:
43868 num5 = 4;
43869 break;
43870 case 4:
43871 num5 = 0;
43872 break;
43873 }
43874 break;
43875 }
43876 Main.tile[x, y].frameX = (short)(num5 * 18);
43877 if (Main.netMode == 1)
43878 {
43879 NetMessage.SendTileSquare(-1, x, y);
43880 }
43881 }
43882 else if (Main.tile[x, y].type == 424)
43883 {
43884 if (Main.tile[x, y].frameX == 0)
43885 {
43886 Main.tile[x, y].frameX = 18;
43887 }
43888 else if (Main.tile[x, y].frameX == 18)
43889 {
43890 Main.tile[x, y].frameX = 36;
43891 }
43892 else
43893 {
43894 Main.tile[x, y].frameX = 0;
43895 }
43896 if (Main.netMode == 1)
43897 {
43898 NetMessage.SendTileSquare(-1, x, y);
43899 }
43900 }
43901 else if (Main.tile[x, y].type == 442)
43902 {
43903 Tile tile2 = Main.tile[x, y - 1];
43904 Tile tile3 = Main.tile[x, y + 1];
43905 Tile tile4 = Main.tile[x - 1, y];
43906 Tile tile5 = Main.tile[x + 1, y];
43907 Tile tile6 = Main.tile[x - 1, y + 1];
43908 Tile tile7 = Main.tile[x + 1, y + 1];
43909 Tile tile8 = Main.tile[x - 1, y - 1];
43910 Tile tile9 = Main.tile[x + 1, y - 1];
43911 int num6 = -1;
43912 int num7 = -1;
43913 int num8 = -1;
43914 int num9 = -1;
43915 int tree = -1;
43916 int tree2 = -1;
43917 int tree3 = -1;
43918 int tree4 = -1;
43919 if (tile2 != null && tile2.nactive() && !tile2.bottomSlope())
43920 {
43921 num7 = tile2.type;
43922 }
43923 if (tile3 != null && tile3.nactive() && !tile3.halfBrick() && !tile3.topSlope())
43924 {
43925 num6 = tile3.type;
43926 }
43927 if (tile4 != null && tile4.nactive() && (tile4.slope() == 0 || tile4.slope() % 2 != 1))
43928 {
43929 num8 = tile4.type;
43930 }
43931 if (tile5 != null && tile5.nactive() && (tile5.slope() == 0 || tile5.slope() % 2 != 0))
43932 {
43933 num9 = tile5.type;
43934 }
43935 if (tile6 != null && tile6.nactive())
43936 {
43937 tree = tile6.type;
43938 }
43939 if (tile7 != null && tile7.nactive())
43940 {
43941 tree2 = tile7.type;
43942 }
43943 if (tile8 != null && tile8.nactive())
43944 {
43945 tree3 = tile8.type;
43946 }
43947 if (tile9 != null && tile9.nactive())
43948 {
43949 tree4 = tile9.type;
43950 }
43951 bool flag = false;
43952 bool flag2 = false;
43953 bool flag3 = false;
43954 bool flag4 = false;
43955 if (num6 >= 0 && Main.tileSolid[num6] && (!Main.tileNoAttach[num6] || TileID.Sets.Platforms[num6]) && (tile3.bottomSlope() || tile3.slope() == 0) && !tile3.halfBrick())
43956 {
43957 flag4 = true;
43958 }
43959 if (num7 >= 0 && Main.tileSolid[num7] && (!Main.tileNoAttach[num7] || (TileID.Sets.Platforms[num7] && tile2.halfBrick())) && (tile2.topSlope() || tile2.slope() == 0 || tile2.halfBrick()))
43960 {
43961 flag = true;
43962 }
43963 if ((num8 >= 0 && Main.tileSolid[num8] && !Main.tileNoAttach[num8] && (tile4.leftSlope() || tile4.slope() == 0) && !tile4.halfBrick()) || (num8 >= 0 && TileID.Sets.IsBeam[num8]) || (WorldGen.IsTreeType(num8) && WorldGen.IsTreeType(tree3) && WorldGen.IsTreeType(tree)))
43964 {
43965 flag2 = true;
43966 }
43967 if ((num9 >= 0 && Main.tileSolid[num9] && !Main.tileNoAttach[num9] && (tile5.rightSlope() || tile5.slope() == 0) && !tile5.halfBrick()) || (num9 >= 0 && TileID.Sets.IsBeam[num9]) || (WorldGen.IsTreeType(num9) && WorldGen.IsTreeType(tree4) && WorldGen.IsTreeType(tree2)))
43968 {
43969 flag3 = true;
43970 }
43971 int num10 = Main.tile[x, y].frameX / 22;
43972 short num11 = -2;
43973 switch (num10)
43974 {
43975 case 0:
43976 num11 = (short)((!flag2) ? (flag ? 1 : ((!flag3) ? (-1) : 3)) : 2);
43977 break;
43978 case 2:
43979 num11 = (short)(flag ? 1 : ((!flag3) ? ((!flag4) ? (-1) : 0) : 3));
43980 break;
43981 case 1:
43982 num11 = (short)((!flag3) ? ((!flag4) ? ((!flag2) ? (-1) : 2) : 0) : 3);
43983 break;
43984 case 3:
43985 num11 = (short)((!flag4) ? ((!flag2) ? (flag ? 1 : (-1)) : 2) : 0);
43986 break;
43987 }
43988 if (num11 != -1)
43989 {
43990 if (num11 == -2)
43991 {
43992 num11 = 0;
43993 }
43994 Main.tile[x, y].frameX = (short)(22 * num11);
43995 if (Main.netMode == 1)
43996 {
43997 NetMessage.SendTileSquare(-1, x, y);
43998 }
43999 }
44000 }
44001 else if ((Main.tile[x, y].halfBrick() || Main.tile[x, y].slope() != 0) && !Main.tileSolidTop[Main.tile[x, y].type])
44002 {
44003 int num12 = 1;
44004 int num13 = 1;
44005 int num14 = 2;
44006 if ((WorldGen.SolidTile(x + 1, y) || Main.tile[x + 1, y].slope() == 1 || Main.tile[x + 1, y].slope() == 3) && !WorldGen.SolidTile(x - 1, y))
44007 {
44008 num13 = 2;
44009 num14 = 1;
44010 }
44011 if (WorldGen.SolidTile(x, y - 1) && !WorldGen.SolidTile(x, y + 1))
44012 {
44013 num12 = -1;
44014 }
44015 if (num12 == 1)
44016 {
44017 if (Main.tile[x, y].slope() == 0)
44018 {
44019 WorldGen.SlopeTile(x, y, num13);
44020 }
44021 else if (Main.tile[x, y].slope() == num13)
44022 {
44023 WorldGen.SlopeTile(x, y, num14);
44024 }
44025 else if (Main.tile[x, y].slope() == num14)
44026 {
44027 WorldGen.SlopeTile(x, y, num13 + 2);
44028 }
44029 else if (Main.tile[x, y].slope() == num13 + 2)
44030 {
44031 WorldGen.SlopeTile(x, y, num14 + 2);
44032 }
44033 else
44034 {
44035 WorldGen.SlopeTile(x, y);
44036 }
44037 }
44038 else if (Main.tile[x, y].slope() == 0)
44039 {
44040 WorldGen.SlopeTile(x, y, num13 + 2);
44041 }
44042 else if (Main.tile[x, y].slope() == num13 + 2)
44043 {
44044 WorldGen.SlopeTile(x, y, num14 + 2);
44045 }
44046 else if (Main.tile[x, y].slope() == num14 + 2)
44047 {
44048 WorldGen.SlopeTile(x, y, num13);
44049 }
44050 else if (Main.tile[x, y].slope() == num13)
44051 {
44052 WorldGen.SlopeTile(x, y, num14);
44053 }
44054 else
44055 {
44056 WorldGen.SlopeTile(x, y);
44057 }
44058 int num15 = Main.tile[x, y].slope();
44059 if (Main.netMode == 1)
44060 {
44061 NetMessage.SendData(17, -1, -1, null, 14, x, y, num15);
44062 }
44063 }
44064 else
44065 {
44066 WorldGen.PoundTile(x, y);
44067 if (Main.netMode == 1)
44068 {
44069 NetMessage.SendData(17, -1, -1, null, 7, x, y, 1f);
44070 }
44071 }
44072 poundRelease = false;
44073 }
44074 else
44075 {
44076 WorldGen.KillTile(x, y, fail: true, effectOnly: true);
44077 SoundEngine.PlaySound(0, x * 16, y * 16);
44078 }
44079 }
44080 else
44081 {
44082 poundRelease = false;
44083 }
44084 }
44085
44087 {
44088 if (position.X / 16f - (float)tileRangeX - (float)sItem.tileBoost <= (float)tileTargetX && (position.X + (float)width) / 16f + (float)tileRangeX + (float)sItem.tileBoost - 1f >= (float)tileTargetX && position.Y / 16f - (float)tileRangeY - (float)sItem.tileBoost <= (float)tileTargetY)
44089 {
44090 return (position.Y + (float)height) / 16f + (float)tileRangeY + (float)sItem.tileBoost - 2f >= (float)tileTargetY;
44091 }
44092 return false;
44093 }
44094
44096 {
44097 if (((sItem.type < 205 || sItem.type > 207) && sItem.type != 1128 && sItem.type != 3031 && sItem.type != 3032 && sItem.type != 4820 && sItem.type != 4872 && sItem.type != 5302 && sItem.type != 5303 && sItem.type != 5304 && sItem.type != 5364) || noBuilding || !(position.X / 16f - (float)tileRangeX - (float)sItem.tileBoost <= (float)tileTargetX) || !((position.X + (float)width) / 16f + (float)tileRangeX + (float)sItem.tileBoost - 1f >= (float)tileTargetX) || !(position.Y / 16f - (float)tileRangeY - (float)sItem.tileBoost <= (float)tileTargetY) || !((position.Y + (float)height) / 16f + (float)tileRangeY + (float)sItem.tileBoost - 2f >= (float)tileTargetY))
44098 {
44099 return;
44100 }
44102 {
44103 cursorItemIconEnabled = true;
44105 }
44106 if (!ItemTimeIsZero || itemAnimation <= 0 || !controlUseItem)
44107 {
44108 return;
44109 }
44110 if ((sItem.type == 205 && !Main.tile[tileTargetX, tileTargetY].shimmer()) || (sItem.type == 3032 && Main.tile[tileTargetX, tileTargetY].liquidType() == 0) || (sItem.type == 3032 && Main.tile[tileTargetX, tileTargetY].shimmer()) || (sItem.type == 4872 && Main.tile[tileTargetX, tileTargetY].lava()) || (sItem.type == 5303 && Main.tile[tileTargetX, tileTargetY].honey()) || sItem.type == 5304)
44111 {
44112 int num = Main.tile[tileTargetX, tileTargetY].liquidType();
44113 int num2 = 0;
44114 for (int i = tileTargetX - 1; i <= tileTargetX + 1; i++)
44115 {
44116 for (int j = tileTargetY - 1; j <= tileTargetY + 1; j++)
44117 {
44118 if (Main.tile[i, j].liquidType() == num)
44119 {
44120 num2 += Main.tile[i, j].liquid;
44121 }
44122 }
44123 }
44124 if (Main.tile[tileTargetX, tileTargetY].liquid <= 0 || (num2 <= 100 && sItem.type != 3032 && sItem.type != 4872 && sItem.type != 5303 && sItem.type != 5304))
44125 {
44126 return;
44127 }
44128 int liquidType = Main.tile[tileTargetX, tileTargetY].liquidType();
44129 if (sItem.type != 3032 && sItem.type != 4872 && sItem.type != 5303 && sItem.type != 5304)
44130 {
44131 if (Main.tile[tileTargetX, tileTargetY].honey() && sItem.type == 205)
44132 {
44133 sItem.stack--;
44134 PutItemInInventoryFromItemUsage(1128, selectedItem);
44135 }
44136 else if (Main.tile[tileTargetX, tileTargetY].lava() && sItem.type == 205)
44137 {
44138 sItem.stack--;
44139 PutItemInInventoryFromItemUsage(207, selectedItem);
44140 }
44141 else
44142 {
44143 if (Main.tile[tileTargetX, tileTargetY].shimmer() && sItem.type == 205)
44144 {
44145 return;
44146 }
44147 sItem.stack--;
44148 PutItemInInventoryFromItemUsage(206, selectedItem);
44149 }
44150 }
44151 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
44152 ApplyItemTime(sItem);
44153 int num3 = Main.tile[tileTargetX, tileTargetY].liquid;
44154 Main.tile[tileTargetX, tileTargetY].liquid = 0;
44155 Main.tile[tileTargetX, tileTargetY].lava(lava: false);
44156 Main.tile[tileTargetX, tileTargetY].honey(honey: false);
44157 WorldGen.SquareTileFrame(tileTargetX, tileTargetY, resetFrame: false);
44158 if (Main.netMode == 1)
44159 {
44160 NetMessage.sendWater(tileTargetX, tileTargetY);
44161 }
44162 else
44163 {
44164 Liquid.AddWater(tileTargetX, tileTargetY);
44165 }
44166 if (num3 >= 255)
44167 {
44168 return;
44169 }
44170 for (int k = tileTargetX - 1; k <= tileTargetX + 1; k++)
44171 {
44172 for (int l = tileTargetY - 1; l <= tileTargetY + 1; l++)
44173 {
44174 if ((k != tileTargetX || l != tileTargetY) && Main.tile[k, l].liquid > 0 && Main.tile[k, l].liquidType() == num)
44175 {
44176 int num4 = Main.tile[k, l].liquid;
44177 if (num4 + num3 > 255)
44178 {
44179 num4 = 255 - num3;
44180 }
44181 num3 += num4;
44182 Main.tile[k, l].liquid -= (byte)num4;
44183 Main.tile[k, l].liquidType(liquidType);
44184 if (Main.tile[k, l].liquid == 0)
44185 {
44186 Main.tile[k, l].lava(lava: false);
44187 Main.tile[k, l].honey(honey: false);
44188 }
44190 if (Main.netMode == 1)
44191 {
44193 }
44194 else
44195 {
44196 Liquid.AddWater(k, l);
44197 }
44198 }
44199 }
44200 }
44201 }
44202 else
44203 {
44204 if (Main.tile[tileTargetX, tileTargetY].liquid >= 200 || (Main.tile[tileTargetX, tileTargetY].nactive() && Main.tileSolid[Main.tile[tileTargetX, tileTargetY].type] && !Main.tileSolidTop[Main.tile[tileTargetX, tileTargetY].type] && Main.tile[tileTargetX, tileTargetY].type != 546))
44205 {
44206 return;
44207 }
44208 if (sItem.type == 207 || sItem.type == 4820)
44209 {
44210 if (Main.tile[tileTargetX, tileTargetY].liquid == 0 || Main.tile[tileTargetX, tileTargetY].liquidType() == 1)
44211 {
44212 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
44213 Main.tile[tileTargetX, tileTargetY].liquidType(1);
44214 Main.tile[tileTargetX, tileTargetY].liquid = byte.MaxValue;
44215 WorldGen.SquareTileFrame(tileTargetX, tileTargetY);
44216 if (sItem.type != 4820)
44217 {
44218 sItem.stack--;
44219 PutItemInInventoryFromItemUsage(205, selectedItem);
44220 }
44221 ApplyItemTime(sItem);
44222 if (Main.netMode == 1)
44223 {
44224 NetMessage.sendWater(tileTargetX, tileTargetY);
44225 }
44226 }
44227 }
44228 else if (sItem.type == 206 || sItem.type == 3031)
44229 {
44230 if (Main.tile[tileTargetX, tileTargetY].liquid == 0 || Main.tile[tileTargetX, tileTargetY].liquidType() == 0)
44231 {
44232 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
44233 Main.tile[tileTargetX, tileTargetY].liquidType(0);
44234 Main.tile[tileTargetX, tileTargetY].liquid = byte.MaxValue;
44235 WorldGen.SquareTileFrame(tileTargetX, tileTargetY);
44236 if (sItem.type != 3031)
44237 {
44238 sItem.stack--;
44239 PutItemInInventoryFromItemUsage(205, selectedItem);
44240 }
44241 ApplyItemTime(sItem);
44242 if (Main.netMode == 1)
44243 {
44244 NetMessage.sendWater(tileTargetX, tileTargetY);
44245 }
44246 }
44247 }
44248 else if (sItem.type == 1128 || sItem.type == 5302)
44249 {
44250 if (Main.tile[tileTargetX, tileTargetY].liquid == 0 || Main.tile[tileTargetX, tileTargetY].liquidType() == 2)
44251 {
44252 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
44253 Main.tile[tileTargetX, tileTargetY].liquidType(2);
44254 Main.tile[tileTargetX, tileTargetY].liquid = byte.MaxValue;
44255 WorldGen.SquareTileFrame(tileTargetX, tileTargetY);
44256 if (sItem.type != 5302)
44257 {
44258 sItem.stack--;
44259 PutItemInInventoryFromItemUsage(205, selectedItem);
44260 }
44261 ApplyItemTime(sItem);
44262 if (Main.netMode == 1)
44263 {
44264 NetMessage.sendWater(tileTargetX, tileTargetY);
44265 }
44266 }
44267 }
44268 else if (sItem.type == 5364 && (Main.tile[tileTargetX, tileTargetY].liquid == 0 || Main.tile[tileTargetX, tileTargetY].liquidType() == 3))
44269 {
44270 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
44271 Main.tile[tileTargetX, tileTargetY].liquidType(3);
44272 Main.tile[tileTargetX, tileTargetY].liquid = byte.MaxValue;
44273 WorldGen.SquareTileFrame(tileTargetX, tileTargetY);
44274 ApplyItemTime(sItem);
44275 if (Main.netMode == 1)
44276 {
44277 NetMessage.sendWater(tileTargetX, tileTargetY);
44278 }
44279 }
44280 }
44281 }
44282
44284 {
44285 Vector2 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
44286 float num = (float)Main.mouseX + Main.screenPosition.X - vector.X;
44287 float num2 = (float)Main.mouseY + Main.screenPosition.Y - vector.Y;
44288 float num3 = (float)Math.Sqrt(num * num + num2 * num2);
44289 float num4 = (float)Main.screenHeight / Main.GameViewMatrix.Zoom.Y;
44290 num3 /= num4 / 2f;
44291 if (num3 > 1f)
44292 {
44293 num3 = 1f;
44294 }
44295 musicDist = num3;
44296 if (itemAnimation > 0 && ItemTimeIsZero && (sItem.type == 508 || sItem.type == 507))
44297 {
44298 ApplyItemTime(sItem);
44299 Vector2 vector2 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
44300 float num5 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
44301 float num6 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
44302 float num7 = (float)Math.Sqrt(num5 * num5 + num6 * num6);
44303 float num8 = (float)Main.screenHeight / Main.GameViewMatrix.Zoom.Y;
44304 num7 /= num8 / 2f;
44305 if (num7 > 1f)
44306 {
44307 num7 = 1f;
44308 }
44309 num7 = num7 * 2f - 1f;
44310 if (num7 < -1f)
44311 {
44312 num7 = -1f;
44313 }
44314 if (num7 > 1f)
44315 {
44316 num7 = 1f;
44317 }
44318 num7 = (float)Math.Round(num7 * (float)musicNotes);
44319 num7 = (Main.musicPitch = num7 / (float)musicNotes);
44321 if (sItem.type == 507)
44322 {
44324 }
44325 SoundEngine.PlaySound(type, position);
44326 NetMessage.SendData(58, -1, -1, null, whoAmI, num7);
44327 }
44328 if (itemAnimation <= 0 || mouseInterface)
44329 {
44330 return;
44331 }
44333 {
44334 if (sItem.type == 1305)
44335 {
44336 Vector2 vector3 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
44337 float num9 = (float)Main.mouseX + Main.screenPosition.X - vector3.X;
44338 float num10 = (float)Main.mouseY + Main.screenPosition.Y - vector3.Y;
44339 float num11 = (float)Math.Sqrt(num9 * num9 + num10 * num10);
44340 float num12 = (float)Main.screenHeight / Main.GameViewMatrix.Zoom.Y;
44341 num11 /= num12 / 2f;
44342 if (num11 > 1f)
44343 {
44344 num11 = 1f;
44345 }
44346 num11 = num11 * 2f - 1f;
44347 if (num11 < -1f)
44348 {
44349 num11 = -1f;
44350 }
44351 if (num11 > 1f)
44352 {
44353 num11 = 1f;
44354 }
44355 num11 = (float)Math.Round(num11 * (float)musicNotes);
44356 num11 = (Main.musicPitch = num11 / (float)musicNotes);
44358 NetMessage.SendData(58, -1, -1, null, whoAmI, num11);
44359 }
44360 else if (sItem.type == 4057 || sItem.type == 4372)
44361 {
44362 Vector2 vector4 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
44363 float num13 = (float)Main.mouseX + Main.screenPosition.X - vector4.X;
44364 float num14 = (float)Main.mouseY + Main.screenPosition.Y - vector4.Y;
44365 float num15 = (float)Math.Sqrt(num13 * num13 + num14 * num14);
44366 float num16 = (float)Main.screenHeight / Main.GameViewMatrix.Zoom.Y;
44367 num15 /= num16 / 2f;
44368 if (num15 > 1f)
44369 {
44370 num15 = 1f;
44371 }
44372 PlayGuitarChord(num15);
44373 NetMessage.SendData(58, -1, -1, null, whoAmI, num15);
44374 }
44375 }
44376 if (sItem.type == 4715 && ((Main.mouseLeft && Main.mouseLeftRelease) | ItemAnimationJustStarted))
44377 {
44378 Vector2 vector5 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
44379 float num17 = (float)Main.mouseX + Main.screenPosition.X - vector5.X;
44380 float num18 = (float)Main.mouseY + Main.screenPosition.Y - vector5.Y;
44381 float num19 = (float)Math.Sqrt(num17 * num17 + num18 * num18);
44382 float num20 = (float)Main.screenHeight / Main.GameViewMatrix.Zoom.Y;
44383 num19 /= num20 / 2f;
44384 if (num19 > 1f)
44385 {
44386 num19 = 1f;
44387 }
44388 PlayGuitarChord(num19);
44389 NetMessage.SendData(58, -1, -1, null, whoAmI, num19);
44390 }
44391 if (sItem.type != 4673)
44392 {
44393 return;
44394 }
44395 int num21 = (int)base.Center.X / 16;
44396 int num22 = (int)base.Center.Y / 16;
44398 {
44399 Vector2 vector6 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
44400 float num23 = (float)Main.mouseX + Main.screenPosition.X - vector6.X;
44401 float num24 = (float)Main.mouseY + Main.screenPosition.Y - vector6.Y;
44402 float num25 = (float)Math.Sqrt(num23 * num23 + num24 * num24);
44403 float num26 = (float)Main.screenHeight / Main.GameViewMatrix.Zoom.Y;
44404 num25 /= num26 / 2f;
44405 if (num25 > 1f)
44406 {
44407 num25 = 1f;
44408 }
44409 PlayDrums(num25);
44410 NetMessage.SendData(58, -1, -1, null, whoAmI, num25);
44411 }
44412 }
44413
44415 {
44416 validTargets = new List<NPC>();
44417 Rectangle value = Utils.CenteredRectangle(base.Center, new Vector2(1000f, 800f));
44418 for (int i = 0; i < 200; i++)
44419 {
44420 NPC nPC = Main.npc[i];
44421 if (nPC.CanBeChasedBy(this) && nPC.Hitbox.Intersects(value))
44422 {
44424 }
44425 }
44426 if (validTargets.Count == 0)
44427 {
44428 return false;
44429 }
44430 return true;
44431 }
44432
44434 {
44435 npcTargetIndex = 0;
44436 int? num = null;
44437 float num2 = maxDistance;
44438 for (int i = 0; i < 200; i++)
44439 {
44440 NPC nPC = Main.npc[i];
44441 if (nPC.CanBeChasedBy(this))
44442 {
44443 float num3 = searchCenter.Distance(nPC.Center);
44444 if (!(num2 <= num3))
44445 {
44446 num = i;
44447 num2 = num3;
44448 }
44449 }
44450 }
44451 if (!num.HasValue)
44452 {
44453 return false;
44454 }
44455 npcTargetIndex = num.Value;
44456 return true;
44457 }
44458
44459 public void PlayGuitarChord(float range)
44460 {
44461 int num = 6;
44462 float num2 = 1f / (float)num;
44463 if (range > num2 * 5f)
44464 {
44465 SoundEngine.PlaySound(49, base.Center);
44466 }
44467 else if (range > num2 * 4f)
44468 {
44469 SoundEngine.PlaySound(48, base.Center);
44470 }
44471 else if (range > num2 * 3f)
44472 {
44473 SoundEngine.PlaySound(47, base.Center);
44474 }
44475 else if (range > num2 * 2f)
44476 {
44477 SoundEngine.PlaySound(51, base.Center);
44478 }
44479 else if (range > num2 * 1f)
44480 {
44481 SoundEngine.PlaySound(52, base.Center);
44482 }
44483 else
44484 {
44485 SoundEngine.PlaySound(50, base.Center);
44486 }
44487 }
44488
44489 public void PlayDrums(float range)
44490 {
44491 int num = 10;
44492 float num2 = 1f / (float)num;
44493 if (range > num2 * 9f)
44494 {
44495 SoundEngine.PlaySound(59, base.Center);
44496 }
44497 else if (range > num2 * 8f)
44498 {
44499 SoundEngine.PlaySound(58, base.Center);
44500 }
44501 else if (range > num2 * 7f)
44502 {
44503 SoundEngine.PlaySound(53, base.Center);
44504 }
44505 else if (range > num2 * 6f)
44506 {
44507 SoundEngine.PlaySound(57, base.Center);
44508 }
44509 else if (range > num2 * 5f)
44510 {
44511 SoundEngine.PlaySound(62, base.Center);
44512 }
44513 else if (range > num2 * 4f)
44514 {
44515 SoundEngine.PlaySound(61, base.Center);
44516 }
44517 else if (range > num2 * 3f)
44518 {
44519 SoundEngine.PlaySound(54, base.Center);
44520 }
44521 else if (range > num2 * 2f)
44522 {
44523 SoundEngine.PlaySound(56, base.Center);
44524 }
44525 else if (range > num2 * 1f)
44526 {
44527 SoundEngine.PlaySound(55, base.Center);
44528 }
44529 else
44530 {
44531 SoundEngine.PlaySound(60, base.Center);
44532 }
44533 }
44534
44536 {
44537 if ((sItem.type != 509 && sItem.type != 510 && sItem.type != 849 && sItem.type != 850 && sItem.type != 851 && sItem.type != 3612 && sItem.type != 3620 && sItem.type != 3625) || !(position.X / 16f - (float)tileRangeX - (float)sItem.tileBoost - (float)blockRange <= (float)tileTargetX) || !((position.X + (float)width) / 16f + (float)tileRangeX + (float)sItem.tileBoost - 1f + (float)blockRange >= (float)tileTargetX) || !(position.Y / 16f - (float)tileRangeY - (float)sItem.tileBoost - (float)blockRange <= (float)tileTargetY) || !((position.Y + (float)height) / 16f + (float)tileRangeY + (float)sItem.tileBoost - 2f + (float)blockRange >= (float)tileTargetY))
44538 {
44539 return;
44540 }
44542 {
44543 cursorItemIconEnabled = true;
44545 }
44546 if (!CanDoWireStuffHere(tileTargetX, tileTargetY) || itemAnimation <= 0 || !ItemTimeIsZero || !controlUseItem)
44547 {
44548 return;
44549 }
44550 int num = tileTargetX;
44551 int num2 = tileTargetY;
44552 if (sItem.type == 509)
44553 {
44554 int num3 = -1;
44555 for (int i = 0; i < 58; i++)
44556 {
44557 if (inventory[i].stack > 0 && inventory[i].type == 530)
44558 {
44559 num3 = i;
44560 break;
44561 }
44562 }
44563 if (num3 >= 0 && WorldGen.PlaceWire(num, num2))
44564 {
44565 inventory[num3].stack--;
44566 if (inventory[num3].stack <= 0)
44567 {
44568 inventory[num3].SetDefaults();
44569 }
44570 ApplyItemTime(sItem);
44571 NetMessage.SendData(17, -1, -1, null, 5, tileTargetX, tileTargetY);
44572 }
44573 }
44574 else if (sItem.type == 850)
44575 {
44576 int num4 = -1;
44577 for (int j = 0; j < 58; j++)
44578 {
44579 if (inventory[j].stack > 0 && inventory[j].type == 530)
44580 {
44581 num4 = j;
44582 break;
44583 }
44584 }
44585 if (num4 >= 0 && WorldGen.PlaceWire2(num, num2))
44586 {
44587 inventory[num4].stack--;
44588 if (inventory[num4].stack <= 0)
44589 {
44590 inventory[num4].SetDefaults();
44591 }
44592 ApplyItemTime(sItem);
44593 NetMessage.SendData(17, -1, -1, null, 10, tileTargetX, tileTargetY);
44594 }
44595 }
44596 if (sItem.type == 851)
44597 {
44598 int num5 = -1;
44599 for (int k = 0; k < 58; k++)
44600 {
44601 if (inventory[k].stack > 0 && inventory[k].type == 530)
44602 {
44603 num5 = k;
44604 break;
44605 }
44606 }
44607 if (num5 >= 0 && WorldGen.PlaceWire3(num, num2))
44608 {
44609 inventory[num5].stack--;
44610 if (inventory[num5].stack <= 0)
44611 {
44612 inventory[num5].SetDefaults();
44613 }
44614 ApplyItemTime(sItem);
44615 NetMessage.SendData(17, -1, -1, null, 12, tileTargetX, tileTargetY);
44616 }
44617 }
44618 if (sItem.type == 3612)
44619 {
44620 int num6 = -1;
44621 for (int l = 0; l < 58; l++)
44622 {
44623 if (inventory[l].stack > 0 && inventory[l].type == 530)
44624 {
44625 num6 = l;
44626 break;
44627 }
44628 }
44629 if (num6 >= 0 && WorldGen.PlaceWire4(num, num2))
44630 {
44631 inventory[num6].stack--;
44632 if (inventory[num6].stack <= 0)
44633 {
44634 inventory[num6].SetDefaults();
44635 }
44636 ApplyItemTime(sItem);
44637 NetMessage.SendData(17, -1, -1, null, 16, tileTargetX, tileTargetY);
44638 }
44639 }
44640 else if (sItem.type == 510)
44641 {
44642 if (WorldGen.KillActuator(num, num2))
44643 {
44644 ApplyItemTime(sItem);
44645 NetMessage.SendData(17, -1, -1, null, 9, tileTargetX, tileTargetY);
44646 }
44647 else if (WorldGen.KillWire4(num, num2))
44648 {
44649 ApplyItemTime(sItem);
44650 NetMessage.SendData(17, -1, -1, null, 17, tileTargetX, tileTargetY);
44651 }
44652 else if (WorldGen.KillWire3(num, num2))
44653 {
44654 ApplyItemTime(sItem);
44655 NetMessage.SendData(17, -1, -1, null, 13, tileTargetX, tileTargetY);
44656 }
44657 else if (WorldGen.KillWire2(num, num2))
44658 {
44659 ApplyItemTime(sItem);
44660 NetMessage.SendData(17, -1, -1, null, 11, tileTargetX, tileTargetY);
44661 }
44662 else if (WorldGen.KillWire(num, num2))
44663 {
44664 ApplyItemTime(sItem);
44665 NetMessage.SendData(17, -1, -1, null, 6, tileTargetX, tileTargetY);
44666 }
44667 }
44668 else if (sItem.type == 849 && sItem.stack > 0 && WorldGen.PlaceActuator(num, num2))
44669 {
44670 ApplyItemTime(sItem);
44671 NetMessage.SendData(17, -1, -1, null, 8, tileTargetX, tileTargetY);
44672 sItem.stack--;
44673 if (sItem.stack <= 0)
44674 {
44675 sItem.SetDefaults();
44676 }
44677 }
44678 if (sItem.type == 3620)
44679 {
44680 Tile tile = Main.tile[num, num2];
44681 if (tile != null && tile.actuator())
44682 {
44683 bool flag = tile.inActive();
44684 if ((!ActuationRodLock || ActuationRodLockSetting == tile.inActive()) && Wiring.Actuate(num, num2) && flag != tile.inActive())
44685 {
44686 ActuationRodLock = true;
44687 ActuationRodLockSetting = !tile.inActive();
44688 ApplyItemTime(sItem);
44689 NetMessage.SendData(17, -1, -1, null, 19, tileTargetX, tileTargetY);
44690 }
44691 }
44692 }
44693 if (sItem.type == 3625)
44694 {
44695 Point point = new Point(tileTargetX, tileTargetY);
44696 ApplyItemTime(sItem);
44698 WiresUI.Settings.ToolMode &= ~WiresUI.Settings.MultiToolMode.Actuator;
44699 if (Main.netMode == 1)
44700 {
44701 NetMessage.SendData(109, -1, -1, null, point.X, point.Y, point.X, point.Y, (int)WiresUI.Settings.ToolMode);
44702 }
44703 else
44704 {
44705 Wiring.MassWireOperation(point, point, this);
44706 }
44707 WiresUI.Settings.ToolMode = toolMode;
44708 }
44709 }
44710
44711 public bool CanDoWireStuffHere(int x, int y)
44712 {
44713 if (!WorldGen.InWorld(x, y))
44714 {
44715 return false;
44716 }
44717 if (!NPC.downedGolemBoss && Main.tile[x, y].wall == 87)
44718 {
44719 return false;
44720 }
44721 return true;
44722 }
44723
44725 {
44726 if (sItem.type == 4049 && position.X / 16f - (float)tileRangeX - (float)sItem.tileBoost - (float)blockRange <= (float)tileTargetX && (position.X + (float)width) / 16f + (float)tileRangeX + (float)sItem.tileBoost - 1f + (float)blockRange >= (float)tileTargetX && position.Y / 16f - (float)tileRangeY - (float)sItem.tileBoost - (float)blockRange <= (float)tileTargetY && (position.Y + (float)height) / 16f + (float)tileRangeY + (float)sItem.tileBoost - 2f + (float)blockRange >= (float)tileTargetY && itemAnimation > 0 && ItemTimeIsZero && controlUseItem)
44727 {
44728 MowGrassTile(new Point(tileTargetX, tileTargetY).ToWorldCoordinates());
44729 ApplyItemTime(sItem);
44730 }
44731 }
44732
44734 {
44735 _oldestProjCheckList.Clear();
44736 for (int i = 0; i < 1000; i++)
44737 {
44738 Projectile projectile = Main.projectile[i];
44739 if (projectile.active && projectile.owner == whoAmI)
44740 {
44741 switch (projectile.type)
44742 {
44743 case 135:
44744 case 138:
44745 case 141:
44746 case 144:
44747 case 778:
44748 case 782:
44749 case 786:
44750 case 789:
44751 case 792:
44752 case 795:
44753 case 798:
44754 case 801:
44755 _oldestProjCheckList.Add(projectile);
44756 break;
44757 }
44758 }
44759 }
44760 while (_oldestProjCheckList.Count > minesCap)
44761 {
44762 Projectile projectile2 = _oldestProjCheckList[0];
44763 for (int j = 1; j < _oldestProjCheckList.Count; j++)
44764 {
44765 if (_oldestProjCheckList[j].timeLeft < projectile2.timeLeft)
44766 {
44767 projectile2 = _oldestProjCheckList[j];
44768 }
44769 }
44770 projectile2.Kill();
44771 _oldestProjCheckList.Remove(projectile2);
44772 }
44773 _oldestProjCheckList.Clear();
44774 }
44775
44776 private void ItemCheck_Shoot(int i, Item sItem, int weaponDamage)
44777 {
44778 int projToShoot = sItem.shoot;
44779 float speed = sItem.shootSpeed;
44780 int damage = sItem.damage;
44782 {
44783 speed /= meleeSpeed;
44784 }
44785 bool canShoot = false;
44786 int Damage = weaponDamage;
44787 float KnockBack = sItem.knockBack;
44788 int usedAmmoItemId = 0;
44789 if (sItem.useAmmo > 0)
44790 {
44792 }
44793 else
44794 {
44795 canShoot = true;
44796 }
44797 if (ItemID.Sets.gunProj[sItem.type])
44798 {
44799 KnockBack = sItem.knockBack;
44801 speed = sItem.shootSpeed;
44802 }
44803 if (sItem.IsACoin)
44804 {
44805 canShoot = false;
44806 }
44807 if (sItem.type == 1254 && projToShoot == 14)
44808 {
44809 projToShoot = 242;
44810 }
44811 if (sItem.type == 1255 && projToShoot == 14)
44812 {
44813 projToShoot = 242;
44814 }
44815 if (sItem.type == 1265 && projToShoot == 14)
44816 {
44817 projToShoot = 242;
44818 }
44819 if (sItem.type == 3542)
44820 {
44821 if (Main.rand.Next(100) < 20)
44822 {
44823 projToShoot++;
44824 Damage *= 3;
44825 }
44826 else
44827 {
44828 speed -= 1f;
44829 }
44830 }
44831 if (sItem.type == 1928)
44832 {
44833 Damage = (int)((float)Damage * 1f);
44834 }
44835 if (sItem.type == 3063)
44836 {
44837 Damage = (int)((float)Damage * 1.25f);
44838 }
44839 if (sItem.type == 1306)
44840 {
44841 Damage = (int)((double)Damage * 0.67);
44842 }
44843 if (sItem.type == 1227)
44844 {
44845 Damage = (int)((double)Damage * 0.7);
44846 }
44847 if (!canShoot)
44848 {
44849 return;
44850 }
44851 KnockBack = GetWeaponKnockback(sItem, KnockBack);
44852 IEntitySource projectileSource_Item_WithPotentialAmmo = GetProjectileSource_Item_WithPotentialAmmo(sItem, usedAmmoItemId);
44853 if (projToShoot == 228)
44854 {
44855 KnockBack = 0f;
44856 }
44857 if (projToShoot == 1 && sItem.type == 120)
44858 {
44859 projToShoot = 2;
44860 }
44861 if (sItem.type == 682)
44862 {
44863 projToShoot = 117;
44864 }
44865 if (sItem.type == 725)
44866 {
44867 projToShoot = 120;
44868 }
44869 if (sItem.type == 2796)
44870 {
44871 projToShoot = 442;
44872 }
44873 if (sItem.type == 2223)
44874 {
44875 projToShoot = 357;
44876 }
44877 if (sItem.type == 5117)
44878 {
44879 projToShoot = 968;
44880 }
44881 if (sItem.fishingPole > 0 && overrideFishingBobber > -1)
44882 {
44883 projToShoot = overrideFishingBobber;
44884 }
44885 ApplyItemTime(sItem);
44886 Vector2 pointPoisition = RotatedRelativePoint(MountedCenter);
44887 bool flag = true;
44888 int type = sItem.type;
44889 if (type == 723 || type == 3611)
44890 {
44891 flag = false;
44892 }
44893 Vector2 value = Vector2.UnitX.RotatedBy(fullRotation);
44894 Vector2 vector = Main.MouseWorld - pointPoisition;
44895 Vector2 v = itemRotation.ToRotationVector2() * direction;
44896 if (sItem.type == 3852 && !ItemAnimationJustStarted)
44897 {
44898 vector = (v.ToRotation() + fullRotation).ToRotationVector2();
44899 }
44900 if (vector != Vector2.Zero)
44901 {
44902 vector.Normalize();
44903 }
44904 float num = Vector2.Dot(value, vector);
44905 if (flag)
44906 {
44907 if (num > 0f)
44908 {
44909 ChangeDir(1);
44910 }
44911 else
44912 {
44913 ChangeDir(-1);
44914 }
44915 }
44916 if (sItem.type == 3094 || sItem.type == 3378 || sItem.type == 3543)
44917 {
44918 pointPoisition.Y = position.Y + (float)(height / 3);
44919 }
44920 if (sItem.type == 5117)
44921 {
44922 pointPoisition.Y = position.Y + (float)(height / 3);
44923 }
44924 if (sItem.type == 517)
44925 {
44926 pointPoisition.X += (float)Main.rand.Next(-3, 4) * 3.5f;
44927 pointPoisition.Y += (float)Main.rand.Next(-3, 4) * 3.5f;
44928 }
44929 if (sItem.type == 2611)
44930 {
44932 if (vector2 != Vector2.Zero)
44933 {
44934 vector2.Normalize();
44935 }
44937 }
44938 if (sItem.type == 3827)
44939 {
44940 pointPoisition += vector.SafeNormalize(Vector2.Zero).RotatedBy((float)direction * (-(float)Math.PI / 2f)) * 24f;
44941 }
44942 if (projToShoot == 9)
44943 {
44944 pointPoisition = new Vector2(position.X + (float)width * 0.5f + (float)(Main.rand.Next(201) * -direction) + ((float)Main.mouseX + Main.screenPosition.X - position.X), MountedCenter.Y - 600f);
44945 KnockBack = 0f;
44946 Damage = (int)((float)Damage * 1.5f);
44947 }
44948 if (sItem.type == 986 || sItem.type == 281)
44949 {
44950 pointPoisition.X += 6 * direction;
44951 pointPoisition.Y -= 6f * gravDir;
44952 }
44953 if (sItem.type == 3007)
44954 {
44955 pointPoisition.X -= 4 * direction;
44956 pointPoisition.Y -= 2f * gravDir;
44957 }
44958 float num2 = (float)Main.mouseX + Main.screenPosition.X - pointPoisition.X;
44959 float num3 = (float)Main.mouseY + Main.screenPosition.Y - pointPoisition.Y;
44960 if (sItem.type == 3852 && !ItemAnimationJustStarted)
44961 {
44963 num2 = vector3.X;
44964 num3 = vector3.Y;
44965 }
44966 if (gravDir == -1f)
44967 {
44968 num3 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - pointPoisition.Y;
44969 }
44970 float num4 = (float)Math.Sqrt(num2 * num2 + num3 * num3);
44971 float num5 = num4;
44972 if ((float.IsNaN(num2) && float.IsNaN(num3)) || (num2 == 0f && num3 == 0f))
44973 {
44974 num2 = direction;
44975 num3 = 0f;
44976 num4 = speed;
44977 }
44978 else
44979 {
44980 num4 = speed / num4;
44981 }
44982 if (sItem.type == 1929 || sItem.type == 2270)
44983 {
44984 num2 += (float)Main.rand.Next(-50, 51) * 0.03f / num4;
44985 num3 += (float)Main.rand.Next(-50, 51) * 0.03f / num4;
44986 }
44987 num2 *= num4;
44988 num3 *= num4;
44989 if (projToShoot == 250)
44990 {
44991 for (int j = 0; j < 1000; j++)
44992 {
44993 if (Main.projectile[j].active && Main.projectile[j].owner == whoAmI && (Main.projectile[j].type == 250 || Main.projectile[j].type == 251))
44994 {
44995 Main.projectile[j].Kill();
44996 }
44997 }
44998 }
44999 if (projToShoot == 12 && Collision.CanHitLine(base.Center, 0, 0, pointPoisition + new Vector2(num2, num3) * 4f, 0, 0))
45000 {
45001 pointPoisition += new Vector2(num2, num3) * 3f;
45002 }
45003 if (projToShoot == 728 && !Collision.CanHitLine(base.Center, 0, 0, pointPoisition + new Vector2(num2, num3) * 2f, 0, 0))
45004 {
45005 Vector2 vector4 = new Vector2(num2, num3) * 0.25f;
45006 pointPoisition = base.Center - vector4;
45007 }
45008 if (projToShoot == 85)
45009 {
45010 pointPoisition += new Vector2(0f, -6f * (float)direction * Directions.Y).RotatedBy(vector.ToRotation());
45011 if (Collision.CanHitLine(pointPoisition, 0, 0, pointPoisition + new Vector2(num2, num3) * 5f, 0, 0))
45012 {
45013 pointPoisition += new Vector2(num2, num3) * 4f;
45014 }
45015 }
45016 if (projToShoot == 802 || projToShoot == 842)
45017 {
45018 Vector2 v2 = new Vector2(num2, num3);
45019 float num6 = (float)Math.PI / 4f;
45020 Vector2 vector5 = v2.SafeNormalize(Vector2.Zero).RotatedBy(num6 * (Main.rand.NextFloat() - 0.5f)) * (v2.Length() - Main.rand.NextFloatDirection() * 0.7f);
45021 num2 = vector5.X;
45022 num3 = vector5.Y;
45023 }
45024 if (sItem.useStyle == 5)
45025 {
45026 if (sItem.type == 3029)
45027 {
45029 vector6.X = (float)Main.mouseX + Main.screenPosition.X - pointPoisition.X;
45030 vector6.Y = (float)Main.mouseY + Main.screenPosition.Y - pointPoisition.Y - 1000f;
45031 itemRotation = (float)Math.Atan2(vector6.Y * (float)direction, vector6.X * (float)direction);
45032 NetMessage.SendData(13, -1, -1, null, whoAmI);
45033 NetMessage.SendData(41, -1, -1, null, whoAmI);
45034 }
45035 else if (sItem.type == 4381)
45036 {
45038 vector7.X = (float)Main.mouseX + Main.screenPosition.X - pointPoisition.X;
45039 vector7.Y = (float)Main.mouseY + Main.screenPosition.Y - pointPoisition.Y - 1000f;
45040 itemRotation = (float)Math.Atan2(vector7.Y * (float)direction, vector7.X * (float)direction);
45041 NetMessage.SendData(13, -1, -1, null, whoAmI);
45042 NetMessage.SendData(41, -1, -1, null, whoAmI);
45043 }
45044 else if (sItem.type == 3779)
45045 {
45046 itemRotation = 0f;
45047 NetMessage.SendData(13, -1, -1, null, whoAmI);
45048 NetMessage.SendData(41, -1, -1, null, whoAmI);
45049 }
45050 else
45051 {
45052 itemRotation = (float)Math.Atan2(num3 * (float)direction, num2 * (float)direction) - fullRotation;
45053 NetMessage.SendData(13, -1, -1, null, whoAmI);
45054 NetMessage.SendData(41, -1, -1, null, whoAmI);
45055 }
45056 }
45057 if (sItem.useStyle == 13)
45058 {
45059 itemRotation = (float)Math.Atan2(num3 * (float)direction, num2 * (float)direction) - fullRotation;
45060 NetMessage.SendData(13, -1, -1, null, whoAmI);
45061 NetMessage.SendData(41, -1, -1, null, whoAmI);
45062 }
45063 if (projToShoot == 17)
45064 {
45065 pointPoisition.X = (float)Main.mouseX + Main.screenPosition.X;
45066 pointPoisition.Y = (float)Main.mouseY + Main.screenPosition.Y;
45067 if (gravDir == -1f)
45068 {
45069 pointPoisition.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
45070 }
45071 LimitPointToPlayerReachableArea(ref pointPoisition);
45072 }
45073 if (projToShoot == 76)
45074 {
45075 projToShoot += Main.rand.Next(3);
45076 float num7 = (float)Main.screenHeight / Main.GameViewMatrix.Zoom.Y;
45077 num5 /= num7 / 2f;
45078 if (num5 > 1f)
45079 {
45080 num5 = 1f;
45081 }
45082 float num8 = num2 + (float)Main.rand.Next(-40, 41) * 0.01f;
45083 float num9 = num3 + (float)Main.rand.Next(-40, 41) * 0.01f;
45084 num8 *= num5 + 0.25f;
45085 num9 *= num5 + 0.25f;
45087 Main.projectile[num10].ai[1] = 1f;
45088 num5 = num5 * 2f - 1f;
45089 if (num5 < -1f)
45090 {
45091 num5 = -1f;
45092 }
45093 if (num5 > 1f)
45094 {
45095 num5 = 1f;
45096 }
45097 num5 = (float)Math.Round(num5 * (float)musicNotes);
45098 num5 /= (float)musicNotes;
45099 Main.projectile[num10].ai[0] = num5;
45100 NetMessage.SendData(27, -1, -1, null, num10);
45101 }
45102 else if (sItem.type == 3029)
45103 {
45104 int num11 = 3;
45105 if (projToShoot == 91 || projToShoot == 4 || projToShoot == 5 || projToShoot == 41)
45106 {
45107 if (Main.rand.Next(3) == 0)
45108 {
45109 num11--;
45110 }
45111 }
45112 else if (Main.rand.Next(3) == 0)
45113 {
45114 num11++;
45115 }
45116 for (int k = 0; k < num11; k++)
45117 {
45118 pointPoisition = new Vector2(position.X + (float)width * 0.5f + (float)(Main.rand.Next(201) * -direction) + ((float)Main.mouseX + Main.screenPosition.X - position.X), MountedCenter.Y - 600f);
45119 pointPoisition.X = (pointPoisition.X * 10f + base.Center.X) / 11f + (float)Main.rand.Next(-100, 101);
45120 pointPoisition.Y -= 150 * k;
45123 if (num3 < 0f)
45124 {
45125 num3 *= -1f;
45126 }
45127 if (num3 < 20f)
45128 {
45129 num3 = 20f;
45130 }
45131 num4 = (float)Math.Sqrt(num2 * num2 + num3 * num3);
45132 num4 = speed / num4;
45133 num2 *= num4;
45134 num3 *= num4;
45135 float num12 = num2 + (float)Main.rand.Next(-40, 41) * 0.03f;
45136 float speedY = num3 + (float)Main.rand.Next(-40, 41) * 0.03f;
45137 num12 *= (float)Main.rand.Next(75, 150) * 0.01f;
45138 pointPoisition.X += Main.rand.Next(-50, 51);
45140 Main.projectile[num13].noDropItem = true;
45141 }
45142 }
45143 else if (sItem.type == 4381)
45144 {
45145 int num14 = Main.rand.Next(1, 3);
45146 if (Main.rand.Next(3) == 0)
45147 {
45148 num14++;
45149 }
45150 for (int l = 0; l < num14; l++)
45151 {
45152 pointPoisition = new Vector2(position.X + (float)width * 0.5f + (float)(Main.rand.Next(61) * -direction) + ((float)Main.mouseX + Main.screenPosition.X - position.X), MountedCenter.Y - 600f);
45153 pointPoisition.X = (pointPoisition.X * 10f + base.Center.X) / 11f + (float)Main.rand.Next(-30, 31);
45154 pointPoisition.Y -= 150f * Main.rand.NextFloat();
45157 if (num3 < 0f)
45158 {
45159 num3 *= -1f;
45160 }
45161 if (num3 < 20f)
45162 {
45163 num3 = 20f;
45164 }
45165 num4 = (float)Math.Sqrt(num2 * num2 + num3 * num3);
45166 num4 = speed / num4;
45167 num2 *= num4;
45168 num3 *= num4;
45169 float num15 = num2 + (float)Main.rand.Next(-20, 21) * 0.03f;
45170 float speedY2 = num3 + (float)Main.rand.Next(-40, 41) * 0.03f;
45171 num15 *= (float)Main.rand.Next(55, 80) * 0.01f;
45172 pointPoisition.X += Main.rand.Next(-50, 51);
45174 Main.projectile[num16].noDropItem = true;
45175 }
45176 }
45177 else if (sItem.type == 98 || sItem.type == 533)
45178 {
45179 float speedX = num2 + (float)Main.rand.Next(-40, 41) * 0.01f;
45180 float speedY3 = num3 + (float)Main.rand.Next(-40, 41) * 0.01f;
45182 }
45183 else if (sItem.type == 1319)
45184 {
45185 float speedX2 = num2 + (float)Main.rand.Next(-40, 41) * 0.02f;
45186 float speedY4 = num3 + (float)Main.rand.Next(-40, 41) * 0.02f;
45188 }
45189 else if (sItem.type == 3107)
45190 {
45191 float speedX3 = num2 + (float)Main.rand.Next(-40, 41) * 0.02f;
45192 float speedY5 = num3 + (float)Main.rand.Next(-40, 41) * 0.02f;
45194 }
45196 {
45198 Vector2 vector9 = vector8 - base.Center;
45199 bool flag2 = false;
45200 if (vector9.Length() < 100f)
45201 {
45202 flag2 = TryPlacingAGolfBallNearANearbyTee(vector8);
45203 }
45204 if (!flag2)
45205 {
45206 if (vector9.Length() > 100f || !Collision.CanHit(base.Center, 1, 1, vector8, 1, 1))
45207 {
45209 }
45210 else
45211 {
45213 }
45214 }
45215 }
45216 else if (sItem.type == 3053)
45217 {
45218 bool flag3 = false;
45219 if (itemAnimation <= sItem.useTime + 1)
45220 {
45221 flag3 = true;
45222 }
45224 vector10.Normalize();
45225 vector10 *= 4f;
45226 if (!flag3)
45227 {
45228 Vector2 vector11 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
45229 vector11.Normalize();
45230 vector10 += vector11;
45231 }
45232 vector10.Normalize();
45233 vector10 *= sItem.shootSpeed;
45234 float num17 = (float)Main.rand.Next(10, 80) * 0.001f;
45235 if (Main.rand.Next(2) == 0)
45236 {
45237 num17 *= -1f;
45238 }
45239 float num18 = (float)Main.rand.Next(10, 80) * 0.001f;
45240 if (Main.rand.Next(2) == 0)
45241 {
45242 num18 *= -1f;
45243 }
45244 if (flag3)
45245 {
45246 num18 = (num17 = 0f);
45247 }
45249 }
45250 else if (sItem.type == 3019)
45251 {
45253 float num19 = vector12.Length();
45254 vector12.X += (float)Main.rand.Next(-100, 101) * 0.01f * num19 * 0.15f;
45255 vector12.Y += (float)Main.rand.Next(-100, 101) * 0.01f * num19 * 0.15f;
45256 float num20 = num2 + (float)Main.rand.Next(-40, 41) * 0.03f;
45257 float num21 = num3 + (float)Main.rand.Next(-40, 41) * 0.03f;
45258 vector12.Normalize();
45259 vector12 *= num19;
45260 num20 *= (float)Main.rand.Next(50, 150) * 0.01f;
45261 num21 *= (float)Main.rand.Next(50, 150) * 0.01f;
45263 vector13.X += (float)Main.rand.Next(-100, 101) * 0.025f;
45264 vector13.Y += (float)Main.rand.Next(-100, 101) * 0.025f;
45265 vector13.Normalize();
45266 vector13 *= num19;
45267 num20 = vector13.X;
45268 num21 = vector13.Y;
45270 }
45271 else if (sItem.type == 2797)
45272 {
45273 Vector2 vector14 = Vector2.Normalize(new Vector2(num2, num3)) * 40f * sItem.scale;
45275 {
45277 }
45278 float ai = new Vector2(num2, num3).ToRotation();
45279 float num22 = (float)Math.PI * 2f / 3f;
45280 int num23 = Main.rand.Next(4, 5);
45281 if (Main.rand.Next(4) == 0)
45282 {
45283 num23++;
45284 }
45285 for (int m = 0; m < num23; m++)
45286 {
45287 float num24 = (float)Main.rand.NextDouble() * 0.2f + 0.05f;
45288 Vector2 vector15 = new Vector2(num2, num3).RotatedBy(num22 * (float)Main.rand.NextDouble() - num22 / 2f) * num24;
45290 Main.projectile[num25].localAI[0] = projToShoot;
45291 Main.projectile[num25].localAI[1] = speed;
45292 }
45293 }
45294 else if (sItem.type == 2270)
45295 {
45296 float num26 = num2 + (float)Main.rand.Next(-40, 41) * 0.05f;
45297 float num27 = num3 + (float)Main.rand.Next(-40, 41) * 0.05f;
45298 if (Main.rand.Next(3) == 0)
45299 {
45300 num26 *= 1f + (float)Main.rand.Next(-30, 31) * 0.02f;
45301 num27 *= 1f + (float)Main.rand.Next(-30, 31) * 0.02f;
45302 }
45304 }
45305 else if (sItem.type == 5117)
45306 {
45307 float speedX4 = num2 + (float)Main.rand.Next(-15, 16) * 0.075f;
45308 float speedY6 = num3 + (float)Main.rand.Next(-15, 16) * 0.075f;
45309 int num28 = Main.rand.Next(Main.projFrames[sItem.shoot]);
45310 int damage2 = Damage;
45312 }
45313 else if (sItem.type == 1930)
45314 {
45315 int num29 = 2 + Main.rand.Next(3);
45316 for (int n = 0; n < num29; n++)
45317 {
45318 float num30 = num2;
45319 float num31 = num3;
45320 float num32 = 0.025f * (float)n;
45321 num30 += (float)Main.rand.Next(-35, 36) * num32;
45322 num31 += (float)Main.rand.Next(-35, 36) * num32;
45323 num4 = (float)Math.Sqrt(num30 * num30 + num31 * num31);
45324 num4 = speed / num4;
45325 num30 *= num4;
45326 num31 *= num4;
45327 float x = pointPoisition.X + num2 * (float)(num29 - n) * 1.75f;
45328 float y = pointPoisition.Y + num3 * (float)(num29 - n) * 1.75f;
45330 }
45331 }
45332 else if (sItem.type == 1931)
45333 {
45334 int num33 = 2;
45335 for (int num34 = 0; num34 < num33; num34++)
45336 {
45337 pointPoisition = new Vector2(position.X + (float)width * 0.5f + (float)(Main.rand.Next(201) * -direction) + ((float)Main.mouseX + Main.screenPosition.X - position.X), MountedCenter.Y - 600f);
45338 pointPoisition.X = (pointPoisition.X + base.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
45339 pointPoisition.Y -= 100 * num34;
45342 if (gravDir == -1f)
45343 {
45344 num3 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - pointPoisition.Y;
45345 }
45346 if (num3 < 0f)
45347 {
45348 num3 *= -1f;
45349 }
45350 if (num3 < 20f)
45351 {
45352 num3 = 20f;
45353 }
45354 num4 = (float)Math.Sqrt(num2 * num2 + num3 * num3);
45355 num4 = speed / num4;
45356 num2 *= num4;
45357 num3 *= num4;
45358 float speedX5 = num2 + (float)Main.rand.Next(-40, 41) * 0.02f;
45359 float speedY7 = num3 + (float)Main.rand.Next(-40, 41) * 0.02f;
45361 }
45362 }
45363 else if (sItem.type == 2750)
45364 {
45365 int num35 = 1;
45366 for (int num36 = 0; num36 < num35; num36++)
45367 {
45368 pointPoisition = new Vector2(position.X + (float)width * 0.5f + (float)(Main.rand.Next(201) * -direction) + ((float)Main.mouseX + Main.screenPosition.X - position.X), MountedCenter.Y - 600f);
45369 pointPoisition.X = (pointPoisition.X + base.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
45370 pointPoisition.Y -= 100 * num36;
45371 num2 = (float)Main.mouseX + Main.screenPosition.X - pointPoisition.X + (float)Main.rand.Next(-40, 41) * 0.03f;
45373 if (gravDir == -1f)
45374 {
45375 num3 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - pointPoisition.Y;
45376 }
45377 if (num3 < 0f)
45378 {
45379 num3 *= -1f;
45380 }
45381 if (num3 < 20f)
45382 {
45383 num3 = 20f;
45384 }
45385 num4 = (float)Math.Sqrt(num2 * num2 + num3 * num3);
45386 num4 = speed / num4;
45387 num2 *= num4;
45388 num3 *= num4;
45389 float num37 = num2;
45390 float num38 = num3 + (float)Main.rand.Next(-40, 41) * 0.02f;
45391 Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, pointPoisition.X, pointPoisition.Y, num37 * 0.75f, num38 * 0.75f, projToShoot + Main.rand.Next(3), Damage, KnockBack, i, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f);
45392 }
45393 }
45394 else if (sItem.type == 3570)
45395 {
45396 int num39 = 3;
45397 for (int num40 = 0; num40 < num39; num40++)
45398 {
45399 pointPoisition = new Vector2(position.X + (float)width * 0.5f + (float)(Main.rand.Next(201) * -direction) + ((float)Main.mouseX + Main.screenPosition.X - position.X), MountedCenter.Y - 600f);
45400 pointPoisition.X = (pointPoisition.X + base.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
45401 pointPoisition.Y -= 100 * num40;
45404 float ai2 = num3 + pointPoisition.Y;
45405 if (num3 < 0f)
45406 {
45407 num3 *= -1f;
45408 }
45409 if (num3 < 20f)
45410 {
45411 num3 = 20f;
45412 }
45413 num4 = (float)Math.Sqrt(num2 * num2 + num3 * num3);
45414 num4 = speed / num4;
45415 num2 *= num4;
45416 num3 *= num4;
45417 Vector2 vector16 = new Vector2(num2, num3) / 2f;
45419 }
45420 }
45421 else if (sItem.type == 5065)
45422 {
45423 Vector2 farthestSpawnPositionOnLine = GetFarthestSpawnPositionOnLine(pointPoisition, num2, num3);
45426 }
45427 else if (sItem.type == 3065)
45428 {
45429 Vector2 vector17 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY);
45430 float num41 = vector17.Y;
45431 if (num41 > base.Center.Y - 200f)
45432 {
45433 num41 = base.Center.Y - 200f;
45434 }
45435 for (int num42 = 0; num42 < 3; num42++)
45436 {
45437 pointPoisition = base.Center + new Vector2(-Main.rand.Next(0, 401) * direction, -600f);
45438 pointPoisition.Y -= 100 * num42;
45440 if (vector18.Y < 0f)
45441 {
45442 vector18.Y *= -1f;
45443 }
45444 if (vector18.Y < 20f)
45445 {
45446 vector18.Y = 20f;
45447 }
45448 vector18.Normalize();
45449 vector18 *= speed;
45450 num2 = vector18.X;
45451 num3 = vector18.Y;
45452 float speedX6 = num2;
45453 float speedY8 = num3 + (float)Main.rand.Next(-40, 41) * 0.02f;
45455 }
45456 }
45457 else if (sItem.type == 2624)
45458 {
45459 float num43 = (float)Math.PI / 10f;
45460 int num44 = 5;
45462 vector19.Normalize();
45463 vector19 *= 40f;
45465 for (int num45 = 0; num45 < num44; num45++)
45466 {
45467 float num46 = (float)num45 - ((float)num44 - 1f) / 2f;
45468 Vector2 vector20 = vector19.RotatedBy(num43 * num46);
45469 if (!flag4)
45470 {
45471 vector20 -= vector19;
45472 }
45474 Main.projectile[num47].noDropItem = true;
45475 }
45476 }
45477 else if (sItem.type == 1929)
45478 {
45479 float speedX7 = num2 + (float)Main.rand.Next(-40, 41) * 0.03f;
45480 float speedY9 = num3 + (float)Main.rand.Next(-40, 41) * 0.03f;
45482 }
45483 else if (sItem.type == 1553)
45484 {
45485 float speedX8 = num2 + (float)Main.rand.Next(-40, 41) * 0.005f;
45486 float speedY10 = num3 + (float)Main.rand.Next(-40, 41) * 0.005f;
45488 }
45489 else if (sItem.type == 518)
45490 {
45491 float num48 = num2;
45492 float num49 = num3;
45493 num48 += (float)Main.rand.Next(-40, 41) * 0.04f;
45494 num49 += (float)Main.rand.Next(-40, 41) * 0.04f;
45496 }
45497 else if (sItem.type == 1265)
45498 {
45499 float num50 = num2;
45500 float num51 = num3;
45501 num50 += (float)Main.rand.Next(-30, 31) * 0.03f;
45502 num51 += (float)Main.rand.Next(-30, 31) * 0.03f;
45504 }
45505 else if (sItem.type == 4262)
45506 {
45507 float num52 = 2.6666667f;
45508 _ = base.Bottom;
45509 _ = (int)base.Bottom.X / 16;
45510 int num53 = 4;
45511 float num54 = Math.Abs((float)Main.mouseX + Main.screenPosition.X - position.X) / 16f;
45512 if (direction < 0)
45513 {
45514 num54 += 1f;
45515 }
45516 num53 = (int)num54;
45517 if (num53 > 15)
45518 {
45519 num53 = 15;
45520 }
45521 Point point = base.Center.ToTileCoordinates();
45522 int maxDistance = 31;
45523 for (int num55 = num53; num55 >= 0; num55--)
45524 {
45525 if (Collision.CanHitLine(base.Center, 1, 1, base.Center + new Vector2(16 * num55 * direction, 0f), 1, 1) && WorldUtils.Find(new Point(point.X + direction * num55, point.Y), Searches.Chain(new Searches.Down(maxDistance), new Conditions.MysticSnake()), out var result))
45526 {
45527 int num56 = result.Y;
45528 while (Main.tile[result.X, num56 - 1].active())
45529 {
45530 num56--;
45531 if (Main.tile[result.X, num56 - 1] == null || num56 < 10 || result.Y - num56 > 7)
45532 {
45533 num56 = -1;
45534 break;
45535 }
45536 }
45537 if (num56 >= 10)
45538 {
45539 result.Y = num56;
45540 for (int num57 = 0; num57 < 1000; num57++)
45541 {
45542 Projectile projectile = Main.projectile[num57];
45543 if (projectile.active && projectile.owner == whoAmI && projectile.type == projToShoot)
45544 {
45545 if (projectile.ai[1] == 2f)
45546 {
45547 projectile.timeLeft = 4;
45548 }
45549 else
45550 {
45551 projectile.Kill();
45552 }
45553 }
45554 }
45555 Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, result.X * 16 + 8, result.Y * 16 + 8 - 16, 0f, 0f - num52, projToShoot, Damage, KnockBack, i, result.Y * 16 + 8 - 16);
45556 break;
45557 }
45558 }
45559 }
45560 }
45561 else if (sItem.type == 4952)
45562 {
45563 Vector2 vector21 = Main.rand.NextVector2Circular(1f, 1f) + Main.rand.NextVector2CircularEdge(3f, 3f);
45564 if (vector21.Y > 0f)
45565 {
45566 vector21.Y *= -1f;
45567 }
45568 float num58 = (float)itemAnimation / (float)itemAnimationMax * 0.66f + miscCounterNormalized;
45569 pointPoisition = MountedCenter + new Vector2(direction * 15, gravDir * 3f);
45570 Point point2 = pointPoisition.ToTileCoordinates();
45571 Tile tile = Main.tile[point2.X, point2.Y];
45572 if (tile != null && tile.nactive() && Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type] && !TileID.Sets.Platforms[tile.type])
45573 {
45574 pointPoisition = MountedCenter;
45575 }
45577 }
45578 else if (sItem.type == 4953)
45579 {
45580 float num59 = (float)Math.PI / 10f;
45581 int num60 = 5;
45583 vector22.Normalize();
45584 vector22 *= 40f;
45586 int num62 = (itemAnimationMax - itemAnimation) / 2;
45587 int num63 = num62;
45588 if (direction == 1)
45589 {
45590 num63 = 4 - num62;
45591 }
45592 float num64 = (float)num63 - ((float)num60 - 1f) / 2f;
45593 Vector2 vector23 = vector22.RotatedBy(num59 * num64);
45594 if (!num61)
45595 {
45596 vector23 -= vector22;
45597 }
45599 Vector2 origin = pointPoisition + vector23;
45600 Vector2 vector24 = origin.DirectionTo(mouseWorld).SafeNormalize(-Vector2.UnitY);
45601 Vector2 value2 = base.Center.DirectionTo(base.Center + new Vector2(num2, num3)).SafeNormalize(-Vector2.UnitY);
45602 float lerpValue = Utils.GetLerpValue(100f, 40f, mouseWorld.Distance(base.Center), clamped: true);
45603 if (lerpValue > 0f)
45604 {
45605 vector24 = Vector2.Lerp(vector24, value2, lerpValue).SafeNormalize(new Vector2(num2, num3).SafeNormalize(-Vector2.UnitY));
45606 }
45608 if (num62 == 2)
45609 {
45610 projToShoot = 932;
45611 Damage *= 2;
45612 }
45613 if (projToShoot == 932)
45614 {
45615 float ai3 = miscCounterNormalized * 12f % 1f;
45616 v3 = v3.SafeNormalize(Vector2.Zero) * (speed * 2f);
45618 }
45619 else
45620 {
45622 Main.projectile[num65].noDropItem = true;
45623 }
45624 }
45625 else if (sItem.type == 534)
45626 {
45627 int num66 = Main.rand.Next(4, 6);
45628 for (int num67 = 0; num67 < num66; num67++)
45629 {
45630 float num68 = num2;
45631 float num69 = num3;
45632 num68 += (float)Main.rand.Next(-40, 41) * 0.05f;
45633 num69 += (float)Main.rand.Next(-40, 41) * 0.05f;
45635 }
45636 }
45637 else if (sItem.type == 4703)
45638 {
45639 float num70 = (float)Math.PI / 2f;
45641 for (int num71 = 0; num71 < 7; num71++)
45642 {
45643 Vector2 v4 = new Vector2(num2, num3);
45644 float num72 = v4.Length();
45645 v4 += v4.SafeNormalize(Vector2.Zero).RotatedBy(num70 * Main.rand.NextFloat()) * Main.rand.NextFloatDirection() * 5f;
45646 v4 = v4.SafeNormalize(Vector2.Zero) * num72;
45647 float x2 = v4.X;
45648 float y2 = v4.Y;
45649 x2 += (float)Main.rand.Next(-40, 41) * 0.05f;
45650 y2 += (float)Main.rand.Next(-40, 41) * 0.05f;
45652 }
45653 }
45654 else if (sItem.type == 4270)
45655 {
45657 LimitPointToPlayerReachableArea(ref pointPoisition2);
45658 Vector2 vector25 = pointPoisition2 + Main.rand.NextVector2Circular(8f, 8f);
45659 Vector2 vector26 = FindSharpTearsSpot(vector25).ToWorldCoordinates(Main.rand.Next(17), Main.rand.Next(17));
45660 Vector2 vector27 = (vector25 - vector26).SafeNormalize(-Vector2.UnitY) * 16f;
45662 }
45663 else if (sItem.type == 4715)
45664 {
45667 bool sparkleGuitarTarget = GetSparkleGuitarTarget(out validTargets);
45669 {
45671 vector28 = nPC.Center + nPC.velocity * 20f;
45672 }
45673 Vector2 vector29 = vector28 - base.Center;
45675 {
45676 vector28 += Main.rand.NextVector2Circular(24f, 24f);
45677 if (vector29.Length() > 700f)
45678 {
45679 vector29 *= 700f / vector29.Length();
45680 vector28 = base.Center + vector29;
45681 }
45682 }
45683 Vector2 vector30 = Main.rand.NextVector2CircularEdge(1f, 1f);
45684 if (vector30.Y > 0f)
45685 {
45686 vector30 *= -1f;
45687 }
45688 if (Math.Abs(vector30.Y) < 0.5f)
45689 {
45690 vector30.Y = (0f - Main.rand.NextFloat()) * 0.5f - 0.5f;
45691 }
45692 vector30 *= vector29.Length() * 2f;
45694 }
45695 else if (sItem.type == 4722)
45696 {
45699 bool sparkleGuitarTarget2 = GetSparkleGuitarTarget(out validTargets2);
45701 {
45703 vector31 = nPC2.Center + nPC2.velocity * 20f;
45704 }
45705 Vector2 vector32 = vector31 - base.Center;
45706 Vector2 vector33 = Main.rand.NextVector2CircularEdge(1f, 1f);
45707 float num73 = 1f;
45708 int num74 = 1;
45709 for (int num75 = 0; num75 < num74; num75++)
45710 {
45712 {
45713 vector31 += Main.rand.NextVector2Circular(24f, 24f);
45714 if (vector32.Length() > 700f)
45715 {
45716 vector32 *= 700f / vector32.Length();
45717 vector31 = base.Center + vector32;
45718 }
45719 float num76 = Utils.GetLerpValue(0f, 6f, velocity.Length(), clamped: true) * 0.8f;
45720 vector33 *= 1f - num76;
45721 vector33 += velocity * num76;
45722 vector33 = vector33.SafeNormalize(Vector2.UnitX);
45723 }
45724 float num77 = 60f;
45725 float num78 = Main.rand.NextFloatDirection() * (float)Math.PI * (1f / num77) * 0.5f * num73;
45726 float num79 = num77 / 2f;
45727 float num80 = 12f + Main.rand.NextFloat() * 2f;
45729 Vector2 vector35 = new Vector2(0f, 0f);
45731 for (int num81 = 0; (float)num81 < num79; num81++)
45732 {
45733 vector35 += vector36;
45734 vector36 = vector36.RotatedBy(num78);
45735 }
45738 float lerpValue2 = Utils.GetLerpValue(itemAnimationMax, 0f, itemAnimation, clamped: true);
45740 }
45741 }
45742 else if (sItem.type == 4607)
45743 {
45744 SpawnMinionOnCursor(projectileSource_Item_WithPotentialAmmo, i, projToShoot, damage, KnockBack);
45745 }
45746 else if (sItem.type == 5069)
45747 {
45748 SpawnMinionOnCursor(projectileSource_Item_WithPotentialAmmo, i, projToShoot, damage, KnockBack);
45749 }
45750 else if (sItem.type == 5114)
45751 {
45752 SpawnMinionOnCursor(projectileSource_Item_WithPotentialAmmo, i, projToShoot, damage, KnockBack);
45753 }
45754 else if (sItem.type == 2188)
45755 {
45756 int num82 = 4;
45757 if (Main.rand.Next(3) == 0)
45758 {
45759 num82++;
45760 }
45761 if (Main.rand.Next(4) == 0)
45762 {
45763 num82++;
45764 }
45765 if (Main.rand.Next(5) == 0)
45766 {
45767 num82++;
45768 }
45769 for (int num83 = 0; num83 < num82; num83++)
45770 {
45771 float num84 = num2;
45772 float num85 = num3;
45773 float num86 = 0.05f * (float)num83;
45774 num84 += (float)Main.rand.Next(-35, 36) * num86;
45775 num85 += (float)Main.rand.Next(-35, 36) * num86;
45776 num4 = (float)Math.Sqrt(num84 * num84 + num85 * num85);
45777 num4 = speed / num4;
45778 num84 *= num4;
45779 num85 *= num4;
45780 float x3 = pointPoisition.X;
45781 float y3 = pointPoisition.Y;
45783 }
45784 }
45785 else if (sItem.type == 1308)
45786 {
45787 int num87 = 3;
45788 if (Main.rand.Next(3) == 0)
45789 {
45790 num87++;
45791 }
45792 for (int num88 = 0; num88 < num87; num88++)
45793 {
45794 float num89 = num2;
45795 float num90 = num3;
45796 float num91 = 0.05f * (float)num88;
45797 num89 += (float)Main.rand.Next(-35, 36) * num91;
45798 num90 += (float)Main.rand.Next(-35, 36) * num91;
45799 num4 = (float)Math.Sqrt(num89 * num89 + num90 * num90);
45800 num4 = speed / num4;
45801 num89 *= num4;
45802 num90 *= num4;
45803 float x4 = pointPoisition.X;
45804 float y4 = pointPoisition.Y;
45806 }
45807 }
45808 else if (sItem.type == 1258)
45809 {
45810 float num92 = num2;
45811 float num93 = num3;
45812 num92 += (float)Main.rand.Next(-40, 41) * 0.01f;
45813 num93 += (float)Main.rand.Next(-40, 41) * 0.01f;
45814 pointPoisition.X += (float)Main.rand.Next(-40, 41) * 0.05f;
45815 pointPoisition.Y += (float)Main.rand.Next(-45, 36) * 0.05f;
45817 }
45818 else if (sItem.type == 964)
45819 {
45820 int num94 = Main.rand.Next(3, 5);
45821 for (int num95 = 0; num95 < num94; num95++)
45822 {
45823 float num96 = num2;
45824 float num97 = num3;
45825 num96 += (float)Main.rand.Next(-35, 36) * 0.04f;
45826 num97 += (float)Main.rand.Next(-35, 36) * 0.04f;
45828 }
45829 }
45830 else if (sItem.type == 1569)
45831 {
45832 int num98 = 4;
45833 if (Main.rand.Next(2) == 0)
45834 {
45835 num98++;
45836 }
45837 if (Main.rand.Next(4) == 0)
45838 {
45839 num98++;
45840 }
45841 if (Main.rand.Next(8) == 0)
45842 {
45843 num98++;
45844 }
45845 if (Main.rand.Next(16) == 0)
45846 {
45847 num98++;
45848 }
45849 for (int num99 = 0; num99 < num98; num99++)
45850 {
45851 float num100 = num2;
45852 float num101 = num3;
45853 float num102 = 0.05f * (float)num99;
45854 num100 += (float)Main.rand.Next(-35, 36) * num102;
45855 num101 += (float)Main.rand.Next(-35, 36) * num102;
45856 num4 = (float)Math.Sqrt(num100 * num100 + num101 * num101);
45857 num4 = speed / num4;
45858 num100 *= num4;
45859 num101 *= num4;
45860 float x5 = pointPoisition.X;
45861 float y5 = pointPoisition.Y;
45863 }
45864 }
45865 else if (sItem.type == 1572 || sItem.type == 2366 || sItem.type == 3571 || sItem.type == 3569 || sItem.type == 5119)
45866 {
45867 bool num103 = sItem.type == 3571 || sItem.type == 3569;
45868 int num104 = (int)((float)Main.mouseX + Main.screenPosition.X) / 16;
45869 int num105 = (int)((float)Main.mouseY + Main.screenPosition.Y) / 16;
45870 if (gravDir == -1f)
45871 {
45872 num105 = (int)(Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16;
45873 }
45874 if (!num103)
45875 {
45876 for (; num105 < Main.maxTilesY - 10 && Main.tile[num104, num105] != null && !WorldGen.SolidTile2(num104, num105) && Main.tile[num104 - 1, num105] != null && !WorldGen.SolidTile2(num104 - 1, num105) && Main.tile[num104 + 1, num105] != null && !WorldGen.SolidTile2(num104 + 1, num105); num105++)
45877 {
45878 }
45879 num105--;
45880 }
45881 int num106 = 0;
45882 switch (sItem.type)
45883 {
45884 case 1572:
45885 num106 = 60;
45886 break;
45887 case 5119:
45888 num106 = 90;
45889 break;
45890 }
45892 Main.projectile[num107].originalDamage = damage;
45893 UpdateMaxTurrets();
45894 }
45895 else if (sItem.type == 1244 || sItem.type == 1256)
45896 {
45898 Main.projectile[num108].ai[0] = (float)Main.mouseX + Main.screenPosition.X;
45899 Main.projectile[num108].ai[1] = (float)Main.mouseY + Main.screenPosition.Y;
45900 }
45901 else if (sItem.type == 1229)
45902 {
45903 int num109 = 2;
45904 if (Main.rand.Next(3) == 0)
45905 {
45906 num109++;
45907 }
45908 for (int num110 = 0; num110 < num109; num110++)
45909 {
45910 float num111 = num2;
45911 float num112 = num3;
45912 if (num110 > 0)
45913 {
45914 num111 += (float)Main.rand.Next(-35, 36) * 0.04f;
45915 num112 += (float)Main.rand.Next(-35, 36) * 0.04f;
45916 }
45917 if (num110 > 1)
45918 {
45919 num111 += (float)Main.rand.Next(-35, 36) * 0.04f;
45920 num112 += (float)Main.rand.Next(-35, 36) * 0.04f;
45921 }
45922 if (num110 > 2)
45923 {
45924 num111 += (float)Main.rand.Next(-35, 36) * 0.04f;
45925 num112 += (float)Main.rand.Next(-35, 36) * 0.04f;
45926 }
45928 Main.projectile[num113].noDropItem = true;
45929 }
45930 }
45931 else if (sItem.type == 1121)
45932 {
45933 int num114 = Main.rand.Next(1, 4);
45934 if (Main.rand.Next(6) == 0)
45935 {
45936 num114++;
45937 }
45938 if (Main.rand.Next(6) == 0)
45939 {
45940 num114++;
45941 }
45942 if (strongBees && Main.rand.Next(3) == 0)
45943 {
45944 num114++;
45945 }
45946 for (int num115 = 0; num115 < num114; num115++)
45947 {
45948 float num116 = num2;
45949 float num117 = num3;
45950 num116 += (float)Main.rand.Next(-35, 36) * 0.02f;
45951 num117 += (float)Main.rand.Next(-35, 36) * 0.02f;
45953 Main.projectile[num118].magic = true;
45954 }
45955 }
45956 else if (sItem.type == 1155)
45957 {
45958 int num119 = Main.rand.Next(2, 5);
45959 for (int num120 = 0; num120 < num119; num120++)
45960 {
45961 float num121 = num2;
45962 float num122 = num3;
45963 num121 += (float)Main.rand.Next(-35, 36) * 0.02f;
45964 num122 += (float)Main.rand.Next(-35, 36) * 0.02f;
45966 }
45967 }
45968 else if (sItem.type == 1801)
45969 {
45970 int num123 = Main.rand.Next(2, 4);
45971 for (int num124 = 0; num124 < num123; num124++)
45972 {
45973 float num125 = num2;
45974 float num126 = num3;
45975 num125 += (float)Main.rand.Next(-35, 36) * 0.05f;
45976 num126 += (float)Main.rand.Next(-35, 36) * 0.05f;
45978 }
45979 }
45980 else if (sItem.type == 679)
45981 {
45982 for (int num127 = 0; num127 < 6; num127++)
45983 {
45984 float num128 = num2;
45985 float num129 = num3;
45986 num128 += (float)Main.rand.Next(-40, 41) * 0.05f;
45987 num129 += (float)Main.rand.Next(-40, 41) * 0.05f;
45989 }
45990 }
45991 else if (sItem.type == 1156)
45992 {
45993 for (int num130 = 0; num130 < 3; num130++)
45994 {
45995 float num131 = num2;
45996 float num132 = num3;
45997 num131 += (float)Main.rand.Next(-40, 41) * 0.05f;
45998 num132 += (float)Main.rand.Next(-40, 41) * 0.05f;
46000 }
46001 }
46002 else if (sItem.type == 4682)
46003 {
46004 for (int num133 = 0; num133 < 3; num133++)
46005 {
46006 float num134 = num2;
46007 float num135 = num3;
46008 num134 += (float)Main.rand.Next(-20, 21) * 0.1f;
46009 num135 += (float)Main.rand.Next(-20, 21) * 0.1f;
46011 }
46012 }
46013 else if (sItem.type == 2623)
46014 {
46015 for (int num136 = 0; num136 < 3; num136++)
46016 {
46017 float num137 = num2;
46018 float num138 = num3;
46019 num137 += (float)Main.rand.Next(-40, 41) * 0.1f;
46020 num138 += (float)Main.rand.Next(-40, 41) * 0.1f;
46022 }
46023 }
46024 else if (sItem.type == 3210)
46025 {
46027 vector39.X += (float)Main.rand.Next(-30, 31) * 0.04f;
46028 vector39.Y += (float)Main.rand.Next(-30, 31) * 0.03f;
46029 vector39.Normalize();
46030 vector39 *= (float)Main.rand.Next(70, 91) * 0.1f;
46031 vector39.X += (float)Main.rand.Next(-30, 31) * 0.04f;
46032 vector39.Y += (float)Main.rand.Next(-30, 31) * 0.03f;
46034 }
46035 else if (sItem.type == 434)
46036 {
46037 float num139 = num2;
46038 float num140 = num3;
46039 if (itemAnimation < 5)
46040 {
46041 num139 += (float)Main.rand.Next(-40, 41) * 0.01f;
46042 num140 += (float)Main.rand.Next(-40, 41) * 0.01f;
46043 num139 *= 1.1f;
46044 num140 *= 1.1f;
46045 }
46046 else if (itemAnimation < 10)
46047 {
46048 num139 += (float)Main.rand.Next(-20, 21) * 0.01f;
46049 num140 += (float)Main.rand.Next(-20, 21) * 0.01f;
46050 num139 *= 1.05f;
46051 num140 *= 1.05f;
46052 }
46054 }
46055 else if (sItem.type == 1157)
46056 {
46057 projToShoot = Main.rand.Next(191, 195);
46058 int num141 = SpawnMinionOnCursor(projectileSource_Item_WithPotentialAmmo, i, projToShoot, damage, KnockBack);
46059 Main.projectile[num141].localAI[0] = 30f;
46060 }
46061 else if (sItem.type == 1802)
46062 {
46063 SpawnMinionOnCursor(projectileSource_Item_WithPotentialAmmo, i, projToShoot, damage, KnockBack);
46064 }
46065 else if (sItem.type == 2364 || sItem.type == 2365)
46066 {
46067 SpawnMinionOnCursor(projectileSource_Item_WithPotentialAmmo, i, projToShoot, damage, KnockBack);
46068 }
46069 else if (sItem.type == 2535)
46070 {
46071 num2 = 0f;
46072 num3 = 0f;
46074 spinningpoint = spinningpoint.RotatedBy(1.5707963705062866);
46076 spinningpoint = spinningpoint.RotatedBy(-3.1415927410125732);
46078 }
46079 else if (sItem.type == 2551)
46080 {
46081 SpawnMinionOnCursor(projectileSource_Item_WithPotentialAmmo, i, projToShoot + nextCycledSpiderMinionType, damage, KnockBack);
46082 nextCycledSpiderMinionType++;
46083 nextCycledSpiderMinionType %= 3;
46084 }
46085 else if (sItem.type == 2584)
46086 {
46087 SpawnMinionOnCursor(projectileSource_Item_WithPotentialAmmo, i, projToShoot + Main.rand.Next(3), damage, KnockBack);
46088 }
46089 else if (sItem.type == 2621)
46090 {
46091 SpawnMinionOnCursor(projectileSource_Item_WithPotentialAmmo, i, projToShoot, damage, KnockBack);
46092 }
46093 else if (sItem.type == 2749 || sItem.type == 3249 || sItem.type == 3474 || sItem.type == 4273 || sItem.type == 4281)
46094 {
46095 SpawnMinionOnCursor(projectileSource_Item_WithPotentialAmmo, i, projToShoot, damage, KnockBack);
46096 }
46097 else if (sItem.type == 3531)
46098 {
46099 int num142 = -1;
46100 int num143 = -1;
46101 for (int num144 = 0; num144 < 1000; num144++)
46102 {
46103 if (Main.projectile[num144].active && Main.projectile[num144].owner == Main.myPlayer)
46104 {
46105 if (num142 == -1 && Main.projectile[num144].type == 625)
46106 {
46107 num142 = num144;
46108 }
46109 if (num143 == -1 && Main.projectile[num144].type == 628)
46110 {
46111 num143 = num144;
46112 }
46113 if (num142 != -1 && num143 != -1)
46114 {
46115 break;
46116 }
46117 }
46118 }
46119 if (num142 == -1 && num143 == -1)
46120 {
46121 num2 = 0f;
46122 num3 = 0f;
46123 pointPoisition.X = (float)Main.mouseX + Main.screenPosition.X;
46124 pointPoisition.Y = (float)Main.mouseY + Main.screenPosition.Y;
46129 Main.projectile[num146].localAI[1] = num147;
46130 Main.projectile[num147].localAI[1] = num148;
46131 Main.projectile[num145].originalDamage = damage;
46132 Main.projectile[num146].originalDamage = damage;
46133 Main.projectile[num147].originalDamage = damage;
46134 Main.projectile[num148].originalDamage = damage;
46135 }
46136 else if (num142 != -1 && num143 != -1)
46137 {
46138 int num149 = (int)Main.projectile[num143].ai[0];
46141 Main.projectile[num150].localAI[1] = num151;
46142 Main.projectile[num150].netUpdate = true;
46143 Main.projectile[num150].ai[1] = 1f;
46144 Main.projectile[num151].localAI[1] = num143;
46145 Main.projectile[num151].netUpdate = true;
46146 Main.projectile[num151].ai[1] = 1f;
46147 Main.projectile[num143].ai[0] = num151;
46148 Main.projectile[num143].netUpdate = true;
46149 Main.projectile[num143].ai[1] = 1f;
46150 Main.projectile[num150].originalDamage = damage;
46151 Main.projectile[num151].originalDamage = damage;
46152 Main.projectile[num143].originalDamage = damage;
46153 }
46154 }
46155 else if (sItem.type == 1309 || sItem.type == 4758 || sItem.type == 4269 || sItem.type == 5005)
46156 {
46157 SpawnMinionOnCursor(projectileSource_Item_WithPotentialAmmo, i, projToShoot, damage, KnockBack);
46158 }
46159 else if (sItem.shoot > 0 && (Main.projPet[sItem.shoot] || sItem.shoot == 72 || sItem.shoot == 18 || sItem.shoot == 500 || sItem.shoot == 650) && !sItem.summon)
46160 {
46161 for (int num152 = 0; num152 < 1000; num152++)
46162 {
46164 if (projectile2.active && projectile2.owner == whoAmI)
46165 {
46166 if (sItem.shoot == 72 && (projectile2.type == 72 || projectile2.type == 86 || projectile2.type == 87))
46167 {
46168 projectile2.Kill();
46169 }
46170 else if (sItem.type == 5131 && (projectile2.type == 881 || projectile2.type == 934))
46171 {
46172 projectile2.Kill();
46173 }
46174 else if (sItem.shoot == projectile2.type)
46175 {
46176 projectile2.Kill();
46177 }
46178 }
46179 }
46181 }
46182 else if (sItem.type == 3006)
46183 {
46184 pointPoisition = GetFarthestSpawnPositionOnLine(pointPoisition, num2, num3);
46186 }
46187 else if (sItem.type == 3014)
46188 {
46189 Vector2 pointPoisition3 = default(Vector2);
46190 pointPoisition3.X = Main.MouseWorld.X;
46191 pointPoisition3.Y = Main.MouseWorld.Y;
46192 LimitPointToPlayerReachableArea(ref pointPoisition3);
46193 while (Collision.CanHitLine(position, width, height, pointPoisition, 1, 1))
46194 {
46195 pointPoisition.X += num2;
46196 pointPoisition.Y += num3;
46197 if ((pointPoisition - pointPoisition3).Length() < 20f + Math.Abs(num2) + Math.Abs(num3))
46198 {
46200 break;
46201 }
46202 }
46203 bool flag5 = false;
46204 int num153 = (int)pointPoisition.Y / 16;
46205 int num154 = (int)pointPoisition.X / 16;
46206 int num155;
46207 for (num155 = num153; num153 < Main.maxTilesY - 10 && num153 - num155 < 30 && !WorldGen.SolidTile(num154, num153) && !TileID.Sets.Platforms[Main.tile[num154, num153].type]; num153++)
46208 {
46209 }
46211 {
46212 flag5 = true;
46213 }
46214 float num156 = num153 * 16;
46215 num153 = num155;
46216 while (num153 > 10 && num155 - num153 < 30 && !WorldGen.SolidTile(num154, num153))
46217 {
46218 num153--;
46219 }
46220 float num157 = num153 * 16 + 16;
46221 float num158 = num156 - num157;
46222 int num159 = 15;
46223 if (num158 > (float)(16 * num159))
46224 {
46225 num158 = 16 * num159;
46226 }
46227 num157 = num156 - num158;
46228 pointPoisition.X = (int)(pointPoisition.X / 16f) * 16;
46229 if (!flag5)
46230 {
46232 }
46233 }
46234 else if (sItem.type == 3384)
46235 {
46236 int num160 = ((altFunctionUse == 2) ? 1 : 0);
46238 }
46239 else if (sItem.type == 3473)
46240 {
46241 float ai4 = (Main.rand.NextFloat() - 0.5f) * ((float)Math.PI / 4f);
46244 }
46245 else if (sItem.type == 4956)
46246 {
46247 int num161 = (itemAnimationMax - itemAnimation) / itemTime;
46250 if (num161 == 0)
46251 {
46252 num162 = 4956;
46253 }
46255 LimitPointToPlayerReachableArea(ref pointPoisition4);
46256 Vector2 vector42 = pointPoisition4 - MountedCenter;
46257 if (num161 == 1 || num161 == 2)
46258 {
46259 int npcTargetIndex;
46260 bool zenithTarget = GetZenithTarget(pointPoisition4, 400f, out npcTargetIndex);
46261 if (zenithTarget)
46262 {
46263 vector42 = Main.npc[npcTargetIndex].Center - MountedCenter;
46264 }
46265 bool flag6 = num161 == 2;
46266 if (num161 == 1 && !zenithTarget)
46267 {
46268 flag6 = true;
46269 }
46270 if (flag6)
46271 {
46272 vector42 += Main.rand.NextVector2Circular(150f, 150f);
46273 }
46274 }
46275 vector41 = vector42 / 2f;
46276 float ai5 = Main.rand.Next(-100, 101);
46278 }
46279 else if (sItem.type == 3836)
46280 {
46281 float ai6 = Main.rand.NextFloat() * speed * 0.75f * (float)direction;
46283 }
46284 else if (sItem.type == 3858)
46285 {
46286 bool num163 = altFunctionUse == 2;
46288 if (num163)
46289 {
46290 vector43 *= 1.5f;
46291 float ai7 = (0.3f + 0.7f * Main.rand.NextFloat()) * speed * 1.75f * (float)direction;
46293 }
46294 else
46295 {
46297 }
46298 }
46299 else if (sItem.type == 3859)
46300 {
46302 projToShoot = 710;
46303 vector44 *= 0.8f;
46304 Vector2 vector45 = vector44.SafeNormalize(-Vector2.UnitY);
46305 float num164 = (float)Math.PI / 180f * (float)(-direction);
46306 for (float num165 = -2.5f; num165 < 3f; num165 += 1f)
46307 {
46309 }
46310 }
46311 else if (sItem.type == 3870)
46312 {
46313 Vector2 vector46 = Vector2.Normalize(new Vector2(num2, num3)) * 40f * sItem.scale;
46315 {
46317 }
46319 vector47 *= 0.8f;
46320 Vector2 vector48 = vector47.SafeNormalize(-Vector2.UnitY);
46321 float num166 = (float)Math.PI / 180f * (float)(-direction);
46322 for (int num167 = 0; num167 <= 2; num167++)
46323 {
46325 }
46326 }
46327 else if (sItem.type == 3542)
46328 {
46329 float num168 = (Main.rand.NextFloat() - 0.5f) * ((float)Math.PI / 4f) * 0.7f;
46330 for (int num169 = 0; num169 < 10; num169++)
46331 {
46332 if (Collision.CanHit(pointPoisition, 0, 0, pointPoisition + new Vector2(num2, num3).RotatedBy(num168) * 100f, 0, 0))
46333 {
46334 break;
46335 }
46336 num168 = (Main.rand.NextFloat() - 0.5f) * ((float)Math.PI / 4f) * 0.7f;
46337 }
46338 Vector2 vector49 = new Vector2(num2, num3).RotatedBy(num168) * (0.95f + Main.rand.NextFloat() * 0.3f);
46340 }
46341 else if (sItem.type == 3779)
46342 {
46343 float num170 = Main.rand.NextFloat() * ((float)Math.PI * 2f);
46344 for (int num171 = 0; num171 < 10; num171++)
46345 {
46346 if (Collision.CanHit(pointPoisition, 0, 0, pointPoisition + new Vector2(num2, num3).RotatedBy(num170) * 100f, 0, 0))
46347 {
46348 break;
46349 }
46350 num170 = Main.rand.NextFloat() * ((float)Math.PI * 2f);
46351 }
46352 Vector2 vector50 = new Vector2(num2, num3).RotatedBy(num170) * (0.95f + Main.rand.NextFloat() * 0.3f);
46354 }
46355 else if (sItem.type == 3787)
46356 {
46357 float f = Main.rand.NextFloat() * ((float)Math.PI * 2f);
46358 float value3 = 20f;
46359 float value4 = 60f;
46360 Vector2 vector51 = pointPoisition + f.ToRotationVector2() * MathHelper.Lerp(value3, value4, Main.rand.NextFloat());
46361 for (int num172 = 0; num172 < 50; num172++)
46362 {
46363 vector51 = pointPoisition + f.ToRotationVector2() * MathHelper.Lerp(value3, value4, Main.rand.NextFloat());
46364 if (Collision.CanHit(pointPoisition, 0, 0, vector51 + (vector51 - pointPoisition).SafeNormalize(Vector2.UnitX) * 8f, 0, 0))
46365 {
46366 break;
46367 }
46368 f = Main.rand.NextFloat() * ((float)Math.PI * 2f);
46369 }
46370 Vector2 v5 = Main.MouseWorld - vector51;
46371 Vector2 vector52 = new Vector2(num2, num3).SafeNormalize(Vector2.UnitY) * speed;
46372 v5 = v5.SafeNormalize(vector52) * speed;
46373 v5 = Vector2.Lerp(v5, vector52, 0.25f);
46375 }
46376 else if (sItem.type == 3788)
46377 {
46379 float num173 = (float)Math.PI / 4f;
46380 for (int num174 = 0; num174 < 2; num174++)
46381 {
46382 Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, pointPoisition, vector53 + vector53.SafeNormalize(Vector2.Zero).RotatedBy(num173 * (Main.rand.NextFloat() * 0.5f + 0.5f)) * Main.rand.NextFloatDirection() * 2f, projToShoot, Damage, KnockBack, i);
46383 Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, pointPoisition, vector53 + vector53.SafeNormalize(Vector2.Zero).RotatedBy((0f - num173) * (Main.rand.NextFloat() * 0.5f + 0.5f)) * Main.rand.NextFloatDirection() * 2f, projToShoot, Damage, KnockBack, i);
46384 }
46386 }
46387 else if (sItem.type == 4463 || sItem.type == 486)
46388 {
46390 }
46391 else if (sItem.type == 46)
46392 {
46393 Vector2 vector54 = new Vector2(direction, gravDir * 4f).SafeNormalize(Vector2.UnitY).RotatedBy((float)Math.PI * 2f * Main.rand.NextFloatDirection() * 0.05f);
46394 Vector2 searchCenter = MountedCenter + new Vector2(70f, -40f) * Directions + vector54 * -10f;
46395 if (GetZenithTarget(searchCenter, 50f, out var npcTargetIndex2))
46396 {
46398 searchCenter = nPC3.Center + Main.rand.NextVector2Circular(nPC3.width / 2, nPC3.height / 2);
46399 }
46400 else
46401 {
46402 searchCenter += Main.rand.NextVector2Circular(20f, 20f);
46403 }
46404 float ai8 = 1f;
46405 if (Main.rand.Next(100) < meleeCrit)
46406 {
46407 ai8 = 2f;
46408 Damage *= 2;
46409 }
46411 NetMessage.SendData(13, -1, -1, null, whoAmI);
46412 }
46413 else if (sItem.type == 273)
46414 {
46415 float adjustedItemScale = GetAdjustedItemScale(sItem);
46416 Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, MountedCenter, new Vector2(direction, 0f), projToShoot, Damage, KnockBack, i, (float)direction * gravDir, itemAnimationMax, adjustedItemScale);
46417 Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, MountedCenter, new Vector2(num2, num3), projToShoot, Damage, KnockBack, i, (float)direction * gravDir * 0.1f, 30f, adjustedItemScale);
46418 NetMessage.SendData(13, -1, -1, null, whoAmI);
46419 }
46420 else if (sItem.type == 368)
46421 {
46422 float adjustedItemScale2 = GetAdjustedItemScale(sItem);
46423 Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, MountedCenter, new Vector2(direction, 0f), projToShoot, Damage, KnockBack, i, (float)direction * gravDir, itemAnimationMax, adjustedItemScale2);
46424 NetMessage.SendData(13, -1, -1, null, whoAmI);
46425 }
46426 else if (sItem.type == 1826)
46427 {
46428 float adjustedItemScale3 = GetAdjustedItemScale(sItem);
46429 Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, MountedCenter, new Vector2(direction, 0f), projToShoot, Damage, KnockBack, i, (float)direction * gravDir, itemAnimationMax, adjustedItemScale3);
46430 NetMessage.SendData(13, -1, -1, null, whoAmI);
46431 }
46432 else if (sItem.type == 675)
46433 {
46434 float adjustedItemScale4 = GetAdjustedItemScale(sItem);
46435 Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, MountedCenter, new Vector2(direction, 0f), 972, Damage, KnockBack, i, (float)direction * gravDir, itemAnimationMax, adjustedItemScale4);
46436 Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, MountedCenter, new Vector2(num2, num3), projToShoot, Damage / 2, KnockBack, i, (float)direction * gravDir, 32f, adjustedItemScale4);
46437 NetMessage.SendData(13, -1, -1, null, whoAmI);
46438 }
46439 else if (sItem.type == 674)
46440 {
46441 float adjustedItemScale5 = GetAdjustedItemScale(sItem);
46442 Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, MountedCenter, new Vector2(direction, 0f), projToShoot, Damage, KnockBack, i, (float)direction * gravDir, itemAnimationMax, adjustedItemScale5);
46443 Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, MountedCenter, new Vector2(direction, 0f), 982, 0, KnockBack, i, (float)direction * gravDir, itemAnimationMax, adjustedItemScale5);
46444 NetMessage.SendData(13, -1, -1, null, whoAmI);
46445 }
46446 else if (sItem.type == 757)
46447 {
46448 float adjustedItemScale6 = GetAdjustedItemScale(sItem);
46449 Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, MountedCenter, new Vector2(direction, 0f), 984, Damage, KnockBack, i, (float)direction * gravDir, itemAnimationMax, adjustedItemScale6);
46450 Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, MountedCenter, new Vector2(num2, num3) * 5f, projToShoot, Damage, KnockBack, i, (float)direction * gravDir, 18f, adjustedItemScale6);
46451 NetMessage.SendData(13, -1, -1, null, whoAmI);
46452 }
46453 else if (sItem.type == 190)
46454 {
46455 Vector2 vector55 = MountedCenter + new Vector2(70f, -40f) * Directions;
46456 int npcTargetIndex3;
46457 bool zenithTarget2 = GetZenithTarget(vector55, 150f, out npcTargetIndex3);
46458 if (zenithTarget2)
46459 {
46461 vector55 = Main.rand.NextVector2FromRectangle(nPC4.Hitbox);
46462 }
46463 else
46464 {
46465 vector55 += Main.rand.NextVector2Circular(20f, 20f);
46466 }
46467 Vector2 vector56 = base.Center + new Vector2(Main.rand.NextFloatDirection() * (float)width / 2f, height / 2) * Directions;
46469 float num175 = ((float)Math.PI + (float)Math.PI * 2f * Main.rand.NextFloat() * 1.5f) * ((float)(-direction) * gravDir);
46470 int num176 = 60;
46471 float num177 = num175 / (float)num176;
46472 float num178 = 16f;
46473 float num179 = v6.Length();
46474 if (Math.Abs(num177) >= 0.17f)
46475 {
46476 num177 *= 0.7f;
46477 }
46478 _ = direction;
46479 _ = gravDir;
46480 Vector2 vector57 = Vector2.UnitX * num178;
46482 int num180 = 0;
46483 while (v7.Length() < num179 && num180 < num176)
46484 {
46485 num180++;
46486 v7 += vector57;
46487 vector57 = vector57.RotatedBy(num177);
46488 }
46489 float num181 = v7.ToRotation();
46490 Vector2 spinningpoint2 = v6.SafeNormalize(Vector2.UnitY).RotatedBy(0f - num181 - num177) * num178;
46491 if (num180 == num176)
46492 {
46493 spinningpoint2 = new Vector2(direction, 0f) * num178;
46494 }
46495 if (!zenithTarget2)
46496 {
46497 vector56.Y -= gravDir * 24f;
46498 spinningpoint2 = spinningpoint2.RotatedBy((float)direction * gravDir * ((float)Math.PI * 2f) * 0.14f);
46499 }
46501 NetMessage.SendData(13, -1, -1, null, whoAmI);
46502 }
46503 else if (sItem.type == 3475)
46504 {
46506 }
46507 else if (sItem.type == 3930)
46508 {
46510 }
46511 else if (sItem.type == 3540)
46512 {
46514 }
46515 else if (sItem.type == 5451)
46516 {
46517 for (int num182 = 0; num182 < 1000; num182++)
46518 {
46520 if (projectile3.type == projToShoot && projectile3.owner == whoAmI)
46521 {
46522 projectile3.Kill();
46523 }
46524 }
46526 }
46527 else if (sItem.type == 3854)
46528 {
46530 }
46531 else if (sItem.type == 3546)
46532 {
46533 for (int num183 = 0; num183 < 2; num183++)
46534 {
46535 float num184 = num2;
46536 float num185 = num3;
46537 num184 += (float)Main.rand.Next(-40, 41) * 0.05f;
46538 num185 += (float)Main.rand.Next(-40, 41) * 0.05f;
46539 Vector2 vector58 = pointPoisition + Vector2.Normalize(new Vector2(num184, num185).RotatedBy(-(float)Math.PI / 2f * (float)direction)) * 6f;
46541 }
46542 }
46543 else if (sItem.type == 3350)
46544 {
46545 float num186 = num2;
46546 float num187 = num3;
46547 num186 += (float)Main.rand.Next(-1, 2) * 0.5f;
46548 num187 += (float)Main.rand.Next(-1, 2) * 0.5f;
46549 if (Collision.CanHitLine(base.Center, 0, 0, pointPoisition + new Vector2(num186, num187) * 2f, 0, 0))
46550 {
46552 }
46554 }
46555 else if (sItem.type == 3852)
46556 {
46557 if (altFunctionUse == 2)
46558 {
46559 Projectile.NewProjectile(projectileSource_Item_WithPotentialAmmo, pointPoisition.X, base.Bottom.Y - 100f, (float)direction * speed, 0f, 704, (int)((float)Damage * 1.75f), KnockBack, i);
46560 }
46561 else
46562 {
46564 }
46565 }
46566 else if (sItem.type == 3818 || sItem.type == 3819 || sItem.type == 3820 || sItem.type == 3824 || sItem.type == 3825 || sItem.type == 3826 || sItem.type == 3829 || sItem.type == 3830 || sItem.type == 3831 || sItem.type == 3832 || sItem.type == 3833 || sItem.type == 3834)
46567 {
46568 PayDD2CrystalsBeforeUse(sItem);
46569 FindSentryRestingSpot(sItem.shoot, out var worldX, out var worldY, out var pushYUp);
46570 int num188 = 0;
46571 int num189 = 0;
46572 int num190 = 0;
46573 switch (sItem.type)
46574 {
46575 case 3824:
46576 case 3825:
46577 case 3826:
46578 num188 = 1;
46580 break;
46581 case 3832:
46582 case 3833:
46583 case 3834:
46585 break;
46586 case 3818:
46587 num188 = 1;
46588 num189 = 80;
46589 break;
46590 case 3819:
46591 num188 = 1;
46592 num189 = 70;
46593 break;
46594 case 3820:
46595 num188 = 1;
46596 num189 = 60;
46597 break;
46598 }
46600 Main.projectile[num191].originalDamage = damage;
46601 Main.projectile[num191].localAI[0] = num190;
46602 UpdateMaxTurrets();
46603 }
46604 else if (sItem.type == 65)
46605 {
46607 new Vector2(100f, 0f);
46610 Vector2 vector60 = (pointPoisition - mouseWorld2).SafeNormalize(new Vector2(0f, -1f));
46611 while (vec.Y > pointPoisition.Y && WorldGen.SolidTile(vec.ToTileCoordinates()))
46612 {
46613 vec += vector60 * 16f;
46614 }
46616 }
46617 else if (sItem.type == 4923)
46618 {
46619 float adjustedItemScale7 = GetAdjustedItemScale(sItem);
46621 }
46622 else if (sItem.type == 1910)
46623 {
46625 }
46626 else if (sItem.type == 5134)
46627 {
46629 }
46630 else
46631 {
46633 if (sItem.type == 726)
46634 {
46635 Main.projectile[num192].magic = true;
46636 }
46637 if (sItem.type == 724 || sItem.type == 676)
46638 {
46639 Main.projectile[num192].melee = true;
46640 }
46641 if (projToShoot == 80)
46642 {
46643 Main.projectile[num192].ai[0] = tileTargetX;
46644 Main.projectile[num192].ai[1] = tileTargetY;
46645 }
46646 if (sItem.type == 760)
46647 {
46648 DestroyOldestProximityMinesOverMinesCap(20);
46649 }
46650 if (projToShoot == 442)
46651 {
46652 Main.projectile[num192].ai[0] = tileTargetX;
46653 Main.projectile[num192].ai[1] = tileTargetY;
46654 }
46655 if (projToShoot == 826)
46656 {
46657 Main.projectile[num192].ai[1] = Main.rand.Next(3);
46658 }
46659 if (sItem.type == 949)
46660 {
46661 Main.projectile[num192].ai[1] = 1f;
46662 }
46663 if (Main.projectile[num192].aiStyle == 99)
46664 {
46666 }
46667 if (Main.projectile[num192].aiStyle == 160 && Main.IsItAHappyWindyDay)
46668 {
46670 }
46671 NetMessage.SendData(13, -1, -1, null, whoAmI);
46672 }
46673 }
46674
46676 {
46678 LimitPointToPlayerReachableArea(ref pointPoisition);
46679 int num = 0;
46680 float num2 = new Vector2(speedX, speedY).Length();
46681 float num3 = (pointPoisition - startPos).Length();
46682 Vector2 center = base.Center;
46683 center.X += direction * 16;
46684 while (Collision.CanHitLine(center, 0, 0, startPos, 0, 0))
46685 {
46686 num++;
46687 startPos.X += speedX;
46688 startPos.Y += speedY;
46689 if ((startPos - pointPoisition).Length() < 20f + Math.Abs(speedX) + Math.Abs(speedY))
46690 {
46692 break;
46693 }
46694 if (num2 * (float)num >= num3)
46695 {
46697 break;
46698 }
46699 }
46700 return startPos;
46701 }
46702
46704 {
46707 LimitPointToPlayerReachableArea(ref pointPoisition);
46708 float ai = 0f;
46710 {
46711 switch (entitySource_ItemUse.Item.type)
46712 {
46713 case 1157:
46714 ai = 60f;
46715 break;
46716 case 2364:
46717 case 2365:
46718 case 2535:
46719 case 2621:
46720 case 2749:
46721 case 3474:
46722 ai = 1f;
46723 break;
46724 }
46725 }
46728 return num;
46729 }
46730
46732 {
46733 Point point = targetSpot.ToTileCoordinates();
46734 Vector2 center = base.Center;
46736 int samplesToTake = 3;
46737 float samplingWidth = 4f;
46739 float num = float.PositiveInfinity;
46740 for (int i = 0; i < samples.Length; i++)
46741 {
46742 if (samples[i] < num)
46743 {
46744 num = samples[i];
46745 }
46746 }
46747 targetSpot = center + vectorTowardsTarget.SafeNormalize(Vector2.Zero) * num;
46748 point = targetSpot.ToTileCoordinates();
46749 Rectangle value = new Rectangle(point.X, point.Y, 1, 1);
46750 value.Inflate(6, 16);
46752 value2.Inflate(-40, -40);
46756 for (int j = value.Left; j <= value.Right; j++)
46757 {
46758 for (int k = value.Top; k <= value.Bottom; k++)
46759 {
46760 if (!WorldGen.SolidTile2(j, k))
46761 {
46762 continue;
46763 }
46764 Vector2 value3 = new Vector2(j * 16 + 8, k * 16 + 8);
46765 if (!(Vector2.Distance(targetSpot, value3) > 200f))
46766 {
46767 if (FindSharpTearsOpening(j, k, j > point.X, j < point.X, k > point.Y, k < point.Y))
46768 {
46769 list.Add(new Point(j, k));
46770 }
46771 else
46772 {
46773 list2.Add(new Point(j, k));
46774 }
46775 }
46776 }
46777 }
46778 if (list.Count == 0 && list2.Count == 0)
46779 {
46780 list.Add((base.Center.ToTileCoordinates().ToVector2() + Main.rand.NextVector2Square(-2f, 2f)).ToPoint());
46781 }
46783 if (list3.Count == 0)
46784 {
46785 list3 = list2;
46786 }
46787 int index = Main.rand.Next(list3.Count);
46788 return list3[index];
46789 }
46790
46791 private bool FindSharpTearsOpening(int x, int y, bool acceptLeft, bool acceptRight, bool acceptUp, bool acceptDown)
46792 {
46793 if (acceptLeft && !WorldGen.SolidTile(x - 1, y))
46794 {
46795 return true;
46796 }
46797 if (acceptRight && !WorldGen.SolidTile(x + 1, y))
46798 {
46799 return true;
46800 }
46801 if (acceptUp && !WorldGen.SolidTile(x, y - 1))
46802 {
46803 return true;
46804 }
46805 if (acceptDown && !WorldGen.SolidTile(x, y + 1))
46806 {
46807 return true;
46808 }
46809 return false;
46810 }
46811
46813 {
46814 int num = 0;
46815 int value = (int)(placePosition.X / 16f) - tileRangeX - num + 1;
46816 int value2 = (int)(placePosition.X / 16f) + tileRangeX + num - 1;
46817 int value3 = (int)(placePosition.Y / 16f) - tileRangeY - num + 1;
46818 int value4 = (int)(placePosition.Y / 16f) + tileRangeY + num - 2;
46819 value = Utils.Clamp(value, 10, Main.maxTilesX - 10);
46820 value2 = Utils.Clamp(value2, 10, Main.maxTilesX - 10);
46821 value3 = Utils.Clamp(value3, 10, Main.maxTilesY - 10);
46822 value4 = Utils.Clamp(value4, 10, Main.maxTilesY - 10);
46823 Vector2 value5 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY);
46824 if (gravDir == -1f)
46825 {
46826 value5.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
46827 }
46828 Point point = placePosition.ToTileCoordinates();
46830 for (int i = -2; i <= 2; i++)
46831 {
46832 for (int j = -2; j <= 2; j++)
46833 {
46834 int num2 = point.X + i;
46835 int num3 = point.Y + j;
46836 if (WorldGen.InWorld(num2, num3, 1))
46837 {
46839 if (tileSafely.active() && tileSafely.type == 494)
46840 {
46841 list.Add(new Tuple<int, int>(num2, num3));
46842 break;
46843 }
46844 }
46845 }
46846 }
46847 bool result = false;
46848 if (list.Count > 0)
46849 {
46850 float num4 = -1f;
46852 for (int k = 0; k < list.Count; k++)
46853 {
46854 float num5 = Vector2.Distance(new Vector2(list[k].Item1, list[k].Item2) * 16f + Vector2.One * 8f, value5);
46855 if (num4 == -1f || num5 < num4)
46856 {
46857 num4 = num5;
46858 tuple = list[k];
46859 }
46860 }
46861 if (Collision.InTileBounds(tuple.Item1, tuple.Item2, value, value3, value2, value4))
46862 {
46863 result = true;
46864 for (int l = 0; l < 1000; l++)
46865 {
46866 if (ProjectileID.Sets.IsAGolfBall[Main.projectile[l].type] && Main.projectile[l].owner == whoAmI)
46867 {
46868 Main.projectile[l].Kill();
46869 }
46870 }
46871 GetPreferredGolfBallToUse(out var projType);
46872 Projectile.NewProjectile(GetProjectileSource_TileInteraction(tuple.Item1, tuple.Item2), (float)(tuple.Item1 * 16) + 8.5f, tuple.Item2 * 16 + 6, 0f, 0f, projType, 0, 0f, whoAmI, 0f, -1f);
46873 }
46874 }
46875 return result;
46876 }
46877
46879 {
46880 projType = 721;
46881 Item item = inventory[selectedItem];
46882 if (!item.IsAir && item.shoot > 0 && ProjectileID.Sets.IsAGolfBall[item.shoot])
46883 {
46884 projType = item.shoot;
46885 return;
46886 }
46887 for (int num = 19; num >= 0; num--)
46888 {
46889 if (IsItemSlotUnlockedAndUsable(num))
46890 {
46891 _ = num % 10;
46892 Item item2 = armor[num];
46893 if (!item2.IsAir && item2.shoot > 0 && ProjectileID.Sets.IsAGolfBall[item2.shoot])
46894 {
46895 projType = item2.shoot;
46896 return;
46897 }
46898 }
46899 }
46900 for (int i = 0; i < 50; i++)
46901 {
46902 Item item3 = inventory[i];
46903 if (!item3.IsAir && item3.shoot > 0 && ProjectileID.Sets.IsAGolfBall[item3.shoot])
46904 {
46905 projType = item3.shoot;
46906 break;
46907 }
46908 }
46909 }
46910
46912 {
46913 if (sItem.shoot > 0 && ProjectileID.Sets.MinionTargettingFeature[sItem.shoot] && altFunctionUse == 2 && cShoot && ItemTimeIsZero)
46914 {
46915 ApplyItemTime(sItem);
46916 MinionNPCTargetAim(doNotDisableIfTheTargetIsTheSame: false);
46917 }
46918 }
46919
46921 {
46922 if (sItem.shoot <= 0 || !ProjectileID.Sets.TurretFeature[sItem.shoot] || altFunctionUse != 2 || !cShoot || !ItemTimeIsZero)
46923 {
46924 return;
46925 }
46926 ApplyItemTime(sItem);
46927 for (int i = 0; i < 1000; i++)
46928 {
46929 Projectile projectile = Main.projectile[i];
46930 if (projectile.active && projectile.owner == Main.myPlayer && ProjectileID.Sets.TurretFeature[projectile.type])
46931 {
46932 projectile.Kill();
46933 }
46934 }
46935 }
46936
46937 private void EmitMaxManaEffect()
46938 {
46940 for (int i = 0; i < 5; i++)
46941 {
46942 int num = Dust.NewDust(position, width, height, 45, 0f, 0f, 255, default(Color), (float)Main.rand.Next(20, 26) * 0.1f);
46943 Main.dust[num].noLight = true;
46944 Main.dust[num].noGravity = true;
46945 Main.dust[num].velocity *= 0.5f;
46946 }
46947 }
46948
46950 {
46951 Vector2? handPosition = HandPosition;
46952 if (((ItemID.Sets.Torches[sItem.type] && !wet) || ItemID.Sets.WaterTorches[sItem.type]) && !pulley && !happyFunTorchTime)
46953 {
46954 float R = 1f;
46955 float G = 0.95f;
46956 float B = 0.8f;
46957 int num = 0;
46958 int num2 = BiomeTorchHoldStyle(sItem.type);
46959 if (num2 == 523)
46960 {
46961 num = 8;
46962 }
46963 else if (num2 == 974)
46964 {
46965 num = 9;
46966 }
46967 else if (num2 == 1245)
46968 {
46969 num = 10;
46970 }
46971 else if (num2 == 1333)
46972 {
46973 num = 11;
46974 }
46975 else if (num2 == 2274)
46976 {
46977 num = 12;
46978 }
46979 else if (num2 == 3004)
46980 {
46981 num = 13;
46982 }
46983 else if (num2 == 3045)
46984 {
46985 num = 14;
46986 }
46987 else if (num2 == 3114)
46988 {
46989 num = 15;
46990 }
46991 else if (num2 == 4383)
46992 {
46993 num = 16;
46994 }
46995 else if (num2 == 4384)
46996 {
46997 num = 17;
46998 }
46999 else if (num2 == 4385)
47000 {
47001 num = 18;
47002 }
47003 else if (num2 == 4386)
47004 {
47005 num = 19;
47006 }
47007 else if (num2 == 4387)
47008 {
47009 num = 20;
47010 }
47011 else if (num2 == 4388)
47012 {
47013 num = 21;
47014 }
47015 else if (num2 == 5293)
47016 {
47017 num = 22;
47018 }
47019 else if (num2 == 5353)
47020 {
47021 num = 23;
47022 }
47023 else if (num2 >= 427)
47024 {
47025 num = num2 - 426;
47026 }
47027 num = (int)MathHelper.Clamp(num, 0f, TorchID.Count - 1);
47028 TorchID.TorchColor(num, out R, out G, out B);
47029 int num3 = TorchID.Dust[num];
47030 int maxValue = 30;
47031 if (itemAnimation > 0)
47032 {
47033 maxValue = 7;
47034 }
47035 if (direction == -1)
47036 {
47037 if (Main.rand.Next(maxValue) == 0)
47038 {
47039 int num4 = Dust.NewDust(new Vector2(itemLocation.X - 16f, itemLocation.Y - 14f * gravDir), 4, 4, num3, 0f, 0f, 100);
47040 if (Main.rand.Next(3) != 0)
47041 {
47042 Main.dust[num4].noGravity = true;
47043 }
47044 Main.dust[num4].velocity *= 0.3f;
47045 Main.dust[num4].velocity.Y -= 1.5f;
47046 Main.dust[num4].position = RotatedRelativePoint(Main.dust[num4].position);
47047 if (num3 == 66)
47048 {
47049 Main.dust[num4].color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB);
47050 Main.dust[num4].noGravity = true;
47051 }
47052 }
47053 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X - 12f + velocity.X, itemLocation.Y - 14f + velocity.Y)), R, G, B);
47054 }
47055 else
47056 {
47057 if (Main.rand.Next(maxValue) == 0)
47058 {
47059 int num5 = Dust.NewDust(new Vector2(itemLocation.X + 6f, itemLocation.Y - 14f * gravDir), 4, 4, num3, 0f, 0f, 100);
47060 if (Main.rand.Next(3) != 0)
47061 {
47062 Main.dust[num5].noGravity = true;
47063 }
47064 Main.dust[num5].velocity *= 0.3f;
47065 Main.dust[num5].velocity.Y -= 1.5f;
47066 Main.dust[num5].position = RotatedRelativePoint(Main.dust[num5].position);
47067 if (num3 == 66)
47068 {
47069 Main.dust[num5].color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB);
47070 Main.dust[num5].noGravity = true;
47071 }
47072 }
47073 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X + 12f + velocity.X, itemLocation.Y - 14f + velocity.Y)), R, G, B);
47074 }
47075 }
47076 if ((sItem.type == 105 || sItem.type == 713) && !wet && !pulley)
47077 {
47078 int maxValue2 = 20;
47079 if (itemAnimation > 0)
47080 {
47081 maxValue2 = 7;
47082 }
47083 if (direction == -1)
47084 {
47085 if (Main.rand.Next(maxValue2) == 0)
47086 {
47087 int num6 = Dust.NewDust(new Vector2(itemLocation.X - 12f, itemLocation.Y - 20f * gravDir), 4, 4, 6, 0f, 0f, 100);
47088 if (Main.rand.Next(3) != 0)
47089 {
47090 Main.dust[num6].noGravity = true;
47091 }
47092 Main.dust[num6].velocity *= 0.3f;
47093 Main.dust[num6].velocity.Y -= 1.5f;
47094 Main.dust[num6].position = RotatedRelativePoint(Main.dust[num6].position);
47095 }
47096 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X - 16f + velocity.X, itemLocation.Y - 14f)), 1f, 0.95f, 0.8f);
47097 }
47098 else
47099 {
47100 if (Main.rand.Next(maxValue2) == 0)
47101 {
47102 int num7 = Dust.NewDust(new Vector2(itemLocation.X + 4f, itemLocation.Y - 20f * gravDir), 4, 4, 6, 0f, 0f, 100);
47103 if (Main.rand.Next(3) != 0)
47104 {
47105 Main.dust[num7].noGravity = true;
47106 }
47107 Main.dust[num7].velocity *= 0.3f;
47108 Main.dust[num7].velocity.Y -= 1.5f;
47109 Main.dust[num7].position = RotatedRelativePoint(Main.dust[num7].position);
47110 }
47111 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X + 6f + velocity.X, itemLocation.Y - 14f)), 1f, 0.95f, 0.8f);
47112 }
47113 }
47114 else if (sItem.type == 148 && !wet && !pulley)
47115 {
47116 int maxValue3 = 10;
47117 if (itemAnimation > 0)
47118 {
47119 maxValue3 = 7;
47120 }
47121 if (direction == -1)
47122 {
47123 if (Main.rand.Next(maxValue3) == 0)
47124 {
47125 int num8 = Dust.NewDust(new Vector2(itemLocation.X - 12f, itemLocation.Y - 20f * gravDir), 4, 4, 172, 0f, 0f, 100);
47126 if (Main.rand.Next(3) != 0)
47127 {
47128 Main.dust[num8].noGravity = true;
47129 }
47130 Main.dust[num8].velocity *= 0.3f;
47131 Main.dust[num8].velocity.Y -= 1.5f;
47132 Main.dust[num8].position = RotatedRelativePoint(Main.dust[num8].position);
47133 }
47134 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X - 16f + velocity.X, itemLocation.Y - 14f)), 0f, 0.5f, 1f);
47135 }
47136 else
47137 {
47138 if (Main.rand.Next(maxValue3) == 0)
47139 {
47140 int num9 = Dust.NewDust(new Vector2(itemLocation.X + 4f, itemLocation.Y - 20f * gravDir), 4, 4, 172, 0f, 0f, 100);
47141 if (Main.rand.Next(3) != 0)
47142 {
47143 Main.dust[num9].noGravity = true;
47144 }
47145 Main.dust[num9].velocity *= 0.3f;
47146 Main.dust[num9].velocity.Y -= 1.5f;
47147 Main.dust[num9].position = RotatedRelativePoint(Main.dust[num9].position);
47148 }
47149 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X + 6f + velocity.X, itemLocation.Y - 14f)), 0f, 0.5f, 1f);
47150 }
47151 }
47152 else if (sItem.type == 3117 && !wet && !pulley)
47153 {
47154 itemLocation.X -= direction * 4;
47155 int maxValue4 = 10;
47156 if (itemAnimation > 0)
47157 {
47158 maxValue4 = 7;
47159 }
47160 if (direction == -1)
47161 {
47162 if (Main.rand.Next(maxValue4) == 0)
47163 {
47164 int num10 = Dust.NewDust(new Vector2(itemLocation.X - 10f, itemLocation.Y - 20f * gravDir), 4, 4, 242, 0f, 0f, 100);
47165 if (Main.rand.Next(3) != 0)
47166 {
47167 Main.dust[num10].noGravity = true;
47168 }
47169 Main.dust[num10].velocity *= 0.3f;
47170 Main.dust[num10].velocity.Y -= 1.5f;
47171 Main.dust[num10].position = RotatedRelativePoint(Main.dust[num10].position);
47172 }
47173 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X - 16f + velocity.X, itemLocation.Y - 14f)), 0.9f, 0.1f, 0.75f);
47174 }
47175 else
47176 {
47177 if (Main.rand.Next(maxValue4) == 0)
47178 {
47179 int num11 = Dust.NewDust(new Vector2(itemLocation.X + 6f, itemLocation.Y - 20f * gravDir), 4, 4, 242, 0f, 0f, 100);
47180 if (Main.rand.Next(3) != 0)
47181 {
47182 Main.dust[num11].noGravity = true;
47183 }
47184 Main.dust[num11].velocity *= 0.3f;
47185 Main.dust[num11].velocity.Y -= 1.5f;
47186 Main.dust[num11].position = RotatedRelativePoint(Main.dust[num11].position);
47187 }
47188 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X + 6f + velocity.X, itemLocation.Y - 14f)), 0.9f, 0.1f, 0.75f);
47189 }
47190 }
47191 else if (sItem.type == 5322 && !wet && !pulley)
47192 {
47193 float r = 0.2f;
47194 float g = 0.3f;
47195 float b = 0.32f;
47196 if (direction == -1)
47197 {
47198 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X - 16f + velocity.X, itemLocation.Y - 14f)), r, g, b);
47199 }
47200 else
47201 {
47202 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X + 6f + velocity.X, itemLocation.Y - 14f)), r, g, b);
47203 }
47204 }
47205 if (sItem.type == 282 && !pulley)
47206 {
47207 if (direction == -1)
47208 {
47209 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X - 16f + velocity.X, itemLocation.Y - 14f)), 0.7f, 1f, 0.8f);
47210 }
47211 else
47212 {
47213 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X + 6f + velocity.X, itemLocation.Y - 14f)), 0.7f, 1f, 0.8f);
47214 }
47215 }
47216 if (sItem.type == 3002 && !pulley)
47217 {
47218 float r2 = 1.05f;
47219 float g2 = 0.95f;
47220 float b2 = 0.55f;
47221 if (direction == -1)
47222 {
47223 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X - 16f + velocity.X, itemLocation.Y - 14f)), r2, g2, b2);
47224 }
47225 else
47226 {
47227 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X + 6f + velocity.X, itemLocation.Y - 14f)), r2, g2, b2);
47228 }
47229 spelunkerTimer++;
47230 if (spelunkerTimer >= 10)
47231 {
47232 spelunkerTimer = 0;
47233 Main.instance.SpelunkerProjectileHelper.AddSpotToCheck(base.Center);
47234 }
47235 }
47236 if (sItem.type == 286 && !pulley)
47237 {
47238 if (direction == -1)
47239 {
47240 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X - 16f + velocity.X, itemLocation.Y - 14f)), 0.7f, 0.8f, 1f);
47241 }
47242 else
47243 {
47244 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X + 6f + velocity.X, itemLocation.Y - 14f)), 0.7f, 0.8f, 1f);
47245 }
47246 }
47247 if (sItem.type == 3112 && !pulley)
47248 {
47249 if (direction == -1)
47250 {
47251 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X - 16f + velocity.X, itemLocation.Y - 14f)), 1f, 0.6f, 0.85f);
47252 }
47253 else
47254 {
47255 Lighting.AddLight(RotatedRelativePoint(new Vector2(itemLocation.X + 6f + velocity.X, itemLocation.Y - 14f)), 1f, 0.6f, 0.85f);
47256 }
47257 }
47258 if (sItem.type == 4776 && !pulley)
47259 {
47260 Vector2 vec = RotatedRelativePoint(new Vector2(itemLocation.X + 6f + velocity.X, itemLocation.Y - 14f));
47261 if (direction == -1)
47262 {
47263 vec = RotatedRelativePoint(new Vector2(itemLocation.X - 16f + velocity.X, itemLocation.Y - 14f));
47264 }
47265 Vector3 rgb = (DelegateMethods.v3_1 = new Vector3(0.9f, 0.35f, 1f));
47266 Point p = vec.ToTileCoordinates();
47267 DelegateMethods.v2_1 = p.ToVector2();
47268 DelegateMethods.f_1 = 4.5f;
47271 }
47272 if (sItem.type == 3542 && handPosition.HasValue)
47273 {
47274 Vector2 vector = handPosition.Value - velocity;
47275 for (int i = 0; i < 4; i++)
47276 {
47277 Dust dust = Main.dust[Dust.NewDust(base.Center, 0, 0, 242, direction * 2, 0f, 150, default(Color), 1.3f)];
47278 dust.position = vector;
47279 dust.velocity *= 0f;
47280 dust.noGravity = true;
47281 dust.fadeIn = 1f;
47282 dust.velocity += velocity;
47283 if (Main.rand.Next(2) == 0)
47284 {
47285 dust.position += Utils.RandomVector2(Main.rand, -4f, 4f);
47286 dust.scale += Main.rand.NextFloat();
47287 if (Main.rand.Next(2) == 0)
47288 {
47289 dust.customData = this;
47290 }
47291 }
47292 }
47293 }
47294 if (sItem.type != 4952 || pulley || isPettingAnimal)
47295 {
47296 return;
47297 }
47298 Vector2 pos = itemLocation + new Vector2(8 * direction, -10f * gravDir);
47299 Vector3 rgb2 = new Vector3(1f, 0.7f, 0.8f) * 1.3f;
47300 Vector2 vector2 = RotatedRelativePoint(pos);
47302 if (Main.rand.Next(40) == 0)
47303 {
47304 Vector2 vector3 = Main.rand.NextVector2Circular(4f, 4f);
47305 Dust dust2 = Dust.NewDustPerfect(vector2 + vector3, 43, Vector2.Zero, 254, new Color(255, 255, 0, 255), 0.3f);
47306 if (vector3 != Vector2.Zero)
47307 {
47308 dust2.velocity = vector2.DirectionTo(dust2.position) * 0.2f;
47309 }
47310 dust2.fadeIn = 0.3f;
47311 dust2.noLightEmittence = true;
47312 dust2.customData = this;
47313 }
47314 }
47315
47317 {
47318 if (item.holdStyle == 4)
47319 {
47320 if (isPettingAnimal)
47321 {
47322 return false;
47323 }
47324 if (pulley)
47325 {
47326 return false;
47327 }
47328 if (gravDir == -1f)
47329 {
47330 return false;
47331 }
47332 if (velocity.Y != 0f)
47333 {
47334 return false;
47335 }
47336 if (mount.Active)
47337 {
47338 return false;
47339 }
47340 }
47341 if (item.holdStyle == 6 && isPettingAnimal)
47342 {
47343 return false;
47344 }
47345 if (item.holdStyle == 5 && isPettingAnimal)
47346 {
47347 return false;
47348 }
47349 return true;
47350 }
47351
47353 {
47354 if (isPettingAnimal)
47355 {
47356 int num = miscCounter % 14 / 7;
47358 if (num == 1)
47359 {
47360 stretch = CompositeArmStretchAmount.Full;
47361 }
47362 float num2 = 0.3f;
47363 if (isTheAnimalBeingPetSmall)
47364 {
47365 num2 = 0.2f;
47366 }
47367 SetCompositeArmBack(enabled: true, stretch, (float)Math.PI * -2f * num2 * (float)direction);
47368 }
47369 if (!CanVisuallyHoldItem(sItem))
47370 {
47371 return;
47372 }
47373 if (sItem.holdStyle == 1 && !pulley)
47374 {
47375 if (Main.dedServ)
47376 {
47377 itemLocation.X = position.X + (float)width * 0.5f + 20f * (float)direction;
47378 }
47379 else if (sItem.type == 930)
47380 {
47381 itemLocation.X = position.X + (float)(width / 2) * 0.5f - 12f - (float)(2 * direction);
47382 float x = position.X + (float)(width / 2) + (float)(38 * direction);
47383 if (direction == 1)
47384 {
47385 x -= 10f;
47386 }
47387 float y = MountedCenter.Y - 4f * gravDir;
47388 if (gravDir == -1f)
47389 {
47390 y -= 8f;
47391 }
47392 RotateRelativePoint(ref x, ref y);
47393 int num3 = 0;
47394 for (int i = 54; i < 58; i++)
47395 {
47396 if (inventory[i].stack > 0 && inventory[i].ammo == 931)
47397 {
47398 num3 = inventory[i].type;
47399 break;
47400 }
47401 }
47402 if (num3 == 0)
47403 {
47404 for (int j = 0; j < 54; j++)
47405 {
47406 if (inventory[j].stack > 0 && inventory[j].ammo == 931)
47407 {
47408 num3 = inventory[j].type;
47409 break;
47410 }
47411 }
47412 }
47413 switch (num3)
47414 {
47415 case 931:
47416 num3 = 127;
47417 break;
47418 case 1614:
47419 num3 = 187;
47420 break;
47421 case 5377:
47422 num3 = 169;
47423 break;
47424 case 5378:
47425 num3 = 75;
47426 break;
47427 case 5379:
47428 num3 = 66;
47429 break;
47430 case 5380:
47431 num3 = 310;
47432 break;
47433 }
47434 if (num3 > 0)
47435 {
47436 int num4 = Dust.NewDust(new Vector2(x, y + gfxOffY), 6, 6, num3, 0f, 0f, 100, default(Color), 1.6f);
47437 Main.dust[num4].noGravity = true;
47438 Main.dust[num4].velocity.Y -= 4f * gravDir;
47439 if (num3 == 66)
47440 {
47441 Main.dust[num4].color = Main.hslToRgb(Main.GlobalTimeWrappedHourly * 0.6f % 1f, 1f, 0.5f);
47442 Main.dust[num4].scale *= 0.5f;
47443 Main.dust[num4].velocity *= 0.75f;
47444 }
47445 }
47446 }
47447 else if (sItem.type == 968)
47448 {
47449 itemLocation.X = position.X + (float)width * 0.5f + (float)(8 * direction);
47450 if (whoAmI == Main.myPlayer)
47451 {
47452 int num5 = (int)(itemLocation.X + (float)heldItemFrame.Width * 0.8f * (float)direction) / 16;
47453 int num6 = (int)(itemLocation.Y + mountOffset + (float)(heldItemFrame.Height / 2)) / 16;
47454 if (Main.tile[num5, num6] == null)
47455 {
47456 Main.tile[num5, num6] = new Tile();
47457 }
47458 if (Main.tile[num5, num6].active() && Main.tile[num5, num6].type == 215 && Main.tile[num5, num6].frameY < 54)
47459 {
47460 miscTimer++;
47461 if (Main.rand.Next(5) == 0)
47462 {
47463 miscTimer++;
47464 }
47465 if (miscTimer > 900)
47466 {
47467 miscTimer = 0;
47468 sItem.SetDefaults(969);
47469 if (selectedItem == 58)
47470 {
47471 Main.mouseItem.SetDefaults(969);
47472 }
47473 for (int k = 0; k < 58; k++)
47474 {
47475 if (inventory[k].type == sItem.type && k != selectedItem && inventory[k].stack < inventory[k].maxStack)
47476 {
47478 inventory[k].stack++;
47479 sItem.SetDefaults();
47480 if (selectedItem == 58)
47481 {
47482 Main.mouseItem.SetDefaults();
47483 }
47484 }
47485 }
47486 }
47487 }
47488 else
47489 {
47490 miscTimer = 0;
47491 }
47492 }
47493 }
47494 else if (sItem.type == 856)
47495 {
47496 itemLocation.X = position.X + (float)width * 0.5f + (float)(4 * direction);
47497 }
47498 else if (sItem.fishingPole > 0)
47499 {
47500 itemLocation.X = position.X + (float)width * 0.5f + (float)heldItemFrame.Width * 0.18f * (float)direction;
47501 }
47502 else
47503 {
47504 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f + 2f) * (float)direction;
47505 if (sItem.type == 282 || sItem.type == 286 || sItem.type == 3112 || sItem.type == 4776)
47506 {
47507 itemLocation.X -= direction * 2;
47508 itemLocation.Y += 4f;
47509 }
47510 else if (sItem.type == 3002)
47511 {
47512 itemLocation.X -= 4 * direction;
47513 itemLocation.Y += 2f;
47514 }
47515 }
47516 itemLocation.Y = position.Y + 24f + mountOffset;
47517 if (sItem.type == 856)
47518 {
47519 itemLocation.Y = position.Y + 34f + mountOffset;
47520 }
47521 if (sItem.type == 930)
47522 {
47523 itemLocation.Y = position.Y + 9f + mountOffset;
47524 }
47525 if (sItem.fishingPole > 0)
47526 {
47527 itemLocation.Y += 4f;
47528 }
47529 else if (sItem.type == 3476)
47530 {
47531 itemLocation.X = base.Center.X + (float)(14 * direction);
47532 itemLocation.Y = MountedCenter.Y;
47533 }
47534 else if (sItem.type == 3779)
47535 {
47536 itemLocation.X = base.Center.X + (float)(6 * direction);
47537 itemLocation.Y = MountedCenter.Y + 6f;
47538 }
47539 else if (sItem.type == 4952)
47540 {
47541 itemLocation.X = base.Center.X + (float)(2 * direction);
47542 itemLocation.Y = MountedCenter.Y + 26f;
47543 }
47544 else if (sItem.type == 353)
47545 {
47546 itemLocation.X = base.Center.X + (float)(6 * direction);
47547 itemLocation.Y = MountedCenter.Y + 11f;
47548 }
47549 else if (ItemID.Sets.IsFood[sItem.type])
47550 {
47551 itemLocation.X = base.Center.X + (float)(4 * direction);
47552 itemLocation.Y = MountedCenter.Y + (float)(heldItemFrame.Height / 2);
47553 }
47554 else if (sItem.type == 4049 && Main.rand.Next(4) == 0)
47555 {
47556 Dust dust = Dust.NewDustPerfect(base.Center + new Vector2(direction * 23, gravDir * 6f), 31, Vector2.Zero, 127, default(Color), 0.7f);
47557 dust.noGravity = true;
47558 dust.velocity = Main.rand.NextVector2Circular(1f, 1f) + new Vector2(0f, -1f);
47559 }
47560 itemRotation = 0f;
47561 if (gravDir == -1f)
47562 {
47563 itemRotation = 0f - itemRotation;
47564 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y) + mountOffset;
47565 if (sItem.type == 930)
47566 {
47567 itemLocation.Y -= 24f;
47568 }
47569 }
47570 }
47571 else if (sItem.holdStyle == 2 && !pulley)
47572 {
47573 if (sItem.type == 946 || sItem.type == 4707)
47574 {
47575 itemRotation = 0f;
47576 itemLocation.X = position.X + (float)width * 0.5f - (float)(16 * direction);
47577 itemLocation.Y = position.Y + 22f + mountOffset;
47578 fallStart = (int)(position.Y / 16f);
47579 if (gravDir == -1f)
47580 {
47581 itemRotation = 0f - itemRotation;
47582 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
47583 if (velocity.Y < -2f && !controlDown)
47584 {
47585 velocity.Y = -2f;
47586 }
47587 }
47588 else if (velocity.Y > 2f && !controlDown)
47589 {
47590 velocity.Y = 2f;
47591 }
47592 }
47593 else
47594 {
47595 itemLocation.X = position.X + (float)width * 0.5f + (float)(6 * direction);
47596 itemLocation.Y = position.Y + 16f + mountOffset;
47597 itemRotation = 0.79f * (float)(-direction);
47598 if (gravDir == -1f)
47599 {
47600 itemRotation = 0f - itemRotation;
47601 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
47602 }
47603 }
47604 }
47605 else if (sItem.holdStyle == 3 && !pulley)
47606 {
47607 if (!Main.dedServ)
47608 {
47609 itemLocation.X = position.X + (float)width * 0.5f - (float)heldItemFrame.Width * 0.5f - (float)(direction * 2);
47610 itemLocation.Y = MountedCenter.Y - (float)heldItemFrame.Height * 0.5f;
47611 itemRotation = 0f;
47612 }
47613 }
47614 else if (sItem.holdStyle == 4)
47615 {
47616 if (!Main.dedServ)
47617 {
47618 float num7 = new Vector2(10 * direction, 10f).ToRotation() + (float)Math.PI / 4f;
47619 itemRotation = num7;
47620 if (direction == -1)
47621 {
47622 itemRotation += (float)Math.PI / 2f;
47623 }
47626 float num8 = -(float)Math.PI / 10f;
47627 if (direction == -1)
47628 {
47629 num8 *= -1f;
47630 }
47631 float num9 = itemRotation - (float)Math.PI / 4f + (float)Math.PI;
47632 if (direction == 1)
47633 {
47634 num9 += (float)Math.PI / 2f;
47635 }
47636 float rotation = num9 + num8;
47637 float rotation2 = num9 - num8;
47638 Vector2 vector = (num9 + (float)Math.PI / 2f).ToRotationVector2() * 2f;
47639 itemLocation = MountedCenter.Floor() + vector;
47640 SetCompositeArmFront(enabled: true, stretch2, rotation);
47641 SetCompositeArmBack(enabled: true, stretch3, rotation2);
47642 FlipItemLocationAndRotationForGravity();
47643 }
47644 }
47645 else if (sItem.holdStyle == 5 && !pulley)
47646 {
47647 if (!Main.dedServ)
47648 {
47649 itemRotation = 0f;
47650 itemLocation.X = base.Center.X - (float)(8 * direction);
47651 itemLocation.Y = position.Y + 40f + mountOffset;
47652 Vector2 vector2 = Main.OffsetsPlayerHeadgear[bodyFrame.Y / 56];
47653 itemLocation += vector2;
47655 SetCompositeArmBack(enabled: true, stretch4, -(float)Math.PI / 4f * (float)direction);
47657 SetCompositeArmFront(enabled: true, stretch5, -0.39269912f * (float)direction);
47658 FlipItemLocationAndRotationForGravity();
47659 }
47660 }
47661 else if (sItem.holdStyle == 6 && !pulley && !Main.dedServ)
47662 {
47663 itemRotation = 0f;
47664 itemLocation.X = base.Center.X + (float)(8 * direction);
47665 itemLocation.Y = position.Y + 40f + mountOffset - 2f;
47666 Vector2 vector3 = Main.OffsetsPlayerHeadgear[bodyFrame.Y / 56];
47667 itemLocation += vector3;
47669 SetCompositeArmBack(enabled: true, stretch6, (float)Math.PI * -3f / 5f * (float)direction);
47670 FlipItemLocationAndRotationForGravity();
47671 }
47672 }
47673
47675 {
47676 if (!spaceGun || (sItem.type != 127 && sItem.type != 4347 && sItem.type != 4348))
47677 {
47678 manaRegenDelay = (int)maxRegenDelay;
47679 }
47680 }
47681
47683 {
47684 float num = rotation + (float)Math.PI / 2f;
47685 Vector2 vector = new Vector2((float)Math.Cos(num), (float)Math.Sin(num));
47686 switch (stretch)
47687 {
47688 case CompositeArmStretchAmount.Full:
47689 vector *= 10f;
47690 break;
47691 case CompositeArmStretchAmount.None:
47692 vector *= 4f;
47693 break;
47694 case CompositeArmStretchAmount.Quarter:
47695 vector *= 6f;
47696 break;
47697 case CompositeArmStretchAmount.ThreeQuarters:
47698 vector *= 8f;
47699 break;
47700 }
47701 if (direction == -1)
47702 {
47703 vector += new Vector2(4f, -2f);
47704 vector += new Vector2(0f, -3f).RotatedBy(rotation + (float)Math.PI / 2f);
47705 }
47706 else
47707 {
47708 vector += new Vector2(-4f, -2f);
47709 vector += new Vector2(0f, 3f).RotatedBy(rotation + (float)Math.PI / 2f);
47710 }
47711 return MountedCenter + vector;
47712 }
47713
47715 {
47716 float num = rotation + (float)Math.PI / 2f;
47717 Vector2 vector = new Vector2((float)Math.Cos(num), (float)Math.Sin(num));
47718 switch (stretch)
47719 {
47720 case CompositeArmStretchAmount.Full:
47721 vector *= new Vector2(10f, 12f);
47722 break;
47723 case CompositeArmStretchAmount.None:
47724 vector *= new Vector2(4f, 6f);
47725 break;
47726 case CompositeArmStretchAmount.Quarter:
47727 vector *= new Vector2(6f, 8f);
47728 break;
47729 case CompositeArmStretchAmount.ThreeQuarters:
47730 vector *= new Vector2(8f, 10f);
47731 break;
47732 }
47733 if (direction == -1)
47734 {
47735 vector += new Vector2(-6f, -2f);
47736 }
47737 else
47738 {
47739 vector += new Vector2(6f, -2f);
47740 }
47741 return MountedCenter + vector;
47742 }
47743
47745 {
47746 if (Main.dedServ)
47747 {
47748 return;
47749 }
47750 if (sItem.useStyle == 1)
47751 {
47752 if (sItem.type > -1 && Item.claw[sItem.type])
47753 {
47754 if ((double)itemAnimation < (double)itemAnimationMax * 0.333)
47755 {
47756 float num = 10f;
47757 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - num) * (float)direction;
47758 itemLocation.Y = position.Y + 26f + mountOffset;
47759 }
47760 else if ((double)itemAnimation < (double)itemAnimationMax * 0.666)
47761 {
47762 float num2 = 8f;
47763 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - num2) * (float)direction;
47764 num2 = 24f;
47765 itemLocation.Y = position.Y + num2 + mountOffset;
47766 }
47767 else
47768 {
47769 float num3 = 6f;
47770 itemLocation.X = position.X + (float)width * 0.5f - ((float)heldItemFrame.Width * 0.5f - num3) * (float)direction;
47771 num3 = 20f;
47772 itemLocation.Y = position.Y + num3 + mountOffset;
47773 }
47774 itemRotation = ((float)itemAnimation / (float)itemAnimationMax - 0.5f) * (float)(-direction) * 3.5f - (float)direction * 0.3f;
47775 }
47776 else
47777 {
47779 if ((double)itemAnimation < (double)itemAnimationMax * 0.333)
47780 {
47781 float num4 = 10f;
47782 if (heldItemFrame.Width > 32)
47783 {
47784 num4 = 14f;
47785 }
47786 if (heldItemFrame.Width >= 52)
47787 {
47788 num4 = 24f;
47789 }
47790 if (heldItemFrame.Width >= 64)
47791 {
47792 num4 = 28f;
47793 }
47794 if (heldItemFrame.Width >= 92)
47795 {
47796 num4 = 38f;
47797 }
47798 if (sItem.type == 2330 || sItem.type == 2320 || sItem.type == 2341)
47799 {
47800 num4 += 8f;
47801 }
47802 if (sItem.type == 671)
47803 {
47804 num4 += 12f;
47805 }
47806 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - num4) * (float)direction;
47807 itemLocation.Y = position.Y + 24f + mountOffset;
47808 zero = new Vector2(-4f, 1f);
47809 }
47810 else if ((double)itemAnimation < (double)itemAnimationMax * 0.666)
47811 {
47812 float num5 = 10f;
47813 if (heldItemFrame.Width > 32)
47814 {
47815 num5 = 18f;
47816 }
47817 if (heldItemFrame.Width >= 52)
47818 {
47819 num5 = 24f;
47820 }
47821 if (heldItemFrame.Width >= 64)
47822 {
47823 num5 = 28f;
47824 }
47825 if (heldItemFrame.Width >= 92)
47826 {
47827 num5 = 38f;
47828 }
47829 if (sItem.type == 2330 || sItem.type == 2320 || sItem.type == 2341)
47830 {
47831 num5 += 4f;
47832 }
47833 if (sItem.type == 671)
47834 {
47835 num5 += 6f;
47836 }
47837 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - num5) * (float)direction;
47838 num5 = 10f;
47839 if (heldItemFrame.Height > 32)
47840 {
47841 num5 = 8f;
47842 }
47843 if (heldItemFrame.Height > 52)
47844 {
47845 num5 = 12f;
47846 }
47847 if (heldItemFrame.Height > 64)
47848 {
47849 num5 = 14f;
47850 }
47851 if (sItem.type == 2330 || sItem.type == 2320 || sItem.type == 2341)
47852 {
47853 num5 += 4f;
47854 }
47855 if (sItem.type == 671)
47856 {
47857 num5 += 10f;
47858 }
47859 itemLocation.Y = position.Y + num5 + mountOffset;
47860 zero = new Vector2(-6f, -4f);
47861 }
47862 else
47863 {
47864 float num6 = 6f;
47865 if (heldItemFrame.Width > 32)
47866 {
47867 num6 = 14f;
47868 }
47869 if (heldItemFrame.Width >= 48)
47870 {
47871 num6 = 18f;
47872 }
47873 if (heldItemFrame.Width >= 52)
47874 {
47875 num6 = 24f;
47876 }
47877 if (heldItemFrame.Width >= 64)
47878 {
47879 num6 = 28f;
47880 }
47881 if (heldItemFrame.Width >= 92)
47882 {
47883 num6 = 38f;
47884 }
47885 if (sItem.type == 2330 || sItem.type == 2320 || sItem.type == 2341)
47886 {
47887 num6 += 4f;
47888 }
47889 if (sItem.type == 671)
47890 {
47891 num6 += 8f;
47892 }
47893 itemLocation.X = position.X + (float)width * 0.5f - ((float)heldItemFrame.Width * 0.5f - num6) * (float)direction;
47894 num6 = 10f;
47895 if (heldItemFrame.Height > 32)
47896 {
47897 num6 = 10f;
47898 }
47899 if (heldItemFrame.Height > 52)
47900 {
47901 num6 = 12f;
47902 }
47903 if (heldItemFrame.Height > 64)
47904 {
47905 num6 = 14f;
47906 }
47907 if (sItem.type == 2330 || sItem.type == 2320 || sItem.type == 2341)
47908 {
47909 num6 += 4f;
47910 }
47911 if (sItem.type == 671)
47912 {
47913 num6 += 8f;
47914 }
47915 itemLocation.Y = position.Y + num6 + mountOffset;
47916 zero = new Vector2(4f, -2f);
47917 }
47918 if (sItem.type > -1 && ItemID.Sets.UsesBetterMeleeItemLocation[sItem.type])
47919 {
47920 itemLocation += zero * Directions;
47921 }
47922 itemRotation = ((float)itemAnimation / (float)itemAnimationMax - 0.5f) * (float)(-direction) * 3.5f - (float)direction * 0.3f;
47923 }
47924 if (gravDir == -1f)
47925 {
47926 itemRotation = 0f - itemRotation;
47927 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
47928 }
47929 }
47930 else if (sItem.useStyle == 7)
47931 {
47932 itemRotation = (float)itemAnimation / (float)itemAnimationMax * (float)direction * 2f + -1.4f * (float)direction;
47933 if ((double)itemAnimation < (double)itemAnimationMax * 0.5)
47934 {
47935 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - 9f - itemRotation * 12f * (float)direction) * (float)direction;
47936 itemLocation.Y = position.Y + 38f + itemRotation * (float)direction * 4f + mountOffset;
47937 }
47938 else
47939 {
47940 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - 9f - itemRotation * 16f * (float)direction) * (float)direction;
47941 itemLocation.Y = position.Y + 38f + itemRotation * (float)direction + mountOffset;
47942 }
47943 if (gravDir == -1f)
47944 {
47945 itemRotation = 0f - itemRotation;
47946 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
47947 }
47948 }
47949 else if (sItem.useStyle == 9)
47950 {
47951 float num7 = (float)itemAnimation / (float)itemAnimationMax;
47952 float t = 1f - num7;
47953 t = Utils.GetLerpValue(0f, 0.7f, t, clamped: true);
47954 itemRotation = t * (float)(-direction) * 2f + 0.7f * (float)direction;
47955 itemLocation = MountedCenter + new Vector2((float)(direction * 10) * ((float)itemAnimation / (float)itemAnimationMax), 0f);
47956 float num8 = 8f;
47957 float num9 = 7f;
47958 float num10 = (float)Math.PI * 2f / 5f;
47959 float num11 = (0f - num10) * 0.5f + (1f - t) * num10;
47960 num11 += (float)Math.PI / 10f;
47961 Vector2 vector = base.Center + new Vector2((float)direction * num8, 0f) + num11.ToRotationVector2() * num9 * new Vector2(direction, 1f);
47962 itemLocation = vector;
47963 float num12 = num11 - (float)Math.PI / 2f;
47964 if (direction == -1)
47965 {
47966 num12 = 0f - num12;
47967 }
47968 SetCompositeArmFront(enabled: true, CompositeArmStretchAmount.Full, num12);
47969 itemLocation = GetFrontHandPosition(CompositeArmStretchAmount.Full, num12);
47970 itemLocation -= MountedCenter;
47971 itemLocation *= MathHelper.Lerp(1.5f, 1.2f, t);
47972 itemLocation += MountedCenter;
47973 itemLocation.X += (float)direction * MathHelper.Lerp(8f, 2f, t);
47974 if (gravDir == -1f)
47975 {
47976 itemRotation = 0f - itemRotation;
47977 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
47978 }
47979 }
47980 else if (sItem.useStyle == 6)
47981 {
47982 float num13 = 1f - (float)itemAnimation / (float)itemAnimationMax;
47983 num13 *= 6f;
47984 if (num13 > 1f)
47985 {
47986 num13 = 1f;
47987 }
47988 itemRotation = (1f - num13) * (float)direction * 2f - 1.4f * (float)direction;
47989 if (num13 >= 0.5f)
47990 {
47991 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - 9f - itemRotation * 12f * (float)direction) * (float)direction;
47992 itemLocation.Y = position.Y + 38f + itemRotation * (float)direction * 4f + mountOffset;
47993 }
47994 else
47995 {
47996 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - 9f - itemRotation * 16f * (float)direction) * (float)direction;
47997 itemLocation.Y = position.Y + 38f + itemRotation * (float)direction + mountOffset;
47998 }
47999 if (gravDir == -1f)
48000 {
48001 itemRotation = 0f - itemRotation;
48002 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
48003 }
48004 }
48005 else if (sItem.useStyle == 2)
48006 {
48007 itemLocation = MountedCenter + new Vector2(10 * direction, -10f).RotatedBy(itemRotation + (float)Math.PI / 4f * (float)direction);
48008 float num14 = 1f - (float)itemAnimation / (float)itemAnimationMax;
48010 if (num14 > 0.25f && num14 <= 0.5f)
48011 {
48013 }
48014 if (num14 > 0.5f && num14 <= 0.75f)
48015 {
48017 }
48018 if (num14 > 0.75f && num14 <= 1f)
48019 {
48021 }
48022 SetCompositeArmFront(enabled: true, compositeArmStretchAmount, -(float)Math.PI / 2f * (float)direction);
48023 SetCompositeArmBack(enabled: true, compositeArmStretchAmount, -(float)Math.PI / 2f * (float)direction);
48024 int num15 = 8;
48026 {
48027 case CompositeArmStretchAmount.Full:
48028 num15 = 8;
48029 break;
48030 case CompositeArmStretchAmount.ThreeQuarters:
48031 num15 = 6;
48032 break;
48033 case CompositeArmStretchAmount.Quarter:
48034 num15 = 4;
48035 break;
48036 case CompositeArmStretchAmount.None:
48037 num15 = 2;
48038 break;
48039 }
48040 itemLocation = MountedCenter + new Vector2((num15 + 10 - heldItemFrame.Width / 2) * direction, heldItemFrame.Height / 2 - 4);
48041 if (gravDir == -1f)
48042 {
48043 itemRotation = 0f - itemRotation;
48044 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
48045 }
48046 }
48047 else if (sItem.useStyle == 11)
48048 {
48049 float num16 = 1f - (float)itemAnimation / (float)itemAnimationMax;
48050 num16 *= 2f;
48052 if (num16 > 0.25f && num16 <= 0.5f)
48053 {
48055 }
48056 if (num16 > 0.5f && num16 <= 0.75f)
48057 {
48059 }
48060 if (num16 > 0.75f && num16 <= 1.25f)
48061 {
48063 }
48064 if (num16 > 1.25f && num16 <= 1.5f)
48065 {
48067 }
48068 if (num16 > 1.5f && num16 <= 1.75f)
48069 {
48071 }
48072 if (num16 > 1.75f && num16 <= 2f)
48073 {
48075 }
48076 SetCompositeArmFront(enabled: true, compositeArmStretchAmount2, -(float)Math.PI / 4f * (float)direction);
48077 SetCompositeArmBack(enabled: true, CompositeArmStretchAmount.Full, -(float)Math.PI / 16f);
48078 int num17 = 8;
48080 {
48081 case CompositeArmStretchAmount.Full:
48082 num17 = 8;
48083 break;
48084 case CompositeArmStretchAmount.ThreeQuarters:
48085 num17 = 6;
48086 break;
48087 case CompositeArmStretchAmount.Quarter:
48088 num17 = 4;
48089 break;
48090 case CompositeArmStretchAmount.None:
48091 num17 = 2;
48092 break;
48093 }
48094 itemLocation = MountedCenter + new Vector2((num17 + 22 - heldItemFrame.Width / 2) * direction, heldItemFrame.Height / 2 - 8);
48095 if (gravDir == -1f)
48096 {
48097 itemRotation = 0f - itemRotation;
48098 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
48099 }
48100 }
48101 else if (sItem.useStyle == 3)
48102 {
48103 if ((double)itemAnimation > (double)itemAnimationMax * 0.666)
48104 {
48105 itemLocation.X = -1000f;
48106 itemLocation.Y = -1000f;
48107 itemRotation = -1.3f * (float)direction;
48108 }
48109 else
48110 {
48111 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - 4f) * (float)direction;
48112 itemLocation.Y = position.Y + 24f + mountOffset;
48113 float num18 = (float)itemAnimation / (float)itemAnimationMax * (float)heldItemFrame.Width * (float)direction * GetAdjustedItemScale(sItem) * 1.2f - (float)(10 * direction);
48114 if (num18 > -4f && direction == -1)
48115 {
48116 num18 = -8f;
48117 }
48118 if (num18 < 4f && direction == 1)
48119 {
48120 num18 = 8f;
48121 }
48122 itemLocation.X -= num18;
48123 itemRotation = 0.8f * (float)direction;
48124 if (sItem.type == 946 || sItem.type == 4707)
48125 {
48126 itemLocation.X -= 6 * direction;
48127 }
48128 }
48129 if (gravDir == -1f)
48130 {
48131 itemRotation = 0f - itemRotation;
48132 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
48133 }
48134 }
48135 else if (sItem.useStyle == 4)
48136 {
48137 int num19 = 0;
48138 int num20 = 0;
48139 if (sItem.type == 3601)
48140 {
48141 num19 = 10;
48142 }
48143 if (sItem.type == 5114)
48144 {
48145 num19 = 10;
48146 num20 = -2;
48147 }
48148 if (sItem.type == 5120)
48149 {
48150 num19 = 10;
48151 }
48152 itemRotation = 0f;
48153 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - 9f - itemRotation * 14f * (float)direction - 4f - (float)num19) * (float)direction;
48154 itemLocation.Y = position.Y + (float)heldItemFrame.Height * 0.5f + 4f + mountOffset + (float)num20;
48155 if (gravDir == -1f)
48156 {
48157 itemRotation = 0f - itemRotation;
48158 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
48159 }
48160 }
48161 else if (sItem.useStyle == 5)
48162 {
48163 if (sItem.type == 3779)
48164 {
48165 itemRotation = 0f;
48166 itemLocation.X = base.Center.X + (float)(6 * direction);
48167 itemLocation.Y = MountedCenter.Y + 6f;
48168 }
48169 else if (sItem.type == 4262)
48170 {
48171 itemRotation = 0f;
48172 itemLocation.X = base.Center.X + (float)(-heldItemFrame.Width) * 0.5f + (float)(direction * -6);
48173 itemLocation.Y = MountedCenter.Y - 6f;
48174 if (Main.rand.Next(20) == 0)
48175 {
48176 int num21 = Main.rand.Next(570, 573);
48177 Vector2 vector2 = new Vector2(base.Center.X + (float)(direction * 30) - 6f, itemLocation.Y - 30f);
48178 Vector2 vector3 = new Vector2(Main.WindForVisuals * 2f + (float)direction * 0.3f, -0.5f);
48179 vector3.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
48180 vector3.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
48181 if (num21 == 572)
48182 {
48183 vector2.X -= 8f;
48184 }
48185 if (num21 == 571)
48186 {
48187 vector2.X -= 4f;
48188 }
48189 Gore.NewGore(vector2, vector3, num21, 0.8f);
48190 }
48191 }
48192 else if (Item.staff[sItem.type])
48193 {
48194 float num22 = 6f;
48195 if (sItem.type == 3476)
48196 {
48197 num22 = 14f;
48198 }
48199 itemLocation = MountedCenter;
48200 itemLocation += (itemRotation.ToRotationVector2() * num22 * direction).Floor();
48201 }
48202 else
48203 {
48204 itemLocation.X = position.X + (float)width * 0.5f - (float)heldItemFrame.Width * 0.5f - (float)(direction * 2);
48205 itemLocation.Y = MountedCenter.Y - (float)heldItemFrame.Height * 0.5f;
48206 }
48207 if (sItem.type != 5065)
48208 {
48209 return;
48210 }
48211 _ = itemRotation;
48212 Vector2 vector4 = itemLocation + itemRotation.ToRotationVector2() * 38f * direction;
48213 Vector2 vector5 = itemRotation.ToRotationVector2() * 5f * direction;
48214 if (itemAnimation % 2 == 0)
48215 {
48216 Color newColor = Main.hslToRgb(0.92f, 1f, 0.5f);
48217 int num23 = Dust.NewDust(vector4, 0, 0, 267, 0f, 0f, 0, newColor);
48218 Main.dust[num23].position = vector4 - velocity + Main.rand.NextVector2Circular(10f, 10f);
48219 Main.dust[num23].noGravity = true;
48220 Main.dust[num23].scale = 0.3f;
48221 Main.dust[num23].fadeIn = Main.rand.NextFloat() * 1.2f;
48222 Main.dust[num23].velocity = Main.rand.NextVector2Circular(1f, 1f) + velocity;
48223 if (num23 != 6000)
48224 {
48225 Dust dust = Dust.CloneDust(num23);
48226 dust.scale /= 2f;
48227 dust.fadeIn *= 0.85f;
48228 dust.color = new Color(255, 255, 255, 255);
48229 }
48230 }
48231 if (itemAnimation % 4 == 0)
48232 {
48234 {
48235 PositionInWorld = vector4,
48236 MovementVector = vector5 * 0.1f + Main.rand.NextVector2Circular(2f, 2f) + velocity
48237 }, whoAmI);
48238 }
48239 }
48240 else if (sItem.useStyle == 13)
48241 {
48242 int useAnimation = itemAnimationMax;
48243 if (itemTimeMax != 0)
48244 {
48245 useAnimation = itemTimeMax;
48246 }
48247 if (useAnimation == 0)
48248 {
48249 useAnimation = sItem.useAnimation;
48250 }
48251 float num24 = 1f - (float)(itemAnimation % useAnimation) / (float)useAnimation;
48253 if (num24 > 0.33f && num24 <= 0.66f)
48254 {
48255 stretch = CompositeArmStretchAmount.ThreeQuarters;
48256 }
48257 if (num24 > 0.66f && num24 <= 1f)
48258 {
48259 stretch = CompositeArmStretchAmount.Full;
48260 }
48261 float rotation = itemRotation * Directions.Y - (float)Math.PI / 2f * (float)direction;
48262 SetCompositeArmFront(enabled: true, stretch, rotation);
48263 }
48264 else if (sItem.useStyle == 8)
48265 {
48266 Projectile projectile = null;
48267 if (ownedProjectileCounts[722] > 0)
48268 {
48269 for (int i = 0; i < 1000; i++)
48270 {
48272 if (projectile2.active && projectile2.owner == whoAmI && projectile2.type == 722)
48273 {
48274 projectile = projectile2;
48275 break;
48276 }
48277 }
48278 }
48279 float num25 = 1f;
48280 if (projectile != null)
48281 {
48282 num25 = MathHelper.Lerp(0.6f, 1f, Utils.GetLerpValue(0f, 800f, Vector2.Distance(MountedCenter, projectile.Center), clamped: true));
48283 }
48284 num25 = 1f;
48285 if (itemAnimation >= sItem.useAnimation - 1 && itemAnimation <= sItem.useAnimation)
48286 {
48287 float num26 = new Vector2(10 * direction, 10f).ToRotation() + (float)Math.PI / 4f;
48288 itemRotation = num26;
48289 if (direction == -1)
48290 {
48291 itemRotation += (float)Math.PI / 2f;
48292 }
48293 _ = 1f - (float)itemAnimation / (float)itemAnimationMax;
48296 float num27 = -(float)Math.PI / 10f;
48297 if (direction == -1)
48298 {
48299 num27 *= -1f;
48300 }
48301 float num28 = itemRotation - (float)Math.PI / 4f + (float)Math.PI;
48302 if (direction == 1)
48303 {
48304 num28 += (float)Math.PI / 2f;
48305 }
48306 float rotation2 = num28 + num27;
48307 float rotation3 = num28 - num27;
48308 Vector2 vector6 = (num28 + (float)Math.PI / 2f).ToRotationVector2() * -2f;
48309 itemLocation = (MountedCenter + vector6).Floor();
48310 SetCompositeArmFront(enabled: true, stretch2, rotation2);
48311 SetCompositeArmBack(enabled: true, stretch3, rotation3);
48312 }
48313 else if (itemAnimation > sItem.useAnimation)
48314 {
48315 float num29 = 0f - Utils.GetLerpValue(itemAnimationMax, itemAnimationMax * 5, itemAnimation, clamped: true);
48316 num29 *= num25;
48319 float num30 = -(float)Math.PI / 10f;
48320 num30 *= 0f - num29;
48321 itemRotation = (float)Math.PI / 2f * (float)(-direction) + (float)Math.PI + (float)Math.PI * num29 * (float)(-direction);
48322 float num31 = -(float)Math.PI / 5f * (float)direction;
48323 if (direction < 1)
48324 {
48325 num30 *= -1f;
48326 }
48327 float rotation4 = num31 + num30;
48328 float rotation5 = num31 - num30;
48329 Vector2 vector7 = new Vector2(10 * direction, num29 * -6f);
48330 itemLocation = (MountedCenter + vector7).Floor();
48331 SetCompositeArmFront(enabled: true, stretch4, rotation4);
48332 SetCompositeArmBack(enabled: true, stretch5, rotation5);
48333 }
48334 else
48335 {
48336 float num32 = 1f - (float)itemAnimation / (float)itemAnimationMax;
48339 if (num32 > 0.6f)
48340 {
48342 }
48343 float num33 = -(float)Math.PI / 10f;
48344 if (direction == -1)
48345 {
48346 num33 *= -1f;
48347 }
48348 num33 *= 1f - num32 * 2.2f;
48349 itemRotation = (num32 * (float)Math.PI * 1.6f + -(float)Math.PI / 2f) * num25 * (float)(-direction) + (float)Math.PI;
48350 float num34 = (num32 * (float)Math.PI * 0.6f + (float)Math.PI * 2f / 5f) * (float)(-direction) + (float)Math.PI - (float)Math.PI / 4f + (float)Math.PI;
48351 if (direction == 1)
48352 {
48353 num34 += (float)Math.PI / 2f;
48354 }
48355 float rotation6 = num34 + num33;
48356 float rotation7 = num34 - num33;
48357 Vector2 vector8 = (num34 + (float)Math.PI / 2f).ToRotationVector2() * (-5f * (1f - num32));
48358 itemLocation = (MountedCenter + vector8).Floor();
48359 SetCompositeArmFront(enabled: true, stretch6, rotation6);
48360 SetCompositeArmBack(enabled: true, stretch7, rotation7);
48361 }
48362 FlipItemLocationAndRotationForGravity();
48363 }
48364 else if (sItem.useStyle == 12)
48365 {
48366 itemRotation = 0f;
48367 itemLocation.X = MountedCenter.X - (float)(8 * direction);
48368 itemLocation.Y = position.Y + 40f + mountOffset;
48369 Vector2 vector9 = Main.OffsetsPlayerHeadgear[bodyFrame.Y / 56];
48370 itemLocation += vector9;
48371 float num35 = itemAnimationMax;
48372 if (num35 == 0f)
48373 {
48374 num35 = sItem.useAnimation;
48375 }
48376 float num36 = 1f - (float)itemAnimation / num35;
48377 num36 *= 2f;
48378 float num37 = (float)Math.Cos(num36 * (float)Math.PI) * 0.2f;
48380 if (num36 > 0.25f && num36 <= 0.5f)
48381 {
48383 }
48384 if (num36 > 0.5f && num36 <= 0.75f)
48385 {
48387 }
48388 if (num36 > 0.75f && num36 <= 1.25f)
48389 {
48391 }
48392 if (num36 > 1.25f && num36 <= 1.5f)
48393 {
48395 }
48396 if (num36 > 1.5f && num36 <= 1.75f)
48397 {
48399 }
48400 if (num36 > 1.75f && num36 <= 2f)
48401 {
48403 }
48404 SetCompositeArmFront(enabled: true, compositeArmStretchAmount3, (-(float)Math.PI / 4f + num37) * (float)direction);
48406 SetCompositeArmBack(enabled: true, stretch8, (-(float)Math.PI / 4f - num37 * 0.5f) * (float)direction);
48407 FlipItemLocationAndRotationForGravity();
48408 if (sItem.type != 4715 || compositeArmStretchAmount3 != CompositeArmStretchAmount.ThreeQuarters)
48409 {
48410 return;
48411 }
48412 Vector2 vector10 = itemLocation + new Vector2(heldItemFrame.Width, -heldItemFrame.Height) * new Vector2(direction, gravDir) * 0.3f;
48413 Dust dust2 = Dust.NewDustPerfect(vector10, 228, Main.rand.NextVector2CircularEdge(1f, 1f));
48414 dust2.noGravity = true;
48415 dust2.noLight = true;
48416 dust2.velocity *= 2f;
48417 float num38 = 0.5f;
48418 for (float num39 = 0f; num39 < 1f; num39 += 0.5f)
48419 {
48420 if (Main.rand.Next(3) == 0)
48421 {
48422 Dust dust3 = Dust.NewDustPerfect(vector10, 278, Vector2.UnitY.RotatedBy(num39 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * num38 - num38 * 0.5f + (float)Math.PI / 2f) * (2f + Main.rand.NextFloat() * 1f), 150, Color.Lerp(Color.White, Color.HotPink, Main.rand.NextFloat() * 0.5f + 0.5f), 0.45f);
48423 dust3.noGravity = true;
48424 dust3.velocity *= 0.5f;
48425 dust3.customData = this;
48426 dust3.position += dust3.velocity * 6f;
48427 }
48428 }
48429 for (float num40 = 0f; num40 < 1f; num40 += 0.5f)
48430 {
48431 if (Main.rand.Next(3) == 0)
48432 {
48433 Dust dust4 = Dust.NewDustPerfect(vector10, 278, Vector2.UnitY.RotatedBy(num40 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * num38 - num38 * 0.5f + (float)Math.PI / 2f) * (0.5f + Main.rand.NextFloat() * 1f), 150, Color.Lerp(Color.White, Color.Gold, Main.rand.NextFloat() * 0.5f + 0.5f), 0.45f);
48434 dust4.noGravity = true;
48435 dust4.velocity *= 0.5f;
48436 dust4.customData = this;
48437 dust4.position += dust4.velocity * 6f;
48438 }
48439 }
48440 }
48441 else if (sItem.useStyle == 14 && !Main.dedServ)
48442 {
48443 itemRotation = 0f;
48444 itemLocation.X = base.Center.X + (float)(6 * direction);
48445 itemLocation.Y = position.Y + 40f + mountOffset - 8f;
48446 Vector2 vector11 = Main.OffsetsPlayerHeadgear[bodyFrame.Y / 56];
48447 itemLocation += vector11;
48449 SetCompositeArmBack(enabled: true, stretch9, (float)Math.PI * -3f / 4f * (float)direction);
48450 FlipItemLocationAndRotationForGravity();
48451 }
48452 }
48453
48455 {
48456 if (gravDir == -1f)
48457 {
48458 itemRotation = 0f - itemRotation;
48459 float num = position.Y - itemLocation.Y;
48460 itemLocation.Y = base.Bottom.Y + num;
48461 }
48462 }
48463
48465 {
48466 bool flag = sItem.type == 4711;
48467 if (sItem.pick > 0 || sItem.axe > 0 || sItem.hammer > 0 || flag)
48468 {
48469 toolTime = 1;
48470 }
48471 if (grappling[0] > -1)
48472 {
48473 pulley = false;
48474 pulleyDir = 1;
48475 if (controlRight)
48476 {
48477 direction = 1;
48478 }
48479 else if (controlLeft)
48480 {
48481 direction = -1;
48482 }
48483 }
48484 StartChanneling(sItem);
48485 attackCD = 0;
48486 ResetMeleeHitCooldowns();
48487 ApplyItemAnimation(sItem);
48489 if (sItem.UseSound != null && !flag2)
48490 {
48491 SoundEngine.PlaySound(sItem.UseSound, base.Center);
48492 }
48493 }
48494
48496 {
48498 {
48499 List<int> list = new List<int>();
48500 float num = 0f;
48501 for (int i = 0; i < 1000; i++)
48502 {
48503 if (!Main.projectile[i].active || Main.projectile[i].owner != whoAmI || !Main.projectile[i].minion)
48504 {
48505 continue;
48506 }
48507 int j;
48508 for (j = 0; j < list.Count; j++)
48509 {
48510 if (Main.projectile[list[j]].minionSlots > Main.projectile[i].minionSlots)
48511 {
48512 list.Insert(j, i);
48513 break;
48514 }
48515 }
48516 if (j == list.Count)
48517 {
48518 list.Add(i);
48519 }
48520 num += Main.projectile[i].minionSlots;
48521 }
48523 float num3 = 0f;
48524 int num4 = 388;
48525 int num5 = -1;
48526 for (int k = 0; k < list.Count; k++)
48527 {
48528 int type = Main.projectile[list[k]].type;
48529 if (type == 626)
48530 {
48531 list.RemoveAt(k);
48532 k--;
48533 }
48534 if (type == 627)
48535 {
48536 if (Main.projectile[(int)Main.projectile[list[k]].localAI[1]].type == 628)
48537 {
48538 num5 = list[k];
48539 }
48540 list.RemoveAt(k);
48541 k--;
48542 }
48543 }
48544 if (num5 != -1)
48545 {
48546 list.Add(num5);
48548 }
48549 for (int l = 0; l < list.Count; l++)
48550 {
48551 if (!(num - num3 > (float)maxMinions - num2))
48552 {
48553 break;
48554 }
48555 int type2 = Main.projectile[list[l]].type;
48556 if (type2 == num4 || type2 == 625 || type2 == 628 || type2 == 623)
48557 {
48558 continue;
48559 }
48560 if (type2 == 388 && num4 == 387)
48561 {
48562 num4 = 388;
48563 }
48564 if (type2 == 387 && num4 == 388)
48565 {
48566 num4 = 387;
48567 }
48568 num3 += Main.projectile[list[l]].minionSlots;
48569 if (type2 == 626 || type2 == 627)
48570 {
48571 Projectile projectile = Main.projectile[list[l]];
48572 int byUUID = Projectile.GetByUUID(projectile.owner, projectile.ai[0]);
48573 if (Main.projectile.IndexInRange(byUUID))
48574 {
48576 if (projectile2.type != 625)
48577 {
48578 projectile2.localAI[1] = projectile.localAI[1];
48579 }
48580 projectile2 = Main.projectile[(int)projectile.localAI[1]];
48581 projectile2.ai[0] = projectile.ai[0];
48582 projectile2.ai[1] = 1f;
48583 projectile2.netUpdate = true;
48584 }
48585 }
48586 Main.projectile[list[l]].Kill();
48587 }
48588 list.Clear();
48589 if (num + num2 >= 9f)
48590 {
48592 }
48593 return;
48594 }
48595 for (int m = 0; m < 1000; m++)
48596 {
48598 if (projectile3.active && projectile3.owner == whoAmI)
48599 {
48600 if (projectile3.type == sItem.shoot)
48601 {
48602 projectile3.Kill();
48603 }
48604 if (sItem.shoot == 72 && (projectile3.type == 86 || projectile3.type == 87))
48605 {
48606 projectile3.Kill();
48607 }
48608 if (sItem.type == 5131 && (projectile3.type == 881 || projectile3.type == 934))
48609 {
48610 projectile3.Kill();
48611 }
48612 }
48613 }
48614 }
48615
48617 {
48618 if (sItem.type == 3001)
48619 {
48620 int minValue = 2400;
48621 int num = 4200;
48622 potionDelay = Main.rand.Next(minValue, num + 1);
48623 if (pStone)
48624 {
48625 potionDelay = (int)((float)potionDelay * PhilosopherStoneDurationMultiplier);
48626 }
48627 AddBuff(21, potionDelay);
48628 }
48629 else if (sItem.type == 227)
48630 {
48631 potionDelay = restorationDelayTime;
48632 AddBuff(21, potionDelay);
48633 }
48634 else if (sItem.type == 5)
48635 {
48636 potionDelay = mushroomDelayTime;
48637 AddBuff(21, potionDelay);
48638 TryToResetHungerToNeutral();
48639 }
48640 else
48641 {
48642 potionDelay = potionDelayTime;
48643 AddBuff(21, potionDelay);
48644 }
48645 }
48646
48648 {
48649 int num = item.healLife;
48650 int healMana = item.healMana;
48651 if (item.type == 3001)
48652 {
48653 int healLife = item.healLife;
48654 int num2 = 120;
48655 num = Main.rand.Next(healLife, num2 + 1);
48656 if (Main.myPlayer == whoAmI)
48657 {
48658 float num3 = Main.rand.NextFloat();
48659 int num4 = 0;
48660 if (num3 <= 0.1f)
48661 {
48662 num4 = 240;
48663 }
48664 else if (num3 <= 0.3f)
48665 {
48666 num4 = 120;
48667 }
48668 else if (num3 <= 0.6f)
48669 {
48670 num4 = 60;
48671 }
48672 if (num4 > 0)
48673 {
48674 SetImmuneTimeForAllTypes(num4);
48675 }
48676 }
48677 }
48678 statLife += num;
48679 statMana += healMana;
48680 if (statLife > statLifeMax2)
48681 {
48682 statLife = statLifeMax2;
48683 }
48684 if (statMana > statManaMax2)
48685 {
48686 statMana = statManaMax2;
48687 }
48688 if (num > 0 && Main.myPlayer == whoAmI)
48689 {
48690 HealEffect(num);
48691 }
48692 if (healMana > 0)
48693 {
48694 AddBuff(94, manaSickTime);
48695 if (Main.myPlayer == whoAmI)
48696 {
48697 ManaEffect(healMana);
48698 }
48699 }
48700 }
48701
48703 {
48704 int num = whoAmI;
48705 bool flag = true;
48706 int num2 = (int)((float)Main.mouseX + Main.screenPosition.X) / 16;
48707 int num3 = (int)((float)Main.mouseY + Main.screenPosition.Y) / 16;
48708 if (gravDir == -1f)
48709 {
48710 num3 = (int)(Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16;
48711 }
48712 if (sItem.type == 3335 && (extraAccessory || !Main.expertMode))
48713 {
48714 flag = false;
48715 }
48716 if (pulley && sItem.fishingPole > 0)
48717 {
48718 flag = false;
48719 }
48720 if (pulley && ItemID.Sets.IsAKite[sItem.type])
48721 {
48722 flag = false;
48723 }
48725 {
48726 flag = false;
48727 }
48728 if (sItem.type == 5451 && ownedProjectileCounts[1020] > 0)
48729 {
48730 flag = false;
48731 }
48732 if ((sItem.type == 3611 || sItem.type == 3625) && wireOperationsCooldown > 0)
48733 {
48734 flag = false;
48735 }
48736 if (!CheckDD2CrystalPaymentLock(sItem))
48737 {
48738 flag = false;
48739 }
48740 if (sItem.shoot > -1 && ProjectileID.Sets.IsADD2Turret[sItem.shoot] && !downedDD2EventAnyDifficulty && !DD2Event.Ongoing)
48741 {
48742 flag = false;
48743 }
48744 if (sItem.shoot > -1 && ProjectileID.Sets.IsADD2Turret[sItem.shoot] && DD2Event.Ongoing && num == Main.myPlayer)
48745 {
48746 FindSentryRestingSpot(sItem.shoot, out var worldX, out var worldY, out var _);
48747 if (WouldSpotOverlapWithSentry(worldX, worldY, sItem.shoot == 688 || sItem.shoot == 689 || sItem.shoot == 690))
48748 {
48749 flag = false;
48750 }
48751 }
48752 if (sItem.shoot > -1 && ProjectileID.Sets.IsADD2Turret[sItem.shoot] && num == Main.myPlayer)
48753 {
48754 FindSentryRestingSpot(sItem.shoot, out var worldX2, out var worldY2, out var _);
48755 worldX2 /= 16;
48756 worldY2 /= 16;
48757 worldY2--;
48758 if (sItem.shoot == 688 || sItem.shoot == 689 || sItem.shoot == 690)
48759 {
48761 {
48762 flag = false;
48763 }
48764 }
48765 else if (WorldGen.SolidTile(worldX2, worldY2))
48766 {
48767 flag = false;
48768 }
48769 }
48770 if (wet && (sItem.shoot == 85 || sItem.shoot == 15 || sItem.shoot == 34))
48771 {
48772 flag = false;
48773 }
48774 if (sItem.makeNPC > 0 && !NPC.CanReleaseNPCs(whoAmI))
48775 {
48776 flag = false;
48777 }
48778 if (whoAmI == Main.myPlayer && sItem.type == 603 && !Main.runningCollectorsEdition)
48779 {
48780 flag = false;
48781 }
48782 if (sItem.type == 1071 || sItem.type == 1072)
48783 {
48784 bool flag2 = false;
48785 for (int i = 0; i < 58; i++)
48786 {
48787 if (inventory[i].PaintOrCoating)
48788 {
48789 flag2 = true;
48790 break;
48791 }
48792 }
48793 if (!flag2)
48794 {
48795 flag = false;
48796 }
48797 }
48798 if (noItems)
48799 {
48800 flag = false;
48801 }
48802 if (sItem.tileWand > 0)
48803 {
48804 int tileWand = sItem.tileWand;
48805 flag = false;
48806 for (int j = 0; j < 58; j++)
48807 {
48808 if (tileWand == inventory[j].type && inventory[j].stack > 0)
48809 {
48810 flag = true;
48811 break;
48812 }
48813 }
48814 }
48815 if (sItem.shoot == 6 || sItem.shoot == 19 || sItem.shoot == 33 || sItem.shoot == 52 || sItem.shoot == 113 || sItem.shoot == 320 || sItem.shoot == 333 || sItem.shoot == 383 || sItem.shoot == 491 || sItem.shoot == 867 || sItem.shoot == 902 || sItem.shoot == 866)
48816 {
48817 for (int k = 0; k < 1000; k++)
48818 {
48819 if (Main.projectile[k].active && Main.projectile[k].owner == Main.myPlayer && Main.projectile[k].type == sItem.shoot)
48820 {
48821 flag = false;
48822 }
48823 }
48824 }
48825 if (sItem.shoot == 106)
48826 {
48827 int num4 = 0;
48828 for (int l = 0; l < 1000; l++)
48829 {
48830 if (Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == sItem.shoot)
48831 {
48832 num4++;
48833 }
48834 }
48835 if (num4 >= 6)
48836 {
48837 flag = false;
48838 }
48839 }
48840 if (sItem.shoot == 272)
48841 {
48842 int num5 = 0;
48843 for (int m = 0; m < 1000; m++)
48844 {
48845 if (Main.projectile[m].active && Main.projectile[m].owner == Main.myPlayer && Main.projectile[m].type == sItem.shoot)
48846 {
48847 num5++;
48848 }
48849 }
48850 if (num5 >= 10)
48851 {
48852 flag = false;
48853 }
48854 }
48855 if (sItem.shoot == 1000)
48856 {
48857 int num6 = 0;
48858 for (int n = 0; n < 1000; n++)
48859 {
48860 if (Main.projectile[n].active && Main.projectile[n].owner == Main.myPlayer && Main.projectile[n].type == sItem.shoot)
48861 {
48862 num6++;
48863 }
48864 }
48865 if (num6 >= 3)
48866 {
48867 flag = false;
48868 }
48869 }
48870 if (sItem.shoot == 13 || sItem.shoot == 32 || (sItem.shoot >= 230 && sItem.shoot <= 235) || sItem.shoot == 315 || sItem.shoot == 331 || sItem.shoot == 372)
48871 {
48872 for (int num7 = 0; num7 < 1000; num7++)
48873 {
48874 if (Main.projectile[num7].active && Main.projectile[num7].owner == Main.myPlayer && Main.projectile[num7].type == sItem.shoot && Main.projectile[num7].ai[0] != 2f)
48875 {
48876 flag = false;
48877 }
48878 }
48879 }
48880 if (sItem.shoot == 332)
48881 {
48882 int num8 = 0;
48883 for (int num9 = 0; num9 < 1000; num9++)
48884 {
48885 if (Main.projectile[num9].active && Main.projectile[num9].owner == Main.myPlayer && Main.projectile[num9].type == sItem.shoot && Main.projectile[num9].ai[0] != 2f)
48886 {
48887 num8++;
48888 }
48889 }
48890 if (num8 >= 3)
48891 {
48892 flag = false;
48893 }
48894 }
48895 if (sItem.potion && potionDelay > 0)
48896 {
48897 flag = false;
48898 }
48899 if (sItem.mana > 0 && silence)
48900 {
48901 flag = false;
48902 }
48903 if (sItem.mana > 0 && flag)
48904 {
48905 flag = ItemCheck_PayMana(sItem, flag);
48906 }
48907 if (sItem.type == 43 && Main.IsItDay())
48908 {
48909 flag = false;
48910 }
48911 if (sItem.type == 544 && Main.IsItDay())
48912 {
48913 flag = false;
48914 }
48915 if (sItem.type == 556 && Main.IsItDay())
48916 {
48917 flag = false;
48918 }
48919 if (sItem.type == 557 && Main.IsItDay())
48920 {
48921 flag = false;
48922 }
48923 if (sItem.type == 70 && !ZoneCorrupt)
48924 {
48925 flag = false;
48926 }
48927 if (sItem.type == 1133 && !ZoneJungle)
48928 {
48929 flag = false;
48930 }
48931 if (sItem.type == 5120 && !ZoneSnow)
48932 {
48933 flag = false;
48934 }
48935 if (sItem.type == 1844 && (Main.dayTime || Main.pumpkinMoon || Main.snowMoon || DD2Event.Ongoing))
48936 {
48937 flag = false;
48938 }
48939 if (sItem.type == 1958 && (Main.dayTime || Main.pumpkinMoon || Main.snowMoon || DD2Event.Ongoing))
48940 {
48941 flag = false;
48942 }
48943 if (sItem.type == 2767 && (!Main.dayTime || Main.eclipse || !Main.hardMode))
48944 {
48945 flag = false;
48946 }
48947 if (sItem.type == 4271 && (Main.dayTime || Main.bloodMoon))
48948 {
48949 flag = false;
48950 }
48951 if (sItem.type == 3601 && (!NPC.downedGolemBoss || !Main.hardMode || NPC.AnyDanger() || NPC.AnyoneNearCultists()))
48952 {
48953 flag = false;
48954 }
48955 if (!SummonItemCheck(sItem))
48956 {
48957 flag = false;
48958 }
48959 if (sItem.shoot == 17 && flag && num == Main.myPlayer && !ItemCheck_IsValidDirtRodTarget(Main.tile[num2, num3]))
48960 {
48961 flag = false;
48962 }
48963 if (sItem.chlorophyteExtractinatorConsumable && flag && num == Main.myPlayer)
48964 {
48965 Tile tile = Main.tile[num2, num3];
48966 if (!tile.active() || (tile.type != 642 && tile.type != 219))
48967 {
48968 flag = false;
48969 }
48970 }
48971 if (sItem.fishingPole > 0)
48972 {
48973 flag = ItemCheck_CheckFishingBobbers(flag);
48974 }
48976 {
48977 flag = ItemCheck_CheckUsabilityOfProjectiles(flag);
48978 }
48979 if (sItem.shoot == 17 && flag && num == Main.myPlayer)
48980 {
48981 if (ItemCheck_IsValidDirtRodTarget(Main.tile[num2, num3]))
48982 {
48983 WorldGen.KillTile(num2, num3, fail: false, effectOnly: false, noItem: true);
48984 if (!Main.tile[num2, num3].active())
48985 {
48986 if (Main.netMode == 1)
48987 {
48988 NetMessage.SendData(17, -1, -1, null, 4, num2, num3);
48989 }
48990 }
48991 else
48992 {
48993 flag = false;
48994 }
48995 }
48996 else
48997 {
48998 flag = false;
48999 }
49000 }
49001 if (flag)
49002 {
49003 flag = HasAmmo(sItem, flag);
49004 }
49005 return flag;
49006 }
49007
49009 {
49010 for (int i = 0; i < 1000; i++)
49011 {
49012 Projectile projectile = Main.projectile[i];
49013 if (projectile.active && projectile.owner == whoAmI)
49014 {
49015 projectile.CheckUsability(this, ref canUse);
49016 }
49017 }
49018 return canUse;
49019 }
49020
49022 {
49023 for (int i = 0; i < 1000; i++)
49024 {
49025 Projectile projectile = Main.projectile[i];
49026 if (!projectile.active || projectile.owner != whoAmI || !projectile.bobber)
49027 {
49028 continue;
49029 }
49030 canUse = false;
49031 if (whoAmI != Main.myPlayer || projectile.ai[0] != 0f)
49032 {
49033 continue;
49034 }
49035 projectile.ai[0] = 1f;
49036 float num = -10f;
49037 if (projectile.wet && projectile.velocity.Y > num)
49038 {
49039 projectile.velocity.Y = num;
49040 }
49041 projectile.netUpdate2 = true;
49042 if (projectile.ai[1] < 0f && projectile.localAI[1] != 0f)
49043 {
49044 ItemCheck_CheckFishingBobber_PickAndConsumeBait(projectile, out var pullTheBobber, out var baitTypeUsed);
49045 if (pullTheBobber)
49046 {
49047 ItemCheck_CheckFishingBobber_PullBobber(projectile, baitTypeUsed);
49048 }
49049 }
49050 }
49051 return canUse;
49052 }
49053
49055 {
49056 if (baitTypeUsed == 2673)
49057 {
49058 if (Main.netMode != 1)
49059 {
49060 NPC.SpawnOnPlayer(whoAmI, 370);
49061 }
49062 else
49063 {
49064 NetMessage.SendData(61, -1, -1, null, whoAmI, 370f);
49065 }
49066 bobber.ai[0] = 2f;
49067 }
49068 else if (bobber.localAI[1] < 0f)
49069 {
49070 Point point = new Point((int)bobber.position.X, (int)bobber.position.Y);
49071 int num = (int)(0f - bobber.localAI[1]);
49072 if (num == 618)
49073 {
49074 point.Y += 64;
49075 }
49076 if (Main.netMode == 1)
49077 {
49078 NetMessage.SendData(130, -1, -1, null, point.X / 16, point.Y / 16, num);
49079 }
49080 else
49081 {
49082 if (num == 682)
49083 {
49084 NPC.unlockedSlimeRedSpawn = true;
49085 }
49086 NPC.NewNPC(new EntitySource_FishedOut(this), point.X, point.Y, num);
49087 bobber.ai[0] = 2f;
49089 }
49090 }
49091 else if (Main.rand.Next(7) == 0 && !accFishingLine)
49092 {
49093 bobber.ai[0] = 2f;
49094 }
49095 else
49096 {
49097 bobber.ai[1] = bobber.localAI[1];
49098 }
49099 bobber.netUpdate = true;
49100 }
49101
49103 {
49104 pullTheBobber = false;
49105 baitTypeUsed = 0;
49106 int num = -1;
49107 for (int i = 54; i < 58; i++)
49108 {
49109 if (inventory[i].stack > 0 && inventory[i].bait > 0)
49110 {
49111 num = i;
49112 break;
49113 }
49114 }
49115 if (num == -1)
49116 {
49117 for (int j = 0; j < 50; j++)
49118 {
49119 if (inventory[j].stack > 0 && inventory[j].bait > 0)
49120 {
49121 num = j;
49122 break;
49123 }
49124 }
49125 }
49126 if (num <= -1)
49127 {
49128 return;
49129 }
49130 Item item = inventory[num];
49131 bool flag = false;
49132 float num2 = 1f + (float)item.bait / 6f;
49133 if (num2 < 1f)
49134 {
49135 num2 = 1f;
49136 }
49137 if (accTackleBox)
49138 {
49139 num2 += 1f;
49140 }
49141 if (Main.rand.NextFloat() * num2 < 1f)
49142 {
49143 flag = true;
49144 }
49145 if (bobber.localAI[1] == -1f)
49146 {
49147 flag = true;
49148 }
49149 if (bobber.localAI[1] > 0f)
49150 {
49151 Item item2 = new Item();
49152 item2.SetDefaults((int)bobber.localAI[1]);
49153 if (item2.rare < 0)
49154 {
49155 flag = false;
49156 }
49157 }
49158 baitTypeUsed = item.type;
49159 if (baitTypeUsed == 2895)
49160 {
49161 flag = Main.rand.Next(20) == 0;
49162 }
49163 if (baitTypeUsed == 2673)
49164 {
49165 flag = true;
49166 }
49167 if (flag)
49168 {
49169 if (item.type == 4361 || item.type == 4362)
49170 {
49171 NPC.LadyBugKilled(base.Center, item.type == 4362);
49172 }
49173 item.stack--;
49174 if (item.stack <= 0)
49175 {
49176 item.SetDefaults();
49177 }
49178 }
49179 pullTheBobber = true;
49180 }
49181
49183 {
49184 if (t.active())
49185 {
49186 if (t.type != 0 && t.type != 2 && t.type != 23 && t.type != 109 && t.type != 199 && t.type != 477)
49187 {
49188 return t.type == 492;
49189 }
49190 return true;
49191 }
49192 return false;
49193 }
49194
49196 {
49197 bool flag = altFunctionUse == 2;
49198 bool flag2 = false;
49199 int num = (int)((float)sItem.mana * manaCost);
49200 if (sItem.type == 2795)
49201 {
49202 flag2 = true;
49203 }
49204 if (sItem.type == 3852 && flag)
49205 {
49206 num = (int)((float)(sItem.mana * 2) * manaCost);
49207 }
49208 if (sItem.shoot > 0 && ProjectileID.Sets.TurretFeature[sItem.shoot] && flag)
49209 {
49210 flag2 = true;
49211 }
49212 if (sItem.shoot > 0 && ProjectileID.Sets.MinionTargettingFeature[sItem.shoot] && flag)
49213 {
49214 flag2 = true;
49215 }
49216 if (sItem.type == 3006)
49217 {
49218 flag2 = true;
49219 }
49220 if (sItem.type != 3269 && (!spaceGun || (sItem.type != 127 && sItem.type != 4347 && sItem.type != 4348)))
49221 {
49222 if (statMana >= num)
49223 {
49224 if (!flag2)
49225 {
49226 statMana -= num;
49227 }
49228 }
49229 else if (manaFlower)
49230 {
49231 QuickMana();
49232 if (statMana >= num)
49233 {
49234 if (!flag2)
49235 {
49236 statMana -= num;
49237 }
49238 }
49239 else
49240 {
49241 canUse = false;
49242 }
49243 }
49244 else
49245 {
49246 canUse = false;
49247 }
49248 }
49249 return canUse;
49250 }
49251
49253 {
49254 if (!controlUseItem || !releaseUseItem || (sItem.headSlot <= 0 && sItem.bodySlot <= 0 && sItem.legSlot <= 0))
49255 {
49256 return;
49257 }
49258 if (sItem.useStyle == 0)
49259 {
49260 releaseUseItem = false;
49261 }
49262 if (!(position.X / 16f - (float)tileRangeX - (float)sItem.tileBoost <= (float)tileTargetX) || !((position.X + (float)width) / 16f + (float)tileRangeX + (float)sItem.tileBoost - 1f >= (float)tileTargetX) || !(position.Y / 16f - (float)tileRangeY - (float)sItem.tileBoost <= (float)tileTargetY) || !((position.Y + (float)height) / 16f + (float)tileRangeY + (float)sItem.tileBoost - 2f >= (float)tileTargetY))
49263 {
49264 return;
49265 }
49266 int num = tileTargetX;
49267 int num2 = tileTargetY;
49268 if (!Main.tile[num, num2].active() || (Main.tile[num, num2].type != 128 && Main.tile[num, num2].type != 269))
49269 {
49270 return;
49271 }
49272 int frameY = Main.tile[num, num2].frameY;
49273 int num3 = 0;
49274 if (sItem.bodySlot >= 0)
49275 {
49276 num3 = 1;
49277 }
49278 if (sItem.legSlot >= 0)
49279 {
49280 num3 = 2;
49281 }
49282 frameY /= 18;
49283 while (num3 > frameY)
49284 {
49285 num2++;
49286 frameY = Main.tile[num, num2].frameY;
49287 frameY /= 18;
49288 }
49289 while (num3 < frameY)
49290 {
49291 num2--;
49292 frameY = Main.tile[num, num2].frameY;
49293 frameY /= 18;
49294 }
49295 int num4;
49296 for (num4 = Main.tile[num, num2].frameX; num4 >= 100; num4 -= 100)
49297 {
49298 }
49299 if (num4 >= 36)
49300 {
49301 num4 -= 36;
49302 }
49303 num -= num4 / 18;
49304 int num5 = Main.tile[num, num2].frameX;
49305 WorldGen.KillTile(num, num2, fail: true);
49306 if (Main.netMode == 1)
49307 {
49308 NetMessage.SendData(17, -1, -1, null, 0, num, num2, 1f);
49309 }
49310 while (num5 >= 100)
49311 {
49312 num5 -= 100;
49313 }
49314 if (frameY == 0 && sItem.headSlot >= 0)
49315 {
49316 Main.blockMouse = true;
49317 Main.tile[num, num2].frameX = (short)(num5 + sItem.headSlot * 100);
49318 if (Main.netMode == 1)
49319 {
49320 NetMessage.SendTileSquare(-1, num, num2);
49321 }
49322 sItem.stack--;
49323 if (sItem.stack <= 0)
49324 {
49325 sItem.SetDefaults();
49326 Main.mouseItem.SetDefaults();
49327 }
49328 if (selectedItem == 58)
49329 {
49330 Main.mouseItem = sItem.Clone();
49331 }
49332 releaseUseItem = false;
49333 mouseInterface = true;
49334 }
49335 else if (frameY == 1 && sItem.bodySlot >= 0)
49336 {
49337 Main.blockMouse = true;
49338 Main.tile[num, num2].frameX = (short)(num5 + sItem.bodySlot * 100);
49339 if (Main.netMode == 1)
49340 {
49341 NetMessage.SendTileSquare(-1, num, num2);
49342 }
49343 sItem.stack--;
49344 if (sItem.stack <= 0)
49345 {
49346 sItem.SetDefaults();
49347 Main.mouseItem.SetDefaults();
49348 }
49349 if (selectedItem == 58)
49350 {
49351 Main.mouseItem = sItem.Clone();
49352 }
49353 releaseUseItem = false;
49354 mouseInterface = true;
49355 }
49356 else if (frameY == 2 && sItem.legSlot >= 0 && !ArmorIDs.Legs.Sets.MannequinIncompatible.Contains(sItem.legSlot))
49357 {
49358 Main.blockMouse = true;
49359 Main.tile[num, num2].frameX = (short)(num5 + sItem.legSlot * 100);
49360 if (Main.netMode == 1)
49361 {
49362 NetMessage.SendTileSquare(-1, num, num2);
49363 }
49364 sItem.stack--;
49365 if (sItem.stack <= 0)
49366 {
49367 sItem.SetDefaults();
49368 Main.mouseItem.SetDefaults();
49369 }
49370 if (selectedItem == 58)
49371 {
49372 Main.mouseItem = sItem.Clone();
49373 }
49374 releaseUseItem = false;
49375 mouseInterface = true;
49376 }
49377 }
49378
49379 private void ApplyReuseDelay()
49380 {
49381 itemAnimation = reuseDelay;
49382 itemTime = reuseDelay;
49383 reuseDelay = 0;
49384 }
49385
49387 {
49388 if (sItem.fishingPole > 0)
49389 {
49390 sItem.holdStyle = 0;
49391 if (ItemTimeIsZero && itemAnimation == 0)
49392 {
49393 for (int i = 0; i < 1000; i++)
49394 {
49395 if (Main.projectile[i].active && Main.projectile[i].owner == whoAmI && Main.projectile[i].bobber)
49396 {
49397 sItem.holdStyle = 1;
49398 }
49399 }
49400 }
49401 }
49402 if (!ItemID.Sets.IsAKite[sItem.type])
49403 {
49404 return;
49405 }
49406 sItem.holdStyle = 0;
49407 if (!ItemTimeIsZero || itemAnimation != 0)
49408 {
49409 return;
49410 }
49411 for (int j = 0; j < 1000; j++)
49412 {
49413 if (Main.projectile[j].active && Main.projectile[j].owner == whoAmI && Main.projectile[j].type == sItem.shoot)
49414 {
49415 sItem.holdStyle = 1;
49416 ChangeDir((!(Main.projectile[j].Center.X - base.Center.X < 0f)) ? 1 : (-1));
49417 }
49418 }
49419 }
49420
49422 {
49423 if (sItem.autoReuse && !noItems)
49424 {
49425 releaseUseItem = true;
49426 if (itemAnimation == 1 && sItem.stack > 0)
49427 {
49428 if (sItem.shoot > 0 && whoAmI != Main.myPlayer && controlUseItem && sItem.useStyle == 5 && sItem.reuseDelay == 0)
49429 {
49430 ApplyItemAnimation(sItem);
49431 }
49432 else
49433 {
49434 itemAnimation = 0;
49435 }
49436 }
49437 }
49438 TryAllowingItemReuse(sItem);
49439 }
49440
49442 {
49443 bool flag = false;
49444 if (autoReuseGlove)
49445 {
49446 flag |= sItem.melee && sItem.type != 3030;
49447 flag |= sItem.summon && ItemID.Sets.SummonerWeaponThatScalesWithAttackSpeed[sItem.type];
49448 }
49449 if (autoReuseAllWeapons && sItem.damage > 0 && (!sItem.channel || !channel))
49450 {
49451 flag = true;
49452 }
49453 if (flag)
49454 {
49455 releaseUseItem = true;
49456 }
49457 }
49458
49460 {
49461 if (!mount.Active)
49462 {
49463 return;
49464 }
49465 if (whoAmI == Main.myPlayer && gravDir == -1f)
49466 {
49467 mount.Dismount(this);
49468 }
49469 else
49470 {
49471 if (mount.Type != 8)
49472 {
49473 return;
49474 }
49475 noItems = true;
49476 if (controlUseItem || controlUseTile)
49477 {
49478 StartChanneling();
49479 if (releaseUseItem && releaseUseTile)
49480 {
49481 mount.UseAbility(this, Vector2.Zero, toggleOn: true);
49482 }
49483 releaseUseItem = false;
49484 releaseUseTile = false;
49485 }
49486 }
49487 }
49488
49489 public void StartChanneling()
49490 {
49491 channel = true;
49492 _channelShotCache = default(ChannelCancelKey);
49493 }
49494
49496 {
49497 if (item.channel)
49498 {
49499 channel = true;
49500 _channelShotCache = new ChannelCancelKey
49501 {
49502 ProjectileTypeExpected = item.shoot
49503 };
49504 }
49505 }
49506
49507 public void TryUpdateChannel(Projectile projectile)
49508 {
49509 _channelShotCache.TryTracking(projectile);
49510 }
49511
49512 public void TryCancelChannel(Projectile projectile)
49513 {
49514 if (_channelShotCache.Matches(projectile))
49515 {
49516 channel = false;
49517 }
49518 }
49519
49520 public static bool WouldSpotOverlapWithSentry(int worldX, int worldY, bool lightningAura)
49521 {
49522 Point value = new Point(worldX, worldY - 8);
49523 Point value2 = new Point(worldX + 16, worldY - 8);
49524 Point value3 = new Point(worldX - 16, worldY - 8);
49525 bool result = false;
49526 for (int i = 0; i < 1000; i++)
49527 {
49528 Projectile projectile = Main.projectile[i];
49529 if (projectile.active && projectile.sentry)
49530 {
49531 Rectangle hitbox = projectile.Hitbox;
49532 if (!lightningAura && hitbox.X > 30)
49533 {
49534 hitbox.X += hitbox.Width / 2;
49535 hitbox.Width = 30;
49536 hitbox.X -= hitbox.Width / 2;
49537 }
49539 {
49540 result = true;
49541 break;
49542 }
49543 }
49544 }
49545 return result;
49546 }
49547
49549 {
49550 bool flag = false;
49552 LimitPointToPlayerReachableArea(ref pointPoisition);
49553 int num = (int)pointPoisition.X / 16;
49554 int i = (int)pointPoisition.Y / 16;
49555 worldX = num * 16 + 8;
49556 pushYUp = 41;
49557 switch (checkProj)
49558 {
49559 case 663:
49560 worldX += direction;
49561 break;
49562 case 665:
49563 pushYUp += 2;
49564 break;
49565 case 667:
49566 pushYUp += 3;
49567 break;
49568 case 677:
49569 worldX += direction;
49570 break;
49571 case 678:
49572 worldX += direction;
49573 break;
49574 case 691:
49575 case 692:
49576 case 693:
49577 pushYUp = 20;
49578 worldX += direction;
49579 pushYUp += 2;
49580 break;
49581 }
49582 if (!flag)
49583 {
49584 for (; i < Main.maxTilesY - 10 && Main.tile[num, i] != null && !WorldGen.SolidTile2(num, i) && Main.tile[num - 1, i] != null && !WorldGen.SolidTile2(num - 1, i) && Main.tile[num + 1, i] != null && !WorldGen.SolidTile2(num + 1, i); i++)
49585 {
49586 }
49587 i++;
49588 }
49589 i--;
49590 pushYUp -= 14;
49591 worldY = i * 16;
49592 }
49593
49594 public void UpdateMaxTurrets()
49595 {
49596 if (Main.myPlayer != whoAmI)
49597 {
49598 return;
49599 }
49601 for (int i = 0; i < 1000; i++)
49602 {
49603 if (Main.projectile[i].WipableTurret)
49604 {
49605 list.Add(Main.projectile[i]);
49606 }
49607 }
49608 int num = 0;
49609 while (list.Count > maxTurrets && ++num < 1000)
49610 {
49611 Projectile projectile = list[0];
49612 for (int j = 1; j < list.Count; j++)
49613 {
49614 if (list[j].timeLeft < projectile.timeLeft)
49615 {
49616 projectile = list[j];
49617 }
49618 }
49619 projectile.Kill();
49620 list.Remove(projectile);
49621 }
49622 }
49623
49625 {
49626 if (whoAmI == Main.myPlayer && sItem.type == 603 && Main.runningCollectorsEdition)
49627 {
49628 AddBuff(sItem.buffType, 3600);
49629 }
49630 if (whoAmI == Main.myPlayer && sItem.type == 669)
49631 {
49632 AddBuff(sItem.buffType, 3600);
49633 }
49634 if (whoAmI == Main.myPlayer && sItem.type == 115)
49635 {
49636 AddBuff(sItem.buffType, 3600);
49637 }
49638 if (whoAmI == Main.myPlayer && sItem.type == 3060)
49639 {
49640 AddBuff(sItem.buffType, 3600);
49641 }
49642 if (whoAmI == Main.myPlayer && sItem.type == 3628)
49643 {
49644 AddBuff(sItem.buffType, 3600);
49645 }
49646 if (whoAmI == Main.myPlayer && sItem.type == 3062)
49647 {
49648 AddBuff(sItem.buffType, 3600);
49649 }
49650 if (whoAmI == Main.myPlayer && sItem.type == 3577)
49651 {
49652 AddBuff(sItem.buffType, 3600);
49653 }
49654 if (whoAmI == Main.myPlayer && sItem.type == 425)
49655 {
49656 int num = Main.rand.Next(3);
49657 if (num == 0)
49658 {
49659 num = 27;
49660 }
49661 if (num == 1)
49662 {
49663 num = 101;
49664 }
49665 if (num == 2)
49666 {
49667 num = 102;
49668 }
49669 for (int i = 0; i < maxBuffs; i++)
49670 {
49671 if (buffType[i] == 27 || buffType[i] == 101 || buffType[i] == 102)
49672 {
49673 DelBuff(i);
49674 i--;
49675 }
49676 }
49677 AddBuff(num, 3600);
49678 }
49679 if (whoAmI == Main.myPlayer && sItem.type == 753)
49680 {
49681 AddBuff(sItem.buffType, 3600);
49682 }
49683 if (whoAmI == Main.myPlayer && sItem.type == 994)
49684 {
49685 AddBuff(sItem.buffType, 3600);
49686 }
49687 if (whoAmI == Main.myPlayer && sItem.type == 1169)
49688 {
49689 AddBuff(sItem.buffType, 3600);
49690 }
49691 if (whoAmI == Main.myPlayer && sItem.type == 1170)
49692 {
49693 AddBuff(sItem.buffType, 3600);
49694 }
49695 if (whoAmI == Main.myPlayer && sItem.type == 1171)
49696 {
49697 AddBuff(sItem.buffType, 3600);
49698 }
49699 if (whoAmI == Main.myPlayer && sItem.type == 1172)
49700 {
49701 AddBuff(sItem.buffType, 3600);
49702 }
49703 if (whoAmI == Main.myPlayer && sItem.type == 1180)
49704 {
49705 AddBuff(sItem.buffType, 3600);
49706 }
49707 if (whoAmI == Main.myPlayer && sItem.type == 1181)
49708 {
49709 AddBuff(sItem.buffType, 3600);
49710 }
49711 if (whoAmI == Main.myPlayer && sItem.type == 1182)
49712 {
49713 AddBuff(sItem.buffType, 3600);
49714 }
49715 if (whoAmI == Main.myPlayer && sItem.type == 1183)
49716 {
49717 AddBuff(sItem.buffType, 3600);
49718 }
49719 if (whoAmI == Main.myPlayer && sItem.type == 1242)
49720 {
49721 AddBuff(sItem.buffType, 3600);
49722 }
49723 if (whoAmI == Main.myPlayer && sItem.type == 1157)
49724 {
49725 AddBuff(sItem.buffType, 3600);
49726 }
49727 if (whoAmI == Main.myPlayer && sItem.type == 1309)
49728 {
49729 AddBuff(sItem.buffType, 3600);
49730 }
49731 if (whoAmI == Main.myPlayer && sItem.type == 1311)
49732 {
49733 AddBuff(sItem.buffType, 3600);
49734 }
49735 if (whoAmI == Main.myPlayer && sItem.type == 1837)
49736 {
49737 AddBuff(sItem.buffType, 3600);
49738 }
49739 if (whoAmI == Main.myPlayer && sItem.type == 1312)
49740 {
49741 AddBuff(sItem.buffType, 3600);
49742 }
49743 if (whoAmI == Main.myPlayer && sItem.type == 1798)
49744 {
49745 AddBuff(sItem.buffType, 3600);
49746 }
49747 if (whoAmI == Main.myPlayer && sItem.type == 1799)
49748 {
49749 AddBuff(sItem.buffType, 3600);
49750 }
49751 if (whoAmI == Main.myPlayer && sItem.type == 1802)
49752 {
49753 AddBuff(sItem.buffType, 3600);
49754 }
49755 if (whoAmI == Main.myPlayer && sItem.type == 1810)
49756 {
49757 AddBuff(sItem.buffType, 3600);
49758 }
49759 if (whoAmI == Main.myPlayer && sItem.type == 1927)
49760 {
49761 AddBuff(sItem.buffType, 3600);
49762 }
49763 if (whoAmI == Main.myPlayer && sItem.type == 1959)
49764 {
49765 AddBuff(sItem.buffType, 3600);
49766 }
49767 if (whoAmI == Main.myPlayer && sItem.type == 2364)
49768 {
49769 AddBuff(sItem.buffType, 3600);
49770 }
49771 if (whoAmI == Main.myPlayer && sItem.type == 2365)
49772 {
49773 AddBuff(sItem.buffType, 3600);
49774 }
49775 if (whoAmI == Main.myPlayer && sItem.type == 3043)
49776 {
49777 AddBuff(sItem.buffType, 3600);
49778 }
49779 if (whoAmI == Main.myPlayer && sItem.type == 2420)
49780 {
49781 AddBuff(sItem.buffType, 3600);
49782 }
49783 if (whoAmI == Main.myPlayer)
49784 {
49785 switch (sItem.type)
49786 {
49787 case 2535:
49788 case 2551:
49789 case 2584:
49790 case 2587:
49791 case 2621:
49792 case 2749:
49793 case 3249:
49794 case 3474:
49795 case 3531:
49796 case 4269:
49797 case 4273:
49798 case 4281:
49799 case 4607:
49800 case 4758:
49801 case 5005:
49802 case 5069:
49803 case 5114:
49804 AddBuff(sItem.buffType, 3600);
49805 break;
49806 }
49807 }
49808 if (whoAmI == Main.myPlayer)
49809 {
49810 switch (sItem.type)
49811 {
49812 case 3855:
49813 case 3856:
49814 case 3857:
49815 case 4365:
49816 case 4366:
49817 case 4425:
49818 case 4550:
49819 case 4551:
49820 case 4603:
49821 case 4604:
49822 case 4605:
49823 case 4701:
49824 case 4735:
49825 case 4736:
49826 case 4737:
49827 case 4777:
49828 case 4797:
49829 case 4798:
49830 case 4799:
49831 case 4800:
49832 case 4801:
49833 case 4802:
49834 case 4803:
49835 case 4804:
49836 case 4805:
49837 case 4806:
49838 case 4807:
49839 case 4808:
49840 case 4809:
49841 case 4810:
49842 case 4811:
49843 case 4812:
49844 case 4813:
49845 case 4814:
49846 case 4815:
49847 case 4816:
49848 case 4817:
49849 case 4960:
49850 case 5088:
49851 case 5089:
49852 case 5090:
49853 case 5091:
49854 case 5098:
49855 case 5131:
49856 case 5276:
49857 case 5297:
49858 case 5332:
49859 case 5333:
49860 case 5400:
49861 AddBuff(sItem.buffType, 3600);
49862 break;
49863 }
49864 }
49865 }
49866
49868 {
49869 if (sItem.summon)
49870 {
49871 KnockBack += minionKB;
49872 }
49873 if (sItem.melee && kbGlove)
49874 {
49875 KnockBack *= 2f;
49876 }
49877 if (kbBuff)
49878 {
49879 KnockBack *= 1.5f;
49880 }
49881 if (sItem.ranged && shroomiteStealth)
49882 {
49883 KnockBack *= 1f + (1f - stealth) * 0.5f;
49884 }
49885 if (sItem.ranged && setVortex)
49886 {
49887 KnockBack *= 1f + (1f - stealth) * 0.5f;
49888 }
49889 return KnockBack;
49890 }
49891
49893 {
49894 if (sItem.melee)
49895 {
49896 return meleeCrit;
49897 }
49898 if (sItem.ranged)
49899 {
49900 return rangedCrit;
49901 }
49902 if (sItem.magic)
49903 {
49904 return magicCrit;
49905 }
49906 return 0;
49907 }
49908
49910 {
49911 int num = sItem.damage;
49912 if (num > 0)
49913 {
49914 if (sItem.melee)
49915 {
49916 num = (int)((float)num * meleeDamage + 5E-06f);
49917 }
49918 else if (sItem.ranged)
49919 {
49920 float num2 = rangedDamage;
49921 if (sItem.useAmmo == AmmoID.Arrow || sItem.useAmmo == AmmoID.Stake)
49922 {
49923 num2 = bowEffectiveDamage;
49924 }
49925 if (sItem.useAmmo == AmmoID.Bullet || sItem.useAmmo == AmmoID.CandyCorn)
49926 {
49927 num2 = gunEffectiveDamage;
49928 }
49929 if (sItem.useAmmo == AmmoID.Rocket || sItem.useAmmo == AmmoID.StyngerBolt || sItem.useAmmo == AmmoID.JackOLantern || sItem.useAmmo == AmmoID.NailFriendly || sItem.useAmmo == AmmoID.Coin || sItem.useAmmo == AmmoID.Flare || sItem.useAmmo == AmmoID.Dart || sItem.useAmmo == AmmoID.Snowball || sItem.useAmmo == AmmoID.Sand || sItem.useAmmo == AmmoID.FallenStar || sItem.useAmmo == AmmoID.Gel)
49930 {
49931 num2 = specialistEffectiveDamage;
49932 }
49933 if (sItem.type == 1156 || sItem.type == 3350 || sItem.type == 3210 || sItem.type == 160 || sItem.type == 3821)
49934 {
49935 num2 = specialistEffectiveDamage;
49936 }
49937 num = (int)((float)num * num2 + 5E-06f);
49938 }
49939 else if (sItem.magic)
49940 {
49941 num = (int)((float)num * magicDamage + 5E-06f);
49942 }
49943 else if (sItem.summon)
49944 {
49945 num = (int)((float)num * minionDamage + 5E-06f);
49946 }
49947 }
49948 return num;
49949 }
49950
49951 public bool HasAmmo(Item sItem, bool canUse)
49952 {
49953 if (sItem.useAmmo > 0)
49954 {
49955 canUse = false;
49956 for (int i = 0; i < 58; i++)
49957 {
49958 if (inventory[i].ammo == sItem.useAmmo && inventory[i].stack > 0)
49959 {
49960 canUse = true;
49961 break;
49962 }
49963 }
49964 }
49965 return canUse;
49966 }
49967
49969 {
49972 {
49973 return true;
49974 }
49975 return false;
49976 }
49977
49978 public void PickAmmo(Item sItem, ref int projToShoot, ref float speed, ref bool canShoot, ref int Damage, ref float KnockBack, out int usedAmmoItemId, bool dontConsume = false)
49979 {
49980 Item item = new Item();
49981 bool flag = false;
49982 usedAmmoItemId = 0;
49983 if (sItem.useAmmo == AmmoID.Coin)
49984 {
49985 for (int i = 0; i < 4; i++)
49986 {
49987 int num = 50 + i;
49988 if (inventory[num].ammo == sItem.useAmmo && inventory[num].stack > 0)
49989 {
49990 item = inventory[num];
49991 canShoot = true;
49992 flag = true;
49993 break;
49994 }
49995 }
49996 }
49997 for (int j = 54; j < 58; j++)
49998 {
49999 if (inventory[j].ammo == sItem.useAmmo && inventory[j].stack > 0)
50000 {
50001 item = inventory[j];
50002 canShoot = true;
50003 flag = true;
50004 break;
50005 }
50006 }
50007 if (!flag)
50008 {
50009 for (int k = 0; k < 54; k++)
50010 {
50011 if (inventory[k].ammo == sItem.useAmmo && inventory[k].stack > 0)
50012 {
50013 item = inventory[k];
50014 canShoot = true;
50015 break;
50016 }
50017 }
50018 }
50019 if (!canShoot)
50020 {
50021 return;
50022 }
50023 usedAmmoItemId = item.type;
50024 int pickedProjectileId = -1;
50025 if (PickAmmo_TryFindingSpecificMatches(sItem.type, item.type, out pickedProjectileId))
50026 {
50028 }
50029 else if (sItem.type == 1946)
50030 {
50031 projToShoot = 338 + item.type - 771;
50032 }
50033 else if (sItem.type == 3930)
50034 {
50035 projToShoot = 715 + item.type - AmmoID.Rocket;
50036 }
50037 else if (sItem.useAmmo == AmmoID.Rocket)
50038 {
50039 projToShoot += item.shoot;
50040 }
50041 else if (sItem.useAmmo == AmmoID.Solution)
50042 {
50043 projToShoot += item.shoot;
50044 }
50045 else if (item.shoot > 0)
50046 {
50047 projToShoot = item.shoot;
50048 }
50049 if (sItem.type == 3019 && projToShoot == 1)
50050 {
50051 projToShoot = 485;
50052 }
50053 if (sItem.type == 3052)
50054 {
50055 projToShoot = 495;
50056 }
50057 if (sItem.type == 4953 && projToShoot == 1)
50058 {
50059 projToShoot = 932;
50060 }
50061 if (sItem.type == 4381)
50062 {
50063 projToShoot = 819;
50064 }
50065 if (sItem.type == 4058 && projToShoot == 474)
50066 {
50067 projToShoot = 117;
50068 }
50069 if (projToShoot == 42)
50070 {
50071 if (item.type == 370)
50072 {
50073 projToShoot = 65;
50074 Damage += 5;
50075 }
50076 else if (item.type == 408)
50077 {
50078 projToShoot = 68;
50079 Damage += 5;
50080 }
50081 else if (item.type == 1246)
50082 {
50083 projToShoot = 354;
50084 Damage += 5;
50085 }
50086 }
50087 if (inventory[selectedItem].type == 2888 && projToShoot == 1)
50088 {
50089 projToShoot = 469;
50090 }
50091 if (hasMoltenQuiver && projToShoot == 1)
50092 {
50093 projToShoot = 2;
50094 Damage += 2;
50095 }
50096 speed += item.shootSpeed;
50097 if (magicQuiver && (sItem.useAmmo == AmmoID.Arrow || sItem.useAmmo == AmmoID.Stake))
50098 {
50099 KnockBack *= 1.1f;
50100 speed *= 1.1f;
50101 }
50102 if (item.ranged)
50103 {
50104 if (item.damage > 0)
50105 {
50106 Damage += (int)((float)item.damage * rangedDamage);
50107 }
50108 }
50109 else
50110 {
50111 Damage += item.damage;
50112 }
50113 if ((sItem.useAmmo == AmmoID.Arrow || sItem.useAmmo == AmmoID.Stake) && archery)
50114 {
50115 if (speed < 20f)
50116 {
50117 speed *= 1.2f;
50118 if (speed > 20f)
50119 {
50120 speed = 20f;
50121 }
50122 }
50123 Damage = (int)((double)Damage * 1.1);
50124 }
50125 KnockBack += item.knockBack;
50126 bool flag2 = dontConsume;
50127 if (sItem.type == 3475 && Main.rand.Next(3) != 0)
50128 {
50129 flag2 = true;
50130 }
50131 if (sItem.type == 3930 && Main.rand.Next(2) == 0)
50132 {
50133 flag2 = true;
50134 }
50135 if (sItem.type == 3540 && Main.rand.Next(3) != 0)
50136 {
50137 flag2 = true;
50138 }
50139 if (sItem.type == 5134 && Main.rand.Next(3) == 0)
50140 {
50141 flag2 = true;
50142 }
50143 if (magicQuiver && (sItem.useAmmo == AmmoID.Arrow || sItem.useAmmo == AmmoID.Stake) && Main.rand.Next(5) == 0)
50144 {
50145 flag2 = true;
50146 }
50147 if (ammoBox && Main.rand.Next(5) == 0)
50148 {
50149 flag2 = true;
50150 }
50151 if (ammoPotion && Main.rand.Next(5) == 0)
50152 {
50153 flag2 = true;
50154 }
50155 if (sItem.type == 1782 && Main.rand.Next(3) == 0)
50156 {
50157 flag2 = true;
50158 }
50159 if (sItem.type == 98 && Main.rand.Next(3) == 0)
50160 {
50161 flag2 = true;
50162 }
50163 if (sItem.type == 2270 && Main.rand.Next(2) == 0)
50164 {
50165 flag2 = true;
50166 }
50167 if (sItem.type == 533 && Main.rand.Next(2) == 0)
50168 {
50169 flag2 = true;
50170 }
50171 if (sItem.type == 1929 && Main.rand.Next(2) == 0)
50172 {
50173 flag2 = true;
50174 }
50175 if (sItem.type == 1553 && Main.rand.Next(3) != 0)
50176 {
50177 flag2 = true;
50178 }
50179 if (sItem.type == 434 && !ItemAnimationJustStarted)
50180 {
50181 flag2 = true;
50182 }
50183 if (sItem.type == 4953 && itemAnimation > sItem.useAnimation - 8)
50184 {
50185 flag2 = true;
50186 }
50187 if (huntressAmmoCost90 && Main.rand.Next(10) == 0)
50188 {
50189 flag2 = true;
50190 }
50191 if (chloroAmmoCost80 && Main.rand.Next(5) == 0)
50192 {
50193 flag2 = true;
50194 }
50195 if (ammoCost80 && Main.rand.Next(5) == 0)
50196 {
50197 flag2 = true;
50198 }
50199 if (ammoCost75 && Main.rand.Next(4) == 0)
50200 {
50201 flag2 = true;
50202 }
50203 if (Main.remixWorld && sItem.type == 1319 && Main.rand.Next(2) == 0)
50204 {
50205 flag2 = true;
50206 }
50207 if (projToShoot == 85 && itemAnimation < itemAnimationMax - sItem.useTime)
50208 {
50209 flag2 = true;
50210 }
50211 if ((sItem.type == 779 || sItem.type == 5134) && itemAnimation < itemAnimationMax - sItem.useTime)
50212 {
50213 flag2 = true;
50214 }
50215 if (!flag2 && item.consumable)
50216 {
50217 item.stack--;
50218 if (item.stack <= 0)
50219 {
50220 item.active = false;
50221 item.TurnToAir();
50222 }
50223 }
50224 }
50225
50226 public void GetOtherPlayersPickTile(int x, int y, int pickDamage)
50227 {
50228 int tileId = hitTile.HitObject(x, y, 1);
50229 hitTile.AddDamage(tileId, pickDamage);
50230 }
50231
50232 public void PickTile(int x, int y, int pickPower)
50233 {
50234 int num = hitTile.HitObject(x, y, 1);
50235 Tile tile = Main.tile[x, y];
50236 if (tile.type == 504)
50237 {
50238 return;
50239 }
50240 int num2 = GetPickaxeDamage(x, y, pickPower, num, tile);
50241 if (!WorldGen.CanKillTile(x, y))
50242 {
50243 num2 = 0;
50244 }
50245 if (Main.getGoodWorld)
50246 {
50247 num2 *= 2;
50248 }
50249 if (DoesPickTargetTransformOnKill(hitTile, num2, x, y, pickPower, num, tile))
50250 {
50251 num2 = 0;
50252 }
50253 if (hitTile.AddDamage(num, num2) >= 100)
50254 {
50255 AchievementsHelper.CurrentlyMining = true;
50256 ClearMiningCacheAt(x, y, 1);
50257 if (Main.netMode == 1 && Main.tileContainer[Main.tile[x, y].type])
50258 {
50259 if (Main.tile[x, y].type == 470 || Main.tile[x, y].type == 475)
50260 {
50261 NetMessage.SendData(17, -1, -1, null, 20, x, y);
50262 }
50263 else
50264 {
50265 WorldGen.KillTile(x, y, fail: true);
50266 NetMessage.SendData(17, -1, -1, null, 0, x, y, 1f);
50267 }
50268 if (Main.tile[x, y].type == 21)
50269 {
50270 NetMessage.SendData(34, -1, -1, null, 1, x, y);
50271 }
50272 if (Main.tile[x, y].type == 467)
50273 {
50274 NetMessage.SendData(34, -1, -1, null, 5, x, y);
50275 }
50276 if (Main.tile[x, y].type == 88)
50277 {
50278 NetMessage.SendData(34, -1, -1, null, 3, x, y);
50279 }
50280 }
50281 else
50282 {
50283 bool flag = Main.tile[x, y].active();
50284 WorldGen.KillTile(x, y);
50285 if (!Main.dedServ && flag && !Main.tile[x, y].active())
50286 {
50288 }
50289 if (Main.netMode == 1)
50290 {
50291 NetMessage.SendData(17, -1, -1, null, 0, x, y);
50292 }
50293 }
50294 AchievementsHelper.CurrentlyMining = false;
50295 }
50296 else
50297 {
50298 WorldGen.KillTile(x, y, fail: true);
50299 if (Main.netMode == 1)
50300 {
50301 NetMessage.SendData(17, -1, -1, null, 0, x, y, 1f);
50302 NetMessage.SendData(125, -1, -1, null, Main.myPlayer, x, y, num2);
50303 }
50304 }
50305 if (num2 != 0)
50306 {
50307 hitTile.Prune();
50308 }
50309 }
50310
50311 private void ClearMiningCacheAt(int x, int y, int hitTileCacheType)
50312 {
50313 hitReplace.TryClearingAndPruning(x, y, 1);
50314 hitTile.TryClearingAndPruning(x, y, 1);
50315 }
50316
50317 public bool isNearFairy()
50318 {
50320 {
50321 for (int i = 0; i < 200; i++)
50322 {
50323 if (Main.npc[i].active && (Main.npc[i].type == 583 || Main.npc[i].type == 584 || Main.npc[i].type == 585) && Vector2.Distance(Main.npc[i].Center, base.Center) < (float)NPC.sWidth)
50324 {
50325 return true;
50326 }
50327 }
50328 }
50329 return false;
50330 }
50331
50332 public bool isNearNPC(int type, float range = -1f)
50333 {
50334 if (range == -1f)
50335 {
50336 range = NPC.sWidth;
50337 }
50339 {
50340 for (int i = 0; i < 200; i++)
50341 {
50342 if (Main.npc[i].active && Main.npc[i].type == type && Vector2.Distance(Main.npc[i].Center, base.Center) < range)
50343 {
50344 return true;
50345 }
50346 }
50347 }
50348 return false;
50349 }
50350
50351 public bool HasEnoughPickPowerToHurtTile(int x, int y)
50352 {
50353 Item bestPickaxe = GetBestPickaxe();
50354 if (bestPickaxe == null)
50355 {
50356 return false;
50357 }
50358 Tile tile = Main.tile[x, y];
50359 _ = tile.type;
50360 int hitBufferIndex = hitTile.HitObject(x, y, 1);
50361 if (GetPickaxeDamage(x, y, bestPickaxe.pick, hitBufferIndex, tile) == 0)
50362 {
50363 return false;
50364 }
50365 return true;
50366 }
50367
50368 private int GetPickaxeDamage(int x, int y, int pickPower, int hitBufferIndex, Tile tileTarget)
50369 {
50370 int num = 0;
50371 if (Main.tileNoFail[tileTarget.type])
50372 {
50373 num = 100;
50374 }
50375 num = ((!Main.tileDungeon[tileTarget.type] && tileTarget.type != 25 && tileTarget.type != 58 && tileTarget.type != 117 && tileTarget.type != 203) ? ((tileTarget.type == 85) ? ((!Main.getGoodWorld) ? (num + pickPower / 3) : (num + pickPower / 4)) : ((tileTarget.type != 48 && tileTarget.type != 232) ? ((tileTarget.type == 226) ? (num + pickPower / 4) : ((tileTarget.type != 107 && tileTarget.type != 221) ? ((tileTarget.type != 108 && tileTarget.type != 222) ? ((tileTarget.type == 111 || tileTarget.type == 223) ? (num + pickPower / 4) : ((tileTarget.type != 211) ? (num + pickPower) : (num + pickPower / 5))) : (num + pickPower / 3)) : (num + pickPower / 2))) : (num + pickPower * 2))) : (num + pickPower / 2));
50376 if (tileTarget.type == 211 && pickPower < 200)
50377 {
50378 num = 0;
50379 }
50380 if ((tileTarget.type == 25 || tileTarget.type == 203) && pickPower < 65)
50381 {
50382 num = 0;
50383 }
50384 else if (tileTarget.type == 117 && pickPower < 65)
50385 {
50386 num = 0;
50387 }
50388 else if (tileTarget.type == 37 && pickPower < 50)
50389 {
50390 num = 0;
50391 }
50392 else if ((tileTarget.type == 22 || tileTarget.type == 204) && (double)y > Main.worldSurface && pickPower < 55)
50393 {
50394 num = 0;
50395 }
50396 else if (tileTarget.type == 56 && pickPower < 55)
50397 {
50398 num = 0;
50399 }
50400 else if (tileTarget.type == 77 && pickPower < 65 && y >= Main.UnderworldLayer)
50401 {
50402 num = 0;
50403 }
50404 else if (tileTarget.type == 58 && pickPower < 65)
50405 {
50406 num = 0;
50407 }
50408 else if ((tileTarget.type == 226 || tileTarget.type == 237) && pickPower < 210)
50409 {
50410 num = 0;
50411 }
50412 else if (tileTarget.type == 137 && pickPower < 210)
50413 {
50414 int num2 = tileTarget.frameY / 18;
50415 if ((uint)(num2 - 1) <= 3u)
50416 {
50417 num = 0;
50418 }
50419 }
50420 else if (Main.tileDungeon[tileTarget.type] && pickPower < 100 && (double)y > Main.worldSurface)
50421 {
50422 if ((double)x < (double)Main.maxTilesX * 0.35 || (double)x > (double)Main.maxTilesX * 0.65)
50423 {
50424 num = 0;
50425 }
50426 }
50427 else if (tileTarget.type == 107 && pickPower < 100)
50428 {
50429 num = 0;
50430 }
50431 else if (tileTarget.type == 108 && pickPower < 110)
50432 {
50433 num = 0;
50434 }
50435 else if (tileTarget.type == 111 && pickPower < 150)
50436 {
50437 num = 0;
50438 }
50439 else if (tileTarget.type == 221 && pickPower < 100)
50440 {
50441 num = 0;
50442 }
50443 else if (tileTarget.type == 222 && pickPower < 110)
50444 {
50445 num = 0;
50446 }
50447 else if (tileTarget.type == 223 && pickPower < 150)
50448 {
50449 num = 0;
50450 }
50451 if (tileTarget.type == 147 || tileTarget.type == 0 || tileTarget.type == 40 || tileTarget.type == 53 || tileTarget.type == 57 || tileTarget.type == 59 || tileTarget.type == 123 || tileTarget.type == 224 || tileTarget.type == 397)
50452 {
50453 num += pickPower;
50454 }
50455 if (tileTarget.type == 404)
50456 {
50457 num += 5;
50458 }
50459 if (tileTarget.type == 165 || Main.tileRope[tileTarget.type] || tileTarget.type == 199)
50460 {
50461 num = 100;
50462 }
50463 if (tileTarget.type == 128 || tileTarget.type == 269)
50464 {
50465 if (tileTarget.frameX == 18 || tileTarget.frameX == 54)
50466 {
50467 x--;
50468 tileTarget = Main.tile[x, y];
50469 hitTile.UpdatePosition(hitBufferIndex, x, y);
50470 }
50471 if (tileTarget.frameX >= 100)
50472 {
50473 num = 0;
50474 Main.blockMouse = true;
50475 }
50476 }
50477 if (tileTarget.type == 334)
50478 {
50479 if (tileTarget.frameY == 0)
50480 {
50481 y++;
50482 tileTarget = Main.tile[x, y];
50483 hitTile.UpdatePosition(hitBufferIndex, x, y);
50484 }
50485 if (tileTarget.frameY == 36)
50486 {
50487 y--;
50488 tileTarget = Main.tile[x, y];
50489 hitTile.UpdatePosition(hitBufferIndex, x, y);
50490 }
50491 int frameX = tileTarget.frameX;
50492 bool flag = frameX >= 5000;
50493 bool flag2 = false;
50494 if (!flag)
50495 {
50496 int num3 = frameX / 18;
50497 num3 %= 3;
50498 x -= num3;
50499 tileTarget = Main.tile[x, y];
50500 if (tileTarget.frameX >= 5000)
50501 {
50502 flag = true;
50503 }
50504 }
50505 if (flag)
50506 {
50507 frameX = tileTarget.frameX;
50508 int num4 = 0;
50509 while (frameX >= 5000)
50510 {
50511 frameX -= 5000;
50512 num4++;
50513 }
50514 if (num4 != 0)
50515 {
50516 flag2 = true;
50517 }
50518 }
50519 if (flag2)
50520 {
50521 num = 0;
50522 Main.blockMouse = true;
50523 }
50524 }
50525 return num;
50526 }
50527
50528 private bool DoesPickTargetTransformOnKill(HitTile hitCounter, int damage, int x, int y, int pickPower, int bufferIndex, Tile tileTarget)
50529 {
50530 if (hitCounter.AddDamage(bufferIndex, damage, updateAmount: false) >= 100 && (tileTarget.type == 2 || tileTarget.type == 477 || tileTarget.type == 492 || tileTarget.type == 23 || tileTarget.type == 60 || tileTarget.type == 70 || tileTarget.type == 109 || tileTarget.type == 199 || Main.tileMoss[tileTarget.type] || tileTarget.type == 662 || tileTarget.type == 661 || TileID.Sets.tileMossBrick[tileTarget.type] || tileTarget.type == 633))
50531 {
50532 return true;
50533 }
50534 return false;
50535 }
50536
50538 {
50539 bool flag = false;
50540 if (i.fishingPole > 0)
50541 {
50542 flag = true;
50543 }
50544 int netID = i.netID;
50545 if (netID == 905 || netID == 1326 || netID == 5335)
50546 {
50547 flag = true;
50548 }
50549 if ((i.damage > 0 || flag) && i.useStyle != 0)
50550 {
50551 return i.stack > 0;
50552 }
50553 return false;
50554 }
50555
50556 public void PlaceWeapon(int x, int y)
50557 {
50558 if (Main.tile[x, y].active() && Main.tile[x, y].type == 334)
50559 {
50560 int frameY = Main.tile[x, y].frameY;
50561 int num = 1;
50562 frameY /= 18;
50563 while (num > frameY)
50564 {
50565 y++;
50566 frameY = Main.tile[x, y].frameY;
50567 frameY /= 18;
50568 }
50569 while (num < frameY)
50570 {
50571 y--;
50572 frameY = Main.tile[x, y].frameY;
50573 frameY /= 18;
50574 }
50575 int num2 = Main.tile[x, y].frameX;
50576 int num3 = 0;
50577 while (num2 >= 5000)
50578 {
50579 num2 -= 5000;
50580 num3++;
50581 }
50582 if (num3 != 0)
50583 {
50584 num2 = (num3 - 1) * 18;
50585 }
50586 bool flag = false;
50587 if (num2 >= 54)
50588 {
50589 num2 -= 54;
50590 flag = true;
50591 }
50592 x -= num2 / 18;
50593 int num4 = Main.tile[x, y].frameX;
50594 WorldGen.KillTile(x, y, fail: true);
50595 if (Main.netMode == 1)
50596 {
50597 NetMessage.SendData(17, -1, -1, null, 0, x, y, 1f);
50598 }
50599 if (Main.netMode == 1)
50600 {
50601 NetMessage.SendData(17, -1, -1, null, 0, x + 1, y, 1f);
50602 }
50603 while (num4 >= 5000)
50604 {
50605 num4 -= 5000;
50606 }
50607 Main.blockMouse = true;
50608 int num5 = 5000;
50609 int num6 = 10000;
50610 if (flag)
50611 {
50612 num5 = 20000;
50613 num6 = 25000;
50614 }
50615 Main.tile[x, y].frameX = (short)(inventory[selectedItem].netID + num5 + 100);
50616 Main.tile[x + 1, y].frameX = (short)(inventory[selectedItem].prefix + num6);
50617 if (Main.netMode == 1)
50618 {
50619 NetMessage.SendTileSquare(-1, x, y);
50620 }
50621 if (Main.netMode == 1)
50622 {
50623 NetMessage.SendTileSquare(-1, x + 1, y);
50624 }
50625 inventory[selectedItem].stack--;
50626 if (inventory[selectedItem].stack <= 0)
50627 {
50628 inventory[selectedItem].SetDefaults();
50629 Main.mouseItem.SetDefaults();
50630 }
50631 if (selectedItem == 58)
50632 {
50633 Main.mouseItem = inventory[selectedItem].Clone();
50634 }
50635 releaseUseItem = false;
50636 mouseInterface = true;
50637 }
50638 }
50639
50641 {
50642 return i.stack > 0;
50643 }
50644
50646 {
50647 float num = (float)(255 - immuneAlpha) / 255f;
50648 if (alphaReduction > 0f)
50649 {
50650 num *= 1f - alphaReduction;
50651 }
50652 if (shimmerTransparency > 0f)
50653 {
50654 if ((double)shimmerTransparency >= 0.8)
50655 {
50656 return Color.Transparent;
50657 }
50658 num *= 1f - shimmerTransparency;
50659 num *= 1f - shimmerTransparency;
50660 num *= 1f - shimmerTransparency;
50661 }
50662 if (immuneAlpha > 125)
50663 {
50664 return Color.Transparent;
50665 }
50666 return Color.Multiply(newColor, num);
50667 }
50668
50670 {
50671 float num = (float)(255 - immuneAlpha) / 255f;
50672 if (alphaReduction > 0f)
50673 {
50674 num *= 1f - alphaReduction;
50675 }
50676 if (shimmerTransparency > 0f)
50677 {
50678 num *= 1f - shimmerTransparency;
50679 }
50680 return Color.Multiply(newColor, num);
50681 }
50682
50684 {
50685 int r = newColor.R + (int)((double)immuneAlpha * 0.9);
50686 int g = newColor.G + (int)((double)immuneAlpha * 0.5);
50687 int b = newColor.B + (int)((double)immuneAlpha * 0.5);
50688 int num = newColor.A + (int)((double)immuneAlpha * 0.4);
50689 if (num < 0)
50690 {
50691 num = 0;
50692 }
50693 if (num > 255)
50694 {
50695 num = 255;
50696 }
50697 return new Color(r, g, b, num);
50698 }
50699
50700 public void addDPS(int dmg)
50701 {
50702 if (dpsStarted)
50703 {
50704 dpsLastHit = DateTime.Now;
50705 dpsDamage += dmg;
50706 dpsEnd = DateTime.Now;
50707 }
50708 else
50709 {
50710 dpsStarted = true;
50711 dpsStart = DateTime.Now;
50712 dpsEnd = DateTime.Now;
50713 dpsLastHit = DateTime.Now;
50714 dpsDamage = dmg;
50715 }
50716 }
50717
50718 public void checkDPSTime()
50719 {
50720 int num = 3;
50721 if (dpsStarted && (DateTime.Now - dpsLastHit).Seconds >= num)
50722 {
50723 dpsStarted = false;
50724 }
50725 }
50726
50727 public int getDPS()
50728 {
50729 TimeSpan timeSpan = dpsEnd - dpsStart;
50730 float num = (float)timeSpan.Milliseconds / 1000f;
50731 num += (float)timeSpan.Seconds;
50732 num += (float)timeSpan.Minutes / 60f;
50733 if (num >= 3f)
50734 {
50735 dpsStart = DateTime.Now;
50736 dpsStart = dpsStart.AddSeconds(-1.0);
50737 dpsDamage = (int)((float)dpsDamage / num);
50738 timeSpan = dpsEnd - dpsStart;
50739 num = (float)timeSpan.Milliseconds / 1000f;
50740 num += (float)timeSpan.Seconds;
50741 num += (float)timeSpan.Minutes / 60f;
50742 }
50743 if (num < 1f)
50744 {
50745 num = 1f;
50746 }
50747 return (int)((float)dpsDamage / num);
50748 }
50749
50750 public long DropCoins()
50751 {
50752 IEntitySource itemSource_Death = GetItemSource_Death();
50753 long num = 0L;
50754 for (int i = 0; i < 59; i++)
50755 {
50756 if (inventory[i].IsACoin)
50757 {
50758 int num2 = Item.NewItem(itemSource_Death, (int)position.X, (int)position.Y, width, height, inventory[i].type);
50759 int num3 = inventory[i].stack / 2;
50760 if (Main.expertMode)
50761 {
50762 num3 = (int)((double)inventory[i].stack * 0.25);
50763 }
50764 if (Main.masterMode)
50765 {
50766 num3 = 0;
50767 }
50768 num3 = inventory[i].stack - num3;
50769 inventory[i].stack -= num3;
50770 if (inventory[i].type == 71)
50771 {
50772 num += num3;
50773 }
50774 if (inventory[i].type == 72)
50775 {
50776 num += (long)num3 * 100L;
50777 }
50778 if (inventory[i].type == 73)
50779 {
50780 num += (long)num3 * 10000L;
50781 }
50782 if (inventory[i].type == 74)
50783 {
50784 num += (long)num3 * 1000000L;
50785 }
50786 if (inventory[i].stack <= 0)
50787 {
50788 inventory[i] = new Item();
50789 }
50790 Main.item[num2].stack = num3;
50791 Main.item[num2].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f;
50792 Main.item[num2].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f;
50793 Main.item[num2].noGrabDelay = 100;
50794 if (Main.netMode == 1)
50795 {
50796 NetMessage.SendData(21, -1, -1, null, num2);
50797 }
50798 if (i == 58)
50799 {
50800 Main.mouseItem = inventory[i].Clone();
50801 }
50802 }
50803 }
50804 lostCoins = num;
50805 lostCoinString = Main.ValueToCoins(lostCoins);
50806 return num;
50807 }
50808
50809 public void DropItems()
50810 {
50811 IEntitySource itemSource_Death = GetItemSource_Death();
50812 for (int i = 0; i < 59; i++)
50813 {
50814 if (inventory[i].stack > 0)
50815 {
50816 bool flag = true;
50817 int type = inventory[i].type;
50818 if ((uint)(type - 3506) <= 1u || type == 3509)
50819 {
50820 flag = false;
50821 }
50822 if (flag)
50823 {
50824 TryDroppingSingleItem(itemSource_Death, inventory[i]);
50825 }
50826 }
50827 inventory[i].TurnToAir();
50828 if (i < armor.Length)
50829 {
50830 TryDroppingSingleItem(itemSource_Death, armor[i]);
50831 }
50832 if (i < dye.Length)
50833 {
50834 TryDroppingSingleItem(itemSource_Death, dye[i]);
50835 }
50836 if (i < miscEquips.Length)
50837 {
50838 TryDroppingSingleItem(itemSource_Death, miscEquips[i]);
50839 }
50840 if (i < miscDyes.Length)
50841 {
50842 TryDroppingSingleItem(itemSource_Death, miscDyes[i]);
50843 }
50844 }
50845 EquipmentLoadout[] loadouts = Loadouts;
50846 for (int type = 0; type < loadouts.Length; type++)
50847 {
50848 loadouts[type].TryDroppingItems(this, itemSource_Death);
50849 }
50850 inventory[0].SetDefaults(3507);
50851 inventory[0].Prefix(-1);
50852 inventory[1].SetDefaults(3509);
50853 inventory[1].Prefix(-1);
50854 inventory[2].SetDefaults(3506);
50855 inventory[2].Prefix(-1);
50856 Main.mouseItem.TurnToAir();
50857 }
50858
50860 {
50861 if (theItem.stack > 0)
50862 {
50863 int num = Item.NewItem(source, (int)position.X, (int)position.Y, width, height, theItem.type);
50864 Item obj = Main.item[num];
50865 obj.netDefaults(theItem.netID);
50866 obj.Prefix(theItem.prefix);
50867 obj.stack = theItem.stack;
50868 obj.velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f;
50869 obj.velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f;
50870 obj.noGrabDelay = 100;
50871 obj.newAndShiny = false;
50872 if (Main.netMode == 1)
50873 {
50874 NetMessage.SendData(21, -1, -1, null, num);
50875 }
50876 }
50877 theItem.TurnToAir(fullReset: true);
50878 }
50879
50880 public object Clone()
50881 {
50882 return MemberwiseClone();
50883 }
50884
50886 {
50887 skinVariant = other.skinVariant;
50888 direction = other.direction;
50889 selectedItem = other.selectedItem;
50890 extraAccessory = other.extraAccessory;
50891 skinColor = other.skinColor;
50892 eyeColor = other.eyeColor;
50893 hair = other.hair;
50894 hairColor = other.hairColor;
50895 shirtColor = other.shirtColor;
50896 underShirtColor = other.underShirtColor;
50897 pantsColor = other.pantsColor;
50898 shoeColor = other.shoeColor;
50899 position = other.position;
50900 velocity = other.velocity;
50901 statLife = other.statLife;
50902 statLifeMax = other.statLifeMax;
50903 statLifeMax2 = other.statLifeMax2;
50904 statMana = other.statMana;
50905 statManaMax = other.statManaMax;
50906 statManaMax2 = other.statManaMax2;
50907 hideMisc = other.hideMisc;
50908 for (int i = 0; i < 59; i++)
50909 {
50910 inventory[i] = other.inventory[i].Clone();
50911 if (i < armor.Length)
50912 {
50913 armor[i] = other.armor[i].Clone();
50914 }
50915 if (i < dye.Length)
50916 {
50917 dye[i] = other.dye[i].Clone();
50918 }
50919 if (i < miscEquips.Length)
50920 {
50921 miscEquips[i] = other.miscEquips[i].Clone();
50922 }
50923 if (i < miscDyes.Length)
50924 {
50925 miscDyes[i] = other.miscDyes[i].Clone();
50926 }
50927 if (i < hideVisibleAccessory.Length)
50928 {
50929 hideVisibleAccessory[i] = other.hideVisibleAccessory[i];
50930 }
50931 }
50932 }
50933
50935 {
50936 Player player = new Player();
50937 player.zone1 = zone1;
50938 player.zone2 = zone2;
50939 player.zone3 = zone3;
50940 player.zone4 = zone4;
50941 player.zone5 = zone5;
50942 player.voidVaultInfo = voidVaultInfo;
50943 player.luck = luck;
50944 player.extraAccessory = extraAccessory;
50945 player.MinionRestTargetPoint = MinionRestTargetPoint;
50946 player.MinionAttackTargetNPC = MinionAttackTargetNPC;
50947 player.direction = direction;
50948 player.selectedItem = selectedItem;
50949 player.controlUp = controlUp;
50950 player.controlDown = controlDown;
50951 player.controlLeft = controlLeft;
50952 player.controlRight = controlRight;
50953 player.controlJump = controlJump;
50954 player.controlUseItem = controlUseItem;
50955 player.controlDownHold = controlDownHold;
50956 player.isOperatingAnotherEntity = isOperatingAnotherEntity;
50957 player.autoReuseAllWeapons = autoReuseAllWeapons;
50958 player.statLife = statLife;
50959 player.statLifeMax = statLifeMax;
50960 player.statMana = statMana;
50961 player.statManaMax = statManaMax;
50962 player.position.X = position.X;
50963 player.tileEntityAnchor = tileEntityAnchor;
50964 player.chest = chest;
50965 player.talkNPC = talkNPC;
50966 player.piggyBankProjTracker = piggyBankProjTracker;
50967 player.voidLensChest = voidLensChest;
50968 player.hideVisibleAccessory = hideVisibleAccessory;
50969 player.hideMisc = hideMisc;
50970 player.shieldRaised = shieldRaised;
50971 for (int i = 0; i < 59; i++)
50972 {
50973 player.inventory[i] = inventory[i].Clone();
50974 if (i < armor.Length)
50975 {
50976 player.armor[i] = armor[i].Clone();
50977 }
50978 if (i < dye.Length)
50979 {
50980 player.dye[i] = dye[i].Clone();
50981 }
50982 if (i < miscEquips.Length)
50983 {
50984 player.miscEquips[i] = miscEquips[i].Clone();
50985 }
50986 if (i < miscDyes.Length)
50987 {
50988 player.miscDyes[i] = miscDyes[i].Clone();
50989 }
50990 if (i < bank.item.Length)
50991 {
50992 player.bank.item[i] = bank.item[i].Clone();
50993 }
50994 if (i < bank2.item.Length)
50995 {
50996 player.bank2.item[i] = bank2.item[i].Clone();
50997 }
50998 if (i < bank3.item.Length)
50999 {
51000 player.bank3.item[i] = bank3.item[i].Clone();
51001 }
51002 if (i < bank4.item.Length)
51003 {
51004 player.bank4.item[i] = bank4.item[i].Clone();
51005 }
51006 }
51007 CloneLoadouts(player);
51008 player.trashItem = trashItem.Clone();
51009 for (int j = 0; j < maxBuffs; j++)
51010 {
51011 player.buffType[j] = buffType[j];
51012 player.buffTime[j] = buffTime[j];
51013 }
51014 DpadRadial.CopyTo(player.DpadRadial);
51015 CircularRadial.CopyTo(player.CircularRadial);
51016 return player;
51017 }
51018
51020 {
51021 Item[] array = armor;
51022 Item[] array2 = clonePlayer.armor;
51023 for (int i = 0; i < array.Length; i++)
51024 {
51025 array2[i] = array[i].Clone();
51026 }
51027 array = dye;
51028 array2 = clonePlayer.dye;
51029 for (int j = 0; j < array.Length; j++)
51030 {
51031 array2[j] = array[j].Clone();
51032 }
51033 for (int k = 0; k < Loadouts.Length; k++)
51034 {
51035 array = Loadouts[k].Armor;
51036 array2 = clonePlayer.Loadouts[k].Armor;
51037 for (int l = 0; l < array.Length; l++)
51038 {
51039 array2[l] = array[l].Clone();
51040 }
51041 array = Loadouts[k].Dye;
51042 array2 = clonePlayer.Loadouts[k].Dye;
51043 for (int m = 0; m < array.Length; m++)
51044 {
51045 array2[m] = array[m].Clone();
51046 }
51047 }
51048 }
51049
51050 public static bool CheckSpawn(int x, int y)
51051 {
51052 bool flag = Main.tileSolid[379];
51053 Main.tileSolid[379] = true;
51054 bool result = CheckSpawn_Internal(x, y);
51055 Main.tileSolid[379] = flag;
51056 return result;
51057 }
51058
51059 private static bool CheckSpawn_Internal(int x, int y)
51060 {
51062 {
51063 return false;
51064 }
51065 if (Main.tile[x, y - 1] == null)
51066 {
51067 return false;
51068 }
51069 if (!Main.tile[x, y - 1].active() || Main.tile[x, y - 1].type != 79)
51070 {
51071 return false;
51072 }
51073 for (int i = x - 1; i <= x + 1; i++)
51074 {
51075 for (int j = y - 3; j < y; j++)
51076 {
51077 if (Main.tile[i, j] == null)
51078 {
51079 return false;
51080 }
51081 if (Main.tile[i, j].nactive() && Main.tileSolid[Main.tile[i, j].type] && !Main.tileSolidTop[Main.tile[i, j].type])
51082 {
51083 Main.NewText(Language.GetTextValue("Game.BedObstructed"), byte.MaxValue, 240, 20);
51084 return false;
51085 }
51086 }
51087 }
51088 if (!WorldGen.StartRoomCheck(x, y - 1))
51089 {
51090 return false;
51091 }
51092 return true;
51093 }
51094
51095 public void FindSpawn()
51096 {
51097 for (int i = 0; i < 200; i++)
51098 {
51099 if (spN[i] == null)
51100 {
51101 SpawnX = -1;
51102 SpawnY = -1;
51103 break;
51104 }
51105 if (spN[i] == Main.worldName && spI[i] == Main.worldID)
51106 {
51107 SpawnX = spX[i];
51108 SpawnY = spY[i];
51109 break;
51110 }
51111 }
51112 }
51113
51114 public void RemoveSpawn()
51115 {
51116 SpawnX = -1;
51117 SpawnY = -1;
51118 for (int i = 0; i < 200 && spN[i] != null; i++)
51119 {
51120 if (spN[i] == Main.worldName && spI[i] == Main.worldID)
51121 {
51122 for (int j = i; j < 199; j++)
51123 {
51124 spN[j] = spN[j + 1];
51125 spI[j] = spI[j + 1];
51126 spX[j] = spX[j + 1];
51127 spY[j] = spY[j + 1];
51128 }
51129 spN[199] = null;
51130 spI[199] = 0;
51131 spX[199] = 0;
51132 spY[199] = 0;
51133 break;
51134 }
51135 }
51136 }
51137
51138 public void ChangeSpawn(int x, int y)
51139 {
51140 for (int i = 0; i < 200 && spN[i] != null; i++)
51141 {
51142 if (spN[i] == Main.worldName && spI[i] == Main.worldID)
51143 {
51144 for (int num = i; num > 0; num--)
51145 {
51146 spN[num] = spN[num - 1];
51147 spI[num] = spI[num - 1];
51148 spX[num] = spX[num - 1];
51149 spY[num] = spY[num - 1];
51150 }
51151 spN[0] = Main.worldName;
51152 spI[0] = Main.worldID;
51153 spX[0] = x;
51154 spY[0] = y;
51155 FindSpawn();
51156 return;
51157 }
51158 }
51159 for (int num2 = 199; num2 > 0; num2--)
51160 {
51161 if (spN[num2 - 1] != null)
51162 {
51163 spN[num2] = spN[num2 - 1];
51164 spI[num2] = spI[num2 - 1];
51165 spX[num2] = spX[num2 - 1];
51166 spY[num2] = spY[num2 - 1];
51167 }
51168 }
51169 spN[0] = Main.worldName;
51170 spI[0] = Main.worldID;
51171 spX[0] = x;
51172 spY[0] = y;
51173 FindSpawn();
51174 }
51175
51176 public static void SavePlayer(PlayerFileData playerFile, bool skipMapSave = false)
51177 {
51178 try
51179 {
51180 Main.Achievements.Save();
51181 InternalSaveMap(playerFile.IsCloudSave);
51183 {
51185 {
51186 InternalSavePlayerFile(playerFile);
51187 });
51188 }
51189 }
51190 catch (Exception exception)
51191 {
51193 throw;
51194 }
51195 }
51196
51198 {
51199 if (playerFile.ServerSideCharacter)
51200 {
51201 return;
51202 }
51203 string path = playerFile.Path;
51204 Player player = playerFile.Player;
51205 bool isCloudSave = playerFile.IsCloudSave;
51206 if (string.IsNullOrEmpty(path))
51207 {
51208 return;
51209 }
51211 {
51213 }
51215 using Stream stream = (isCloudSave ? ((Stream)new MemoryStream(2000)) : ((Stream)new FileStream(path, FileMode.Create)));
51216 using CryptoStream cryptoStream = new CryptoStream(stream, rijndaelManaged.CreateEncryptor(ENCRYPTION_KEY, ENCRYPTION_KEY), CryptoStreamMode.Write);
51218 binaryWriter.Write(279);
51219 playerFile.Metadata.Write(binaryWriter);
51220 Serialize(playerFile, player, binaryWriter);
51221 binaryWriter.Flush();
51222 cryptoStream.FlushFinalBlock();
51223 stream.Flush();
51224 if (isCloudSave && SocialAPI.Cloud != null)
51225 {
51226 SocialAPI.Cloud.Write(playerFile.Path, ((MemoryStream)stream).ToArray());
51227 }
51228 }
51229
51231 {
51232 fileIO.Write(newPlayer.name);
51233 fileIO.Write(newPlayer.difficulty);
51234 fileIO.Write(playerFile.GetPlayTime().Ticks);
51235 fileIO.Write(newPlayer.hair);
51236 fileIO.Write(newPlayer.hairDye);
51237 BitsByte bitsByte = (byte)0;
51238 for (int i = 0; i < 8; i++)
51239 {
51240 bitsByte[i] = newPlayer.hideVisibleAccessory[i];
51241 }
51242 fileIO.Write(bitsByte);
51243 bitsByte = (byte)0;
51244 for (int j = 0; j < 2; j++)
51245 {
51246 bitsByte[j] = newPlayer.hideVisibleAccessory[j + 8];
51247 }
51248 fileIO.Write(bitsByte);
51249 fileIO.Write(newPlayer.hideMisc);
51250 fileIO.Write((byte)newPlayer.skinVariant);
51251 fileIO.Write(newPlayer.statLife);
51252 fileIO.Write(newPlayer.statLifeMax);
51253 fileIO.Write(newPlayer.statMana);
51254 fileIO.Write(newPlayer.statManaMax);
51255 fileIO.Write(newPlayer.extraAccessory);
51256 fileIO.Write(newPlayer.unlockedBiomeTorches);
51257 fileIO.Write(newPlayer.UsingBiomeTorches);
51258 fileIO.Write(newPlayer.ateArtisanBread);
51259 fileIO.Write(newPlayer.usedAegisCrystal);
51260 fileIO.Write(newPlayer.usedAegisFruit);
51261 fileIO.Write(newPlayer.usedArcaneCrystal);
51262 fileIO.Write(newPlayer.usedGalaxyPearl);
51263 fileIO.Write(newPlayer.usedGummyWorm);
51264 fileIO.Write(newPlayer.usedAmbrosia);
51265 fileIO.Write(newPlayer.downedDD2EventAnyDifficulty);
51266 fileIO.Write(newPlayer.taxMoney);
51267 fileIO.Write(newPlayer.numberOfDeathsPVE);
51268 fileIO.Write(newPlayer.numberOfDeathsPVP);
51269 fileIO.Write(newPlayer.hairColor.R);
51270 fileIO.Write(newPlayer.hairColor.G);
51271 fileIO.Write(newPlayer.hairColor.B);
51272 fileIO.Write(newPlayer.skinColor.R);
51273 fileIO.Write(newPlayer.skinColor.G);
51274 fileIO.Write(newPlayer.skinColor.B);
51275 fileIO.Write(newPlayer.eyeColor.R);
51276 fileIO.Write(newPlayer.eyeColor.G);
51277 fileIO.Write(newPlayer.eyeColor.B);
51278 fileIO.Write(newPlayer.shirtColor.R);
51279 fileIO.Write(newPlayer.shirtColor.G);
51280 fileIO.Write(newPlayer.shirtColor.B);
51281 fileIO.Write(newPlayer.underShirtColor.R);
51282 fileIO.Write(newPlayer.underShirtColor.G);
51283 fileIO.Write(newPlayer.underShirtColor.B);
51284 fileIO.Write(newPlayer.pantsColor.R);
51285 fileIO.Write(newPlayer.pantsColor.G);
51286 fileIO.Write(newPlayer.pantsColor.B);
51287 fileIO.Write(newPlayer.shoeColor.R);
51288 fileIO.Write(newPlayer.shoeColor.G);
51289 fileIO.Write(newPlayer.shoeColor.B);
51290 for (int k = 0; k < newPlayer.armor.Length; k++)
51291 {
51292 fileIO.Write(newPlayer.armor[k].netID);
51293 fileIO.Write(newPlayer.armor[k].prefix);
51294 }
51295 for (int l = 0; l < newPlayer.dye.Length; l++)
51296 {
51297 fileIO.Write(newPlayer.dye[l].netID);
51298 fileIO.Write(newPlayer.dye[l].prefix);
51299 }
51300 for (int m = 0; m < 58; m++)
51301 {
51302 fileIO.Write(newPlayer.inventory[m].netID);
51303 fileIO.Write(newPlayer.inventory[m].stack);
51304 fileIO.Write(newPlayer.inventory[m].prefix);
51305 fileIO.Write(newPlayer.inventory[m].favorited);
51306 }
51307 for (int n = 0; n < newPlayer.miscEquips.Length; n++)
51308 {
51309 fileIO.Write(newPlayer.miscEquips[n].netID);
51310 fileIO.Write(newPlayer.miscEquips[n].prefix);
51311 fileIO.Write(newPlayer.miscDyes[n].netID);
51312 fileIO.Write(newPlayer.miscDyes[n].prefix);
51313 }
51314 for (int num = 0; num < 40; num++)
51315 {
51316 fileIO.Write(newPlayer.bank.item[num].netID);
51317 fileIO.Write(newPlayer.bank.item[num].stack);
51318 fileIO.Write(newPlayer.bank.item[num].prefix);
51319 }
51320 for (int num2 = 0; num2 < 40; num2++)
51321 {
51322 fileIO.Write(newPlayer.bank2.item[num2].netID);
51323 fileIO.Write(newPlayer.bank2.item[num2].stack);
51324 fileIO.Write(newPlayer.bank2.item[num2].prefix);
51325 }
51326 for (int num3 = 0; num3 < 40; num3++)
51327 {
51328 fileIO.Write(newPlayer.bank3.item[num3].netID);
51329 fileIO.Write(newPlayer.bank3.item[num3].stack);
51330 fileIO.Write(newPlayer.bank3.item[num3].prefix);
51331 }
51332 for (int num4 = 0; num4 < 40; num4++)
51333 {
51334 fileIO.Write(newPlayer.bank4.item[num4].netID);
51335 fileIO.Write(newPlayer.bank4.item[num4].stack);
51336 fileIO.Write(newPlayer.bank4.item[num4].prefix);
51337 fileIO.Write(newPlayer.bank4.item[num4].favorited);
51338 }
51339 fileIO.Write(newPlayer.voidVaultInfo);
51340 for (int num5 = 0; num5 < maxBuffs; num5++)
51341 {
51342 if (Main.buffNoSave[newPlayer.buffType[num5]])
51343 {
51344 fileIO.Write(0);
51345 fileIO.Write(0);
51346 }
51347 else
51348 {
51349 fileIO.Write(newPlayer.buffType[num5]);
51350 fileIO.Write(newPlayer.buffTime[num5]);
51351 }
51352 }
51353 for (int num6 = 0; num6 < 200; num6++)
51354 {
51355 if (newPlayer.spN[num6] == null)
51356 {
51357 fileIO.Write(-1);
51358 break;
51359 }
51360 fileIO.Write(newPlayer.spX[num6]);
51361 fileIO.Write(newPlayer.spY[num6]);
51362 fileIO.Write(newPlayer.spI[num6]);
51363 fileIO.Write(newPlayer.spN[num6]);
51364 }
51365 fileIO.Write(newPlayer.hbLocked);
51366 for (int num7 = 0; num7 < newPlayer.hideInfo.Length; num7++)
51367 {
51368 fileIO.Write(newPlayer.hideInfo[num7]);
51369 }
51370 fileIO.Write(newPlayer.anglerQuestsFinished);
51371 for (int num8 = 0; num8 < newPlayer.DpadRadial.Bindings.Length; num8++)
51372 {
51373 fileIO.Write(newPlayer.DpadRadial.Bindings[num8]);
51374 }
51375 for (int num9 = 0; num9 < newPlayer.builderAccStatus.Length; num9++)
51376 {
51377 fileIO.Write(newPlayer.builderAccStatus[num9]);
51378 }
51379 fileIO.Write(newPlayer.bartenderQuestLog);
51380 fileIO.Write(newPlayer.dead);
51381 if (newPlayer.dead)
51382 {
51383 fileIO.Write(newPlayer.respawnTimer);
51384 }
51385 long value = DateTime.UtcNow.ToBinary();
51386 fileIO.Write(value);
51387 fileIO.Write(newPlayer.golferScoreAccumulated);
51388 newPlayer.creativeTracker.Save(fileIO);
51389 newPlayer.SaveTemporaryItemSlotContents(fileIO);
51391 BitsByte bitsByte2 = default(BitsByte);
51392 bitsByte2[0] = newPlayer.unlockedSuperCart;
51393 bitsByte2[1] = newPlayer.enabledSuperCart;
51394 fileIO.Write(bitsByte2);
51395 fileIO.Write(newPlayer.CurrentLoadoutIndex);
51396 for (int num10 = 0; num10 < newPlayer.Loadouts.Length; num10++)
51397 {
51398 newPlayer.Loadouts[num10].Serialize(fileIO);
51399 }
51400 }
51401
51403 {
51404 Item itemByIndex = Main.CreativeMenu.GetItemByIndex(0);
51405 BitsByte bitsByte = (byte)0;
51406 bitsByte[0] = !Main.mouseItem.IsAir;
51407 bitsByte[1] = !itemByIndex.IsAir;
51408 bitsByte[2] = !Main.guideItem.IsAir;
51409 bitsByte[3] = !Main.reforgeItem.IsAir;
51410 ItemSerializationContext context = ItemSerializationContext.SavingAndLoading;
51411 writer.Write(bitsByte);
51412 if (bitsByte[0])
51413 {
51414 Main.mouseItem.Serialize(writer, context);
51415 }
51416 if (bitsByte[1])
51417 {
51418 itemByIndex.Serialize(writer, context);
51419 }
51420 if (bitsByte[2])
51421 {
51422 Main.guideItem.Serialize(writer, context);
51423 }
51424 if (bitsByte[3])
51425 {
51426 Main.reforgeItem.Serialize(writer, context);
51427 }
51428 }
51429
51431 {
51432 BitsByte bitsByte = reader.ReadByte();
51433 ItemSerializationContext context = ItemSerializationContext.SavingAndLoading;
51434 if (bitsByte[0])
51435 {
51436 _temporaryItemSlots[0] = new Item();
51437 _temporaryItemSlots[0].DeserializeFrom(reader, context);
51438 }
51439 if (bitsByte[1])
51440 {
51441 _temporaryItemSlots[1] = new Item();
51442 _temporaryItemSlots[1].DeserializeFrom(reader, context);
51443 }
51444 if (bitsByte[2])
51445 {
51446 _temporaryItemSlots[2] = new Item();
51447 _temporaryItemSlots[2].DeserializeFrom(reader, context);
51448 }
51449 if (bitsByte[3])
51450 {
51451 _temporaryItemSlots[3] = new Item();
51452 _temporaryItemSlots[3].DeserializeFrom(reader, context);
51453 }
51454 }
51455
51457 {
51458 Item mouseItem = new Item();
51459 if (_temporaryItemSlots[0] != null)
51460 {
51461 mouseItem = _temporaryItemSlots[0].Clone();
51462 }
51463 Main.mouseItem = mouseItem;
51464 mouseItem = new Item();
51465 if (_temporaryItemSlots[1] != null)
51466 {
51467 mouseItem = _temporaryItemSlots[1].Clone();
51468 }
51469 Main.CreativeMenu.SetItembyIndex(mouseItem, 0);
51470 mouseItem = new Item();
51471 if (_temporaryItemSlots[2] != null)
51472 {
51473 mouseItem = _temporaryItemSlots[2].Clone();
51474 }
51475 Main.guideItem = mouseItem;
51476 mouseItem = new Item();
51477 if (_temporaryItemSlots[3] != null)
51478 {
51479 mouseItem = _temporaryItemSlots[3].Clone();
51480 }
51481 Main.reforgeItem = mouseItem;
51482 CreativePowerManager.Instance.ApplyLoadedDataToPlayer(this);
51483 }
51484
51485 public static void ClearPlayerTempInfo()
51486 {
51487 Main.mouseItem.TurnToAir();
51488 Main.guideItem.TurnToAir();
51489 Main.reforgeItem.TurnToAir();
51490 Main.CreativeMenu.GetItemByIndex(0).TurnToAir();
51491 }
51492
51493 public static void InternalSaveMap(bool isCloudSave)
51494 {
51495 if (string.IsNullOrEmpty(Main.playerPathName))
51496 {
51497 return;
51498 }
51499 try
51500 {
51501 if (Main.mapEnabled)
51502 {
51503 Main.Map.Save();
51504 }
51505 }
51506 catch
51507 {
51508 }
51509 if (!isCloudSave)
51510 {
51512 }
51513 }
51514
51515 public static PlayerFileData LoadPlayer(string playerPath, bool cloudSave)
51516 {
51518 if (cloudSave && SocialAPI.Cloud == null)
51519 {
51520 return playerFileData;
51521 }
51522 if (Main.rand == null)
51523 {
51524 Main.rand = new UnifiedRandom((int)DateTime.Now.Ticks);
51525 }
51526 Player player = new Player();
51527 bool gotToReadName = false;
51528 try
51529 {
51531 rijndaelManaged.Padding = PaddingMode.None;
51533 {
51534 using CryptoStream input = new CryptoStream(stream, rijndaelManaged.CreateDecryptor(ENCRYPTION_KEY, ENCRYPTION_KEY), CryptoStreamMode.Read);
51536 int num = binaryReader.ReadInt32();
51537 if (num >= 135)
51538 {
51539 playerFileData.Metadata = FileMetadata.Read(binaryReader, FileType.Player);
51540 }
51541 else
51542 {
51543 playerFileData.Metadata = FileMetadata.FromCurrentSettings(FileType.Player);
51544 }
51545 if (num > 279)
51546 {
51547 player.loadStatus = 1;
51548 player.name = binaryReader.ReadString();
51549 playerFileData.Player = player;
51550 return playerFileData;
51551 }
51552 Deserialize(playerFileData, player, binaryReader, num, out gotToReadName);
51553 }
51554 player.PlayerFrame();
51555 player.loadStatus = 0;
51556 playerFileData.Player = player;
51557 return playerFileData;
51558 }
51559 catch
51560 {
51561 }
51562 Player player2 = new Player();
51563 player2.loadStatus = 2;
51564 if (gotToReadName && player.name.Length <= nameLen)
51565 {
51566 player2.name = player.name;
51567 }
51568 else
51569 {
51571 player2.name = array[array.Length - 1].Split('.')[0];
51572 }
51573 playerFileData.Player = player2;
51574 return playerFileData;
51575 }
51576
51578 {
51579 Player player = new Player();
51580 _visualCloneStream.Seek(0L, SeekOrigin.Begin);
51581 Serialize(_visualCloneDummyData, this, _visualCloneWriter);
51582 _visualCloneStream.Seek(0L, SeekOrigin.Begin);
51583 Deserialize(_visualCloneDummyData, player, _visualCloneReader, 279, out var _);
51584 return player;
51585 }
51586
51588 {
51589 gotToReadName = false;
51590 newPlayer.name = fileIO.ReadString();
51591 gotToReadName = true;
51592 if (release >= 10)
51593 {
51594 if (release >= 17)
51595 {
51596 newPlayer.difficulty = fileIO.ReadByte();
51597 }
51598 else if (fileIO.ReadBoolean())
51599 {
51600 newPlayer.difficulty = 2;
51601 }
51602 }
51603 if (release >= 138)
51604 {
51605 data.SetPlayTime(new TimeSpan(fileIO.ReadInt64()));
51606 }
51607 else
51608 {
51610 }
51611 newPlayer.hair = fileIO.ReadInt32();
51612 if (release >= 82)
51613 {
51614 newPlayer.hairDye = fileIO.ReadByte();
51615 }
51616 if (release >= 124)
51617 {
51618 BitsByte bitsByte = fileIO.ReadByte();
51619 for (int i = 0; i < 8; i++)
51620 {
51621 newPlayer.hideVisibleAccessory[i] = bitsByte[i];
51622 }
51623 bitsByte = fileIO.ReadByte();
51624 for (int j = 0; j < 2; j++)
51625 {
51626 newPlayer.hideVisibleAccessory[j + 8] = bitsByte[j];
51627 }
51628 }
51629 else if (release >= 83)
51630 {
51631 BitsByte bitsByte2 = fileIO.ReadByte();
51632 for (int k = 0; k < 8; k++)
51633 {
51634 newPlayer.hideVisibleAccessory[k] = bitsByte2[k];
51635 }
51636 }
51637 if (release >= 119)
51638 {
51639 newPlayer.hideMisc = fileIO.ReadByte();
51640 }
51641 if (release <= 17)
51642 {
51643 if (newPlayer.hair == 5 || newPlayer.hair == 6 || newPlayer.hair == 9 || newPlayer.hair == 11)
51644 {
51645 newPlayer.Male = false;
51646 }
51647 else
51648 {
51649 newPlayer.Male = true;
51650 }
51651 }
51652 else if (release < 107)
51653 {
51654 newPlayer.Male = fileIO.ReadBoolean();
51655 }
51656 else
51657 {
51658 newPlayer.skinVariant = fileIO.ReadByte();
51659 }
51660 if (release < 161 && newPlayer.skinVariant == 7)
51661 {
51662 newPlayer.skinVariant = 9;
51663 }
51664 newPlayer.statLife = fileIO.ReadInt32();
51665 newPlayer.statLifeMax = fileIO.ReadInt32();
51666 if (newPlayer.statLifeMax > 500)
51667 {
51668 newPlayer.statLifeMax = 500;
51669 }
51670 newPlayer.statMana = fileIO.ReadInt32();
51671 newPlayer.statManaMax = fileIO.ReadInt32();
51672 if (newPlayer.statManaMax > 200)
51673 {
51674 newPlayer.statManaMax = 200;
51675 }
51676 if (newPlayer.statMana > 400)
51677 {
51678 newPlayer.statMana = 400;
51679 }
51680 if (release >= 125)
51681 {
51682 newPlayer.extraAccessory = fileIO.ReadBoolean();
51683 }
51684 if (release >= 229)
51685 {
51686 newPlayer.unlockedBiomeTorches = fileIO.ReadBoolean();
51687 newPlayer.UsingBiomeTorches = fileIO.ReadBoolean();
51688 if (release >= 256)
51689 {
51690 newPlayer.ateArtisanBread = fileIO.ReadBoolean();
51691 }
51692 if (release >= 260)
51693 {
51694 newPlayer.usedAegisCrystal = fileIO.ReadBoolean();
51695 newPlayer.usedAegisFruit = fileIO.ReadBoolean();
51696 newPlayer.usedArcaneCrystal = fileIO.ReadBoolean();
51697 newPlayer.usedGalaxyPearl = fileIO.ReadBoolean();
51698 newPlayer.usedGummyWorm = fileIO.ReadBoolean();
51699 newPlayer.usedAmbrosia = fileIO.ReadBoolean();
51700 }
51701 }
51702 if (release >= 182)
51703 {
51704 newPlayer.downedDD2EventAnyDifficulty = fileIO.ReadBoolean();
51705 }
51706 if (release >= 128)
51707 {
51708 newPlayer.taxMoney = fileIO.ReadInt32();
51709 }
51710 if (release >= 254)
51711 {
51712 newPlayer.numberOfDeathsPVE = fileIO.ReadInt32();
51713 }
51714 if (release >= 254)
51715 {
51716 newPlayer.numberOfDeathsPVP = fileIO.ReadInt32();
51717 }
51718 newPlayer.hairColor = fileIO.ReadRGB();
51719 newPlayer.skinColor = fileIO.ReadRGB();
51720 newPlayer.eyeColor = fileIO.ReadRGB();
51721 newPlayer.shirtColor = fileIO.ReadRGB();
51722 newPlayer.underShirtColor = fileIO.ReadRGB();
51723 newPlayer.pantsColor = fileIO.ReadRGB();
51724 newPlayer.shoeColor = fileIO.ReadRGB();
51725 Main.player[Main.myPlayer].hairColor = newPlayer.hairColor;
51726 Main.player[Main.myPlayer].skinColor = newPlayer.skinColor;
51727 Main.player[Main.myPlayer].eyeColor = newPlayer.eyeColor;
51728 Main.player[Main.myPlayer].shirtColor = newPlayer.shirtColor;
51729 Main.player[Main.myPlayer].underShirtColor = newPlayer.underShirtColor;
51730 Main.player[Main.myPlayer].pantsColor = newPlayer.pantsColor;
51731 Main.player[Main.myPlayer].shoeColor = newPlayer.shoeColor;
51732 if (release >= 38)
51733 {
51734 if (release < 124)
51735 {
51736 int num = 11;
51737 if (release >= 81)
51738 {
51739 num = 16;
51740 }
51741 for (int l = 0; l < num; l++)
51742 {
51743 int num2 = l;
51744 if (num2 >= 8)
51745 {
51746 num2 += 2;
51747 }
51748 newPlayer.armor[num2].netDefaults(fileIO.ReadInt32());
51749 newPlayer.armor[num2].Prefix(fileIO.ReadByte());
51750 }
51751 }
51752 else
51753 {
51754 int num3 = 20;
51755 for (int m = 0; m < num3; m++)
51756 {
51757 newPlayer.armor[m].netDefaults(fileIO.ReadInt32());
51758 newPlayer.armor[m].Prefix(fileIO.ReadByte());
51759 }
51760 }
51761 if (release >= 47)
51762 {
51763 int num4 = 3;
51764 if (release >= 81)
51765 {
51766 num4 = 8;
51767 }
51768 if (release >= 124)
51769 {
51770 num4 = 10;
51771 }
51772 for (int n = 0; n < num4; n++)
51773 {
51774 int num5 = n;
51775 newPlayer.dye[num5].netDefaults(fileIO.ReadInt32());
51776 newPlayer.dye[num5].Prefix(fileIO.ReadByte());
51777 }
51778 }
51779 if (release >= 58)
51780 {
51781 for (int num6 = 0; num6 < 58; num6++)
51782 {
51783 int num7 = fileIO.ReadInt32();
51784 if (num7 >= ItemID.Count)
51785 {
51786 newPlayer.inventory[num6].netDefaults(0);
51787 fileIO.ReadInt32();
51788 fileIO.ReadByte();
51789 if (release >= 114)
51790 {
51791 fileIO.ReadBoolean();
51792 }
51793 }
51794 else
51795 {
51796 newPlayer.inventory[num6].netDefaults(num7);
51797 newPlayer.inventory[num6].stack = fileIO.ReadInt32();
51798 newPlayer.inventory[num6].Prefix(fileIO.ReadByte());
51799 if (release >= 114)
51800 {
51801 newPlayer.inventory[num6].favorited = fileIO.ReadBoolean();
51802 }
51803 }
51804 }
51805 }
51806 else
51807 {
51808 for (int num8 = 0; num8 < 48; num8++)
51809 {
51810 int num9 = fileIO.ReadInt32();
51811 if (num9 >= ItemID.Count)
51812 {
51813 newPlayer.inventory[num8].netDefaults(0);
51814 fileIO.ReadInt32();
51815 fileIO.ReadByte();
51816 }
51817 else
51818 {
51819 newPlayer.inventory[num8].netDefaults(num9);
51820 newPlayer.inventory[num8].stack = fileIO.ReadInt32();
51821 newPlayer.inventory[num8].Prefix(fileIO.ReadByte());
51822 }
51823 }
51824 }
51825 if (release >= 117)
51826 {
51827 if (release < 136)
51828 {
51829 for (int num10 = 0; num10 < 5; num10++)
51830 {
51831 if (num10 != 1)
51832 {
51833 int num11 = fileIO.ReadInt32();
51834 if (num11 >= ItemID.Count)
51835 {
51836 newPlayer.miscEquips[num10].netDefaults(0);
51837 fileIO.ReadByte();
51838 }
51839 else
51840 {
51841 newPlayer.miscEquips[num10].netDefaults(num11);
51842 newPlayer.miscEquips[num10].Prefix(fileIO.ReadByte());
51843 }
51844 num11 = fileIO.ReadInt32();
51845 if (num11 >= ItemID.Count)
51846 {
51847 newPlayer.miscDyes[num10].netDefaults(0);
51848 fileIO.ReadByte();
51849 }
51850 else
51851 {
51852 newPlayer.miscDyes[num10].netDefaults(num11);
51853 newPlayer.miscDyes[num10].Prefix(fileIO.ReadByte());
51854 }
51855 }
51856 }
51857 }
51858 else
51859 {
51860 for (int num12 = 0; num12 < 5; num12++)
51861 {
51862 int num13 = fileIO.ReadInt32();
51863 if (num13 >= ItemID.Count)
51864 {
51865 newPlayer.miscEquips[num12].netDefaults(0);
51866 fileIO.ReadByte();
51867 }
51868 else
51869 {
51870 newPlayer.miscEquips[num12].netDefaults(num13);
51871 newPlayer.miscEquips[num12].Prefix(fileIO.ReadByte());
51872 }
51873 num13 = fileIO.ReadInt32();
51874 if (num13 >= ItemID.Count)
51875 {
51876 newPlayer.miscDyes[num12].netDefaults(0);
51877 fileIO.ReadByte();
51878 }
51879 else
51880 {
51881 newPlayer.miscDyes[num12].netDefaults(num13);
51882 newPlayer.miscDyes[num12].Prefix(fileIO.ReadByte());
51883 }
51884 }
51885 }
51886 }
51887 if (release >= 58)
51888 {
51889 for (int num14 = 0; num14 < 40; num14++)
51890 {
51891 newPlayer.bank.item[num14].netDefaults(fileIO.ReadInt32());
51892 newPlayer.bank.item[num14].stack = fileIO.ReadInt32();
51893 newPlayer.bank.item[num14].Prefix(fileIO.ReadByte());
51894 }
51895 for (int num15 = 0; num15 < 40; num15++)
51896 {
51897 newPlayer.bank2.item[num15].netDefaults(fileIO.ReadInt32());
51898 newPlayer.bank2.item[num15].stack = fileIO.ReadInt32();
51899 newPlayer.bank2.item[num15].Prefix(fileIO.ReadByte());
51900 }
51901 }
51902 else
51903 {
51904 for (int num16 = 0; num16 < 20; num16++)
51905 {
51906 newPlayer.bank.item[num16].netDefaults(fileIO.ReadInt32());
51907 newPlayer.bank.item[num16].stack = fileIO.ReadInt32();
51908 newPlayer.bank.item[num16].Prefix(fileIO.ReadByte());
51909 }
51910 for (int num17 = 0; num17 < 20; num17++)
51911 {
51912 newPlayer.bank2.item[num17].netDefaults(fileIO.ReadInt32());
51913 newPlayer.bank2.item[num17].stack = fileIO.ReadInt32();
51914 newPlayer.bank2.item[num17].Prefix(fileIO.ReadByte());
51915 }
51916 }
51917 if (release >= 182)
51918 {
51919 for (int num18 = 0; num18 < 40; num18++)
51920 {
51921 newPlayer.bank3.item[num18].netDefaults(fileIO.ReadInt32());
51922 newPlayer.bank3.item[num18].stack = fileIO.ReadInt32();
51923 newPlayer.bank3.item[num18].Prefix(fileIO.ReadByte());
51924 }
51925 }
51926 if (release >= 198)
51927 {
51928 for (int num19 = 0; num19 < 40; num19++)
51929 {
51930 newPlayer.bank4.item[num19].netDefaults(fileIO.ReadInt32());
51931 newPlayer.bank4.item[num19].stack = fileIO.ReadInt32();
51932 newPlayer.bank4.item[num19].Prefix(fileIO.ReadByte());
51933 if (release >= 255)
51934 {
51935 newPlayer.bank4.item[num19].favorited = fileIO.ReadBoolean();
51936 }
51937 }
51938 }
51939 if (release >= 199)
51940 {
51941 newPlayer.voidVaultInfo = fileIO.ReadByte();
51942 }
51943 }
51944 else
51945 {
51946 for (int num20 = 0; num20 < 8; num20++)
51947 {
51948 newPlayer.armor[num20].SetDefaults(ItemID.FromLegacyName(fileIO.ReadString(), release));
51949 if (release >= 36)
51950 {
51951 newPlayer.armor[num20].Prefix(fileIO.ReadByte());
51952 }
51953 }
51954 if (release >= 6)
51955 {
51956 for (int num21 = 8; num21 < 11; num21++)
51957 {
51958 newPlayer.armor[num21].SetDefaults(ItemID.FromLegacyName(fileIO.ReadString(), release));
51959 if (release >= 36)
51960 {
51961 newPlayer.armor[num21].Prefix(fileIO.ReadByte());
51962 }
51963 }
51964 }
51965 for (int num22 = 0; num22 < 44; num22++)
51966 {
51967 newPlayer.inventory[num22].SetDefaults(ItemID.FromLegacyName(fileIO.ReadString(), release));
51968 newPlayer.inventory[num22].stack = fileIO.ReadInt32();
51969 if (release >= 36)
51970 {
51971 newPlayer.inventory[num22].Prefix(fileIO.ReadByte());
51972 }
51973 }
51974 if (release >= 15)
51975 {
51976 for (int num23 = 44; num23 < 48; num23++)
51977 {
51978 newPlayer.inventory[num23].SetDefaults(ItemID.FromLegacyName(fileIO.ReadString(), release));
51979 newPlayer.inventory[num23].stack = fileIO.ReadInt32();
51980 if (release >= 36)
51981 {
51982 newPlayer.inventory[num23].Prefix(fileIO.ReadByte());
51983 }
51984 }
51985 }
51986 for (int num24 = 0; num24 < 20; num24++)
51987 {
51988 newPlayer.bank.item[num24].SetDefaults(ItemID.FromLegacyName(fileIO.ReadString(), release));
51989 newPlayer.bank.item[num24].stack = fileIO.ReadInt32();
51990 if (release >= 36)
51991 {
51992 newPlayer.bank.item[num24].Prefix(fileIO.ReadByte());
51993 }
51994 }
51995 if (release >= 20)
51996 {
51997 for (int num25 = 0; num25 < 20; num25++)
51998 {
51999 newPlayer.bank2.item[num25].SetDefaults(ItemID.FromLegacyName(fileIO.ReadString(), release));
52000 newPlayer.bank2.item[num25].stack = fileIO.ReadInt32();
52001 if (release >= 36)
52002 {
52003 newPlayer.bank2.item[num25].Prefix(fileIO.ReadByte());
52004 }
52005 }
52006 }
52007 }
52008 if (release < 58)
52009 {
52010 for (int num26 = 40; num26 < 48; num26++)
52011 {
52012 newPlayer.inventory[num26 + 10] = newPlayer.inventory[num26].Clone();
52013 newPlayer.inventory[num26].SetDefaults();
52014 }
52015 }
52016 if (release >= 11)
52017 {
52018 int num27 = 22;
52019 if (release < 74)
52020 {
52021 num27 = 10;
52022 }
52023 if (release >= 252)
52024 {
52025 num27 = 44;
52026 }
52027 for (int num28 = 0; num28 < num27; num28++)
52028 {
52029 newPlayer.buffType[num28] = fileIO.ReadInt32();
52030 newPlayer.buffTime[num28] = fileIO.ReadInt32();
52031 if (newPlayer.buffType[num28] == 0)
52032 {
52033 num28--;
52034 num27--;
52035 }
52036 }
52037 }
52038 for (int num29 = 0; num29 < 200; num29++)
52039 {
52040 int num30 = fileIO.ReadInt32();
52041 if (num30 == -1)
52042 {
52043 break;
52044 }
52045 newPlayer.spX[num29] = num30;
52046 newPlayer.spY[num29] = fileIO.ReadInt32();
52047 newPlayer.spI[num29] = fileIO.ReadInt32();
52048 newPlayer.spN[num29] = fileIO.ReadString();
52049 }
52050 if (release >= 16)
52051 {
52052 newPlayer.hbLocked = fileIO.ReadBoolean();
52053 }
52054 if (release >= 115)
52055 {
52056 int num31 = 13;
52057 for (int num32 = 0; num32 < num31; num32++)
52058 {
52059 newPlayer.hideInfo[num32] = fileIO.ReadBoolean();
52060 }
52061 }
52062 if (release >= 98)
52063 {
52064 newPlayer.anglerQuestsFinished = fileIO.ReadInt32();
52065 }
52066 if (release >= 162)
52067 {
52068 for (int num33 = 0; num33 < 4; num33++)
52069 {
52070 newPlayer.DpadRadial.Bindings[num33] = fileIO.ReadInt32();
52071 }
52072 }
52073 if (release >= 164)
52074 {
52075 int num34 = 8;
52076 if (release >= 167)
52077 {
52078 num34 = 10;
52079 }
52080 if (release >= 197)
52081 {
52082 num34 = 11;
52083 }
52084 if (release >= 230)
52085 {
52086 num34 = 12;
52087 }
52088 for (int num35 = 0; num35 < num34; num35++)
52089 {
52090 newPlayer.builderAccStatus[num35] = fileIO.ReadInt32();
52091 }
52092 if (release < 210)
52093 {
52094 newPlayer.builderAccStatus[0] = 1;
52095 }
52096 if (release < 249)
52097 {
52098 bool flag = false;
52099 for (int num36 = 0; num36 < 58; num36++)
52100 {
52101 if (newPlayer.inventory[num36].type == 3611)
52102 {
52103 flag = true;
52104 break;
52105 }
52106 }
52107 if (flag)
52108 {
52109 newPlayer.builderAccStatus[1] = 1;
52110 }
52111 }
52112 }
52113 if (release >= 181)
52114 {
52115 newPlayer.bartenderQuestLog = fileIO.ReadInt32();
52116 }
52117 if (release >= 200)
52118 {
52119 newPlayer.dead = fileIO.ReadBoolean();
52120 if (newPlayer.dead)
52121 {
52122 newPlayer.respawnTimer = Utils.Clamp(fileIO.ReadInt32(), 0, 60000);
52123 }
52124 }
52125 newPlayer.lastTimePlayerWasSaved = 0L;
52126 if (release >= 202)
52127 {
52128 newPlayer.lastTimePlayerWasSaved = fileIO.ReadInt64();
52129 }
52130 else
52131 {
52132 newPlayer.lastTimePlayerWasSaved = DateTime.UtcNow.ToBinary();
52133 }
52134 if (release >= 206)
52135 {
52136 newPlayer.golferScoreAccumulated = fileIO.ReadInt32();
52137 }
52138 if (release >= 218)
52139 {
52140 newPlayer.creativeTracker.Load(fileIO, release);
52141 }
52142 if (release >= 214)
52143 {
52144 newPlayer.LoadTemporaryItemSlotContents(fileIO);
52145 }
52146 newPlayer.savedPerPlayerFieldsThatArentInThePlayerClass = new SavedPlayerDataWithAnnoyingRules();
52147 CreativePowerManager.Instance.ResetDataForNewPlayer(newPlayer);
52148 if (release >= 220)
52149 {
52151 }
52152 if (release >= 253)
52153 {
52154 BitsByte bitsByte3 = fileIO.ReadByte();
52155 newPlayer.unlockedSuperCart = bitsByte3[0];
52156 newPlayer.enabledSuperCart = bitsByte3[1];
52157 }
52158 else
52159 {
52160 newPlayer.unlockedSuperCart = newPlayer.HasItemInAnyInventory(3353);
52161 }
52162 if (release >= 262)
52163 {
52164 int value = fileIO.ReadInt32();
52165 newPlayer.CurrentLoadoutIndex = Utils.Clamp(value, 0, newPlayer.Loadouts.Length - 1);
52166 for (int num37 = 0; num37 < newPlayer.Loadouts.Length; num37++)
52167 {
52168 newPlayer.Loadouts[num37].Deserialize(fileIO, release);
52169 }
52170 }
52171 LoadPlayer_LastMinuteFixes(newPlayer);
52172 }
52173
52175 {
52176 if (Main.myPlayer != newPlayer.whoAmI || !newPlayer.dead)
52177 {
52178 return;
52179 }
52180 long num = DateTime.UtcNow.ToBinary() - newPlayer.lastTimePlayerWasSaved;
52181 if (num > 0)
52182 {
52183 int num2 = Utils.Clamp((int)(Utils.Clamp(new TimeSpan(num).TotalSeconds, 0.0, 1000.0) * 60.0), 0, newPlayer.respawnTimer);
52184 newPlayer.respawnTimer -= num2;
52185 if (newPlayer.respawnTimer == 0)
52186 {
52187 newPlayer.dead = false;
52188 }
52189 }
52190 }
52191
52192 public void FixLoadedData()
52193 {
52194 FixLoadedData_Items(armor);
52195 FixLoadedData_Items(dye);
52196 FixLoadedData_Items(inventory);
52197 FixLoadedData_Items(miscEquips);
52198 FixLoadedData_Items(miscDyes);
52199 FixLoadedData_Items(bank.item);
52200 FixLoadedData_Items(bank2.item);
52201 FixLoadedData_Items(bank3.item);
52202 FixLoadedData_Items(bank4.item);
52203 FixLoadedData_Items(_temporaryItemSlots);
52204 FixLoadedData_EliminiateDuplicateAccessories(armor);
52205 for (int i = 0; i < Loadouts.Length; i++)
52206 {
52207 Loadouts[i].FixLoadedData();
52208 }
52209 }
52210
52212 {
52213 for (int i = 3; i < 10; i++)
52214 {
52215 Item item = armorArray[i];
52216 if (item.IsAir)
52217 {
52218 continue;
52219 }
52220 for (int j = i + 1; j < 10; j++)
52221 {
52223 if (item2.type == item.type)
52224 {
52225 item2.TurnToAir();
52226 }
52227 }
52228 }
52229 }
52230
52231 private void FixLoadedData_Items(Item[] items)
52232 {
52233 for (int i = 0; i < items.Length; i++)
52234 {
52235 if (items[i] != null)
52236 {
52237 items[i].FixAgainstExploit();
52238 }
52239 }
52240 }
52241
52243 {
52244 newPlayer.skinVariant = (int)MathHelper.Clamp(newPlayer.skinVariant, 0f, PlayerVariantID.Count - 1);
52245 for (int i = 3; i < 10; i++)
52246 {
52247 int type = newPlayer.armor[i].type;
52248 if (type == 908 || type == 5000)
52249 {
52250 newPlayer.lavaMax += 420;
52251 }
52252 if (type == 906 || type == 4038 || type == 3999 || type == 4003)
52253 {
52254 newPlayer.lavaMax += 420;
52255 }
52256 if (newPlayer.wingsLogic == 0 && newPlayer.armor[i].wingSlot >= 0)
52257 {
52258 newPlayer.wingsLogic = newPlayer.armor[i].wingSlot;
52259 }
52260 if (type == 158 || type == 396 || type == 1250 || type == 1251 || type == 1252)
52261 {
52262 newPlayer.noFallDmg = true;
52263 }
52264 if (type == 860 || type == 535)
52265 {
52266 newPlayer.pStone = true;
52267 }
52268 newPlayer.lavaTime = newPlayer.lavaMax;
52269 }
52270 newPlayer.FixLoadedData();
52271 }
52272
52273 public static PlayerFileData GetFileData(string file, bool cloudSave)
52274 {
52275 if (file == null || (cloudSave && SocialAPI.Cloud == null))
52276 {
52277 return null;
52278 }
52280 if (playerFileData.Player != null)
52281 {
52282 if (playerFileData.Player.loadStatus != 0 && playerFileData.Player.loadStatus != 1)
52283 {
52284 if (FileUtilities.Exists(file + ".bak", cloudSave))
52285 {
52286 FileUtilities.Move(file + ".bak", file, cloudSave);
52287 }
52288 playerFileData = LoadPlayer(file, cloudSave);
52289 if (playerFileData.Player == null)
52290 {
52291 return null;
52292 }
52293 }
52294 return playerFileData;
52295 }
52296 return null;
52297 }
52298
52299 public Color GetHairColor(bool useLighting = true)
52300 {
52301 Color color = Lighting.GetColor((int)((double)position.X + (double)width * 0.5) / 16, (int)(((double)position.Y + (double)height * 0.25) / 16.0));
52302 return GameShaders.Hair.GetColor(hairDye, this, useLighting ? color : Color.White);
52303 }
52304
52305 public bool HasItem(int type)
52306 {
52307 for (int i = 0; i < 58; i++)
52308 {
52309 if (type == inventory[i].type && inventory[i].stack > 0)
52310 {
52311 return true;
52312 }
52313 }
52314 return false;
52315 }
52316
52317 public bool HasItem(int type, Item[] collection)
52318 {
52319 for (int i = 0; i < collection.Length; i++)
52320 {
52321 if (type == collection[i].type && collection[i].stack > 0)
52322 {
52323 return true;
52324 }
52325 }
52326 return false;
52327 }
52328
52330 {
52331 if (!HasItem(type))
52332 {
52333 if (useVoidBag())
52334 {
52335 return HasItem(type, bank4.item);
52336 }
52337 return false;
52338 }
52339 return true;
52340 }
52341
52343 {
52344 if (HasItem(type, inventory))
52345 {
52346 return true;
52347 }
52348 if (HasItem(type, armor))
52349 {
52350 return true;
52351 }
52352 if (HasItem(type, dye))
52353 {
52354 return true;
52355 }
52356 if (HasItem(type, miscEquips))
52357 {
52358 return true;
52359 }
52360 if (HasItem(type, miscDyes))
52361 {
52362 return true;
52363 }
52364 if (HasItem(type, bank.item))
52365 {
52366 return true;
52367 }
52368 if (HasItem(type, bank2.item))
52369 {
52370 return true;
52371 }
52372 if (HasItem(type, bank3.item))
52373 {
52374 return true;
52375 }
52376 if (HasItem(type, bank4.item))
52377 {
52378 return true;
52379 }
52380 return false;
52381 }
52382
52383 public int FindItem(int netid)
52384 {
52385 for (int i = 0; i < 58; i++)
52386 {
52387 if (netid == inventory[i].netID && inventory[i].stack > 0)
52388 {
52389 return i;
52390 }
52391 }
52392 return -1;
52393 }
52394
52396 {
52397 for (int i = 0; i < 58; i++)
52398 {
52399 if (inventory[i].stack > 0 && netids.Contains(inventory[i].netID))
52400 {
52401 return i;
52402 }
52403 }
52404 return -1;
52405 }
52406
52407 public int FindItem(bool[] validtypes)
52408 {
52409 for (int i = 0; i < 58; i++)
52410 {
52411 if (inventory[i].stack > 0 && validtypes[inventory[i].type])
52412 {
52413 return i;
52414 }
52415 }
52416 return -1;
52417 }
52418
52419 public int FindItem(int type, Item[] collection)
52420 {
52421 for (int i = 0; i < collection.Length; i++)
52422 {
52423 if (inventory[i].stack > 0 && type == collection[i].type)
52424 {
52425 return i;
52426 }
52427 }
52428 return -1;
52429 }
52430
52432 {
52433 inVoidBag = false;
52434 int num = FindItem(type);
52435 if (num == -1 && useVoidBag())
52436 {
52437 num = FindItem(type, bank4.item);
52438 if (num == -1)
52439 {
52440 return -1;
52441 }
52442 inVoidBag = true;
52443 }
52444 return num;
52445 }
52446
52447 public Player()
52448 {
52449 width = 20;
52450 height = 42;
52451 name = string.Empty;
52452 bodyFrame.Width = 40;
52453 bodyFrame.Height = 56;
52454 legFrame.Width = 40;
52455 legFrame.Height = 56;
52456 tileEntityAnchor.Clear();
52457 doorHelper = new DoorOpeningHelper();
52458 for (int i = 0; i < 59; i++)
52459 {
52460 if (i < armor.Length)
52461 {
52462 armor[i] = new Item();
52463 }
52464 inventory[i] = new Item();
52465 }
52466 for (int j = 0; j < 40; j++)
52467 {
52468 bank.item[j] = new Item();
52469 bank2.item[j] = new Item();
52470 bank3.item[j] = new Item();
52471 bank4.item[j] = new Item();
52472 }
52473 for (int k = 0; k < dye.Length; k++)
52474 {
52475 dye[k] = new Item();
52476 }
52477 for (int l = 0; l < miscEquips.Length; l++)
52478 {
52479 miscEquips[l] = new Item();
52480 }
52481 for (int m = 0; m < miscDyes.Length; m++)
52482 {
52483 miscDyes[m] = new Item();
52484 }
52485 trashItem = new Item();
52486 lastVisualizedSelectedItem = new Item();
52487 grappling[0] = -1;
52488 statManaMax = 20;
52489 extraAccessory = false;
52490 ateArtisanBread = false;
52491 usedAegisCrystal = false;
52492 usedAegisFruit = false;
52493 usedArcaneCrystal = false;
52494 usedGalaxyPearl = false;
52495 usedGummyWorm = false;
52496 usedAmbrosia = false;
52497 for (int n = 0; n < TileID.Count; n++)
52498 {
52499 adjTile[n] = false;
52500 oldAdjTile[n] = false;
52501 }
52502 hitTile = new HitTile();
52503 hitReplace = new HitTile();
52504 mount = new Mount();
52505 talkNPC = -1;
52506 piggyBankProjTracker.Clear();
52507 voidLensChest.Clear();
52508 creativeTracker = new CreativeUnlocksTracker();
52509 builderAccStatus[0] = 1;
52510 }
52511
52512 public void MagicConch()
52513 {
52514 bool flag = position.X / 16f < (float)(Main.maxTilesX / 2);
52515 bool flag2 = false;
52516 int num = 50;
52517 int num2 = 50;
52518 int num3 = WorldGen.beachDistance - num - num2;
52519 if (flag)
52520 {
52521 num3 = Main.maxTilesX - num3 - 1 - num2;
52522 }
52523 else
52524 {
52525 num3 -= num2 / 2;
52526 }
52527 _ = (float)Main.maxTilesY / 1200f;
52528 _ = (float)Main.maxTilesY / 1200f;
52530 {
52531 avoidAnyLiquid = true,
52532 avoidHurtTiles = true,
52533 attemptsBeforeGivingUp = 1000,
52534 maximumFallDistanceFromOrignalPoint = 300
52535 };
52537 int num4 = flag.ToDirectionInt();
52538 int startX = (flag ? (Main.maxTilesX - 50) : 50);
52539 flag2 = true;
52541 {
52542 flag2 = false;
52543 startX = ((!flag) ? (Main.maxTilesX - 50) : 50);
52545 {
52546 flag2 = true;
52547 }
52548 }
52549 if (flag2)
52550 {
52551 vector = landingPoint.ToWorldCoordinates(8f, 16f) - new Vector2(width / 2, height);
52552 }
52553 if (flag2)
52554 {
52556 Teleport(newPos, 5);
52557 velocity = Vector2.Zero;
52558 if (Main.netMode == 2)
52559 {
52560 RemoteClient.CheckSection(whoAmI, position);
52561 NetMessage.SendData(65, -1, -1, null, 0, whoAmI, newPos.X, newPos.Y, 5);
52562 }
52563 }
52564 else
52565 {
52566 Vector2 newPos2 = position;
52567 Teleport(newPos2, 5);
52568 velocity = Vector2.Zero;
52569 if (Main.netMode == 2)
52570 {
52571 RemoteClient.CheckSection(whoAmI, position);
52572 NetMessage.SendData(65, -1, -1, null, 0, whoAmI, newPos2.X, newPos2.Y, 5, 1);
52573 }
52574 }
52575 }
52576
52577 public void Shellphone_Spawn()
52578 {
52579 int floorX = Main.spawnTileX;
52580 int floorY = Main.spawnTileY;
52581 Spawn_GetPositionAtWorldSpawn(ref floorX, ref floorY);
52582 if (Main.netMode != 1 && !Spawn_IsAreaAValidWorldSpawn(floorX, floorY))
52583 {
52584 Spawn_ForceClearArea(floorX, floorY);
52585 }
52586 Vector2 newPos = new Point(floorX, floorY).ToWorldCoordinates(8f, 0f) - new Vector2(width / 2, height);
52587 Teleport(newPos, 11);
52588 velocity = Vector2.Zero;
52589 if (Main.netMode == 2)
52590 {
52591 RemoteClient.CheckSection(whoAmI, position);
52592 NetMessage.SendData(65, -1, -1, null, 0, whoAmI, newPos.X, newPos.Y, 11);
52593 }
52594 }
52595
52596 public void DemonConch()
52597 {
52598 bool canSpawn = false;
52599 int num = Main.maxTilesX / 2;
52600 int num2 = 100;
52601 int num3 = num2 / 2;
52602 int teleportStartY = Main.UnderworldLayer + 20;
52603 int teleportRangeY = 80;
52605 {
52606 mostlySolidFloor = true,
52607 avoidAnyLiquid = true,
52608 avoidLava = true,
52609 avoidHurtTiles = true,
52610 avoidWalls = true,
52611 attemptsBeforeGivingUp = 1000,
52612 maximumFallDistanceFromOrignalPoint = 30
52613 };
52614 Vector2 vector = CheckForGoodTeleportationSpot(ref canSpawn, num - num3, num2, teleportStartY, teleportRangeY, settings);
52615 if (!canSpawn)
52616 {
52617 vector = CheckForGoodTeleportationSpot(ref canSpawn, num - num2, num3, teleportStartY, teleportRangeY, settings);
52618 }
52619 if (!canSpawn)
52620 {
52621 vector = CheckForGoodTeleportationSpot(ref canSpawn, num + num3, num3, teleportStartY, teleportRangeY, settings);
52622 }
52623 if (canSpawn)
52624 {
52626 Teleport(newPos, 7);
52627 velocity = Vector2.Zero;
52628 if (Main.netMode == 2)
52629 {
52630 RemoteClient.CheckSection(whoAmI, position);
52631 NetMessage.SendData(65, -1, -1, null, 0, whoAmI, newPos.X, newPos.Y, 7);
52632 }
52633 }
52634 else
52635 {
52636 Vector2 newPos2 = position;
52637 Teleport(newPos2, 7);
52638 velocity = Vector2.Zero;
52639 if (Main.netMode == 2)
52640 {
52641 RemoteClient.CheckSection(whoAmI, position);
52642 NetMessage.SendData(65, -1, -1, null, 0, whoAmI, newPos2.X, newPos2.Y, 7, 1);
52643 }
52644 }
52645 }
52646
52648 {
52649 bool canSpawn = false;
52650 int teleportStartX = 100;
52651 int teleportRangeX = Main.maxTilesX - 200;
52652 int teleportStartY = 100;
52655 {
52656 avoidLava = true,
52657 avoidHurtTiles = true,
52658 maximumFallDistanceFromOrignalPoint = 100,
52659 attemptsBeforeGivingUp = 1000
52660 });
52661 if (canSpawn)
52662 {
52664 Teleport(newPos, 2);
52665 velocity = Vector2.Zero;
52666 if (Main.netMode == 2)
52667 {
52668 RemoteClient.CheckSection(whoAmI, position);
52669 NetMessage.SendData(65, -1, -1, null, 0, whoAmI, newPos.X, newPos.Y, 2);
52670 }
52671 }
52672 else
52673 {
52674 Vector2 newPos2 = position;
52675 Teleport(newPos2, 2);
52676 velocity = Vector2.Zero;
52677 if (Main.netMode == 2)
52678 {
52679 RemoteClient.CheckSection(whoAmI, position);
52680 NetMessage.SendData(65, -1, -1, null, 0, whoAmI, newPos2.X, newPos2.Y, 2, 1);
52681 }
52682 }
52683 }
52684
52686 {
52687 int num = 0;
52688 int num2 = 0;
52689 int num3 = 0;
52690 int num4 = width;
52691 Vector2 vector = new Vector2(num2, num3) * 16f + new Vector2(-num4 / 2 + 8, -height);
52692 while (!canSpawn && num < settings.attemptsBeforeGivingUp)
52693 {
52694 num++;
52697 int num5 = 5;
52700 vector = new Vector2(num2, num3) * 16f + new Vector2(-num4 / 2 + 8, -height);
52701 if (Collision.SolidCollision(vector, num4, height))
52702 {
52703 continue;
52704 }
52705 if (Main.tile[num2, num3] == null)
52706 {
52707 Main.tile[num2, num3] = new Tile();
52708 }
52709 if ((settings.avoidWalls && Main.tile[num2, num3].wall > 0) || (Main.tile[num2, num3].wall == 87 && (double)num3 > Main.worldSurface && !NPC.downedPlantBoss) || (Main.wallDungeon[Main.tile[num2, num3].wall] && (double)num3 > Main.worldSurface && !NPC.downedBoss3))
52710 {
52711 continue;
52712 }
52713 int num6 = 0;
52714 while (num6 < settings.maximumFallDistanceFromOrignalPoint)
52715 {
52716 if (Main.tile[num2, num3 + num6] == null)
52717 {
52718 Main.tile[num2, num3 + num6] = new Tile();
52719 }
52720 Tile tile = Main.tile[num2, num3 + num6];
52721 vector = new Vector2(num2, num3 + num6) * 16f + new Vector2(-num4 / 2 + 8, -height);
52722 Collision.SlopeCollision(vector, velocity, num4, height, gravDir);
52723 if (!Collision.SolidCollision(vector, num4, height))
52724 {
52725 num6++;
52726 continue;
52727 }
52728 if (tile.active() && !tile.inActive() && Main.tileSolid[tile.type])
52729 {
52730 break;
52731 }
52732 num6++;
52733 }
52734 vector.Y -= 16f;
52735 int i = (int)vector.X / 16;
52736 int j = (int)vector.Y / 16;
52737 int num7 = (int)(vector.X + (float)num4 * 0.5f) / 16;
52738 int j2 = (int)(vector.Y + (float)height) / 16;
52741 if (settings.avoidAnyLiquid && tileSafely2.liquid > 0)
52742 {
52743 continue;
52744 }
52745 if (settings.mostlySolidFloor)
52746 {
52749 if (!tileSafely3.active() || tileSafely3.inActive() || !Main.tileSolid[tileSafely3.type] || Main.tileSolidTop[tileSafely3.type] || !tileSafely4.active() || tileSafely4.inActive() || !Main.tileSolid[tileSafely4.type] || Main.tileSolidTop[tileSafely4.type])
52750 {
52751 continue;
52752 }
52753 }
52754 if ((settings.avoidWalls && tileSafely.wall > 0) || (settings.avoidAnyLiquid && Collision.WetCollision(vector, num4, height)) || (settings.avoidLava && Collision.LavaCollision(vector, num4, height)) || (settings.avoidHurtTiles && Collision.AnyHurtingTiles(vector, num4, height)) || Collision.SolidCollision(vector, num4, height) || num6 >= settings.maximumFallDistanceFromOrignalPoint - 1)
52755 {
52756 continue;
52757 }
52758 Vector2 vector2 = Vector2.UnitX * 16f;
52759 if (Collision.TileCollision(vector - vector2, vector2, width, height, fallThrough: false, fall2: false, (int)gravDir) != vector2)
52760 {
52761 continue;
52762 }
52763 vector2 = -Vector2.UnitX * 16f;
52764 if (Collision.TileCollision(vector - vector2, vector2, width, height, fallThrough: false, fall2: false, (int)gravDir) != vector2)
52765 {
52766 continue;
52767 }
52768 vector2 = Vector2.UnitY * 16f;
52769 if (!(Collision.TileCollision(vector - vector2, vector2, width, height, fallThrough: false, fall2: false, (int)gravDir) != vector2))
52770 {
52771 vector2 = -Vector2.UnitY * 16f;
52772 if (!(Collision.TileCollision(vector - vector2, vector2, width, height, fallThrough: false, fall2: false, (int)gravDir) != vector2))
52773 {
52774 canSpawn = true;
52775 num3 += num6;
52776 break;
52777 }
52778 }
52779 }
52780 return vector;
52781 }
52782
52784 {
52786 int questsDone = anglerQuestsFinished;
52787 float anglerRewardRarityMultiplier = GetAnglerRewardRarityMultiplier(questsDone);
52788 anglerRewardRarityMultiplier *= (float)(currentShoppingSettings.PriceAdjustment + 1.0) / 2f;
52794 }
52795
52797 {
52798 float num = 1f;
52799 num = ((questsDone <= 50) ? (num - (float)questsDone * 0.01f) : ((questsDone <= 100) ? (0.5f - (float)(questsDone - 50) * 0.005f) : ((questsDone > 150) ? 0.15f : (0.25f - (float)(questsDone - 100) * 0.002f))));
52800 return num * 0.9f;
52801 }
52802
52804 {
52805 Item item = new Item();
52806 item.type = 0;
52807 switch (questsDone)
52808 {
52809 case 5:
52810 item.SetDefaults(2428);
52811 break;
52812 case 10:
52813 item.SetDefaults(2367);
52814 break;
52815 case 15:
52816 item.SetDefaults(2368);
52817 break;
52818 case 20:
52819 item.SetDefaults(2369);
52820 break;
52821 case 25:
52822 item.SetDefaults(3031);
52823 break;
52824 case 30:
52825 item.SetDefaults(2294);
52826 break;
52827 default:
52828 {
52829 if (questItemType == 2451 && Main.hardMode)
52830 {
52831 item.SetDefaults((Main.rand.Next(2) == 0) ? 5303 : 5302);
52832 break;
52833 }
52834 if (questItemType == 2451 && !Main.hardMode && Main.rand.Next(2) == 0)
52835 {
52836 item.SetDefaults((Main.rand.Next(2) == 0) ? 5303 : 5302);
52837 break;
52838 }
52839 List<int> list = new List<int> { 2373, 2374, 2375, 3120, 3037, 3096, 5139 };
52840 float num = 1f;
52841 for (int i = 0; i < 3; i++)
52842 {
52843 num *= 1f - 1f / (float)(int)(40f * rarityReduction);
52844 }
52845 for (int j = 0; j < 3; j++)
52846 {
52847 num *= 1f - 1f / (float)(int)(30f * rarityReduction);
52848 }
52849 num *= 1f - 1f / (float)(int)(25f * rarityReduction);
52850 float num2 = 1f - num;
52851 num2 *= 0.8f;
52852 if (questsDone > 75 && Main.rand.Next((int)(250f * rarityReduction)) == 0)
52853 {
52854 item.SetDefaults(2294);
52855 break;
52856 }
52857 if (Main.hardMode && questsDone > 25 && Main.rand.Next((int)(100f * rarityReduction)) == 0)
52858 {
52859 item.SetDefaults(2422);
52860 break;
52861 }
52862 if (Main.hardMode && questsDone > 10 && Main.rand.Next((int)(70f * rarityReduction)) == 0)
52863 {
52864 item.SetDefaults(2494);
52865 break;
52866 }
52867 if (questsDone > 10 && Main.rand.Next((int)(70f * rarityReduction)) == 0)
52868 {
52869 item.SetDefaults(3031);
52870 break;
52871 }
52872 if (questsDone > 10 && Main.rand.Next((int)(70f * rarityReduction)) == 0)
52873 {
52874 item.SetDefaults(3032);
52875 break;
52876 }
52877 if (Main.rand.Next((int)(80f * rarityReduction)) == 0)
52878 {
52879 item.SetDefaults(3183);
52880 break;
52881 }
52882 if (Main.rand.Next((int)(60f * rarityReduction)) == 0)
52883 {
52884 item.SetDefaults(2360);
52885 break;
52886 }
52887 if (Main.rand.Next((int)(60f * rarityReduction)) == 0)
52888 {
52889 item.SetDefaults(4067);
52890 break;
52891 }
52892 if (Main.rand.Next((int)(80f * rarityReduction)) == 0)
52893 {
52894 item.SetDefaults(2417);
52895 break;
52896 }
52897 if (Main.rand.Next((int)(80f * rarityReduction)) == 0)
52898 {
52899 item.SetDefaults(2498);
52900 break;
52901 }
52902 if (DropAnglerAccByMissing(list, num2, out var botheredRollingForADrop, out var itemIdToDrop))
52903 {
52904 item.SetDefaults(itemIdToDrop);
52905 break;
52906 }
52907 if (!botheredRollingForADrop && Main.rand.NextDouble() < (double)num2)
52908 {
52909 int defaults = Utils.SelectRandom(Main.rand, list.ToArray());
52910 item.SetDefaults(defaults);
52911 break;
52912 }
52913 switch (Main.rand.Next(3))
52914 {
52915 case 0:
52916 item.SetDefaults(2354);
52917 item.stack = Main.rand.Next(2, 6);
52918 break;
52919 case 1:
52920 item.SetDefaults(2355);
52921 item.stack = Main.rand.Next(2, 6);
52922 break;
52923 default:
52924 item.SetDefaults(2356);
52925 item.stack = Main.rand.Next(2, 6);
52926 break;
52927 }
52928 break;
52929 }
52930 }
52931 item.position = base.Center;
52932 Item item2 = GetItem(whoAmI, item, anglerRewardSettings);
52933 if (item2.stack > 0)
52934 {
52935 int number = Item.NewItem(source, (int)position.X, (int)position.Y, width, height, item2.type, item2.stack, noBroadcast: false, 0, noGrabDelay: true);
52936 if (Main.netMode == 1)
52937 {
52938 NetMessage.SendData(21, -1, -1, null, number, 1f);
52939 }
52940 }
52941 if (item.type == 2417)
52942 {
52943 Item item3 = new Item();
52944 Item item4 = new Item();
52945 item3.SetDefaults(2418);
52946 item3.position = base.Center;
52947 item2 = GetItem(whoAmI, item3, anglerRewardSettings);
52948 if (item2.stack > 0)
52949 {
52950 int number2 = Item.NewItem(source, (int)position.X, (int)position.Y, width, height, item2.type, item2.stack, noBroadcast: false, 0, noGrabDelay: true);
52951 if (Main.netMode == 1)
52952 {
52953 NetMessage.SendData(21, -1, -1, null, number2, 1f);
52954 }
52955 }
52956 item4.SetDefaults(2419);
52957 item4.position = base.Center;
52958 item2 = GetItem(whoAmI, item4, anglerRewardSettings);
52959 if (item2.stack > 0)
52960 {
52961 int number3 = Item.NewItem(source, (int)position.X, (int)position.Y, width, height, item2.type, item2.stack, noBroadcast: false, 0, noGrabDelay: true);
52962 if (Main.netMode == 1)
52963 {
52964 NetMessage.SendData(21, -1, -1, null, number3, 1f);
52965 }
52966 }
52967 }
52968 else
52969 {
52970 if (item.type != 2498)
52971 {
52972 return;
52973 }
52974 Item item5 = new Item();
52975 Item item6 = new Item();
52976 item5.SetDefaults(2499);
52977 item5.position = base.Center;
52978 item2 = GetItem(whoAmI, item5, anglerRewardSettings);
52979 if (item2.stack > 0)
52980 {
52981 int number4 = Item.NewItem(source, (int)position.X, (int)position.Y, width, height, item2.type, item2.stack, noBroadcast: false, 0, noGrabDelay: true);
52982 if (Main.netMode == 1)
52983 {
52984 NetMessage.SendData(21, -1, -1, null, number4, 1f);
52985 }
52986 }
52987 item6.SetDefaults(2500);
52988 item6.position = base.Center;
52989 item2 = GetItem(whoAmI, item6, anglerRewardSettings);
52990 if (item2.stack > 0)
52991 {
52992 int number5 = Item.NewItem(source, (int)position.X, (int)position.Y, width, height, item2.type, item2.stack, noBroadcast: false, 0, noGrabDelay: true);
52993 if (Main.netMode == 1)
52994 {
52995 NetMessage.SendData(21, -1, -1, null, number5, 1f);
52996 }
52997 }
52998 }
52999 }
53000
53002 {
53003 float value = 1f - rarityReduction;
53004 int num = 100;
53005 float num2 = MathHelper.Lerp(value, 1f, Math.Min(1f, (float)questsDone / (float)num));
53006 if (!(num2 >= 1f) && !(Main.rand.NextFloat() <= num2))
53007 {
53008 return;
53009 }
53010 Item item = new Item();
53011 item.type = 0;
53012 item.SetDefaults(Main.rand.Next(19) switch
53013 {
53014 1 => 2443,
53015 2 => 2444,
53016 3 => 2445,
53017 4 => 2497,
53018 5 => 2495,
53019 6 => 2446,
53020 7 => 2447,
53021 8 => 2448,
53022 9 => 2449,
53023 10 => 2490,
53024 11 => 2496,
53025 12 => 5235,
53026 13 => 5252,
53027 14 => 5256,
53028 15 => 5259,
53029 16 => 5263,
53030 17 => 5264,
53031 18 => 5265,
53032 _ => 2442,
53033 });
53034 item.position = base.Center;
53036 if (item2.stack > 0)
53037 {
53038 int number = Item.NewItem(source, (int)position.X, (int)position.Y, width, height, item2.type, item2.stack, noBroadcast: false, 0, noGrabDelay: true);
53039 if (Main.netMode == 1)
53040 {
53041 NetMessage.SendData(21, -1, -1, null, number, 1f);
53042 }
53043 }
53044 }
53045
53047 {
53048 if (Main.rand.Next((int)(100f * rarityReduction)) > 50)
53049 {
53050 return;
53051 }
53052 Item item = new Item();
53053 if (Main.rand.Next((int)(15f * rarityReduction)) == 0)
53054 {
53055 item.SetDefaults(2676);
53056 }
53057 else if (Main.rand.Next((int)(5f * rarityReduction)) == 0)
53058 {
53059 item.SetDefaults(2675);
53060 }
53061 else
53062 {
53063 item.SetDefaults(2674);
53064 }
53065 if (Main.rand.Next(25) <= questsDone)
53066 {
53067 item.stack++;
53068 }
53069 if (Main.rand.Next(50) <= questsDone)
53070 {
53071 item.stack++;
53072 }
53073 if (Main.rand.Next(100) <= questsDone)
53074 {
53075 item.stack++;
53076 }
53077 if (Main.rand.Next(150) <= questsDone)
53078 {
53079 item.stack++;
53080 }
53081 if (Main.rand.Next(200) <= questsDone)
53082 {
53083 item.stack++;
53084 }
53085 if (Main.rand.Next(250) <= questsDone)
53086 {
53087 item.stack++;
53088 }
53089 item.position = base.Center;
53091 if (item2.stack > 0)
53092 {
53093 int number = Item.NewItem(source, (int)position.X, (int)position.Y, width, height, item2.type, item2.stack, noBroadcast: false, 0, noGrabDelay: true);
53094 if (Main.netMode == 1)
53095 {
53096 NetMessage.SendData(21, -1, -1, null, number, 1f);
53097 }
53098 }
53099 }
53100
53102 {
53103 Item item = new Item();
53104 int num = (questsDone + 50) / 2;
53105 num = (int)((float)(num * Main.rand.Next(50, 201)) * 0.015f);
53106 num = (int)((double)num * 1.5);
53107 if (Main.hardMode)
53108 {
53109 num *= 2;
53110 }
53111 if (Main.expertMode)
53112 {
53113 num *= 2;
53114 }
53115 if (num > 100)
53116 {
53117 num /= 100;
53118 if (num > 10)
53119 {
53120 num = 10;
53121 }
53122 if (num < 1)
53123 {
53124 num = 1;
53125 }
53126 item.SetDefaults(73);
53127 item.stack = num;
53128 }
53129 else
53130 {
53131 if (num > 99)
53132 {
53133 num = 99;
53134 }
53135 if (num < 1)
53136 {
53137 num = 1;
53138 }
53139 item.SetDefaults(72);
53140 item.stack = num;
53141 }
53142 item.position = base.Center;
53143 Item item2 = GetItem(whoAmI, item, anglerRewardSettings);
53144 if (item2.stack > 0)
53145 {
53146 int number = Item.NewItem(source, (int)position.X, (int)position.Y, width, height, item2.type, item2.stack, noBroadcast: false, 0, noGrabDelay: true);
53147 if (Main.netMode == 1)
53148 {
53149 NetMessage.SendData(21, -1, -1, null, number, 1f);
53150 }
53151 }
53152 }
53153
53155 {
53157 itemIdToDrop = 0;
53159 Item[] array = inventory;
53160 for (int i = 0; i < array.Length; i++)
53161 {
53162 RemoveAnglerAccOptionsFromRewardPool(list, array[i]);
53163 }
53164 array = armor;
53165 for (int j = 0; j < array.Length; j++)
53166 {
53167 RemoveAnglerAccOptionsFromRewardPool(list, array[j]);
53168 }
53169 array = bank.item;
53170 for (int k = 0; k < array.Length; k++)
53171 {
53172 RemoveAnglerAccOptionsFromRewardPool(list, array[k]);
53173 }
53174 array = bank2.item;
53175 for (int l = 0; l < array.Length; l++)
53176 {
53177 RemoveAnglerAccOptionsFromRewardPool(list, array[l]);
53178 }
53179 array = bank3.item;
53180 for (int m = 0; m < array.Length; m++)
53181 {
53182 RemoveAnglerAccOptionsFromRewardPool(list, array[m]);
53183 }
53184 array = bank4.item;
53185 for (int n = 0; n < array.Length; n++)
53186 {
53187 RemoveAnglerAccOptionsFromRewardPool(list, array[n]);
53188 }
53189 for (int num = 0; num < Loadouts.Length; num++)
53190 {
53191 array = Loadouts[num].Armor;
53192 for (int num2 = 0; num2 < array.Length; num2++)
53193 {
53194 RemoveAnglerAccOptionsFromRewardPool(list, array[num2]);
53195 }
53196 }
53197 if (list.Count == 0)
53198 {
53199 return false;
53200 }
53201 bool flag = false;
53202 if (Main.rand.NextDouble() < (double)totalChance)
53203 {
53204 flag = true;
53205 }
53207 if (flag)
53208 {
53209 itemIdToDrop = Main.rand.NextFromList(list.ToArray());
53210 return true;
53211 }
53212 return false;
53213 }
53214
53216 {
53217 if (!itemToTestAgainst.IsAir)
53218 {
53219 switch (itemToTestAgainst.type)
53220 {
53221 default:
53223 break;
53224 case 3721:
53225 case 5064:
53229 break;
53230 case 3036:
53231 case 3123:
53232 case 3124:
53233 case 5358:
53234 case 5359:
53235 case 5360:
53236 case 5361:
53240 break;
53241 case 5140:
53242 case 5141:
53243 case 5142:
53244 case 5143:
53245 case 5144:
53246 case 5145:
53247 case 5146:
53249 break;
53250 }
53251 }
53252 }
53253
53255 {
53256 int num = -1;
53259 {
53260 3560, 3028, 3041, 3040, 3025, 3190, 3027, 3026, 3554, 3553,
53261 3555, 2872, 3534, 2871
53262 };
53263 if (Main.hardMode)
53264 {
53265 list.Add(3039);
53266 list.Add(3038);
53267 list.Add(3598);
53268 list.Add(3597);
53269 list.Add(3600);
53270 list.Add(3042);
53271 list.Add(3533);
53272 list.Add(3561);
53274 {
53275 list.Add(2883);
53276 list.Add(2869);
53277 list.Add(2873);
53278 list.Add(2870);
53279 }
53280 if (NPC.downedPlantBoss)
53281 {
53282 list.Add(2878);
53283 list.Add(2879);
53284 list.Add(2884);
53285 list.Add(2885);
53286 }
53287 if (NPC.downedMartians)
53288 {
53289 list.Add(2864);
53290 list.Add(3556);
53291 }
53292 if (NPC.downedMoonlord)
53293 {
53294 list.Add(3024);
53295 }
53296 }
53297 num = list[Main.rand.Next(list.Count)];
53298 Item item = new Item();
53299 item.SetDefaults(num);
53300 item.stack = 6;
53301 item.position = base.Center;
53303 if (item2.stack > 0)
53304 {
53305 int number = Item.NewItem(source, (int)position.X, (int)position.Y, width, height, item2.type, item2.stack, noBroadcast: false, 0, noGrabDelay: true);
53306 if (Main.netMode == 1)
53307 {
53308 NetMessage.SendData(21, -1, -1, null, number, 1f);
53309 }
53310 }
53311 }
53312
53313 public bool CheckMana(int amount, bool pay = false, bool blockQuickMana = false)
53314 {
53315 int num = (int)((float)amount * manaCost);
53316 if (statMana >= num)
53317 {
53318 if (pay)
53319 {
53320 statMana -= num;
53321 }
53322 return true;
53323 }
53324 if (manaFlower && !blockQuickMana)
53325 {
53326 QuickMana();
53327 if (statMana >= num)
53328 {
53329 if (pay)
53330 {
53331 statMana -= num;
53332 }
53333 return true;
53334 }
53335 return false;
53336 }
53337 return false;
53338 }
53339
53340 public void TryPortalJumping()
53341 {
53342 if (!mount.Active && !dead && !isLockedToATile)
53343 {
53345 }
53346 }
53347
53348 public bool ConsumeSolarFlare()
53349 {
53350 if (setSolar && solarShields > 0)
53351 {
53352 solarShields--;
53353 for (int i = 0; i < maxBuffs; i++)
53354 {
53355 if (buffType[i] >= 170 && buffType[i] <= 172)
53356 {
53357 DelBuff(i);
53358 }
53359 }
53360 if (solarShields > 0 && whoAmI == Main.myPlayer)
53361 {
53362 AddBuff(170 + solarShields - 1, 5, quiet: false);
53363 }
53364 solarCounter = 0;
53365 return true;
53366 }
53367 return false;
53368 }
53369
53370 public void KeyDoubleTap(int keyDir)
53371 {
53372 int num = 0;
53374 {
53375 num = 1;
53376 }
53377 if (keyDir != num)
53378 {
53379 return;
53380 }
53381 if (setVortex && !mount.Active)
53382 {
53383 vortexStealthActive = !vortexStealthActive;
53384 }
53385 if (setForbidden)
53386 {
53387 MinionRestTargetAim();
53388 if (!setForbiddenCooldownLocked)
53389 {
53390 CommandForbiddenStorm();
53391 }
53392 }
53393 }
53394
53396 {
53397 List<int> list = new List<int>();
53398 for (int i = 0; i < 1000; i++)
53399 {
53400 Projectile projectile = Main.projectile[i];
53401 if (projectile.active && projectile.type == 656 && projectile.owner == whoAmI)
53402 {
53403 list.Add(i);
53404 }
53405 }
53406 setForbiddenCooldownLocked = list.Count > 1;
53407 }
53408
53410 {
53411 List<int> list = new List<int>();
53412 for (int i = 0; i < 1000; i++)
53413 {
53414 Projectile projectile = Main.projectile[i];
53415 if (projectile.active && projectile.type == 656 && projectile.owner == whoAmI)
53416 {
53417 list.Add(i);
53418 }
53419 }
53420 bool flag = StrayMethods.CanSpawnSandstormFriendly(MinionRestTargetPoint, 30, 30);
53421 bool num = MinionRestTargetPoint == Vector2.Zero;
53422 Vector2 center = base.Center;
53423 Vector2 endPoint = MinionRestTargetPoint;
53424 if (num)
53425 {
53426 endPoint = center;
53427 }
53428 int samplesToTake = 10;
53429 float samplingWidth = 60f;
53431 bool flag2 = false;
53432 float[] array = samples;
53433 for (int j = 0; j < array.Length; j++)
53434 {
53435 if (Math.Abs(array[j] - vectorTowardsTarget.Length()) < 10f)
53436 {
53437 flag2 = true;
53438 break;
53439 }
53440 }
53441 float num2 = 0f;
53442 for (int k = 0; k < samples.Length; k++)
53443 {
53444 if (samples[k] > num2)
53445 {
53446 num2 = samples[k];
53447 }
53448 }
53449 if (list.Count <= 1)
53450 {
53453 if (vector2.Length() > 0f)
53454 {
53455 for (float num3 = 0f; num3 < vector2.Length(); num3 += 15f)
53456 {
53457 Vector2 vector3 = center + vector2 * (num3 / vector2.Length());
53458 Dust obj = Main.dust[Dust.NewDust(vector3, 0, 0, 269)];
53459 obj.position = vector3;
53460 obj.fadeIn = 0.5f;
53461 obj.scale = 0.7f;
53462 obj.velocity *= 0.4f;
53463 obj.noLight = true;
53464 }
53465 }
53466 for (float num4 = 0f; num4 < (float)Math.PI * 2f; num4 += (float)Math.PI / 15f)
53467 {
53468 Dust obj2 = Main.dust[Dust.NewDust(vector, 0, 0, 269)];
53469 obj2.position = vector;
53470 obj2.fadeIn = 1f;
53471 obj2.scale = 0.3f;
53472 obj2.noLight = true;
53473 }
53474 }
53475 flag &= list.Count <= 1;
53476 flag = flag && flag2;
53477 if (flag)
53478 {
53479 flag = CheckMana(20, pay: true);
53480 if (flag)
53481 {
53482 manaRegenDelay = (int)maxRegenDelay;
53483 }
53484 }
53485 if (!flag)
53486 {
53487 return;
53488 }
53489 foreach (int item in list)
53490 {
53492 if (!(projectile2.ai[0] >= 780f))
53493 {
53494 projectile2.ai[0] = 780f + projectile2.ai[0] % 60f;
53495 projectile2.netUpdate = true;
53496 }
53497 }
53498 int damage = (int)(20f * (1f + magicDamage + minionDamage - 2f));
53499 IEntitySource projectileSource_SetBonus = GetProjectileSource_SetBonus(3);
53500 _ = Main.projectile[Projectile.NewProjectile(projectileSource_SetBonus, MinionRestTargetPoint, Vector2.Zero, 656, damage, 0f, Main.myPlayer)];
53501 }
53502
53503 public void KeyHoldDown(int keyDir, int holdTime)
53504 {
53505 int num = 0;
53507 {
53508 num = 1;
53509 }
53510 if (keyDir == num)
53511 {
53512 if (setStardust && holdTime >= 60)
53513 {
53514 MinionRestTargetPoint = Vector2.Zero;
53515 }
53516 if (setForbidden && holdTime >= 60)
53517 {
53518 MinionRestTargetPoint = Vector2.Zero;
53519 }
53520 }
53521 }
53522
53524 {
53526 int num = -1;
53527 for (int i = 0; i < 200; i++)
53528 {
53529 if (Main.npc[i].CanBeChasedBy(this) && (num == -1 || Main.npc[i].Hitbox.Distance(mouseWorld) < Main.npc[num].Hitbox.Distance(mouseWorld)))
53530 {
53531 num = i;
53532 }
53533 }
53534 if (MinionAttackTargetNPC == num && !doNotDisableIfTheTargetIsTheSame)
53535 {
53536 MinionAttackTargetNPC = -1;
53537 }
53538 else
53539 {
53540 MinionAttackTargetNPC = num;
53541 }
53542 }
53543
53545 {
53547 float y = mouseWorld.Y;
53548 int num = (int)mouseWorld.X / 16;
53549 int num2 = (int)y / 16;
53550 int num3 = 0;
53551 if (Main.tile[num, num2].nactive() && Main.tileSolid[Main.tile[num, num2].type] && !Main.tileSolidTop[Main.tile[num, num2].type])
53552 {
53553 int num4 = 0;
53554 int num5 = 0;
53555 while (num5 > -20 && num2 + num5 > 1)
53556 {
53557 int num6 = num2 + num5;
53558 if (Main.tile[num, num6].nactive() && Main.tileSolid[Main.tile[num, num6].type] && !Main.tileSolidTop[Main.tile[num, num6].type])
53559 {
53560 num4 = num5;
53561 num5--;
53562 continue;
53563 }
53564 num4 = num5;
53565 break;
53566 }
53567 int num7 = 0;
53568 for (int i = 0; i < 20 && num2 + i < Main.maxTilesY; i++)
53569 {
53570 int num8 = num2 + i;
53571 if (Main.tile[num, num8].nactive() && Main.tileSolid[Main.tile[num, num8].type] && !Main.tileSolidTop[Main.tile[num, num8].type])
53572 {
53573 num7 = i;
53574 continue;
53575 }
53576 num7 = i;
53577 break;
53578 }
53579 num3 = ((num7 <= -num4) ? (num7 + 3) : (num4 - 2));
53580 }
53581 int num9 = num2 + num3;
53582 bool flag = false;
53583 for (int j = num9; j < num9 + 5; j++)
53584 {
53586 {
53587 flag = true;
53588 }
53589 }
53590 while (!flag)
53591 {
53592 num9++;
53593 for (int k = num9; k < num9 + 5; k++)
53594 {
53596 {
53597 flag = true;
53598 }
53599 }
53600 }
53601 Vector2 vector = new Vector2(num * 16 + 8, num9 * 16);
53602 if (Distance(vector) <= 1000f)
53603 {
53604 MinionRestTargetPoint = vector;
53605 }
53606 }
53607
53609 {
53610 if (whoAmI != Main.myPlayer)
53611 {
53612 return;
53613 }
53614 if (Distance(MinionRestTargetPoint) > 1000f)
53615 {
53616 MinionRestTargetPoint = Vector2.Zero;
53617 }
53618 if (MinionAttackTargetNPC != -1 && (!Main.npc[MinionAttackTargetNPC].CanBeChasedBy(this) || Main.npc[MinionAttackTargetNPC].Hitbox.Distance(base.Center) > 3000f))
53619 {
53620 MinionAttackTargetNPC = -1;
53621 }
53622 if (stardustGuardian && HasMinionRestTarget)
53623 {
53624 Vector2 minionRestTargetPoint = MinionRestTargetPoint;
53625 float num = (float)miscCounter / 150f;
53626 float num2 = (float)Math.PI * 2f / 3f;
53627 for (int i = 0; i < 3; i++)
53628 {
53629 int num3 = Dust.NewDust(minionRestTargetPoint, 0, 0, 135, 0f, 0f, 100, default(Color), 1.5f);
53630 Main.dust[num3].noGravity = true;
53631 Main.dust[num3].velocity = Vector2.Zero;
53632 Main.dust[num3].noLight = true;
53633 Main.dust[num3].position = minionRestTargetPoint + (num * ((float)Math.PI * 2f) + num2 * (float)i).ToRotationVector2() * 4f;
53634 Main.dust[num3].shader = GameShaders.Armor.GetSecondaryShader(cPet, this);
53635 }
53636 }
53637 }
53638
53639 public void NebulaLevelup(int type)
53640 {
53641 if (whoAmI != Main.myPlayer)
53642 {
53643 return;
53644 }
53645 int timeToAdd = 480;
53646 for (int i = 0; i < maxBuffs; i++)
53647 {
53648 if (buffType[i] >= type && buffType[i] < type + 3)
53649 {
53650 DelBuff(i);
53651 }
53652 }
53653 switch (type)
53654 {
53655 case 173:
53656 nebulaLevelLife = (int)MathHelper.Clamp(nebulaLevelLife + 1, 0f, 3f);
53657 AddBuff(type + nebulaLevelLife - 1, timeToAdd);
53658 break;
53659 case 176:
53660 nebulaLevelMana = (int)MathHelper.Clamp(nebulaLevelMana + 1, 0f, 3f);
53661 AddBuff(type + nebulaLevelMana - 1, timeToAdd);
53662 break;
53663 case 179:
53664 nebulaLevelDamage = (int)MathHelper.Clamp(nebulaLevelDamage + 1, 0f, 3f);
53665 AddBuff(type + nebulaLevelDamage - 1, timeToAdd);
53666 break;
53667 }
53668 }
53669
53671 {
53672 TouchedTiles.Clear();
53673 List<Point> list = null;
53674 List<Point> list2 = null;
53675 if (!Collision.IsClearSpotTest(position + velocity, 16f, width, height, fallThrough: false, fall2: false, (int)gravDir, checkCardinals: true, checkSlopes: true))
53676 {
53677 list = Collision.FindCollisionTile((Math.Sign(velocity.Y) == 1) ? 2 : 3, position + velocity, 16f, width, height, fallThrough: false, fall2: false, (int)gravDir);
53678 }
53679 if (!Collision.IsClearSpotTest(position, Math.Abs(velocity.Y), width, height, fallThrough: false, fall2: false, (int)gravDir, checkCardinals: true, checkSlopes: true))
53680 {
53681 list2 = Collision.FindCollisionTile((Math.Sign(velocity.Y) == 1) ? 2 : 3, position, Math.Abs(velocity.Y), width, height, fallThrough: false, fall2: false, (int)gravDir, checkCardinals: true, checkSlopes: true);
53682 }
53683 if (list != null && list2 != null)
53684 {
53685 for (int i = 0; i < list2.Count; i++)
53686 {
53687 if (!list.Contains(list2[i]))
53688 {
53689 list.Add(list2[i]);
53690 }
53691 }
53692 }
53693 if (list == null && list2 != null)
53694 {
53695 list = list2;
53696 }
53697 if (list != null)
53698 {
53699 TouchedTiles = list;
53700 }
53701 }
53702}
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static float Clamp(float value, float min, float max)
Definition MathHelper.cs:46
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
void ICollection< T >. Add(T item)
Definition HashSet.cs:225
virtual byte ReadByte()
static readonly char DirectorySeparatorChar
Definition Path.cs:71
static double Cos(double d)
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static double Atan2(double y, double x)
static double Sqrt(double d)
static double Pow(double x, double y)
static decimal Round(decimal d)
Definition Math.cs:1096
static double Abs(double value)
static double Sin(double a)
const double PI
Definition Math.cs:16
static int Sign(decimal value)
Definition Math.cs:1202
static byte Max(byte val1, byte val2)
Definition Math.cs:738
unsafe override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex)
static void NewTemporaryAnimation(int type, ushort tileType, int x, int y)
Definition Animation.cs:102
static SlotId PlayTrackedSound(SoundStyle style, Vector2 position)
static void PlaySound(int type, Vector2 position, int style=1)
static ActiveSound GetActiveSound(SlotId id)
static void BroadcastChatMessage(NetworkText text, Color color, int excludedPlayer=-1)
Definition ChatHelper.cs:46
static int[] dresserTypeToIcon
Definition Chest.cs:33
static int[] chestTypeToIcon2
Definition Chest.cs:27
static bool IsLocked(int x, int y)
Definition Chest.cs:235
static int[] chestTypeToIcon
Definition Chest.cs:21
Item[] item
Definition Chest.cs:41
static Item PutItemInNearbyChest(Item item, Vector2 position)
Definition Chest.cs:272
static bool Unlock(int X, int Y)
Definition Chest.cs:379
static int FindChest(int X, int Y)
Definition Chest.cs:546
static bool Lock(int X, int Y)
Definition Chest.cs:461
static bool CanHit(Entity source, Entity target)
Definition Collision.cs:344
static bool InTileBounds(int x, int y, int lx, int ly, int hx, int hy)
static bool down
Definition Collision.cs:34
static bool WetCollision(Vector2 Position, int Width, int Height)
static bool stair
Definition Collision.cs:20
static Vector2 WaterCollision(Vector2 Position, Vector2 Velocity, int Width, int Height, bool fallThrough=false, bool fall2=false, bool lavaWalk=true)
static bool DrownCollision(Vector2 Position, int Width, int Height, float gravDir=-1f, bool includeSlopes=false)
static bool CanTileHurt(ushort type, int i, int j, Player player)
static List< Point > FindCollisionTile(int Direction, Vector2 position, float testMagnitude, int Width, int Height, bool fallThrough=false, bool fall2=false, int gravDir=1, bool checkCardinals=true, bool checkSlopes=false)
static void AimingLaserScan(Vector2 startPoint, Vector2 endPoint, float samplingWidth, int samplesToTake, out Vector2 vectorTowardsTarget, out float[] samples)
static bool up
Definition Collision.cs:32
static bool honey
Definition Collision.cs:24
static bool stairFall
Definition Collision.cs:22
static bool CanHitLine(Vector2 Position1, int Width1, int Height1, Vector2 Position2, int Width2, int Height2)
Definition Collision.cs:551
static bool AnyHurtingTiles(Vector2 Position, int Width, int Height)
static Vector4 WalkDownSlope(Vector2 Position, Vector2 Velocity, int Width, int Height, float gravity=0f)
static Vector2 TileCollision(Vector2 Position, Vector2 Velocity, int Width, int Height, bool fallThrough=false, bool fall2=false, int gravDir=1)
static HurtTile HurtTiles(Vector2 Position, int Width, int Height, Player player)
static void StepDown(ref Vector2 position, ref Vector2 velocity, int width, int height, ref float stepSpeed, ref float gfxOffY, int gravDir=1, bool waterWalk=false)
static Vector4 SlopeCollision(Vector2 Position, Vector2 Velocity, int Width, int Height, float gravity=0f, bool fall=false)
static Vector2 StickyTiles(Vector2 Position, Vector2 Velocity, int Width, int Height)
static List< Point > GetTilesIn(Vector2 TopLeft, Vector2 BottomRight)
static bool shimmer
Definition Collision.cs:26
static void StepUp(ref Vector2 position, ref Vector2 velocity, int width, int height, ref float stepSpeed, ref float gfxOffY, int gravDir=1, bool holdsMatching=false, int specialChecksMode=0)
static bool LavaCollision(Vector2 Position, int Width, int Height)
static bool SolidCollision(Vector2 Position, int Width, int Height)
static bool SwitchTiles(Vector2 Position, int Width, int Height, Vector2 oldPosition, int objType)
static void StepConveyorBelt(Entity entity, float gravDir)
static bool IsClearSpotTest(Vector2 position, float testMagnitude, int Width, int Height, bool fallThrough=false, bool fall2=false, int gravDir=1, bool checkCardinals=true, bool checkSlopes=false)
static bool SolidTiles(Vector2 position, int width, int height)
static bool GetWaterLine(Point pt, out float waterLineHeight)
static readonly Color DamagedFriendly
Definition CombatText.cs:8
static readonly Color HealMana
Definition CombatText.cs:22
static readonly Color LifeRegen
Definition CombatText.cs:24
static int NewText(Rectangle location, Color color, int amount, bool dramatic=false, bool dot=false)
Definition CombatText.cs:54
static readonly Color HealLife
Definition CombatText.cs:20
static PlayerDeathReason ByOther(int type)
static PlayerDeathReason ByPlayer(int index)
static PlayerDeathReason ByNPC(int index)
static Dictionary< int, TileEntity > ByID
Definition TileEntity.cs:18
static bool SpreadLightOpen_StopForSolids(int x, int y)
static int CompareYReverse(Point a, Point b)
static bool CastLightOpen(int x, int y)
Vector2 position
Definition Dust.cs:20
static Dust CloneDust(int dustIndex)
Definition Dust.cs:233
int type
Definition Dust.cs:38
static int dustWater()
Definition Dust.cs:340
static int NewDust(Vector2 Position, int Width, int Height, int Type, float SpeedX=0f, float SpeedY=0f, int Alpha=0, Color newColor=default(Color), float Scale=1f)
Definition Dust.cs:73
static Dust NewDustPerfect(Vector2 Position, int Type, Vector2? Velocity=null, int Alpha=0, Color newColor=default(Color), float Scale=1f)
Definition Dust.cs:52
static Dust NewDustDirect(Vector2 Position, int Width, int Height, int Type, float SpeedX=0f, float SpeedY=0f, int Alpha=0, Color newColor=default(Color), float Scale=1f)
Definition Dust.cs:63
Vector2 velocity
Definition Dust.cs:22
Vector2 BottomRight
Definition Entity.cs:139
bool honeyWet
Definition Entity.cs:34
Vector2 Center
Definition Entity.cs:43
Vector2 TopLeft
Definition Entity.cs:91
Vector2 velocity
Definition Entity.cs:16
float Distance(Vector2 Other)
Definition Entity.cs:187
Rectangle Hitbox
Definition Entity.cs:164
Vector2 position
Definition Entity.cs:14
void Swap(Player player)
static Tile GetTileSafely(Vector2 position)
Definition Framing.cs:419
static void HandleSpecialEvent(Player player, int eventID)
static void NotifyItemPickup(Player player, Item item)
static void BroadcastOrRequestParticleSpawn(ParticleOrchestraType type, ParticleOrchestraSettings settings)
static void RequestParticleSpawn(bool clientOnly, ParticleOrchestraType type, ParticleOrchestraSettings settings, int? overrideInvokingPlayerIndex=null)
static bool WouldFailSpawningHere(int x, int y)
Definition DD2Event.cs:571
static bool ShouldBlockBuilding(Vector2 worldPosition)
Definition DD2Event.cs:782
static void SummonCrystal(int x, int y, int whoAsks)
Definition DD2Event.cs:540
static void RequestToSkipWaitTime(int x, int y)
Definition DD2Event.cs:1762
static void FailureMessage(int client)
Definition DD2Event.cs:583
bool TryGetPlacementOption(Player player, int randomSeed, int selectCycleOffset, out PlacementOption option, out Item itemToConsume)
static Asset< DynamicSpriteFont > MouseText
Definition FontAssets.cs:10
static bool IsPlayerHoldingClub(Player player)
static ItemTrader ChlorophyteExtractinator
Definition ItemTrader.cs:27
static void TryCreatingMessageWithCooldown(MessageSource messageSource, Vector2 position, Vector2 velocity, int cooldownTimeInTicks)
static void Create(MessageSource source, Vector2 position, Vector2 velocity)
static Color GetPortalColor(int colorIndex)
static void TryGoingThroughPortals(Entity ent)
static void UpdatePlayerPosition(Player player)
static ? Vector2 FindSpotWithoutShimmer(Entity entity, int startX, int startY, int expand, bool allowSolidTop)
static void SmartCursorLookup(Player player)
static bool RequestMagicConchTeleportPosition(Player player, int crawlOffsetX, int startX, out Point landingPoint)
static void SpawnInWorldDust(int tileStyle, Rectangle dustBox)
static Asset< Texture2D > HairStyleBack
static Asset< Texture2D >[] Item
static void OnPlayerInteraction(Player player, int clickX, int clickY)
static void OnPlayerInteraction(Player player, int clickX, int clickY)
static void OnPlayerInteraction(Player player, int clickX, int clickY)
Definition TEHatRack.cs:314
static void OnPlayerInteraction(Player player, int clickX, int clickY)
static void OnPlayerInteraction(Player player, int clickX, int clickY)
static void GetPrices(Item item, out long calcForSelling, out long calcForBuying)
static bool BuyItem(Player player, long price, int currencyIndex)
static void MakeLocalPlayerEmote(int emoteId)
static TriggersPack Triggers
static Vector2 GamepadThumbstickLeft
static SmartSelectGamepadPointer smartSelectPointer
static PlayerInputProfile CurrentProfile
static Vector2 GamepadThumbstickRight
static int NewGore(Vector2 Position, Vector2 Velocity, int Type, float Scale=1f)
Definition Gore.cs:1288
static FilterManager Scene
Definition Filters.cs:5
static OverlayManager Scene
Definition Overlays.cs:5
static HairShaderDataSet Hair
Definition GameShaders.cs:9
static ArmorShaderDataSet Armor
Definition GameShaders.cs:7
static Dictionary< int, Dictionary< int, int > > SpecificLauncherAmmoProjectileMatches
Definition AmmoID.cs:9
static int Bullet
Definition AmmoID.cs:114
static int Sand
Definition AmmoID.cs:116
static int CandyCorn
Definition AmmoID.cs:130
static int Flare
Definition AmmoID.cs:124
static int Dart
Definition AmmoID.cs:118
static int FallenStar
Definition AmmoID.cs:112
static int Gel
Definition AmmoID.cs:106
static int Arrow
Definition AmmoID.cs:108
static int Rocket
Definition AmmoID.cs:120
static int Snowball
Definition AmmoID.cs:126
static int Coin
Definition AmmoID.cs:110
static int JackOLantern
Definition AmmoID.cs:132
static int StyngerBolt
Definition AmmoID.cs:128
static int Stake
Definition AmmoID.cs:134
static int Solution
Definition AmmoID.cs:122
static int NailFriendly
Definition AmmoID.cs:136
static bool[] DrawInBackpackLayer
Definition ArmorIDs.cs:1591
static readonly int Count
Definition ArmorIDs.cs:1668
static bool[] DrawInFrontOfBackArmLayer
Definition ArmorIDs.cs:2045
static readonly int Count
Definition ArmorIDs.cs:2088
static readonly sbyte Count
Definition ArmorIDs.cs:2123
static IncludeCapeFrontAndBackInfo[] IncludeCapeFrontAndBack
Definition ArmorIDs.cs:623
static bool[] DisableHandOnAndOffAccDraw
Definition ArmorIDs.cs:647
static bool[] DisableBeltAccDraw
Definition ArmorIDs.cs:649
static int[] IncludedCapeBackFemale
Definition ArmorIDs.cs:619
static bool[] DrawInFaceFlowerLayer
Definition ArmorIDs.cs:1987
static bool[] DrawInFaceHeadLayer
Definition ArmorIDs.cs:1989
static bool[] DrawInFaceUnderHairLayer
Definition ArmorIDs.cs:1985
static readonly sbyte Count
Definition ArmorIDs.cs:2036
static readonly int Count
Definition ArmorIDs.cs:1704
static readonly int Count
Definition ArmorIDs.cs:1582
static readonly int Count
Definition ArmorIDs.cs:1536
static bool[] UseAltFaceHeadDraw
Definition ArmorIDs.cs:20
static bool[] IncompatibleWithFrogLeg
Definition ArmorIDs.cs:1043
static List< int > MannequinIncompatible
Definition ArmorIDs.cs:1041
static readonly int Count
Definition ArmorIDs.cs:1972
static readonly int Count
Definition ArmorIDs.cs:1943
static readonly int Count
Definition ArmorIDs.cs:1770
static readonly int Count
Definition ArmorIDs.cs:1818
static WingStats[] Stats
Definition ArmorIDs.cs:1825
static readonly int Count
Definition ArmorIDs.cs:1920
static bool[] IsWellFed
Definition BuffID.cs:18
static BuffMountData[] BasicMountData
Definition BuffID.cs:32
static bool[] TimeLeftDoesNotDecrease
Definition BuffID.cs:24
static bool[] IsFedState
Definition BuffID.cs:20
static readonly int Count
Definition BuffID.cs:1069
static BannerEffect[] BannerStrength
Definition ItemID.cs:1018
static bool[] IsPaintScraper
Definition ItemID.cs:229
static Color[][] DrinkParticleColors
Definition ItemID.cs:542
static FlowerPacketInfo[] flowerPacketInfo
Definition ItemID.cs:156
static bool[] HasAProjectileThatHasAUsabilityCheck
Definition ItemID.cs:148
static bool[] ColorfulDyeValues
Definition ItemID.cs:154
static bool[] Torches
Definition ItemID.cs:1110
static bool[] SkipsInitialUseSound
Definition ItemID.cs:126
static bool[] SingleUseInGamepad
Definition ItemID.cs:1108
static bool[] WaterTorches
Definition ItemID.cs:1112
static bool[] NebulaPickup
Definition ItemID.cs:1058
static int[] StaffMinionSlotsRequired
Definition ItemID.cs:1054
static bool[] IsFishingCrateHardmode
Definition ItemID.cs:1034
static Color[][] FoodParticleColors
Definition ItemID.cs:235
static bool[] WorksInVoidBag
Definition ItemID.cs:63
static bool[] SummonerWeaponThatScalesWithAttackSpeed
Definition ItemID.cs:231
static bool[] IsAPickup
Definition ItemID.cs:223
static bool[] gunProj
Definition ItemID.cs:1062
static bool[] IgnoresEncumberingStone
Definition ItemID.cs:219
static bool[] IsAKite
Definition ItemID.cs:130
static ? bool[] ForceConsumption
Definition ItemID.cs:132
static int[] SortingPriorityRopes
Definition ItemID.cs:1072
static bool[] IsFood
Definition ItemID.cs:233
static int[] ExtractinatorMode
Definition ItemID.cs:1052
static bool[] UsesBetterMeleeItemLocation
Definition ItemID.cs:61
static bool[] ItemsThatAllowRepeatedRightClick
Definition ItemID.cs:53
static bool[] IsLavaBait
Definition ItemID.cs:1026
static float[] BonusMeleeSpeedMultiplier
Definition ItemID.cs:1082
static readonly short Count
Definition ItemID.cs:12138
static short FromLegacyName(string name, int release)
Definition ItemID.cs:12856
static bool[] Cart
Definition MountID.cs:9
static bool[] CountsAsCritter
Definition NPCID.cs:4202
static bool[] CanHitPastShimmer
Definition NPCID.cs:4254
static bool[] IsTownPet
Definition NPCID.cs:4099
static bool[] ZappingJellyfish
Definition NPCID.cs:4111
static readonly short Count
Definition NPCID.cs:11744
static readonly int Inventory0
static readonly int Count
static bool[] MinionTargettingFeature
static bool[] NoMeleeSpeedVelocityScaling
static readonly short Count
static readonly LegacySoundStyle Item32
Definition SoundID.cs:478
static readonly LegacySoundStyle DSTMaleHurt
Definition SoundID.cs:986
static readonly LegacySoundStyle Item130
Definition SoundID.cs:674
static readonly LegacySoundStyle Item166
Definition SoundID.cs:746
static readonly LegacySoundStyle Item37
Definition SoundID.cs:488
static readonly LegacySoundStyle Item3
Definition SoundID.cs:420
static readonly LegacySoundStyle Item16
Definition SoundID.cs:446
static readonly LegacySoundStyle Item173
Definition SoundID.cs:760
static readonly LegacySoundStyle Item4
Definition SoundID.cs:422
static readonly LegacySoundStyle Item24
Definition SoundID.cs:462
static readonly LegacySoundStyle Item6
Definition SoundID.cs:426
static readonly LegacySoundStyle Item27
Definition SoundID.cs:468
static readonly LegacySoundStyle Item55
Definition SoundID.cs:524
static readonly LegacySoundStyle DSTFemaleHurt
Definition SoundID.cs:988
static readonly LegacySoundStyle BlizzardStrongLoop
Definition SoundID.cs:780
static readonly LegacySoundStyle Item2
Definition SoundID.cs:418
static readonly LegacySoundStyle BlizzardInsideBuildingLoop
Definition SoundID.cs:778
static readonly LegacySoundStyle Item47
Definition SoundID.cs:508
static readonly LegacySoundStyle Item13
Definition SoundID.cs:440
static readonly LegacySoundStyle Item8
Definition SoundID.cs:430
static readonly LegacySoundStyle Item26
Definition SoundID.cs:466
static readonly LegacySoundStyle Item35
Definition SoundID.cs:484
static readonly LegacySoundStyle Item11
Definition SoundID.cs:436
static readonly LegacySoundStyle Item168
Definition SoundID.cs:750
static readonly LegacySoundStyle Item60
Definition SoundID.cs:534
static readonly LegacySoundStyle Item149
Definition SoundID.cs:712
static readonly LegacySoundStyle Item177
Definition SoundID.cs:768
static bool[] TouchDamageDestroyTile
Definition TileID.cs:279
static bool[] TouchDamageBleeding
Definition TileID.cs:285
static bool[] IceSkateSlippery
Definition TileID.cs:83
static bool[] CountsAsGemTree
Definition TileID.cs:89
static bool[] CanBeDugByShovel
Definition TileID.cs:107
static bool[] BreakableWhenPlacing
Definition TileID.cs:277
static bool[] IsBeam
Definition TileID.cs:161
static bool[] TouchDamageHot
Definition TileID.cs:283
static bool[] DoesntPlaceWithTileReplacement
Definition TileID.cs:155
static bool[] tileMossBrick
Definition TileID.cs:219
static bool[] CrackedBricks
Definition TileID.cs:113
static bool[] Falling
Definition TileID.cs:289
static bool[] BasicDresser
Definition TileID.cs:227
static bool[] IsAContainer
Definition TileID.cs:297
static bool[] NotReallySolid
Definition TileID.cs:257
static bool[] BasicChest
Definition TileID.cs:223
static int[] TouchDamageImmediate
Definition TileID.cs:287
static bool[] Platforms
Definition TileID.cs:163
static bool[] Suffocate
Definition TileID.cs:281
static bool[] IsATreeTrunk
Definition TileID.cs:91
static bool[] IgnoresTileReplacementDropCheckWhenBeingPlaced
Definition TileID.cs:139
static bool[] DoesntGetReplacedWithTileReplacement
Definition TileID.cs:157
static readonly ushort Count
Definition TileID.cs:1698
static readonly short Count
Definition TorchID.cs:132
static int[] Dust
Definition TorchID.cs:75
static void TorchColor(int torchID, out float R, out float G, out float B)
Definition TorchID.cs:164
static FileMetadata Read(BinaryReader reader, FileType expectedType)
static FileMetadata FromCurrentSettings(FileType type)
void SetPlayTime(TimeSpan time)
static int buyPrice(int platinum=0, int gold=0, int silver=0, int copper=0)
Definition Item.cs:47979
Item Clone()
Definition Item.cs:49916
bool useTurn
Definition Item.cs:181
int useAnimation
Definition Item.cs:145
int fishingPole
Definition Item.cs:97
static int coinGrabRange
Definition Item.cs:101
int tileWand
Definition Item.cs:89
static int manaGrabRange
Definition Item.cs:103
int stack
Definition Item.cs:149
int useAmmo
Definition Item.cs:243
int healMana
Definition Item.cs:173
int shoot
Definition Item.cs:235
int maxStack
Definition Item.cs:151
static int BannerToItem(int banner)
Definition Item.cs:1246
int headSlot
Definition Item.cs:195
bool Prefix(int prefixWeWant)
Definition Item.cs:487
int hammer
Definition Item.cs:157
static int mushroomDelay
Definition Item.cs:65
int createWall
Definition Item.cs:163
static bool[] staff
Definition Item.cs:75
int createTile
Definition Item.cs:161
static int lifeGrabRange
Definition Item.cs:105
bool IsAir
Definition Item.cs:377
static int potionDelay
Definition Item.cs:61
FlexibleTileWand GetFlexibleTileWand()
Definition Item.cs:48626
bool consumable
Definition Item.cs:177
int buffType
Definition Item.cs:271
static bool[] claw
Definition Item.cs:77
static int restorationDelay
Definition Item.cs:63
bool IsACoin
Definition Item.cs:364
bool favorited
Definition Item.cs:135
static int NPCtoBanner(int i)
Definition Item.cs:1296
int tileBoost
Definition Item.cs:159
void ChangeItemType(int to)
Definition Item.cs:46627
sbyte shieldSlot
Definition Item.cs:215
int netID
Definition Item.cs:291
int placeStyle
Definition Item.cs:165
sbyte wingSlot
Definition Item.cs:213
int legSlot
Definition Item.cs:199
bool expertOnly
Definition Item.cs:111
void TurnToAir(bool fullReset=false)
Definition Item.cs:49954
static Rectangle GetDrawHitbox(int type, Player user)
Definition Item.cs:49662
void SetDefaults(int Type=0)
Definition Item.cs:47332
int mountType
Definition Item.cs:275
int bodySlot
Definition Item.cs:197
static int NewItem(IEntitySource source, Vector2 pos, Vector2 randomBox, int Type, int Stack=1, bool noBroadcast=false, int prefixGiven=0, bool noGrabDelay=false, bool reverseLookup=false)
Definition Item.cs:49697
int bait
Definition Item.cs:99
byte prefix
Definition Item.cs:295
LegacySoundStyle UseSound
Definition Item.cs:191
bool potion
Definition Item.cs:175
void FixAgainstExploit()
Definition Item.cs:48328
bool newAndShiny
Definition Item.cs:309
static int treasureGrabRange
Definition Item.cs:107
byte dye
Definition Item.cs:95
static LocalizedText[] dresserType
Definition Lang.cs:40
static LocalizedText[] chestType2
Definition Lang.cs:43
static LocalizedText[] chestType
Definition Lang.cs:37
static LocalizedText[] misc
Definition Lang.cs:25
static Color GetColor(Point tileCoords)
Definition Lighting.cs:182
static void Clear()
Definition Lighting.cs:177
static int OffScreenTiles
Definition Lighting.cs:17
static void AddLight(Vector2 position, Vector3 rgb)
Definition Lighting.cs:137
static void AddWater(int x, int y)
Definition Liquid.cs:1160
static GameCulture FromCultureName(CultureName name)
static string GetTextValue(string key)
Definition Language.cs:15
static NetworkText FromLiteral(string text)
static bool HadAnActiveInteractibleProjectile
Definition Main.cs:95
static bool IsItAHappyWindyDay
Definition Main.cs:2869
static int musicBox2
Definition Main.cs:572
static SceneMetrics SceneMetrics
Definition Main.cs:1344
static readonly int maxMusic
Definition Main.cs:447
static int WaveQuality
Definition Main.cs:425
static float mapFullscreenScale
Definition Main.cs:936
static bool ingameOptionsWindow
Definition Main.cs:704
static float cameraX
Definition Main.cs:1202
static void OpenClothesWindow()
Definition Main.cs:41135
static bool[] vanityPet
Definition Main.cs:778
static bool[] tileDungeon
Definition Main.cs:1465
static float windSpeedCurrent
Definition Main.cs:1360
static bool raining
Definition Main.cs:1310
static double time
Definition Main.cs:1284
static float bottomWorld
Definition Main.cs:1112
static int maxTilesY
Definition Main.cs:1116
static float shimmerDarken
Definition Main.cs:1010
static bool GamepadDisableCursorItemIcon
Definition Main.cs:2669
static bool UseHeatDistortion
Definition Main.cs:429
static bool drawingPlayerChat
Definition Main.cs:1739
static int SmartInteractProj
Definition Main.cs:2165
static MoonPhase GetMoonPhase()
Definition Main.cs:3058
static AchievementManager Achievements
Definition Main.cs:2756
static GolfState LocalGolfState
Definition Main.cs:1876
static float cloudAlpha
Definition Main.cs:1302
static UIBestiaryTest BestiaryUI
Definition Main.cs:1870
static int spawnTileY
Definition Main.cs:1811
static void NotifyOfEvent(GameNotificationType type)
Definition Main.cs:15651
static bool blockInput
Definition Main.cs:1819
static ShopHelper ShopHelper
Definition Main.cs:1874
static float GraveyardVisualIntensity
Definition Main.cs:1393
static bool[] tileSolidTop
Definition Main.cs:1469
static float cloudBGAlpha
Definition Main.cs:626
static Chest[] chest
Definition Main.cs:1699
static bool npcChatRelease
Definition Main.cs:1813
static Microsoft.Xna.Framework.Color hcColor
Definition Main.cs:994
static bool cSmartCursorModeIsToggleAndNotHold
Definition Main.cs:2143
static bool[] tileCut
Definition Main.cs:1433
static string ValueToCoins(long value)
Definition Main.cs:52286
static bool[] projPet
Definition Main.cs:1328
static bool SmartCursorWanted_GamePad
Definition Main.cs:2147
static UserInterface InGameUI
Definition Main.cs:383
static bool SmartInteractShowingGenuine
Definition Main.cs:2155
static Item[] item
Definition Main.cs:1681
static bool[] tileTable
Definition Main.cs:1459
static bool[] pvpBuff
Definition Main.cs:774
static bool[] meleeBuff
Definition Main.cs:782
static double worldSurface
Definition Main.cs:1272
static string playerPathName
Definition Main.cs:2835
static ItemShopSellbackHelper shopSellbackHelper
Definition Main.cs:1841
static bool[] tileContainer
Definition Main.cs:1503
static int myPlayer
Definition Main.cs:1801
static int DiscoR
Definition Main.cs:1062
static Vector2 ReverseGravitySupport(Vector2 pos, float height=0f)
Definition Main.cs:3005
static int netMode
Definition Main.cs:2095
static bool editSign
Definition Main.cs:1815
static Microsoft.Xna.Framework.Color tileColor
Definition Main.cs:1270
static bool inFancyUI
Definition Main.cs:706
static double rockLayer
Definition Main.cs:1274
static Vector2[] OffsetsPlayerHeadgear
Definition Main.cs:520
static bool[] wallDungeon
Definition Main.cs:1443
static Gore[] gore
Definition Main.cs:1687
static int focusRecipe
Definition Main.cs:1799
static bool SmartInteractShowingFake
Definition Main.cs:2157
static bool[] wallHouse
Definition Main.cs:1441
static bool expertMode
Definition Main.cs:2737
static bool SettingsEnabled_AutoReuseAllItems
Definition Main.cs:247
static CreativeUI CreativeMenu
Definition Main.cs:369
static bool hasFocus
Definition Main.cs:1781
static bool masterMode
Definition Main.cs:2717
static bool mouseRight
Definition Main.cs:616
static bool dayTime
Definition Main.cs:1282
static DrawAnimation[] itemAnimations
Definition Main.cs:1707
static List< Microsoft.Xna.Framework.Point > SmartInteractTileCoordsSelected
Definition Main.cs:2171
static bool dedServ
Definition Main.cs:1226
static int recStart
Definition Main.cs:1789
static bool[] tileMoss
Definition Main.cs:1485
static bool[] tileSign
Definition Main.cs:1505
static int wofNPCIndex
Definition Main.cs:828
static int[] projFrames
Definition Main.cs:1326
static void GetAreaToLight(out int firstTileX, out int lastTileX, out int firstTileY, out int lastTileY)
Definition Main.cs:60773
static bool IsItDay()
Definition Main.cs:59621
static bool bloodMoon
Definition Main.cs:1296
static bool mouseLeftRelease
Definition Main.cs:1755
static Microsoft.Xna.Framework.Color mcColor
Definition Main.cs:992
static float WindForVisuals
Definition Main.cs:2827
static Main instance
Definition Main.cs:283
static bool SmartCursorWanted_Mouse
Definition Main.cs:2145
static Vector2 MouseWorld
Definition Main.cs:2776
static void startSnowMoon()
Definition Main.cs:10159
static bool UseStormEffects
Definition Main.cs:427
static bool[] tileHammer
Definition Main.cs:1453
static void Sundialing()
Definition Main.cs:5730
static int DamageVar(float dmg, float luck=0f)
Definition Main.cs:62870
static int screenHeight
Definition Main.cs:1721
static Vector2 screenPosition
Definition Main.cs:1715
static int moonPhase
Definition Main.cs:1288
static int SmartInteractNPC
Definition Main.cs:2163
static Vector2 MouseScreen
Definition Main.cs:2773
static void StartInvasion(int type=1)
Definition Main.cs:61241
static string worldName
Definition Main.cs:1260
static bool HasInteractibleObjectThatIsNotATile
Definition Main.cs:1998
static Item mouseItem
Definition Main.cs:1773
static int mapStyle
Definition Main.cs:908
static void NewText(string newText, byte R=byte.MaxValue, byte G=byte.MaxValue, byte B=byte.MaxValue)
Definition Main.cs:61429
static int maxTilesX
Definition Main.cs:1114
static SpriteViewMatrix GameViewMatrix
Definition Main.cs:227
static int DiscoG
Definition Main.cs:1066
static Vector2[] OffsetsPlayerOnhand
Definition Main.cs:496
static bool[] tileRope
Definition Main.cs:1481
static Player clientPlayer
Definition Main.cs:2085
static bool[] tileBouncy
Definition Main.cs:1473
static int LogicCheckScreenWidth
Definition Main.cs:1896
static bool[] tileAlch
Definition Main.cs:1435
static bool getGoodWorld
Definition Main.cs:341
static int numAvailableRecipes
Definition Main.cs:1797
static float topWorld
Definition Main.cs:1110
static bool clothesWindow
Definition Main.cs:702
static bool[] tileSolid
Definition Main.cs:1471
static bool InReforgeMenu
Definition Main.cs:1908
static float shimmerBrightenDelay
Definition Main.cs:1012
static Tile[,] tile
Definition Main.cs:1675
static BestiaryUnlocksTracker BestiaryTracker
Definition Main.cs:1868
static int spawnTileX
Definition Main.cs:1809
static void ToggleGameplayUpdates(bool state)
Definition Main.cs:2959
static bool editChest
Definition Main.cs:1817
static WorldMap Map
Definition Main.cs:1673
static PlayerFileData ActivePlayerFileData
Definition Main.cs:1940
static bool[] lightPet
Definition Main.cs:780
static int moondialCooldown
Definition Main.cs:2287
static bool fastForwardTimeToDawn
Definition Main.cs:2281
static bool mouseRightRelease
Definition Main.cs:1757
static bool eclipse
Definition Main.cs:1312
static Projectile[] projectile
Definition Main.cs:1691
static bool[] buffNoSave
Definition Main.cs:786
static GameModeData GameModeInfo
Definition Main.cs:2682
static int npcShop
Definition Main.cs:2833
static KeyboardState keyState
Definition Main.cs:988
static int invasionType
Definition Main.cs:1970
static Item reforgeItem
Definition Main.cs:1777
static bool CanStartInvasion(int type=1, bool ignoreDelay=false)
Definition Main.cs:61220
static int DiscoB
Definition Main.cs:1064
static bool InGuideCraftMenu
Definition Main.cs:1906
static bool ignoreErrors
Definition Main.cs:742
static int LogicCheckScreenHeight
Definition Main.cs:1898
static void Moondialing()
Definition Main.cs:5745
static UnifiedRandom rand
Definition Main.cs:1387
static int worldID
Definition Main.cs:1262
static float rightWorld
Definition Main.cs:1108
static NPC[] npc
Definition Main.cs:1685
static string PlayerPath
Definition Main.cs:1952
static Vector3 rgbToHsl(Microsoft.Xna.Framework.Color newColor)
Definition Main.cs:44972
static bool recBigList
Definition Main.cs:1787
static bool dontStarveWorld
Definition Main.cs:345
static void SetCameraLerp(float lerp, int time)
Definition Main.cs:2991
static void ReleaseHostAndPlayProcess()
Definition Main.cs:45213
static float maxRaining
Definition Main.cs:1304
static bool mapEnabled
Definition Main.cs:906
static bool tenthAnniversaryWorld
Definition Main.cs:343
static int sundialCooldown
Definition Main.cs:2283
static int SmartInteractY
Definition Main.cs:2161
static bool playerInventory
Definition Main.cs:1759
static int dayRate
Definition Main.cs:746
static bool SmartCursorIsUsed
Definition Main.cs:2855
static int screenWidth
Definition Main.cs:1719
static int UnderworldLayer
Definition Main.cs:2825
static double CalculateDamagePlayersTake(int Damage, int Defense)
Definition Main.cs:62915
static bool HoveringOverAnNPC
Definition Main.cs:2447
static double CalculateDamagePlayersTakeInPVP(int Damage, int Defense)
Definition Main.cs:62905
static void ItemIconCacheUpdate(int selectedItemID)
Definition Main.cs:43506
static int SmartInteractX
Definition Main.cs:2159
static void ClearSmartInteract()
Definition Main.cs:45082
static Microsoft.Xna.Framework.Color hslToRgb(Vector3 hslVector)
Definition Main.cs:44913
static bool snowMoon
Definition Main.cs:1300
static bool pumpkinMoon
Definition Main.cs:1298
static void startPumpkinMoon()
Definition Main.cs:10133
static float leftWorld
Definition Main.cs:1106
static int mouseY
Definition Main.cs:606
static void InputTextChest()
Definition Main.cs:18412
static int mapTime
Definition Main.cs:884
static bool[] tileFrameImportant
Definition Main.cs:1495
static bool ReversedUpDownArmorSetBonuses
Definition Main.cs:259
static bool gameMenu
Definition Main.cs:1926
static bool[] tileNoFail
Definition Main.cs:1489
static bool SmartCursorShowing
Definition Main.cs:2149
static float shimmerAlpha
Definition Main.cs:1008
static bool[] tileNoAttach
Definition Main.cs:1487
static bool mapFullscreen
Definition Main.cs:932
static bool[] persistentBuff
Definition Main.cs:776
static bool ServerSideCharacter
Definition Main.cs:397
static bool hardMode
Definition Main.cs:1022
static void PlayInteractiveProjectileOpenCloseSound(int projType, bool open)
Definition Main.cs:34550
static bool gamePaused
Definition Main.cs:1072
static Item guideItem
Definition Main.cs:1775
static Sign[] sign
Definition Main.cs:1701
static BigProgressBarSystem BigBossProgressBar
Definition Main.cs:379
static bool specialSeedWorld
Definition Main.cs:2705
static Player[] player
Definition Main.cs:1803
static void CancelClothesWindow(bool quiet=false)
Definition Main.cs:41163
static bool[] projHook
Definition Main.cs:772
static bool runningCollectorsEdition
Definition Main.cs:578
static int mouseX
Definition Main.cs:604
static float GlobalTimeWrappedHourly
Definition Main.cs:405
static bool fastForwardTimeToDusk
Definition Main.cs:2285
static bool[] debuff
Definition Main.cs:784
static bool remixWorld
Definition Main.cs:349
static Dust[] dust
Definition Main.cs:1677
static bool[] tileAxe
Definition Main.cs:1451
static bool mouseLeft
Definition Main.cs:614
static int curMusic
Definition Main.cs:1230
static Dictionary< int, GameModeData > RegisteredGameModes
Definition Main.cs:315
static bool hairWindow
Definition Main.cs:700
static void TeleportEffect(Microsoft.Xna.Framework.Rectangle effectRect, int Style, int extraInfo=0, float dustCountMult=1f, TeleportationSide side=TeleportationSide.Entry, Vector2 otherPosition=default(Vector2))
Definition Main.cs:12270
static void InputTextSign()
Definition Main.cs:18393
static bool FrameTrack(int i, int j, bool pound, bool mute=false)
Definition Minecart.cs:934
static BitsByte TrackCollision(Player Player, ref Vector2 Position, ref Vector2 Velocity, ref Vector2 lastBoost, int Width, int Height, bool followDown, bool followUp, int fallStart, bool trackOnly, Mount.MountDelegatesData delegatesData)
Definition Minecart.cs:550
static bool GetOnTrack(int tileX, int tileY, ref Vector2 Position, int Width, int Height)
Definition Minecart.cs:1191
static bool OnTrack(Vector2 Position, int Width, int Height)
Definition Minecart.cs:1236
static void WheelSparks(Action< Vector2 > DustAction, Vector2 Position, int Width, int Height, int sparkCount)
Definition Minecart.cs:1615
static float TrackRotation(Player player, ref float rotation, Vector2 Position, int Width, int Height, bool followDown, bool followUp, Mount.MountDelegatesData delegatesData)
Definition Minecart.cs:1248
static void HitTrackSwitch(Vector2 Position, int Width, int Height)
Definition Minecart.cs:1273
OverridePositionMethod MouthPosition
Definition Mount.cs:93
OverridePositionMethod HandPosition
Definition Mount.cs:95
bool IsConsideredASlimeMount
Definition Mount.cs:471
int PlayerXOFfset
Definition Mount.cs:359
void Dismount(Player mountedPlayer)
Definition Mount.cs:5229
MountDelegatesData Delegations
Definition Mount.cs:507
bool CanMount(int m, Player mountingPlayer)
Definition Mount.cs:5452
bool Active
Definition Mount.cs:345
void SetMount(int m, Player mountedPlayer, bool faceLeft=false)
Definition Mount.cs:5258
static int GetHeightBoost(int MountType)
Definition Mount.cs:2312
int PlayerOffsetHitbox
Definition Mount.cs:378
int PlayerHeadOffset
Definition Mount.cs:390
float RunSpeed
Definition Mount.cs:404
int HeightBoost
Definition Mount.cs:401
int PlayerOffset
Definition Mount.cs:362
float DashSpeed
Definition Mount.cs:441
static int ladyBugBadLuckTime
Definition NPC.cs:628
int checkArmorPenetration(int armorPenetration, float armorPenetrationPercent)
Definition NPC.cs:77993
static int TypeToDefaultHeadIndex(int type)
Definition NPC.cs:1651
static void ResetNetOffsets()
Definition NPC.cs:87083
bool HittableForOnHitRewards()
Definition NPC.cs:86861
static bool boughtCat
Definition NPC.cs:301
static void CatchNPC(int i, int who=-1)
Definition NPC.cs:72128
static int FindFirstNPC(int Type)
Definition NPC.cs:86701
static bool downedMechBossAny
Definition NPC.cs:421
int BannerID()
Definition NPC.cs:1786
static bool boughtDog
Definition NPC.cs:303
static int GetNPCInvasionGroup(int npcID)
Definition NPC.cs:70596
static int sWidth
Definition NPC.cs:177
static void SpawnFaelings(int plr)
Definition NPC.cs:77231
static bool taxCollector
Definition NPC.cs:111
static bool combatBookWasUsed
Definition NPC.cs:339
static int ReleaseNPC(int x, int y, int Type, int Style, int who)
Definition NPC.cs:72344
static bool downedMoonlord
Definition NPC.cs:383
double StrikeNPC(int Damage, float knockBack, int hitDirection, bool crit=false, bool noEffect=false, bool fromNet=false)
Definition NPC.cs:78024
static bool freeCake
Definition NPC.cs:119
static bool BigMimicSummonCheck(int x, int y, Player user)
Definition NPC.cs:69701
static bool AnyDanger(bool quickBossNPCCheck=false, bool ignorePillarsAndMoonlordCountdown=false)
Definition NPC.cs:77014
bool CanBeChasedBy(object attacker=null, bool ignoreDontTakeDamage=false)
Definition NPC.cs:86852
static bool AnyNPCs(int Type)
Definition NPC.cs:86689
int type
Definition NPC.cs:445
static bool CanReleaseNPCs(int who)
Definition NPC.cs:72308
static bool IsADeerclopsNearScreen()
Definition NPC.cs:37649
static int NewNPC(IEntitySource source, int X, int Y, int Type, int Start=0, float ai0=0f, float ai1=0f, float ai2=0f, float ai3=0f, int Target=255)
Definition NPC.cs:77654
static void SpawnOnPlayer(int plr, int Type)
Definition NPC.cs:77311
static bool peddlersSatchelWasUsed
Definition NPC.cs:343
static bool SpawnMechQueen(int onWhichPlayer)
Definition NPC.cs:13579
static void LadyBugKilled(Vector2 Position, bool GoldLadyBug=false)
Definition NPC.cs:78297
static bool AnyoneNearCultists()
Definition NPC.cs:77061
int netID
Definition NPC.cs:531
static bool combatBookVolumeTwoWasUsed
Definition NPC.cs:341
static bool downedGolemBoss
Definition NPC.cs:365
static bool downedMartians
Definition NPC.cs:367
static bool boughtBunny
Definition NPC.cs:305
static void GetMeleeCollisionData(Rectangle victimHitbox, int enemyIndex, ref int specialHitSetter, ref float damageMultiplier, ref Rectangle npcRect)
Definition NPC.cs:91619
static bool downedBoss3
Definition NPC.cs:349
static void UnlockOrExchangePet(ref bool petBoughtFlag, int npcType, string textKeyForLicense, int netMessageData)
Definition NPC.cs:77747
static bool[] npcsFoundForCheckActive
Definition NPC.cs:429
static bool downedPlantBoss
Definition NPC.cs:363
static int ladyBugGoodLuckTime
Definition NPC.cs:626
static int brainOfGravity
Definition NPC.cs:583
static void SendData(int msgType, int remoteClient=-1, int ignoreClient=-1, NetworkText text=null, int number=0, float number2=0f, float number3=0f, float number4=0f, int number5=0, int number6=0, int number7=0)
Definition NetMessage.cs:88
static void SendPlayerHurt(int playerTargetIndex, PlayerDeathReason reason, int damage, int direction, bool critical, bool pvp, int hitContext, int remoteClient=-1, int ignoreClient=-1)
static bool TrySendData(int msgType, int remoteClient=-1, int ignoreClient=-1, NetworkText text=null, int number=0, float number2=0f, float number3=0f, float number4=0f, int number5=0, int number6=0, int number7=0)
Definition NetMessage.cs:75
static void SendTileSquare(int whoAmi, int tileX, int tileY, int xSize, int ySize, TileChangeType changeType=TileChangeType.None)
static void SendTemporaryAnimation(int whoAmi, int animationType, int tileType, int xCoord, int yCoord)
static void SendPlayerDeath(int playerTargetIndex, PlayerDeathReason reason, int damage, int direction, bool pvp, int remoteClient=-1, int ignoreClient=-1)
static void SendObjectPlacement(int whoAmi, int x, int y, int type, int style, int alternative, int random, int direction)
static void sendWater(int x, int y)
static void AddCurrentServerToRecentList()
Definition Netplay.cs:369
static bool CheckLiquidPlacement(int type, int style, Tile checkTile)
static bool CustomPlace(int type, int style)
static bool CallPostPlacementPlayerHook(int tileX, int tileY, int type, int style, int dir, int alternate, TileObject data)
static readonly int Count
Definition Player.cs:69
static void PlayerDisconnect(int playerIndex)
Definition Player.cs:308
static void PlayerConnect(int playerIndex)
Definition Player.cs:303
static void EnterWorld(int playerIndex)
Definition Player.cs:313
static Action< Player > OnEnterWorld
Definition Player.cs:301
void Bind(int itemslot, int radialslot)
Definition Player.cs:507
void ChangeBinding(int itemSlot)
Definition Player.cs:472
int GetDrawMode(int itemslot)
Definition Player.cs:525
SelectionRadial(SelectionMode mode=SelectionMode.Dpad4)
Definition Player.cs:390
void CopyTo(SelectionRadial that)
Definition Player.cs:541
static void CycleHoverControl()
Definition Player.cs:345
static HoverControlMode HoverControl
Definition Player.cs:343
static bool SmartCursorHoldCanReleaseMidUse
Definition Player.cs:332
int restorationDelayTime
Definition Player.cs:2445
static readonly MemoryStream _visualCloneStream
Definition Player.cs:2746
float moveSpeed
Definition Player.cs:2047
bool equippedAnyWallSpeedAcc
Definition Player.cs:2587
void TryRecalculatingTorchLuck()
Definition Player.cs:17412
void ItemCheck_EmitDrinkParticles(Item sItem)
Definition Player.cs:41543
bool IsTileTypeInInteractionRange(int targetTileType, TileReachCheckSettings settings)
Definition Player.cs:33928
bool poundRelease
Definition Player.cs:1185
void UpdateItemDye(bool isNotInVanitySlot, bool isSetToHidden, Item armorItem, Item dyeItem)
Definition Player.cs:9125
Vector2 bodyVelocity
Definition Player.cs:1287
void PlaceThing_Tiles_PlaceIt_SpinSmartPlatform()
Definition Player.cs:38345
int nebulaLevelLife
Definition Player.cs:703
void UpdateImmunity()
Definition Player.cs:18395
bool[] buffImmune
Definition Player.cs:1197
Player SerializedClone()
Definition Player.cs:51577
bool PlaceThing_Tiles_BlockPlacementForAssortedThings(bool canPlace)
Definition Player.cs:38758
bool controlRight
Definition Player.cs:1383
void OpenLockBox(int lockboxItemType)
Definition Player.cs:8583
void UpdateHairDyeDust()
Definition Player.cs:23274
Rectangle hairFrame
Definition Player.cs:1377
Vector2 headVelocity
Definition Player.cs:1285
string cursorItemIconText
Definition Player.cs:1497
DoorOpeningHelper doorHelper
Definition Player.cs:2471
int _quickGrappleCooldown
Definition Player.cs:2657
float _deerclopsBlizzardSmoothedEffect
Definition Player.cs:2605
bool onHitRegen
Definition Player.cs:933
void RotateRelativePoint(ref float x, ref float y)
Definition Player.cs:3602
float firstFractalAfterImageOpacity
Definition Player.cs:1253
void RemoveSpawn()
Definition Player.cs:51114
float CalculateCoinLuck()
Definition Player.cs:17799
void ItemCheck_ApplyManaRegenDelay(Item sItem)
Definition Player.cs:47674
bool ItemCheck_CheckUsabilityOfProjectiles(bool canUse)
Definition Player.cs:49008
bool accTackleBox
Definition Player.cs:961
void SetTalkNPC(int npcIndex, bool fromNet=false)
Definition Player.cs:3725
bool petFlagDynamiteKitten
Definition Player.cs:1767
const int shadowMax
Definition Player.cs:1503
void CheckDrowning()
Definition Player.cs:22224
static float solidLightDecay
Definition Player.cs:2603
bool eyebrellaCloud
Definition Player.cs:1633
void StopPettingAnimal()
Definition Player.cs:31211
float maxFallSpeed
Definition Player.cs:2095
bool hasLuck_LuckyHorseshoe
Definition Player.cs:2227
static void FixLoadedData_EliminiateDuplicateAccessories(Item[] armorArray)
Definition Player.cs:52211
bool petFlagDD2Dragon
Definition Player.cs:1747
void WingAirLogicTweaks()
Definition Player.cs:27575
void OpenShadowLockbox(int boxType)
Definition Player.cs:8555
void MagicConch()
Definition Player.cs:52512
void ApplyItemTime(Item sItem)
Definition Player.cs:3752
bool SellItem(Item item, int stack=-1)
Definition Player.cs:33352
sbyte balloonFront
Definition Player.cs:1363
bool ItemFitsItemFrame(Item i)
Definition Player.cs:50640
IEntitySource GetProjectileSource_OnHit(Entity victim, int projectileSourceId)
Definition Player.cs:9302
void PlaceThing_Walls_FillEmptySpace()
Definition Player.cs:37443
void Shellphone_Spawn()
Definition Player.cs:52577
bool releaseMapFullscreen
Definition Player.cs:1475
void ResetEffects()
Definition Player.cs:17886
bool moonLordLegs
Definition Player.cs:1713
bool controlDownHold
Definition Player.cs:1449
static PlayerFileData LoadPlayer(string playerPath, bool cloudSave)
Definition Player.cs:51515
bool socialShadowRocketBoots
Definition Player.cs:1229
bool hasMagiluminescence
Definition Player.cs:1627
bool releaseQuickMana
Definition Player.cs:1423
bool isPerformingJump_Sandstorm
Definition Player.cs:2239
void GrantPrefixBenefits(Item item)
Definition Player.cs:13274
DateTime lastDeathTime
Definition Player.cs:641
void ApplyAttackCooldown(int frames)
Definition Player.cs:42233
string name
Definition Player.cs:621
bool armorEffectDrawOutlinesForbidden
Definition Player.cs:1225
bool IsVoidVaultEnabled
Definition Player.cs:3376
void MinionNPCTargetAim(bool doNotDisableIfTheTargetIsTheSame)
Definition Player.cs:53523
bool accDivingHelm
Definition Player.cs:2221
Rectangle ItemCheck_EmitUseVisuals(Item sItem, Rectangle itemRectangle)
Definition Player.cs:42565
void HandleHotbar()
Definition Player.cs:29483
int lastPortalColorIndex
Definition Player.cs:2549
float lifeRegenTime
Definition Player.cs:1571
static void Deserialize(PlayerFileData data, Player newPlayer, BinaryReader fileIO, int release, out bool gotToReadName)
Definition Player.cs:51587
void Update_NPCCollision()
Definition Player.cs:29078
OverheadMessage chatOverhead
Definition Player.cs:581
void PayDD2CrystalsBeforeUse(Item item)
Definition Player.cs:40433
void ItemCheck_UseMinecartPowerUp(Item sItem)
Definition Player.cs:43039
bool setApprenticeT3
Definition Player.cs:2395
float NormalizedLuck
Definition Player.cs:3530
void UseShovel(Player user, Item item, int sX, int sY)
Definition Player.cs:43348
void RefreshInfoAccsFromItemType(int accType)
Definition Player.cs:12115
bool HasNPCBannerBuff(int bannerType)
Definition Player.cs:42017
bool canJumpAgain_Sandstorm
Definition Player.cs:2237
bool hasJumpOption_Sandstorm
Definition Player.cs:2235
Color hairColor
Definition Player.cs:2133
bool runningOnSand
Definition Player.cs:887
int itemAnimationMax
Definition Player.cs:2567
static float GetClosestRollLuck(int x, int y, int range)
Definition Player.cs:17881
static bool WouldSpotOverlapWithSentry(int worldX, int worldY, bool lightningAura)
Definition Player.cs:49520
void TakeDamageFromJellyfish(int npcIndex)
Definition Player.cs:42068
float stepSpeed
Definition Player.cs:1303
SelectionRadial DpadRadial
Definition Player.cs:583
bool parryDamageBuff
Definition Player.cs:2011
bool magicLantern
Definition Player.cs:1693
float arrowDamageAdditiveStack
Definition Player.cs:2031
bool cursorItemIconReversed
Definition Player.cs:1491
bool electrified
Definition Player.cs:911
bool loveStruck
Definition Player.cs:905
void OpenOyster(int sourceItemType)
Definition Player.cs:8710
bool ShouldNotDraw
Definition Player.cs:3464
void checkDPSTime()
Definition Player.cs:50718
void UpdateMinionTarget()
Definition Player.cs:53608
int FindItem(int netid)
Definition Player.cs:52383
static void Spawn_ForceClearArea(int floorX, int floorY)
Definition Player.cs:35958
bool hasMoltenQuiver
Definition Player.cs:1605
bool GetItem_FillIntoOccupiedSlot_VoidBag(int plr, Item[] inv, Item newItem, GetItemSettings settings, Item returnItem, int i)
Definition Player.cs:37243
const int InitialAccSlotCount
Definition Player.cs:1153
const int miscSlotCart
Definition Player.cs:1159
float whipRangeMultiplier
Definition Player.cs:901
int HeightMapOffset
Definition Player.cs:2815
bool IsStandingStillForSpecialEffects
Definition Player.cs:2841
void HandleBeingInChestRange()
Definition Player.cs:28762
void ToggleCreativeMenu()
Definition Player.cs:4153
bool bloodMoonMonolithShader
Definition Player.cs:1657
const int SHIELD_PARRY_DURATION
Definition Player.cs:2665
void TentacleSpike_TrySpiking(NPC npc, Item sItem, float damage, float knockBack)
Definition Player.cs:41977
void ItemCheck_ManageRightClickFeatures_ShieldRaise(bool theGeneralCheck)
Definition Player.cs:29422
void TrySyncingInput()
Definition Player.cs:5802
Color GetDeathAlpha(Color newColor)
Definition Player.cs:50683
static int manaSickTime
Definition Player.cs:749
PlayerSleepingHelper sleeping
Definition Player.cs:2465
void ItemCheck_GetMeleeHitbox(Item sItem, Rectangle heldItemFrame, out bool dontAttack, out Rectangle itemRectangle)
Definition Player.cs:42887
bool cursorItemIconEnabled
Definition Player.cs:1489
List< int > _projectilesToInteractWith
Definition Player.cs:2695
float rangedDamage
Definition Player.cs:2027
void UpdateManaRegen()
Definition Player.cs:18904
void ItemCheck_UseWiringTools(Item sItem)
Definition Player.cs:44535
BitsByte ownedLargeGems
Definition Player.cs:829
bool isPerformingPogostickTricks
Definition Player.cs:2283
int[] doubleTapCardinalTimer
Definition Player.cs:1081
void GetPreferredGolfBallToUse(out int projType)
Definition Player.cs:46878
bool petFlagFairyQueenPet
Definition Player.cs:1803
static void PlaceThing_Tiles_BlockPlacementIfOverPlayers(ref bool canPlace, ref TileObject data)
Definition Player.cs:39122
void DropItems()
Definition Player.cs:50809
bool[] GetTileCutIgnorance(bool allowRegrowth, bool fromTrap)
Definition Player.cs:42438
object Clone()
Definition Player.cs:50880
int _timeSinceLastImmuneGet
Definition Player.cs:1115
void AddBuff_RemoveOldPetBuffsOfMatchingType(int type)
Definition Player.cs:4528
bool PlaceThing_Tiles_PlaceIt_StaffOfRegrowthCheck(bool placed)
Definition Player.cs:38626
int cursorItemIconID
Definition Player.cs:1493
bool abigailMinion
Definition Player.cs:1017
bool _wasInShimmerZone
Definition Player.cs:1059
void UpdateJumpHeight()
Definition Player.cs:18993
static float itemGrabSpeedMax
Definition Player.cs:2123
bool accCritterGuide
Definition Player.cs:2181
bool cactusThorns
Definition Player.cs:2369
int[] unlitTorchY
Definition Player.cs:2637
void ItemCheck_HandleMount()
Definition Player.cs:49459
bool dangerSense
Definition Player.cs:893
bool ItemAnimationJustStarted
Definition Player.cs:3527
bool petFlagChesterPet
Definition Player.cs:1827
bool remoteVisionForDrone
Definition Player.cs:1981
static int FlexibleWandCycleOffset
Definition Player.cs:2703
void UpdateVisibleAccessory(int itemSlot, Item item)
Definition Player.cs:35057
bool tankPetReset
Definition Player.cs:665
bool CanBeTalkedTo
Definition Player.cs:3364
void TryCancelChannel(Projectile projectile)
Definition Player.cs:49512
void ShadowDodge()
Definition Player.cs:36019
bool petFlagDukeFishronPet
Definition Player.cs:1797
byte accCritterGuideCounter
Definition Player.cs:2183
bool HasItem(int type, Item[] collection)
Definition Player.cs:52317
bool palladiumRegen
Definition Player.cs:929
bool canJumpAgain_Fart
Definition Player.cs:2249
void OpenHerbBag(int bagType)
Definition Player.cs:8616
bool ConsumeSolarFlare()
Definition Player.cs:53348
bool coolWhipBuff
Definition Player.cs:1717
bool babyFaceMonster
Definition Player.cs:1841
void PlaceThing_Tiles_PlaceIt_ConsumeFlexibleWandMaterial()
Definition Player.cs:37915
float bowEffectiveDamage
Definition Player.cs:3457
bool HasMinionAttackTargetNPC
Definition Player.cs:3523
int manaRegenBonus
Definition Player.cs:803
IEntitySource GetItemSource_TileInteraction(int tileCoordsX, int tileCoordsY)
Definition Player.cs:9327
RabbitOrderFrameHelper rabbitOrderFrame
Definition Player.cs:1527
Vector2? PotionOfReturnHomePosition
Definition Player.cs:2065
bool CanItemSlotAccept(Item theSlot, Item theItemToAccept)
Definition Player.cs:37025
static bool lastPound
Definition Player.cs:2707
bool canJumpAgain_Sail
Definition Player.cs:2255
bool solarDashing
Definition Player.cs:697
bool CanSnapToPosition(Vector2 offset)
Definition Player.cs:31160
bool PortalPhysicsEnabled
Definition Player.cs:3494
void UpdateProjectileCaches(int i)
Definition Player.cs:11625
bool petFlagLilHarpy
Definition Player.cs:1755
void ItemCheck_UseLifeFruit(Item sItem)
Definition Player.cs:43115
void ScrollHotbar(int Offset)
Definition Player.cs:29621
bool downedDD2EventAnyDifficulty
Definition Player.cs:1549
bool tryKeepingHoveringDown
Definition Player.cs:1457
bool empressBrooch
Definition Player.cs:1621
void RefreshInfoAccsFromTeamPlayers()
Definition Player.cs:12040
bool frogLegJumpBoost
Definition Player.cs:2297
TrackedProjectileReference voidLensChest
Definition Player.cs:2431
static readonly int maxBuffs
Definition Player.cs:1191
bool accFishFinder
Definition Player.cs:2161
string[] spN
Definition Player.cs:2071
DateTime dpsStart
Definition Player.cs:2199
static int[] _torchAttackPosX
Definition Player.cs:2639
bool petFlagPumpkingPet
Definition Player.cs:1805
float _stormShaderObstruction
Definition Player.cs:2595
Collision.HurtTile GetHurtTile()
Definition Player.cs:27277
void SetItemAnimation(int frames)
Definition Player.cs:3769
bool CanVoidVaultAccept(Item item)
Definition Player.cs:37229
int highestStormTigerGemOriginalDamage
Definition Player.cs:1009
bool ItemIsVisuallyIncompatible(Item item)
Definition Player.cs:35023
void ItemCheck_TurretAltFeatureUse(Item sItem, bool cShoot)
Definition Player.cs:46920
bool crimsonRegen
Definition Player.cs:873
int GetRespawnTime(bool pvp)
Definition Player.cs:36868
bool PickAmmo_TryFindingSpecificMatches(int launcher, int ammo, out int pickedProjectileId)
Definition Player.cs:49968
float[] speedSlice
Definition Player.cs:1089
void BuffHandle_SpawnPetIfNeededAndSetTime(int buffIndex, ref bool petBool, int petProjID, int buffTimeToGive=18000)
Definition Player.cs:11668
float wallSpeed
Definition Player.cs:2051
void RemoveAllFishingBobbers()
Definition Player.cs:31304
SelectionRadial QuicksRadial
Definition Player.cs:587
void ItemCheck()
Definition Player.cs:40653
int FindItemInInventoryOrOpenVoidBag(int type, out bool inVoidBag)
Definition Player.cs:52431
void UpdateGraveyard(bool now=false)
Definition Player.cs:15998
float pickSpeed
Definition Player.cs:2049
Item QuickGrapple_GetItemToUse()
Definition Player.cs:5447
void ApplyArmorSoundAndDustChanges()
Definition Player.cs:36101
float bodyRotation
Definition Player.cs:1275
Vector2 ApplyRangeCompensation(float rangeCompensation, Vector2 startPos, Vector2 targetPos)
Definition Player.cs:40641
bool unlockedBiomeTorches
Definition Player.cs:1663
void SolarDashStart(int dashDirection)
Definition Player.cs:20729
bool PlaceThing_Tiles_CheckWandUsability(bool canUse)
Definition Player.cs:39227
bool hasJumpOption_Santank
Definition Player.cs:2265
bool socialIgnoreLight
Definition Player.cs:1237
HitTile hitTile
Definition Player.cs:1323
int _lastAddedAvancedShadow
Definition Player.cs:1537
HashSet< Point > _blackListedTileCoordsForGrappling
Definition Player.cs:2579
void ApplyPotionDelay(Item sItem)
Definition Player.cs:48616
float itemRotation
Definition Player.cs:1177
void MatchItemTimeToItemAnimation()
Definition Player.cs:3805
Rectangle GetItemDrawFrame(int type)
Definition Player.cs:40605
bool FindSharpTearsOpening(int x, int y, bool acceptLeft, bool acceptRight, bool acceptUp, bool acceptDown)
Definition Player.cs:46791
int _framesLeftEligibleForDeadmansChestDeathAchievement
Definition Player.cs:1045
bool empressBlade
Definition Player.cs:1013
bool CanGoIntoAmmoOnPickup(Item theSlot, Item theItemToAccept)
Definition Player.cs:37038
bool onFrostBurn2
Definition Player.cs:1897
bool ShouldDrawFootball()
Definition Player.cs:33968
int[] meleeNPCHitCooldown
Definition Player.cs:2713
void GamepadEnableGrappleCooldown()
Definition Player.cs:23162
void PetAnimal(int animalNpcIndex)
Definition Player.cs:31086
int luckyTorchCounter
Definition Player.cs:2617
bool accOreFinder
Definition Player.cs:2179
void GetMinecartDamage(float currentSpeed, out int damage, out float knockback)
Definition Player.cs:27513
static float GetClosestRollLuck(Vector2 position, int range)
Definition Player.cs:17876
bool twinsMinion
Definition Player.cs:981
float beetleCounter
Definition Player.cs:677
byte spelunkerTimer
Definition Player.cs:595
BitsByte zone5
Definition Player.cs:1057
bool[] oldAdjTile
Definition Player.cs:2117
bool cratePotion
Definition Player.cs:953
bool hellfireTreads
Definition Player.cs:1711
PlayerSittingHelper sitting
Definition Player.cs:2463
bool petFlagKingSlimePet
Definition Player.cs:1775
bool forceWerewolf
Definition Player.cs:1947
bool DeadlySphereMinion
Definition Player.cs:993
static List< Projectile > _oldestProjCheckList
Definition Player.cs:2719
int itemFlameCount
Definition Player.cs:767
void TryInteractingWithMinecartTrackInNearbyArea(int selectedTargetX, int selectedTargetY)
Definition Player.cs:29733
int nebulaLevelDamage
Definition Player.cs:709
float opacityForAnimation
Definition Player.cs:1501
bool GetItem_FillEmptyInventorySlot(int plr, Item newItem, GetItemSettings settings, Item returnItem, int i)
Definition Player.cs:37353
static int[] _torchAttackPosY
Definition Player.cs:2641
int nebulaManaCounter
Definition Player.cs:707
bool petFlagBabyRedPanda
Definition Player.cs:1763
void TryDroppingSingleItem(IEntitySource source, Item theItem)
Definition Player.cs:50859
void EmitMaxManaEffect()
Definition Player.cs:46937
Vector2? PotionOfReturnOriginalUsePosition
Definition Player.cs:2063
float _shaderObstructionInternalValue
Definition Player.cs:2597
static float jumpSpeed
Definition Player.cs:2091
Item brainOfConfusionItem
Definition Player.cs:917
Color underShirtColor
Definition Player.cs:2141
void CancelAllJumpVisualEffects()
Definition Player.cs:34862
Item GetItem(int plr, Item newItem, GetItemSettings settings)
Definition Player.cs:37130
bool mapAlphaDown
Definition Player.cs:1469
void PutItemInInventoryFromItemUsage(int type, int theSelectedItem=-1)
Definition Player.cs:40188
bool ItemTimeIsZero
Definition Player.cs:3525
bool IsStackingItems()
Definition Player.cs:22004
string displayedFishingInfo
Definition Player.cs:2209
bool[] ItemCheck_GetTileCutIgnoreList(Item sItem)
Definition Player.cs:42427
bool mouseInterface
Definition Player.cs:1137
void QuickBuff()
Definition Player.cs:4802
bool ZoneUndergroundDesert
Definition Player.cs:3085
void CapAttackSpeeds()
Definition Player.cs:27340
Vector2? TryFindingShimmerFreeSpot()
Definition Player.cs:27214
void SpawnFastRunParticles()
Definition Player.cs:19636
void SetMeleeHitCooldown(int npcIndex, int timeInFrames)
Definition Player.cs:42049
bool canJumpAgain_Basilisk
Definition Player.cs:2279
bool ZoneWaterCandle
Definition Player.cs:2989
bool beetleOffense
Definition Player.cs:683
void SetCompositeArmBack(bool enabled, CompositeArmStretchAmount stretch, float rotation)
Definition Player.cs:3716
int FindItem(List< int > netids)
Definition Player.cs:52395
void CloneLoadouts(Player clonePlayer)
Definition Player.cs:51019
bool HasItemInAnyInventory(int type)
Definition Player.cs:52342
void SaveTemporaryItemSlotContents(BinaryWriter writer)
Definition Player.cs:51402
float flameRingRot
Definition Player.cs:725
bool drippingSparkleSlime
Definition Player.cs:1917
Vector2 bodyPosition
Definition Player.cs:1281
bool releaseUseTile
Definition Player.cs:1415
int numberOfDeathsPVE
Definition Player.cs:629
int[] unlitTorchX
Definition Player.cs:2635
bool happyFunTorchTime
Definition Player.cs:2625
Item QuickMana_GetItemToUse()
Definition Player.cs:4756
bool onHitTitaniumStorm
Definition Player.cs:937
void RelightTorches()
Definition Player.cs:17478
void PlaceThing_Tiles_PlaceIt_SpinBedsAndBaths()
Definition Player.cs:38564
void ItemCheck_CheckFishingBobber_PullBobber(Projectile bobber, int baitTypeUsed)
Definition Player.cs:49054
void CollectTaxes()
Definition Player.cs:23134
void ManaEffect(int manaAmount)
Definition Player.cs:3837
void KeyHoldDown(int keyDir, int holdTime)
Definition Player.cs:53503
IEntitySource GetNPCSource_TileInteraction(int tileCoordsX, int tileCoordsY)
Definition Player.cs:9332
bool petFlagGlitteryButterfly
Definition Player.cs:1759
int ArmorSetDye()
Definition Player.cs:9255
void PlaceThing_XMasTreeTops()
Definition Player.cs:39361
Vector2 lastBoost
Definition Player.cs:1733
bool isPerformingJump_Blizzard
Definition Player.cs:2245
int brainOfConfusionDodgeAnimationCounter
Definition Player.cs:919
bool petFlagMoonLordPet
Definition Player.cs:1801
bool petFlagDeerclopsPet
Definition Player.cs:1823
Vector2 GetHairDrawOffset(int hairID, bool hatHair)
Definition Player.cs:3855
Point _mainMouseCoordsSmartSelect
Definition Player.cs:2689
CompositeArmStretchAmount
Definition Player.cs:192
int wireOperationsCooldown
Definition Player.cs:2425
void PullItem_ToVoidVault(Item itemToPickUp)
Definition Player.cs:33173
int GetWeaponDamage(Item sItem)
Definition Player.cs:49909
bool hasFloatingTube
Definition Player.cs:2295
bool armorEffectDrawShadowEOCShield
Definition Player.cs:1227
void GetAnglerReward_Decoration(IEntitySource source, int questsDone, float rarityReduction, ref GetItemSettings anglerRewardSettings)
Definition Player.cs:53001
bool ashWoodBonus
Definition Player.cs:1235
bool setForbiddenCooldownLocked
Definition Player.cs:2389
BitsByte zone1
Definition Player.cs:1049
bool hasJumpOption_Fart
Definition Player.cs:2247
Color shirtColor
Definition Player.cs:2139
static readonly float PhilosopherStoneDurationMultiplier
Definition Player.cs:1995
DateTime dpsEnd
Definition Player.cs:2201
bool skyStoneEffects
Definition Player.cs:2299
void HealEffect(int healAmount, bool broadcast=true)
Definition Player.cs:3828
float meleeSpeed
Definition Player.cs:2043
bool detectCreature
Definition Player.cs:2357
float bulletDamage
Definition Player.cs:2035
float accRunSpeed
Definition Player.cs:821
void ApplyEquipFunctional(int itemSlot, Item currentItem)
Definition Player.cs:13611
static int musicNotes
Definition Player.cs:2715
bool _batbatCanHeal
Definition Player.cs:2449
void GetHairSettings(out bool fullHair, out bool hatHair, out bool hideHair, out bool backHairDraw, out bool drawsBackHairWithoutHeadgear)
Definition Player.cs:16638
bool petFlagQueenSlimePet
Definition Player.cs:1817
Vector2 GetHelmetOffsetAddonFromFaceHead(Vector2 headOffset)
Definition Player.cs:3946
void HorsemansBlade_SpawnPumpkin(int npcIndex, int dmg, float kb)
Definition Player.cs:40167
void addDPS(int dmg)
Definition Player.cs:50700
int AddBuff_DetermineBuffTimeToAdd(int type, int time1)
Definition Player.cs:4580
bool isPerformingJump_Basilisk
Definition Player.cs:2281
EntityShadowInfo GetAdvancedShadow(int shadowIndex)
Definition Player.cs:3678
bool ZoneDirtLayerHeight
Definition Player.cs:3121
bool HasItemInInventoryOrOpenVoidBag(int type)
Definition Player.cs:52329
static float itemGrabSpeed
Definition Player.cs:2121
bool vortexMonolithShader
Definition Player.cs:1651
void ItemCheck_UseTorchGodsFavor(Item sItem)
Definition Player.cs:43063
bool[] npcTypeNoAggro
Definition Player.cs:2547
void ApplyReuseDelay()
Definition Player.cs:49379
byte accThirdEyeNumber
Definition Player.cs:2175
void RocketBootVisuals()
Definition Player.cs:27605
void PlaceThing(ref ItemCheckContext context)
Definition Player.cs:37387
void UpdateMeleeHitCooldowns()
Definition Player.cs:42033
bool[] adjTile
Definition Player.cs:2115
void GetItemExpectedPrice(Item item, out long calcForSelling, out long calcForBuying)
Definition Player.cs:33543
bool usedGummyWorm
Definition Player.cs:653
static int GetMouseScrollDelta()
Definition Player.cs:27473
void WallslideMovement()
Definition Player.cs:20779
bool petFlagBabyImp
Definition Player.cs:1761
bool SlimeDontHyperJump
Definition Player.cs:3547
void PurgeDD2EnergyCrystals()
Definition Player.cs:29204
void UpdateMaxTurrets()
Definition Player.cs:49594
bool creativeGodMode
Definition Player.cs:1529
bool trapDebuffSource
Definition Player.cs:2003
void FindSentryRestingSpot(int checkProj, out int worldX, out int worldY, out int pushYUp)
Definition Player.cs:49548
float legRotation
Definition Player.cs:1277
void UpdateBootVisualEffects(Item item)
Definition Player.cs:34913
bool petFlagBabyWerewolf
Definition Player.cs:1769
void UpdateAbigailStatus()
Definition Player.cs:11701
bool ActuationRodLockSetting
Definition Player.cs:2195
int fartKartCloudDelay
Definition Player.cs:1295
void SmartInteractLookup()
Definition Player.cs:17002
void ClearGrapplingBlacklist()
Definition Player.cs:5137
float HeightOffsetVisual
Definition Player.cs:2755
void BuffHandle_SpawnPetIfNeeded(ref bool petBool, int petProjID, int buffIndex)
Definition Player.cs:11674
bool CheckMana(int amount, bool pay=false, bool blockQuickMana=false)
Definition Player.cs:53313
bool petFlagEyeOfCthulhuPet
Definition Player.cs:1777
void Heal(int amount)
Definition Player.cs:33301
bool stardustMonolithShader
Definition Player.cs:1647
bool ConsumeItem(int type, bool reverseOrder=false, bool includeVoidBag=false)
Definition Player.cs:8514
static int FlexibleWandRandomSeed
Definition Player.cs:2701
float tileSpeed
Definition Player.cs:2053
bool hasUnicornHorn
Definition Player.cs:1639
bool PlaceThing_ValidWallForReplacement()
Definition Player.cs:37628
static int crystalLeafKB
Definition Player.cs:635
bool companionCube
Definition Player.cs:1839
float runAcceleration
Definition Player.cs:2099
bool isNearNPC(int type, float range=-1f)
Definition Player.cs:50332
byte iceBarrierFrameCounter
Definition Player.cs:923
void TryToShimmerUnstuck()
Definition Player.cs:27169
bool usedArcaneCrystal
Definition Player.cs:649
void GrappleMovement()
Definition Player.cs:21565
void PlaceThing_LockChest()
Definition Player.cs:39254
float gunEffectiveDamage
Definition Player.cs:3459
Vector2 legVelocity
Definition Player.cs:1289
bool CanHitNPCWithMeleeHit(int npcIndex)
Definition Player.cs:42044
Player clientClone()
Definition Player.cs:50934
bool TryingToHoverDown
Definition Player.cs:3412
void LoadTemporaryItemSlotContents(BinaryReader reader)
Definition Player.cs:51430
bool stardustGuardian
Definition Player.cs:997
bool CanPullItem(Item item, ItemSpaceStatus status)
Definition Player.cs:36949
bool suspiciouslookingTentacle
Definition Player.cs:1671
void GetAnglerReward_Bait(IEntitySource source, int questsDone, float rarityReduction, ref GetItemSettings anglerRewardSettings)
Definition Player.cs:53046
void ApplyAttackCooldown()
Definition Player.cs:42228
void LookForTileInteractions()
Definition Player.cs:29681
BitsByte hideMisc
Definition Player.cs:1369
void EndOngoingTorchGodEvent()
Definition Player.cs:17399
bool releaseRight
Definition Player.cs:1429
byte oldLuckPotion
Definition Player.cs:897
bool hasLuckyCoin
Definition Player.cs:2215
Color ChatColor()
Definition Player.cs:32958
bool ShoppingZone_BelowSurface
Definition Player.cs:3312
void UnityTeleport(Vector2 telePos)
Definition Player.cs:40420
bool autoActuator
Definition Player.cs:2057
float luckMaximumCap
Definition Player.cs:2649
int GetDesiredStormTigerMinionRank()
Definition Player.cs:11762
void RefreshItems(Item[] array, bool onlyIfVariantChanged)
Definition Player.cs:33535
Vector2[] solarShieldVel
Definition Player.cs:695
int CountItem(int type, int stopCountingAt=0)
Definition Player.cs:8497
static int SetMatch(SetMatchRequest request, ref bool somethingSpecial)
Definition Player.cs:35344
static void PlaceThing_Tiles_BlockPlacementForRepeatedPumpkins(ref bool canPlace, ref TileObject data)
Definition Player.cs:39076
bool isPerformingJump_Santank
Definition Player.cs:2269
void SetImmuneTimeForAllTypes(int time)
Definition Player.cs:36009
IEntitySource GetProjectileSource_SetBonus(int projectileSourceId)
Definition Player.cs:9297
void ApplyTouchDamage(int tileId, int x, int y)
Definition Player.cs:27299
void StatusToNPC(int type, int i)
Definition Player.cs:5468
void UpdateVisibleAccessories()
Definition Player.cs:34962
bool CanNPCBeHitByPlayerOrPlayerProjectile(NPC npc, Projectile projectile=null)
Definition Player.cs:19902
IEntitySource GetItemSource_Death()
Definition Player.cs:9282
void PlaceThing_Tiles_PlaceIt_KillGrassForSolids()
Definition Player.cs:38248
void ForceForwardCursor(bool state)
Definition Player.cs:29569
void Spawn_SetPosition(int floorX, int floorY)
Definition Player.cs:36003
void TryReplantingTree()
Definition Player.cs:43592
Rectangle headFrame
Definition Player.cs:1371
bool controlThrow
Definition Player.cs:1395
Color hairDyeColor
Definition Player.cs:2127
void UpdateTorchLuck_ConsumeCountersAndCalculate()
Definition Player.cs:17600
void UpdatePettingAnimal()
Definition Player.cs:31217
int GetRequiredDD2CrystalsToUse(Item item)
Definition Player.cs:40452
bool vortexStealthActive
Definition Player.cs:2411
bool turtleThorns
Definition Player.cs:2367
bool nebulaMonolithShader
Definition Player.cs:1649
void ToggleLight()
Definition Player.cs:16979
void StatusToPlayerPvP(int type, int i)
Definition Player.cs:5575
bool solarMonolithShader
Definition Player.cs:1653
EquipmentLoadout[] Loadouts
Definition Player.cs:2721
void PutHallowedArmorSetBonusOnCooldown()
Definition Player.cs:36037
Point _tileTargetSmartSelect
Definition Player.cs:2691
const int respawnTimerMax
Definition Player.cs:1311
static float Fishing_GetPowerMultiplier()
Definition Player.cs:40274
bool CheckDD2CrystalPaymentLock(Item item)
Definition Player.cs:40442
void MowTheLawn()
Definition Player.cs:19732
int environmentBuffImmunityTimer
Definition Player.cs:1043
Vector2 lastDeathPostion
Definition Player.cs:639
bool ZoneSkyHeight
Definition Player.cs:3097
Vector2 GetFrontHandPosition(CompositeArmStretchAmount stretch, float rotation)
Definition Player.cs:47682
void RefreshItems(bool onlyIfVariantChanged=true)
Definition Player.cs:33517
void ApplyPaint(int x, int y, bool paintingAWall, bool applyItemAnimation, Item targetItem)
Definition Player.cs:39646
void GrabItems(int i)
Definition Player.cs:33106
void ResetVisibleAccessories()
Definition Player.cs:28887
int MinionAttackTargetNPC
Definition Player.cs:2561
void GetDyeTraderReward(NPC dyeTrader)
Definition Player.cs:53254
TileObject PlaceThing_Tiles_PlaceIt(bool newObjectType, TileObject data, int tileToCreate)
Definition Player.cs:37855
bool beetleBuff
Definition Player.cs:685
bool petFlagGlommerPet
Definition Player.cs:1821
const int miscSlotPet
Definition Player.cs:1155
int graveImmediateTime
Definition Player.cs:2599
const int SafeItemAnimationTimeForPreventingExploits
Definition Player.cs:2577
List< int > GetListOfProjectilesToInteractWithHack()
Definition Player.cs:29669
void SetItemTime(int frames)
Definition Player.cs:3746
string setBonus
Definition Player.cs:1255
bool HasEnoughPickPowerToHurtTile(int x, int y)
Definition Player.cs:50351
Vector2 MountedCenter
Definition Player.cs:2853
float MountFishronSpecialCounter
Definition Player.cs:2557
void PlayDroppedItemAnimation(int time)
Definition Player.cs:4393
float carpetFrameCounter
Definition Player.cs:857
void TryToPoop()
Definition Player.cs:18435
bool canJumpAgain_Blizzard
Definition Player.cs:2243
BitsByte zone4
Definition Player.cs:1055
bool anglerSetSpawnReduction
Definition Player.cs:2373
int FindBuffIndex(int type)
Definition Player.cs:4425
IEntitySource GetItemSource_OpenItem(int itemType)
Definition Player.cs:9277
double headFrameCounter
Definition Player.cs:1093
bool isFullbright
Definition Player.cs:1247
int teleportStyle
Definition Player.cs:779
void TryOpeningInGameOptionsBasedOnInput()
Definition Player.cs:16903
int infernoCounter
Definition Player.cs:865
void HorizontalMovement()
Definition Player.cs:19152
bool HasItem(int type)
Definition Player.cs:52305
void TryPainting(int x, int y, bool paintingAWall=false, bool applyItemAnimation=true)
Definition Player.cs:39598
bool slowOgreSpit
Definition Player.cs:2009
void ItemCheckWrapped(int i)
Definition Player.cs:29512
int snowBallLauncherInteractionCooldown
Definition Player.cs:847
const int SupportedSlotSets
Definition Player.cs:1151
void ApplyLifeAndOrMana(Item item)
Definition Player.cs:48647
bool accStopwatch
Definition Player.cs:2177
bool IsWithinSnappngRangeToTile(int x, int y, int distanceInPixels)
Definition Player.cs:16993
void TryToResetHungerToNeutral()
Definition Player.cs:11523
void InterruptItemUsageIfOverTile(int tileTypeToBeOver)
Definition Player.cs:3846
bool isDisplayDollOrInanimate
Definition Player.cs:1245
bool PlaceThing_Tiles_CheckFlexibleWand(bool canUse)
Definition Player.cs:39220
Color GetHairColor(bool useLighting=true)
Definition Player.cs:52299
bool releaseMapStyle
Definition Player.cs:1477
Item[] miscEquips
Definition Player.cs:1171
void ItemCheck_UseTeleportRod(Item sItem)
Definition Player.cs:43286
float rangedMultDamage
Definition Player.cs:2029
Item lastVisualizedSelectedItem
Definition Player.cs:1261
void WingMovement()
Definition Player.cs:21052
int _lockTileInteractionsTimer
Definition Player.cs:2697
bool CanSeeShimmerEffects()
Definition Player.cs:16046
void UpdatePetLight(int i)
Definition Player.cs:16939
int GetItemGrabRange(Item item)
Definition Player.cs:33314
void PlaceThing_Tiles_PlaceIt_SpinChairs()
Definition Player.cs:38572
void TakeUnityPotion()
Definition Player.cs:40388
bool controlCreativeMenu
Definition Player.cs:1441
bool[] hideInfo
Definition Player.cs:597
static int ClampHotbarOffset(int Offset)
Definition Player.cs:29656
bool CanHit(Entity ent)
Definition Player.cs:40596
bool releaseUseItem
Definition Player.cs:1413
bool petFlagPlanteraPet
Definition Player.cs:1793
int[,] PlaceThing_Tiles_GetAutoAccessoryCache()
Definition Player.cs:38156
bool killClothier
Definition Player.cs:2337
void ItemCheck_CutTiles(Item sItem, Rectangle itemRectangle, bool[] shouldIgnore)
Definition Player.cs:42452
static void ItemCheck_UseMiningTools_TryFindingWallToHammer(out int wX, out int wY)
Definition Player.cs:43612
void NinjaDodge()
Definition Player.cs:36053
void SmartSelect_GetAvailableToolRanges(out int pickRange, out int axeRange, out int hammerRange, out int cannonRange, out int extractItemRange, out int paintScraperRange)
Definition Player.cs:17362
void TryInterruptingItemUsage()
Definition Player.cs:23167
void QuickGrapple()
Definition Player.cs:5170
bool _forceSmartSelectCursor
Definition Player.cs:2685
void SmartSelect_SelectItem(int t)
Definition Player.cs:17277
int nebulaLevelMana
Definition Player.cs:705
void AddCoinLuck(Vector2 coinPosition, int coinAmount)
Definition Player.cs:17774
void ResetFloorFlags()
Definition Player.cs:22794
static int taxRate
Definition Player.cs:627
int vanityRocketBoots
Definition Player.cs:2325
bool canJumpAgain_Cloud
Definition Player.cs:2231
bool ShoppingZone_Forest
Definition Player.cs:3315
bool petFlagShadowMimic
Definition Player.cs:1771
void UpdateStormTigerStatus()
Definition Player.cs:11721
void SmartSelectLookup()
Definition Player.cs:17044
bool isPerformingJump_Cloud
Definition Player.cs:2233
bool HasLockedInventory()
Definition Player.cs:21999
Vector2 GetBackHandPosition(CompositeArmStretchAmount stretch, float rotation)
Definition Player.cs:47714
void ItemCheck_UseLawnMower(Item sItem)
Definition Player.cs:44724
void QuickHeal()
Definition Player.cs:4647
static Point[] _tentacleSpikesMax5
Definition Player.cs:2709
bool petFlagDD2OgrePet
Definition Player.cs:1813
bool petFlagQueenBeePet
Definition Player.cs:1785
void ToggleInv()
Definition Player.cs:4038
void AdjustRemainingPotionSickness()
Definition Player.cs:27262
void KillMe(PlayerDeathReason damageSource, double dmg, int hitDirection, bool pvp=false)
Definition Player.cs:36665
static bool CanPlayerSmashWall(int X, int Y)
Definition Player.cs:43698
void DropTombstone(long coinsOwned, NetworkText deathText, int hitDirection)
Definition Player.cs:36910
bool petFlagPlantero
Definition Player.cs:1765
Vector2[] beetlePos
Definition Player.cs:741
float GetWeaponKnockback(Item sItem, float KnockBack)
Definition Player.cs:49867
void OpenGoodieBag(int itemType)
Definition Player.cs:8731
void ClearMiningCacheAt(int x, int y, int hitTileCacheType)
Definition Player.cs:50311
float meleeDamage
Definition Player.cs:2023
static void InternalSaveMap(bool isCloudSave)
Definition Player.cs:51493
static Point[] _bloodButchererMax5
Definition Player.cs:2711
bool isControlledByFilm
Definition Player.cs:1455
bool stardustMinion
Definition Player.cs:995
void PlaceThing_Walls()
Definition Player.cs:37407
Vector2[] beetleVel
Definition Player.cs:743
bool IsColorfulDye(int dye)
Definition Player.cs:33959
Item starCloakItem_beeCloakOverrideItem
Definition Player.cs:1989
const int SaveSlotIndex_TinkererItem
Definition Player.cs:2738
bool alchemyTable
Definition Player.cs:589
void ResetMeleeHitCooldowns()
Definition Player.cs:42022
bool witheredWeapon
Definition Player.cs:2007
bool IsBottomOfTreeTrunkNoRoots(int x, int y)
Definition Player.cs:43571
static bool CheckSpawn(int x, int y)
Definition Player.cs:51050
void ItemCheck_UseBuckets(Item sItem)
Definition Player.cs:44095
bool witheredArmor
Definition Player.cs:2005
void ChangeSpawn(int x, int y)
Definition Player.cs:51138
void MowGrassTile(Vector2 thePos)
Definition Player.cs:19777
void LaunchMinecartHook(int myX, int myY)
Definition Player.cs:31273
void SmartInteractLookup_PrepareCommonlyUsedInfo(out Vector2 mousevec, out int LX, out int HX, out int LY, out int HY)
Definition Player.cs:17030
float ghostDmg
Definition Player.cs:773
void AutoFinchStaff()
Definition Player.cs:35691
bool ballistaPanic
Definition Player.cs:2013
void StartChanneling()
Definition Player.cs:49489
int shadowDodgeTimer
Definition Player.cs:945
bool ItemCheck_CheckCanUse(Item sItem)
Definition Player.cs:48702
List< Point > TouchedTiles
Definition Player.cs:2563
bool isNearFairy()
Definition Player.cs:50317
int insanityShadowCooldown
Definition Player.cs:867
void PlaceThing_PaintScrapper_TryScrapping(int x, int y)
Definition Player.cs:39522
bool releaseThrow
Definition Player.cs:1421
static ItemTrader TryGettingItemTraderFromBlock(Tile targetBlock)
Definition Player.cs:39351
bool ActuationRodLock
Definition Player.cs:2193
void Teleport(Vector2 newPos, int Style=0, int extraInfo=0)
Definition Player.cs:35567
bool GoingDownWithGrapple
Definition Player.cs:593
bool PlaceThing_ValidTileForReplacement()
Definition Player.cs:37704
static byte[] ENCRYPTION_KEY
Definition Player.cs:579
int beetleFrameCounter
Definition Player.cs:747
float slotsMinions
Definition Player.cs:969
Color skinColor
Definition Player.cs:2135
float flameRingScale
Definition Player.cs:727
long lastTimePlayerWasSaved
Definition Player.cs:1313
IEntitySource GetProjectileSource_Accessory(Item item)
Definition Player.cs:9312
bool onHitDodge
Definition Player.cs:931
bool JustDroppedAnItem
Definition Player.cs:2015
ShimmerUnstuckHelper shimmerUnstuckHelper
Definition Player.cs:1907
bool petFlagDD2Ghost
Definition Player.cs:1745
static void PlaceThing_Tiles_BlockPlacementForRepeatedCoralAndBeachPiles(ref bool canPlace, ref TileObject data)
Definition Player.cs:39094
float trackBoost
Definition Player.cs:1731
bool setHuntressT3
Definition Player.cs:2393
static readonly BinaryReader _visualCloneReader
Definition Player.cs:2750
bool vortexDebuff
Definition Player.cs:2001
void ItemCheck_UseShimmerPermanentItems(Item sItem)
Definition Player.cs:43210
int lastTeleportPylonStyleUsed
Definition Player.cs:2555
bool editedChestName
Definition Player.cs:1127
static void InternalSavePlayerFile(PlayerFileData playerFile)
Definition Player.cs:51197
void PlaceThing_Tiles()
Definition Player.cs:37524
Color GetImmuneAlpha(Color newColor, float alphaReduction)
Definition Player.cs:50645
EntityShadowInfo[] _advancedShadows
Definition Player.cs:1535
bool TeamChangeAllowed()
Definition Player.cs:3823
int torchGodCooldown
Definition Player.cs:2629
Item FindPaintOrCoating()
Definition Player.cs:39579
Vector2 GetLegsDrawOffset()
Definition Player.cs:3991
int bartenderQuestLog
Definition Player.cs:1547
bool IsVisibleCapeBad(int accFrontSlot)
Definition Player.cs:35048
void UpdateFishingBobber(Item item)
Definition Player.cs:34882
bool UsingBiomeTorches
Definition Player.cs:3426
bool hasJumpOption_Unicorn
Definition Player.cs:2259
static int tileTargetY
Definition Player.cs:2085
int immuneAlphaDirection
Definition Player.cs:1109
void TrySpawningFaelings()
Definition Player.cs:16588
bool useVoidBag()
Definition Player.cs:22085
bool noBuilding
Definition Player.cs:799
bool isPerformingJump_Fart
Definition Player.cs:2251
bool stardustDragon
Definition Player.cs:999
void TileInteractionsMouseOver_Containers(int myX, int myY)
Definition Player.cs:32968
bool ZoneUnderworldHeight
Definition Player.cs:3145
IEntitySource GetProjectileSource_Misc(int projectileSourceId)
Definition Player.cs:9317
bool petFlagEaterOfWorldsPet
Definition Player.cs:1779
int FindItem(bool[] validtypes)
Definition Player.cs:52407
void UpdateBuffs(int i)
Definition Player.cs:9342
Color pantsColor
Definition Player.cs:2143
bool[] nearbyTorch
Definition Player.cs:2613
bool _spawnBloodButcherer
Definition Player.cs:2453
bool CanAcceptItemIntoInventory(Item item)
Definition Player.cs:33097
Color GetImmuneAlphaPure(Color newColor, float alphaReduction)
Definition Player.cs:50669
bool creativeInterface
Definition Player.cs:1135
void TileInteractionsCheckLongDistance(int myX, int myY)
Definition Player.cs:29844
void ItemCheck_UseLifeCrystal(Item sItem)
Definition Player.cs:43131
bool outOfRange
Definition Player.cs:769
bool PlaceThing_Tiles_CheckRopeUsability(bool canUse)
Definition Player.cs:39195
double Hurt(PlayerDeathReason damageSource, int Damage, int hitDirection, bool pvp=false, bool quiet=false, bool Crit=false, int cooldownCounter=-1, bool dodgeable=true)
Definition Player.cs:36134
void DropSelectedItem_InterruptActionsThatUseAnimations()
Definition Player.cs:4405
bool TileReplacementEnabled
Definition Player.cs:2864
int _funkytownAchievementCheckCooldown
Definition Player.cs:2593
void ItemCheck_UseDemonHeart(Item sItem)
Definition Player.cs:43029
int wingFrameCounter
Definition Player.cs:1031
Point _inputMouseCoordsSmartSelect
Definition Player.cs:2687
void TrySwitchingLoadout(int loadoutIndex)
Definition Player.cs:4778
bool isPettingAnimal
Definition Player.cs:2459
CompositeArmData compositeFrontArm
Definition Player.cs:1539
bool ZoneTowerNebula
Definition Player.cs:3037
void ItemCheck_UseManaCrystal(Item sItem)
Definition Player.cs:43099
void RefreshMovementAbilities(bool doubleJumps=true)
Definition Player.cs:21793
bool ZonePeaceCandle
Definition Player.cs:3001
void DropSelectedItem(int slot, ref Item theItemWeDrop)
Definition Player.cs:4327
void CommandForbiddenStorm()
Definition Player.cs:53409
ItemSpaceStatus ItemSpace(Item newItem)
Definition Player.cs:36958
void UpdatePlacementPreview(Item sItem)
Definition Player.cs:41316
long DropCoins()
Definition Player.cs:50750
void DoPotionOfReturnTeleportationAndSetTheComebackPoint()
Definition Player.cs:35664
int CollideWithNPCs(Rectangle myRect, float Damage, float Knockback, int NPCImmuneTime, int PlayerImmuneTime)
Definition Player.cs:19810
bool PlaceThing_Tiles_CheckGamepadTorchUsability(bool canUse)
Definition Player.cs:39245
bool leinforsHair
Definition Player.cs:1645
int GetAmountOfExtraAccessorySlotsToShow()
Definition Player.cs:3664
int _portalPhysicsTime
Definition Player.cs:2551
int QuickBuff_FindFoodPriority(int buffType)
Definition Player.cs:4959
void ItemCheck_UseMiningTools(Item sItem)
Definition Player.cs:43374
bool ShouldFloatInWater
Definition Player.cs:3348
byte iceBarrierFrame
Definition Player.cs:921
static int Spawn_DescendFromDefaultSpace(int x, int y)
Definition Player.cs:35935
IEntitySource GetProjectileSource_Item_WithPotentialAmmo(Item item, int ammoItemId)
Definition Player.cs:9292
float whipUseTimeMultiplier
Definition Player.cs:903
int starCloakCooldown
Definition Player.cs:869
bool moonLordMonolithShader
Definition Player.cs:1655
IEntitySource GetProjectileSource_Item(Item item)
Definition Player.cs:9272
const int ChairSittingMaxDistance
Definition Player.cs:2607
bool crimsonHeart
Definition Player.cs:1673
void Fishing_GetBait(out int baitPower, out int baitType)
Definition Player.cs:40320
static bool IsHoveringOverABottomSideOfABed(int myX, int myY)
Definition Player.cs:31074
void ItemCheck_UseArtisanLoaf(Item sItem)
Definition Player.cs:43053
void Yoraiz0rEye()
Definition Player.cs:11862
int BiomeCampfirePlaceStyle(int style)
Definition Player.cs:38042
float ghostFade
Definition Player.cs:1187
int ghostFrameCounter
Definition Player.cs:1039
void ItemCheck_UseBossSpawners(int onWhichPlayer, Item sItem)
Definition Player.cs:41562
void AdjTiles()
Definition Player.cs:33828
bool CanMoveForwardOnRope(int dir, int x, int y)
Definition Player.cs:23253
void RemoveAllGrapplingHooks()
Definition Player.cs:31290
static int nameLen
Definition Player.cs:1121
Vector2 legPosition
Definition Player.cs:1283
void UpdateLifeRegen()
Definition Player.cs:18481
static SmartInteractSystem _smartInteractSys
Definition Player.cs:2609
void ItemCheck_MeleeHitPVP(Item sItem, Rectangle itemRectangle, int damage, float knockBack)
Definition Player.cs:41888
float manaRegenDelay
Definition Player.cs:1577
void TileInteractionsUse(int myX, int myY)
Definition Player.cs:29919
void ChangeDir(int dir)
Definition Player.cs:40136
bool botherWithUnaimedMinecartTracks
Definition Player.cs:2693
int CountBuffs()
Definition Player.cs:4634
void PlaceThing_PaintScrapper_LongMoss(int x, int y)
Definition Player.cs:39473
bool canJumpAgain_Unicorn
Definition Player.cs:2261
static float airLightDecay
Definition Player.cs:2601
bool tryKeepingHoveringUp
Definition Player.cs:1459
static float GetAnglerRewardRarityMultiplier(int questsDone)
Definition Player.cs:52796
const int SupportedMiscSlotCount
Definition Player.cs:1165
bool armorEffectDrawShadowSubtle
Definition Player.cs:1217
bool mapFullScreen
Definition Player.cs:1471
void ApplyDamageToNPC(NPC npc, int damage, float knockback, int direction, bool crit)
Definition Player.cs:19845
int rocketSoundDelay
Definition Player.cs:2317
bool dontHurtCritters
Definition Player.cs:1075
bool sonarPotion
Definition Player.cs:955
void ItemCheck_MeleeHitNPCs(Item sItem, Rectangle itemRectangle, int originalDamage, float knockBack)
Definition Player.cs:42054
bool isPerformingJump_Sail
Definition Player.cs:2257
Rectangle HitboxForBestiaryNearbyCheck
Definition Player.cs:2831
void QuickMount()
Definition Player.cs:5013
void ItemCheck_EmitHammushProjectiles(int i, Item sItem, Rectangle itemRectangle, int damage)
Definition Player.cs:42358
float wingRunAccelerationMult
Definition Player.cs:2663
float maxRegenDelay
Definition Player.cs:1123
void ForceUpdateBiomes()
Definition Player.cs:16028
bool ShouldDrawWingsThatAreAlwaysAnimated()
Definition Player.cs:28507
Item QuickBuff_PickBestFoodItem()
Definition Player.cs:4912
PlayerMovementAccsCache movementAbilitiesCache
Definition Player.cs:2659
bool DoesPickTargetTransformOnKill(HitTile hitCounter, int damage, int x, int y, int pickPower, int bufferIndex, Tile tileTarget)
Definition Player.cs:50528
void KeyDoubleTap(int keyDir)
Definition Player.cs:53370
static bool disabledBlizzardSound
Definition Player.cs:613
void TeleportationPotion()
Definition Player.cs:52647
bool CanMasterModeAccessoryBeShown()
Definition Player.cs:3655
Vector2[] shadowOrigin
Definition Player.cs:1509
Point _mainMouseCoordsForward
Definition Player.cs:2683
bool InOpposingTeam(Player otherPlayer)
Definition Player.cs:3810
void ItemCheck_ApplyHoldStyle(float mountOffset, Item sItem, Rectangle heldItemFrame)
Definition Player.cs:47352
void CancelAllBootRunVisualEffects()
Definition Player.cs:34873
void UpdateArmorSets(int i)
Definition Player.cs:15283
void ItemCheck_UsePeddlersSatchel(Item sItem)
Definition Player.cs:43193
bool ZoneGraveyard
Definition Player.cs:3265
void ResetControls()
Definition Player.cs:27371
bool controlTorch
Definition Player.cs:1401
void DoubleJumpVisuals()
Definition Player.cs:20921
void TryToToggleSmartCursor(ref bool smartCursorWanted)
Definition Player.cs:27137
float arrowDamage
Definition Player.cs:2033
bool usedAegisFruit
Definition Player.cs:647
void UpdateForbiddenSetLock()
Definition Player.cs:53395
bool usedAmbrosia
Definition Player.cs:655
void GetPointOnSwungItemPath(float spriteWidth, float spriteHeight, float normalizedPointOnPath, float itemScale, out Vector2 location, out Vector2 outwardDirection)
Definition Player.cs:42553
bool GetSparkleGuitarTarget(out List< NPC > validTargets)
Definition Player.cs:44414
Item honeyCombItem
Definition Player.cs:2423
bool UpdateEquips_CanItemGrantBenefits(int itemSlot, Item item)
Definition Player.cs:12239
bool BuyItem(long price, int customCurrency=-1)
Definition Player.cs:33584
void SmartSelectLookup_GetTargetTile(out int tX, out int tY)
Definition Player.cs:17096
bool extraAccessory
Definition Player.cs:659
const int SaveSlotIndex_GuideItem
Definition Player.cs:2736
Vector2 MinionRestTargetPoint
Definition Player.cs:2559
PortableStoolUsage portableStoolInfo
Definition Player.cs:1071
Vector2 Directions
Definition Player.cs:3326
Rectangle getRect()
Definition Player.cs:40162
bool gravControl2
Definition Player.cs:2421
void TryUsingDiggerCart()
Definition Player.cs:19613
bool hasJumpOption_Sail
Definition Player.cs:2253
bool[] hideVisibleAccessory
Definition Player.cs:1367
bool controlMount
Definition Player.cs:1407
void NebulaLevelup(int type)
Definition Player.cs:53639
int titaniumStormCooldown
Definition Player.cs:939
void CheckIceBreak()
Definition Player.cs:22405
byte meleeEnchant
Definition Player.cs:831
int beardGrowthTimer
Definition Player.cs:1243
static void Serialize(PlayerFileData playerFile, Player newPlayer, BinaryWriter fileIO)
Definition Player.cs:51230
void ItemCheck_CheckFishingBobber_PickAndConsumeBait(Projectile bobber, out bool pullTheBobber, out int baitTypeUsed)
Definition Player.cs:49102
int counterWeight
Definition Player.cs:669
void FixLoadedData_Items(Item[] items)
Definition Player.cs:52231
bool accFishingBobber
Definition Player.cs:959
void ItemCheck_ApplyUseStyle(float mountOffset, Item sItem, Rectangle heldItemFrame)
Definition Player.cs:47744
static bool deadForGood
Definition Player.cs:1305
void GetPettingInfo(int animalNpcIndex, out int targetDirection, out Vector2 playerPositionWhenPetting, out bool isPetSmall)
Definition Player.cs:31123
int PlaceThing_Tiles_PlaceIt_GetLegacyTileStyle(int style)
Definition Player.cs:38182
void ApplyWilsonBeard(Item currentItem)
Definition Player.cs:15010
bool isHatRackDoll
Definition Player.cs:1249
void PlaceThing_Paintbrush()
Definition Player.cs:39561
static int tileRangeX
Definition Player.cs:2075
void CarpetMovement()
Definition Player.cs:20871
bool portalPhysicsFlag
Definition Player.cs:2553
void PlayDrums(float range)
Definition Player.cs:44489
bool IsTilePoundable(Tile targetTile)
Definition Player.cs:43339
const int MaxAdvancedShadows
Definition Player.cs:1531
List< int > GetNearbyContainerProjectilesList()
Definition Player.cs:22024
void GetOtherPlayersPickTile(int x, int y, int pickDamage)
Definition Player.cs:50226
int[] grappling
Definition Player.cs:2305
int GetPickaxeDamage(int x, int y, int pickPower, int hitBufferIndex, Tile tileTarget)
Definition Player.cs:50368
static void LoadPlayer_LastMinuteFixes(Player newPlayer)
Definition Player.cs:52242
void GetAnglerReward_MainReward(IEntitySource source, int questsDone, float rarityReduction, int questItemType, ref GetItemSettings anglerRewardSettings)
Definition Player.cs:52803
void SetPlayerDataToOutOfClassFields()
Definition Player.cs:51456
int BiomeTorchHoldStyle(int style)
Definition Player.cs:37985
Vector2? HandPosition
Definition Player.cs:3576
Vector2 GetFaceHeadOffsetFromHelmet()
Definition Player.cs:3927
bool IsInTileInteractionRange(int targetX, int targetY, TileReachCheckSettings settings)
Definition Player.cs:29821
bool solarDashConsumedFlare
Definition Player.cs:699
bool QuickMinecartSnap()
Definition Player.cs:5086
bool makeStrongBee
Definition Player.cs:2581
sbyte faceFlower
Definition Player.cs:1361
float minionDamage
Definition Player.cs:2039
bool IsInInteractionRangeToMultiTileHitbox(int chestPointX, int chestPointY)
Definition Player.cs:28858
bool petFlagLunaticCultistPet
Definition Player.cs:1799
void DoCoins(int i)
Definition Player.cs:37047
Vector2 _nextTorchLuckCheckCenter
Definition Player.cs:2623
void DoPotionOfReturnReturnToOriginalUsePosition()
Definition Player.cs:35678
bool CanDoWireStuffHere(int x, int y)
Definition Player.cs:44711
bool IsItemSlotUnlockedAndUsable(int slot)
Definition Player.cs:11968
const int miscSlotMount
Definition Player.cs:1161
bool equippedAnyTileSpeedAcc
Definition Player.cs:2585
void ApplyMusicBox(Item currentItem)
Definition Player.cs:15026
const int miscSlotHook
Definition Player.cs:1163
bool lifeMagnet
Definition Player.cs:713
bool InfoAccMechShowWires
Definition Player.cs:2197
Vector2[] shadowPos
Definition Player.cs:1505
bool hasRaisableShield
Definition Player.cs:2671
bool autoReuseAllWeapons
Definition Player.cs:1453
void PullItem_Pickup(Item itemToPickUp, float speed, int acc)
Definition Player.cs:33226
PlayerFishingConditions GetFishingConditions()
Definition Player.cs:40242
byte accThirdEyeCounter
Definition Player.cs:2173
void ItemCheck_EmitFoodParticles(Item sItem)
Definition Player.cs:41524
int availableAdvancedShadowsCount
Definition Player.cs:1533
bool tileInteractAttempted
Definition Player.cs:1447
const int fartKartCloudDelayMax
Definition Player.cs:1297
void PickWall(int x, int y, int damage)
Definition Player.cs:43719
bool ZoneOverworldHeight
Definition Player.cs:3109
void TryAllowingSnappingToPosition(ref bool canSnapToPosition, Vector2 pos1, Vector2 pos2)
Definition Player.cs:31186
int crystalLeafCooldown
Definition Player.cs:1069
void ManageSpecialBiomeVisuals(string biomeName, bool inZone, Vector2 activationSource=default(Vector2))
Definition Player.cs:16597
float musicDist
Definition Player.cs:2717
static void PlaceThing_Tiles_BlockPlacementForRepeatedPigronatas(ref bool canPlace, ref TileObject data)
Definition Player.cs:39106
bool petFlagBabyShark
Definition Player.cs:1753
bool petFlagBrainOfCthulhuPet
Definition Player.cs:1781
static bool AllowShimmerDodge(PlayerDeathReason damageSource, int cooldownCounter, bool dodgeable)
Definition Player.cs:36621
void JumpMovement()
Definition Player.cs:19912
bool canJumpAgain_Santank
Definition Player.cs:2267
void CopyVisuals(Player other)
Definition Player.cs:50885
int numberOfTorchAttacksMade
Definition Player.cs:2631
bool controlQuickMana
Definition Player.cs:1437
void SmartSelect_GetToolStrategy(int tX, int tY, out int toolStrategy, out bool wetTile)
Definition Player.cs:17286
Item PickupItem(int playerIndex, int worldItemArrayIndex, Item itemToPickUp)
Definition Player.cs:33239
bool AddBuff_ActuallyTryToAddTheBuff(int type, int time)
Definition Player.cs:4476
bool immuneNoBlink
Definition Player.cs:1105
int shield_parry_cooldown
Definition Player.cs:2677
bool spiderMinion
Definition Player.cs:983
void ApplyItemAnimation(Item sItem)
Definition Player.cs:3775
bool hasAngelHalo
Definition Player.cs:1641
void BatBat_TryLifeLeeching(Entity entity)
Definition Player.cs:42008
IEntitySource GetProjectileSource_Buff(int buffIndex)
Definition Player.cs:9266
float luckMinimumCap
Definition Player.cs:2647
bool petFlagEverscreamPet
Definition Player.cs:1807
IEntitySource GetItemSource_Misc(int itemSourceId)
Definition Player.cs:9287
float MountXOffset
Definition Player.cs:2787
Vector2 GetHelmetDrawOffset()
Definition Player.cs:3869
bool petFlagTwinsPet
Definition Player.cs:1789
void DashMovement()
Definition Player.cs:20374
bool AddBuff_TryUpdatingExistingBuffTime(int type, int time)
Definition Player.cs:4553
float jumpSpeedBoost
Definition Player.cs:2289
const int SHIELD_PARRY_DURATION_DRAWING_TWEAKER
Definition Player.cs:2667
void RefreshMechanicalAccsFromItemType(int accType)
Definition Player.cs:12181
bool hasJumpOption_WallOfFleshGoat
Definition Player.cs:2271
int highestAbigailCounterOriginalDamage
Definition Player.cs:1019
bool hasJumpOption_Cloud
Definition Player.cs:2229
void DoQueenSlimeHookTeleport(Vector2 targetPosition)
Definition Player.cs:21682
bool hasLucyTheAxe
Definition Player.cs:1077
void GetAnglerReward_Money(IEntitySource source, int questsDone, float rarityReduction, ref GetItemSettings anglerRewardSettings)
Definition Player.cs:53101
void UpdateLadyBugLuckTime()
Definition Player.cs:18375
double bodyFrameCounter
Definition Player.cs:1095
void SlopingCollision(bool fallThrough, bool ignorePlats)
Definition Player.cs:22725
void PlaceThing_PaintRoller()
Definition Player.cs:39543
bool ZoneLihzhardTemple
Definition Player.cs:3253
void DisplayDollUpdate()
Definition Player.cs:33951
Rectangle bodyFrame
Definition Player.cs:1373
bool SummonItemCheck(Item item)
Definition Player.cs:40228
void WaterCollision(bool fallThrough, bool ignorePlats)
Definition Player.cs:22491
bool luckNeedsSync
Definition Player.cs:2653
bool petFlagSkeletronPrimePet
Definition Player.cs:1791
void ItemCheck_HackHoldStyles(Item sItem)
Definition Player.cs:49386
void UpdateArmorLights()
Definition Player.cs:28907
void UpdatePortableStoolUsage()
Definition Player.cs:27478
bool hasPaladinShield
Definition Player.cs:1087
int HeightOffsetBoost
Definition Player.cs:2799
void LimitPointToPlayerReachableArea(ref Vector2 pointPoisition)
Definition Player.cs:43259
bool petFlagBlueChickenPet
Definition Player.cs:1831
void HoneyCollision(bool fallThrough, bool ignorePlats)
Definition Player.cs:22473
static int GetFloorTileType(int x, int y)
Definition Player.cs:22833
bool discountEquipped
Definition Player.cs:2211
void ItemCheck_ManageRightClickFeatures()
Definition Player.cs:29284
bool releaseCreativeMenu
Definition Player.cs:1443
SavedPlayerDataWithAnnoyingRules savedPerPlayerFieldsThatArentInThePlayerClass
Definition Player.cs:2730
Item GetBestPickaxe()
Definition Player.cs:37842
float headRotation
Definition Player.cs:1273
bool petFlagVoltBunny
Definition Player.cs:1773
static int jumpHeight
Definition Player.cs:2089
bool yoyoString
Definition Player.cs:671
byte suffocateDelay
Definition Player.cs:1911
void DamageTileWithShovel(Player user, Item item, int x, int y)
Definition Player.cs:43360
Item[] miscDyes
Definition Player.cs:1173
static int BlockInteractionWithProjectiles
Definition Player.cs:2575
float beeKB(float KB)
Definition Player.cs:11853
const int SupportedSlotsArmor
Definition Player.cs:1147
bool hasJumpOption_Basilisk
Definition Player.cs:2277
float manaRegenDelayBonus
Definition Player.cs:805
float shimmerTransparency
Definition Player.cs:1905
void TileInteractionsCheck(int myX, int myY)
Definition Player.cs:29831
void PlaceThing_CannonBall()
Definition Player.cs:39446
void ShootFromCannon(int x, int y)
Definition Player.cs:39678
void dropItemCheck()
Definition Player.cs:4220
IEntitySource GetProjectileSource_OnHurt(Entity attacker, int projectileSourceId)
Definition Player.cs:9307
bool ModifyFlexibleWandPlacementInfo(ref int tileType, ref int tileStyle, ref int? forcedRandom)
Definition Player.cs:37587
static int tileTargetX
Definition Player.cs:2083
bool CanSeeInvisibleBlocks
Definition Player.cs:2375
void AddBuff_RemoveOldMeleeBuffsOfMatchingType(int type)
Definition Player.cs:4512
const int SaveSlotIndex_MouseItem
Definition Player.cs:2732
void ExtractinatorUse(int extractType, int extractinatorBlockType)
Definition Player.cs:39722
int GetWeaponCrit(Item sItem)
Definition Player.cs:49892
bool accLavaFishing
Definition Player.cs:963
void PlaceThing_Tiles_PlaceIt_TriggerLogicLamp()
Definition Player.cs:38549
bool petFlagDirtiestBlock
Definition Player.cs:1837
int BiomeTorchPlaceStyle(int style)
Definition Player.cs:37928
void UpdateTouchingTiles()
Definition Player.cs:53670
Item starCloakItem
Definition Player.cs:1983
bool DoBootsEffect_PlaceFlowersOnTile(int X, int Y)
Definition Player.cs:13424
bool dontConsumeWand
Definition Player.cs:661
static float defaultGravity
Definition Player.cs:2087
void SlopeDownMovement()
Definition Player.cs:22431
void ItemCheck_UseEventItems(Item sItem)
Definition Player.cs:41731
bool shroomiteStealth
Definition Player.cs:1233
bool ZoneTowerVortex
Definition Player.cs:3025
void ItemCheck_HandleMPItemAnimation(Item sItem)
Definition Player.cs:49421
void StopVanityActions(bool multiplayerBroadcast=true)
Definition Player.cs:31204
HitTile hitReplace
Definition Player.cs:1325
bool dd2Accessory
Definition Player.cs:609
static int defaultItemGrabRange
Definition Player.cs:2119
void PlayGuitarChord(float range)
Definition Player.cs:44459
const int nebulaMaxLevel
Definition Player.cs:701
static PlayerFileData GetFileData(string file, bool cloudSave)
Definition Player.cs:52273
bool unlockedSuperCart
Definition Player.cs:1667
void UpdateBlacklistedTilesForGrappling()
Definition Player.cs:5147
void UpdateDead()
Definition Player.cs:16766
float[] shadowRotation
Definition Player.cs:1507
float miscCounterNormalized
Definition Player.cs:2880
void PullItem_Common(Item itemToPickUp, float xPullSpeed)
Definition Player.cs:33178
void ItemCheck_Shoot(int i, Item sItem, int weaponDamage)
Definition Player.cs:44776
float basiliskCharge
Definition Player.cs:637
void UpdateStarvingState(bool withEmote)
Definition Player.cs:11593
bool Spawn_IsAreaAValidWorldSpawn(int floorX, int floorY)
Definition Player.cs:35981
void ApplyEquipVanity(int itemSlot, Item currentItem)
Definition Player.cs:13520
Item QuickHeal_GetItemToUse()
Definition Player.cs:4689
double legFrameCounter
Definition Player.cs:1097
bool pirateMinion
Definition Player.cs:987
bool TouchBlockSurfaceCenter(int x, int y, Tile tile, out int exitNormalX, out int exitNormalY, out Vector2 surfaceCenter)
Definition Player.cs:22651
void CheckCrackedBrickBreak()
Definition Player.cs:22332
void FreeUpPetsAndMinions(Item sItem)
Definition Player.cs:48495
void TileInteractionsMouseOver(int myX, int myY)
Definition Player.cs:31315
bool controlQuickHeal
Definition Player.cs:1439
static float GetClosestPlayersLuck(Point Position)
Definition Player.cs:17853
static void OpenInventory()
Definition Player.cs:4145
void BloodButcherer_TryButchering(NPC npc, Item sItem, float damage, float knockBack)
Definition Player.cs:41992
bool drippingSlime
Definition Player.cs:1915
void FixLoadedData()
Definition Player.cs:52192
Vector2 GetBeardDrawOffsetFromHelmet()
Definition Player.cs:3907
bool sharknadoMinion
Definition Player.cs:989
bool shadowDodge
Definition Player.cs:925
bool ZoneSandstorm
Definition Player.cs:3181
bool showLastDeath
Definition Player.cs:643
Rectangle ItemCheck_CatchCritters(Item sItem, Rectangle itemRectangle)
Definition Player.cs:42517
const int SaveSlotIndex_CreativeSacrifice
Definition Player.cs:2734
int phantomPhoneixCounter
Definition Player.cs:949
void TryFloatingInFluid()
Definition Player.cs:22509
const int miscSlotLight
Definition Player.cs:1157
bool isOperatingAnotherEntity
Definition Player.cs:1451
bool teleporting
Definition Player.cs:775
void ItemCheck_OwnerOnlyCode(ref ItemCheckContext context, Item sItem, int weaponDamage, Rectangle heldItemFrame)
Definition Player.cs:41357
static void ClearPlayerTempInfo()
Definition Player.cs:51485
DateTime dpsLastHit
Definition Player.cs:2203
int timeSinceLastDashStarted
Definition Player.cs:813
bool isPerformingJump_WallOfFleshGoat
Definition Player.cs:2275
float lifeSteal
Definition Player.cs:771
bool armorEffectDrawOutlines
Definition Player.cs:1219
bool petFlagMartianPet
Definition Player.cs:1811
bool GetItem_FillEmptyInventorySlot_VoidBag(int plr, Item[] inv, Item newItem, GetItemSettings settings, Item returnItem, int i)
Definition Player.cs:37323
void UpdateLuck()
Definition Player.cs:27360
float manaSickReduction
Definition Player.cs:755
CompositeArmData compositeBackArm
Definition Player.cs:1541
bool PlaceThing_TryReplacingTiles(bool canUse)
Definition Player.cs:37634
bool PlaceThing_Tiles_CheckLavaBlocking()
Definition Player.cs:39178
static List< NPC > _hallucinationCandidates
Definition Player.cs:2589
float equipmentBasedLuckBonus
Definition Player.cs:2339
BitsByte voidVaultInfo
Definition Player.cs:1271
bool preventAllItemPickups
Definition Player.cs:1073
bool setHuntressT2
Definition Player.cs:2401
float rocketDamage
Definition Player.cs:2037
bool hasLuck_LuckyCoin
Definition Player.cs:2225
void GrantArmorBenefits(Item armorPiece)
Definition Player.cs:12428
float maxRunSpeed
Definition Player.cs:2097
WingStats GetWingStats(int wingID)
Definition Player.cs:13602
void ItemCheck_UseMiningTools_TryHittingWall(Item sItem, int wX, int wY)
Definition Player.cs:43688
void OpenPresent(int itemType)
Definition Player.cs:5965
static Point FlexibleWandLastPosition
Definition Player.cs:2705
void OpenChest(int x, int y, int newChest)
Definition Player.cs:31241
float summonerWeaponSpeedBonus
Definition Player.cs:2045
bool findTreasure
Definition Player.cs:2351
bool chiselSpeed
Definition Player.cs:717
void UpdatePermanentBoosters()
Definition Player.cs:12221
void ItemCheck_ApplyPetBuffs(Item sItem)
Definition Player.cs:49624
void UpdatePet(int i)
Definition Player.cs:16926
bool rocketRelease
Definition Player.cs:2319
bool CanFitSpace(int heightBoost)
Definition Player.cs:5044
bool ZoneTowerStardust
Definition Player.cs:3049
bool ShoppingZone_AnyBiome
Definition Player.cs:3301
bool volatileGelatin
Definition Player.cs:1623
void SetArmorEffectVisuals(Player drawPlayer)
Definition Player.cs:35179
static int crystalLeafDamage
Definition Player.cs:633
float wingAccRunSpeed
Definition Player.cs:2661
bool _spawnMuramasaCut
Definition Player.cs:2457
bool lastMouseInterface
Definition Player.cs:1139
void TorchAttack()
Definition Player.cs:17493
bool HasMinionRestTarget
Definition Player.cs:3521
bool dryCoralTorch
Definition Player.cs:2615
void PlaceThing_PaintScrapper()
Definition Player.cs:39459
bool shimmerImmune
Definition Player.cs:1583
void UpdateCoinLuck()
Definition Player.cs:17787
bool petFlagFennecFox
Definition Player.cs:1757
float magicDamage
Definition Player.cs:2025
int RollLuck(int range)
Definition Player.cs:17863
float runSlowdown
Definition Player.cs:2101
float hairDyeVar
Definition Player.cs:2129
int lastCreatureHit
Definition Player.cs:2169
void LicenseOrExchangePet(Item sItem, ref bool petBoughtFlag, int npcType, string textKeyForLicense, int netMessageData)
Definition Player.cs:43250
void SporeSac(Item sourceItem)
Definition Player.cs:40477
void UpdateReleaseUseTile()
Definition Player.cs:27499
void StartChanneling(Item item)
Definition Player.cs:49495
void AddBuff(int type, int timeToAdd, bool quiet=true, bool foodHack=false)
Definition Player.cs:4441
static int tileRangeY
Definition Player.cs:2077
void RemoveAnglerAccOptionsFromRewardPool(List< int > itemIdsOfAccsWeWant, Item itemToTestAgainst)
Definition Player.cs:53215
void UpdateControlHolds()
Definition Player.cs:27397
void GetAnglerReward(NPC angler, int questItemType)
Definition Player.cs:52783
bool armorEffectDrawShadow
Definition Player.cs:1215
Vector2 instantMovementAccumulatedThisFrame
Definition Player.cs:2153
Item[] _temporaryItemSlots
Definition Player.cs:2742
int[] builderAccStatus
Definition Player.cs:599
bool onHitPetal
Definition Player.cs:935
void FindSpawn()
Definition Player.cs:51095
bool CanParryAgainst(Rectangle blockingPlayerRect, Rectangle enemyRect, Vector2 enemyVelocity)
Definition Player.cs:29195
bool dontStarveShader
Definition Player.cs:1631
void ResetProjectileCaches()
Definition Player.cs:11658
float endurance
Definition Player.cs:899
Vector2 GetFarthestSpawnPositionOnLine(Vector2 startPos, float speedX, float speedY)
Definition Player.cs:46675
void PlaceThing_Tiles_PlaceIt_SpinTraps()
Definition Player.cs:38588
PlayerEyeHelper eyeHelper
Definition Player.cs:2467
void TryBouncingBlocks(bool Falling)
Definition Player.cs:33032
void QuickSpawnItem(IEntitySource source, int item, int stack=1)
Definition Player.cs:6265
byte flameRingFrame
Definition Player.cs:729
void ItemCheck_UseCombatBook(Item sItem)
Definition Player.cs:43147
CreativeUnlocksTracker creativeTracker
Definition Player.cs:577
void SmartSelect_PickToolForStrategy(int tX, int tY, int toolStrategy, bool wetTile)
Definition Player.cs:17106
bool _forceForwardCursor
Definition Player.cs:2679
void DryCollision(bool fallThrough, bool ignorePlats)
Definition Player.cs:22556
static int maxTorchAttacks
Definition Player.cs:2633
int golferScoreAccumulated
Definition Player.cs:1545
bool armorEffectDrawShadowLokis
Definition Player.cs:1221
Vector2 RotatedRelativePoint(Vector2 pos, bool reverseRotation=false, bool addGfxOffY=true)
Definition Player.cs:3618
void TryGettingDevArmor(IEntitySource source)
Definition Player.cs:6974
void WOFTongue()
Definition Player.cs:21298
void PlaceWeapon(int x, int y)
Definition Player.cs:50556
bool petFlagBerniePet
Definition Player.cs:1819
bool manaRegenBuff
Definition Player.cs:1579
void TryOpeningFullscreenMap()
Definition Player.cs:27420
void QuickMana()
Definition Player.cs:4732
bool isLockedToATile
Definition Player.cs:3482
void FloorVisuals(bool Falling)
Definition Player.cs:22756
int numberOfDeathsPVP
Definition Player.cs:631
byte accCritterGuideNumber
Definition Player.cs:2185
bool ItemCheck_CheckFishingBobbers(bool canUse)
Definition Player.cs:49021
void TogglePet()
Definition Player.cs:16970
bool huntressAmmoCost90
Definition Player.cs:1591
int potionDelayTime
Definition Player.cs:2443
void AccumulateGolfingScore(int score)
Definition Player.cs:4001
bool releaseSmart
Definition Player.cs:1431
BitsByte zone3
Definition Player.cs:1053
void ShimmerUnstuck()
Definition Player.cs:27183
int shieldParryTimeLeft
Definition Player.cs:2675
void PickTile(int x, int y, int pickPower)
Definition Player.cs:50232
bool petFlagDD2Gato
Definition Player.cs:1743
void ItemCheck_MinionAltFeatureUse(Item sItem, bool cShoot)
Definition Player.cs:46911
bool chloroAmmoCost80
Definition Player.cs:1589
void UpdateDyes()
Definition Player.cs:9096
bool ZoneGlowshroom
Definition Player.cs:3073
bool meleeScaleGlove
Definition Player.cs:1977
int beeDamage(int dmg)
Definition Player.cs:11844
bool HasUnityPotion()
Definition Player.cs:40366
float teleportTime
Definition Player.cs:777
float GetLadyBugLuck()
Definition Player.cs:17840
void FlipItemLocationAndRotationForGravity()
Definition Player.cs:48454
bool HasAmmo(Item sItem, bool canUse)
Definition Player.cs:49951
void UpdateSocialShadow()
Definition Player.cs:15909
bool releaseQuickHeal
Definition Player.cs:1425
Vector2 headPosition
Definition Player.cs:1279
float GetAdjustedItemScale(Item item)
Definition Player.cs:40623
void MinionRestTargetAim()
Definition Player.cs:53544
bool ZoneRockLayerHeight
Definition Player.cs:3133
Vector2 CheckForGoodTeleportationSpot(ref bool canSpawn, int teleportStartX, int teleportRangeX, int teleportStartY, int teleportRangeY, RandomTeleportationAttemptSettings settings)
Definition Player.cs:52685
void DropItemFromExtractinator(int itemType, int stack)
Definition Player.cs:40122
bool InInteractionRange(int interactX, int interactY, TileReachCheckSettings settings)
Definition Player.cs:29774
void ApplyCoating(int x, int y, bool paintingAWall, bool applyItemAnimation, Item targetItem)
Definition Player.cs:39614
Vector2 BlehOldPositionFixer
Definition Player.cs:2752
float HeightOffsetHitboxCenter
Definition Player.cs:2771
bool ItemSpaceForCofveve(Item newItem)
Definition Player.cs:37004
bool IsBlacklistedForGrappling(Point p)
Definition Player.cs:5142
const int SHIELD_PARRY_DAMAGE_BUFF_MULTIPLIER
Definition Player.cs:2669
bool _spawnTentacleSpikes
Definition Player.cs:2451
bool usedGalaxyPearl
Definition Player.cs:651
bool minecartLeft
Definition Player.cs:1721
float pulleyFrameCounter
Definition Player.cs:839
bool TryingToHoverUp
Definition Player.cs:3400
void OpenCanofWorms(int sourceItemType)
Definition Player.cs:8696
bool petFlagJunimoPet
Definition Player.cs:1829
bool DropAnglerAccByMissing(List< int > itemIdsOfAccsWeWant, float totalChance, out bool botheredRollingForADrop, out int itemIdToDrop)
Definition Player.cs:53154
bool setForbidden
Definition Player.cs:2387
void Volcano_TrySpawningVolcano(NPC npc, Item sItem, float damage, float knockBack, Rectangle itemRectangle)
Definition Player.cs:41966
void Spawn_SetPositionAtWorldSpawn()
Definition Player.cs:35923
Vector2[] solarShieldPos
Definition Player.cs:693
bool petFlagPigPet
Definition Player.cs:1825
SelectionRadial CircularRadial
Definition Player.cs:585
bool ZoneShadowCandle
Definition Player.cs:3277
void TryLandingOnDetonator()
Definition Player.cs:33018
void FindPulley()
Definition Player.cs:19045
static byte FindClosest(Vector2 Position, int Width, int Height)
Definition Player.cs:4011
void SetCompositeArmFront(bool enabled, CompositeArmStretchAmount stretch, float rotation)
Definition Player.cs:3707
void ShimmerCollision(bool fallThrough, bool ignorePlats, bool noCollision)
Definition Player.cs:22449
bool isTheAnimalBeingPetSmall
Definition Player.cs:2461
void DestroyOldestProximityMinesOverMinesCap(int minesCap)
Definition Player.cs:44733
bool IsTargetTileInItemRange(Item sItem)
Definition Player.cs:44086
void DemonConch()
Definition Player.cs:52596
void ForceSmartSelectCursor(bool state)
Definition Player.cs:29592
void LockGamepadTileInteractions()
Definition Player.cs:29674
bool releaseInventory
Definition Player.cs:1417
void TryAllowingItemReuse(Item sItem)
Definition Player.cs:49441
void Spawn(PlayerSpawnContext context)
Definition Player.cs:35701
void Fishing_GetBestFishingPole(out int fishingPolePower, out int fishingPoleType)
Definition Player.cs:40348
void WingAirVisuals()
Definition Player.cs:28516
bool ZoneOldOneArmy
Definition Player.cs:3193
bool manaMagnet
Definition Player.cs:711
void DoBootsEffect(Utils.TileActionAttempt theEffectMethod)
Definition Player.cs:13400
IEntitySource GetItemSource_OnHit(Entity victim, int itemSourceId)
Definition Player.cs:9337
void ItemCheck_UseMiningTools_ActuallyUseMiningTool(Item sItem, out bool canHitWalls, int x, int y)
Definition Player.cs:43435
bool resistCold
Definition Player.cs:909
bool setApprenticeT2
Definition Player.cs:2403
void OnKillNPC(ref NPCKillAttempt attempt, object externalKillingBlowSource)
Definition Player.cs:19875
static Tile GetFloorTile(int x, int y)
Definition Player.cs:22803
float fullRotation
Definition Player.cs:1291
SoundPlaySet hermesStepSound
Definition Player.cs:2151
void DropSelectedItem()
Definition Player.cs:4315
void PlaceThing_Tiles_PlaceIt_AdjustPlants()
Definition Player.cs:38603
int[] hurtCooldowns
Definition Player.cs:2699
void DoCommonDashHandle(out int dir, out bool dashing, DashStartAction dashStartAction=null)
Definition Player.cs:20735
ShoppingSettings currentShoppingSettings
Definition Player.cs:2473
float drainBoost
Definition Player.cs:607
override Vector2 VisualPosition
Definition Player.cs:2866
void SetDummyItemTime(int frames)
Definition Player.cs:3762
static float _blizzardSoundVolume
Definition Player.cs:615
void UpdateHungerBuffs()
Definition Player.cs:11540
bool petFlagUpbeatStar
Definition Player.cs:1749
void OpenLegacyPresent(int itemType)
Definition Player.cs:6235
int armorPenetration
Definition Player.cs:1551
void UpdateMiscCounter()
Definition Player.cs:27566
void MakeFloorDust(bool Falling, int type, int paintColor)
Definition Player.cs:22838
void TryPortalJumping()
Definition Player.cs:53340
void GetGrapplingForces(Vector2 fromPosition, out int? preferredPlayerDirectionToSet, out float preferedPlayerVelocityX, out float preferedPlayerVelocityY)
Definition Player.cs:21699
bool drawingFootball
Definition Player.cs:2191
bool enabledSuperCart
Definition Player.cs:1669
BitsByte zone2
Definition Player.cs:1051
bool behindBackWall
Definition Player.cs:2591
bool iceBarrier
Definition Player.cs:891
int FindItem(int type, Item[] collection)
Definition Player.cs:52419
void TryTogglingShield(bool shouldGuard)
Definition Player.cs:29458
DirectionalInputSyncCache LocalInputCache
Definition Player.cs:1379
Vector2 itemLocation
Definition Player.cs:1183
void RecalculateLuck()
Definition Player.cs:27453
void CloseSign()
Definition Player.cs:31262
bool delayUseItem
Definition Player.cs:1483
bool petFlagDestroyerPet
Definition Player.cs:1787
void UpdateNearbyInteractibleProjectilesList()
Definition Player.cs:22048
bool hasCreditsSceneMusicBox
Definition Player.cs:2343
bool ateArtisanBread
Definition Player.cs:1665
const int SaveSlotIndexCount
Definition Player.cs:2740
int cursorItemIconPush
Definition Player.cs:1495
int CurrentLoadoutIndex
Definition Player.cs:2728
bool GetItem_VoidVault(int plr, Item[] inventory, Item newItem, GetItemSettings settings, Item returnItem)
Definition Player.cs:37206
Vector2 DefaultSize
Definition Player.cs:3423
Vector2? MouthPosition
Definition Player.cs:3559
void StatusFromNPC(NPC npc)
Definition Player.cs:21364
void UpdateBiomes()
Definition Player.cs:16067
void ApplyNPCOnHitEffects(Item sItem, Rectangle itemRectangle, int damage, float knockBack, int npcIndex, int dmgRandomized, int dmgDone)
Definition Player.cs:42241
void BordersMovement()
Definition Player.cs:23080
bool CanDemonHeartAccessoryBeShown()
Definition Player.cs:3646
bool yoraiz0rDarkness
Definition Player.cs:1637
Point FindSharpTearsSpot(Vector2 targetSpot)
Definition Player.cs:46731
int _lastSmartCursorToolStrategy
Definition Player.cs:2611
static float manaSickLessDmg
Definition Player.cs:753
Color shoeColor
Definition Player.cs:2145
void TryUpdateChannel(Projectile projectile)
Definition Player.cs:49507
bool onWrongGround
Definition Player.cs:1723
bool HasGardenGnomeNearby
Definition Player.cs:1691
bool treasureMagnet
Definition Player.cs:715
void ItemCheck_PlayInstruments(Item sItem)
Definition Player.cs:44283
bool hasRainbowCursor
Definition Player.cs:1643
bool armorEffectDrawShadowBasilisk
Definition Player.cs:1223
bool accFishingLine
Definition Player.cs:957
bool accJarOfSouls
Definition Player.cs:2165
static int manaSickTimeMax
Definition Player.cs:751
void ResizeHitbox()
Definition Player.cs:27492
void ApplyItemTime(Item sItem, float multiplier)
Definition Player.cs:3757
void ItemCheck_StartActualUse(Item sItem)
Definition Player.cs:48464
int beetleCountdown
Definition Player.cs:679
bool ItemFitsWeaponRack(Item i)
Definition Player.cs:50537
bool petFlagGolemPet
Definition Player.cs:1795
bool petFlagSugarGlider
Definition Player.cs:1751
void ItemCheck_ReleaseCritter(Item sItem)
Definition Player.cs:41867
void UpdateAdvancedShadows()
Definition Player.cs:3688
void ItemCheck_UsePetLicenses(Item sItem)
Definition Player.cs:43177
int[] shadowDirection
Definition Player.cs:1511
void OnHit(float x, float y, Entity victim)
Definition Player.cs:5855
bool petFlagDD2BetsyPet
Definition Player.cs:1815
void Counterweight(Vector2 hitPos, int dmg, float kb)
Definition Player.cs:11781
bool releaseMount
Definition Player.cs:1433
bool GetZenithTarget(Vector2 searchCenter, float maxDistance, out int npcTargetIndex)
Definition Player.cs:44433
bool dontHurtNature
Definition Player.cs:1079
void UpdateLuckFactors()
Definition Player.cs:27438
int cShieldFallback
Definition Player.cs:2517
void ItemCheck_UseMiningTools_TryPoundingTile(Item sItem, int tileHitId, ref bool hitWall, int x, int y)
Definition Player.cs:43746
void StickyMovement()
Definition Player.cs:21844
void QuickMinecart()
Definition Player.cs:5050
static bool disabledBlizzardGraphic
Definition Player.cs:611
byte luckPotion
Definition Player.cs:895
void GiveImmuneTimeForCollisionAttack(int time)
Definition Player.cs:19883
void DelBuff(int b)
Definition Player.cs:4602
void OpenFishingCrate(int crateItemID)
Definition Player.cs:7097
int[] ownedProjectileCounts
Definition Player.cs:2545
bool Spawn_GetPositionAtWorldSpawn(ref int floorX, ref int floorY)
Definition Player.cs:35878
int anglerQuestsFinished
Definition Player.cs:1543
bool hasJumpOption_Blizzard
Definition Player.cs:2241
float shadowDodgeCount
Definition Player.cs:927
bool autoReuseGlove
Definition Player.cs:1975
void ItemCheck_TryPlacingWearablesOnMannequins(Item sItem)
Definition Player.cs:49252
void UpdateEquips(int i)
Definition Player.cs:12262
bool lastStoned
Definition Player.cs:791
void KillMeForGood()
Definition Player.cs:36647
void UpdateTeleportVisuals()
Definition Player.cs:15939
float TurnAttackSpeedToUseTimeMultiplier(float speed)
Definition Player.cs:27347
static bool ItemCheck_IsValidDirtRodTarget(Tile t)
Definition Player.cs:49182
void PlaceThing_ItemInExtractinator(ref ItemCheckContext context)
Definition Player.cs:39316
bool ZoneTowerSolar
Definition Player.cs:3013
static void SavePlayer(PlayerFileData playerFile, bool skipMapSave=false)
Definition Player.cs:51176
void ItemCheck_EmitHeldItemLight(Item sItem)
Definition Player.cs:46949
int[] holdDownCardinalTimer
Definition Player.cs:1083
float specialistEffectiveDamage
Definition Player.cs:3461
Vector2 fullRotationOrigin
Definition Player.cs:1293
int BiomeCampfireHoldStyle(int itemType)
Definition Player.cs:38099
void DoEyebrellaRainEffect()
Definition Player.cs:13583
Item[] inventory
Definition Player.cs:1257
void RefreshInfoAccs()
Definition Player.cs:11997
bool _spawnVolcanoExplosion
Definition Player.cs:2455
bool GetItem_FillIntoOccupiedSlot(int plr, Item newItem, GetItemSettings settings, Item returnItem, int i)
Definition Player.cs:37278
const int defaultWidth
Definition Player.cs:1485
void FigureOutWhatToPlace(Tile targetTile, Item sItem, out int tileToCreate, out int previewPlaceStyle, out bool? overrideCanPlace, out int? forcedRandom)
Definition Player.cs:41329
bool PlaceThing_TryReplacingWalls(bool canUse)
Definition Player.cs:37613
bool[] inventoryChestStack
Definition Player.cs:1259
void ItemCheck_TryDestroyingDrones(Item sItem)
Definition Player.cs:43082
bool controlUseTile
Definition Player.cs:1393
bool petFlagSkeletronPet
Definition Player.cs:1783
bool beetleDefense
Definition Player.cs:681
bool PlaceThing_CheckSpecificValidtyCaseForBlockSwap(int tileTypeBeingPlaced, int tileTypeCurrentlyPlaced)
Definition Player.cs:37809
void VolatileGelatin(Item sourceItem)
Definition Player.cs:40558
int nextCycledSpiderMinionType
Definition Player.cs:985
Item FillAmmo(int plr, Item newItem, GetItemSettings settings)
Definition Player.cs:37067
void ProcessHitAgainstNPC(Item sItem, Rectangle itemRectangle, int originalDamage, float knockBack, int npcIndex)
Definition Player.cs:42076
bool controlUseItem
Definition Player.cs:1391
static readonly BinaryWriter _visualCloneWriter
Definition Player.cs:2748
void BrainOfConfusionDodge()
Definition Player.cs:36042
void PlayerFrame()
Definition Player.cs:33978
const int defaultHeight
Definition Player.cs:1487
bool MountFishronSpecial
Definition Player.cs:3506
static bool TryPurchasing(long price, List< Item[]> inv, List< Point > slotCoins, List< Point > slotsEmpty, List< Point > slotEmptyBank, List< Point > slotEmptyBank2, List< Point > slotEmptyBank3, List< Point > slotEmptyBank4)
Definition Player.cs:33675
void ApplyMeleeScale(ref float scale)
Definition Player.cs:40633
bool skipAnimatingValuesInPlayerFrame
Definition Player.cs:1525
void PlaceThing_Tiles_PlaceIt_AutoPaintAndActuate(int[,] typeCaches, int tileToCreate)
Definition Player.cs:38286
bool TryPlacingAGolfBallNearANearbyTee(Vector2 placePosition)
Definition Player.cs:46812
int SpawnMinionOnCursor(IEntitySource projectileSource, int ownerIndex, int minionProjectileId, int originalDamageNotScaledByMinionDamage, float KnockBack, Vector2 offsetFromCursor=default(Vector2), Vector2 velocityOnSpawn=default(Vector2))
Definition Player.cs:46703
void RefreshDoubleJumps()
Definition Player.cs:21804
float torchLuck
Definition Player.cs:2621
void Update(int i)
Definition Player.cs:23305
int mushroomDelayTime
Definition Player.cs:2447
bool petFlagIceQueenPet
Definition Player.cs:1809
static readonly PlayerFileData _visualCloneDummyData
Definition Player.cs:2744
bool accDreamCatcher
Definition Player.cs:2187
void WingFrame(bool wingFlap)
Definition Player.cs:27719
int volatileGelatinCounter
Definition Player.cs:1625
int overrideFishingBobber
Definition Player.cs:1661
void PickAmmo(Item sItem, ref int projToShoot, ref float speed, ref bool canShoot, ref int Damage, ref float KnockBack, out int usedAmmoItemId, bool dontConsume=false)
Definition Player.cs:49978
bool controlSmart
Definition Player.cs:1405
bool isPerformingJump_Unicorn
Definition Player.cs:2263
Point _inputMouseCoordsForward
Definition Player.cs:2681
bool equippedAnyTileRangeAcc
Definition Player.cs:2583
void QuickStackAllChests()
Definition Player.cs:22097
int extraAccessorySlots
Definition Player.cs:657
delegate void DashStartAction(int dashDirection)
bool UsingSuperCart
Definition Player.cs:3442
bool tileInteractionHappened
Definition Player.cs:1445
IEntitySource GetProjectileSource_TileInteraction(int tileCoordsX, int tileCoordsY)
Definition Player.cs:9322
bool canJumpAgain_WallOfFleshGoat
Definition Player.cs:2273
Item QuickMount_GetItemToUse()
Definition Player.cs:5116
bool hornetMinion
Definition Player.cs:977
int boneGloveTimer
Definition Player.cs:947
bool accWeatherRadio
Definition Player.cs:2163
void MoonLeechRope()
Definition Player.cs:21274
bool DoBootsEffect_PlaceFlamesOnTile(int X, int Y)
Definition Player.cs:13410
Item boneGloveItem
Definition Player.cs:2217
bool CanVisuallyHoldItem(Item item)
Definition Player.cs:47316
static void AdjustRespawnTimerForWorldJoining(Player newPlayer)
Definition Player.cs:52174
string lostCoinString
Definition Player.cs:603
void PlaceThing_Tiles_PlaceIt_UnslopeForSolids()
Definition Player.cs:38220
byte flameRingAlpha
Definition Player.cs:731
const int maxSolarShields
Definition Player.cs:691
static bool CheckSpawn_Internal(int x, int y)
Definition Player.cs:51059
float nearbyActiveNPCs
Definition Player.cs:1133
void OpenBossBag(int type)
Definition Player.cs:6274
bool ItemCheck_PayMana(Item sItem, bool canUse)
Definition Player.cs:49195
bool discountAvailable
Definition Player.cs:2213
TrackedProjectileReference piggyBankProjTracker
Definition Player.cs:2429
bool usedAegisCrystal
Definition Player.cs:645
bool shimmerMonolithShader
Definition Player.cs:1659
bool petFlagSpiffo
Definition Player.cs:1833
Item starCloakItem_manaCloakOverrideItem
Definition Player.cs:1985
int ladyBugLuckTimeLeft
Definition Player.cs:2643
bool shieldRaised
Definition Player.cs:2673
void ResetAdvancedShadows()
Definition Player.cs:3702
static float GetClosestPlayersLuck(Vector2 Position)
Definition Player.cs:17858
bool petFlagCaveling
Definition Player.cs:1835
bool arcticDivingGear
Definition Player.cs:1715
Rectangle legFrame
Definition Player.cs:1375
bool hasTitaniumStormBuff
Definition Player.cs:941
static SlotId _strongBlizzardSound
Definition Player.cs:617
void SpawnHallucination(Item item)
Definition Player.cs:13370
bool miniMinotaur
Definition Player.cs:1705
const int SupportedSlotsAccs
Definition Player.cs:1149
bool isFirstFractalAfterImage
Definition Player.cs:1251
ChannelCancelKey _channelShotCache
Definition Player.cs:1523
Vector2[] itemFlamePos
Definition Player.cs:765
static SlotId _insideBlizzardSound
Definition Player.cs:619
PlayerInteractionAnchor tileEntityAnchor
Definition Player.cs:2469
Vector2 RotatedRelativePointOld(Vector2 pos, bool rotateForward=true)
Definition Player.cs:3609
bool canFloatInWater
Definition Player.cs:2293
void ClearBuff(int type)
Definition Player.cs:4623
Item starCloakItem_starVeilOverrideItem
Definition Player.cs:1987
bool defendedByPaladin
Definition Player.cs:1085
bool IsProjectileInteractibleAndInInteractionRange(Projectile proj, ref Vector2 compareSpot)
Definition Player.cs:22067
bool QuickBuff_ShouldBotherUsingThisBuff(int attemptedType)
Definition Player.cs:4970
float lastEquipmentBasedLuckBonus
Definition Player.cs:2341
static int NewText(AdvancedPopupRequest request, Vector2 position)
Definition PopupText.cs:95
void CheckUsability(Player player, ref bool currentlyUsable)
static int GetBallistraShotDelay(Player player)
static void KillOldestJavelin(int protectedProjectileIndex, int projectileType, int targetNPCIndex, Point[] bufferForScan)
bool TryGetContainerIndex(out int containerIndex)
static int GetByUUID(int owner, float uuid)
static int GetExplosiveTrapCooldown(Player player)
static void RandomizeInsanityShadowFor(Entity targetEntity, bool isHostile, out Vector2 spawnposition, out Vector2 spawnvelocity, out float ai0, out float ai1)
static bool GasTrapCheck(int x, int y, Player user)
static IEntitySource InheritSource(Projectile projectile)
static int NewProjectile(IEntitySource spawnSource, Vector2 position, Vector2 velocity, int Type, int Damage, float KnockBack, int Owner=-1, float ai0=0f, float ai1=0f, float ai2=0f)
static int NewRainForced(Vector2 Position, Vector2 Velocity)
Definition Rain.cs:149
static void UpdateItemVariants()
Definition Recipe.cs:748
static void FindRecipes(bool canDelayCheck=false)
Definition Recipe.cs:453
static void CheckSection(int playerIndex, Vector2 position, int fluff=1)
static int GraveyardTileMin
static int GraveyardTileMax
static int ReadSign(int i, int j, bool CreateIfMissing=true)
Definition Sign.cs:24
static Terraria.Social.Base.CloudSocialModule Cloud
Definition SocialAPI.cs:18
static bool CanSpawnSandstormFriendly(Vector2 position, int expandUp, int expandDown)
byte color()
Definition Tile.cs:555
void liquidType(int liquidType)
Definition Tile.cs:233
bool nactive()
Definition Tile.cs:257
bool fullbrightWall()
Definition Tile.cs:694
bool invisibleWall()
Definition Tile.cs:521
byte liquid
Definition Tile.cs:12
bool inActive()
Definition Tile.cs:582
bool fullbrightBlock()
Definition Tile.cs:538
short frameY
Definition Tile.cs:24
void CopyPaintAndCoating(Tile other)
Definition Tile.cs:834
ushort type
Definition Tile.cs:8
short frameX
Definition Tile.cs:22
bool invisibleBlock()
Definition Tile.cs:504
bool active()
Definition Tile.cs:565
int blockType()
Definition Tile.cs:219
byte slope()
Definition Tile.cs:684
ushort wall
Definition Tile.cs:10
byte wallColor()
Definition Tile.cs:352
bool actuator()
Definition Tile.cs:667
bool halfBrick()
Definition Tile.cs:650
static Vector2 GetStringSize(DynamicSpriteFont font, string text, Vector2 baseScale, float maxWidth=-1f)
static List< TextSnippet > ParseMessage(string text, Color baseColor)
static void QuickStack(ContainerTransferContext context, bool voidStack=false)
Definition ChestUI.cs:686
static void ShowFileSavingFailError(Exception exception, string filePath)
static bool HighlightNewItems
Definition ItemSlot.cs:26
static bool DisableLeftShiftTrashCan
Definition ItemSlot.cs:22
static void SetGlow(int index, float hue, bool chest)
Definition ItemSlot.cs:249
static void RecordLoadoutChange()
Definition ItemSlot.cs:2228
static bool Exists(string path, bool cloud)
static void ProtectedInvoke(Action action)
static byte[] ReadAllBytes(string path, bool cloud)
static void Move(string source, string destination, bool cloud, bool overwrite=true, bool forceDeleteSourceFile=false)
static void Copy(string source, string destination, bool cloud, bool overwrite=true)
static void Delete(string path, bool cloud, bool forceDeleteFile=false)
static bool TryCreatingDirectory(string folderPath)
Definition Utils.cs:754
static Vector2 RandomVector2(UnifiedRandom random, float min, float max)
Definition Utils.cs:1823
delegate bool TileActionAttempt(int x, int y)
static ChaseResults GetChaseResults(Vector2 chaserPosition, float chaserSpeed, Vector2 runnerPosition, Vector2 runnerVelocity)
Definition Utils.cs:247
static float GetLerpValue(float from, float to, float t, bool clamped=false)
Definition Utils.cs:203
static long CoinsCombineStacks(out bool overFlowing, params long[] coinCounts)
Definition Utils.cs:679
static bool PlotTileArea(int x, int y, TileActionAttempt plot)
Definition Utils.cs:1765
static bool PlotTileLine(Vector2 start, Vector2 end, float width, TileActionAttempt plot)
Definition Utils.cs:1670
static void ClampWithinWorld(ref int minX, ref int minY, ref int maxX, ref int maxY, bool lastValuesInclusiveToIteration=false, int fluffX=0, int fluffY=0)
Definition Utils.cs:238
static long CoinsCount(out bool overFlowing, Item[] inv, params int[] ignoreSlots)
Definition Utils.cs:636
static float LineRectangleDistance(Rectangle rect, Vector2 lineStart, Vector2 lineEnd)
Definition Utils.cs:421
static Rectangle CenteredRectangle(Vector2 center, Vector2 size)
Definition Utils.cs:604
static bool Actuate(int i, int j)
Definition Wiring.cs:363
static void MassWireOperation(Point ps, Point pe, Player master)
Definition Wiring.cs:393
static void PokeLogicGate(int lampX, int lampY)
Definition Wiring.cs:354
static void HitSwitch(int i, int j)
Definition Wiring.cs:237
TileScanner Output(Dictionary< ushort, int > resultsOutput)
Definition Actions.cs:86
static GenSearch Chain(GenSearch search, params GenCondition[] conditions)
Definition Searches.cs:123
static bool Find(Point origin, GenSearch search, out Point result)
Definition WorldUtils.cs:27
static bool Gen(Point origin, GenShape shape, GenAction action)
Definition WorldUtils.cs:17
static void StartImpendingDoom(int countdownTime)
static void KillTile_GetItemDrops(int x, int y, Tile tileCache, out int dropItem, out int dropItemStack, out int secondaryItem, out int secondaryItemStack, bool includeLargeObjectDrops=false)
static bool IsTreeType(int tree)
static bool IsChestRigged(int x, int y)
static bool SolidTileNoAttach(int i, int j)
static void SwitchMonolith(int i, int j)
static bool SolidTile(Tile testTile)
static void CheckAchievement_RealEstateAndTownSlimes()
Definition WorldGen.cs:2158
static bool PlaceWire2(int i, int j)
static bool OpenDoor(int i, int j, int direction)
static bool IsTileReplacable(int x, int y)
static void SwitchMB(int i, int j)
static void LaunchRocketSmall(int x, int y, bool fromWiring)
static void KillTile(int i, int j, bool fail=false, bool effectOnly=false, bool noItem=false)
static int GetItemDrop_Chair(int style)
static bool KillWire3(int i, int j)
static bool PlaceTile(int i, int j, int Type, bool mute=false, bool forced=false, int plr=-1, int style=0)
static bool PoundTile(int i, int j)
static bool IsLockedDoor(int x, int y)
static bool SolidTile3(int i, int j)
static bool CloseDoor(int i, int j, bool forced=false)
static bool ShiftTallGate(int x, int y, bool closing, bool forced=false)
static bool CanKillTile(int i, int j, SpecialKillTileContext context)
static int GetItemDrop_Benches(int style)
static bool KillWire4(int i, int j)
static bool WouldTileReplacementWork(ushort attemptingToReplaceWith, int x, int y)
static bool PlaceWire3(int i, int j)
static bool SolidTile2(Tile testTile)
static bool crimson
Definition WorldGen.cs:932
static bool paintWall(int x, int y, byte color, bool broadCast=false)
static bool ShiftTrapdoor(int x, int y, bool playerAbove, int onlyCloseOrOpen=-1)
static bool InAPlaceWithWind(Vector2 position, int width, int height)
static bool KillWire(int i, int j)
static bool oceanDepths(int x, int y)
Definition WorldGen.cs:7142
static bool StartRoomCheck(int x, int y)
Definition WorldGen.cs:2581
static bool PlaceWire4(int i, int j)
static void setXmasTree(int x, int y, int obj, int style)
static void SwitchFountain(int i, int j)
static int KillTile_MakeTileDust(int i, int j, Tile tileCache)
static Point GetTopLeftAndStyles(ref int x, ref int y, int w, int h, int frameXinc, int frameYinc)
static bool SlopeTile(int i, int j, int slope=0, bool noEffects=false)
static bool paintTile(int x, int y, byte color, bool broadCast=false)
static bool KillWire2(int i, int j)
static void UnlockDoor(int i, int j)
static void KillWall(int i, int j, bool fail=false)
static int PlatformProperSides(int x, int y, bool acceptNonOpposing=false)
static bool IsFitToPlaceFlowerIn(int x, int y, int typeAttemptedToPlace)
static void saveToonWhilePlaying()
Definition WorldGen.cs:3308
static bool BunnyCannonCanFire()
static void LaunchRocket(int x, int y, bool fromWiring)
static void dropXmasTree(int x, int y, int obj)
static int checkXmasTreeDrop(int x, int y, int obj)
static bool PlaceWire(int i, int j)
static void PlaceWall(int i, int j, int type, bool mute=false)
static void ToggleGemLock(int i, int j, bool on)
static bool SolidTileAllowBottomSlope(int i, int j)
static void KillTile_PlaySounds(int i, int j, bool fail, Tile tileCache)
static int KillTile_GetTileDustAmount(bool fail, Tile tileCache)
static int GetItemDrop_PicnicTables(int style)
static bool paintCoatWall(int x, int y, byte paintCoatId, bool broadcast=false)
static bool ReplaceWall(int x, int y, ushort targetWall)
static bool InWorld(int x, int y, int fluff=0)
Definition WorldGen.cs:5816
static void ShootFromCannon(int x, int y, int angle, int ammo, int Damage, float KnockBack, int owner, bool fromWire)
static bool IsRope(int x, int y)
static bool PlaceActuator(int i, int j)
static void SquareTileFrame(int i, int j, bool resetFrame=true)
static bool CanCutTile(int x, int y, TileCuttingContext context)
static bool IsHarvestableHerbWithSeed(int type, int style)
static bool NearFriendlyWall(int x, int y)
static bool paintCoatTile(int x, int y, byte paintCoatId, bool broadcast=false)
static bool WouldTileReplacementBeBlockedByLiquid(int x, int y, int liquidType)
static bool ReplaceTile(int x, int y, ushort targetType, int targetStyle)
static bool SolidOrSlopedTile(Tile tile)
static bool KillActuator(int i, int j)
static int GetItemDrop_Toilet(int style)
static Color Multiply(Color value, float scale)
Definition Color.cs:513
static Color Transparent
Definition Color.cs:76
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491
static Matrix CreateRotationZ(float radians)
Definition Matrix.cs:746
void Inflate(int horizontalAmount, int verticalAmount)
Definition Rectangle.cs:84
bool Intersects(Rectangle value)
Definition Rectangle.cs:129
static Rectangle Intersect(Rectangle value1, Rectangle value2)
Definition Rectangle.cs:143
bool Contains(int x, int y)
Definition Rectangle.cs:92
static float Dot(Vector2 value1, Vector2 value2)
Definition Vector2.cs:121
static Vector2 Transform(Vector2 position, Matrix matrix)
Definition Vector2.cs:317
static float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91
static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:227
static readonly SlotId Invalid
Definition SlotId.cs:5
static DateTime Now
Definition DateTime.cs:103
static unsafe DateTime UtcNow
Definition DateTime.cs:142
static readonly TimeSpan Zero
Definition TimeSpan.cs:21
static ContainerTransferContext FromProjectile(Projectile projectile)
static ContainerTransferContext FromBlockPosition(int x, int y)
void SetStats(int heightBoost, int visualYOffset, int mapYOffset)
void GetRanges(Player player, out int x, out int y)
void GetSittingOffsetInfo(Player player, out Vector2 posOffset, out float seatAdjustment)
void GetSleepingOffsetInfo(Player player, out Vector2 posOffset)
readonly bool CanGoIntoVoidVault
static GetItemSettings GetItemInDropItemCheck
static GetItemSettings PickupItemFromWorld
static GetItemSettings ItemCreatedFromItemUsage
static GetItemSettings NPCEntityToPlayerInventorySettings
void HandlePostAction(Item item)
void TryTracking(Projectile projectile)
Definition Player.cs:114
bool Matches(Projectile projectile)
Definition Player.cs:105
CompositeArmData(bool enabled, CompositeArmStretchAmount intendedStrech, float rotation)
Definition Player.cs:207
CompositeArmStretchAmount stretch
Definition Player.cs:203
readonly bool ItemIsGoingToVoidVault
Definition Player.cs:234
ItemSpaceStatus(bool CanTakeItem, bool ItemIsGoingToVoidVault=false)
Definition Player.cs:248
void NewMessage(string message, int displayTime)
Definition Player.cs:566
void UpdateFrame(int displayFrameMin, int displayFrameMax, int exitAIState, int gameFramesPerDisplayFrame)
Definition Player.cs:177
delegate void UseToolAction(Player user, Item item, int targetX, int targetY)
delegate bool CanUseToolCondition(Player user, Item item, int targetX, int targetY)
static ShoppingSettings NotInShop
static bool Place(TileObject toBePlaced)
Definition TileObject.cs:29
static bool CanPlace(int x, int y, int type, int style, int dir, out TileObject objectData, bool onlyCheck=false, int? forcedRandom=null)
static TileObjectPreviewData objectPreview
Definition TileObject.cs:27