// Decompiled with JetBrains decompiler // Type: Terraria.Player // Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null // MVID: 68659D26-2BE6-448F-8663-74FA559E6F08 // Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; using ReLogic.Utilities; using System; using System.Collections.Generic; using System.IO; using System.Security.Cryptography; using System.Text; using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; using Terraria.GameContent; using Terraria.GameContent.Achievements; using Terraria.GameContent.Events; using Terraria.GameContent.Tile_Entities; using Terraria.GameContent.UI; using Terraria.GameInput; using Terraria.Graphics.Capture; using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.IO; using Terraria.Localization; using Terraria.ObjectData; using Terraria.Social; using Terraria.UI; using Terraria.UI.Chat; using Terraria.UI.Gamepad; using Terraria.Utilities; using Terraria.World.Generation; namespace Terraria { public class Player : Entity { private static byte[] ENCRYPTION_KEY = new UnicodeEncoding().GetBytes("h3y_gUyZ"); public Player.OverheadMessage chatOverhead; public Player.SelectionRadial DpadRadial = new Player.SelectionRadial(); public Player.SelectionRadial CircularRadial = new Player.SelectionRadial(Player.SelectionRadial.SelectionMode.RadialCircular); public Player.SelectionRadial QuicksRadial = new Player.SelectionRadial(Player.SelectionRadial.SelectionMode.RadialQuicks); public bool alchemyTable; public int HotbarOffset; public bool GoingDownWithGrapple; public byte spelunkerTimer; public bool[] hideInfo = new bool[13]; public int[] builderAccStatus = new int[10]; public int lostCoins; public string lostCoinString = ""; public int soulDrain; public float drainBoost; public bool dd2Accessory; private static float _blizzardSoundVolume = 0.0f; private static SlotId _strongBlizzardSound = (SlotId) SlotId.Invalid; private static SlotId _weakBlizzardSound = (SlotId) SlotId.Invalid; private static SlotId _insideBlizzardSound = (SlotId) SlotId.Invalid; public string name = ""; public int taxMoney; public int taxTimer; public static int taxRate = 3600; public static int crystalLeafDamage = 100; public static int crystalLeafKB = 10; public float basiliskCharge; public bool[] NPCBannerBuff = new bool[267]; public bool hasBanner; public Vector2 lastDeathPostion; public DateTime lastDeathTime; public bool showLastDeath; public int extraAccessorySlots = 2; public bool extraAccessory; public int tankPet = -1; public bool tankPetReset; public int stringColor; public int counterWeight; public bool yoyoString; public bool yoyoGlove; public int beetleOrbs; public float beetleCounter; public int beetleCountdown; public bool beetleDefense; public bool beetleOffense; public bool beetleBuff; public int solarShields; public int solarCounter; public const int maxSolarShields = 3; public Vector2[] solarShieldPos = new Vector2[3]; public Vector2[] solarShieldVel = new Vector2[3]; public bool solarDashing; public bool solarDashConsumedFlare; public const int nebulaMaxLevel = 3; public int nebulaLevelLife; public int nebulaLevelMana; public int nebulaManaCounter; public int nebulaLevelDamage; public bool manaMagnet; public bool lifeMagnet; public bool lifeForce; public bool calmed; public bool inferno; public float flameRingRot; public float flameRingScale = 1f; public byte flameRingFrame; public byte flameRingAlpha; public int netManaTime; public int netLifeTime; public bool netMana; public bool netLife; public Vector2[] beetlePos = new Vector2[3]; public Vector2[] beetleVel = new Vector2[3]; public int beetleFrame; public int beetleFrameCounter; public static int manaSickTime = 300; public static int manaSickTimeMax = 600; public static float manaSickLessDmg = 0.25f; public float manaSickReduction; public bool manaSick; public bool stairFall; public int loadStatus; public Vector2[] itemFlamePos = new Vector2[7]; public int itemFlameCount; public bool outOfRange; public float lifeSteal = 99999f; public float ghostDmg; public bool teleporting; public float teleportTime; public int teleportStyle; public bool sloping; public bool chilled; public bool dazed; public bool frozen; public bool stoned; public bool lastStoned; public bool ichor; public bool webbed; public bool noBuilding; public int ropeCount; public int manaRegenBonus; public int manaRegenDelayBonus; public int dash; public int dashTime; public int dashDelay; public int eocDash; public int eocHit; public float accRunSpeed; public bool cordage; public int gem = -1; public int gemCount; public BitsByte ownedLargeGems; public byte meleeEnchant; public byte pulleyDir; public bool pulley; public int pulleyFrame; public float pulleyFrameCounter; public bool blackBelt; public bool sliding; public int slideDir; public int launcherWait; public bool iceSkate; public bool carpet; public int spikedBoots; public int carpetFrame = -1; public float carpetFrameCounter; public bool canCarpet; public int carpetTime; public int miscCounter; public int infernoCounter; public bool sandStorm; public bool crimsonRegen; public bool ghostHeal; public bool ghostHurt; public bool sticky; public bool slippy; public bool slippy2; public bool powerrun; public bool flapSound; public bool iceBarrier; public bool dangerSense; public float endurance; public bool loveStruck; public bool stinky; public bool resistCold; public bool electrified; public bool dryadWard; public bool panic; public bool brainOfConfusion; public byte iceBarrierFrame; public byte iceBarrierFrameCounter; public bool shadowDodge; public float shadowDodgeCount; public bool palladiumRegen; public bool onHitDodge; public bool onHitRegen; public bool onHitPetal; public int petalTimer; public int shadowDodgeTimer; public int phantomPhoneixCounter; public int fishingSkill; public bool cratePotion; public bool sonarPotion; public bool accFishingLine; public bool accTackleBox; public int maxMinions = 1; public int numMinions; public float slotsMinions; public bool pygmy; public bool raven; public bool slime; public bool hornetMinion; public bool impMinion; public bool twinsMinion; public bool spiderMinion; public bool pirateMinion; public bool sharknadoMinion; public bool UFOMinion; public bool DeadlySphereMinion; public bool stardustMinion; public bool stardustGuardian; public bool stardustDragon; public float wingTime; public int wings; public int wingsLogic; public int wingTimeMax; public int wingFrame; public int wingFrameCounter; public int skinVariant; public bool ghost; public int ghostFrame; public int ghostFrameCounter; public int miscTimer; public bool pvpDeath; public BitsByte zone1 = (BitsByte) (byte) 0; public BitsByte zone2 = (BitsByte) (byte) 0; public BitsByte zone3 = (BitsByte) (byte) 0; public BitsByte zone4 = (BitsByte) (byte) 0; public bool boneArmor; public bool frostArmor; public bool honey; public bool crystalLeaf; public int[] doubleTapCardinalTimer = new int[4]; public int[] holdDownCardinalTimer = new int[4]; public bool defendedByPaladin; public bool hasPaladinShield; public float[] speedSlice = new float[60]; public float townNPCs; public double headFrameCounter; public double bodyFrameCounter; public double legFrameCounter; public int netSkip; public int oldSelectItem; public bool immune; public bool immuneNoBlink; public int immuneTime; public int immuneAlphaDirection; public int immuneAlpha; public int team; public bool hbLocked; public static int nameLen = 20; public float maxRegenDelay; public int sign = -1; public bool editedChestName; public int reuseDelay; public int aggro; public float activeNPCs; public bool mouseInterface; public bool lastMouseInterface; public int noThrow; public int changeItem = -1; public int selectedItem; public const int SupportedSlotsArmor = 3; public const int SupportedSlotsAccs = 7; public const int SupportedSlotSets = 10; public const int InitialAccSlotCount = 5; public const int miscSlotPet = 0; public const int miscSlotLight = 1; public const int miscSlotCart = 2; public const int miscSlotMount = 3; public const int miscSlotHook = 4; public Item[] armor = new Item[20]; public Item[] dye = new Item[10]; public Item[] miscEquips = new Item[5]; public Item[] miscDyes = new Item[5]; public Item trashItem = new Item(); public int itemAnimation; public int itemAnimationMax; public int itemTime; public int toolTime; public float itemRotation; public int itemWidth; public int itemHeight; public Vector2 itemLocation; public bool poundRelease; public float ghostFade; public float ghostDir = 1f; public const int maxBuffs = 22; public int[] buffType = new int[22]; public int[] buffTime = new int[22]; public bool[] buffImmune = new bool[206]; public int heldProj = -1; public int breathCD; public int breathMax = 200; public int breath = 200; public int lavaCD; public int lavaMax; public int lavaTime; public bool ignoreWater; public bool armorEffectDrawShadow; public bool armorEffectDrawShadowSubtle; public bool armorEffectDrawOutlines; public bool armorEffectDrawShadowLokis; public bool armorEffectDrawShadowBasilisk; public bool armorEffectDrawOutlinesForbidden; public bool armorEffectDrawShadowEOCShield; public bool socialShadowRocketBoots; public bool socialGhost; public bool shroomiteStealth; public bool socialIgnoreLight; public int stealthTimer; public float stealth = 1f; public string setBonus = ""; public Item[] inventory = new Item[59]; public bool[] inventoryChestStack = new bool[59]; public Chest bank = new Chest(true); public Chest bank2 = new Chest(true); public Chest bank3 = new Chest(true); public float headRotation; public float bodyRotation; public float legRotation; public Vector2 headPosition; public Vector2 bodyPosition; public Vector2 legPosition; public Vector2 headVelocity; public Vector2 bodyVelocity; public Vector2 legVelocity; public float fullRotation; public Vector2 fullRotationOrigin = Vector2.Zero; public int nonTorch = -1; public float gfxOffY; public float stepSpeed = 1f; public static bool deadForGood = false; public bool dead; public int respawnTimer; public int attackCD; public int potionDelay; public byte difficulty; public byte wetSlime; public HitTile hitTile; public int jump; public int head = -1; public int body = -1; public int legs = -1; public sbyte handon = -1; public sbyte handoff = -1; public sbyte back = -1; public sbyte front = -1; public sbyte shoe = -1; public sbyte waist = -1; public sbyte shield = -1; public sbyte neck = -1; public sbyte face = -1; public sbyte balloon = -1; public bool[] hideVisual = new bool[10]; public BitsByte hideMisc = (BitsByte) (byte) 0; public Microsoft.Xna.Framework.Rectangle headFrame; public Microsoft.Xna.Framework.Rectangle bodyFrame; public Microsoft.Xna.Framework.Rectangle legFrame; public Microsoft.Xna.Framework.Rectangle hairFrame; public bool controlLeft; public bool controlRight; public bool controlUp; public bool controlDown; public bool controlJump; public bool controlUseItem; public bool controlUseTile; public bool controlThrow; public bool controlInv; public bool controlHook; public bool controlTorch; public bool controlMap; public bool controlSmart; public bool controlMount; public bool releaseJump; public bool releaseUp; public bool releaseUseItem; public bool releaseUseTile; public bool releaseInventory; public bool releaseHook; public bool releaseThrow; public bool releaseQuickMana; public bool releaseQuickHeal; public bool releaseLeft; public bool releaseRight; public bool releaseSmart; public bool releaseMount; public bool releaseDown; public bool controlQuickMana; public bool controlQuickHeal; public bool tileInteractionHappened; public bool tileInteractAttempted; public int altFunctionUse; public bool mapZoomIn; public bool mapZoomOut; public bool mapAlphaUp; public bool mapAlphaDown; public bool mapFullScreen; public bool mapStyle; public bool releaseMapFullscreen; public bool releaseMapStyle; public int leftTimer; public int rightTimer; public bool delayUseItem; public const int defaultWidth = 20; public const int defaultHeight = 42; public bool showItemIcon; public bool showItemIconR; public int showItemIcon2; public string showItemIconText = ""; public int runSoundDelay; public float shadow; public const int shadowMax = 3; public Vector2[] shadowPos = new Vector2[3]; public float[] shadowRotation = new float[3]; public Vector2[] shadowOrigin = new Vector2[3]; public int[] shadowDirection = new int[3]; public int shadowCount; public float manaCost = 1f; public bool fireWalk; public bool channel; public int step = -1; public int anglerQuestsFinished; public int bartenderQuestLog; public bool downedDD2EventAnyDifficulty; public int armorPenetration; public int statDefense; public int statLifeMax = 100; public int statLifeMax2 = 100; public int statLife = 100; public int statMana; public int statManaMax; public int statManaMax2; public int lifeRegen; public int lifeRegenCount; public int lifeRegenTime; public int manaRegen; public int manaRegenCount; public int manaRegenDelay; public bool manaRegenBuff; public bool noKnockback; public bool spaceGun; public float gravDir = 1f; public bool ammoCost80; public bool ammoCost75; public int stickyBreak; public bool magicQuiver; public bool magmaStone; public bool lavaRose; public int phantasmTime; public bool ammoBox; public bool ammoPotion; public bool chaosState; public bool strongBees; public bool sporeSac; public bool shinyStone; public int yoraiz0rEye; public bool yoraiz0rDarkness; public bool leinforsHair; public bool suspiciouslookingTentacle; public bool crimsonHeart; public bool lightOrb; public bool blueFairy; public bool redFairy; public bool greenFairy; public bool bunny; public bool turtle; public bool eater; public bool penguin; public bool magicLantern; public bool rabid; public bool sunflower; public bool wellFed; public bool puppy; public bool grinch; public bool miniMinotaur; public bool arcticDivingGear; public bool wearsRobe; public bool minecartLeft; public bool onWrongGround; public bool onTrack; public int cartRampTime; public bool cartFlip; public float trackBoost; public Vector2 lastBoost = Vector2.Zero; public Mount mount; public bool blackCat; public bool spider; public bool squashling; public bool petFlagDD2Gato; public bool petFlagDD2Ghost; public bool petFlagDD2Dragon; public bool companionCube; public bool babyFaceMonster; public bool magicCuffs; public bool coldDash; public bool sailDash; public bool eyeSpring; public bool snowman; public bool scope; public bool dino; public bool skeletron; public bool hornet; public bool zephyrfish; public bool tiki; public bool parrot; public bool truffle; public bool sapling; public bool cSapling; public bool wisp; public bool lizard; public bool archery; public bool poisoned; public bool venom; public bool blind; public bool blackout; public bool headcovered; public bool frostBurn; public bool onFrostBurn; public bool burned; public bool suffocating; public byte suffocateDelay; public bool dripping; public bool drippingSlime; public bool onFire; public bool onFire2; public bool noItems; public bool windPushed; public bool wereWolf; public bool wolfAcc; public bool hideMerman; public bool hideWolf; public bool forceMerman; public bool forceWerewolf; public bool rulerGrid; public bool rulerLine; public bool bleed; public bool confused; public bool accMerman; public bool merman; public bool brokenArmor; public bool silence; public bool slow; public bool gross; public bool tongued; public bool kbGlove; public bool kbBuff; public bool starCloak; public bool longInvince; public bool pStone; public bool manaFlower; public bool moonLeech; public bool vortexDebuff; public bool trapDebuffSource; public bool witheredArmor; public bool witheredWeapon; public bool slowOgreSpit; public bool parryDamageBuff; public bool ballistaPanic; public int meleeCrit = 4; public int rangedCrit = 4; public int magicCrit = 4; public int thrownCrit = 4; public float meleeDamage = 1f; public float rangedDamage = 1f; public float thrownDamage = 1f; public float bulletDamage = 1f; public float arrowDamage = 1f; public float rocketDamage = 1f; public float magicDamage = 1f; public float minionDamage = 1f; public float minionKB; public float meleeSpeed = 1f; public float thrownVelocity = 1f; public bool thrownCost50; public bool thrownCost33; public float moveSpeed = 1f; public float pickSpeed = 1f; public float wallSpeed = 1f; public float tileSpeed = 1f; public bool autoPaint; public bool autoActuator; public int SpawnX = -1; public int SpawnY = -1; public int[] spX = new int[200]; public int[] spY = new int[200]; public string[] spN = new string[200]; public int[] spI = new int[200]; public static int tileRangeX = 5; public static int tileRangeY = 4; public int lastTileRangeX; public int lastTileRangeY; public static int tileTargetX; public static int tileTargetY; public static float defaultGravity = 0.4f; public static int jumpHeight = 15; public static float jumpSpeed = 5.01f; public float gravity = Player.defaultGravity; public float maxFallSpeed = 10f; public float maxRunSpeed = 3f; public float runAcceleration = 0.08f; public float runSlowdown = 0.2f; public bool adjWater; public bool adjHoney; public bool adjLava; public bool oldAdjWater; public bool oldAdjHoney; public bool oldAdjLava; public bool[] adjTile = new bool[470]; public bool[] oldAdjTile = new bool[470]; public static int defaultItemGrabRange = 38; private static float itemGrabSpeed = 0.45f; private static float itemGrabSpeedMax = 4f; public byte hairDye; public Color hairDyeColor = Color.Transparent; public float hairDyeVar; public Color hairColor = new Color(215, 90, 55); public Color skinColor = new Color((int) byte.MaxValue, 125, 90); public Color eyeColor = new Color(105, 90, 75); public Color shirtColor = new Color(175, 165, 140); public Color underShirtColor = new Color(160, 180, 215); public Color pantsColor = new Color((int) byte.MaxValue, 230, 175); public Color shoeColor = new Color(160, 105, 60); public int hair; public bool hostile; public SoundPlaySet hermesStepSound = new SoundPlaySet(); public int accCompass; public int accWatch; public int accDepthMeter; public bool accFishFinder; public bool accWeatherRadio; public bool accJarOfSouls; public bool accCalendar; public int lastCreatureHit = -1; public bool accThirdEye; public byte accThirdEyeCounter; public byte accThirdEyeNumber; public bool accStopwatch; public bool accOreFinder; public int bestOre = -1; public bool accCritterGuide; public byte accCritterGuideCounter; public byte accCritterGuideNumber; public bool accDreamCatcher; public bool ActuationRodLock; public bool ActuationRodLockSetting; public bool InfoAccMechShowWires; public DateTime dpsStart; public DateTime dpsEnd; public DateTime dpsLastHit; public int dpsDamage; public bool dpsStarted; public string displayedFishingInfo = ""; public bool discount; public bool coins; public bool goldRing; public bool accDivingHelm; public bool accFlipper; public bool doubleJumpCloud; public bool jumpAgainCloud; public bool dJumpEffectCloud; public bool doubleJumpSandstorm; public bool jumpAgainSandstorm; public bool dJumpEffectSandstorm; public bool doubleJumpBlizzard; public bool jumpAgainBlizzard; public bool dJumpEffectBlizzard; public bool doubleJumpFart; public bool jumpAgainFart; public bool dJumpEffectFart; public bool doubleJumpSail; public bool jumpAgainSail; public bool dJumpEffectSail; public bool doubleJumpUnicorn; public bool jumpAgainUnicorn; public bool dJumpEffectUnicorn; public bool autoJump; public bool justJumped; public float jumpSpeedBoost; public int extraFall; public bool spawnMax; public int blockRange; public int[] grappling = new int[20]; public int grapCount; public int rocketTime; public int rocketTimeMax = 7; public int rocketDelay; public int rocketDelay2; public bool rocketRelease; public bool rocketFrame; public int rocketBoots; public bool canRocket; public bool jumpBoost; public bool noFallDmg; public int swimTime; public bool killGuide; public bool killClothier; public bool lavaImmune; public bool gills; public bool slowFall; public bool findTreasure; public bool invis; public bool detectCreature; public bool nightVision; public bool enemySpawns; public float thorns; public bool turtleArmor; public bool turtleThorns; public bool spiderArmor; public bool setSolar; public bool setVortex; public bool setNebula; public int nebulaCD; public bool setStardust; public bool setForbidden; public bool setForbiddenCooldownLocked; public bool setSquireT3; public bool setHuntressT3; public bool setApprenticeT3; public bool setMonkT3; public bool setSquireT2; public bool setHuntressT2; public bool setApprenticeT2; public bool setMonkT2; public int maxTurrets = 1; public int maxTurretsOld = 1; public bool vortexStealthActive; public bool waterWalk; public bool waterWalk2; public bool gravControl; public bool gravControl2; public bool bee; public int wireOperationsCooldown; public int lastChest; public int flyingPigChest = -1; public int chest = -1; public int chestX; public int chestY; public int talkNPC = -1; public int fallStart; public int fallStart2; public int potionDelayTime = Item.potionDelay; public int restorationDelayTime = Item.restorationDelay; public int cHead; public int cBody; public int cLegs; public int cHandOn; public int cHandOff; public int cBack; public int cFront; public int cShoe; public int cWaist; public int cShield; public int cNeck; public int cFace; public int cBalloon; public int cWings; public int cCarpet; public int cGrapple; public int cMount; public int cMinecart; public int cPet; public int cLight; public int cYorai; public int[] ownedProjectileCounts = new int[714]; public bool[] npcTypeNoAggro = new bool[580]; public int lastPortalColorIndex; public int _portalPhysicsTime; public bool portalPhysicsFlag; public float MountFishronSpecialCounter; public Vector2 MinionRestTargetPoint = Vector2.Zero; public int MinionAttackTargetNPC = -1; public List TouchedTiles = new List(); public static int StopMoneyTroughFromWorking = 3; private bool makeStrongBee; public bool behindBackWall; public int _funkytownCheckCD; private float _stormShaderObstruction = 1f; private float _shaderObstructionInternalValue = 1f; private int _quickGrappleCooldown; public const int SHIELD_PARRY_DURATION = 20; public const int SHIELD_PARRY_DURATION_DRAWING_TWEAKER = 20; public const int SHIELD_PARRY_DAMAGE_BUFF_MULTIPLIER = 5; public bool hasRaisableShield; public bool shieldRaised; public int shieldParryTimeLeft; public int shield_parry_cooldown; public int[] hurtCooldowns = new int[2]; public static bool lastPound = true; public Vector2 BlehOldPositionFixer => -Vector2.UnitY; public Vector2 MountedCenter { get => new Vector2(this.position.X + (float) (this.width / 2), this.position.Y + 21f + (float) this.mount.PlayerOffsetHitbox); set => this.position = new Vector2(value.X - (float) (this.width / 2), value.Y - 21f - (float) this.mount.PlayerOffsetHitbox); } public void RotateRelativePoint(ref float x, ref float y) { Vector2 vector2 = this.RotatedRelativePoint(new Vector2(x, y)); x = vector2.X; y = vector2.Y; } public Vector2 RotatedRelativePoint(Vector2 pos, bool rotateForward = true) { Vector2 vector2 = this.position + this.fullRotationOrigin; Matrix rotationZ = Matrix.CreateRotationZ(this.fullRotation * (float) rotateForward.ToInt()); pos -= this.position + this.fullRotationOrigin; pos = Vector2.Transform(pos, rotationZ); return pos + vector2; } public bool CCed => this.frozen || this.webbed || this.stoned; public bool ExtraAccessorySlotsShouldShow => this.extraAccessorySlots > 0 || this.armor[8].type > 0 || this.armor[18].type > 0 || this.dye[8].type > 0; public bool Male { get => PlayerVariantID.Sets.Male[this.skinVariant]; set { if (value) { if (this.Male) return; this.skinVariant = PlayerVariantID.Sets.AltGenderReference[this.skinVariant]; } else { if (!this.Male) return; this.skinVariant = PlayerVariantID.Sets.AltGenderReference[this.skinVariant]; } } } public bool ZoneDungeon { get => this.zone1[0]; set => this.zone1[0] = value; } public bool ZoneCorrupt { get => this.zone1[1]; set => this.zone1[1] = value; } public bool ZoneHoly { get => this.zone1[2]; set => this.zone1[2] = value; } public bool ZoneMeteor { get => this.zone1[3]; set => this.zone1[3] = value; } public bool ZoneJungle { get => this.zone1[4]; set => this.zone1[4] = value; } public bool ZoneSnow { get => this.zone1[5]; set => this.zone1[5] = value; } public bool ZoneCrimson { get => this.zone1[6]; set => this.zone1[6] = value; } public bool ZoneWaterCandle { get => this.zone1[7]; set => this.zone1[7] = value; } public bool ZonePeaceCandle { get => this.zone2[0]; set => this.zone2[0] = value; } public bool ZoneTowerSolar { get => this.zone2[1]; set => this.zone2[1] = value; } public bool ZoneTowerVortex { get => this.zone2[2]; set => this.zone2[2] = value; } public bool ZoneTowerNebula { get => this.zone2[3]; set => this.zone2[3] = value; } public bool ZoneTowerStardust { get => this.zone2[4]; set => this.zone2[4] = value; } public bool ZoneDesert { get => this.zone2[5]; set => this.zone2[5] = value; } public bool ZoneGlowshroom { get => this.zone2[6]; set => this.zone2[6] = value; } public bool ZoneUndergroundDesert { get => this.zone2[7]; set => this.zone2[7] = value; } public bool ZoneSkyHeight { get => this.zone3[0]; set => this.zone3[0] = value; } public bool ZoneOverworldHeight { get => this.zone3[1]; set => this.zone3[1] = value; } public bool ZoneDirtLayerHeight { get => this.zone3[2]; set => this.zone3[2] = value; } public bool ZoneRockLayerHeight { get => this.zone3[3]; set => this.zone3[3] = value; } public bool ZoneUnderworldHeight { get => this.zone3[4]; set => this.zone3[4] = value; } public bool ZoneBeach { get => this.zone3[5]; set => this.zone3[5] = value; } public bool ZoneRain { get => this.zone3[6]; set => this.zone3[6] = value; } public bool ZoneSandstorm { get => this.zone3[7]; set => this.zone3[7] = value; } public bool ZoneOldOneArmy { get => this.zone4[0]; set => this.zone4[0] = value; } public Vector2 Directions => new Vector2((float) this.direction, this.gravDir); public Item HeldItem => this.inventory[this.selectedItem]; public Vector2 DefaultSize => new Vector2(20f, 42f); public bool PortalPhysicsEnabled => this._portalPhysicsTime > 0 && !this.mount.Active; public bool MountFishronSpecial => this.statLife < this.statLifeMax2 / 2 || this.wet && !this.lavaWet && !this.honeyWet || this.dripping || (double) this.MountFishronSpecialCounter > 0.0; public bool HasMinionRestTarget => this.MinionRestTargetPoint != Vector2.Zero; public bool HasMinionAttackTargetNPC => this.MinionAttackTargetNPC != -1; public bool TeamChangeAllowed() => true; public void HealEffect(int healAmount, bool broadcast = true) { CombatText.NewText(new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), CombatText.HealLife, healAmount); if (!broadcast || Main.netMode != 1 || this.whoAmI != Main.myPlayer) return; NetMessage.SendData(35, number: this.whoAmI, number2: ((float) healAmount)); } public void ManaEffect(int manaAmount) { CombatText.NewText(new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), CombatText.HealMana, manaAmount); if (Main.netMode != 1 || this.whoAmI != Main.myPlayer) return; NetMessage.SendData(43, number: this.whoAmI, number2: ((float) manaAmount)); } public static byte FindClosest(Vector2 Position, int Width, int Height) { byte num1 = 0; for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active) { num1 = (byte) index; break; } } float num2 = -1f; for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active && !Main.player[index].dead) { float num3 = Math.Abs((float) ((double) Main.player[index].position.X + (double) (Main.player[index].width / 2) - ((double) Position.X + (double) (Width / 2)))) + Math.Abs((float) ((double) Main.player[index].position.Y + (double) (Main.player[index].height / 2) - ((double) Position.Y + (double) (Height / 2)))); if ((double) num2 == -1.0 || (double) num3 < (double) num2) { num2 = num3; num1 = (byte) index; } } } return num1; } public void ToggleInv() { bool interactAreShared = PlayerInput.GrappleAndInteractAreShared; if (Main.mapFullscreen) { Main.mapFullscreen = false; this.releaseInventory = false; Main.PlaySound(11); } else if (PlayerInput.InBuildingMode) { PlayerInput.ExitBuildingMode(); Main.PlaySound(11); } else if (Main.ingameOptionsWindow) { if (PlayerInput.UsingGamepadUI && UILinkPointNavigator.CurrentPage == 1002) UILinkPointNavigator.ChangePage(1001); else IngameOptions.Close(); } else if (Main.inFancyUI) IngameFancyUI.Close(); else if (CaptureManager.Instance.Active) CaptureManager.Instance.Active = false; else if (this.talkNPC >= 0) { this.talkNPC = -1; Main.npcChatCornerItem = 0; Main.npcChatText = ""; Main.PlaySound(11); if (PlayerInput.UsingGamepad) Main.npcChatRelease = false; } else if (this.sign >= 0) { this.sign = -1; Main.editSign = false; Main.npcChatText = ""; Main.PlaySound(11); } else if (Main.clothesWindow) Main.CancelClothesWindow(); else if (!Main.playerInventory) { Recipe.FindRecipes(); Main.playerInventory = true; Main.EquipPageSelected = 0; Main.PlaySound(10); } else { Main.playerInventory = false; if (!PlayerInput.UsingGamepad) { Main.EquipPageSelected = 0; } else { PlayerInput.NavigatorUnCachePosition(); Main.GamepadCursorAlpha = 0.0f; Player.StopMoneyTroughFromWorking = 3; } Main.PlaySound(11); if (ItemSlot.Options.HighlightNewItems) { foreach (Item obj in this.inventory) obj.newAndShiny = false; } } if (!interactAreShared) return; this.GamepadEnableGrappleCooldown(); } public void dropItemCheck() { if (!Main.playerInventory) this.noThrow = 0; if (this.noThrow > 0) --this.noThrow; if (!Main.InGuideCraftMenu && Main.guideItem.type > 0) { Main.guideItem.position = this.Center; Item obj = this.GetItem(this.whoAmI, Main.guideItem, noText: true); if (obj.stack > 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, obj.type, obj.stack, pfix: ((int) Main.guideItem.prefix), noGrabDelay: true); Main.item[number].newAndShiny = false; if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } Main.guideItem = new Item(); } if (!Main.InReforgeMenu && Main.reforgeItem.type > 0) { Main.reforgeItem.position = this.Center; Item obj = this.GetItem(this.whoAmI, Main.reforgeItem, noText: true); if (obj.stack > 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, obj.type, obj.stack, pfix: ((int) Main.reforgeItem.prefix), noGrabDelay: true); Main.item[number].newAndShiny = false; if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } Main.reforgeItem = new Item(); } if (Main.myPlayer == this.whoAmI) this.inventory[58] = Main.mouseItem.Clone(); bool flag = true; if (Main.mouseItem.type > 0 && Main.mouseItem.stack > 0) { if (!Main.gamePaused) { Player.tileTargetX = (int) (((double) Main.mouseX + (double) Main.screenPosition.X) / 16.0); Player.tileTargetY = (int) (((double) Main.mouseY + (double) Main.screenPosition.Y) / 16.0); if ((double) this.gravDir == -1.0) Player.tileTargetY = (int) (((double) Main.screenPosition.Y + (double) Main.screenHeight - (double) Main.mouseY) / 16.0); } if (this.selectedItem != 58) this.oldSelectItem = this.selectedItem; this.selectedItem = 58; flag = false; } if (flag && this.selectedItem == 58 && this.itemTime == 0 && this.itemAnimation == 0) this.selectedItem = this.oldSelectItem; if (WorldGen.InWorld(Player.tileTargetX, Player.tileTargetY) && Main.tile[Player.tileTargetX, Player.tileTargetY] != null && Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 334 && this.ItemFitsWeaponRack(this.inventory[this.selectedItem])) this.noThrow = 2; if (WorldGen.InWorld(Player.tileTargetX, Player.tileTargetY) && Main.tile[Player.tileTargetX, Player.tileTargetY] != null && Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 395 && this.ItemFitsItemFrame(this.inventory[this.selectedItem])) this.noThrow = 2; if (Main.mouseItem.type > 0 && !Main.playerInventory) { Main.mouseItem.position = this.Center; Item obj = this.GetItem(this.whoAmI, Main.mouseItem, noText: true); if (obj.stack > 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, obj.type, obj.stack, noGrabDelay: true); Main.item[number].newAndShiny = false; if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } Main.mouseItem = new Item(); this.inventory[58] = new Item(); Recipe.FindRecipes(); } if ((this.controlThrow && this.releaseThrow && !this.inventory[this.selectedItem].favorited && this.inventory[this.selectedItem].type > 0 && !Main.drawingPlayerChat || (Main.mouseRight && !this.mouseInterface && Main.mouseRightRelease || !Main.playerInventory) && Main.mouseItem.type > 0 && Main.mouseItem.stack > 0) && this.noThrow <= 0) this.DropSelectedItem(); if (!Main.gamePaused || this.selectedItem != 58) return; this.selectedItem = this.oldSelectItem; } public void DropSelectedItem() { bool flag1 = false; if (this.inventory[this.selectedItem].favorited) { this.inventory[this.selectedItem] = this.GetItem(this.whoAmI, this.inventory[this.selectedItem], noText: true); if (this.selectedItem == 58) Main.mouseItem = this.inventory[this.selectedItem]; Recipe.FindRecipes(); if (this.inventory[this.selectedItem].type == 0) flag1 = true; } if (flag1) return; Item obj = new Item(); bool flag2 = false; if ((Main.mouseRight && !this.mouseInterface && Main.mouseRightRelease || !Main.playerInventory) && Main.mouseItem.type > 0 && Main.mouseItem.stack > 0) { obj = this.inventory[this.selectedItem]; this.inventory[this.selectedItem] = Main.mouseItem; this.delayUseItem = true; this.controlUseItem = false; flag2 = true; } int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, this.inventory[this.selectedItem].type); if (!flag2 && this.inventory[this.selectedItem].type == 8 && this.inventory[this.selectedItem].stack > 1) { --this.inventory[this.selectedItem].stack; } else { this.inventory[this.selectedItem].position = Main.item[number].position; Main.item[number] = this.inventory[this.selectedItem]; this.inventory[this.selectedItem] = new Item(); if (this.selectedItem == 58) Main.mouseItem = new Item(); } if (Main.netMode == 0) Main.item[number].noGrabDelay = 100; Main.item[number].velocity.Y = -2f; Main.item[number].velocity.X = (float) (4 * this.direction) + this.velocity.X; Main.item[number].favorited = false; Main.item[number].newAndShiny = false; if ((Main.mouseRight && !this.mouseInterface || !Main.playerInventory) && Main.mouseItem.type > 0) { this.inventory[this.selectedItem] = obj; Main.mouseItem = new Item(); } else { this.itemAnimation = 10; this.itemAnimationMax = 10; } Recipe.FindRecipes(); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number); } public int FindBuffIndex(int type) { if (this.buffImmune[type]) return -1; for (int index = 0; index < 22; ++index) { if (this.buffTime[index] >= 1 && this.buffType[index] == type) return index; } return -1; } public void AddBuff(int type, int time1, bool quiet = true) { if (this.buffImmune[type]) return; int num = time1; if (Main.expertMode && this.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)) num = (int) ((double) Main.expertDebuffTime * (double) num); if (!quiet && Main.netMode == 1) { bool flag = true; for (int index = 0; index < 22; ++index) { if (this.buffType[index] == type) { flag = false; break; } } if (flag) NetMessage.SendData(55, number: this.whoAmI, number2: ((float) type), number3: ((float) num)); } int index1 = -1; for (int index2 = 0; index2 < 22; ++index2) { if (this.buffType[index2] == type) { if (type == 94) { this.buffTime[index2] += num; if (this.buffTime[index2] <= Player.manaSickTimeMax) return; this.buffTime[index2] = Player.manaSickTimeMax; return; } if (this.buffTime[index2] >= num) return; this.buffTime[index2] = num; return; } } if (Main.vanityPet[type] || Main.lightPet[type]) { for (int b = 0; b < 22; ++b) { if (Main.vanityPet[type] && Main.vanityPet[this.buffType[b]]) this.DelBuff(b); if (Main.lightPet[type] && Main.lightPet[this.buffType[b]]) this.DelBuff(b); } } while (index1 == -1) { int b = -1; for (int index3 = 0; index3 < 22; ++index3) { if (!Main.debuff[this.buffType[index3]]) { b = index3; break; } } if (b == -1) return; for (int index4 = b; index4 < 22; ++index4) { if (this.buffType[index4] == 0) { index1 = index4; break; } } if (index1 == -1) this.DelBuff(b); } this.buffType[index1] = type; this.buffTime[index1] = num; if (!Main.meleeBuff[type]) return; for (int b = 0; b < 22; ++b) { if (b != index1 && Main.meleeBuff[this.buffType[b]]) this.DelBuff(b); } } public void DelBuff(int b) { this.buffTime[b] = 0; this.buffType[b] = 0; for (int index1 = 0; index1 < 21; ++index1) { if (this.buffTime[index1] == 0 || this.buffType[index1] == 0) { for (int index2 = index1 + 1; index2 < 22; ++index2) { this.buffTime[index2 - 1] = this.buffTime[index2]; this.buffType[index2 - 1] = this.buffType[index2]; this.buffTime[index2] = 0; this.buffType[index2] = 0; } } } } public void ClearBuff(int type) { for (int b = 0; b < 22; ++b) { if (this.buffType[b] == type) this.DelBuff(b); } } public int CountBuffs() { int index1 = 0; for (int index2 = 0; index2 < 22; ++index2) { if (this.buffType[index1] > 0) ++index1; } return index1; } public void QuickHeal() { if (this.noItems || this.statLife == this.statLifeMax2 || this.potionDelay > 0) return; Item itemToUse = this.QuickHeal_GetItemToUse(); if (itemToUse == null) return; Main.PlaySound(itemToUse.UseSound, this.position); if (itemToUse.potion) { if (itemToUse.type == 227) { this.potionDelay = this.restorationDelayTime; this.AddBuff(21, this.potionDelay); } else { this.potionDelay = this.potionDelayTime; this.AddBuff(21, this.potionDelay); } } this.statLife += itemToUse.healLife; this.statMana += itemToUse.healMana; if (this.statLife > this.statLifeMax2) this.statLife = this.statLifeMax2; if (this.statMana > this.statManaMax2) this.statMana = this.statManaMax2; if (itemToUse.healLife > 0 && Main.myPlayer == this.whoAmI) this.HealEffect(itemToUse.healLife); if (itemToUse.healMana > 0) { this.AddBuff(94, Player.manaSickTime); if (Main.myPlayer == this.whoAmI) this.ManaEffect(itemToUse.healMana); } --itemToUse.stack; if (itemToUse.stack <= 0) itemToUse.TurnToAir(); Recipe.FindRecipes(); } public Item QuickHeal_GetItemToUse() { int num1 = this.statLifeMax2 - this.statLife; Item obj1 = (Item) null; int num2 = -this.statLifeMax2; for (int index = 0; index < 58; ++index) { Item obj2 = this.inventory[index]; if (obj2.stack > 0 && obj2.type > 0 && obj2.potion && obj2.healLife > 0) { int num3 = obj2.healLife - num1; if (num2 < 0) { if (num3 > num2) { obj1 = obj2; num2 = num3; } } else if (num3 < num2 && num3 >= 0) { obj1 = obj2; num2 = num3; } } } return obj1; } public void QuickMana() { if (this.noItems || this.statMana == this.statManaMax2) return; for (int index = 0; index < 58; ++index) { if (this.inventory[index].stack > 0 && this.inventory[index].type > 0 && this.inventory[index].healMana > 0 && (this.potionDelay == 0 || !this.inventory[index].potion)) { Main.PlaySound(this.inventory[index].UseSound, this.position); if (this.inventory[index].potion) { if (this.inventory[index].type == 227) { this.potionDelay = this.restorationDelayTime; this.AddBuff(21, this.potionDelay); } else { this.potionDelay = this.potionDelayTime; this.AddBuff(21, this.potionDelay); } } this.statLife += this.inventory[index].healLife; this.statMana += this.inventory[index].healMana; if (this.statLife > this.statLifeMax2) this.statLife = this.statLifeMax2; if (this.statMana > this.statManaMax2) this.statMana = this.statManaMax2; if (this.inventory[index].healLife > 0 && Main.myPlayer == this.whoAmI) this.HealEffect(this.inventory[index].healLife); if (this.inventory[index].healMana > 0) { this.AddBuff(94, Player.manaSickTime); if (Main.myPlayer == this.whoAmI) this.ManaEffect(this.inventory[index].healMana); } --this.inventory[index].stack; if (this.inventory[index].stack <= 0) this.inventory[index].TurnToAir(); Recipe.FindRecipes(); break; } } } public Item QuickMana_GetItemToUse() { for (int index = 0; index < 58; ++index) { if (this.inventory[index].stack > 0 && this.inventory[index].type > 0 && this.inventory[index].healMana > 0 && (this.potionDelay == 0 || !this.inventory[index].potion)) return this.inventory[index]; } return (Item) null; } public void QuickBuff() { if (this.noItems) return; LegacySoundStyle type1 = (LegacySoundStyle) null; for (int index1 = 0; index1 < 58; ++index1) { if (this.CountBuffs() == 22) return; if (this.inventory[index1].stack > 0 && this.inventory[index1].type > 0 && this.inventory[index1].buffType > 0 && !this.inventory[index1].summon && this.inventory[index1].buffType != 90) { int type2 = this.inventory[index1].buffType; bool flag = true; for (int index2 = 0; index2 < 22; ++index2) { if (type2 == 27 && (this.buffType[index2] == type2 || this.buffType[index2] == 101 || this.buffType[index2] == 102)) { flag = false; break; } if (this.buffType[index2] == type2) { flag = false; break; } if (Main.meleeBuff[type2] && Main.meleeBuff[this.buffType[index2]]) { flag = false; break; } } if (Main.lightPet[this.inventory[index1].buffType] || Main.vanityPet[this.inventory[index1].buffType]) { for (int index3 = 0; index3 < 22; ++index3) { if (Main.lightPet[this.buffType[index3]] && Main.lightPet[this.inventory[index1].buffType]) flag = false; if (Main.vanityPet[this.buffType[index3]] && Main.vanityPet[this.inventory[index1].buffType]) flag = false; } } if (this.inventory[index1].mana > 0 & flag) { if (this.statMana >= (int) ((double) this.inventory[index1].mana * (double) this.manaCost)) { this.manaRegenDelay = (int) this.maxRegenDelay; this.statMana -= (int) ((double) this.inventory[index1].mana * (double) this.manaCost); } else flag = false; } if (this.whoAmI == Main.myPlayer && this.inventory[index1].type == 603 && !Main.cEd) flag = false; if (type2 == 27) { type2 = Main.rand.Next(3); if (type2 == 0) type2 = 27; if (type2 == 1) type2 = 101; if (type2 == 2) type2 = 102; } if (flag) { type1 = this.inventory[index1].UseSound; int time1 = this.inventory[index1].buffTime; if (time1 == 0) time1 = 3600; this.AddBuff(type2, time1); if (this.inventory[index1].consumable) { --this.inventory[index1].stack; if (this.inventory[index1].stack <= 0) this.inventory[index1].TurnToAir(); } } } } if (type1 == null) return; Main.PlaySound(type1, this.position); Recipe.FindRecipes(); } public void QuickMount() { if (this.mount.Active) { this.mount.Dismount(this); } else { if (this.frozen || this.tongued || this.webbed || this.stoned || (double) this.gravDir == -1.0 || this.noItems) return; Item itemToUse = this.QuickMount_GetItemToUse(); if (itemToUse != null && itemToUse.mountType != -1 && this.mount.CanMount(itemToUse.mountType, this)) { bool flag = false; List tilesIn = Collision.GetTilesIn(this.TopLeft - new Vector2(24f), this.BottomRight + new Vector2(24f)); if (tilesIn.Count > 0) { Point? nullable = new Point?(); Microsoft.Xna.Framework.Rectangle hitbox = this.Hitbox; for (int index = 0; index < tilesIn.Count; ++index) { Point point = tilesIn[index]; Tile tileSafely = Framing.GetTileSafely(point.X, point.Y); if (tileSafely.active() && tileSafely.type == (ushort) 314) { Vector2 vector2 = tilesIn[index].ToVector2() * 16f + new Vector2(8f); if (!nullable.HasValue || (double) this.Distance(vector2) < (double) this.Distance(nullable.Value.ToVector2() * 16f + new Vector2(8f)) && Collision.CanHitLine(this.Center, 0, 0, vector2, 0, 0)) nullable = new Point?(tilesIn[index]); } } if (nullable.HasValue) { this.LaunchMinecartHook(nullable.Value.X, nullable.Value.Y); flag = true; } } if (flag) return; this.mount.SetMount(itemToUse.mountType, this); if (itemToUse.UseSound == null) return; Main.PlaySound(itemToUse.UseSound, this.Center); } else { int num1 = 0; int num2 = (int) ((double) this.position.X / 16.0) - Player.tileRangeX - num1 + 1; int num3 = (int) (((double) this.position.X + (double) this.width) / 16.0) + Player.tileRangeX + num1 - 1; int num4 = (int) ((double) this.position.Y / 16.0) - Player.tileRangeY - num1 + 1; int num5 = (int) (((double) this.position.Y + (double) this.height) / 16.0) + Player.tileRangeY + num1 - 2; int max = Main.maxTilesX - 10; int num6 = Utils.Clamp(num2, 10, max); int num7 = Utils.Clamp(num3, 10, Main.maxTilesX - 10); int num8 = Utils.Clamp(num4, 10, Main.maxTilesY - 10); int num9 = Utils.Clamp(num5, 10, Main.maxTilesY - 10); List tilesIn = Collision.GetTilesIn(new Vector2((float) num6, (float) num8) * 16f, new Vector2((float) (num7 + 1), (float) (num9 + 1)) * 16f); if (tilesIn.Count <= 0) return; Point? nullable = new Point?(); Microsoft.Xna.Framework.Rectangle hitbox = this.Hitbox; for (int index = 0; index < tilesIn.Count; ++index) { Point point = tilesIn[index]; Tile tileSafely = Framing.GetTileSafely(point.X, point.Y); if (tileSafely.active() && tileSafely.type == (ushort) 314) { Vector2 vector2 = tilesIn[index].ToVector2() * 16f + new Vector2(8f); if (!nullable.HasValue || (double) this.Distance(vector2) < (double) this.Distance(nullable.Value.ToVector2() * 16f + new Vector2(8f)) && Collision.CanHitLine(this.Center, 0, 0, vector2, 0, 0)) nullable = new Point?(tilesIn[index]); } } if (!nullable.HasValue) return; this.LaunchMinecartHook(nullable.Value.X, nullable.Value.Y); } } } public Item QuickMount_GetItemToUse() { Item obj = (Item) null; if (obj == null && this.miscEquips[3].mountType != -1 && !MountID.Sets.Cart[this.miscEquips[3].mountType]) obj = this.miscEquips[3]; if (obj == null) { for (int index = 0; index < 58; ++index) { if (this.inventory[index].mountType != -1 && !MountID.Sets.Cart[this.inventory[index].mountType]) { obj = this.inventory[index]; break; } } } return obj; } public void QuickGrapple() { if (this.frozen || this.tongued || this.webbed || this.stoned) return; if (PlayerInput.GrappleAndInteractAreShared) { if (Main.HoveringOverAnNPC || Main.SmartInteractShowingGenuine || Main.SmartInteractShowingFake || this._quickGrappleCooldown > 0 && !Main.mapFullscreen || WiresUI.Settings.DrawToolModeUI) return; int num = this.controlUseTile ? 1 : 0; bool releaseUseTile = this.releaseUseTile; if (num == 0 && !releaseUseTile) return; Tile tileSafely = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY); if (tileSafely.active() && (tileSafely.type == (ushort) 4 || tileSafely.type == (ushort) 33 || tileSafely.type == (ushort) 372 || tileSafely.type == (ushort) 174 || tileSafely.type == (ushort) 49) || this.inventory[this.selectedItem].type == 3384) return; } if (this.mount.Active) this.mount.Dismount(this); if (this.noItems) return; Item obj = (Item) null; if (obj == null && Main.projHook[this.miscEquips[4].shoot]) obj = this.miscEquips[4]; if (obj == null) { for (int index = 0; index < 58; ++index) { if (Main.projHook[this.inventory[index].shoot]) { obj = this.inventory[index]; break; } } } if (obj == null) return; if (obj.shoot == 73) { int num = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && (Main.projectile[index].type == 73 || Main.projectile[index].type == 74)) ++num; } if (num > 1) obj = (Item) null; } else if (obj.shoot == 165) { int num = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && Main.projectile[index].type == 165) ++num; } if (num > 8) obj = (Item) null; } else if (obj.shoot == 372) { int num = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && Main.projectile[index].type == 372) ++num; } if (num > 2) obj = (Item) null; } else if (obj.shoot == 652) { int num = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && Main.projectile[index].type == 652) ++num; } if (num > 1) obj = (Item) null; } else if (obj.type == 3572) { int num = 0; bool flag = false; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && Main.projectile[index].type >= 646 && Main.projectile[index].type <= 649) { ++num; if ((double) Main.projectile[index].ai[0] == 2.0) flag = true; } } if (num > 4 || !flag && num > 3) obj = (Item) null; } else { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && Main.projectile[index].type == obj.shoot && (double) Main.projectile[index].ai[0] != 2.0) { obj = (Item) null; break; } } } if (obj == null) return; Main.PlaySound(obj.UseSound, this.position); if (Main.netMode == 1 && this.whoAmI == Main.myPlayer) NetMessage.SendData(51, number: this.whoAmI, number2: 2f); int Type = obj.shoot; float shootSpeed = obj.shootSpeed; int damage = obj.damage; float knockBack = obj.knockBack; if (Type == 13 || Type == 32 || Type == 315 || Type >= 230 && Type <= 235 || Type == 331) { this.grappling[0] = -1; this.grapCount = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == this.whoAmI) { if (Main.projectile[index].type == 13) Main.projectile[index].Kill(); if (Main.projectile[index].type == 331) Main.projectile[index].Kill(); if (Main.projectile[index].type == 315) Main.projectile[index].Kill(); if (Main.projectile[index].type >= 230 && Main.projectile[index].type <= 235) Main.projectile[index].Kill(); } } } if (Type == 256) { int num1 = 0; int index1 = -1; int num2 = 100000; for (int index2 = 0; index2 < 1000; ++index2) { if (Main.projectile[index2].active && Main.projectile[index2].owner == this.whoAmI && Main.projectile[index2].type == 256) { ++num1; if (Main.projectile[index2].timeLeft < num2) { index1 = index2; num2 = Main.projectile[index2].timeLeft; } } } if (num1 > 1) Main.projectile[index1].Kill(); } if (Type == 652) { int num3 = 0; int index3 = -1; int num4 = 100000; for (int index4 = 0; index4 < 1000; ++index4) { if (Main.projectile[index4].active && Main.projectile[index4].owner == this.whoAmI && Main.projectile[index4].type == 652) { ++num3; if (Main.projectile[index4].timeLeft < num4) { index3 = index4; num4 = Main.projectile[index4].timeLeft; } } } if (num3 > 1) Main.projectile[index3].Kill(); } if (Type == 73) { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == this.whoAmI && Main.projectile[index].type == 73) Type = 74; } } if (obj.type == 3572) { int num5 = -1; int num6 = -1; for (int index = 0; index < 1000; ++index) { Projectile projectile = Main.projectile[index]; if (projectile.active && projectile.owner == this.whoAmI && projectile.type >= 646 && projectile.type <= 649 && (num6 == -1 || num6 < projectile.timeLeft)) { num5 = projectile.type; num6 = projectile.timeLeft; } } switch (num5) { case -1: case 649: Type = 646; break; case 646: Type = 647; break; case 647: Type = 648; break; case 648: Type = 649; break; } } Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); float f1 = (float) Main.mouseX + Main.screenPosition.X - vector2.X; float f2 = (float) Main.mouseY + Main.screenPosition.Y - vector2.Y; if ((double) this.gravDir == -1.0) f2 = Main.screenPosition.Y + (float) Main.screenHeight - (float) Main.mouseY - vector2.Y; float num7 = (float) Math.Sqrt((double) f1 * (double) f1 + (double) f2 * (double) f2); float num8; if (float.IsNaN(f1) && float.IsNaN(f2) || (double) f1 == 0.0 && (double) f2 == 0.0) { f1 = (float) this.direction; f2 = 0.0f; num8 = shootSpeed; } else num8 = shootSpeed / num7; float SpeedX = f1 * num8; float SpeedY = f2 * num8; Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, Type, damage, knockBack, this.whoAmI); } public void StatusNPC(int type, int i) { if (this.meleeEnchant > (byte) 0) { if (this.meleeEnchant == (byte) 1) Main.npc[i].AddBuff(70, 60 * Main.rand.Next(5, 10)); if (this.meleeEnchant == (byte) 2) Main.npc[i].AddBuff(39, 60 * Main.rand.Next(3, 7)); if (this.meleeEnchant == (byte) 3) Main.npc[i].AddBuff(24, 60 * Main.rand.Next(3, 7)); if (this.meleeEnchant == (byte) 5) Main.npc[i].AddBuff(69, 60 * Main.rand.Next(10, 20)); if (this.meleeEnchant == (byte) 6) Main.npc[i].AddBuff(31, 60 * Main.rand.Next(1, 4)); if (this.meleeEnchant == (byte) 8) Main.npc[i].AddBuff(20, 60 * Main.rand.Next(5, 10)); if (this.meleeEnchant == (byte) 4) Main.npc[i].AddBuff(72, 120); } if (this.frostBurn) Main.npc[i].AddBuff(44, 60 * Main.rand.Next(5, 15)); if (this.magmaStone) { if (Main.rand.Next(4) == 0) Main.npc[i].AddBuff(24, 360); else if (Main.rand.Next(2) == 0) Main.npc[i].AddBuff(24, 240); else Main.npc[i].AddBuff(24, 120); } if (type == 3211) Main.npc[i].AddBuff(69, 60 * Main.rand.Next(5, 10)); if (type == 121) { if (Main.rand.Next(2) != 0) return; Main.npc[i].AddBuff(24, 180); } else if (type == 3823) { if (Main.rand.Next(4) != 0) return; Main.npc[i].AddBuff(24, 300); } else if (type == 122) { if (Main.rand.Next(10) != 0) return; Main.npc[i].AddBuff(24, 180); } else if (type == 190) { if (Main.rand.Next(4) != 0) return; Main.npc[i].AddBuff(20, 420); } else if (type == 217) { if (Main.rand.Next(5) != 0) return; Main.npc[i].AddBuff(24, 180); } else { if (type != 1123 || Main.rand.Next(10) == 0) return; Main.npc[i].AddBuff(31, 120); } } public void StatusPvP(int type, int i) { if (this.meleeEnchant > (byte) 0) { if (this.meleeEnchant == (byte) 1) Main.player[i].AddBuff(70, 60 * Main.rand.Next(5, 10)); if (this.meleeEnchant == (byte) 2) Main.player[i].AddBuff(39, 60 * Main.rand.Next(3, 7)); if (this.meleeEnchant == (byte) 3) Main.player[i].AddBuff(24, 60 * Main.rand.Next(3, 7)); if (this.meleeEnchant == (byte) 5) Main.player[i].AddBuff(69, 60 * Main.rand.Next(10, 20)); if (this.meleeEnchant == (byte) 6) Main.player[i].AddBuff(31, 60 * Main.rand.Next(1, 4)); if (this.meleeEnchant == (byte) 8) Main.player[i].AddBuff(20, 60 * Main.rand.Next(5, 10)); } if (this.frostBurn) Main.player[i].AddBuff(44, 60 * Main.rand.Next(1, 8)); if (this.magmaStone) { if (Main.rand.Next(7) == 0) Main.player[i].AddBuff(24, 360); else if (Main.rand.Next(3) == 0) Main.player[i].AddBuff(24, 120); else Main.player[i].AddBuff(24, 60); } switch (type) { case 121: if (Main.rand.Next(2) != 0) break; Main.player[i].AddBuff(24, 180, false); break; case 122: if (Main.rand.Next(10) != 0) break; Main.player[i].AddBuff(24, 180, false); break; case 190: if (Main.rand.Next(4) != 0) break; Main.player[i].AddBuff(20, 420, false); break; case 217: if (Main.rand.Next(5) != 0) break; Main.player[i].AddBuff(24, 180, false); break; case 1123: if (Main.rand.Next(9) == 0) break; Main.player[i].AddBuff(31, 120, false); break; case 3823: if (Main.rand.Next(4) != 0) break; Main.player[i].AddBuff(24, 300); break; } } public void Ghost() { this.immune = false; this.immuneAlpha = 0; this.controlUp = false; this.controlLeft = false; this.controlDown = false; this.controlRight = false; this.controlJump = false; if (Main.hasFocus && !Main.drawingPlayerChat && !Main.editSign && !Main.editChest && !Main.blockInput) PlayerInput.Triggers.Current.CopyInto(this); if (this.controlUp || this.controlJump) { if ((double) this.velocity.Y > 0.0) this.velocity.Y *= 0.9f; this.velocity.Y -= 0.1f; if ((double) this.velocity.Y < -3.0) this.velocity.Y = -3f; } else if (this.controlDown) { if ((double) this.velocity.Y < 0.0) this.velocity.Y *= 0.9f; this.velocity.Y += 0.1f; if ((double) this.velocity.Y > 3.0) this.velocity.Y = 3f; } else if ((double) this.velocity.Y < -0.1 || (double) this.velocity.Y > 0.1) this.velocity.Y *= 0.9f; else this.velocity.Y = 0.0f; if (this.controlLeft && !this.controlRight) { if ((double) this.velocity.X > 0.0) this.velocity.X *= 0.9f; this.velocity.X -= 0.1f; if ((double) this.velocity.X < -3.0) this.velocity.X = -3f; } else if (this.controlRight && !this.controlLeft) { if ((double) this.velocity.X < 0.0) this.velocity.X *= 0.9f; this.velocity.X += 0.1f; if ((double) this.velocity.X > 3.0) this.velocity.X = 3f; } else if ((double) this.velocity.X < -0.1 || (double) this.velocity.X > 0.1) this.velocity.X *= 0.9f; else this.velocity.X = 0.0f; this.position = this.position + this.velocity; ++this.ghostFrameCounter; if ((double) this.velocity.X < 0.0) this.direction = -1; else if ((double) this.velocity.X > 0.0) this.direction = 1; if (this.ghostFrameCounter >= 8) { this.ghostFrameCounter = 0; ++this.ghostFrame; if (this.ghostFrame >= 4) this.ghostFrame = 0; } if ((double) this.position.X < (double) Main.leftWorld + (double) (Lighting.offScreenTiles * 16) + 16.0) { this.position.X = (float) ((double) Main.leftWorld + (double) (Lighting.offScreenTiles * 16) + 16.0); this.velocity.X = 0.0f; } if ((double) this.position.X + (double) this.width > (double) Main.rightWorld - (double) (Lighting.offScreenTiles * 16) - 32.0) { this.position.X = (float) ((double) Main.rightWorld - (double) (Lighting.offScreenTiles * 16) - 32.0) - (float) this.width; this.velocity.X = 0.0f; } if ((double) this.position.Y < (double) Main.topWorld + (double) (Lighting.offScreenTiles * 16) + 16.0) { this.position.Y = (float) ((double) Main.topWorld + (double) (Lighting.offScreenTiles * 16) + 16.0); if ((double) this.velocity.Y < -0.1) this.velocity.Y = -0.1f; } if ((double) this.position.Y <= (double) Main.bottomWorld - (double) (Lighting.offScreenTiles * 16) - 32.0 - (double) this.height) return; this.position.Y = (float) ((double) Main.bottomWorld - (double) (Lighting.offScreenTiles * 16) - 32.0) - (float) this.height; this.velocity.Y = 0.0f; } private void OldInputGhost() { Keys[] pressedKeys = Main.keyState.GetPressedKeys(); if (Main.blockKey != Keys.None.ToString()) { bool flag = false; for (int index = 0; index < pressedKeys.Length; ++index) { if (pressedKeys[index].ToString() == Main.blockKey) { pressedKeys[index] = Keys.None; flag = true; } } if (!flag) Main.blockKey = Keys.None.ToString(); } for (int index = 0; index < pressedKeys.Length; ++index) { string str = string.Concat((object) pressedKeys[index]); if (str == Main.cUp) this.controlUp = true; if (str == Main.cLeft) this.controlLeft = true; if (str == Main.cDown) this.controlDown = true; if (str == Main.cRight) this.controlRight = true; if (str == Main.cJump) this.controlJump = true; } } public void OnHit(float x, float y, Entity victim) { if (Main.myPlayer != this.whoAmI) return; if (this.onHitDodge && this.shadowDodgeTimer == 0 && Main.rand.Next(4) == 0) { if (!this.shadowDodge) this.shadowDodgeTimer = 1800; this.AddBuff(59, 1800); } if (this.onHitRegen) this.AddBuff(58, 300); if (this.stardustMinion && victim is NPC) { for (int index = 0; index < 1000; ++index) { Projectile projectile = Main.projectile[index]; if (projectile.active && projectile.owner == this.whoAmI && projectile.type == 613 && (double) projectile.localAI[1] <= 0.0 && Main.rand.Next(2) == 0) { Vector2 vector2 = new Vector2(x, y) - projectile.Center; if ((double) vector2.Length() > 0.0) vector2.Normalize(); vector2 *= 20f; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector2.X, vector2.Y, 614, projectile.damage / 3, 0.0f, projectile.owner, ai1: ((float) victim.whoAmI)); projectile.localAI[1] = (float) (30 + Main.rand.Next(4) * 10); } } } if (this.onHitPetal && this.petalTimer == 0) { this.petalTimer = 20; double num1 = (double) this.position.X + (double) (this.width / 2); int direction = this.direction; float x1 = Main.screenPosition.X; if (direction < 0) x1 += (float) Main.screenWidth; float num2 = Main.screenPosition.Y + (float) Main.rand.Next(Main.screenHeight); Vector2 vector2 = new Vector2(x1, num2); float num3 = x - vector2.X; float num4 = y - vector2.Y; float num5 = num3 + (float) Main.rand.Next(-50, 51) * 0.1f; float num6 = num4 + (float) Main.rand.Next(-50, 51) * 0.1f; float num7 = 24f / (float) Math.Sqrt((double) num5 * (double) num5 + (double) num6 * (double) num6); float SpeedX = num5 * num7; float SpeedY = num6 * num7; Projectile.NewProjectile(x1, num2, SpeedX, SpeedY, 221, 36, 0.0f, this.whoAmI); } if (!this.crystalLeaf || this.petalTimer != 0) return; int type = this.inventory[this.selectedItem].type; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].owner == this.whoAmI && Main.projectile[index].type == 226) { this.petalTimer = 50; Vector2 vector2 = new Vector2(Main.projectile[index].position.X + (float) this.width * 0.5f, Main.projectile[index].position.Y + (float) this.height * 0.5f); float num8 = x - vector2.X; float num9 = y - vector2.Y; float num10 = (float) (12.0 / Math.Sqrt((double) num8 * (double) num8 + (double) num9 * (double) num9)); float SpeedX = num8 * num10; float SpeedY = num9 * num10; Projectile.NewProjectile(Main.projectile[index].Center.X - 4f, Main.projectile[index].Center.Y, SpeedX, SpeedY, 227, Player.crystalLeafDamage, (float) Player.crystalLeafKB, this.whoAmI); break; } } } public void openPresent() { if (Main.rand.Next(15) == 0 && Main.hardMode) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 602); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else if (Main.rand.Next(30) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1922); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else if (Main.rand.Next(400) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1927); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else if (Main.rand.Next(150) == 0) { int number1 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1870); if (Main.netMode == 1) NetMessage.SendData(21, number: number1, number2: 1f); int number2 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 97, Main.rand.Next(30, 61)); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number2, number2: 1f); } else if (Main.rand.Next(150) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1909); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else if (Main.rand.Next(150) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1917); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else if (Main.rand.Next(150) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1915); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else if (Main.rand.Next(150) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1918); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else if (Main.rand.Next(150) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1921); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else if (Main.rand.Next(300) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1923); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else if (Main.rand.Next(40) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1907); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else if (Main.rand.Next(10) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1908); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else if (Main.rand.Next(15) == 0) { switch (Main.rand.Next(5)) { case 0: int number3 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1932); if (Main.netMode == 1) NetMessage.SendData(21, number: number3, number2: 1f); int number4 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1933); if (Main.netMode == 1) NetMessage.SendData(21, number: number4, number2: 1f); int number5 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1934); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number5, number2: 1f); break; case 1: int number6 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1935); if (Main.netMode == 1) NetMessage.SendData(21, number: number6, number2: 1f); int number7 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1936); if (Main.netMode == 1) NetMessage.SendData(21, number: number7, number2: 1f); int number8 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1937); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number8, number2: 1f); break; case 2: int number9 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1940); if (Main.netMode == 1) NetMessage.SendData(21, number: number9, number2: 1f); int number10 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1941); if (Main.netMode == 1) NetMessage.SendData(21, number: number10, number2: 1f); int number11 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1942); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number11, number2: 1f); break; case 3: int number12 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1938); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number12, number2: 1f); break; case 4: int number13 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1939); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number13, number2: 1f); break; } } else if (Main.rand.Next(7) == 0) { int Type = Main.rand.Next(3); if (Type == 0) Type = 1911; if (Type == 1) Type = 1919; if (Type == 2) Type = 1920; int number14 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number14, number2: 1f); } else if (Main.rand.Next(8) == 0) { int number15 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1912, Main.rand.Next(1, 4)); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number15, number2: 1f); } else if (Main.rand.Next(9) == 0) { int number16 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1913, Main.rand.Next(20, 41)); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number16, number2: 1f); } else { switch (Main.rand.Next(3)) { case 0: int number17 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1872, Main.rand.Next(20, 50)); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number17, number2: 1f); break; case 1: int number18 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 586, Main.rand.Next(20, 50)); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number18, number2: 1f); break; default: int number19 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 591, Main.rand.Next(20, 50)); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number19, number2: 1f); break; } } } public void QuickSpawnItem(int item, int stack = 1) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, item, stack, pfix: -1); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } public void OpenBossBag(int type) { switch (type) { case 3318: if (Main.rand.Next(2) == 0) this.QuickSpawnItem(2430); if (Main.rand.Next(7) == 0) this.QuickSpawnItem(2493); int num1 = Main.rand.Next(256, 259); int num2 = Main.rand.Next(256, 259); while (num2 == num1) num2 = Main.rand.Next(256, 259); this.QuickSpawnItem(num1); this.QuickSpawnItem(num2); if (Main.rand.Next(2) == 0) this.QuickSpawnItem(2610); else this.QuickSpawnItem(2585); this.QuickSpawnItem(998); this.QuickSpawnItem(3090); break; case 3319: if (this.difficulty == (byte) 2) this.QuickSpawnItem(3763); if (Main.rand.Next(7) == 0) this.QuickSpawnItem(2112); if (Main.rand.Next(30) == 0) this.QuickSpawnItem(1299); if (WorldGen.crimson) { this.QuickSpawnItem(880, Main.rand.Next(20) + 10 + (Main.rand.Next(20) + 10) + (Main.rand.Next(20) + 10)); this.QuickSpawnItem(2171, Main.rand.Next(3) + 1); } else { this.QuickSpawnItem(56, Main.rand.Next(20) + 10 + (Main.rand.Next(20) + 10) + (Main.rand.Next(20) + 10)); this.QuickSpawnItem(59, Main.rand.Next(3) + 1); this.QuickSpawnItem(47, Main.rand.Next(30) + 20); } this.QuickSpawnItem(3097); break; case 3320: this.QuickSpawnItem(56, Main.rand.Next(15, 30) + Main.rand.Next(15, 31)); this.QuickSpawnItem(86, Main.rand.Next(10, 20)); if (Main.rand.Next(20) == 0) this.QuickSpawnItem(994); if (Main.rand.Next(7) == 0) this.QuickSpawnItem(2111); this.QuickSpawnItem(3224); break; case 3321: this.QuickSpawnItem(880, Main.rand.Next(20, 46) + Main.rand.Next(20, 46)); this.QuickSpawnItem(1329, Main.rand.Next(10, 20)); if (Main.rand.Next(7) == 0) this.QuickSpawnItem(2104); if (Main.rand.Next(20) == 0) this.QuickSpawnItem(3060); this.QuickSpawnItem(3223); break; case 3322: if (Main.rand.Next(7) == 0) this.QuickSpawnItem(2108); int num3 = Main.rand.Next(3); switch (num3) { case 0: num3 = 1121; break; case 1: num3 = 1123; break; case 2: num3 = 2888; break; } this.QuickSpawnItem(num3); this.QuickSpawnItem(3333); if (Main.rand.Next(3) == 0) this.QuickSpawnItem(1132); if (Main.rand.Next(9) == 0) this.QuickSpawnItem(1170); if (Main.rand.Next(9) == 0) this.QuickSpawnItem(2502); this.QuickSpawnItem(1129); this.QuickSpawnItem(Main.rand.Next(842, 845)); this.QuickSpawnItem(1130, Main.rand.Next(10, 30)); this.QuickSpawnItem(2431, Main.rand.Next(17, 30)); break; case 3323: this.QuickSpawnItem(3245); switch (Main.rand.Next(3)) { case 0: this.QuickSpawnItem(1281); break; case 1: this.QuickSpawnItem(1273); break; default: this.QuickSpawnItem(1313); break; } break; case 3324: if (Main.rand.Next(7) == 0) this.QuickSpawnItem(2105); this.QuickSpawnItem(367); if (!this.extraAccessory) this.QuickSpawnItem(3335); int num4 = Main.rand.Next(4); this.QuickSpawnItem(num4 != 3 ? 489 + num4 : 2998); switch (Main.rand.Next(3)) { case 0: this.QuickSpawnItem(514); break; case 1: this.QuickSpawnItem(426); break; case 2: this.QuickSpawnItem(434); break; } break; case 3325: this.TryGettingDevArmor(); if (Main.rand.Next(7) == 0) this.QuickSpawnItem(2113); this.QuickSpawnItem(548, Main.rand.Next(25, 41)); this.QuickSpawnItem(1225, Main.rand.Next(20, 36)); this.QuickSpawnItem(3355); break; case 3326: this.TryGettingDevArmor(); if (Main.rand.Next(7) == 0) this.QuickSpawnItem(2106); this.QuickSpawnItem(549, Main.rand.Next(25, 41)); this.QuickSpawnItem(1225, Main.rand.Next(20, 36)); this.QuickSpawnItem(3354); break; case 3327: this.TryGettingDevArmor(); if (Main.rand.Next(7) == 0) this.QuickSpawnItem(2107); this.QuickSpawnItem(547, Main.rand.Next(25, 41)); this.QuickSpawnItem(1225, Main.rand.Next(20, 36)); this.QuickSpawnItem(3356); break; case 3328: this.TryGettingDevArmor(); if (Main.rand.Next(7) == 0) this.QuickSpawnItem(2109); this.QuickSpawnItem(1141); this.QuickSpawnItem(3336); if (Main.rand.Next(15) == 0) this.QuickSpawnItem(1182); if (Main.rand.Next(20) == 0) this.QuickSpawnItem(1305); if (Main.rand.Next(2) == 0) this.QuickSpawnItem(1157); if (Main.rand.Next(10) == 0) this.QuickSpawnItem(3021); switch (Main.rand.Next(7)) { case 0: this.QuickSpawnItem(758); this.QuickSpawnItem(771, Main.rand.Next(50, 150)); break; case 1: this.QuickSpawnItem(1255); break; case 2: this.QuickSpawnItem(788); break; case 3: this.QuickSpawnItem(1178); break; case 4: this.QuickSpawnItem(1259); break; case 5: this.QuickSpawnItem(1155); break; case 6: this.QuickSpawnItem(3018); break; } break; case 3329: this.TryGettingDevArmor(); this.QuickSpawnItem(3337); if (Main.rand.Next(7) == 0) this.QuickSpawnItem(2110); switch (Main.rand.Next(8)) { case 0: this.QuickSpawnItem(1258); this.QuickSpawnItem(1261, Main.rand.Next(60, 100)); break; case 1: this.QuickSpawnItem(1122); break; case 2: this.QuickSpawnItem(899); break; case 3: this.QuickSpawnItem(1248); break; case 4: this.QuickSpawnItem(1294); break; case 5: this.QuickSpawnItem(1295); break; case 6: this.QuickSpawnItem(1296); break; case 7: this.QuickSpawnItem(1297); break; } this.QuickSpawnItem(2218, Main.rand.Next(18, 24)); break; case 3330: this.TryGettingDevArmor(); this.QuickSpawnItem(3367); if (Main.rand.Next(7) == 0) this.QuickSpawnItem(2588); if (Main.rand.Next(10) == 0) this.QuickSpawnItem(2609); switch (Main.rand.Next(5)) { case 0: this.QuickSpawnItem(2611); break; case 1: this.QuickSpawnItem(2624); break; case 2: this.QuickSpawnItem(2622); break; case 3: this.QuickSpawnItem(2621); break; case 4: this.QuickSpawnItem(2623); break; } break; case 3331: this.TryGettingDevArmor(); if (Main.rand.Next(7) == 0) { this.QuickSpawnItem(3372); break; } break; case 3332: this.TryGettingDevArmor(); if (Main.rand.Next(7) == 0) this.QuickSpawnItem(3373); if (!this.HasItem(3384)) this.QuickSpawnItem(3384); this.QuickSpawnItem(3460, Main.rand.Next(90, 111)); this.QuickSpawnItem(1131); this.QuickSpawnItem(3577); this.QuickSpawnItem(Utils.SelectRandom(Main.rand, 3063, 3389, 3065, 1553, 3546, 3541, 3570, 3571, 3569)); break; case 3860: this.TryGettingDevArmor(); if (Main.rand.Next(7) == 0) this.QuickSpawnItem(3863); switch (Main.rand.Next(4)) { case 0: this.QuickSpawnItem(3859); break; case 1: this.QuickSpawnItem(3827); break; case 2: this.QuickSpawnItem(3870); break; default: this.QuickSpawnItem(3858); break; } if (Main.rand.Next(4) == 0) this.QuickSpawnItem(3883); this.QuickSpawnItem(3817, Main.rand.Next(30, 50)); break; } int Type = -1; if (type == 3318) Type = 50; if (type == 3319) Type = 4; if (type == 3320) Type = 13; if (type == 3321) Type = 266; if (type == 3322) Type = 222; if (type == 3323) Type = 35; if (type == 3324) Type = 113; if (type == 3325) Type = 134; if (type == 3326) Type = 125; if (type == 3327) Type = (int) sbyte.MaxValue; if (type == 3328) Type = 262; if (type == 3329) Type = 245; if (type == 3330) Type = 370; if (type == 3331) Type = 439; if (type == 3332) Type = 398; if (type == 3860) Type = 551; if (type == 3861) Type = 576; if (type == 3862) Type = 564; if (Type <= 0) return; NPC npc = new NPC(); npc.SetDefaults(Type); float num5 = npc.value * (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.00999999977648258); if (Main.rand.Next(5) == 0) num5 *= (float) (1.0 + (double) Main.rand.Next(5, 11) * 0.00999999977648258); if (Main.rand.Next(10) == 0) num5 *= (float) (1.0 + (double) Main.rand.Next(10, 21) * 0.00999999977648258); if (Main.rand.Next(15) == 0) num5 *= (float) (1.0 + (double) Main.rand.Next(15, 31) * 0.00999999977648258); if (Main.rand.Next(20) == 0) num5 *= (float) (1.0 + (double) Main.rand.Next(20, 41) * 0.00999999977648258); while ((int) num5 > 0) { if ((double) num5 > 1000000.0) { int stack = (int) ((double) num5 / 1000000.0); num5 -= (float) (1000000 * stack); this.QuickSpawnItem(74, stack); } else if ((double) num5 > 10000.0) { int stack = (int) ((double) num5 / 10000.0); num5 -= (float) (10000 * stack); this.QuickSpawnItem(73, stack); } else if ((double) num5 > 100.0) { int stack = (int) ((double) num5 / 100.0); num5 -= (float) (100 * stack); this.QuickSpawnItem(72, stack); } else { int stack = (int) num5; if (stack < 1) stack = 1; num5 -= (float) stack; this.QuickSpawnItem(71, stack); } } } private void TryGettingDevArmor() { if (Main.rand.Next(20) != 0) return; switch (Main.rand.Next(14)) { case 0: this.QuickSpawnItem(666); this.QuickSpawnItem(667); this.QuickSpawnItem(668); this.QuickSpawnItem(665); this.QuickSpawnItem(3287); break; case 1: this.QuickSpawnItem(1554); this.QuickSpawnItem(1555); this.QuickSpawnItem(1556); this.QuickSpawnItem(1586); break; case 2: this.QuickSpawnItem(1587); this.QuickSpawnItem(1588); this.QuickSpawnItem(1586); break; case 3: this.QuickSpawnItem(1557); this.QuickSpawnItem(1558); this.QuickSpawnItem(1559); this.QuickSpawnItem(1585); break; case 4: this.QuickSpawnItem(1560); this.QuickSpawnItem(1561); this.QuickSpawnItem(1562); this.QuickSpawnItem(1584); break; case 5: this.QuickSpawnItem(1563); this.QuickSpawnItem(1564); this.QuickSpawnItem(1565); this.QuickSpawnItem(3582); break; case 6: this.QuickSpawnItem(1566); this.QuickSpawnItem(1567); this.QuickSpawnItem(1568); break; case 7: this.QuickSpawnItem(1580); this.QuickSpawnItem(1581); this.QuickSpawnItem(1582); this.QuickSpawnItem(1583); break; case 8: this.QuickSpawnItem(3226); this.QuickSpawnItem(3227); this.QuickSpawnItem(3228); this.QuickSpawnItem(3288); break; case 9: this.QuickSpawnItem(3583); this.QuickSpawnItem(3581); this.QuickSpawnItem(3578); this.QuickSpawnItem(3579); this.QuickSpawnItem(3580); break; case 10: this.QuickSpawnItem(3585); this.QuickSpawnItem(3586); this.QuickSpawnItem(3587); this.QuickSpawnItem(3588); this.QuickSpawnItem(3024, 4); break; case 11: this.QuickSpawnItem(3589); this.QuickSpawnItem(3590); this.QuickSpawnItem(3591); this.QuickSpawnItem(3592); this.QuickSpawnItem(3599, 4); break; case 12: this.QuickSpawnItem(3921); this.QuickSpawnItem(3922); this.QuickSpawnItem(3923); this.QuickSpawnItem(3924); break; case 13: this.QuickSpawnItem(3925); this.QuickSpawnItem(3926); this.QuickSpawnItem(3927); this.QuickSpawnItem(3928); this.QuickSpawnItem(3929); break; } } public void openCrate(int type) { int num = type - 2334; if (type >= 3203) num = type - 3203 + 3; switch (num) { case 0: bool flag1 = true; while (flag1) { if (Main.hardMode & flag1 && Main.rand.Next(200) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3064); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); flag1 = false; } if (flag1 && Main.rand.Next(40) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3200, pfix: -1); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); flag1 = false; } if (flag1 && Main.rand.Next(40) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3201, pfix: -1); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); flag1 = false; } if (Main.hardMode & flag1 && Main.rand.Next(25) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2424, pfix: -1); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); flag1 = false; } if (Main.rand.Next(45) == 0) { int Type = Main.rand.Next(5); switch (Type) { case 0: Type = 285; break; case 1: Type = 953; break; case 2: Type = 946; break; case 3: Type = 3068; break; case 4: Type = 3084; break; } int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, pfix: -1); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); flag1 = false; } if (!Main.hardMode & flag1 && Main.rand.Next(50) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 997); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); flag1 = false; } if (Main.rand.Next(7) == 0) { int Type; int Stack; if (Main.rand.Next(3) == 0) { Type = 73; Stack = Main.rand.Next(1, 6); } else { Type = 72; Stack = Main.rand.Next(20, 91); } int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); flag1 = false; } if (Main.rand.Next(7) == 0) { int Type = Main.rand.Next(8); switch (Type) { case 0: Type = 12; break; case 1: Type = 11; break; case 2: Type = 14; break; case 3: Type = 13; break; case 4: Type = 699; break; case 5: Type = 700; break; case 6: Type = 701; break; case 7: Type = 702; break; } if (Main.hardMode && Main.rand.Next(2) == 0) { Type = Main.rand.Next(6); switch (Type) { case 0: Type = 364; break; case 1: Type = 365; break; case 2: Type = 366; break; case 3: Type = 1104; break; case 4: Type = 1105; break; case 5: Type = 1106; break; } } int Stack = Main.rand.Next(8, 21); int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); flag1 = false; } if (Main.rand.Next(8) == 0) { int Type = Main.rand.Next(8); switch (Type) { case 0: Type = 20; break; case 1: Type = 22; break; case 2: Type = 21; break; case 3: Type = 19; break; case 4: Type = 703; break; case 5: Type = 704; break; case 6: Type = 705; break; case 7: Type = 706; break; } int Stack = Main.rand.Next(2, 8); if (Main.hardMode && Main.rand.Next(2) == 0) { Type = Main.rand.Next(6); switch (Type) { case 0: Type = 381; break; case 1: Type = 382; break; case 2: Type = 391; break; case 3: Type = 1184; break; case 4: Type = 1191; break; case 5: Type = 1198; break; } Stack -= Main.rand.Next(2); } int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); flag1 = false; } if (Main.rand.Next(7) == 0) { int Type = Main.rand.Next(10); switch (Type) { case 0: Type = 288; break; case 1: Type = 290; break; case 2: Type = 292; break; case 3: Type = 299; break; case 4: Type = 298; break; case 5: Type = 304; break; case 6: Type = 291; break; case 7: Type = 2322; break; case 8: Type = 2323; break; case 9: Type = 2329; break; } int Stack = Main.rand.Next(1, 4); int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); flag1 = false; } } if (Main.rand.Next(3) == 0) { int Type = Main.rand.Next(2); switch (Type) { case 0: Type = 28; break; case 1: Type = 110; break; } int Stack = Main.rand.Next(5, 16); int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } if (Main.rand.Next(3) != 0) break; int number1 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Main.rand.Next(3) != 0 ? 2674 : 2675, Main.rand.Next(1, 5)); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number1, number2: 1f); break; case 1: bool flag2 = true; while (flag2) { if (Main.hardMode & flag2 && Main.rand.Next(60) == 0) { int number2 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3064); if (Main.netMode == 1) NetMessage.SendData(21, number: number2, number2: 1f); flag2 = false; } if (flag2 && Main.rand.Next(25) == 0) { int number3 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2501); if (Main.netMode == 1) NetMessage.SendData(21, number: number3, number2: 1f); flag2 = false; } if (flag2 && Main.rand.Next(20) == 0) { int number4 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2587); if (Main.netMode == 1) NetMessage.SendData(21, number: number4, number2: 1f); flag2 = false; } if (flag2 && Main.rand.Next(15) == 0) { int number5 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2608, pfix: -1); if (Main.netMode == 1) NetMessage.SendData(21, number: number5, number2: 1f); flag2 = false; } if (flag2 && Main.rand.Next(20) == 0) { int number6 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3200, pfix: -1); if (Main.netMode == 1) NetMessage.SendData(21, number: number6, number2: 1f); flag2 = false; } if (flag2 && Main.rand.Next(20) == 0) { int number7 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3201, pfix: -1); if (Main.netMode == 1) NetMessage.SendData(21, number: number7, number2: 1f); flag2 = false; } if (Main.rand.Next(4) == 0) { int number8 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 73, Main.rand.Next(5, 11)); if (Main.netMode == 1) NetMessage.SendData(21, number: number8, number2: 1f); flag2 = false; } if (Main.rand.Next(4) == 0) { int Type = Main.rand.Next(8); switch (Type) { case 0: Type = 20; break; case 1: Type = 22; break; case 2: Type = 21; break; case 3: Type = 19; break; case 4: Type = 703; break; case 5: Type = 704; break; case 6: Type = 705; break; case 7: Type = 706; break; } int Stack = Main.rand.Next(6, 15); if (Main.hardMode && Main.rand.Next(3) != 0) { Type = Main.rand.Next(6); switch (Type) { case 0: Type = 381; break; case 1: Type = 382; break; case 2: Type = 391; break; case 3: Type = 1184; break; case 4: Type = 1191; break; case 5: Type = 1198; break; } Stack -= Main.rand.Next(2); } int number9 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number9, number2: 1f); flag2 = false; } if (Main.rand.Next(4) == 0) { int Type = Main.rand.Next(8); switch (Type) { case 0: Type = 288; break; case 1: Type = 296; break; case 2: Type = 304; break; case 3: Type = 305; break; case 4: Type = 2322; break; case 5: Type = 2323; break; case 6: Type = 2324; break; case 7: Type = 2327; break; } int Stack = Main.rand.Next(2, 5); int number10 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number10, number2: 1f); flag2 = false; } } if (Main.rand.Next(2) == 0) { int number11 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Main.rand.Next(188, 190), Main.rand.Next(5, 16)); if (Main.netMode == 1) NetMessage.SendData(21, number: number11, number2: 1f); } if (Main.rand.Next(2) != 0) break; int number12 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Main.rand.Next(3) != 0 ? 2675 : 2676, Main.rand.Next(2, 5)); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number12, number2: 1f); break; case 2: bool flag3 = true; while (flag3) { if (Main.hardMode & flag3 && Main.rand.Next(20) == 0) { int number13 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3064); if (Main.netMode == 1) NetMessage.SendData(21, number: number13, number2: 1f); flag3 = false; } if (flag3 && Main.rand.Next(10) == 0) { int number14 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2491); if (Main.netMode == 1) NetMessage.SendData(21, number: number14, number2: 1f); flag3 = false; } if (Main.rand.Next(3) == 0) { int number15 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 73, Main.rand.Next(8, 21)); if (Main.netMode == 1) NetMessage.SendData(21, number: number15, number2: 1f); flag3 = false; } if (Main.rand.Next(3) == 0) { int Type = Main.rand.Next(4); switch (Type) { case 0: Type = 21; break; case 1: Type = 19; break; case 2: Type = 705; break; case 3: Type = 706; break; } if (Main.hardMode && Main.rand.Next(3) != 0) { Type = Main.rand.Next(4); switch (Type) { case 0: Type = 382; break; case 1: Type = 391; break; case 2: Type = 1191; break; case 3: Type = 1198; break; } } int Stack = Main.rand.Next(15, 31); int number16 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number16, number2: 1f); flag3 = false; } } if (Main.rand.Next(3) == 0) { int Type = Main.rand.Next(5); switch (Type) { case 0: Type = 288; break; case 1: Type = 296; break; case 2: Type = 305; break; case 3: Type = 2322; break; case 4: Type = 2323; break; } int Stack = Main.rand.Next(2, 6); int number17 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number17, number2: 1f); } if (Main.rand.Next(2) == 0) { int number18 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Main.rand.Next(499, 501), Main.rand.Next(5, 21)); if (Main.netMode == 1) NetMessage.SendData(21, number: number18, number2: 1f); } if (Main.rand.Next(3) == 0) break; int number19 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 2676, Main.rand.Next(3, 8)); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number19, number2: 1f); break; default: int maxValue = 6; bool flag4 = true; while (flag4) { if (num == 3 && flag4 && Main.rand.Next(maxValue) == 0) { int Type; switch (Main.rand.Next(5)) { case 0: Type = 162; break; case 1: Type = 111; break; case 2: Type = 96; break; case 3: Type = 115; break; default: Type = 64; break; } int number20 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, pfix: -1); if (Main.netMode == 1) NetMessage.SendData(21, number: number20, number2: 1f); flag4 = false; } if (num == 4 && flag4 && Main.rand.Next(maxValue) == 0) { int Type; switch (Main.rand.Next(5)) { case 0: Type = 800; break; case 1: Type = 802; break; case 2: Type = 1256; break; case 3: Type = 1290; break; default: Type = 3062; break; } int number21 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, pfix: -1); if (Main.netMode == 1) NetMessage.SendData(21, number: number21, number2: 1f); flag4 = false; } if (num == 5 && flag4 && Main.rand.Next(maxValue) == 0) { int number22 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 3085, pfix: -1); if (Main.netMode == 1) NetMessage.SendData(21, number: number22, number2: 1f); flag4 = false; } if (num == 6 && flag4 && Main.rand.Next(maxValue) == 0) { int Type; switch (Main.rand.Next(3)) { case 0: Type = 158; break; case 1: Type = 65; break; default: Type = 159; break; } int number23 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, pfix: -1); if (Main.netMode == 1) NetMessage.SendData(21, number: number23, number2: 1f); flag4 = false; } if (num == 8 && flag4 && Main.rand.Next(maxValue) == 0) { int Type; switch (Main.rand.Next(5)) { case 0: Type = 212; break; case 1: Type = 964; break; case 2: Type = 211; break; case 3: Type = 213; break; default: Type = 2292; break; } int number24 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, pfix: -1); if (Main.netMode == 1) NetMessage.SendData(21, number: number24, number2: 1f); flag4 = false; } if (Main.rand.Next(4) == 0) { int number25 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 73, Main.rand.Next(5, 13)); if (Main.netMode == 1) NetMessage.SendData(21, number: number25, number2: 1f); flag4 = false; } if (Main.rand.Next(4) == 0) { int Type = Main.rand.Next(6); switch (Type) { case 0: Type = 22; break; case 1: Type = 21; break; case 2: Type = 19; break; case 3: Type = 704; break; case 4: Type = 705; break; case 5: Type = 706; break; } int Stack = Main.rand.Next(10, 21); if (Main.hardMode && Main.rand.Next(3) != 0) { Type = Main.rand.Next(6); switch (Type) { case 0: Type = 381; break; case 1: Type = 382; break; case 2: Type = 391; break; case 3: Type = 1184; break; case 4: Type = 1191; break; case 5: Type = 1198; break; } Stack -= Main.rand.Next(3); } int number26 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number26, number2: 1f); flag4 = false; } } if (Main.rand.Next(4) == 0) { int Type = Main.rand.Next(6); switch (Type) { case 0: Type = 288; break; case 1: Type = 296; break; case 2: Type = 304; break; case 3: Type = 305; break; case 4: Type = 2322; break; case 5: Type = 2323; break; } int Stack = Main.rand.Next(2, 5); int number27 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number27, number2: 1f); } if (Main.rand.Next(2) == 0) { int number28 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Main.rand.Next(188, 190), Main.rand.Next(5, 18)); if (Main.netMode == 1) NetMessage.SendData(21, number: number28, number2: 1f); } if (Main.rand.Next(2) == 0) { int number29 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Main.rand.Next(2) != 0 ? 2675 : 2676, Main.rand.Next(2, 7)); if (Main.netMode == 1) NetMessage.SendData(21, number: number29, number2: 1f); } if (num != 3 && num != 4 && num != 7) break; if (Main.hardMode && Main.rand.Next(2) == 0) { int Type = 521; if (num == 7) Type = 520; int Stack = Main.rand.Next(2, 6); int number30 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number30, number2: 1f); } if (!Main.hardMode || Main.rand.Next(2) != 0) break; int Type1 = 522; int Stack1 = Main.rand.Next(2, 6); switch (num) { case 4: Type1 = 1332; break; case 7: Type1 = 502; Stack1 = Main.rand.Next(4, 11); break; } int number31 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type1, Stack1); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number31, number2: 1f); break; } } public int CountItem(int type, int stopCountingAt = 0) { int num = 0; for (int index = 0; index != 58; ++index) { if (this.inventory[index].stack > 0 && this.inventory[index].type == type) { num += this.inventory[index].stack; if (num >= stopCountingAt) return num; } } return num; } public bool ConsumeItem(int type, bool reverseOrder = false) { int num1 = 0; int num2 = 58; int num3 = 1; if (reverseOrder) { num1 = 57; num2 = -1; num3 = -1; } for (int index = num1; index != num2; index += num3) { if (this.inventory[index].stack > 0 && this.inventory[index].type == type) { --this.inventory[index].stack; if (this.inventory[index].stack <= 0) this.inventory[index].SetDefaults(); return true; } } return false; } public void openLockBox() { bool flag = true; while (flag) { flag = false; int Type1; switch (Main.rand.Next(7)) { case 1: Type1 = 329; break; case 2: Type1 = 155; break; case 3: Type1 = 156; break; case 4: Type1 = 157; break; case 5: Type1 = 163; break; case 6: Type1 = 113; break; default: Type1 = 164; break; } int number1 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type1, pfix: -1); if (Main.netMode == 1) NetMessage.SendData(21, number: number1, number2: 1f); if (Main.rand.Next(3) == 0) { flag = false; int Stack = Main.rand.Next(1, 4); if (Main.rand.Next(2) == 0) Stack += Main.rand.Next(2); if (Main.rand.Next(3) == 0) Stack += Main.rand.Next(3); if (Main.rand.Next(4) == 0) Stack += Main.rand.Next(3); if (Main.rand.Next(5) == 0) Stack += Main.rand.Next(1, 3); int number2 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 73, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number2, number2: 1f); } if (Main.rand.Next(2) == 0) { flag = false; int number3 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 72, Main.rand.Next(10, 100)); if (Main.netMode == 1) NetMessage.SendData(21, number: number3, number2: 1f); } if (Main.rand.Next(3) == 0) { flag = false; int number4 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 188, Main.rand.Next(2, 6)); if (Main.netMode == 1) NetMessage.SendData(21, number: number4, number2: 1f); } if (Main.rand.Next(3) == 0) { flag = false; int Type2; switch (Main.rand.Next(9)) { case 0: Type2 = 296; break; case 1: Type2 = 2346; break; case 2: Type2 = 305; break; case 3: Type2 = 2323; break; case 4: Type2 = 292; break; case 5: Type2 = 294; break; case 6: Type2 = 288; break; default: Type2 = Main.netMode != 1 ? 2350 : 2997; break; } int number5 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type2, Main.rand.Next(1, 4)); if (Main.netMode == 1) NetMessage.SendData(21, number: number5, number2: 1f); } } } public void openHerbBag() { int num = Main.rand.Next(2, 5); if (Main.rand.Next(3) == 0) ++num; for (int index = 0; index < num; ++index) { int Type = Main.rand.Next(14); if (Type == 0) Type = 313; if (Type == 1) Type = 314; if (Type == 2) Type = 315; if (Type == 3) Type = 317; if (Type == 4) Type = 316; if (Type == 5) Type = 318; if (Type == 6) Type = 2358; if (Type == 7) Type = 307; if (Type == 8) Type = 308; if (Type == 9) Type = 309; if (Type == 10) Type = 311; if (Type == 11) Type = 310; if (Type == 12) Type = 312; if (Type == 13) Type = 2357; int Stack = Main.rand.Next(2, 5); if (Main.rand.Next(3) == 0) Stack += Main.rand.Next(1, 5); int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Type, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } } public void openGoodieBag() { if (Main.rand.Next(150) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1810); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else if (Main.rand.Next(150) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1800); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else if (Main.rand.Next(4) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1809, Main.rand.Next(10, 41)); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else if (Main.rand.Next(10) == 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Main.rand.Next(1846, 1851)); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else { switch (Main.rand.Next(19)) { case 0: int number1 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1749); if (Main.netMode == 1) NetMessage.SendData(21, number: number1, number2: 1f); int number2 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1750); if (Main.netMode == 1) NetMessage.SendData(21, number: number2, number2: 1f); int number3 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1751); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number3, number2: 1f); break; case 1: int number4 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1746); if (Main.netMode == 1) NetMessage.SendData(21, number: number4, number2: 1f); int number5 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1747); if (Main.netMode == 1) NetMessage.SendData(21, number: number5, number2: 1f); int number6 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1748); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number6, number2: 1f); break; case 2: int number7 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1752); if (Main.netMode == 1) NetMessage.SendData(21, number: number7, number2: 1f); int number8 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1753); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number8, number2: 1f); break; case 3: int number9 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1767); if (Main.netMode == 1) NetMessage.SendData(21, number: number9, number2: 1f); int number10 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1768); if (Main.netMode == 1) NetMessage.SendData(21, number: number10, number2: 1f); int number11 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1769); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number11, number2: 1f); break; case 4: int number12 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1770); if (Main.netMode == 1) NetMessage.SendData(21, number: number12, number2: 1f); int number13 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1771); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number13, number2: 1f); break; case 5: int number14 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1772); if (Main.netMode == 1) NetMessage.SendData(21, number: number14, number2: 1f); int number15 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1773); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number15, number2: 1f); break; case 6: int number16 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1754); if (Main.netMode == 1) NetMessage.SendData(21, number: number16, number2: 1f); int number17 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1755); if (Main.netMode == 1) NetMessage.SendData(21, number: number17, number2: 1f); int number18 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1756); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number18, number2: 1f); break; case 7: int number19 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1757); if (Main.netMode == 1) NetMessage.SendData(21, number: number19, number2: 1f); int number20 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1758); if (Main.netMode == 1) NetMessage.SendData(21, number: number20, number2: 1f); int number21 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1759); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number21, number2: 1f); break; case 8: int number22 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1760); if (Main.netMode == 1) NetMessage.SendData(21, number: number22, number2: 1f); int number23 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1761); if (Main.netMode == 1) NetMessage.SendData(21, number: number23, number2: 1f); int number24 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1762); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number24, number2: 1f); break; case 9: int number25 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1763); if (Main.netMode == 1) NetMessage.SendData(21, number: number25, number2: 1f); int number26 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1764); if (Main.netMode == 1) NetMessage.SendData(21, number: number26, number2: 1f); int number27 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1765); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number27, number2: 1f); break; case 10: int number28 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1766); if (Main.netMode == 1) NetMessage.SendData(21, number: number28, number2: 1f); int number29 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1775); if (Main.netMode == 1) NetMessage.SendData(21, number: number29, number2: 1f); int number30 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1776); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number30, number2: 1f); break; case 11: int number31 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1777); if (Main.netMode == 1) NetMessage.SendData(21, number: number31, number2: 1f); int number32 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1778); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number32, number2: 1f); break; case 12: int number33 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1779); if (Main.netMode == 1) NetMessage.SendData(21, number: number33, number2: 1f); int number34 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1780); if (Main.netMode == 1) NetMessage.SendData(21, number: number34, number2: 1f); int number35 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1781); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number35, number2: 1f); break; case 13: int number36 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1819); if (Main.netMode == 1) NetMessage.SendData(21, number: number36, number2: 1f); int number37 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1820); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number37, number2: 1f); break; case 14: int number38 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1821); if (Main.netMode == 1) NetMessage.SendData(21, number: number38, number2: 1f); int number39 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1822); if (Main.netMode == 1) NetMessage.SendData(21, number: number39, number2: 1f); int number40 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1823); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number40, number2: 1f); break; case 15: int number41 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1824); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number41, number2: 1f); break; case 16: int number42 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1838); if (Main.netMode == 1) NetMessage.SendData(21, number: number42, number2: 1f); int number43 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1839); if (Main.netMode == 1) NetMessage.SendData(21, number: number43, number2: 1f); int number44 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1840); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number44, number2: 1f); break; case 17: int number45 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1841); if (Main.netMode == 1) NetMessage.SendData(21, number: number45, number2: 1f); int number46 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1842); if (Main.netMode == 1) NetMessage.SendData(21, number: number46, number2: 1f); int number47 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1843); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number47, number2: 1f); break; case 18: int number48 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1851); if (Main.netMode == 1) NetMessage.SendData(21, number: number48, number2: 1f); int number49 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 1852); if (Main.netMode != 1) break; NetMessage.SendData(21, number: number49, number2: 1f); break; } } } public void UpdateDyes(int plr) { this.cHead = 0; this.cBody = 0; this.cLegs = 0; this.cHandOn = 0; this.cHandOff = 0; this.cBack = 0; this.cFront = 0; this.cShoe = 0; this.cWaist = 0; this.cShield = 0; this.cNeck = 0; this.cFace = 0; this.cBalloon = 0; this.cWings = 0; this.cCarpet = 0; this.cGrapple = this.cMount = this.cMinecart = this.cPet = this.cLight = this.cYorai = 0; if (this.dye[0] != null) this.cHead = (int) this.dye[0].dye; if (this.dye[1] != null) this.cBody = (int) this.dye[1].dye; if (this.dye[2] != null) this.cLegs = (int) this.dye[2].dye; if (this.wearsRobe) this.cLegs = this.cBody; if (this.miscDyes[0] != null) this.cPet = (int) this.miscDyes[0].dye; if (this.miscDyes[1] != null) this.cLight = (int) this.miscDyes[1].dye; if (this.miscDyes[2] != null) this.cMinecart = (int) this.miscDyes[2].dye; if (this.miscDyes[3] != null) this.cMount = (int) this.miscDyes[3].dye; if (this.miscDyes[4] != null) this.cGrapple = (int) this.miscDyes[4].dye; for (int index1 = 0; index1 < 20; ++index1) { int index2 = index1 % 10; if (this.dye[index2] != null && this.armor[index1].type > 0 && this.armor[index1].stack > 0 && (index1 / 10 >= 1 || !this.hideVisual[index2] || this.armor[index1].wingSlot > (sbyte) 0 || this.armor[index1].type == 934)) { if (this.armor[index1].handOnSlot > (sbyte) 0 && this.armor[index1].handOnSlot < (sbyte) 20) this.cHandOn = (int) this.dye[index2].dye; if (this.armor[index1].handOffSlot > (sbyte) 0 && this.armor[index1].handOffSlot < (sbyte) 12) this.cHandOff = (int) this.dye[index2].dye; if (this.armor[index1].backSlot > (sbyte) 0 && this.armor[index1].backSlot < (sbyte) 14) this.cBack = (int) this.dye[index2].dye; if (this.armor[index1].frontSlot > (sbyte) 0 && this.armor[index1].frontSlot < (sbyte) 5) this.cFront = (int) this.dye[index2].dye; if (this.armor[index1].shoeSlot > (sbyte) 0 && this.armor[index1].shoeSlot < (sbyte) 18) this.cShoe = (int) this.dye[index2].dye; if (this.armor[index1].waistSlot > (sbyte) 0 && this.armor[index1].waistSlot < (sbyte) 13) this.cWaist = (int) this.dye[index2].dye; if (this.armor[index1].shieldSlot > (sbyte) 0 && this.armor[index1].shieldSlot < (sbyte) 7) this.cShield = (int) this.dye[index2].dye; if (this.armor[index1].neckSlot > (sbyte) 0 && this.armor[index1].neckSlot < (sbyte) 10) this.cNeck = (int) this.dye[index2].dye; if (this.armor[index1].faceSlot > (sbyte) 0 && this.armor[index1].faceSlot < (sbyte) 9) this.cFace = (int) this.dye[index2].dye; if (this.armor[index1].balloonSlot > (sbyte) 0 && this.armor[index1].balloonSlot < (sbyte) 18) this.cBalloon = (int) this.dye[index2].dye; if (this.armor[index1].wingSlot > (sbyte) 0 && this.armor[index1].wingSlot < (sbyte) 40) this.cWings = (int) this.dye[index2].dye; if (this.armor[index1].type == 934) this.cCarpet = (int) this.dye[index2].dye; } } this.cYorai = this.cPet; } public int ArmorSetDye() { switch (Main.rand.Next(3)) { case 0: return this.cHead; case 1: return this.cBody; case 2: return this.cLegs; default: return this.cBody; } } public void UpdateBuffs(int i) { if (this.soulDrain > 0 && this.whoAmI == Main.myPlayer) this.AddBuff(151, 2); for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == i) ++this.ownedProjectileCounts[Main.projectile[index].type]; } for (int index1 = 0; index1 < 22; ++index1) { if (this.buffType[index1] > 0 && this.buffTime[index1] > 0) { if (this.whoAmI == Main.myPlayer && this.buffType[index1] != 28) --this.buffTime[index1]; if (this.buffType[index1] == 1) { this.lavaImmune = true; this.fireWalk = true; this.buffImmune[24] = true; } else if (this.buffType[index1] == 158) this.manaRegenBonus += 2; else if (this.buffType[index1] == 159 && this.inventory[this.selectedItem].melee) this.armorPenetration = 4; else if (this.buffType[index1] == 2) this.lifeRegen += 4; else if (this.buffType[index1] == 3) this.moveSpeed += 0.25f; else if (this.buffType[index1] == 4) this.gills = true; else if (this.buffType[index1] == 5) this.statDefense += 8; else if (this.buffType[index1] == 6) this.manaRegenBuff = true; else if (this.buffType[index1] == 7) this.magicDamage += 0.2f; else if (this.buffType[index1] == 8) this.slowFall = true; else if (this.buffType[index1] == 9) this.findTreasure = true; else if (this.buffType[index1] == 10) this.invis = true; else if (this.buffType[index1] == 11) Lighting.AddLight((int) ((double) this.position.X + (double) (this.width / 2)) / 16, (int) ((double) this.position.Y + (double) (this.height / 2)) / 16, 0.8f, 0.95f, 1f); else if (this.buffType[index1] == 12) this.nightVision = true; else if (this.buffType[index1] == 13) this.enemySpawns = true; else if (this.buffType[index1] == 14) { if ((double) this.thorns < 1.0) this.thorns = 0.3333333f; } else if (this.buffType[index1] == 15) this.waterWalk = true; else if (this.buffType[index1] == 16) this.archery = true; else if (this.buffType[index1] == 17) this.detectCreature = true; else if (this.buffType[index1] == 18) this.gravControl = true; else if (this.buffType[index1] == 30) this.bleed = true; else if (this.buffType[index1] == 31) this.confused = true; else if (this.buffType[index1] == 32) this.slow = true; else if (this.buffType[index1] == 35) this.silence = true; else if (this.buffType[index1] == 160) this.dazed = true; else if (this.buffType[index1] == 46) this.chilled = true; else if (this.buffType[index1] == 47) this.frozen = true; else if (this.buffType[index1] == 156) this.stoned = true; else if (this.buffType[index1] == 69) { this.ichor = true; this.statDefense -= 20; } else if (this.buffType[index1] == 36) this.brokenArmor = true; else if (this.buffType[index1] == 48) this.honey = true; else if (this.buffType[index1] == 59) this.shadowDodge = true; else if (this.buffType[index1] == 93) this.ammoBox = true; else if (this.buffType[index1] == 58) this.palladiumRegen = true; else if (this.buffType[index1] == 88) this.chaosState = true; else if (this.buffType[index1] == 63) ++this.moveSpeed; else if (this.buffType[index1] == 104) this.pickSpeed -= 0.25f; else if (this.buffType[index1] == 105) this.lifeMagnet = true; else if (this.buffType[index1] == 106) this.calmed = true; else if (this.buffType[index1] == 121) this.fishingSkill += 15; else if (this.buffType[index1] == 122) this.sonarPotion = true; else if (this.buffType[index1] == 123) this.cratePotion = true; else if (this.buffType[index1] == 107) { this.tileSpeed += 0.25f; this.wallSpeed += 0.25f; ++this.blockRange; } else if (this.buffType[index1] == 108) this.kbBuff = true; else if (this.buffType[index1] == 109) { this.ignoreWater = true; this.accFlipper = true; } else if (this.buffType[index1] == 110) ++this.maxMinions; else if (this.buffType[index1] == 150) ++this.maxMinions; else if (this.buffType[index1] == 111) this.dangerSense = true; else if (this.buffType[index1] == 112) this.ammoPotion = true; else if (this.buffType[index1] == 113) { this.lifeForce = true; this.statLifeMax2 += this.statLifeMax / 5 / 20 * 20; } else if (this.buffType[index1] == 114) this.endurance += 0.1f; else if (this.buffType[index1] == 115) { this.meleeCrit += 10; this.rangedCrit += 10; this.magicCrit += 10; this.thrownCrit += 10; } else if (this.buffType[index1] == 116) { this.inferno = true; Lighting.AddLight((int) ((double) this.Center.X / 16.0), (int) ((double) this.Center.Y / 16.0), 0.65f, 0.4f, 0.1f); int type = 24; float num1 = 200f; bool flag = this.infernoCounter % 60 == 0; int num2 = 10; if (this.whoAmI == Main.myPlayer) { for (int index2 = 0; index2 < 200; ++index2) { NPC npc = Main.npc[index2]; if (npc.active && !npc.friendly && npc.damage > 0 && !npc.dontTakeDamage && !npc.buffImmune[type] && (double) Vector2.Distance(this.Center, npc.Center) <= (double) num1) { if (npc.FindBuffIndex(type) == -1) npc.AddBuff(type, 120); if (flag) this.ApplyDamageToNPC(npc, num2, 0.0f, 0, false); } } if (this.hostile) { for (int playerTargetIndex = 0; playerTargetIndex < (int) byte.MaxValue; ++playerTargetIndex) { Player player = Main.player[playerTargetIndex]; if (player != this && player.active && !player.dead && player.hostile && !player.buffImmune[type] && (player.team != this.team || player.team == 0) && (double) Vector2.Distance(this.Center, player.Center) <= (double) num1) { if (player.FindBuffIndex(type) == -1) player.AddBuff(type, 120); if (flag) { player.Hurt(PlayerDeathReason.LegacyEmpty(), num2, 0, true); if (Main.netMode != 0) { PlayerDeathReason reason = PlayerDeathReason.ByPlayer(this.whoAmI); NetMessage.SendPlayerHurt(playerTargetIndex, reason, num2, 0, false, true, 0); } } } } } } } else if (this.buffType[index1] == 117) { this.thrownDamage += 0.1f; this.meleeDamage += 0.1f; this.rangedDamage += 0.1f; this.magicDamage += 0.1f; this.minionDamage += 0.1f; } else if (this.buffType[index1] == 119) this.loveStruck = true; else if (this.buffType[index1] == 120) this.stinky = true; else if (this.buffType[index1] == 124) this.resistCold = true; else if (this.buffType[index1] == 165) { this.lifeRegen += 6; this.statDefense += 8; this.dryadWard = true; if ((double) this.thorns < 1.0) this.thorns += 0.2f; } else if (this.buffType[index1] == 144) { this.electrified = true; Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.3f, 0.8f, 1.1f); } else if (this.buffType[index1] == 94) { this.manaSick = true; this.manaSickReduction = Player.manaSickLessDmg * ((float) this.buffTime[index1] / (float) Player.manaSickTime); } else if (this.buffType[index1] >= 95 && this.buffType[index1] <= 97) { this.buffTime[index1] = 5; int num = (int) (byte) (1 + this.buffType[index1] - 95); if (this.beetleOrbs > 0 && this.beetleOrbs != num) { if (this.beetleOrbs > num) { this.DelBuff(index1); --index1; } else { for (int b = 0; b < 22; ++b) { if (this.buffType[b] >= 95 && this.buffType[b] <= 95 + num - 1) { this.DelBuff(b); --b; } } } } this.beetleOrbs = num; if (!this.beetleDefense) { this.beetleOrbs = 0; this.DelBuff(index1); --index1; } else this.beetleBuff = true; } else if (this.buffType[index1] >= 170 && this.buffType[index1] <= 172) { this.buffTime[index1] = 5; int num = (int) (byte) (1 + this.buffType[index1] - 170); if (this.solarShields > 0 && this.solarShields != num) { if (this.solarShields > num) { this.DelBuff(index1); --index1; } else { for (int b = 0; b < 22; ++b) { if (this.buffType[b] >= 170 && this.buffType[b] <= 170 + num - 1) { this.DelBuff(b); --b; } } } } this.solarShields = num; if (!this.setSolar) { this.solarShields = 0; this.DelBuff(index1); --index1; } } else if (this.buffType[index1] >= 98 && this.buffType[index1] <= 100) { int num = (int) (byte) (1 + this.buffType[index1] - 98); if (this.beetleOrbs > 0 && this.beetleOrbs != num) { if (this.beetleOrbs > num) { this.DelBuff(index1); --index1; } else { for (int b = 0; b < 22; ++b) { if (this.buffType[b] >= 98 && this.buffType[b] <= 98 + num - 1) { this.DelBuff(b); --b; } } } } this.beetleOrbs = num; this.meleeDamage += 0.1f * (float) this.beetleOrbs; this.meleeSpeed += 0.1f * (float) this.beetleOrbs; if (!this.beetleOffense) { this.beetleOrbs = 0; this.DelBuff(index1); --index1; } else this.beetleBuff = true; } else if (this.buffType[index1] >= 176 && this.buffType[index1] <= 178) { int nebulaLevelMana = this.nebulaLevelMana; int num = (int) (byte) (1 + this.buffType[index1] - 176); if (nebulaLevelMana > 0 && nebulaLevelMana != num) { if (nebulaLevelMana > num) { this.DelBuff(index1); --index1; } else { for (int b = 0; b < 22; ++b) { if (this.buffType[b] >= 176 && this.buffType[b] <= 178 + num - 1) { this.DelBuff(b); --b; } } } } this.nebulaLevelMana = num; if (this.buffTime[index1] == 2 && this.nebulaLevelMana > 1) { --this.nebulaLevelMana; --this.buffType[index1]; this.buffTime[index1] = 480; } } else if (this.buffType[index1] >= 173 && this.buffType[index1] <= 175) { int nebulaLevelLife = this.nebulaLevelLife; int num = (int) (byte) (1 + this.buffType[index1] - 173); if (nebulaLevelLife > 0 && nebulaLevelLife != num) { if (nebulaLevelLife > num) { this.DelBuff(index1); --index1; } else { for (int b = 0; b < 22; ++b) { if (this.buffType[b] >= 173 && this.buffType[b] <= 175 + num - 1) { this.DelBuff(b); --b; } } } } this.nebulaLevelLife = num; if (this.buffTime[index1] == 2 && this.nebulaLevelLife > 1) { --this.nebulaLevelLife; --this.buffType[index1]; this.buffTime[index1] = 480; } this.lifeRegen += 10 * this.nebulaLevelLife; } else if (this.buffType[index1] >= 179 && this.buffType[index1] <= 181) { int nebulaLevelDamage = this.nebulaLevelDamage; int num3 = (int) (byte) (1 + this.buffType[index1] - 179); if (nebulaLevelDamage > 0 && nebulaLevelDamage != num3) { if (nebulaLevelDamage > num3) { this.DelBuff(index1); --index1; } else { for (int b = 0; b < 22; ++b) { if (this.buffType[b] >= 179 && this.buffType[b] <= 181 + num3 - 1) { this.DelBuff(b); --b; } } } } this.nebulaLevelDamage = num3; if (this.buffTime[index1] == 2 && this.nebulaLevelDamage > 1) { --this.nebulaLevelDamage; --this.buffType[index1]; this.buffTime[index1] = 480; } float num4 = 0.15f * (float) this.nebulaLevelDamage; this.meleeDamage += num4; this.rangedDamage += num4; this.magicDamage += num4; this.minionDamage += num4; this.thrownDamage += num4; } else if (this.buffType[index1] == 62) { if ((double) this.statLife <= (double) this.statLifeMax2 * 0.5) { Lighting.AddLight((int) ((double) this.Center.X / 16.0), (int) ((double) this.Center.Y / 16.0), 0.1f, 0.2f, 0.45f); this.iceBarrier = true; this.endurance += 0.25f; ++this.iceBarrierFrameCounter; if (this.iceBarrierFrameCounter > (byte) 2) { this.iceBarrierFrameCounter = (byte) 0; ++this.iceBarrierFrame; if (this.iceBarrierFrame >= (byte) 12) this.iceBarrierFrame = (byte) 0; } } else { this.DelBuff(index1); --index1; } } else if (this.buffType[index1] == 49) { for (int index3 = 191; index3 <= 194; ++index3) { if (this.ownedProjectileCounts[index3] > 0) this.pygmy = true; } if (!this.pygmy) { this.DelBuff(index1); --index1; } else this.buffTime[index1] = 18000; } else if (this.buffType[index1] == 83) { if (this.ownedProjectileCounts[317] > 0) this.raven = true; if (!this.raven) { this.DelBuff(index1); --index1; } else this.buffTime[index1] = 18000; } else if (this.buffType[index1] == 64) { if (this.ownedProjectileCounts[266] > 0) this.slime = true; if (!this.slime) { this.DelBuff(index1); --index1; } else this.buffTime[index1] = 18000; } else if (this.buffType[index1] == 125) { if (this.ownedProjectileCounts[373] > 0) this.hornetMinion = true; if (!this.hornetMinion) { this.DelBuff(index1); --index1; } else this.buffTime[index1] = 18000; } else if (this.buffType[index1] == 126) { if (this.ownedProjectileCounts[375] > 0) this.impMinion = true; if (!this.impMinion) { this.DelBuff(index1); --index1; } else this.buffTime[index1] = 18000; } else if (this.buffType[index1] == 133) { if (this.ownedProjectileCounts[390] > 0 || this.ownedProjectileCounts[391] > 0 || this.ownedProjectileCounts[392] > 0) this.spiderMinion = true; if (!this.spiderMinion) { this.DelBuff(index1); --index1; } else this.buffTime[index1] = 18000; } else if (this.buffType[index1] == 134) { if (this.ownedProjectileCounts[387] > 0 || this.ownedProjectileCounts[388] > 0) this.twinsMinion = true; if (!this.twinsMinion) { this.DelBuff(index1); --index1; } else this.buffTime[index1] = 18000; } else if (this.buffType[index1] == 135) { if (this.ownedProjectileCounts[393] > 0 || this.ownedProjectileCounts[394] > 0 || this.ownedProjectileCounts[395] > 0) this.pirateMinion = true; if (!this.pirateMinion) { this.DelBuff(index1); --index1; } else this.buffTime[index1] = 18000; } else if (this.buffType[index1] == 139) { if (this.ownedProjectileCounts[407] > 0) this.sharknadoMinion = true; if (!this.sharknadoMinion) { this.DelBuff(index1); --index1; } else this.buffTime[index1] = 18000; } else if (this.buffType[index1] == 140) { if (this.ownedProjectileCounts[423] > 0) this.UFOMinion = true; if (!this.UFOMinion) { this.DelBuff(index1); --index1; } else this.buffTime[index1] = 18000; } else if (this.buffType[index1] == 182) { if (this.ownedProjectileCounts[613] > 0) this.stardustMinion = true; if (!this.stardustMinion) { this.DelBuff(index1); --index1; } else this.buffTime[index1] = 18000; } else if (this.buffType[index1] == 187) { if (this.ownedProjectileCounts[623] > 0) this.stardustGuardian = true; if (!this.stardustGuardian) { this.DelBuff(index1); --index1; } else this.buffTime[index1] = 18000; } else if (this.buffType[index1] == 188) { if (this.ownedProjectileCounts[625] > 0) this.stardustDragon = true; if (!this.stardustDragon) { this.DelBuff(index1); --index1; } else this.buffTime[index1] = 18000; } else if (this.buffType[index1] == 161) { if (this.ownedProjectileCounts[533] > 0) this.DeadlySphereMinion = true; if (!this.DeadlySphereMinion) { this.DelBuff(index1); --index1; } else this.buffTime[index1] = 18000; } else if (this.buffType[index1] == 90) { this.mount.SetMount(0, this); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 128) { this.mount.SetMount(1, this); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 129) { this.mount.SetMount(2, this); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 130) { this.mount.SetMount(3, this); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 118) { this.mount.SetMount(6, this, true); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 138) { this.mount.SetMount(6, this); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 167) { this.mount.SetMount(11, this, true); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 166) { this.mount.SetMount(11, this); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 184) { this.mount.SetMount(13, this, true); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 185) { this.mount.SetMount(13, this); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 131) { this.ignoreWater = true; this.accFlipper = true; this.mount.SetMount(4, this); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 132) { this.mount.SetMount(5, this); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 168) { this.ignoreWater = true; this.accFlipper = true; this.mount.SetMount(12, this); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 141) { this.mount.SetMount(7, this); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 142) { this.mount.SetMount(8, this); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 143) { this.mount.SetMount(9, this); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 162) { this.mount.SetMount(10, this); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 193) { this.mount.SetMount(14, this); this.buffTime[index1] = 10; } else if (this.buffType[index1] == 37) { if (Main.wof >= 0 && Main.npc[Main.wof].type == 113) { this.gross = true; this.buffTime[index1] = 10; } else { this.DelBuff(index1); --index1; } } else if (this.buffType[index1] == 38) { this.buffTime[index1] = 10; this.tongued = true; } else if (this.buffType[index1] == 146) { this.moveSpeed += 0.1f; this.moveSpeed *= 1.1f; this.sunflower = true; } else if (this.buffType[index1] == 19) { this.buffTime[index1] = 18000; this.lightOrb = true; bool flag = true; if (this.ownedProjectileCounts[18] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 18, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 155) { this.buffTime[index1] = 18000; this.crimsonHeart = true; bool flag = true; if (this.ownedProjectileCounts[500] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 500, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 191) this.CommonPetBuffHandle(index1, ref this.companionCube, 653); else if (this.buffType[index1] == 202) this.CommonPetBuffHandle(index1, ref this.petFlagDD2Dragon, 701); else if (this.buffType[index1] == 200) this.CommonPetBuffHandle(index1, ref this.petFlagDD2Gato, 703); else if (this.buffType[index1] == 201) this.CommonPetBuffHandle(index1, ref this.petFlagDD2Ghost, 702); else if (this.buffType[index1] == 190) { this.buffTime[index1] = 18000; this.suspiciouslookingTentacle = true; bool flag = true; if (this.ownedProjectileCounts[650] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 650, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 27 || this.buffType[index1] == 101 || this.buffType[index1] == 102) { this.buffTime[index1] = 18000; bool flag = true; int Type = 72; if (this.buffType[index1] == 27) this.blueFairy = true; if (this.buffType[index1] == 101) { Type = 86; this.redFairy = true; } if (this.buffType[index1] == 102) { Type = 87; this.greenFairy = true; } if (this.head == 45 && this.body == 26 && this.legs == 25) Type = 72; if (this.ownedProjectileCounts[Type] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, Type, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 40) { this.buffTime[index1] = 18000; this.bunny = true; bool flag = true; if (this.ownedProjectileCounts[111] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 111, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 148) { this.rabid = true; if (Main.rand.Next(1200) == 0) { int num5 = Main.rand.Next(6); float num6 = (float) Main.rand.Next(60, 100) * 0.01f; switch (num5) { case 0: this.AddBuff(22, (int) (60.0 * (double) num6 * 3.0)); break; case 1: this.AddBuff(23, (int) (60.0 * (double) num6 * 0.75)); break; case 2: this.AddBuff(31, (int) (60.0 * (double) num6 * 1.5)); break; case 3: this.AddBuff(32, (int) (60.0 * (double) num6 * 3.5)); break; case 4: this.AddBuff(33, (int) (60.0 * (double) num6 * 5.0)); break; case 5: this.AddBuff(35, (int) (60.0 * (double) num6 * 1.0)); break; } } this.meleeDamage += 0.2f; this.magicDamage += 0.2f; this.rangedDamage += 0.2f; this.thrownDamage += 0.2f; this.minionDamage += 0.2f; } else if (this.buffType[index1] == 41) { this.buffTime[index1] = 18000; this.penguin = true; bool flag = true; if (this.ownedProjectileCounts[112] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 112, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 152) { this.buffTime[index1] = 18000; this.magicLantern = true; if (this.ownedProjectileCounts[492] == 0 && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 492, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 91) { this.buffTime[index1] = 18000; this.puppy = true; bool flag = true; if (this.ownedProjectileCounts[334] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 334, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 92) { this.buffTime[index1] = 18000; this.grinch = true; bool flag = true; if (this.ownedProjectileCounts[353] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 353, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 84) { this.buffTime[index1] = 18000; this.blackCat = true; bool flag = true; if (this.ownedProjectileCounts[319] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 319, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 61) { this.buffTime[index1] = 18000; this.dino = true; bool flag = true; if (this.ownedProjectileCounts[236] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 236, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 154) { this.buffTime[index1] = 18000; this.babyFaceMonster = true; bool flag = true; if (this.ownedProjectileCounts[499] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 499, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 65) { this.buffTime[index1] = 18000; this.eyeSpring = true; bool flag = true; if (this.ownedProjectileCounts[268] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 268, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 66) { this.buffTime[index1] = 18000; this.snowman = true; bool flag = true; if (this.ownedProjectileCounts[269] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 269, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 42) { this.buffTime[index1] = 18000; this.turtle = true; bool flag = true; if (this.ownedProjectileCounts[(int) sbyte.MaxValue] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, (int) sbyte.MaxValue, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 45) { this.buffTime[index1] = 18000; this.eater = true; bool flag = true; if (this.ownedProjectileCounts[175] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 175, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 50) { this.buffTime[index1] = 18000; this.skeletron = true; bool flag = true; if (this.ownedProjectileCounts[197] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 197, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 51) { this.buffTime[index1] = 18000; this.hornet = true; bool flag = true; if (this.ownedProjectileCounts[198] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 198, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 52) { this.buffTime[index1] = 18000; this.tiki = true; bool flag = true; if (this.ownedProjectileCounts[199] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 199, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 53) { this.buffTime[index1] = 18000; this.lizard = true; bool flag = true; if (this.ownedProjectileCounts[200] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 200, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 54) { this.buffTime[index1] = 18000; this.parrot = true; bool flag = true; if (this.ownedProjectileCounts[208] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 208, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 55) { this.buffTime[index1] = 18000; this.truffle = true; bool flag = true; if (this.ownedProjectileCounts[209] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 209, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 56) { this.buffTime[index1] = 18000; this.sapling = true; bool flag = true; if (this.ownedProjectileCounts[210] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 210, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 85) { this.buffTime[index1] = 18000; this.cSapling = true; bool flag = true; if (this.ownedProjectileCounts[324] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 324, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 81) { this.buffTime[index1] = 18000; this.spider = true; bool flag = true; if (this.ownedProjectileCounts[313] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 313, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 82) { this.buffTime[index1] = 18000; this.squashling = true; bool flag = true; if (this.ownedProjectileCounts[314] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 314, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 57) { this.buffTime[index1] = 18000; this.wisp = true; bool flag = true; if (this.ownedProjectileCounts[211] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 211, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 60) { this.buffTime[index1] = 18000; this.crystalLeaf = true; bool flag = true; for (int index4 = 0; index4 < 1000; ++index4) { if (Main.projectile[index4].active && Main.projectile[index4].owner == this.whoAmI && Main.projectile[index4].type == 226) { if (!flag) Main.projectile[index4].Kill(); flag = false; } } if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 226, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == (int) sbyte.MaxValue) { this.buffTime[index1] = 18000; this.zephyrfish = true; bool flag = true; if (this.ownedProjectileCounts[380] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 380, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 136) { this.buffTime[index1] = 18000; this.miniMinotaur = true; bool flag = true; if (this.ownedProjectileCounts[398] > 0) flag = false; if (flag && this.whoAmI == Main.myPlayer) Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, 398, 0, 0.0f, this.whoAmI); } else if (this.buffType[index1] == 70) this.venom = true; else if (this.buffType[index1] == 20) this.poisoned = true; else if (this.buffType[index1] == 21) this.potionDelay = this.buffTime[index1]; else if (this.buffType[index1] == 22) this.blind = true; else if (this.buffType[index1] == 80) this.blackout = true; else if (this.buffType[index1] == 23) this.noItems = true; else if (this.buffType[index1] == 24) this.onFire = true; else if (this.buffType[index1] == 103) this.dripping = true; else if (this.buffType[index1] == 137) this.drippingSlime = true; else if (this.buffType[index1] == 67) this.burned = true; else if (this.buffType[index1] == 68) this.suffocating = true; else if (this.buffType[index1] == 39) this.onFire2 = true; else if (this.buffType[index1] == 44) this.onFrostBurn = true; else if (this.buffType[index1] == 163) { this.headcovered = true; this.bleed = true; } else if (this.buffType[index1] == 164) this.vortexDebuff = true; else if (this.buffType[index1] == 194) this.windPushed = true; else if (this.buffType[index1] == 195) this.witheredArmor = true; else if (this.buffType[index1] == 205) this.ballistaPanic = true; else if (this.buffType[index1] == 196) this.witheredWeapon = true; else if (this.buffType[index1] == 197) this.slowOgreSpit = true; else if (this.buffType[index1] == 198) this.parryDamageBuff = true; else if (this.buffType[index1] == 145) this.moonLeech = true; else if (this.buffType[index1] == 149) { this.webbed = true; if ((double) this.velocity.Y != 0.0) this.velocity = new Vector2(0.0f, 1E-06f); else this.velocity = Vector2.Zero; Player.jumpHeight = 0; this.gravity = 0.0f; this.moveSpeed = 0.0f; this.dash = 0; this.noKnockback = true; this.grappling[0] = -1; this.grapCount = 0; for (int index5 = 0; index5 < 1000; ++index5) { if (Main.projectile[index5].active && Main.projectile[index5].owner == this.whoAmI && Main.projectile[index5].aiStyle == 7) Main.projectile[index5].Kill(); } } else if (this.buffType[index1] == 43) this.defendedByPaladin = true; else if (this.buffType[index1] == 29) { this.magicCrit += 2; this.magicDamage += 0.05f; this.statManaMax2 += 20; this.manaCost -= 0.02f; } else if (this.buffType[index1] == 28) { if (!Main.dayTime && this.wolfAcc && !this.merman) { ++this.lifeRegen; this.wereWolf = true; this.meleeCrit += 2; this.meleeDamage += 0.051f; this.meleeSpeed += 0.051f; this.statDefense += 3; this.moveSpeed += 0.05f; } else { this.DelBuff(index1); --index1; } } else if (this.buffType[index1] == 33) { this.meleeDamage -= 0.051f; this.meleeSpeed -= 0.051f; this.statDefense -= 4; this.moveSpeed -= 0.1f; } else if (this.buffType[index1] == 25) { this.statDefense -= 4; this.meleeCrit += 2; this.meleeDamage += 0.1f; this.meleeSpeed += 0.1f; } else if (this.buffType[index1] == 26) { this.wellFed = true; this.statDefense += 2; this.meleeCrit += 2; this.meleeDamage += 0.05f; this.meleeSpeed += 0.05f; this.magicCrit += 2; this.magicDamage += 0.05f; this.rangedCrit += 2; this.rangedDamage += 0.05f; this.thrownCrit += 2; this.thrownDamage += 0.05f; this.minionDamage += 0.05f; this.minionKB += 0.5f; this.moveSpeed += 0.2f; } else if (this.buffType[index1] == 71) this.meleeEnchant = (byte) 1; else if (this.buffType[index1] == 73) this.meleeEnchant = (byte) 2; else if (this.buffType[index1] == 74) this.meleeEnchant = (byte) 3; else if (this.buffType[index1] == 75) this.meleeEnchant = (byte) 4; else if (this.buffType[index1] == 76) this.meleeEnchant = (byte) 5; else if (this.buffType[index1] == 77) this.meleeEnchant = (byte) 6; else if (this.buffType[index1] == 78) this.meleeEnchant = (byte) 7; else if (this.buffType[index1] == 79) this.meleeEnchant = (byte) 8; } } } private void CommonPetBuffHandle(int buffIndex, ref bool petBool, int petProjID) { this.buffTime[buffIndex] = 18000; petBool = true; bool flag = true; if (this.ownedProjectileCounts[petProjID] > 0) flag = false; if (!flag || this.whoAmI != Main.myPlayer) return; Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), 0.0f, 0.0f, petProjID, 0, 0.0f, this.whoAmI); } public void Counterweight(Vector2 hitPos, int dmg, float kb) { if (!this.yoyoGlove && this.counterWeight <= 0) return; int index1 = -1; int num1 = 0; int num2 = 0; for (int index2 = 0; index2 < 1000; ++index2) { if (Main.projectile[index2].active && Main.projectile[index2].owner == this.whoAmI) { if (Main.projectile[index2].counterweight) ++num2; else if (Main.projectile[index2].aiStyle == 99) { ++num1; index1 = index2; } } } if (this.yoyoGlove && num1 < 2) { if (index1 < 0) return; Vector2 vector2_1 = hitPos - this.Center; vector2_1.Normalize(); Vector2 vector2_2 = vector2_1 * 16f; Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_2.X, vector2_2.Y, Main.projectile[index1].type, Main.projectile[index1].damage, Main.projectile[index1].knockBack, this.whoAmI, 1f); } else { if (num2 >= num1) return; Vector2 vector2_3 = hitPos - this.Center; vector2_3.Normalize(); Vector2 vector2_4 = vector2_3 * 16f; float KnockBack = (float) (((double) kb + 6.0) / 2.0); if (num2 > 0) Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_4.X, vector2_4.Y, this.counterWeight, (int) ((double) dmg * 0.8), KnockBack, this.whoAmI, 1f); else Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_4.X, vector2_4.Y, this.counterWeight, (int) ((double) dmg * 0.8), KnockBack, this.whoAmI); } } public int beeType() { if (this.strongBees && Main.rand.Next(2) == 0) { this.makeStrongBee = true; return 566; } this.makeStrongBee = false; return 181; } public int beeDamage(int dmg) => this.makeStrongBee ? dmg + Main.rand.Next(1, 4) : dmg + Main.rand.Next(2); public float beeKB(float KB) => this.makeStrongBee ? (float) (0.5 + (double) KB * 1.10000002384186) : KB; public void Yoraiz0rEye() { int index = 0 + this.bodyFrame.Y / 56; if (index >= Main.OffsetsPlayerHeadgear.Length) index = 0; Vector2 spinningpoint1 = new Vector2((float) (3 * this.direction - (this.direction == 1 ? 1 : 0)), -11.5f * this.gravDir) + Vector2.UnitY * this.gfxOffY + this.Size / 2f + Main.OffsetsPlayerHeadgear[index]; Vector2 spinningpoint2 = new Vector2((float) (3 * this.shadowDirection[1] - (this.direction == 1 ? 1 : 0)), -11.5f * this.gravDir) + this.Size / 2f + Main.OffsetsPlayerHeadgear[index]; Vector2 vector2_1 = Vector2.Zero; if (this.mount.Active && this.mount.Cart) { int num = Math.Sign(this.velocity.X); if (num == 0) num = this.direction; vector2_1 = new Vector2(MathHelper.Lerp(0.0f, -8f, this.fullRotation / 0.7853982f), MathHelper.Lerp(0.0f, 2f, Math.Abs(this.fullRotation / 0.7853982f))).RotatedBy((double) this.fullRotation); if (num == Math.Sign(this.fullRotation)) vector2_1 *= MathHelper.Lerp(1f, 0.6f, Math.Abs(this.fullRotation / 0.7853982f)); } if ((double) this.fullRotation != 0.0) { spinningpoint1 = spinningpoint1.RotatedBy((double) this.fullRotation, this.fullRotationOrigin); spinningpoint2 = spinningpoint2.RotatedBy((double) this.fullRotation, this.fullRotationOrigin); } float num1 = 0.0f; if (this.mount.Active) num1 = (float) this.mount.PlayerOffset; Vector2 vector2_2 = this.position + spinningpoint1 + vector2_1; Vector2 vector2_3 = this.oldPosition + spinningpoint2 + vector2_1; vector2_3.Y -= num1 / 2f; vector2_2.Y -= num1 / 2f; float num2 = 1f; switch (this.yoraiz0rEye % 10) { case 1: return; case 2: num2 = 0.5f; break; case 3: num2 = 0.625f; break; case 4: num2 = 0.75f; break; case 5: num2 = 0.875f; break; case 6: num2 = 1f; break; case 7: num2 = 1.1f; break; } if (this.yoraiz0rEye < 7) { DelegateMethods.v3_1 = Main.hslToRgb(Main.rgbToHsl(this.eyeColor).X, 1f, 0.5f).ToVector3() * 0.5f * num2; if (this.velocity != Vector2.Zero) Utils.PlotTileLine(this.Center, this.Center + this.velocity * 2f, 4f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); else Utils.PlotTileLine(this.Left, this.Right, 4f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); } int num3 = (int) Vector2.Distance(vector2_2, vector2_3) / 3 + 1; if ((double) Vector2.Distance(vector2_2, vector2_3) % 3.0 != 0.0) ++num3; for (float num4 = 1f; (double) num4 <= (double) num3; ++num4) { Dust dust = Main.dust[Dust.NewDust(this.Center, 0, 0, 182)]; dust.position = Vector2.Lerp(vector2_3, vector2_2, num4 / (float) num3); dust.noGravity = true; dust.velocity = Vector2.Zero; dust.customData = (object) this; dust.scale = num2; dust.shader = GameShaders.Armor.GetSecondaryShader(this.cYorai, this); } } public void UpdateEquips(int i) { for (int index = 0; index < 58; ++index) { int type = this.inventory[index].type; if ((type == 15 || type == 707) && this.accWatch < 1) this.accWatch = 1; if ((type == 16 || type == 708) && this.accWatch < 2) this.accWatch = 2; if ((type == 17 || type == 709) && this.accWatch < 3) this.accWatch = 3; if (type == 393) this.accCompass = 1; if (type == 18) this.accDepthMeter = 1; if (type == 395 || type == 3123 || type == 3124) { this.accWatch = 3; this.accDepthMeter = 1; this.accCompass = 1; } if (type == 3120 || type == 3036 || type == 3123 || type == 3124) this.accFishFinder = true; if (type == 3037 || type == 3036 || type == 3123 || type == 3124) this.accWeatherRadio = true; if (type == 3096 || type == 3036 || type == 3123 || type == 3124) this.accCalendar = true; if (type == 3084 || type == 3122 || type == 3123 || type == 3124) this.accThirdEye = true; if (type == 3095 || type == 3122 || type == 3123 || type == 3124) this.accJarOfSouls = true; if (type == 3118 || type == 3122 || type == 3123 || type == 3124) this.accCritterGuide = true; if (type == 3099 || type == 3121 || type == 3123 || type == 3124) this.accStopwatch = true; if (type == 3102 || type == 3121 || type == 3123 || type == 3124) this.accOreFinder = true; if (type == 3119 || type == 3121 || type == 3123 || type == 3124) this.accDreamCatcher = true; if (type == 3619 || type == 3611) this.InfoAccMechShowWires = true; if (type == 486 || type == 3611) this.rulerLine = true; if (type == 2799) this.rulerGrid = true; if (type == 2216 || type == 3061) this.autoPaint = true; if (type == 3624) this.autoActuator = true; } for (int index1 = 0; index1 < 8 + this.extraAccessorySlots; ++index1) { if (!this.armor[index1].expertOnly || Main.expertMode) { int type = this.armor[index1].type; if ((type == 15 || type == 707) && this.accWatch < 1) this.accWatch = 1; if ((type == 16 || type == 708) && this.accWatch < 2) this.accWatch = 2; if ((type == 17 || type == 709) && this.accWatch < 3) this.accWatch = 3; if (type == 393) this.accCompass = 1; if (type == 18) this.accDepthMeter = 1; if (type == 395 || type == 3123 || type == 3124) { this.accWatch = 3; this.accDepthMeter = 1; this.accCompass = 1; } if (type == 3120 || type == 3036 || type == 3123 || type == 3124) this.accFishFinder = true; if (type == 3037 || type == 3036 || type == 3123 || type == 3124) this.accWeatherRadio = true; if (type == 3096 || type == 3036 || type == 3123 || type == 3124) this.accCalendar = true; if (type == 3084 || type == 3122 || type == 3123 || type == 3124) this.accThirdEye = true; if (type == 3095 || type == 3122 || type == 3123 || type == 3124) this.accJarOfSouls = true; if (type == 3118 || type == 3122 || type == 3123 || type == 3124) this.accCritterGuide = true; if (type == 3099 || type == 3121 || type == 3123 || type == 3124) this.accStopwatch = true; if (type == 3102 || type == 3121 || type == 3123 || type == 3124) this.accOreFinder = true; if (type == 3119 || type == 3121 || type == 3123 || type == 3124) this.accDreamCatcher = true; if (type == 3619) this.InfoAccMechShowWires = true; if (this.armor[index1].type == 3017 && this.whoAmI == Main.myPlayer && (double) this.velocity.Y == 0.0 && this.grappling[0] == -1) { int index2 = (int) this.Center.X / 16; int tileY = (int) ((double) this.position.Y + (double) this.height - 1.0) / 16; if (Main.tile[index2, tileY] == null) Main.tile[index2, tileY] = new Tile(); if (!Main.tile[index2, tileY].active() && Main.tile[index2, tileY].liquid == (byte) 0 && Main.tile[index2, tileY + 1] != null && WorldGen.SolidTile(index2, tileY + 1)) { Main.tile[index2, tileY].frameY = (short) 0; Main.tile[index2, tileY].slope((byte) 0); Main.tile[index2, tileY].halfBrick(false); if (Main.tile[index2, tileY + 1].type == (ushort) 2) { if (Main.rand.Next(2) == 0) { Main.tile[index2, tileY].active(true); Main.tile[index2, tileY].type = (ushort) 3; Main.tile[index2, tileY].frameX = (short) (18 * Main.rand.Next(6, 11)); while (Main.tile[index2, tileY].frameX == (short) 144) Main.tile[index2, tileY].frameX = (short) (18 * Main.rand.Next(6, 11)); } else { Main.tile[index2, tileY].active(true); Main.tile[index2, tileY].type = (ushort) 73; Main.tile[index2, tileY].frameX = (short) (18 * Main.rand.Next(6, 21)); while (Main.tile[index2, tileY].frameX == (short) 144) Main.tile[index2, tileY].frameX = (short) (18 * Main.rand.Next(6, 21)); } if (Main.netMode == 1) NetMessage.SendTileSquare(-1, index2, tileY, 1); } else if (Main.tile[index2, tileY + 1].type == (ushort) 109) { if (Main.rand.Next(2) == 0) { Main.tile[index2, tileY].active(true); Main.tile[index2, tileY].type = (ushort) 110; Main.tile[index2, tileY].frameX = (short) (18 * Main.rand.Next(4, 7)); while (Main.tile[index2, tileY].frameX == (short) 90) Main.tile[index2, tileY].frameX = (short) (18 * Main.rand.Next(4, 7)); } else { Main.tile[index2, tileY].active(true); Main.tile[index2, tileY].type = (ushort) 113; Main.tile[index2, tileY].frameX = (short) (18 * Main.rand.Next(2, 8)); while (Main.tile[index2, tileY].frameX == (short) 90) Main.tile[index2, tileY].frameX = (short) (18 * Main.rand.Next(2, 8)); } if (Main.netMode == 1) NetMessage.SendTileSquare(-1, index2, tileY, 1); } else if (Main.tile[index2, tileY + 1].type == (ushort) 60) { Main.tile[index2, tileY].active(true); Main.tile[index2, tileY].type = (ushort) 74; Main.tile[index2, tileY].frameX = (short) (18 * Main.rand.Next(9, 17)); if (Main.netMode == 1) NetMessage.SendTileSquare(-1, index2, tileY, 1); } } } this.statDefense += this.armor[index1].defense; this.lifeRegen += this.armor[index1].lifeRegen; if (this.armor[index1].shieldSlot > (sbyte) 0) this.hasRaisableShield = true; switch (this.armor[index1].type) { case 3797: ++this.maxTurrets; this.manaCost -= 0.1f; break; case 3798: this.magicDamage += 0.1f; this.minionDamage += 0.2f; break; case 3799: this.minionDamage += 0.1f; this.magicCrit += 20; break; case 3800: ++this.maxTurrets; this.lifeRegen += 8; break; case 3801: this.meleeDamage += 0.15f; this.minionDamage += 0.15f; break; case 3802: this.minionDamage += 0.15f; this.meleeCrit += 20; this.moveSpeed += 0.2f; break; case 3803: ++this.maxTurrets; this.rangedCrit += 10; break; case 3804: this.rangedDamage += 0.2f; this.minionDamage += 0.2f; break; case 3805: this.minionDamage += 0.1f; this.moveSpeed += 0.2f; break; case 3806: ++this.maxTurrets; this.meleeSpeed += 0.2f; break; case 3807: this.meleeDamage += 0.2f; this.minionDamage += 0.2f; break; case 3808: this.minionDamage += 0.1f; this.meleeCrit += 10; this.moveSpeed += 0.2f; break; case 3871: this.maxTurrets += 2; this.minionDamage += 0.1f; break; case 3872: this.minionDamage += 0.3f; this.lifeRegen += 16; break; case 3873: this.minionDamage += 0.2f; this.meleeCrit += 20; this.moveSpeed += 0.3f; break; case 3874: this.maxTurrets += 2; this.magicDamage += 0.1f; this.minionDamage += 0.1f; break; case 3875: this.minionDamage += 0.3f; this.magicDamage += 0.15f; break; case 3876: this.minionDamage += 0.2f; this.magicCrit += 25; break; case 3877: this.maxTurrets += 2; this.minionDamage += 0.1f; this.rangedCrit += 10; break; case 3878: this.minionDamage += 0.25f; this.rangedDamage += 0.25f; break; case 3879: this.minionDamage += 0.25f; this.moveSpeed += 0.2f; break; case 3880: this.maxTurrets += 2; this.minionDamage += 0.2f; this.meleeDamage += 0.2f; break; case 3881: this.meleeSpeed += 0.2f; this.minionDamage += 0.2f; break; case 3882: this.minionDamage += 0.2f; this.meleeCrit += 20; this.moveSpeed += 0.2f; break; } if (this.armor[index1].type == 268) this.accDivingHelm = true; if (this.armor[index1].type == 238) this.magicDamage += 0.15f; if (this.armor[index1].type == 3770) this.slowFall = true; if (this.armor[index1].type == 3776) { this.magicDamage += 0.15f; this.minionDamage += 0.15f; } if (this.armor[index1].type == 3777) this.statManaMax2 += 80; if (this.armor[index1].type == 3778) this.maxMinions += 2; if (this.armor[index1].type == 3212) this.armorPenetration += 5; if (this.armor[index1].type == 2277) { this.magicDamage += 0.05f; this.meleeDamage += 0.05f; this.rangedDamage += 0.05f; this.thrownDamage += 0.05f; this.magicCrit += 5; this.rangedCrit += 5; this.meleeCrit += 5; this.thrownCrit += 5; this.meleeSpeed += 0.1f; this.moveSpeed += 0.1f; } if (this.armor[index1].type == 2279) { this.magicDamage += 0.06f; this.magicCrit += 6; this.manaCost -= 0.1f; } if (this.armor[index1].type == 3109) this.nightVision = true; if (this.armor[index1].type == 256) this.thrownVelocity += 0.15f; if (this.armor[index1].type == 257) this.thrownDamage += 0.15f; if (this.armor[index1].type == 258) this.thrownCrit += 10; if (this.armor[index1].type == 3374) this.thrownVelocity += 0.2f; if (this.armor[index1].type == 3375) this.thrownDamage += 0.2f; if (this.armor[index1].type == 3376) this.thrownCrit += 15; if (this.armor[index1].type == 2275) { this.magicDamage += 0.07f; this.magicCrit += 7; } if (this.armor[index1].type == 123 || this.armor[index1].type == 124 || this.armor[index1].type == 125) this.magicDamage += 0.07f; if (this.armor[index1].type == 151 || this.armor[index1].type == 152 || this.armor[index1].type == 153 || this.armor[index1].type == 959) this.rangedDamage += 0.05f; if (this.armor[index1].type == 111 || this.armor[index1].type == 228 || this.armor[index1].type == 229 || this.armor[index1].type == 230 || this.armor[index1].type == 960 || this.armor[index1].type == 961 || this.armor[index1].type == 962) this.statManaMax2 += 20; if (this.armor[index1].type == 228 || this.armor[index1].type == 960) this.statManaMax2 += 20; if (this.armor[index1].type == 228 || this.armor[index1].type == 229 || this.armor[index1].type == 230 || this.armor[index1].type == 960 || this.armor[index1].type == 961 || this.armor[index1].type == 962) this.magicCrit += 4; if (this.armor[index1].type == 100 || this.armor[index1].type == 101 || this.armor[index1].type == 102) this.meleeSpeed += 0.07f; if (this.armor[index1].type == 956 || this.armor[index1].type == 957 || this.armor[index1].type == 958) this.meleeSpeed += 0.07f; if (this.armor[index1].type == 792 || this.armor[index1].type == 793 || this.armor[index1].type == 794) { this.meleeDamage += 0.02f; this.rangedDamage += 0.02f; this.magicDamage += 0.02f; this.thrownDamage += 0.02f; } if (this.armor[index1].type == 371) { this.magicCrit += 9; this.statManaMax2 += 40; } if (this.armor[index1].type == 372) { this.moveSpeed += 0.07f; this.meleeSpeed += 0.12f; } if (this.armor[index1].type == 373) { this.rangedDamage += 0.1f; this.rangedCrit += 6; } if (this.armor[index1].type == 374) { this.magicCrit += 3; this.meleeCrit += 3; this.rangedCrit += 3; } if (this.armor[index1].type == 375) this.moveSpeed += 0.1f; if (this.armor[index1].type == 376) { this.magicDamage += 0.15f; this.statManaMax2 += 60; } if (this.armor[index1].type == 377) { this.meleeCrit += 5; this.meleeDamage += 0.1f; } if (this.armor[index1].type == 378) { this.rangedDamage += 0.12f; this.rangedCrit += 7; } if (this.armor[index1].type == 379) { this.rangedDamage += 0.05f; this.meleeDamage += 0.05f; this.magicDamage += 0.05f; } if (this.armor[index1].type == 380) { this.magicCrit += 3; this.meleeCrit += 3; this.rangedCrit += 3; } if (this.armor[index1].type >= 2367 && this.armor[index1].type <= 2369) this.fishingSkill += 5; if (this.armor[index1].type == 400) { this.magicDamage += 0.11f; this.magicCrit += 11; this.statManaMax2 += 80; } if (this.armor[index1].type == 401) { this.meleeCrit += 7; this.meleeDamage += 0.14f; } if (this.armor[index1].type == 402) { this.rangedDamage += 0.14f; this.rangedCrit += 8; } if (this.armor[index1].type == 403) { this.rangedDamage += 0.06f; this.meleeDamage += 0.06f; this.magicDamage += 0.06f; } if (this.armor[index1].type == 404) { this.magicCrit += 4; this.meleeCrit += 4; this.rangedCrit += 4; this.moveSpeed += 0.05f; } if (this.armor[index1].type == 1205) { this.meleeDamage += 0.08f; this.meleeSpeed += 0.12f; } if (this.armor[index1].type == 1206) { this.rangedDamage += 0.09f; this.rangedCrit += 9; } if (this.armor[index1].type == 1207) { this.magicDamage += 0.07f; this.magicCrit += 7; this.statManaMax2 += 60; } if (this.armor[index1].type == 1208) { this.meleeDamage += 0.03f; this.rangedDamage += 0.03f; this.magicDamage += 0.03f; this.magicCrit += 2; this.meleeCrit += 2; this.rangedCrit += 2; } if (this.armor[index1].type == 1209) { this.meleeDamage += 0.02f; this.rangedDamage += 0.02f; this.magicDamage += 0.02f; ++this.magicCrit; ++this.meleeCrit; ++this.rangedCrit; } if (this.armor[index1].type == 1210) { this.meleeDamage += 0.07f; this.meleeSpeed += 0.07f; this.moveSpeed += 0.07f; } if (this.armor[index1].type == 1211) { this.rangedCrit += 15; this.moveSpeed += 0.08f; } if (this.armor[index1].type == 1212) { this.magicCrit += 18; this.statManaMax2 += 80; } if (this.armor[index1].type == 1213) { this.magicCrit += 6; this.meleeCrit += 6; this.rangedCrit += 6; } if (this.armor[index1].type == 1214) this.moveSpeed += 0.11f; if (this.armor[index1].type == 1215) { this.meleeDamage += 0.08f; this.meleeCrit += 8; this.meleeSpeed += 0.08f; } if (this.armor[index1].type == 1216) { this.rangedDamage += 0.16f; this.rangedCrit += 7; } if (this.armor[index1].type == 1217) { this.magicDamage += 0.16f; this.magicCrit += 7; this.statManaMax2 += 100; } if (this.armor[index1].type == 1218) { this.meleeDamage += 0.04f; this.rangedDamage += 0.04f; this.magicDamage += 0.04f; this.magicCrit += 3; this.meleeCrit += 3; this.rangedCrit += 3; } if (this.armor[index1].type == 1219) { this.meleeDamage += 0.03f; this.rangedDamage += 0.03f; this.magicDamage += 0.03f; this.magicCrit += 3; this.meleeCrit += 3; this.rangedCrit += 3; this.moveSpeed += 0.06f; } if (this.armor[index1].type == 558) { this.magicDamage += 0.12f; this.magicCrit += 12; this.statManaMax2 += 100; } if (this.armor[index1].type == 559) { this.meleeCrit += 10; this.meleeDamage += 0.1f; this.meleeSpeed += 0.1f; } if (this.armor[index1].type == 553) { this.rangedDamage += 0.15f; this.rangedCrit += 8; } if (this.armor[index1].type == 551) { this.magicCrit += 7; this.meleeCrit += 7; this.rangedCrit += 7; } if (this.armor[index1].type == 552) { this.rangedDamage += 0.07f; this.meleeDamage += 0.07f; this.magicDamage += 0.07f; this.moveSpeed += 0.08f; } if (this.armor[index1].type == 1001) { this.meleeDamage += 0.16f; this.meleeCrit += 6; } if (this.armor[index1].type == 1002) { this.rangedDamage += 0.16f; this.ammoCost80 = true; } if (this.armor[index1].type == 1003) { this.statManaMax2 += 80; this.manaCost -= 0.17f; this.magicDamage += 0.16f; } if (this.armor[index1].type == 1004) { this.meleeDamage += 0.05f; this.magicDamage += 0.05f; this.rangedDamage += 0.05f; this.magicCrit += 7; this.meleeCrit += 7; this.rangedCrit += 7; } if (this.armor[index1].type == 1005) { this.magicCrit += 8; this.meleeCrit += 8; this.rangedCrit += 8; this.moveSpeed += 0.05f; } if (this.armor[index1].type == 2189) { this.statManaMax2 += 60; this.manaCost -= 0.13f; this.magicDamage += 0.05f; this.magicCrit += 5; } if (this.armor[index1].type == 1503) this.magicDamage -= 0.4f; if (this.armor[index1].type == 1504) { this.magicDamage += 0.07f; this.magicCrit += 7; } if (this.armor[index1].type == 1505) { this.magicDamage += 0.08f; this.moveSpeed += 0.08f; } if (this.armor[index1].type == 1546) { this.rangedCrit += 5; this.arrowDamage += 0.15f; } if (this.armor[index1].type == 1547) { this.rangedCrit += 5; this.bulletDamage += 0.15f; } if (this.armor[index1].type == 1548) { this.rangedCrit += 5; this.rocketDamage += 0.15f; } if (this.armor[index1].type == 1549) { this.rangedCrit += 13; this.rangedDamage += 0.13f; this.ammoCost80 = true; } if (this.armor[index1].type == 1550) { this.rangedCrit += 7; this.moveSpeed += 0.12f; } if (this.armor[index1].type == 1282) { this.statManaMax2 += 20; this.manaCost -= 0.05f; } if (this.armor[index1].type == 1283) { this.statManaMax2 += 40; this.manaCost -= 0.07f; } if (this.armor[index1].type == 1284) { this.statManaMax2 += 40; this.manaCost -= 0.09f; } if (this.armor[index1].type == 1285) { this.statManaMax2 += 60; this.manaCost -= 0.11f; } if (this.armor[index1].type == 1286) { this.statManaMax2 += 60; this.manaCost -= 0.13f; } if (this.armor[index1].type == 1287) { this.statManaMax2 += 80; this.manaCost -= 0.15f; } if (this.armor[index1].type == 1316 || this.armor[index1].type == 1317 || this.armor[index1].type == 1318) this.aggro += 250; if (this.armor[index1].type == 1316) this.meleeDamage += 0.06f; if (this.armor[index1].type == 1317) { this.meleeDamage += 0.08f; this.meleeCrit += 8; } if (this.armor[index1].type == 1318) this.meleeCrit += 4; if (this.armor[index1].type == 2199 || this.armor[index1].type == 2202) this.aggro += 250; if (this.armor[index1].type == 2201) this.aggro += 400; if (this.armor[index1].type == 2199) this.meleeDamage += 0.06f; if (this.armor[index1].type == 2200) { this.meleeDamage += 0.08f; this.meleeCrit += 8; this.meleeSpeed += 0.06f; this.moveSpeed += 0.06f; } if (this.armor[index1].type == 2201) { this.meleeDamage += 0.05f; this.meleeCrit += 5; } if (this.armor[index1].type == 2202) { this.meleeSpeed += 0.06f; this.moveSpeed += 0.06f; } if (this.armor[index1].type == 684) { this.rangedDamage += 0.16f; this.meleeDamage += 0.16f; } if (this.armor[index1].type == 685) { this.meleeCrit += 11; this.rangedCrit += 11; } if (this.armor[index1].type == 686) { this.moveSpeed += 0.08f; this.meleeSpeed += 0.07f; } if (this.armor[index1].type == 2361) { ++this.maxMinions; this.minionDamage += 0.04f; } if (this.armor[index1].type == 2362) { ++this.maxMinions; this.minionDamage += 0.04f; } if (this.armor[index1].type == 2363) this.minionDamage += 0.05f; if (this.armor[index1].type >= 1158 && this.armor[index1].type <= 1161) ++this.maxMinions; if (this.armor[index1].type >= 1159 && this.armor[index1].type <= 1161) this.minionDamage += 0.1f; if (this.armor[index1].type >= 2370 && this.armor[index1].type <= 2371) { this.minionDamage += 0.05f; ++this.maxMinions; } if (this.armor[index1].type == 2372) { this.minionDamage += 0.06f; ++this.maxMinions; } if (this.armor[index1].type == 3381 || this.armor[index1].type == 3382 || this.armor[index1].type == 3383) { if (this.armor[index1].type != 3381) ++this.maxMinions; ++this.maxMinions; this.minionDamage += 0.22f; } if (this.armor[index1].type == 2763) { this.aggro += 300; this.meleeCrit += 17; } if (this.armor[index1].type == 2764) { this.aggro += 300; this.meleeDamage += 0.22f; } if (this.armor[index1].type == 2765) { this.aggro += 300; this.meleeSpeed += 0.15f; this.moveSpeed += 0.15f; } if (this.armor[index1].type == 2757) { this.rangedCrit += 7; this.rangedDamage += 0.16f; } if (this.armor[index1].type == 2758) { this.ammoCost75 = true; this.rangedCrit += 12; this.rangedDamage += 0.12f; } if (this.armor[index1].type == 2759) { this.rangedCrit += 8; this.rangedDamage += 0.08f; this.moveSpeed += 0.1f; } if (this.armor[index1].type == 2760) { this.statManaMax2 += 60; this.manaCost -= 0.15f; this.magicCrit += 7; this.magicDamage += 0.07f; } if (this.armor[index1].type == 2761) { this.magicDamage += 0.09f; this.magicCrit += 9; } if (this.armor[index1].type == 2762) { this.moveSpeed += 0.1f; this.magicDamage += 0.1f; } if (this.armor[index1].type >= 1832 && this.armor[index1].type <= 1834) ++this.maxMinions; if (this.armor[index1].type >= 1832 && this.armor[index1].type <= 1834) this.minionDamage += 0.11f; if (this.armor[index1].prefix == (byte) 62) ++this.statDefense; if (this.armor[index1].prefix == (byte) 63) this.statDefense += 2; if (this.armor[index1].prefix == (byte) 64) this.statDefense += 3; if (this.armor[index1].prefix == (byte) 65) this.statDefense += 4; if (this.armor[index1].prefix == (byte) 66) this.statManaMax2 += 20; if (this.armor[index1].prefix == (byte) 67) { this.meleeCrit += 2; this.rangedCrit += 2; this.magicCrit += 2; this.thrownCrit += 2; } if (this.armor[index1].prefix == (byte) 68) { this.meleeCrit += 4; this.rangedCrit += 4; this.magicCrit += 4; this.thrownCrit += 4; } if (this.armor[index1].prefix == (byte) 69) { this.meleeDamage += 0.01f; this.rangedDamage += 0.01f; this.magicDamage += 0.01f; this.minionDamage += 0.01f; this.thrownDamage += 0.01f; } if (this.armor[index1].prefix == (byte) 70) { this.meleeDamage += 0.02f; this.rangedDamage += 0.02f; this.magicDamage += 0.02f; this.minionDamage += 0.02f; this.thrownDamage += 0.02f; } if (this.armor[index1].prefix == (byte) 71) { this.meleeDamage += 0.03f; this.rangedDamage += 0.03f; this.magicDamage += 0.03f; this.minionDamage += 0.03f; this.thrownDamage += 0.03f; } if (this.armor[index1].prefix == (byte) 72) { this.meleeDamage += 0.04f; this.rangedDamage += 0.04f; this.magicDamage += 0.04f; this.minionDamage += 0.04f; this.thrownDamage += 0.04f; } if (this.armor[index1].prefix == (byte) 73) this.moveSpeed += 0.01f; if (this.armor[index1].prefix == (byte) 74) this.moveSpeed += 0.02f; if (this.armor[index1].prefix == (byte) 75) this.moveSpeed += 0.03f; if (this.armor[index1].prefix == (byte) 76) this.moveSpeed += 0.04f; if (this.armor[index1].prefix == (byte) 77) this.meleeSpeed += 0.01f; if (this.armor[index1].prefix == (byte) 78) this.meleeSpeed += 0.02f; if (this.armor[index1].prefix == (byte) 79) this.meleeSpeed += 0.03f; if (this.armor[index1].prefix == (byte) 80) this.meleeSpeed += 0.04f; } } bool flag1 = false; bool flag2 = false; bool flag3 = false; for (int index = 3; index < 8 + this.extraAccessorySlots; ++index) { if (!this.armor[index].expertOnly || Main.expertMode) { if (this.armor[index].type == 3810 || this.armor[index].type == 3809 || this.armor[index].type == 3812 || this.armor[index].type == 3811) this.dd2Accessory = true; if (this.armor[index].type == 3015) { this.aggro -= 400; this.meleeCrit += 5; this.magicCrit += 5; this.rangedCrit += 5; this.thrownCrit += 5; this.meleeDamage += 0.05f; this.magicDamage += 0.05f; this.rangedDamage += 0.05f; this.thrownDamage += 0.05f; this.minionDamage += 0.05f; } if (this.armor[index].type == 3016) this.aggro += 400; if (this.armor[index].type == 2373) this.accFishingLine = true; if (this.armor[index].type == 2374) this.fishingSkill += 10; if (this.armor[index].type == 2375) this.accTackleBox = true; if (this.armor[index].type == 3721) { this.accFishingLine = true; this.accTackleBox = true; this.fishingSkill += 10; } if (this.armor[index].type == 3090) { this.npcTypeNoAggro[1] = true; this.npcTypeNoAggro[16] = true; this.npcTypeNoAggro[59] = true; this.npcTypeNoAggro[71] = true; this.npcTypeNoAggro[81] = true; this.npcTypeNoAggro[138] = true; this.npcTypeNoAggro[121] = true; this.npcTypeNoAggro[122] = true; this.npcTypeNoAggro[141] = true; this.npcTypeNoAggro[147] = true; this.npcTypeNoAggro[183] = true; this.npcTypeNoAggro[184] = true; this.npcTypeNoAggro[204] = true; this.npcTypeNoAggro[225] = true; this.npcTypeNoAggro[244] = true; this.npcTypeNoAggro[302] = true; this.npcTypeNoAggro[333] = true; this.npcTypeNoAggro[335] = true; this.npcTypeNoAggro[334] = true; this.npcTypeNoAggro[336] = true; this.npcTypeNoAggro[537] = true; } if (this.armor[index].stringColor > 0) this.yoyoString = true; if (this.armor[index].type == 3366) { this.counterWeight = 556 + Main.rand.Next(6); this.yoyoGlove = true; this.yoyoString = true; } if (this.armor[index].type >= 3309 && this.armor[index].type <= 3314) this.counterWeight = 556 + this.armor[index].type - 3309; if (this.armor[index].type == 3334) this.yoyoGlove = true; if (this.armor[index].type == 3337) this.shinyStone = true; if (this.armor[index].type == 3336) { this.SporeSac(); this.sporeSac = true; } if (this.armor[index].type == 2423) { this.autoJump = true; this.jumpSpeedBoost += 2.4f; this.extraFall += 15; } if (this.armor[index].type == 857) this.doubleJumpSandstorm = true; if (this.armor[index].type == 983) { this.doubleJumpSandstorm = true; this.jumpBoost = true; } if (this.armor[index].type == 987) this.doubleJumpBlizzard = true; if (this.armor[index].type == 1163) { this.doubleJumpBlizzard = true; this.jumpBoost = true; } if (this.armor[index].type == 1724) this.doubleJumpFart = true; if (this.armor[index].type == 1863) { this.doubleJumpFart = true; this.jumpBoost = true; } if (this.armor[index].type == 1164) { this.doubleJumpCloud = true; this.doubleJumpSandstorm = true; this.doubleJumpBlizzard = true; this.jumpBoost = true; } if (this.armor[index].type == 1250) { this.jumpBoost = true; this.doubleJumpCloud = true; this.noFallDmg = true; } if (this.armor[index].type == 1252) { this.doubleJumpSandstorm = true; this.jumpBoost = true; this.noFallDmg = true; } if (this.armor[index].type == 1251) { this.doubleJumpBlizzard = true; this.jumpBoost = true; this.noFallDmg = true; } if (this.armor[index].type == 3250) { this.doubleJumpFart = true; this.jumpBoost = true; this.noFallDmg = true; } if (this.armor[index].type == 3252) { this.doubleJumpSail = true; this.jumpBoost = true; this.noFallDmg = true; } if (this.armor[index].type == 3251) { this.jumpBoost = true; this.bee = true; this.noFallDmg = true; } if (this.armor[index].type == 1249) { this.jumpBoost = true; this.bee = true; } if (this.armor[index].type == 3241) { this.jumpBoost = true; this.doubleJumpSail = true; } if (this.armor[index].type == 1253 && (double) this.statLife <= (double) this.statLifeMax2 * 0.5) this.AddBuff(62, 5); if (this.armor[index].type == 1290) this.panic = true; if ((this.armor[index].type == 1300 || this.armor[index].type == 1858) && (this.inventory[this.selectedItem].useAmmo == AmmoID.Bullet || this.inventory[this.selectedItem].useAmmo == AmmoID.CandyCorn || this.inventory[this.selectedItem].useAmmo == AmmoID.Stake || this.inventory[this.selectedItem].useAmmo == 23)) this.scope = true; if (this.armor[index].type == 1858) { this.rangedCrit += 10; this.rangedDamage += 0.1f; } if (this.armor[index].type == 1303 && this.wet) Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.9f, 0.2f, 0.6f); if (this.armor[index].type == 1301) { this.meleeCrit += 8; this.rangedCrit += 8; this.magicCrit += 8; this.thrownCrit += 8; this.meleeDamage += 0.1f; this.rangedDamage += 0.1f; this.magicDamage += 0.1f; this.minionDamage += 0.1f; this.thrownDamage += 0.1f; } if (this.armor[index].type == 982) { this.statManaMax2 += 20; ++this.manaRegenDelayBonus; this.manaRegenBonus += 25; } if (this.armor[index].type == 1595) { this.statManaMax2 += 20; this.magicCuffs = true; } if (this.armor[index].type == 2219) this.manaMagnet = true; if (this.armor[index].type == 2220) { this.manaMagnet = true; this.magicDamage += 0.15f; } if (this.armor[index].type == 2221) { this.manaMagnet = true; this.magicCuffs = true; } if (this.whoAmI == Main.myPlayer && this.armor[index].type == 1923) { ++Player.tileRangeX; ++Player.tileRangeY; } if (this.armor[index].type == 1247) { this.starCloak = true; this.bee = true; } if (this.armor[index].type == 1248) { this.meleeCrit += 10; this.rangedCrit += 10; this.magicCrit += 10; this.thrownCrit += 10; } if (this.armor[index].type == 854) this.discount = true; if (this.armor[index].type == 855) this.coins = true; if (this.armor[index].type == 3033) this.goldRing = true; if (this.armor[index].type == 3034) { this.goldRing = true; this.coins = true; } if (this.armor[index].type == 3035) { this.goldRing = true; this.coins = true; this.discount = true; } if (this.armor[index].type == 53) this.doubleJumpCloud = true; if (this.armor[index].type == 3201) this.doubleJumpSail = true; if (this.armor[index].type == 54) this.accRunSpeed = 6f; if (this.armor[index].type == 3068) this.cordage = true; if (this.armor[index].type == 1579) { this.accRunSpeed = 6f; this.coldDash = true; } if (this.armor[index].type == 3200) { this.accRunSpeed = 6f; this.sailDash = true; } if (this.armor[index].type == 128) this.rocketBoots = 1; if (this.armor[index].type == 156) this.noKnockback = true; if (this.armor[index].type == 158) this.noFallDmg = true; if (this.armor[index].type == 934) this.carpet = true; if (this.armor[index].type == 953) ++this.spikedBoots; if (this.armor[index].type == 975) ++this.spikedBoots; if (this.armor[index].type == 976) this.spikedBoots += 2; if (this.armor[index].type == 977) this.dash = 1; if (this.armor[index].type == 3097) this.dash = 2; if (this.armor[index].type == 963) this.blackBelt = true; if (this.armor[index].type == 984) { this.blackBelt = true; this.dash = 1; this.spikedBoots = 2; } if (this.armor[index].type == 1131) this.gravControl2 = true; if (this.armor[index].type == 1132) this.bee = true; if (this.armor[index].type == 1578) { this.bee = true; this.panic = true; } if (this.armor[index].type == 3224) this.endurance += 0.17f; if (this.armor[index].type == 3223) this.brainOfConfusion = true; if (this.armor[index].type == 950) this.iceSkate = true; if (this.armor[index].type == 159) this.jumpBoost = true; if (this.armor[index].type == 3225) this.jumpBoost = true; if (this.armor[index].type == 187) this.accFlipper = true; if (this.armor[index].type == 211) this.meleeSpeed += 0.12f; if (this.armor[index].type == 223) this.manaCost -= 0.06f; if (this.armor[index].type == 285) this.moveSpeed += 0.05f; if (this.armor[index].type == 212) this.moveSpeed += 0.1f; if (this.armor[index].type == 267) this.killGuide = true; if (this.armor[index].type == 1307) this.killClothier = true; if (this.armor[index].type == 193) this.fireWalk = true; if (this.armor[index].type == 861) { this.accMerman = true; this.wolfAcc = true; if (this.hideVisual[index]) { this.hideMerman = true; this.hideWolf = true; } } if (this.armor[index].type == 862) { this.starCloak = true; this.longInvince = true; } if (this.armor[index].type == 860) this.pStone = true; if (this.armor[index].type == 863) this.waterWalk2 = true; if (this.armor[index].type == 907) { this.waterWalk2 = true; this.fireWalk = true; } if (this.armor[index].type == 908) { this.waterWalk = true; this.fireWalk = true; this.lavaMax += 420; } if (this.armor[index].type == 906) this.lavaMax += 420; if (this.armor[index].type == 485) { this.wolfAcc = true; if (this.hideVisual[index]) this.hideWolf = true; } if (this.armor[index].type == 486) this.rulerLine = true; if (this.armor[index].type == 2799) this.rulerGrid = true; if (this.armor[index].type == 394) { this.accFlipper = true; this.accDivingHelm = true; } if (this.armor[index].type == 396) { this.noFallDmg = true; this.fireWalk = true; } if (this.armor[index].type == 397) { this.noKnockback = true; this.fireWalk = true; } if (this.armor[index].type == 399) { this.jumpBoost = true; this.doubleJumpCloud = true; } if (this.armor[index].type == 405) { this.accRunSpeed = 6f; this.rocketBoots = 2; } if (this.armor[index].type == 1860) { this.accFlipper = true; this.accDivingHelm = true; if (this.wet) Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.9f, 0.2f, 0.6f); } if (this.armor[index].type == 1861) { this.arcticDivingGear = true; this.accFlipper = true; this.accDivingHelm = true; this.iceSkate = true; if (this.wet) Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.2f, 0.8f, 0.9f); } if (this.armor[index].type == 2214) flag2 = true; if (this.armor[index].type == 2215) flag3 = true; if (this.armor[index].type == 2216) this.autoPaint = true; if (this.armor[index].type == 2217) flag1 = true; if (this.armor[index].type == 3061) { flag1 = true; flag2 = true; this.autoPaint = true; flag3 = true; } if (this.armor[index].type == 3624) this.autoActuator = true; if (this.armor[index].type == 897) { this.kbGlove = true; this.meleeSpeed += 0.12f; } if (this.armor[index].type == 1343) { this.kbGlove = true; this.meleeSpeed += 0.1f; this.meleeDamage += 0.1f; this.magmaStone = true; } if (this.armor[index].type == 1167) { this.minionKB += 2f; this.minionDamage += 0.15f; } if (this.armor[index].type == 1864) { this.minionKB += 2f; this.minionDamage += 0.15f; ++this.maxMinions; } if (this.armor[index].type == 1845) { this.minionDamage += 0.1f; ++this.maxMinions; } if (this.armor[index].type == 1321) { this.magicQuiver = true; this.arrowDamage += 0.1f; } if (this.armor[index].type == 1322) this.magmaStone = true; if (this.armor[index].type == 1323) this.lavaRose = true; if (this.armor[index].type == 3333) this.strongBees = true; if (this.armor[index].type == 938) { this.noKnockback = true; if ((double) this.statLife > (double) this.statLifeMax2 * 0.25) { this.hasPaladinShield = true; if (i != Main.myPlayer && this.miscCounter % 10 == 0) { int player = Main.myPlayer; if (Main.player[player].team == this.team && this.team != 0) { double num1 = (double) this.position.X - (double) Main.player[player].position.X; float num2 = this.position.Y - Main.player[player].position.Y; if (Math.Sqrt(num1 * num1 + (double) num2 * (double) num2) < 800.0) Main.player[player].AddBuff(43, 20); } } } } if (this.armor[index].type == 936) { this.kbGlove = true; this.meleeSpeed += 0.12f; this.meleeDamage += 0.12f; } if (this.armor[index].type == 898) { this.accRunSpeed = 6.75f; this.rocketBoots = 2; this.moveSpeed += 0.08f; } if (this.armor[index].type == 1862) { this.accRunSpeed = 6.75f; this.rocketBoots = 3; this.moveSpeed += 0.08f; this.iceSkate = true; } if (this.armor[index].type == 3110) { this.accMerman = true; this.wolfAcc = true; if (this.hideVisual[index]) { this.hideMerman = true; this.hideWolf = true; } } if (this.armor[index].type == 1865 || this.armor[index].type == 3110) { this.lifeRegen += 2; this.statDefense += 4; this.meleeSpeed += 0.1f; this.meleeDamage += 0.1f; this.meleeCrit += 2; this.rangedDamage += 0.1f; this.rangedCrit += 2; this.magicDamage += 0.1f; this.magicCrit += 2; this.pickSpeed -= 0.15f; this.minionDamage += 0.1f; this.minionKB += 0.5f; this.thrownDamage += 0.1f; this.thrownCrit += 2; } if (this.armor[index].type == 899 && Main.dayTime) { this.lifeRegen += 2; this.statDefense += 4; this.meleeSpeed += 0.1f; this.meleeDamage += 0.1f; this.meleeCrit += 2; this.rangedDamage += 0.1f; this.rangedCrit += 2; this.magicDamage += 0.1f; this.magicCrit += 2; this.pickSpeed -= 0.15f; this.minionDamage += 0.1f; this.minionKB += 0.5f; this.thrownDamage += 0.1f; this.thrownCrit += 2; } if (this.armor[index].type == 900 && (!Main.dayTime || Main.eclipse)) { this.lifeRegen += 2; this.statDefense += 4; this.meleeSpeed += 0.1f; this.meleeDamage += 0.1f; this.meleeCrit += 2; this.rangedDamage += 0.1f; this.rangedCrit += 2; this.magicDamage += 0.1f; this.magicCrit += 2; this.pickSpeed -= 0.15f; this.minionDamage += 0.1f; this.minionKB += 0.5f; this.thrownDamage += 0.1f; this.thrownCrit += 2; } if (this.armor[index].type == 407) this.blockRange = 1; if (this.armor[index].type == 489) this.magicDamage += 0.15f; if (this.armor[index].type == 490) this.meleeDamage += 0.15f; if (this.armor[index].type == 491) this.rangedDamage += 0.15f; if (this.armor[index].type == 2998) this.minionDamage += 0.15f; if (this.armor[index].type == 935) { this.magicDamage += 0.12f; this.meleeDamage += 0.12f; this.rangedDamage += 0.12f; this.minionDamage += 0.12f; this.thrownDamage += 0.12f; } if (this.armor[index].type == 492) this.wingTimeMax = 100; if (this.armor[index].type == 493) this.wingTimeMax = 100; if (this.armor[index].type == 748) this.wingTimeMax = 115; if (this.armor[index].type == 749) this.wingTimeMax = 130; if (this.armor[index].type == 761) this.wingTimeMax = 130; if (this.armor[index].type == 785) this.wingTimeMax = 140; if (this.armor[index].type == 786) this.wingTimeMax = 140; if (this.armor[index].type == 821) this.wingTimeMax = 160; if (this.armor[index].type == 822) this.wingTimeMax = 160; if (this.armor[index].type == 823) this.wingTimeMax = 160; if (this.armor[index].type == 2280) this.wingTimeMax = 160; if (this.armor[index].type == 2494) this.wingTimeMax = 100; if (this.armor[index].type == 2609) { this.wingTimeMax = 180; this.ignoreWater = true; } if (this.armor[index].type == 948) this.wingTimeMax = 180; if (this.armor[index].type == 1162) this.wingTimeMax = 160; if (this.armor[index].type == 1165) this.wingTimeMax = 140; if (this.armor[index].type == 1515) this.wingTimeMax = 130; if (this.armor[index].type == 665) this.wingTimeMax = 150; if (this.armor[index].type == 1583) this.wingTimeMax = 150; if (this.armor[index].type == 1584) this.wingTimeMax = 150; if (this.armor[index].type == 1585) this.wingTimeMax = 150; if (this.armor[index].type == 1586) this.wingTimeMax = 150; if (this.armor[index].type == 3228) this.wingTimeMax = 150; if (this.armor[index].type == 3580) this.wingTimeMax = 150; if (this.armor[index].type == 3582) this.wingTimeMax = 150; if (this.armor[index].type == 3588) this.wingTimeMax = 150; if (this.armor[index].type == 3592) this.wingTimeMax = 150; if (this.armor[index].type == 3924) this.wingTimeMax = 150; if (this.armor[index].type == 3928) this.wingTimeMax = 150; if (this.armor[index].type == 1797) this.wingTimeMax = 180; if (this.armor[index].type == 1830) this.wingTimeMax = 180; if (this.armor[index].type == 1866) this.wingTimeMax = 170; if (this.armor[index].type == 1871) this.wingTimeMax = 170; if (this.armor[index].type == 2770) this.wingTimeMax = 160; if (this.armor[index].type == 3468) this.wingTimeMax = 180; if (this.armor[index].type == 3469) this.wingTimeMax = 160; if (this.armor[index].type == 3470) this.wingTimeMax = 160; if (this.armor[index].type == 3471) this.wingTimeMax = 180; if (this.armor[index].type == 3883) this.wingTimeMax = 150; if (this.armor[index].type == 885) this.buffImmune[30] = true; if (this.armor[index].type == 886) this.buffImmune[36] = true; if (this.armor[index].type == 887) this.buffImmune[20] = true; if (this.armor[index].type == 888) this.buffImmune[22] = true; if (this.armor[index].type == 889) this.buffImmune[32] = true; if (this.armor[index].type == 890) this.buffImmune[35] = true; if (this.armor[index].type == 891) this.buffImmune[23] = true; if (this.armor[index].type == 892) this.buffImmune[33] = true; if (this.armor[index].type == 893) this.buffImmune[31] = true; if (this.armor[index].type == 3781) this.buffImmune[156] = true; if (this.armor[index].type == 901) { this.buffImmune[33] = true; this.buffImmune[36] = true; } if (this.armor[index].type == 902) { this.buffImmune[30] = true; this.buffImmune[20] = true; } if (this.armor[index].type == 903) { this.buffImmune[32] = true; this.buffImmune[31] = true; } if (this.armor[index].type == 904) { this.buffImmune[35] = true; this.buffImmune[23] = true; } if (this.armor[index].type == 1921) { this.buffImmune[46] = true; this.buffImmune[47] = true; } if (this.armor[index].type == 1612) { this.buffImmune[33] = true; this.buffImmune[36] = true; this.buffImmune[30] = true; this.buffImmune[20] = true; this.buffImmune[32] = true; this.buffImmune[31] = true; this.buffImmune[35] = true; this.buffImmune[23] = true; this.buffImmune[22] = true; } if (this.armor[index].type == 1613) { this.buffImmune[46] = true; this.noKnockback = true; this.fireWalk = true; this.buffImmune[33] = true; this.buffImmune[36] = true; this.buffImmune[30] = true; this.buffImmune[20] = true; this.buffImmune[32] = true; this.buffImmune[31] = true; this.buffImmune[35] = true; this.buffImmune[23] = true; this.buffImmune[22] = true; } if (this.armor[index].type == 497) { this.accMerman = true; if (this.hideVisual[index]) this.hideMerman = true; } if (this.armor[index].type == 535) this.pStone = true; if (this.armor[index].type == 536) this.kbGlove = true; if (this.armor[index].type == 532) this.starCloak = true; if (this.armor[index].type == 554) this.longInvince = true; if (this.armor[index].type == 555) { this.manaFlower = true; this.manaCost -= 0.08f; } if (Main.myPlayer == this.whoAmI) { if (this.armor[index].type == 576 && Main.rand.Next(10800) == 0 && Main.curMusic > 0 && Main.curMusic <= 41) { int num = 0; if (Main.curMusic == 1) num = 0; if (Main.curMusic == 2) num = 1; if (Main.curMusic == 3) num = 2; if (Main.curMusic == 4) num = 4; if (Main.curMusic == 5) num = 5; if (Main.curMusic == 6) num = 3; if (Main.curMusic == 7) num = 6; if (Main.curMusic == 8) num = 7; if (Main.curMusic == 9) num = 9; if (Main.curMusic == 10) num = 8; if (Main.curMusic == 11) num = 11; if (Main.curMusic == 12) num = 10; if (Main.curMusic == 13) num = 12; if (Main.curMusic == 28) this.armor[index].SetDefaults(1963); else if (Main.curMusic == 29) this.armor[index].SetDefaults(1610); else if (Main.curMusic == 30) this.armor[index].SetDefaults(1963); else if (Main.curMusic == 31) this.armor[index].SetDefaults(1964); else if (Main.curMusic == 32) this.armor[index].SetDefaults(1965); else if (Main.curMusic == 33) this.armor[index].SetDefaults(2742); else if (Main.curMusic == 34) this.armor[index].SetDefaults(3370); else if (Main.curMusic == 35) this.armor[index].SetDefaults(3236); else if (Main.curMusic == 36) this.armor[index].SetDefaults(3237); else if (Main.curMusic == 37) this.armor[index].SetDefaults(3235); else if (Main.curMusic == 38) this.armor[index].SetDefaults(3044); else if (Main.curMusic == 39) this.armor[index].SetDefaults(3371); else if (Main.curMusic == 40) this.armor[index].SetDefaults(3796); else if (Main.curMusic == 41) this.armor[index].SetDefaults(3869); else if (Main.curMusic > 13) this.armor[index].SetDefaults(1596 + Main.curMusic - 14); else this.armor[index].SetDefaults(num + 562); } if (this.armor[index].type >= 562 && this.armor[index].type <= 574) Main.musicBox2 = this.armor[index].type - 562; if (this.armor[index].type >= 1596 && this.armor[index].type <= 1609) Main.musicBox2 = this.armor[index].type - 1596 + 13; if (this.armor[index].type == 1610) Main.musicBox2 = 27; if (this.armor[index].type == 1963) Main.musicBox2 = 28; if (this.armor[index].type == 1964) Main.musicBox2 = 29; if (this.armor[index].type == 1965) Main.musicBox2 = 30; if (this.armor[index].type == 2742) Main.musicBox2 = 31; if (this.armor[index].type == 3044) Main.musicBox2 = 32; if (this.armor[index].type == 3235) Main.musicBox2 = 33; if (this.armor[index].type == 3236) Main.musicBox2 = 34; if (this.armor[index].type == 3237) Main.musicBox2 = 35; if (this.armor[index].type == 3370) Main.musicBox2 = 36; if (this.armor[index].type == 3371) Main.musicBox2 = 37; if (this.armor[index].type == 3796) Main.musicBox2 = 38; if (this.armor[index].type == 3869) Main.musicBox2 = 39; } } } if (this.dd2Accessory) { this.minionDamage += 0.1f; ++this.maxTurrets; } for (int index = 3; index < 8 + this.extraAccessorySlots; ++index) { if (this.armor[index].wingSlot > (sbyte) 0) { if (!this.hideVisual[index] || (double) this.velocity.Y != 0.0 && !this.mount.Active) this.wings = (int) this.armor[index].wingSlot; this.wingsLogic = (int) this.armor[index].wingSlot; } } for (int index = 13; index < 18 + this.extraAccessorySlots; ++index) { int type = this.armor[index].type; if (this.armor[index].wingSlot > (sbyte) 0) this.wings = (int) this.armor[index].wingSlot; if (type == 861 || type == 3110 || type == 485) { this.hideWolf = false; this.forceWerewolf = true; } if (((!this.wet || this.lavaWet ? 0 : (!this.mount.Active ? 1 : (this.mount.Type != 3 ? 1 : 0))) != 0 || !this.forceWerewolf) && (type == 861 || type == 3110 || type == 497)) { this.hideMerman = false; this.forceMerman = true; } } if (this.whoAmI == Main.myPlayer && Main.clock && this.accWatch < 3) ++this.accWatch; if (flag2) this.tileSpeed += 0.5f; if (flag1) this.wallSpeed += 0.5f; if (flag3 && this.whoAmI == Main.myPlayer) { Player.tileRangeX += 3; Player.tileRangeY += 2; } if (!this.accThirdEye) this.accThirdEyeCounter = (byte) 0; if (Main.netMode == 1 && this.whoAmI == Main.myPlayer) { for (int index = 0; index < (int) byte.MaxValue; ++index) { if (index != this.whoAmI && Main.player[index].active && !Main.player[index].dead && Main.player[index].team == this.team && Main.player[index].team != 0) { int num = 800; if ((double) (Main.player[index].Center - this.Center).Length() < (double) num) { if (Main.player[index].accWatch > this.accWatch) this.accWatch = Main.player[index].accWatch; if (Main.player[index].accCompass > this.accCompass) this.accCompass = Main.player[index].accCompass; if (Main.player[index].accDepthMeter > this.accDepthMeter) this.accDepthMeter = Main.player[index].accDepthMeter; if (Main.player[index].accFishFinder) this.accFishFinder = true; if (Main.player[index].accWeatherRadio) this.accWeatherRadio = true; if (Main.player[index].accThirdEye) this.accThirdEye = true; if (Main.player[index].accJarOfSouls) this.accJarOfSouls = true; if (Main.player[index].accCalendar) this.accCalendar = true; if (Main.player[index].accStopwatch) this.accStopwatch = true; if (Main.player[index].accOreFinder) this.accOreFinder = true; if (Main.player[index].accCritterGuide) this.accCritterGuide = true; if (Main.player[index].accDreamCatcher) this.accDreamCatcher = true; } } } } if (this.accDreamCatcher || !this.dpsStarted) return; this.dpsStarted = false; this.dpsEnd = DateTime.Now; } public void UpdateArmorSets(int i) { this.setBonus = ""; if (this.body == 67 && this.legs == 56 && this.head >= 103 && this.head <= 105) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Shroomite"); this.shroomiteStealth = true; } if (this.head == 52 && this.body == 32 && this.legs == 31 || this.head == 53 && this.body == 33 && this.legs == 32 || this.head == 54 && this.body == 34 && this.legs == 33 || this.head == 55 && this.body == 35 && this.legs == 34 || this.head == 70 && this.body == 46 && this.legs == 42 || this.head == 71 && this.body == 47 && this.legs == 43 || this.head == 166 && this.body == 173 && this.legs == 108 || this.head == 167 && this.body == 174 && this.legs == 109) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Wood"); ++this.statDefense; } if (this.head == 1 && this.body == 1 && this.legs == 1 || (this.head == 72 || this.head == 2) && this.body == 2 && this.legs == 2 || this.head == 47 && this.body == 28 && this.legs == 27) { this.setBonus = Language.GetTextValue("ArmorSetBonus.MetalTier1"); this.statDefense += 2; } if (this.head == 3 && this.body == 3 && this.legs == 3 || (this.head == 73 || this.head == 4) && this.body == 4 && this.legs == 4 || this.head == 48 && this.body == 29 && this.legs == 28 || this.head == 49 && this.body == 30 && this.legs == 29) { this.setBonus = Language.GetTextValue("ArmorSetBonus.MetalTier2"); this.statDefense += 3; } if (this.head == 188 && this.body == 189 && this.legs == 129) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Fossil"); this.thrownCost50 = true; } if (this.head == 50 && this.body == 31 && this.legs == 30) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Platinum"); this.statDefense += 4; } if (this.head == 112 && this.body == 75 && this.legs == 64) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Pumpkin"); this.meleeDamage += 0.1f; this.magicDamage += 0.1f; this.rangedDamage += 0.1f; this.thrownDamage += 0.1f; } if (this.head == 22 && this.body == 14 && this.legs == 14) { this.thrownCost33 = true; this.setBonus = Language.GetTextValue("ArmorSetBonus.Ninja"); } if (this.head == 157 && this.body == 105 && this.legs == 98) { int num1 = 0; this.setBonus = Language.GetTextValue("ArmorSetBonus.BeetleDamage"); this.beetleOffense = true; this.beetleCounter -= 3f; this.beetleCounter -= (float) (this.beetleCountdown / 10); ++this.beetleCountdown; if ((double) this.beetleCounter < 0.0) this.beetleCounter = 0.0f; int num2 = 400; int num3 = 1200; int num4 = 4600; if ((double) this.beetleCounter > (double) (num2 + num3 + num4 + num3)) this.beetleCounter = (float) (num2 + num3 + num4 + num3); if ((double) this.beetleCounter > (double) (num2 + num3 + num4)) { this.AddBuff(100, 5, false); num1 = 3; } else if ((double) this.beetleCounter > (double) (num2 + num3)) { this.AddBuff(99, 5, false); num1 = 2; } else if ((double) this.beetleCounter > (double) num2) { this.AddBuff(98, 5, false); num1 = 1; } if (num1 < this.beetleOrbs) this.beetleCountdown = 0; else if (num1 > this.beetleOrbs) this.beetleCounter += 200f; if (num1 != this.beetleOrbs && this.beetleOrbs > 0) { for (int b = 0; b < 22; ++b) { if (this.buffType[b] >= 98 && this.buffType[b] <= 100 && this.buffType[b] != 97 + num1) this.DelBuff(b); } } } else if (this.head == 157 && this.body == 106 && this.legs == 98) { this.setBonus = Language.GetTextValue("ArmorSetBonus.BeetleDefense"); this.beetleDefense = true; ++this.beetleCounter; int num = 180; if ((double) this.beetleCounter >= (double) num) { if (this.beetleOrbs > 0 && this.beetleOrbs < 3) { for (int b = 0; b < 22; ++b) { if (this.buffType[b] >= 95 && this.buffType[b] <= 96) this.DelBuff(b); } } if (this.beetleOrbs < 3) { this.AddBuff(95 + this.beetleOrbs, 5, false); this.beetleCounter = 0.0f; } else this.beetleCounter = (float) num; } } if (!this.beetleDefense && !this.beetleOffense) { this.beetleCounter = 0.0f; } else { ++this.beetleFrameCounter; if (this.beetleFrameCounter >= 1) { this.beetleFrameCounter = 0; ++this.beetleFrame; if (this.beetleFrame > 2) this.beetleFrame = 0; } for (int beetleOrbs = this.beetleOrbs; beetleOrbs < 3; ++beetleOrbs) { this.beetlePos[beetleOrbs].X = 0.0f; this.beetlePos[beetleOrbs].Y = 0.0f; } for (int index = 0; index < this.beetleOrbs; ++index) { this.beetlePos[index] += this.beetleVel[index]; this.beetleVel[index].X += (float) Main.rand.Next(-100, 101) * 0.005f; this.beetleVel[index].Y += (float) Main.rand.Next(-100, 101) * 0.005f; float x1 = this.beetlePos[index].X; float y1 = this.beetlePos[index].Y; float num5 = (float) Math.Sqrt((double) x1 * (double) x1 + (double) y1 * (double) y1); if ((double) num5 > 100.0) { float num6 = 20f / num5; float num7 = x1 * -num6; float num8 = y1 * -num6; int num9 = 10; this.beetleVel[index].X = (this.beetleVel[index].X * (float) (num9 - 1) + num7) / (float) num9; this.beetleVel[index].Y = (this.beetleVel[index].Y * (float) (num9 - 1) + num8) / (float) num9; } else if ((double) num5 > 30.0) { float num10 = 10f / num5; float num11 = x1 * -num10; float num12 = y1 * -num10; int num13 = 20; this.beetleVel[index].X = (this.beetleVel[index].X * (float) (num13 - 1) + num11) / (float) num13; this.beetleVel[index].Y = (this.beetleVel[index].Y * (float) (num13 - 1) + num12) / (float) num13; } float x2 = this.beetleVel[index].X; float y2 = this.beetleVel[index].Y; if (Math.Sqrt((double) x2 * (double) x2 + (double) y2 * (double) y2) > 2.0) this.beetleVel[index] *= 0.9f; this.beetlePos[index] -= this.velocity * 0.25f; } } if (this.head == 14 && (this.body >= 58 && this.body <= 63 || this.body == 167)) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Wizard"); this.magicCrit += 10; } if (this.head == 159 && (this.body >= 58 && this.body <= 63 || this.body == 167)) { this.setBonus = Language.GetTextValue("ArmorSetBonus.MagicHat"); this.statManaMax2 += 60; } if ((this.head == 5 || this.head == 74) && (this.body == 5 || this.body == 48) && (this.legs == 5 || this.legs == 44)) { this.setBonus = Language.GetTextValue("ArmorSetBonus.ShadowScale"); this.moveSpeed += 0.15f; } if (this.head == 57 && this.body == 37 && this.legs == 35) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Crimson"); this.crimsonRegen = true; } if (this.head == 101 && this.body == 66 && this.legs == 55) { this.setBonus = Language.GetTextValue("ArmorSetBonus.SpectreHealing"); this.ghostHeal = true; } if (this.head == 156 && this.body == 66 && this.legs == 55) { this.setBonus = Language.GetTextValue("ArmorSetBonus.SpectreDamage"); this.ghostHurt = true; } if (this.head == 6 && this.body == 6 && this.legs == 6) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Meteor"); this.spaceGun = true; } if (this.head == 46 && this.body == 27 && this.legs == 26) { this.frostArmor = true; this.setBonus = Language.GetTextValue("ArmorSetBonus.Frost"); this.frostBurn = true; } if ((this.head == 75 || this.head == 7) && this.body == 7 && this.legs == 7) { this.boneArmor = true; this.setBonus = Language.GetTextValue("ArmorSetBonus.Bone"); this.ammoCost80 = true; } if ((this.head == 76 || this.head == 8) && (this.body == 49 || this.body == 8) && (this.legs == 45 || this.legs == 8)) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Jungle"); this.manaCost -= 0.16f; } if (this.head == 9 && this.body == 9 && this.legs == 9) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Molten"); this.meleeDamage += 0.17f; } if (this.head == 11 && this.body == 20 && this.legs == 19) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Mining"); this.pickSpeed -= 0.3f; } if ((this.head == 78 || this.head == 79 || this.head == 80) && this.body == 51 && this.legs == 47) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Chlorophyte"); this.AddBuff(60, 18000); } else if (this.crystalLeaf) { for (int b = 0; b < 22; ++b) { if (this.buffType[b] == 60) this.DelBuff(b); } } if (this.head == 99 && this.body == 65 && this.legs == 54) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Turtle"); this.thorns = 1f; this.turtleThorns = true; } if (this.body == 17 && this.legs == 16) { if (this.head == 29) { this.setBonus = Language.GetTextValue("ArmorSetBonus.CobaltCaster"); this.manaCost -= 0.14f; } else if (this.head == 30) { this.setBonus = Language.GetTextValue("ArmorSetBonus.CobaltMelee"); this.meleeSpeed += 0.15f; } else if (this.head == 31) { this.setBonus = Language.GetTextValue("ArmorSetBonus.CobaltRanged"); this.ammoCost80 = true; } } if (this.body == 18 && this.legs == 17) { if (this.head == 32) { this.setBonus = Language.GetTextValue("ArmorSetBonus.MythrilCaster"); this.manaCost -= 0.17f; } else if (this.head == 33) { this.setBonus = Language.GetTextValue("ArmorSetBonus.MythrilMelee"); this.meleeCrit += 5; } else if (this.head == 34) { this.setBonus = Language.GetTextValue("ArmorSetBonus.MythrilRanged"); this.ammoCost80 = true; } } if (this.body == 19 && this.legs == 18) { if (this.head == 35) { this.setBonus = Language.GetTextValue("ArmorSetBonus.AdamantiteCaster"); this.manaCost -= 0.19f; } else if (this.head == 36) { this.setBonus = Language.GetTextValue("ArmorSetBonus.AdamantiteMelee"); this.meleeSpeed += 0.18f; this.moveSpeed += 0.18f; } else if (this.head == 37) { this.setBonus = Language.GetTextValue("ArmorSetBonus.AdamantiteRanged"); this.ammoCost75 = true; } } if (this.body == 54 && this.legs == 49 && (this.head == 83 || this.head == 84 || this.head == 85)) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Palladium"); this.onHitRegen = true; } if (this.body == 55 && this.legs == 50 && (this.head == 86 || this.head == 87 || this.head == 88)) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Orichalcum"); this.onHitPetal = true; } if (this.body == 56 && this.legs == 51 && (this.head == 89 || this.head == 90 || this.head == 91)) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Titanium"); this.onHitDodge = true; } if (this.body == 24 && this.legs == 23) { if (this.head == 42) { this.setBonus = Language.GetTextValue("ArmorSetBonus.HallowCaster"); this.manaCost -= 0.2f; } else if (this.head == 43) { this.setBonus = Language.GetTextValue("ArmorSetBonus.HallowMelee"); this.meleeSpeed += 0.19f; this.moveSpeed += 0.19f; } else if (this.head == 41) { this.setBonus = Language.GetTextValue("ArmorSetBonus.HallowRanged"); this.ammoCost75 = true; } } if (this.head == 82 && this.body == 53 && this.legs == 48) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Tiki"); ++this.maxMinions; } if (this.head == 134 && this.body == 95 && this.legs == 79) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Spooky"); this.minionDamage += 0.25f; } if (this.head == 160 && this.body == 168 && this.legs == 103) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Bee"); this.minionDamage += 0.1f; if (this.itemAnimation > 0 && this.inventory[this.selectedItem].type == 1121) AchievementsHelper.HandleSpecialEvent(this, 3); } if (this.head == 162 && this.body == 170 && this.legs == 105) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Spider"); this.minionDamage += 0.12f; } if (this.head == 171 && this.body == 177 && this.legs == 112) { this.setSolar = true; this.setBonus = Language.GetTextValue("ArmorSetBonus.Solar"); ++this.solarCounter; int num = 240; if (this.solarCounter >= num) { if (this.solarShields > 0 && this.solarShields < 3) { for (int b = 0; b < 22; ++b) { if (this.buffType[b] >= 170 && this.buffType[b] <= 171) this.DelBuff(b); } } if (this.solarShields < 3) { this.AddBuff(170 + this.solarShields, 5, false); for (int index = 0; index < 16; ++index) { Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 6, Alpha: 100)]; dust.noGravity = true; dust.scale = 1.7f; dust.fadeIn = 0.5f; dust.velocity *= 5f; dust.shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } this.solarCounter = 0; } else this.solarCounter = num; } for (int solarShields = this.solarShields; solarShields < 3; ++solarShields) this.solarShieldPos[solarShields] = Vector2.Zero; for (int index = 0; index < this.solarShields; ++index) { this.solarShieldPos[index] += this.solarShieldVel[index]; Vector2 vector2 = ((float) ((double) this.miscCounter / 100.0 * 6.28318548202515 + (double) index * (6.28318548202515 / (double) this.solarShields))).ToRotationVector2() * 6f; vector2.X = (float) (this.direction * 20); this.solarShieldVel[index] = (vector2 - this.solarShieldPos[index]) * 0.2f; } if (this.dashDelay >= 0) { this.solarDashing = false; this.solarDashConsumedFlare = false; } if (this.solarShields > 0 | (this.solarDashing && this.dashDelay < 0)) this.dash = 3; } else this.solarCounter = 0; if (this.head == 169 && this.body == 175 && this.legs == 110) { this.setVortex = true; this.setBonus = Language.GetTextValue("ArmorSetBonus.Vortex", (object) Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN")); } else this.vortexStealthActive = false; if (this.head == 170 && this.body == 176 && this.legs == 111) { if (this.nebulaCD > 0) --this.nebulaCD; this.setNebula = true; this.setBonus = Language.GetTextValue("ArmorSetBonus.Nebula"); } if (this.head == 189 && this.body == 190 && this.legs == 130) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Stardust", (object) Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN")); this.setStardust = true; if (this.whoAmI == Main.myPlayer) { if (this.FindBuffIndex(187) == -1) this.AddBuff(187, 3600); if (this.ownedProjectileCounts[623] < 1) Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, -1f, 623, 0, 0.0f, Main.myPlayer); } } else if (this.FindBuffIndex(187) != -1) this.DelBuff(this.FindBuffIndex(187)); if (this.head == 200 && this.body == 198 && this.legs == 142) { this.setBonus = Language.GetTextValue("ArmorSetBonus.Forbidden", (object) Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN")); this.setForbidden = true; this.UpdateForbiddenSetLock(); Lighting.AddLight(this.Center, 0.8f, 0.7f, 0.2f); } if (this.head == 204 && this.body == 201 && this.legs == 145) { this.setBonus = Language.GetTextValue("ArmorSetBonus.SquireTier2"); this.setSquireT2 = true; ++this.maxTurrets; } if (this.head == 203 && this.body == 200 && this.legs == 144) { this.setBonus = Language.GetTextValue("ArmorSetBonus.ApprenticeTier2"); this.setApprenticeT2 = true; ++this.maxTurrets; } if (this.head == 205 && this.body == 202 && (this.legs == 147 || this.legs == 146)) { this.setBonus = Language.GetTextValue("ArmorSetBonus.HuntressTier2"); this.setHuntressT2 = true; ++this.maxTurrets; } if (this.head == 206 && this.body == 203 && this.legs == 148) { this.setBonus = Language.GetTextValue("ArmorSetBonus.MonkTier2"); this.setMonkT2 = true; ++this.maxTurrets; } if (this.head == 210 && this.body == 204 && this.legs == 152) { this.setBonus = Language.GetTextValue("ArmorSetBonus.SquireTier3"); this.setSquireT3 = true; this.setSquireT2 = true; ++this.maxTurrets; } if (this.head == 211 && this.body == 205 && this.legs == 153) { this.setBonus = Language.GetTextValue("ArmorSetBonus.ApprenticeTier3"); this.setApprenticeT3 = true; this.setApprenticeT2 = true; ++this.maxTurrets; } if (this.head == 212 && this.body == 206 && (this.legs == 154 || this.legs == 155)) { this.setBonus = Language.GetTextValue("ArmorSetBonus.HuntressTier3"); this.setHuntressT3 = true; this.setHuntressT2 = true; ++this.maxTurrets; } if (this.head != 213 || this.body != 207 || this.legs != 156) return; this.setBonus = Language.GetTextValue("ArmorSetBonus.MonkTier3"); this.setMonkT3 = true; this.setMonkT2 = true; ++this.maxTurrets; } public void UpdateSocialShadow() { for (int index = 2; index > 0; --index) this.shadowDirection[index] = this.shadowDirection[index - 1]; this.shadowDirection[0] = this.direction; ++this.shadowCount; if (this.shadowCount == 1) { this.shadowPos[2] = this.shadowPos[1]; this.shadowRotation[2] = this.shadowRotation[1]; this.shadowOrigin[2] = this.shadowOrigin[1]; } else if (this.shadowCount == 2) { this.shadowPos[1] = this.shadowPos[0]; this.shadowRotation[1] = this.shadowRotation[0]; this.shadowOrigin[1] = this.shadowOrigin[0]; } else { if (this.shadowCount < 3) return; this.shadowCount = 0; this.shadowPos[0] = this.position; this.shadowPos[0].Y += this.gfxOffY; this.shadowRotation[0] = this.fullRotation; this.shadowOrigin[0] = this.fullRotationOrigin; } } public void UpdateTeleportVisuals() { if ((double) this.teleportTime <= 0.0) return; if (this.teleportStyle == 0) { if ((double) Main.rand.Next(100) <= 100.0 * (double) this.teleportTime * 2.0) { int index = Dust.NewDust(new Vector2((float) this.getRect().X, (float) this.getRect().Y), this.getRect().Width, this.getRect().Height, 159); Main.dust[index].scale = this.teleportTime * 1.5f; Main.dust[index].noGravity = true; Main.dust[index].velocity *= 1.1f; } } else if (this.teleportStyle == 1) { if ((double) Main.rand.Next(100) <= 100.0 * (double) this.teleportTime) { int index = Dust.NewDust(new Vector2((float) this.getRect().X, (float) this.getRect().Y), this.getRect().Width, this.getRect().Height, 164); Main.dust[index].scale = this.teleportTime * 1.5f; Main.dust[index].noGravity = true; Main.dust[index].velocity *= 1.1f; } } else if (this.teleportStyle == 2) this.teleportTime = 0.005f; else if (this.teleportStyle == 3) this.teleportTime = 0.005f; else if (this.teleportStyle == 4) { this.teleportTime -= 0.02f; if ((double) Main.rand.Next(100) <= 100.0 * (double) this.teleportTime) { Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 263)]; dust.color = PortalHelper.GetPortalColor(this.lastPortalColorIndex); dust.noLight = true; dust.noGravity = true; dust.scale = 1.2f; dust.fadeIn = 0.4f; } } this.teleportTime -= 0.005f; } public void UpdateBiomes() { Point tileCoordinates1 = this.Center.ToTileCoordinates(); this.ZoneDungeon = false; if (Main.dungeonTiles >= 250 && (double) this.Center.Y > Main.worldSurface * 16.0) { int index1 = (int) this.Center.X / 16; int index2 = (int) this.Center.Y / 16; if (Main.wallDungeon[(int) Main.tile[index1, index2].wall]) this.ZoneDungeon = true; } Tile tileSafely = Framing.GetTileSafely(this.Center); if (tileSafely != null) this.behindBackWall = tileSafely.wall > (byte) 0; if (Main.sandTiles > 1000 && (double) this.Center.Y > 3200.0) { if (WallID.Sets.Conversion.Sandstone[(int) tileSafely.wall] || WallID.Sets.Conversion.HardenedSand[(int) tileSafely.wall]) this.ZoneUndergroundDesert = true; } else this.ZoneUndergroundDesert = false; this.ZoneCorrupt = Main.evilTiles >= 200; this.ZoneHoly = Main.holyTiles >= 100; this.ZoneMeteor = Main.meteorTiles >= 50; this.ZoneJungle = Main.jungleTiles >= 80; this.ZoneSnow = Main.snowTiles >= 300; this.ZoneCrimson = Main.bloodTiles >= 200; this.ZoneWaterCandle = Main.waterCandles > 0; this.ZonePeaceCandle = Main.peaceCandles > 0; this.ZoneDesert = Main.sandTiles > 1000; this.ZoneGlowshroom = Main.shroomTiles > 100; this.ZoneUnderworldHeight = tileCoordinates1.Y > Main.maxTilesY - 200; this.ZoneRockLayerHeight = tileCoordinates1.Y <= Main.maxTilesY - 200 && (double) tileCoordinates1.Y > Main.rockLayer; this.ZoneDirtLayerHeight = (double) tileCoordinates1.Y <= Main.rockLayer && (double) tileCoordinates1.Y > Main.worldSurface; this.ZoneOverworldHeight = (double) tileCoordinates1.Y <= Main.worldSurface && (double) tileCoordinates1.Y > Main.worldSurface * 0.349999994039536; this.ZoneSkyHeight = (double) tileCoordinates1.Y <= Main.worldSurface * 0.349999994039536; this.ZoneBeach = this.ZoneOverworldHeight && (tileCoordinates1.X < 380 || tileCoordinates1.X > Main.maxTilesX - 380); this.ZoneRain = Main.raining && (double) tileCoordinates1.Y <= Main.worldSurface; this.ZoneSandstorm = (double) tileCoordinates1.Y <= Main.worldSurface && this.ZoneDesert && !this.ZoneBeach && Sandstorm.Happening; this.ZoneTowerSolar = this.ZoneTowerVortex = this.ZoneTowerNebula = this.ZoneTowerStardust = false; this.ZoneOldOneArmy = false; Vector2 vector2_1 = Vector2.Zero; Vector2 vector2_2 = Vector2.Zero; Vector2 vector2_3 = Vector2.Zero; Vector2 vector2_4 = Vector2.Zero; Vector2 zero = Vector2.Zero; for (int index = 0; index < 200; ++index) { if (Main.npc[index].active) { if (Main.npc[index].type == 493) { if ((double) this.Distance(Main.npc[index].Center) <= 4000.0) { this.ZoneTowerStardust = true; vector2_4 = Main.npc[index].Center; } } else if (Main.npc[index].type == 507) { if ((double) this.Distance(Main.npc[index].Center) <= 4000.0) { this.ZoneTowerNebula = true; vector2_3 = Main.npc[index].Center; } } else if (Main.npc[index].type == 422) { if ((double) this.Distance(Main.npc[index].Center) <= 4000.0) { this.ZoneTowerVortex = true; vector2_2 = Main.npc[index].Center; } } else if (Main.npc[index].type == 517) { if ((double) this.Distance(Main.npc[index].Center) <= 4000.0) { this.ZoneTowerSolar = true; vector2_1 = Main.npc[index].Center; } } else if (Main.npc[index].type == 549 && (double) this.Distance(Main.npc[index].Center) <= 4000.0) { this.ZoneOldOneArmy = true; vector2_1 = Main.npc[index].Center; } } } bool flag1 = this.ZoneRain && this.ZoneSnow; bool flag2 = tileCoordinates1.Y > Main.maxTilesY - 320; bool flag3 = this.ZoneOverworldHeight && (tileCoordinates1.X < 380 || tileCoordinates1.X > Main.maxTilesX - 380); this.ManageSpecialBiomeVisuals("Stardust", this.ZoneTowerStardust, vector2_4 - new Vector2(0.0f, 10f)); this.ManageSpecialBiomeVisuals("Nebula", this.ZoneTowerNebula, vector2_3 - new Vector2(0.0f, 10f)); this.ManageSpecialBiomeVisuals("Vortex", this.ZoneTowerVortex, vector2_2 - new Vector2(0.0f, 10f)); this.ManageSpecialBiomeVisuals("Solar", this.ZoneTowerSolar, vector2_1 - new Vector2(0.0f, 10f)); this.ManageSpecialBiomeVisuals("MoonLord", NPC.AnyNPCs(398)); this.ManageSpecialBiomeVisuals("BloodMoon", Main.bloodMoon); this.ManageSpecialBiomeVisuals("Blizzard", Main.UseStormEffects & flag1); this.ManageSpecialBiomeVisuals("HeatDistortion", Main.UseHeatDistortion && (flag2 || (double) tileCoordinates1.Y < Main.worldSurface && this.ZoneDesert && !flag3 && !Main.raining && !Filters.Scene["Sandstorm"].IsActive())); if (!Filters.Scene["WaterDistortion"].IsActive() && Main.WaveQuality > 0) Filters.Scene.Activate("WaterDistortion", new Vector2()); else if (Filters.Scene["WaterDistortion"].IsActive() && Main.WaveQuality == 0) Filters.Scene.Deactivate("WaterDistortion"); if (Filters.Scene["WaterDistortion"].IsActive()) { double num1 = (double) Main.maxTilesX * 0.5 - (double) Math.Abs((float) tileCoordinates1.X - (float) Main.maxTilesX * 0.5f); float num2 = 1f + Math.Abs(Main.windSpeed) * 1f + MathHelper.Clamp(Main.maxRaining, 0.0f, 1f) * 1.5f + (float) -((double) MathHelper.Clamp((float) ((num1 - 380.0) / 100.0), 0.0f, 1f) * 0.5 - 0.25); float num3 = 1f - MathHelper.Clamp((float) (3.0 * ((double) ((float) tileCoordinates1.Y - (float) Main.worldSurface) / (Main.rockLayer - Main.worldSurface))), 0.0f, 1f); float intensity = MathHelper.Clamp(num2 * num3 + (float) (0.899999976158142 - (double) MathHelper.Clamp((float) (Main.maxTilesY - tileCoordinates1.Y - 200) / 300f, 0.0f, 1f) * 0.899999976158142) + (float) ((1.0 - (double) num3) * 0.75), 0.0f, 2.5f); Filters.Scene["WaterDistortion"].GetShader().UseIntensity(intensity); } if (flag2) { float intensity = Math.Min(1f, (float) (tileCoordinates1.Y - (Main.maxTilesY - 320)) / 120f) * 2f; Filters.Scene["HeatDistortion"].GetShader().UseIntensity(intensity); } this._shaderObstructionInternalValue = Utils.Clamp(this._shaderObstructionInternalValue + (float) this.behindBackWall.ToDirectionInt() * -0.005f, -0.1f, 1.1f); this._stormShaderObstruction = Utils.Clamp(this._shaderObstructionInternalValue, 0.0f, 1f); if (Filters.Scene["Sandstorm"].IsActive()) { Filters.Scene["Sandstorm"].GetShader().UseIntensity(this._stormShaderObstruction * 0.4f * Math.Min(1f, Sandstorm.Severity)); Filters.Scene["Sandstorm"].GetShader().UseOpacity(Math.Min(1f, Sandstorm.Severity * 1.5f) * this._stormShaderObstruction); ((SimpleOverlay) Overlays.Scene["Sandstorm"]).GetShader().UseOpacity(Math.Min(1f, Sandstorm.Severity * 1.5f) * (1f - this._stormShaderObstruction)); } else if (this.ZoneDesert && !flag3 && !Main.raining && !flag2) { Vector3 vector3 = Main.tileColor.ToVector3(); float num = (float) (((double) vector3.X + (double) vector3.Y + (double) vector3.Z) / 3.0); float intensity = this._stormShaderObstruction * 4f * Math.Max(0.0f, 0.5f - Main.cloudAlpha) * num; Filters.Scene["HeatDistortion"].GetShader().UseIntensity(intensity); if ((double) intensity <= 0.0) Filters.Scene["HeatDistortion"].IsHidden = true; else Filters.Scene["HeatDistortion"].IsHidden = false; } if (flag1) { ActiveSound activeSound1 = Main.GetActiveSound(Player._strongBlizzardSound); ActiveSound activeSound2 = Main.GetActiveSound(Player._insideBlizzardSound); if (activeSound1 == null) Player._strongBlizzardSound = Main.PlayTrackedSound((SoundStyle) SoundID.BlizzardStrongLoop); if (activeSound2 == null) Player._insideBlizzardSound = Main.PlayTrackedSound((SoundStyle) SoundID.BlizzardInsideBuildingLoop); Main.GetActiveSound(Player._strongBlizzardSound); Main.GetActiveSound(Player._insideBlizzardSound); float opacity = Math.Min(1f, Main.cloudAlpha * 2f) * this._stormShaderObstruction; Filters.Scene["Blizzard"].GetShader().UseIntensity((float) ((double) this._stormShaderObstruction * 0.400000005960464 * (double) Math.Min(1f, Main.cloudAlpha * 2f) * 0.899999976158142 + 0.100000001490116)); Filters.Scene["Blizzard"].GetShader().UseOpacity(opacity); ((SimpleOverlay) Overlays.Scene["Blizzard"]).GetShader().UseOpacity(1f - opacity); } Player._blizzardSoundVolume = !flag1 ? Math.Max(Player._blizzardSoundVolume - 0.01f, 0.0f) : Math.Min(Player._blizzardSoundVolume + 0.01f, 1f); float num4 = Math.Min(1f, Main.cloudAlpha * 2f) * this._stormShaderObstruction; ActiveSound activeSound3 = Main.GetActiveSound(Player._strongBlizzardSound); ActiveSound activeSound4 = Main.GetActiveSound(Player._insideBlizzardSound); if ((double) Player._blizzardSoundVolume > 0.0) { if (activeSound3 == null) { Player._strongBlizzardSound = Main.PlayTrackedSound((SoundStyle) SoundID.BlizzardStrongLoop); activeSound3 = Main.GetActiveSound(Player._strongBlizzardSound); } activeSound3.Volume = num4 * Player._blizzardSoundVolume; if (activeSound4 == null) { Player._insideBlizzardSound = Main.PlayTrackedSound((SoundStyle) SoundID.BlizzardInsideBuildingLoop); activeSound4 = Main.GetActiveSound(Player._insideBlizzardSound); } activeSound4.Volume = (1f - num4) * Player._blizzardSoundVolume; } else { if (activeSound3 != null) activeSound3.Volume = 0.0f; else Player._strongBlizzardSound = (SlotId) SlotId.Invalid; if (activeSound4 != null) activeSound4.Volume = 0.0f; else Player._insideBlizzardSound = (SlotId) SlotId.Invalid; } if (!this.dead) { Point tileCoordinates2 = this.Center.ToTileCoordinates(); if (WorldGen.InWorld(tileCoordinates2.X, tileCoordinates2.Y, 1)) { int num5 = 0; if (Main.tile[tileCoordinates2.X, tileCoordinates2.Y] != null) num5 = (int) Main.tile[tileCoordinates2.X, tileCoordinates2.Y].wall; switch (num5) { case 62: AchievementsHelper.HandleSpecialEvent(this, 13); break; case 86: AchievementsHelper.HandleSpecialEvent(this, 12); break; } } if (this._funkytownCheckCD > 0) --this._funkytownCheckCD; if ((double) this.position.Y / 16.0 > (double) (Main.maxTilesY - 200)) { AchievementsHelper.HandleSpecialEvent(this, 14); } else { if (this._funkytownCheckCD != 0 || (double) this.position.Y / 16.0 >= Main.worldSurface || Main.shroomTiles < 200) return; AchievementsHelper.HandleSpecialEvent(this, 15); } } else this._funkytownCheckCD = 100; } public void ManageSpecialBiomeVisuals(string biomeName, bool inZone, Vector2 activationSource = default (Vector2)) { if (SkyManager.Instance[biomeName] != null && inZone != SkyManager.Instance[biomeName].IsActive()) { if (inZone) SkyManager.Instance.Activate(biomeName, activationSource); else SkyManager.Instance.Deactivate(biomeName); } if (inZone != Filters.Scene[biomeName].IsActive()) { if (inZone) Filters.Scene.Activate(biomeName, activationSource); else Filters.Scene[biomeName].Deactivate(); } else if (inZone) Filters.Scene[biomeName].GetShader().UseTargetPosition(activationSource); if (Overlays.Scene[biomeName] == null || inZone == (Overlays.Scene[biomeName].Mode != OverlayMode.Inactive)) return; if (inZone) Overlays.Scene.Activate(biomeName, activationSource); else Overlays.Scene[biomeName].Deactivate(); } public void UpdateDead() { this._portalPhysicsTime = 0; this.MountFishronSpecialCounter = 0.0f; this.gem = -1; this.ownedLargeGems = (BitsByte) (byte) 0; this.slippy = false; this.slippy2 = false; this.powerrun = false; this.wings = 0; this.wingsLogic = 0; this.face = this.neck = this.back = this.front = this.handoff = this.handon = this.shoe = this.waist = this.balloon = this.shield = (sbyte) 0; this.poisoned = false; this.venom = false; this.onFire = false; this.dripping = false; this.drippingSlime = false; this.burned = false; this.suffocating = false; this.onFire2 = false; this.onFrostBurn = false; this.blind = false; this.blackout = false; this.loveStruck = false; this.dryadWard = false; this.stinky = false; this.resistCold = false; this.electrified = false; this.moonLeech = false; this.headcovered = false; this.vortexDebuff = false; this.windPushed = false; this.setForbidden = false; this.setMonkT3 = false; this.setHuntressT3 = false; this.setApprenticeT3 = false; this.setSquireT3 = false; this.setForbiddenCooldownLocked = false; this.setSolar = this.setVortex = this.setNebula = this.setStardust = false; this.nebulaLevelDamage = this.nebulaLevelLife = this.nebulaLevelMana = 0; this.trapDebuffSource = false; this.yoraiz0rEye = 0; this.yoraiz0rDarkness = false; this.leinforsHair = false; this.gravDir = 1f; for (int index = 0; index < 22; ++index) { if (this.buffType[index] <= 0 || !Main.persistentBuff[this.buffType[index]]) { this.buffTime[index] = 0; this.buffType[index] = 0; } } if (this.whoAmI == Main.myPlayer) { Main.npcChatText = ""; Main.editSign = false; } this.grappling[0] = -1; this.grappling[1] = -1; this.grappling[2] = -1; this.sign = -1; this.talkNPC = -1; Main.npcChatCornerItem = 0; this.statLife = 0; this.channel = false; this.potionDelay = 0; this.chest = -1; this.changeItem = -1; this.itemAnimation = 0; this.immuneAlpha += 2; if (this.immuneAlpha > (int) byte.MaxValue) this.immuneAlpha = (int) byte.MaxValue; this.headPosition += this.headVelocity; this.bodyPosition += this.bodyVelocity; this.legPosition += this.legVelocity; this.headRotation += this.headVelocity.X * 0.1f; this.bodyRotation += this.bodyVelocity.X * 0.1f; this.legRotation += this.legVelocity.X * 0.1f; this.headVelocity.Y += 0.1f; this.bodyVelocity.Y += 0.1f; this.legVelocity.Y += 0.1f; this.headVelocity.X *= 0.99f; this.bodyVelocity.X *= 0.99f; this.legVelocity.X *= 0.99f; for (int index = 0; index < this.npcTypeNoAggro.Length; ++index) this.npcTypeNoAggro[index] = false; if (this.difficulty == (byte) 2) { if (this.respawnTimer > 0) { --this.respawnTimer; } else { if (this.whoAmI != Main.myPlayer && Main.netMode != 2) return; this.ghost = true; } } else { --this.respawnTimer; if (this.respawnTimer > 0 || Main.myPlayer != this.whoAmI) return; if (Main.mouseItem.type > 0) Main.playerInventory = true; this.Spawn(); } } public void UpdatePet(int i) { if (i != Main.myPlayer || this.miscEquips[0].buffType < 1 || this.miscEquips[0].stack < 1) return; int buffType = this.miscEquips[0].buffType; if (!Main.vanityPet[buffType] && !Main.lightPet[buffType] || this.hideMisc[0] || this.miscEquips[0].type == 603 && !Main.cEd || this.FindBuffIndex(buffType) != -1) return; this.AddBuff(buffType, 3600); Main.PlaySound(this.miscEquips[0].UseSound, this.position); } public void UpdatePetLight(int i) { if (i != Main.myPlayer || this.miscEquips[1].buffType < 1 || this.miscEquips[1].stack < 1) return; int type = this.miscEquips[1].buffType; if (!Main.vanityPet[type] && !Main.lightPet[type] || this.hideMisc[1] || this.miscEquips[1].type == 603 && !Main.cEd) return; int buffIndex = this.FindBuffIndex(type); if (type == 27 && buffIndex == -1) buffIndex = this.FindBuffIndex(102); if (type == 27 && buffIndex == -1) buffIndex = this.FindBuffIndex(101); if (buffIndex != -1) return; if (type == 27) type = Utils.SelectRandom(Main.rand, 27, 102, 101); this.AddBuff(type, 3600); Main.PlaySound(this.miscEquips[1].UseSound, this.position); } public void TogglePet() { this.hideMisc[0] = !this.hideMisc[0]; if (!this.hideMisc[0]) return; this.ClearBuff(this.miscEquips[0].buffType); } public void ToggleLight() { this.hideMisc[1] = !this.hideMisc[1]; if (!this.hideMisc[1]) return; this.ClearBuff(this.miscEquips[1].buffType); if (this.miscEquips[1].buffType != 27) return; this.ClearBuff(102); this.ClearBuff(101); } public void SmartCursorLookup() { if (this.whoAmI != Main.myPlayer) return; Main.SmartCursorShowing = false; if (!Main.SmartCursorEnabled) return; Item obj = this.inventory[this.selectedItem]; Vector2 mouse = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY); if ((double) this.gravDir == -1.0) mouse.Y = Main.screenPosition.Y + (float) Main.screenHeight - (float) Main.mouseY; int index1 = Player.tileTargetX; int index2 = Player.tileTargetY; if (index1 < 10) index1 = 10; if (index1 > Main.maxTilesX - 10) index1 = Main.maxTilesX - 10; if (index2 < 10) index2 = 10; if (index2 > Main.maxTilesY - 10) index2 = Main.maxTilesY - 10; bool flag1 = false; if (Main.tile[index1, index2] == null) return; if (Main.tile[index1, index2].active()) { switch (Main.tile[index1, index2].type) { case 4: case 10: case 11: case 13: case 21: case 29: case 33: case 49: case 50: case 55: case 79: case 85: case 88: case 97: case 104: case 125: case 132: case 136: case 139: case 144: case 174: case 207: case 209: case 212: case 216: case 219: case 237: case 287: case 334: case 335: case 338: case 354: case 386: case 387: case 388: case 389: case 411: case 425: case 441: case 463: case 467: case 468: flag1 = true; break; case 314: if ((double) this.gravDir == 1.0) { flag1 = true; break; } break; } } int tileBoost = obj.tileBoost; int num1 = 0; if (obj.type == 1071 || obj.type == 1543 || obj.type == 1072 || obj.type == 1544) { for (int index3 = 0; index3 < 58; ++index3) { if (this.inventory[index3].stack > 0 && this.inventory[index3].paint > (byte) 0) { num1 = (int) this.inventory[index3].paint; break; } } } int num2 = (int) ((double) this.position.X / 16.0) - Player.tileRangeX - tileBoost + 1; int num3 = (int) (((double) this.position.X + (double) this.width) / 16.0) + Player.tileRangeX + tileBoost - 1; int num4 = (int) ((double) this.position.Y / 16.0) - Player.tileRangeY - tileBoost + 1; int num5 = (int) (((double) this.position.Y + (double) this.height) / 16.0) + Player.tileRangeY + tileBoost - 2; int num6 = Utils.Clamp(num2, 10, Main.maxTilesX - 10); int num7 = Utils.Clamp(num3, 10, Main.maxTilesX - 10); int num8 = Utils.Clamp(num4, 10, Main.maxTilesY - 10); int num9 = Utils.Clamp(num5, 10, Main.maxTilesY - 10); if (flag1 && index1 >= num6 && index1 <= num7 && index2 >= num8 && index2 <= num9) return; List> ignoreTargets = new List>(); for (int index4 = 0; index4 < this.grapCount; ++index4) { Projectile projectile = Main.projectile[this.grappling[index4]]; int num10 = (int) projectile.Center.X / 16; int num11 = (int) projectile.Center.Y / 16; ignoreTargets.Add(new Tuple(num10, num11)); } int fX = -1; int fY = -1; if (!Player.SmartCursorSettings.SmartAxeAfterPickaxe) Player.SmartCursor_Axe(obj, ref mouse, num6, num7, num8, num9, ref fX, ref fY); if (obj.pick > 0 && fX == -1 && fY == -1) { if (PlayerInput.UsingGamepad) { Vector2 navigatorDirections = PlayerInput.Triggers.Current.GetNavigatorDirections(); Vector2 gamepadThumbstickLeft = PlayerInput.GamepadThumbstickLeft; Vector2 gamepadThumbstickRight = PlayerInput.GamepadThumbstickRight; Vector2 zero = Vector2.Zero; if (navigatorDirections == zero && (double) gamepadThumbstickLeft.Length() < 0.0500000007450581 && (double) gamepadThumbstickRight.Length() < 0.0500000007450581) mouse = this.Center + new Vector2((float) (this.direction * 1000), 0.0f); } Vector2 vector2 = mouse - this.Center; int num12 = Math.Sign(vector2.X); int num13 = Math.Sign(vector2.Y); if ((double) Math.Abs(vector2.X) > (double) Math.Abs(vector2.Y) * 3.0) { num13 = 0; mouse.Y = this.Center.Y; } if ((double) Math.Abs(vector2.Y) > (double) Math.Abs(vector2.X) * 3.0) { num12 = 0; mouse.X = this.Center.X; } int num14 = (int) this.Center.X / 16; int num15 = (int) this.Center.Y / 16; List> tupleList1 = new List>(); List> tupleList2 = new List>(); int num16 = 1; if (num13 == -1 && num12 != 0) num16 = -1; int index5 = (int) (((double) this.position.X + (double) (this.width / 2) + (double) ((this.width / 2 - 1) * num12)) / 16.0); int index6 = (int) (((double) this.position.Y + 0.1) / 16.0); if (num16 == -1) index6 = (int) (((double) this.position.Y + (double) this.height - 1.0) / 16.0); int num17 = this.width / 16 + (this.width % 16 == 0 ? 0 : 1); int num18 = this.height / 16 + (this.height % 16 == 0 ? 0 : 1); if (num12 != 0) { for (int index7 = 0; index7 < num18; ++index7) { if (Main.tile[index5, index6 + index7 * num16] == null) return; tupleList1.Add(new Tuple(index5, index6 + index7 * num16)); } } if (num13 != 0) { for (int index8 = 0; index8 < num17; ++index8) { if (Main.tile[(int) ((double) this.position.X / 16.0) + index8, index6] == null) return; tupleList1.Add(new Tuple((int) ((double) this.position.X / 16.0) + index8, index6)); } } int index9 = (int) (((double) mouse.X + (double) ((this.width / 2 - 1) * num12)) / 16.0); int index10 = (int) (((double) mouse.Y + 0.1 - (double) (this.height / 2 + 1)) / 16.0); if (num16 == -1) index10 = (int) (((double) mouse.Y + (double) (this.height / 2) - 1.0) / 16.0); if ((double) this.gravDir == -1.0 && num13 == 0) ++index10; if (index10 < 10) index10 = 10; if (index10 > Main.maxTilesY - 10) index10 = Main.maxTilesY - 10; int num19 = this.width / 16 + (this.width % 16 == 0 ? 0 : 1); int num20 = this.height / 16 + (this.height % 16 == 0 ? 0 : 1); if (num12 != 0) { for (int index11 = 0; index11 < num20; ++index11) { if (Main.tile[index9, index10 + index11 * num16] == null) return; tupleList2.Add(new Tuple(index9, index10 + index11 * num16)); } } if (num13 != 0) { for (int index12 = 0; index12 < num19; ++index12) { if (Main.tile[(int) (((double) mouse.X - (double) (this.width / 2)) / 16.0) + index12, index10] == null) return; tupleList2.Add(new Tuple((int) (((double) mouse.X - (double) (this.width / 2)) / 16.0) + index12, index10)); } } List> tupleList3 = new List>(); while (tupleList1.Count > 0) { Tuple tuple1 = tupleList1[0]; Tuple tuple2 = tupleList2[0]; Tuple col; if (!Collision.TupleHitLine(tuple1.Item1, tuple1.Item2, tuple2.Item1, tuple2.Item2, num12 * (int) this.gravDir, -num13 * (int) this.gravDir, ignoreTargets, out col)) { tupleList1.Remove(tuple1); tupleList2.Remove(tuple2); } else { if (col.Item1 != tuple2.Item1 || col.Item2 != tuple2.Item2) tupleList3.Add(col); Tile tile = Main.tile[col.Item1, col.Item2]; if (!tile.inActive() && tile.active() && Main.tileSolid[(int) tile.type] && !Main.tileSolidTop[(int) tile.type] && !ignoreTargets.Contains(col)) tupleList3.Add(col); tupleList1.Remove(tuple1); tupleList2.Remove(tuple2); } } List> tupleList4 = new List>(); for (int index13 = 0; index13 < tupleList3.Count; ++index13) { if (!WorldGen.CanKillTile(tupleList3[index13].Item1, tupleList3[index13].Item2)) tupleList4.Add(tupleList3[index13]); } for (int index14 = 0; index14 < tupleList4.Count; ++index14) tupleList3.Remove(tupleList4[index14]); tupleList4.Clear(); if (tupleList3.Count > 0) { float num21 = -1f; Tuple tuple = tupleList3[0]; for (int index15 = 0; index15 < tupleList3.Count; ++index15) { float num22 = Vector2.Distance(new Vector2((float) tupleList3[index15].Item1, (float) tupleList3[index15].Item2) * 16f + Vector2.One * 8f, this.Center); if ((double) num21 == -1.0 || (double) num22 < (double) num21) { num21 = num22; tuple = tupleList3[index15]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList1.Clear(); tupleList2.Clear(); tupleList3.Clear(); } if (Player.SmartCursorSettings.SmartAxeAfterPickaxe) Player.SmartCursor_Axe(obj, ref mouse, num6, num7, num8, num9, ref fX, ref fY); if ((obj.type == 509 || obj.type == 850 || obj.type == 851 || obj.type == 3612) && fX == -1 && fY == -1) { List> tupleList = new List>(); int num23 = 0; if (obj.type == 509) num23 = 1; if (obj.type == 850) num23 = 2; if (obj.type == 851) num23 = 3; if (obj.type == 3612) num23 = 4; bool flag2 = false; if (Main.tile[index1, index2].wire() && num23 == 1) flag2 = true; if (Main.tile[index1, index2].wire2() && num23 == 2) flag2 = true; if (Main.tile[index1, index2].wire3() && num23 == 3) flag2 = true; if (Main.tile[index1, index2].wire4() && num23 == 4) flag2 = true; if (!flag2) { for (int index16 = num6; index16 <= num7; ++index16) { for (int index17 = num8; index17 <= num9; ++index17) { Tile tile = Main.tile[index16, index17]; if (tile.wire() && num23 == 1 || tile.wire2() && num23 == 2 || tile.wire3() && num23 == 3 || tile.wire4() && num23 == 4) { if (num23 == 1) { if (!Main.tile[index16 - 1, index17].wire()) tupleList.Add(new Tuple(index16 - 1, index17)); if (!Main.tile[index16 + 1, index17].wire()) tupleList.Add(new Tuple(index16 + 1, index17)); if (!Main.tile[index16, index17 - 1].wire()) tupleList.Add(new Tuple(index16, index17 - 1)); if (!Main.tile[index16, index17 + 1].wire()) tupleList.Add(new Tuple(index16, index17 + 1)); } if (num23 == 2) { if (!Main.tile[index16 - 1, index17].wire2()) tupleList.Add(new Tuple(index16 - 1, index17)); if (!Main.tile[index16 + 1, index17].wire2()) tupleList.Add(new Tuple(index16 + 1, index17)); if (!Main.tile[index16, index17 - 1].wire2()) tupleList.Add(new Tuple(index16, index17 - 1)); if (!Main.tile[index16, index17 + 1].wire2()) tupleList.Add(new Tuple(index16, index17 + 1)); } if (num23 == 3) { if (!Main.tile[index16 - 1, index17].wire3()) tupleList.Add(new Tuple(index16 - 1, index17)); if (!Main.tile[index16 + 1, index17].wire3()) tupleList.Add(new Tuple(index16 + 1, index17)); if (!Main.tile[index16, index17 - 1].wire3()) tupleList.Add(new Tuple(index16, index17 - 1)); if (!Main.tile[index16, index17 + 1].wire3()) tupleList.Add(new Tuple(index16, index17 + 1)); } if (num23 == 4) { if (!Main.tile[index16 - 1, index17].wire4()) tupleList.Add(new Tuple(index16 - 1, index17)); if (!Main.tile[index16 + 1, index17].wire4()) tupleList.Add(new Tuple(index16 + 1, index17)); if (!Main.tile[index16, index17 - 1].wire4()) tupleList.Add(new Tuple(index16, index17 - 1)); if (!Main.tile[index16, index17 + 1].wire4()) tupleList.Add(new Tuple(index16, index17 + 1)); } } } } } if (tupleList.Count > 0) { float num24 = -1f; Tuple tuple = tupleList[0]; for (int index18 = 0; index18 < tupleList.Count; ++index18) { float num25 = Vector2.Distance(new Vector2((float) tupleList[index18].Item1, (float) tupleList[index18].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num24 == -1.0 || (double) num25 < (double) num24) { num24 = num25; tuple = tupleList[index18]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.type == 3625 && fX == -1 && fY == -1) { List> tupleList = new List>(); WiresUI.Settings.MultiToolMode toolMode1 = WiresUI.Settings.ToolMode; WiresUI.Settings.MultiToolMode multiToolMode = (WiresUI.Settings.MultiToolMode) 0; if (Main.tile[index1, index2].wire()) multiToolMode |= WiresUI.Settings.MultiToolMode.Red; if (Main.tile[index1, index2].wire2()) multiToolMode |= WiresUI.Settings.MultiToolMode.Blue; if (Main.tile[index1, index2].wire3()) multiToolMode |= WiresUI.Settings.MultiToolMode.Green; if (Main.tile[index1, index2].wire4()) multiToolMode |= WiresUI.Settings.MultiToolMode.Yellow; int num26 = (toolMode1 & ~WiresUI.Settings.MultiToolMode.Cutter) == multiToolMode ? 1 : 0; WiresUI.Settings.MultiToolMode toolMode2 = WiresUI.Settings.ToolMode; if (num26 == 0) { bool flag3 = toolMode2.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Red); bool flag4 = toolMode2.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Blue); bool flag5 = toolMode2.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Green); bool flag6 = toolMode2.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Yellow); bool flag7 = toolMode2.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Cutter); for (int index19 = num6; index19 <= num7; ++index19) { for (int index20 = num8; index20 <= num9; ++index20) { Tile tile = Main.tile[index19, index20]; if (flag7) { if (tile.wire() & flag3 || tile.wire2() & flag4 || tile.wire3() & flag5 || tile.wire4() & flag6) tupleList.Add(new Tuple(index19, index20)); } else if (tile.wire() & flag3 || tile.wire2() & flag4 || tile.wire3() & flag5 || tile.wire4() & flag6) { if (flag3) { if (!Main.tile[index19 - 1, index20].wire()) tupleList.Add(new Tuple(index19 - 1, index20)); if (!Main.tile[index19 + 1, index20].wire()) tupleList.Add(new Tuple(index19 + 1, index20)); if (!Main.tile[index19, index20 - 1].wire()) tupleList.Add(new Tuple(index19, index20 - 1)); if (!Main.tile[index19, index20 + 1].wire()) tupleList.Add(new Tuple(index19, index20 + 1)); } if (flag4) { if (!Main.tile[index19 - 1, index20].wire2()) tupleList.Add(new Tuple(index19 - 1, index20)); if (!Main.tile[index19 + 1, index20].wire2()) tupleList.Add(new Tuple(index19 + 1, index20)); if (!Main.tile[index19, index20 - 1].wire2()) tupleList.Add(new Tuple(index19, index20 - 1)); if (!Main.tile[index19, index20 + 1].wire2()) tupleList.Add(new Tuple(index19, index20 + 1)); } if (flag5) { if (!Main.tile[index19 - 1, index20].wire3()) tupleList.Add(new Tuple(index19 - 1, index20)); if (!Main.tile[index19 + 1, index20].wire3()) tupleList.Add(new Tuple(index19 + 1, index20)); if (!Main.tile[index19, index20 - 1].wire3()) tupleList.Add(new Tuple(index19, index20 - 1)); if (!Main.tile[index19, index20 + 1].wire3()) tupleList.Add(new Tuple(index19, index20 + 1)); } if (flag6) { if (!Main.tile[index19 - 1, index20].wire4()) tupleList.Add(new Tuple(index19 - 1, index20)); if (!Main.tile[index19 + 1, index20].wire4()) tupleList.Add(new Tuple(index19 + 1, index20)); if (!Main.tile[index19, index20 - 1].wire4()) tupleList.Add(new Tuple(index19, index20 - 1)); if (!Main.tile[index19, index20 + 1].wire4()) tupleList.Add(new Tuple(index19, index20 + 1)); } } } } } if (tupleList.Count > 0) { float num27 = -1f; Tuple tuple = tupleList[0]; for (int index21 = 0; index21 < tupleList.Count; ++index21) { float num28 = Vector2.Distance(new Vector2((float) tupleList[index21].Item1, (float) tupleList[index21].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num27 == -1.0 || (double) num28 < (double) num27) { num27 = num28; tuple = tupleList[index21]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.hammer > 0 && fX == -1 && fY == -1) { Vector2 vector2 = mouse - this.Center; int num29 = Math.Sign(vector2.X); int num30 = Math.Sign(vector2.Y); if ((double) Math.Abs(vector2.X) > (double) Math.Abs(vector2.Y) * 3.0) { num30 = 0; mouse.Y = this.Center.Y; } if ((double) Math.Abs(vector2.Y) > (double) Math.Abs(vector2.X) * 3.0) { num29 = 0; mouse.X = this.Center.X; } int num31 = (int) this.Center.X / 16; int num32 = (int) this.Center.Y / 16; List> tupleList5 = new List>(); List> tupleList6 = new List>(); int num33 = 1; if (num30 == -1 && num29 != 0) num33 = -1; int index22 = (int) (((double) this.position.X + (double) (this.width / 2) + (double) ((this.width / 2 - 1) * num29)) / 16.0); int index23 = (int) (((double) this.position.Y + 0.1) / 16.0); if (num33 == -1) index23 = (int) (((double) this.position.Y + (double) this.height - 1.0) / 16.0); int num34 = this.width / 16 + (this.width % 16 == 0 ? 0 : 1); int num35 = this.height / 16 + (this.height % 16 == 0 ? 0 : 1); if (num29 != 0) { for (int index24 = 0; index24 < num35; ++index24) { if (Main.tile[index22, index23 + index24 * num33] == null) return; tupleList5.Add(new Tuple(index22, index23 + index24 * num33)); } } if (num30 != 0) { for (int index25 = 0; index25 < num34; ++index25) { if (Main.tile[(int) ((double) this.position.X / 16.0) + index25, index23] == null) return; tupleList5.Add(new Tuple((int) ((double) this.position.X / 16.0) + index25, index23)); } } int index26 = (int) (((double) mouse.X + (double) ((this.width / 2 - 1) * num29)) / 16.0); int index27 = (int) (((double) mouse.Y + 0.1 - (double) (this.height / 2 + 1)) / 16.0); if (num33 == -1) index27 = (int) (((double) mouse.Y + (double) (this.height / 2) - 1.0) / 16.0); if ((double) this.gravDir == -1.0 && num30 == 0) ++index27; if (index27 < 10) index27 = 10; if (index27 > Main.maxTilesY - 10) index27 = Main.maxTilesY - 10; int num36 = this.width / 16 + (this.width % 16 == 0 ? 0 : 1); int num37 = this.height / 16 + (this.height % 16 == 0 ? 0 : 1); if (num29 != 0) { for (int index28 = 0; index28 < num37; ++index28) { if (Main.tile[index26, index27 + index28 * num33] == null) return; tupleList6.Add(new Tuple(index26, index27 + index28 * num33)); } } if (num30 != 0) { for (int index29 = 0; index29 < num36; ++index29) { if (Main.tile[(int) (((double) mouse.X - (double) (this.width / 2)) / 16.0) + index29, index27] == null) return; tupleList6.Add(new Tuple((int) (((double) mouse.X - (double) (this.width / 2)) / 16.0) + index29, index27)); } } List> tupleList7 = new List>(); while (tupleList5.Count > 0) { Tuple tuple3 = tupleList5[0]; Tuple tuple4 = tupleList6[0]; Tuple tuple5 = Collision.TupleHitLineWall(tuple3.Item1, tuple3.Item2, tuple4.Item1, tuple4.Item2); if (tuple5.Item1 == -1 || tuple5.Item2 == -1) { tupleList5.Remove(tuple3); tupleList6.Remove(tuple4); } else { if (tuple5.Item1 != tuple4.Item1 || tuple5.Item2 != tuple4.Item2) tupleList7.Add(tuple5); Tile tile = Main.tile[tuple5.Item1, tuple5.Item2]; if (Collision.HitWallSubstep(tuple5.Item1, tuple5.Item2)) tupleList7.Add(tuple5); tupleList5.Remove(tuple3); tupleList6.Remove(tuple4); } } if (tupleList7.Count > 0) { float num38 = -1f; Tuple tuple = tupleList7[0]; for (int index30 = 0; index30 < tupleList7.Count; ++index30) { float num39 = Vector2.Distance(new Vector2((float) tupleList7[index30].Item1, (float) tupleList7[index30].Item2) * 16f + Vector2.One * 8f, this.Center); if ((double) num38 == -1.0 || (double) num39 < (double) num38) { num38 = num39; tuple = tupleList7[index30]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { this.poundRelease = false; fX = tuple.Item1; fY = tuple.Item2; } } tupleList7.Clear(); tupleList5.Clear(); tupleList6.Clear(); } if (obj.hammer > 0 && fX == -1 && fY == -1) { List> tupleList = new List>(); for (int x = num6; x <= num7; ++x) { for (int y = num8; y <= num9; ++y) { if (Main.tile[x, y].wall > (byte) 0 && Collision.HitWallSubstep(x, y)) tupleList.Add(new Tuple(x, y)); } } if (tupleList.Count > 0) { float num40 = -1f; Tuple tuple = tupleList[0]; for (int index31 = 0; index31 < tupleList.Count; ++index31) { float num41 = Vector2.Distance(new Vector2((float) tupleList[index31].Item1, (float) tupleList[index31].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num40 == -1.0 || (double) num41 < (double) num40) { num40 = num41; tuple = tupleList[index31]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { this.poundRelease = false; fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.type == 3620 && fX == -1 && fY == -1) { List> tupleList = new List>(); for (int index32 = num6; index32 <= num7; ++index32) { for (int index33 = num8; index33 <= num9; ++index33) { Tile tile = Main.tile[index32, index33]; if (tile.active() && tile.actuator() && (!this.ActuationRodLock || this.ActuationRodLockSetting == tile.inActive())) tupleList.Add(new Tuple(index32, index33)); } } if (tupleList.Count > 0) { float num42 = -1f; Tuple tuple = tupleList[0]; for (int index34 = 0; index34 < tupleList.Count; ++index34) { float num43 = Vector2.Distance(new Vector2((float) tupleList[index34].Item1, (float) tupleList[index34].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num42 == -1.0 || (double) num43 < (double) num42) { num42 = num43; tuple = tupleList[index34]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.type == 510 && fX == -1 && fY == -1) { List> tupleList = new List>(); for (int index35 = num6; index35 <= num7; ++index35) { for (int index36 = num8; index36 <= num9; ++index36) { Tile tile = Main.tile[index35, index36]; if (tile.wire() || tile.wire2() || tile.wire3() || tile.wire4() || tile.actuator()) tupleList.Add(new Tuple(index35, index36)); } } if (tupleList.Count > 0) { float num44 = -1f; Tuple tuple = tupleList[0]; for (int index37 = 0; index37 < tupleList.Count; ++index37) { float num45 = Vector2.Distance(new Vector2((float) tupleList[index37].Item1, (float) tupleList[index37].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num44 == -1.0 || (double) num45 < (double) num44) { num44 = num45; tuple = tupleList[index37]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.createTile >= 0 && TileID.Sets.Platforms[obj.createTile] && fX == -1 && fY == -1) { List> tupleList = new List>(); bool flag8 = false; if (Main.tile[index1, index2].active() && TileID.Sets.Platforms[(int) Main.tile[index1, index2].type]) flag8 = true; if (!flag8) { for (int index38 = num6; index38 <= num7; ++index38) { for (int index39 = num8; index39 <= num9; ++index39) { Tile tile1 = Main.tile[index38, index39]; if (tile1.active() && TileID.Sets.Platforms[(int) tile1.type]) { int num46 = (int) tile1.slope(); if (num46 != 2 && !Main.tile[index38 - 1, index39 - 1].active()) tupleList.Add(new Tuple(index38 - 1, index39 - 1)); if (!Main.tile[index38 - 1, index39].active()) tupleList.Add(new Tuple(index38 - 1, index39)); if (num46 != 1 && !Main.tile[index38 - 1, index39 + 1].active()) tupleList.Add(new Tuple(index38 - 1, index39 + 1)); if (num46 != 1 && !Main.tile[index38 + 1, index39 - 1].active()) tupleList.Add(new Tuple(index38 + 1, index39 - 1)); if (!Main.tile[index38 + 1, index39].active()) tupleList.Add(new Tuple(index38 + 1, index39)); if (num46 != 2 && !Main.tile[index38 + 1, index39 + 1].active()) tupleList.Add(new Tuple(index38 + 1, index39 + 1)); } if (!tile1.active()) { int num47 = 0; int num48 = 1; Tile tile2 = Main.tile[index38 + num47, index39 + num48]; if (tile2.active() && Main.tileSolid[(int) tile2.type] && !Main.tileSolidTop[(int) tile2.type]) tupleList.Add(new Tuple(index38, index39)); int num49 = -1; int num50 = 0; Tile tile3 = Main.tile[index38 + num49, index39 + num50]; if (tile3.active() && Main.tileSolid[(int) tile3.type] && !Main.tileSolidTop[(int) tile3.type]) tupleList.Add(new Tuple(index38, index39)); int num51 = 1; int num52 = 0; Tile tile4 = Main.tile[index38 + num51, index39 + num52]; if (tile4.active() && Main.tileSolid[(int) tile4.type] && !Main.tileSolidTop[(int) tile4.type]) tupleList.Add(new Tuple(index38, index39)); } } } } if (tupleList.Count > 0) { float num53 = -1f; Tuple tuple = tupleList[0]; for (int index40 = 0; index40 < tupleList.Count; ++index40) { float num54 = Vector2.Distance(new Vector2((float) tupleList[index40].Item1, (float) tupleList[index40].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num53 == -1.0 || (double) num54 < (double) num53) { num53 = num54; tuple = tupleList[index40]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if ((obj.type == 2340 || obj.type == 2739) && fX == -1 && fY == -1) { List> tupleList = new List>(); bool flag9 = false; if (Main.tile[index1, index2].active() && Main.tile[index1, index2].type == (ushort) 314) flag9 = true; if (!flag9) { for (int index41 = num6; index41 <= num7; ++index41) { for (int index42 = num8; index42 <= num9; ++index42) { Tile tile = Main.tile[index41, index42]; if (tile.active() && tile.type == (ushort) 314) { bool flag10 = Main.tile[index41 + 1, index42 + 1].active() && Main.tile[index41 + 1, index42 + 1].type == (ushort) 314; bool flag11 = Main.tile[index41 + 1, index42 - 1].active() && Main.tile[index41 + 1, index42 - 1].type == (ushort) 314; bool flag12 = Main.tile[index41 - 1, index42 + 1].active() && Main.tile[index41 - 1, index42 + 1].type == (ushort) 314; bool flag13 = Main.tile[index41 - 1, index42 - 1].active() && Main.tile[index41 - 1, index42 - 1].type == (ushort) 314; if ((!Main.tile[index41 - 1, index42 - 1].active() || Main.tileCut[(int) Main.tile[index41 - 1, index42 - 1].type] || TileID.Sets.BreakableWhenPlacing[(int) Main.tile[index41 - 1, index42 - 1].type]) && !(!flag10 & flag11)) tupleList.Add(new Tuple(index41 - 1, index42 - 1)); if (!Main.tile[index41 - 1, index42].active() || Main.tileCut[(int) Main.tile[index41 - 1, index42].type] || TileID.Sets.BreakableWhenPlacing[(int) Main.tile[index41 - 1, index42].type]) tupleList.Add(new Tuple(index41 - 1, index42)); if ((!Main.tile[index41 - 1, index42 + 1].active() || Main.tileCut[(int) Main.tile[index41 - 1, index42 + 1].type] || TileID.Sets.BreakableWhenPlacing[(int) Main.tile[index41 - 1, index42 + 1].type]) && !(!flag11 & flag10)) tupleList.Add(new Tuple(index41 - 1, index42 + 1)); if ((!Main.tile[index41 + 1, index42 - 1].active() || Main.tileCut[(int) Main.tile[index41 + 1, index42 - 1].type] || TileID.Sets.BreakableWhenPlacing[(int) Main.tile[index41 + 1, index42 - 1].type]) && !(!flag12 & flag13)) tupleList.Add(new Tuple(index41 + 1, index42 - 1)); if (!Main.tile[index41 + 1, index42].active() || Main.tileCut[(int) Main.tile[index41 + 1, index42].type] || TileID.Sets.BreakableWhenPlacing[(int) Main.tile[index41 + 1, index42].type]) tupleList.Add(new Tuple(index41 + 1, index42)); if ((!Main.tile[index41 + 1, index42 + 1].active() || Main.tileCut[(int) Main.tile[index41 + 1, index42 + 1].type] || TileID.Sets.BreakableWhenPlacing[(int) Main.tile[index41 + 1, index42 + 1].type]) && !(!flag13 & flag12)) tupleList.Add(new Tuple(index41 + 1, index42 + 1)); } } } } if (tupleList.Count > 0) { float num55 = -1f; Tuple tuple = tupleList[0]; for (int index43 = 0; index43 < tupleList.Count; ++index43) { if ((!Main.tile[tupleList[index43].Item1, tupleList[index43].Item2 - 1].active() || Main.tile[tupleList[index43].Item1, tupleList[index43].Item2 - 1].type != (ushort) 314) && (!Main.tile[tupleList[index43].Item1, tupleList[index43].Item2 + 1].active() || Main.tile[tupleList[index43].Item1, tupleList[index43].Item2 + 1].type != (ushort) 314)) { float num56 = Vector2.Distance(new Vector2((float) tupleList[index43].Item1, (float) tupleList[index43].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num55 == -1.0 || (double) num56 < (double) num55) { num55 = num56; tuple = tupleList[index43]; } } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9) && (double) num55 != -1.0) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.type == 2492 && fX == -1 && fY == -1) { List> tupleList = new List>(); bool flag14 = false; if (Main.tile[index1, index2].active() && Main.tile[index1, index2].type == (ushort) 314) flag14 = true; if (!flag14) { for (int index44 = num6; index44 <= num7; ++index44) { for (int index45 = num8; index45 <= num9; ++index45) { Tile tile = Main.tile[index44, index45]; if (tile.active() && tile.type == (ushort) 314) { if (!Main.tile[index44 - 1, index45].active() || Main.tileCut[(int) Main.tile[index44 - 1, index45].type] || TileID.Sets.BreakableWhenPlacing[(int) Main.tile[index44 - 1, index45].type]) tupleList.Add(new Tuple(index44 - 1, index45)); if (!Main.tile[index44 + 1, index45].active() || Main.tileCut[(int) Main.tile[index44 + 1, index45].type] || TileID.Sets.BreakableWhenPlacing[(int) Main.tile[index44 + 1, index45].type]) tupleList.Add(new Tuple(index44 + 1, index45)); } } } } if (tupleList.Count > 0) { float num57 = -1f; Tuple tuple = tupleList[0]; for (int index46 = 0; index46 < tupleList.Count; ++index46) { if ((!Main.tile[tupleList[index46].Item1, tupleList[index46].Item2 - 1].active() || Main.tile[tupleList[index46].Item1, tupleList[index46].Item2 - 1].type != (ushort) 314) && (!Main.tile[tupleList[index46].Item1, tupleList[index46].Item2 + 1].active() || Main.tile[tupleList[index46].Item1, tupleList[index46].Item2 + 1].type != (ushort) 314)) { float num58 = Vector2.Distance(new Vector2((float) tupleList[index46].Item1, (float) tupleList[index46].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num57 == -1.0 || (double) num58 < (double) num57) { num57 = num58; tuple = tupleList[index46]; } } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9) && (double) num57 != -1.0) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.createWall > 0 && fX == -1 && fY == -1) { List> tupleList = new List>(); for (int x = num6; x <= num7; ++x) { for (int y = num8; y <= num9; ++y) { Tile tile = Main.tile[x, y]; if (tile.wall == (byte) 0 && (!tile.active() || !Main.tileSolid[(int) tile.type] || Main.tileSolidTop[(int) tile.type]) && Collision.CanHitWithCheck(this.position, this.width, this.height, new Vector2((float) x, (float) y) * 16f, 16, 16, new Utils.PerLinePoint(DelegateMethods.NotDoorStand))) { bool flag15 = false; if (Main.tile[x - 1, y].active() || Main.tile[x - 1, y].wall > (byte) 0) flag15 = true; if (Main.tile[x + 1, y].active() || Main.tile[x + 1, y].wall > (byte) 0) flag15 = true; if (Main.tile[x, y - 1].active() || Main.tile[x, y - 1].wall > (byte) 0) flag15 = true; if (Main.tile[x, y + 1].active() || Main.tile[x, y + 1].wall > (byte) 0) flag15 = true; if (WorldGen.IsOpenDoorAnchorFrame(x, y)) flag15 = false; if (flag15) tupleList.Add(new Tuple(x, y)); } } } if (tupleList.Count > 0) { float num59 = -1f; Tuple tuple = tupleList[0]; for (int index47 = 0; index47 < tupleList.Count; ++index47) { float num60 = Vector2.Distance(new Vector2((float) tupleList[index47].Item1, (float) tupleList[index47].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num59 == -1.0 || (double) num60 < (double) num59) { num59 = num60; tuple = tupleList[index47]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.createTile == 254 && fX == -1 && fY == -1) { List> tupleList = new List>(); for (int index48 = num6; index48 <= num7; ++index48) { for (int index49 = num8; index49 <= num9; ++index49) { Tile tile5 = Main.tile[index48, index49 + 1]; Tile tile6 = Main.tile[index48 - 1, index49 + 1]; if ((double) index49 <= Main.worldSurface - 2.0) { bool flag16 = true; if (!tile6.active() || !tile5.active()) flag16 = false; if (tile6.slope() > (byte) 0 || tile5.slope() > (byte) 0 || tile6.halfBrick() || tile5.halfBrick()) flag16 = false; if (tile6.type != (ushort) 2 && tile6.type != (ushort) 109) flag16 = false; if (tile5.type != (ushort) 2 && tile5.type != (ushort) 109) flag16 = false; for (int x = index48 - 1; x <= index48; ++x) { for (int y = index49 - 1; y <= index49; ++y) { if (Main.tile[x, y].active() && !WorldGen.CanCutTile(x, y, TileCuttingContext.AttackMelee)) flag16 = false; } } if (flag16) tupleList.Add(new Tuple(index48, index49)); } else break; } } if (tupleList.Count > 0) { float num61 = -1f; Tuple tuple = tupleList[0]; for (int index50 = 0; index50 < tupleList.Count; ++index50) { float num62 = Vector2.Distance(new Vector2((float) tupleList[index50].Item1, (float) tupleList[index50].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num61 == -1.0 || (double) num62 < (double) num61) { num61 = num62; tuple = tupleList[index50]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.createTile == 454 && fX == -1 && fY == -1) { List> tupleList = new List>(); for (int index51 = num6; index51 <= num7; ++index51) { for (int index52 = num8; index52 <= num9 && (double) index52 <= Main.worldSurface - 2.0; ++index52) { bool flag17 = true; for (int index53 = index51 - 2; index53 <= index51 + 1; ++index53) { for (int index54 = index52 - 1; index54 <= index52 + 2; ++index54) { Tile testTile = Main.tile[index53, index54]; if (index54 == index52 - 1) { if (!WorldGen.SolidTile(testTile)) flag17 = false; } else if (testTile.active() && (!Main.tileCut[(int) testTile.type] || testTile.type == (ushort) 454)) flag17 = false; } } if (flag17) tupleList.Add(new Tuple(index51, index52)); } } if (tupleList.Count > 0) { float num63 = -1f; Tuple tuple = tupleList[0]; for (int index55 = 0; index55 < tupleList.Count; ++index55) { float num64 = Vector2.Distance(new Vector2((float) tupleList[index55].Item1, (float) tupleList[index55].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num63 == -1.0 || (double) num64 < (double) num63) { num63 = num64; tuple = tupleList[index55]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.createTile == 138 && fX == -1 && fY == -1) { List> tupleList = new List>(); for (int index56 = num6; index56 <= num7; ++index56) { for (int index57 = num8; index57 <= num9; ++index57) { Tile tile7 = Main.tile[index56, index57 + 1]; Tile tile8 = Main.tile[index56 - 1, index57 + 1]; bool flag18 = true; if (!tile8.nactive() || !tile7.nactive()) flag18 = false; if (tile8.slope() > (byte) 0 || tile7.slope() > (byte) 0 || tile8.halfBrick() || tile7.halfBrick()) flag18 = false; if (Main.tileNoAttach[(int) tile8.type] || Main.tileNoAttach[(int) tile7.type]) flag18 = false; for (int index58 = index56 - 1; index58 <= index56; ++index58) { for (int index59 = index57 - 1; index59 <= index57; ++index59) { Tile tile9 = Main.tile[index58, index59]; if (tile9.active() && !Main.tileCut[(int) tile9.type]) flag18 = false; } } Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(index56 * 16 - 16, index57 * 16 - 16, 32, 32); for (int index60 = 0; index60 < (int) byte.MaxValue; ++index60) { Player player = Main.player[index60]; if (player.active && !player.dead && player.Hitbox.Intersects(rectangle)) { flag18 = false; break; } } if (flag18) tupleList.Add(new Tuple(index56, index57)); } } if (tupleList.Count > 0) { float num65 = -1f; Tuple tuple = tupleList[0]; for (int index61 = 0; index61 < tupleList.Count; ++index61) { float num66 = Vector2.Distance(new Vector2((float) tupleList[index61].Item1, (float) tupleList[index61].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num65 == -1.0 || (double) num66 < (double) num65) { num65 = num66; tuple = tupleList[index61]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } Player.SmartCursor_Torch(obj, ref mouse, num6, num7, num8, num9, ref fX, ref fY, index1, index2); Player.SmartCursor_Filling(obj, ref mouse, num6, num7, num8, num9, ref fX, ref fY, index1, index2); if (Player.SmartCursorSettings.SmartBlocksEnabled && obj.createTile > -1 && obj.type != 213 && Main.tileSolid[obj.createTile] && !Main.tileSolidTop[obj.createTile] && !Main.tileFrameImportant[obj.createTile] && fX == -1 && fY == -1) { List> tupleList = new List>(); bool flag19 = false; if (Main.tile[index1, index2].active()) flag19 = true; if (!Collision.InTileBounds(index1, index2, num6, num8, num7, num9)) flag19 = true; if (!flag19) { for (int index62 = num6; index62 <= num7; ++index62) { for (int index63 = num8; index63 <= num9; ++index63) { Tile tile = Main.tile[index62, index63]; if (!tile.active() || Main.tileCut[(int) tile.type] || TileID.Sets.BreakableWhenPlacing[(int) tile.type]) { bool flag20 = false; if (Main.tile[index62 - 1, index63].active() && Main.tileSolid[(int) Main.tile[index62 - 1, index63].type] && !Main.tileSolidTop[(int) Main.tile[index62 - 1, index63].type]) flag20 = true; if (Main.tile[index62 + 1, index63].active() && Main.tileSolid[(int) Main.tile[index62 + 1, index63].type] && !Main.tileSolidTop[(int) Main.tile[index62 + 1, index63].type]) flag20 = true; if (Main.tile[index62, index63 - 1].active() && Main.tileSolid[(int) Main.tile[index62, index63 - 1].type] && !Main.tileSolidTop[(int) Main.tile[index62, index63 - 1].type]) flag20 = true; if (Main.tile[index62, index63 + 1].active() && Main.tileSolid[(int) Main.tile[index62, index63 + 1].type] && !Main.tileSolidTop[(int) Main.tile[index62, index63 + 1].type]) flag20 = true; if (flag20) tupleList.Add(new Tuple(index62, index63)); } } } } if (tupleList.Count > 0) { float num67 = -1f; Tuple tuple = tupleList[0]; for (int index64 = 0; index64 < tupleList.Count; ++index64) { if (Collision.EmptyTile(tupleList[index64].Item1, tupleList[index64].Item2)) { float num68 = Vector2.Distance(new Vector2((float) tupleList[index64].Item1, (float) tupleList[index64].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num67 == -1.0 || (double) num68 < (double) num67) { num67 = num68; tuple = tupleList[index64]; } } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9) && (double) num67 != -1.0) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if ((obj.type == 1072 || obj.type == 1544) && num1 != 0 && fX == -1 && fY == -1) { List> tupleList = new List>(); for (int index65 = num6; index65 <= num7; ++index65) { for (int index66 = num8; index66 <= num9; ++index66) { Tile tile = Main.tile[index65, index66]; if (tile.wall > (byte) 0 && (int) tile.wallColor() != num1 && (!tile.active() || !Main.tileSolid[(int) tile.type] || Main.tileSolidTop[(int) tile.type])) tupleList.Add(new Tuple(index65, index66)); } } if (tupleList.Count > 0) { float num69 = -1f; Tuple tuple = tupleList[0]; for (int index67 = 0; index67 < tupleList.Count; ++index67) { float num70 = Vector2.Distance(new Vector2((float) tupleList[index67].Item1, (float) tupleList[index67].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num69 == -1.0 || (double) num70 < (double) num69) { num69 = num70; tuple = tupleList[index67]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if ((obj.type == 1071 || obj.type == 1543) && num1 != 0 && fX == -1 && fY == -1) { List> tupleList = new List>(); for (int index68 = num6; index68 <= num7; ++index68) { for (int index69 = num8; index69 <= num9; ++index69) { Tile tile = Main.tile[index68, index69]; if (tile.active() && (int) tile.color() != num1) tupleList.Add(new Tuple(index68, index69)); } } if (tupleList.Count > 0) { float num71 = -1f; Tuple tuple = tupleList[0]; for (int index70 = 0; index70 < tupleList.Count; ++index70) { float num72 = Vector2.Distance(new Vector2((float) tupleList[index70].Item1, (float) tupleList[index70].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num71 == -1.0 || (double) num72 < (double) num71) { num71 = num72; tuple = tupleList[index70]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if ((obj.type == 1100 || obj.type == 1545) && fX == -1 && fY == -1) { List> tupleList = new List>(); for (int index71 = num6; index71 <= num7; ++index71) { for (int index72 = num8; index72 <= num9; ++index72) { Tile tile = Main.tile[index71, index72]; if (tile.active() && tile.color() > (byte) 0 || tile.wall > (byte) 0 && tile.wallColor() > (byte) 0) tupleList.Add(new Tuple(index71, index72)); } } if (tupleList.Count > 0) { float num73 = -1f; Tuple tuple = tupleList[0]; for (int index73 = 0; index73 < tupleList.Count; ++index73) { float num74 = Vector2.Distance(new Vector2((float) tupleList[index73].Item1, (float) tupleList[index73].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num73 == -1.0 || (double) num74 < (double) num73) { num73 = num74; tuple = tupleList[index73]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.type == 27 && fX == -1 && fY == -1 && num8 > 20) { List> tupleList8 = new List>(); for (int index74 = num6; index74 <= num7; ++index74) { for (int endY = num8; endY <= num9; ++endY) { Tile tile10 = Main.tile[index74, endY]; Tile tile11 = Main.tile[index74, endY - 1]; Tile testTile = Main.tile[index74, endY + 1]; Tile tile12 = Main.tile[index74 - 1, endY]; Tile tile13 = Main.tile[index74 + 1, endY]; Tile tile14 = Main.tile[index74 - 2, endY]; Tile tile15 = Main.tile[index74 + 2, endY]; Tile tile16 = Main.tile[index74 - 3, endY]; Tile tile17 = Main.tile[index74 + 3, endY]; if ((!tile10.active() || Main.tileCut[(int) tile10.type] || TileID.Sets.BreakableWhenPlacing[(int) tile10.type]) && (!tile11.active() || Main.tileCut[(int) tile11.type] || TileID.Sets.BreakableWhenPlacing[(int) tile11.type]) && (!tile12.active() || tile12.type != (ushort) 20) && (!tile13.active() || tile13.type != (ushort) 20) && (!tile14.active() || tile14.type != (ushort) 20) && (!tile15.active() || tile15.type != (ushort) 20) && (!tile16.active() || tile16.type != (ushort) 20) && (!tile17.active() || tile17.type != (ushort) 20) && testTile.active() && WorldGen.SolidTile2(testTile)) { switch (testTile.type) { case 2: case 23: case 53: case 109: case 112: case 116: case 147: case 199: case 234: if (tile12.liquid == (byte) 0 && tile10.liquid == (byte) 0 && tile13.liquid == (byte) 0 && WorldGen.EmptyTileCheck(index74 - 2, index74 + 2, endY - 20, endY, 20)) { tupleList8.Add(new Tuple(index74, endY)); continue; } continue; case 60: if (WorldGen.EmptyTileCheck(index74 - 2, index74 + 2, endY - 20, endY, 20)) { tupleList8.Add(new Tuple(index74, endY)); continue; } continue; default: continue; } } } } List> tupleList9 = new List>(); for (int index75 = 0; index75 < tupleList8.Count; ++index75) { bool flag21 = false; for (int index76 = -1; index76 < 2; index76 += 2) { Tile tile = Main.tile[tupleList8[index75].Item1 + index76, tupleList8[index75].Item2 + 1]; if (tile.active()) { switch (tile.type) { case 2: case 23: case 53: case 60: case 109: case 112: case 116: case 147: case 199: case 234: flag21 = true; continue; default: continue; } } } if (!flag21) tupleList9.Add(tupleList8[index75]); } for (int index77 = 0; index77 < tupleList9.Count; ++index77) tupleList8.Remove(tupleList9[index77]); tupleList9.Clear(); if (tupleList8.Count > 0) { float num75 = -1f; Tuple tuple = tupleList8[0]; for (int index78 = 0; index78 < tupleList8.Count; ++index78) { float num76 = Vector2.Distance(new Vector2((float) tupleList8[index78].Item1, (float) tupleList8[index78].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num75 == -1.0 || (double) num76 < (double) num75) { num75 = num76; tuple = tupleList8[index78]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList8.Clear(); } if (obj.type == 205 && fX == -1 && fY == -1) { List> tupleList = new List>(); for (int index79 = num6; index79 <= num7; ++index79) { for (int index80 = num8; index80 <= num9; ++index80) { Tile tile = Main.tile[index79, index80]; if (tile.liquid > (byte) 0) { int num77 = (int) tile.liquidType(); int num78 = 0; for (int index81 = index79 - 1; index81 <= index79 + 1; ++index81) { for (int index82 = index80 - 1; index82 <= index80 + 1; ++index82) { if ((int) Main.tile[index81, index82].liquidType() == num77) num78 += (int) Main.tile[index81, index82].liquid; } } if (num78 > 100) tupleList.Add(new Tuple(index79, index80)); } } } if (tupleList.Count > 0) { float num79 = -1f; Tuple tuple = tupleList[0]; for (int index83 = 0; index83 < tupleList.Count; ++index83) { float num80 = Vector2.Distance(new Vector2((float) tupleList[index83].Item1, (float) tupleList[index83].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num79 == -1.0 || (double) num80 < (double) num79) { num79 = num80; tuple = tupleList[index83]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.type == 849 && fX == -1 && fY == -1) { List> tupleList = new List>(); for (int index84 = num6; index84 <= num7; ++index84) { for (int index85 = num8; index85 <= num9; ++index85) { Tile tile = Main.tile[index84, index85]; if ((tile.wire() || tile.wire2() || tile.wire3() || tile.wire4()) && !tile.actuator() && tile.active()) tupleList.Add(new Tuple(index84, index85)); } } if (tupleList.Count > 0) { float num81 = -1f; Tuple tuple = tupleList[0]; for (int index86 = 0; index86 < tupleList.Count; ++index86) { float num82 = Vector2.Distance(new Vector2((float) tupleList[index86].Item1, (float) tupleList[index86].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num81 == -1.0 || (double) num82 < (double) num81) { num81 = num82; tuple = tupleList[index86]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.createTile == 82 && fX == -1 && fY == -1) { int placeStyle = obj.placeStyle; List> tupleList = new List>(); for (int index87 = num6; index87 <= num7; ++index87) { for (int index88 = num8; index88 <= num9; ++index88) { Tile tile18 = Main.tile[index87, index88]; Tile tile19 = Main.tile[index87, index88 + 1]; if ((!tile18.active() || TileID.Sets.BreakableWhenPlacing[(int) tile18.type] || Main.tileCut[(int) tile18.type] && tile18.type != (ushort) 82 && tile18.type != (ushort) 83) && tile19.nactive() && !tile19.halfBrick() && tile19.slope() == (byte) 0) { switch (placeStyle) { case 0: if (tile19.type != (ushort) 78 && tile19.type != (ushort) 380 && tile19.type != (ushort) 2 && tile19.type != (ushort) 109 || tile18.liquid > (byte) 0) continue; break; case 1: if (tile19.type != (ushort) 78 && tile19.type != (ushort) 380 && tile19.type != (ushort) 60 || tile18.liquid > (byte) 0) continue; break; case 2: if (tile19.type != (ushort) 78 && tile19.type != (ushort) 380 && tile19.type != (ushort) 0 && tile19.type != (ushort) 59 || tile18.liquid > (byte) 0) continue; break; case 3: if (tile19.type != (ushort) 78 && tile19.type != (ushort) 380 && tile19.type != (ushort) 203 && tile19.type != (ushort) 199 && tile19.type != (ushort) 23 && tile19.type != (ushort) 25 || tile18.liquid > (byte) 0) continue; break; case 4: if (tile19.type != (ushort) 78 && tile19.type != (ushort) 380 && tile19.type != (ushort) 53 && tile19.type != (ushort) 116 || tile18.liquid > (byte) 0 && tile18.lava()) continue; break; case 5: if (tile19.type != (ushort) 78 && tile19.type != (ushort) 380 && tile19.type != (ushort) 57 || tile18.liquid > (byte) 0 && !tile18.lava()) continue; break; case 6: if (tile19.type != (ushort) 78 && tile19.type != (ushort) 380 && tile19.type != (ushort) 147 && tile19.type != (ushort) 161 && tile19.type != (ushort) 163 && tile19.type != (ushort) 164 && tile19.type != (ushort) 200 || tile18.liquid > (byte) 0 && tile18.lava()) continue; break; } tupleList.Add(new Tuple(index87, index88)); } } } if (tupleList.Count > 0) { float num83 = -1f; Tuple tuple = tupleList[0]; for (int index89 = 0; index89 < tupleList.Count; ++index89) { float num84 = Vector2.Distance(new Vector2((float) tupleList[index89].Item1, (float) tupleList[index89].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num83 == -1.0 || (double) num84 < (double) num83) { num83 = num84; tuple = tupleList[index89]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.createTile == 380 && fX == -1 && fY == -1) { List> tupleList = new List>(); bool flag22 = false; if (Main.tile[index1, index2].active() && Main.tile[index1, index2].type == (ushort) 380) flag22 = true; if (!flag22) { for (int index90 = num6; index90 <= num7; ++index90) { for (int index91 = num8; index91 <= num9; ++index91) { Tile tile = Main.tile[index90, index91]; if (tile.active() && tile.type == (ushort) 380) { if (!Main.tile[index90 - 1, index91].active() || Main.tileCut[(int) Main.tile[index90 - 1, index91].type] || TileID.Sets.BreakableWhenPlacing[(int) Main.tile[index90 - 1, index91].type]) tupleList.Add(new Tuple(index90 - 1, index91)); if (!Main.tile[index90 + 1, index91].active() || Main.tileCut[(int) Main.tile[index90 + 1, index91].type] || TileID.Sets.BreakableWhenPlacing[(int) Main.tile[index90 + 1, index91].type]) tupleList.Add(new Tuple(index90 + 1, index91)); } } } } if (tupleList.Count > 0) { float num85 = -1f; Tuple tuple = tupleList[0]; for (int index92 = 0; index92 < tupleList.Count; ++index92) { float num86 = Vector2.Distance(new Vector2((float) tupleList[index92].Item1, (float) tupleList[index92].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num85 == -1.0 || (double) num86 < (double) num85) { num85 = num86; tuple = tupleList[index92]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9) && (double) num85 != -1.0) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.createTile == 78 && fX == -1 && fY == -1) { List> tupleList = new List>(); bool flag23 = false; if (Main.tile[index1, index2].active()) flag23 = true; if (!Collision.InTileBounds(index1, index2, num6, num8, num7, num9)) flag23 = true; if (!flag23) { for (int index93 = num6; index93 <= num7; ++index93) { for (int index94 = num8; index94 <= num9; ++index94) { Tile tile20 = Main.tile[index93, index94]; Tile tile21 = Main.tile[index93, index94 + 1]; if ((!tile20.active() || Main.tileCut[(int) tile20.type] || TileID.Sets.BreakableWhenPlacing[(int) tile20.type]) && tile21.nactive() && !tile21.halfBrick() && tile21.slope() == (byte) 0 && Main.tileSolid[(int) tile21.type]) tupleList.Add(new Tuple(index93, index94)); } } } if (tupleList.Count > 0) { float num87 = -1f; Tuple tuple = tupleList[0]; for (int index95 = 0; index95 < tupleList.Count; ++index95) { if (Collision.EmptyTile(tupleList[index95].Item1, tupleList[index95].Item2, true)) { float num88 = Vector2.Distance(new Vector2((float) tupleList[index95].Item1, (float) tupleList[index95].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num87 == -1.0 || (double) num88 < (double) num87) { num87 = num88; tuple = tupleList[index95]; } } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9) && (double) num87 != -1.0) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (obj.type == 213 && fX == -1 && fY == -1) { List> tupleList = new List>(); for (int index96 = num6; index96 <= num7; ++index96) { for (int index97 = num8; index97 <= num9; ++index97) { Tile tile = Main.tile[index96, index97]; bool flag24 = !Main.tile[index96 - 1, index97].active() || !Main.tile[index96, index97 + 1].active() || !Main.tile[index96 + 1, index97].active() || !Main.tile[index96, index97 - 1].active(); bool flag25 = !Main.tile[index96 - 1, index97 - 1].active() || !Main.tile[index96 - 1, index97 + 1].active() || !Main.tile[index96 + 1, index97 + 1].active() || !Main.tile[index96 + 1, index97 - 1].active(); if (tile.active() && !tile.inActive() && (tile.type == (ushort) 0 || tile.type == (ushort) 1) && (flag24 || tile.type == (ushort) 0 & flag25)) tupleList.Add(new Tuple(index96, index97)); } } if (tupleList.Count > 0) { float num89 = -1f; Tuple tuple = tupleList[0]; for (int index98 = 0; index98 < tupleList.Count; ++index98) { float num90 = Vector2.Distance(new Vector2((float) tupleList[index98].Item1, (float) tupleList[index98].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num89 == -1.0 || (double) num90 < (double) num89) { num89 = num90; tuple = tupleList[index98]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, num6, num8, num7, num9)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } if (fX != -1 && fY != -1) { Main.SmartCursorX = Player.tileTargetX = fX; Main.SmartCursorY = Player.tileTargetY = fY; Main.SmartCursorShowing = true; } ignoreTargets.Clear(); } public void SmartInteractLookup() { if (this.whoAmI != Main.myPlayer) return; Main.SmartInteractShowingGenuine = false; Main.SmartInteractShowingFake = false; Main.SmartInteractNPC = -1; Main.SmartInteractNPCsNearby.Clear(); Main.SmartInteractTileCoords.Clear(); Main.SmartInteractTileCoordsSelected.Clear(); int num1; Main.TileInteractionHY = num1 = -1; Main.TileInteractionLY = num1; Main.TileInteractionHX = num1; Main.TileInteractionLX = num1; bool smartCursorEnabled = Main.SmartCursorEnabled; if (!smartCursorEnabled && !PlayerInput.UsingGamepad) return; Item obj = this.inventory[this.selectedItem]; Vector2 vector2 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY); if ((double) this.gravDir == -1.0) vector2.Y = Main.screenPosition.Y + (float) Main.screenHeight - (float) Main.mouseY; int index1 = Player.tileTargetX; int index2 = Player.tileTargetY; if (index1 < 10) index1 = 10; if (index1 > Main.maxTilesX - 10) index1 = Main.maxTilesX - 10; if (index2 < 10) index2 = 10; if (index2 > Main.maxTilesY - 10) index2 = Main.maxTilesY - 10; bool flag1 = false; if (Main.tile[index1, index2] == null) return; if (Main.tile[index1, index2].active()) { switch (Main.tile[index1, index2].type) { case 4: case 33: case 334: case 395: case 410: case 455: flag1 = true; break; } } if (flag1) return; int num2 = 0; int num3 = (int) ((double) this.position.X / 16.0) - Player.tileRangeX - num2 + 1; int num4 = (int) (((double) this.position.X + (double) this.width) / 16.0) + Player.tileRangeX + num2 - 1; int num5 = (int) ((double) this.position.Y / 16.0) - Player.tileRangeY - num2 + 1; int num6 = (int) (((double) this.position.Y + (double) this.height) / 16.0) + Player.tileRangeY + num2 - 2; int lx1 = Utils.Clamp(num3, 10, Main.maxTilesX - 10); int hx = Utils.Clamp(num4, 10, Main.maxTilesX - 10); int ly1 = Utils.Clamp(num5, 10, Main.maxTilesY - 10); int hy = Utils.Clamp(num6, 10, Main.maxTilesY - 10); List> tupleList1 = new List>(); for (int index3 = 0; index3 < this.grapCount; ++index3) { Projectile projectile = Main.projectile[this.grappling[index3]]; int num7 = (int) projectile.Center.X / 16; int num8 = (int) projectile.Center.Y / 16; tupleList1.Add(new Tuple(num7, num8)); } int x1 = -1; int y1 = -1; int index4 = -1; Vector2 point1 = Main.ReverseGravitySupport(Main.MouseScreen) + Main.screenPosition; if (x1 == -1 && y1 == -1) { List> tupleList2 = new List>(); for (int index5 = lx1; index5 <= hx; ++index5) { for (int index6 = ly1; index6 <= hy; ++index6) { Tile tile = Main.tile[index5, index6]; if (tile.active()) { ushort type = tile.type; if (type <= (ushort) 209) { if (type <= (ushort) 97) { if (type <= (ushort) 55) { if (type <= (ushort) 21) { if ((uint) type - 10U > 1U && type != (ushort) 21) continue; } else if (type != (ushort) 29 && type != (ushort) 55) continue; } else if (type <= (ushort) 85) { if (type != (ushort) 79 && type != (ushort) 85) continue; } else if (type != (ushort) 88 && type != (ushort) 97) continue; } else if (type <= (ushort) 136) { if (type <= (ushort) 125) { if (type != (ushort) 104 && type != (ushort) 125) continue; } else if (type != (ushort) 132 && type != (ushort) 136) continue; } else if (type <= (ushort) 144) { if (type != (ushort) 139 && type != (ushort) 144) continue; } else if (type != (ushort) 207 && type != (ushort) 209) continue; } else if (type <= (ushort) 356) { if (type <= (ushort) 287) { if (type <= (ushort) 216) { if (type != (ushort) 212) { if ((uint) type - 215U > 1U) continue; } else { if (this.HasItem(949)) { tupleList2.Add(new Tuple(index5, index6)); continue; } continue; } } else if (type != (ushort) 237) { if (type != (ushort) 287) continue; } else { if (this.HasItem(1293)) { tupleList2.Add(new Tuple(index5, index6)); continue; } continue; } } else if (type <= (ushort) 338) { if (type != (ushort) 335 && type != (ushort) 338) continue; } else if (type != (ushort) 354) { if (type == (ushort) 356 && !Main.fastForwardTime && (Main.netMode == 1 || Main.sundialCooldown == 0)) { tupleList2.Add(new Tuple(index5, index6)); continue; } continue; } } else if (type <= (ushort) 425) { if (type <= (ushort) 389) { if (type != (ushort) 377 && (uint) type - 386U > 3U) continue; } else if ((uint) type - 410U > 1U && type != (ushort) 425) continue; } else if (type <= (ushort) 455) { if (type != (ushort) 441 && type != (ushort) 455) continue; } else if (type != (ushort) 463 && (uint) type - 467U > 1U) continue; tupleList2.Add(new Tuple(index5, index6)); } } } if (tupleList2.Count > 0) { float num9 = -1f; Tuple tuple = tupleList2[0]; for (int index7 = 0; index7 < tupleList2.Count; ++index7) { float num10 = Vector2.Distance(new Vector2((float) tupleList2[index7].Item1, (float) tupleList2[index7].Item2) * 16f + Vector2.One * 8f, vector2); if ((double) num9 == -1.0 || (double) num10 < (double) num9) { num9 = num10; tuple = tupleList2[index7]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, lx1, ly1, hx, hy)) { x1 = tuple.Item1; y1 = tuple.Item2; } } bool flag2 = false; for (int index8 = 0; index8 < tupleList2.Count; ++index8) { int index9 = tupleList2[index8].Item1; int index10 = tupleList2[index8].Item2; Tile tile = Main.tile[index9, index10]; int num11 = 0; int num12 = 0; int num13 = 18; int num14 = 18; int num15 = 0; int num16 = 2; switch (tile.type) { case 10: num11 = 1; num12 = 3; num16 = 0; break; case 11: case 356: case 410: num11 = 2; num12 = 3; num16 = 0; break; case 21: case 55: case 85: case 97: case 125: case 132: case 287: case 335: case 386: case 411: case 425: case 441: case 467: case 468: num11 = 2; num12 = 2; break; case 29: case 387: num11 = 2; num12 = 1; break; case 79: num11 = 4; num12 = 2; num16 = 0; break; case 88: num11 = 3; num12 = 1; num16 = 0; break; case 104: num11 = 2; num12 = 5; break; case 136: case 144: num11 = 1; num12 = 1; num16 = 0; break; case 139: num11 = 2; num12 = 2; num16 = 0; break; case 207: num11 = 2; num12 = 4; num16 = 0; break; case 209: num11 = 4; num12 = 3; num16 = 0; break; case 212: num11 = 4; num12 = 3; break; case 215: case 237: case 377: num11 = 3; num12 = 2; break; case 216: case 338: num11 = 1; num12 = 2; break; case 354: case 455: num11 = 3; num12 = 3; num16 = 0; break; case 388: case 389: num11 = 1; num12 = 5; break; case 463: num11 = 3; num12 = 4; break; } if (num11 != 0 && num12 != 0) { int lx2 = index9 - (int) tile.frameX % (num13 * num11 + num15) / num13; int ly2 = index10 - (int) tile.frameY % (num14 * num12 + num16) / num14; bool flag3 = Collision.InTileBounds(x1, y1, lx2, ly2, lx2 + num11 - 1, ly2 + num12 - 1); if (!smartCursorEnabled) flag3 = flag3 && Collision.InTileBounds((int) vector2.X / 16, (int) vector2.Y / 16, lx2, ly2, lx2 + num11 - 1, ly2 + num12 - 1); if (flag2) flag3 = false; if (!flag2 & flag3) flag2 = true; for (int x2 = lx2; x2 < lx2 + num11; ++x2) { for (int y2 = ly2; y2 < ly2 + num12; ++y2) { Point point2 = new Point(x2, y2); if (!Main.SmartInteractTileCoords.Contains(point2)) { if (flag3) Main.SmartInteractTileCoordsSelected.Add(point2); if (flag3 | smartCursorEnabled) Main.SmartInteractTileCoords.Add(point2); } } } } } tupleList2.Clear(); } if (index4 == -1 & smartCursorEnabled) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(lx1 * 16, ly1 * 16, (hx - lx1) * 16 + 16, (hy - ly1) * 16 + 16); bool flag4 = false; for (int index11 = 0; index11 < 200; ++index11) { NPC npc = Main.npc[index11]; if (npc.active && npc.townNPC && npc.Hitbox.Intersects(rectangle)) { Main.SmartInteractNPCsNearby.Add(index11); if (!flag4) { float num17 = npc.Hitbox.Distance(point1); if ((index4 == -1 ? 1 : ((double) Main.npc[index4].Hitbox.Distance(point1) > (double) num17 ? 1 : 0)) != 0) index4 = index11; if ((double) num17 == 0.0) { flag4 = true; index4 = index11; break; } } } } if (flag4) { x1 = y1 = -1; Main.SmartInteractTileCoordsSelected.Clear(); } } if (x1 != -1 && y1 != -1 && index4 != -1) { Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(x1 * 16, y1 * 16, 16, 16); Microsoft.Xna.Framework.Rectangle hitbox = Main.npc[index4].Hitbox; Vector2 point3 = point1; if ((double) r.Distance(point3) < (double) hitbox.Distance(point1)) { index4 = -1; } else { x1 = y1 = -1; Main.SmartInteractTileCoordsSelected.Clear(); } } if (UILinkPointNavigator.InUse || PlayerInput.UsingGamepad && Main.HoveringOverAnNPC) Main.SmartInteractTileCoordsSelected.Clear(); if (PlayerInput.UsingGamepad && !Main.SmartCursorEnabled) { if (x1 != -1 && y1 != -1) { Main.TileInteractionLX = lx1 - 10; Main.TileInteractionLY = ly1 - 10; Main.TileInteractionHX = hx + 10; Main.TileInteractionHY = hy + 10; Main.SmartInteractShowingFake = Main.SmartInteractTileCoords.Count > 0; } } else { if (x1 != -1 && y1 != -1) { Main.SmartInteractX = x1; Main.SmartInteractY = y1; Main.SmartInteractShowingGenuine = true; Main.TileInteractionLX = lx1 - 10; Main.TileInteractionLY = ly1 - 10; Main.TileInteractionHX = hx + 10; Main.TileInteractionHY = hy + 10; } if (index4 != -1) { Main.SmartInteractNPC = index4; Main.SmartInteractShowingGenuine = true; } } tupleList1.Clear(); } private static void SmartCursor_Axe( Item item, ref Vector2 mouse, int LX, int HX, int LY, int HY, ref int fX, ref int fY) { if (item.axe <= 0 || fX != -1 || fY != -1) return; float num1 = -1f; for (int index1 = LX; index1 <= HX; ++index1) { for (int index2 = LY; index2 <= HY; ++index2) { if (Main.tile[index1, index2].active()) { Tile tile = Main.tile[index1, index2]; if (Main.tileAxe[(int) tile.type]) { int x = index1; int y = index2; if (tile.type == (ushort) 5) { if (Collision.InTileBounds(x + 1, y, LX, LY, HX, HY)) { if (Main.tile[x, y].frameY >= (short) 198 && Main.tile[x, y].frameX == (short) 44) ++x; if (Main.tile[x, y].frameX == (short) 66 && Main.tile[x, y].frameY <= (short) 44) ++x; if (Main.tile[x, y].frameX == (short) 44 && Main.tile[x, y].frameY >= (short) 132 && Main.tile[x, y].frameY <= (short) 176) ++x; } if (Collision.InTileBounds(x - 1, y, LX, LY, HX, HY)) { if (Main.tile[x, y].frameY >= (short) 198 && Main.tile[x, y].frameX == (short) 66) --x; if (Main.tile[x, y].frameX == (short) 88 && Main.tile[x, y].frameY >= (short) 66 && Main.tile[x, y].frameY <= (short) 110) --x; if (Main.tile[x, y].frameX == (short) 22 && Main.tile[x, y].frameY >= (short) 132 && Main.tile[x, y].frameY <= (short) 176) --x; } while (Main.tile[x, y].active() && Main.tile[x, y].type == (ushort) 5 && Main.tile[x, y + 1].type == (ushort) 5 && Collision.InTileBounds(x, y + 1, LX, LY, HX, HY)) ++y; } if (tile.type == (ushort) 80) { if (Collision.InTileBounds(x + 1, y, LX, LY, HX, HY)) { if (Main.tile[x, y].frameX == (short) 54) ++x; if (Main.tile[x, y].frameX == (short) 108 && Main.tile[x, y].frameY == (short) 36) ++x; } if (Collision.InTileBounds(x - 1, y, LX, LY, HX, HY)) { if (Main.tile[x, y].frameX == (short) 36) --x; if (Main.tile[x, y].frameX == (short) 108 && Main.tile[x, y].frameY == (short) 18) --x; } while (Main.tile[x, y].active() && Main.tile[x, y].type == (ushort) 80 && Main.tile[x, y + 1].type == (ushort) 80 && Collision.InTileBounds(x, y + 1, LX, LY, HX, HY)) ++y; } if (tile.type == (ushort) 323 || tile.type == (ushort) 72) { while (Main.tile[x, y].active() && (Main.tile[x, y].type == (ushort) 323 && Main.tile[x, y + 1].type == (ushort) 323 || Main.tile[x, y].type == (ushort) 72 && Main.tile[x, y + 1].type == (ushort) 72) && Collision.InTileBounds(x, y + 1, LX, LY, HX, HY)) ++y; } float num2 = Vector2.Distance(new Vector2((float) x, (float) y) * 16f + Vector2.One * 8f, mouse); if ((double) num1 == -1.0 || (double) num2 < (double) num1) { num1 = num2; fX = x; fY = y; } } } } } } private static void SmartCursor_Filling( Item item, ref Vector2 mouse, int LX, int HX, int LY, int HY, ref int fX, ref int fY, int tX, int tY) { if (Player.SmartCursorSettings.SmartBlocksEnabled || item.createTile <= -1 || item.type == 213 || !Main.tileSolid[item.createTile] || Main.tileSolidTop[item.createTile] || Main.tileFrameImportant[item.createTile] || fX != -1 || fY != -1) return; List> tupleList = new List>(); bool flag1 = false; if (Main.tile[tX, tY].active()) flag1 = true; if (!Collision.InTileBounds(tX, tY, LX, LY, HX, HY)) flag1 = true; if (!flag1) { for (int index1 = LX; index1 <= HX; ++index1) { for (int index2 = LY; index2 <= HY; ++index2) { Tile tile = Main.tile[index1, index2]; if (!tile.active() || Main.tileCut[(int) tile.type] || TileID.Sets.BreakableWhenPlacing[(int) tile.type]) { int num = 0; if (Main.tile[index1 - 1, index2].active() && Main.tileSolid[(int) Main.tile[index1 - 1, index2].type] && !Main.tileSolidTop[(int) Main.tile[index1 - 1, index2].type]) ++num; if (Main.tile[index1 + 1, index2].active() && Main.tileSolid[(int) Main.tile[index1 + 1, index2].type] && !Main.tileSolidTop[(int) Main.tile[index1 + 1, index2].type]) ++num; if (Main.tile[index1, index2 - 1].active() && Main.tileSolid[(int) Main.tile[index1, index2 - 1].type] && !Main.tileSolidTop[(int) Main.tile[index1, index2 - 1].type]) ++num; if (Main.tile[index1, index2 + 1].active() && Main.tileSolid[(int) Main.tile[index1, index2 + 1].type] && !Main.tileSolidTop[(int) Main.tile[index1, index2 + 1].type]) ++num; if (num >= 2) tupleList.Add(new Tuple(index1, index2)); } } } } if (tupleList.Count > 0) { float num1 = -1f; float num2 = float.PositiveInfinity; Tuple tuple = tupleList[0]; for (int index = 0; index < tupleList.Count; ++index) { if (Collision.EmptyTile(tupleList[index].Item1, tupleList[index].Item2, true)) { Vector2 vector2 = new Vector2((float) tupleList[index].Item1, (float) tupleList[index].Item2) * 16f + Vector2.One * 8f - mouse; bool flag2 = false; float num3 = Math.Abs(vector2.X); float num4 = vector2.Length(); if ((double) num3 < (double) num2) flag2 = true; if ((double) num3 == (double) num2 && ((double) num1 == -1.0 || (double) num4 < (double) num1)) flag2 = true; if (flag2) { num1 = num4; num2 = num3; tuple = tupleList[index]; } } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, LX, LY, HX, HY) && (double) num1 != -1.0) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } private static void SmartCursor_Torch( Item item, ref Vector2 mouse, int LX, int HX, int LY, int HY, ref int fX, ref int fY, int tX, int tY) { if (item.createTile != 4 || fX != -1 || fY != -1) return; List> tupleList = new List>(); bool flag1 = item.type != 1333 && item.type != 523; for (int index1 = LX; index1 <= HX; ++index1) { for (int index2 = LY; index2 <= HY; ++index2) { Tile tile1 = Main.tile[index1, index2]; Tile tile2 = Main.tile[index1 - 1, index2]; Tile tile3 = Main.tile[index1 + 1, index2]; Tile tile4 = Main.tile[index1, index2 + 1]; if (!tile1.active() || TileID.Sets.BreakableWhenPlacing[(int) tile1.type] || Main.tileCut[(int) tile1.type] && tile1.type != (ushort) 82 && tile1.type != (ushort) 83) { bool flag2 = false; for (int index3 = index1 - 7; index3 <= index1 + 7; ++index3) { for (int index4 = index2 - 7; index4 <= index2 + 7; ++index4) { if (Main.tile[index3, index4] != null && Main.tile[index3, index4].type == (ushort) 4) { flag2 = true; break; } } if (flag2) break; } if (!flag2 && (!flag1 || tile1.liquid <= (byte) 0) && (tile1.wall > (byte) 0 || tile2.active() && (tile2.slope() == (byte) 0 || (int) tile2.slope() % 2 != 1) && (Main.tileSolid[(int) tile2.type] && !Main.tileNoAttach[(int) tile2.type] && !Main.tileSolidTop[(int) tile2.type] && !TileID.Sets.NotReallySolid[(int) tile2.type] || tile2.type == (ushort) 124 || tile2.type == (ushort) 5 && Main.tile[index1 - 1, index2 - 1].type == (ushort) 5 && Main.tile[index1 - 1, index2 + 1].type == (ushort) 5) || tile3.active() && (tile3.slope() == (byte) 0 || (int) tile3.slope() % 2 != 0) && (Main.tileSolid[(int) tile3.type] && !Main.tileNoAttach[(int) tile3.type] && !Main.tileSolidTop[(int) tile3.type] && !TileID.Sets.NotReallySolid[(int) tile3.type] || tile3.type == (ushort) 124 || tile3.type == (ushort) 5 && Main.tile[index1 + 1, index2 - 1].type == (ushort) 5 && Main.tile[index1 + 1, index2 + 1].type == (ushort) 5) || tile4.active() && Main.tileSolid[(int) tile4.type] && !Main.tileNoAttach[(int) tile4.type] && (!Main.tileSolidTop[(int) tile4.type] || TileID.Sets.Platforms[(int) tile4.type] && tile4.slope() == (byte) 0) && !TileID.Sets.NotReallySolid[(int) tile4.type] && !tile4.halfBrick() && tile4.slope() == (byte) 0) && tile1.type != (ushort) 4) tupleList.Add(new Tuple(index1, index2)); } } } if (tupleList.Count > 0) { float num1 = -1f; Tuple tuple = tupleList[0]; for (int index = 0; index < tupleList.Count; ++index) { float num2 = Vector2.Distance(new Vector2((float) tupleList[index].Item1, (float) tupleList[index].Item2) * 16f + Vector2.One * 8f, mouse); if ((double) num1 == -1.0 || (double) num2 < (double) num1) { num1 = num2; tuple = tupleList[index]; } } if (Collision.InTileBounds(tuple.Item1, tuple.Item2, LX, LY, HX, HY)) { fX = tuple.Item1; fY = tuple.Item2; } } tupleList.Clear(); } public void SmartSelectLookup() { if (this.controlTorch && this.itemAnimation == 0) { int num1 = 0; int index1 = (int) (((double) Main.mouseX + (double) Main.screenPosition.X) / 16.0); int index2 = (int) (((double) Main.mouseY + (double) Main.screenPosition.Y) / 16.0); if ((double) this.gravDir == -1.0) index2 = (int) (((double) Main.screenPosition.Y + (double) Main.screenHeight - (double) Main.mouseY) / 16.0); int num2 = -10; int num3 = -10; int num4 = -10; int num5 = -10; int num6 = -10; for (int index3 = 0; index3 < 50; ++index3) { if (this.inventory[index3].pick > 0 && num2 == -10) num2 = this.inventory[index3].tileBoost; if (this.inventory[index3].axe > 0 && num3 == -10) num3 = this.inventory[index3].tileBoost; if (this.inventory[index3].hammer > 0 && num4 == -10) num4 = this.inventory[index3].tileBoost; if ((this.inventory[index3].type == 929 || this.inventory[index3].type == 1338 || this.inventory[index3].type == 1345) && num5 == -10) num5 = this.inventory[index3].tileBoost; if ((this.inventory[index3].type == 424 || this.inventory[index3].type == 1103) && num6 == -10) num6 = this.inventory[index3].tileBoost; } int num7 = 0; int num8 = 0; if ((double) this.position.X / 16.0 >= (double) index1) num7 = (int) ((double) this.position.X / 16.0) - index1; if (((double) this.position.X + (double) this.width) / 16.0 <= (double) index1) num7 = index1 - (int) (((double) this.position.X + (double) this.width) / 16.0); if ((double) this.position.Y / 16.0 >= (double) index2) num8 = (int) ((double) this.position.Y / 16.0) - index2; if (((double) this.position.Y + (double) this.height) / 16.0 <= (double) index2) num8 = index2 - (int) (((double) this.position.Y + (double) this.height) / 16.0); bool flag1 = false; bool flag2 = false; try { flag2 = Main.tile[index1, index2].liquid > (byte) 0; if (Main.tile[index1, index2].active()) { int type = (int) Main.tile[index1, index2].type; if (type == 219 && num7 <= num6 + Player.tileRangeX && num8 <= num6 + Player.tileRangeY) { num1 = 7; flag1 = true; } else if (type == 209 && num7 <= num5 + Player.tileRangeX && num8 <= num5 + Player.tileRangeY) { num1 = 6; flag1 = true; } else if (Main.tileHammer[type] && num7 <= num4 + Player.tileRangeX && num8 <= num4 + Player.tileRangeY) { num1 = 1; flag1 = true; } else if (Main.tileAxe[type] && num7 <= num3 + Player.tileRangeX && num8 <= num3 + Player.tileRangeY) { num1 = 2; flag1 = true; } else if (num7 <= num2 + Player.tileRangeX) { if (num8 <= num2 + Player.tileRangeY) { num1 = 3; flag1 = true; } } } else if (flag2) { if (this.wet) { num1 = 4; flag1 = true; } } } catch { } if (!flag1 && this.wet) num1 = 4; if (num1 == 0 || num1 == 4) { double num9 = (double) Math.Abs((float) ((double) Main.mouseX + (double) Main.screenPosition.X - ((double) this.position.X + (double) (this.width / 2)))); float num10 = Math.Abs((float) ((double) Main.mouseY + (double) Main.screenPosition.Y - ((double) this.position.Y + (double) (this.height / 2)))) * 1.3f; if (Math.Sqrt(num9 * num9 + (double) num10 * (double) num10) > 200.0) num1 = 5; } for (int index4 = 0; index4 < 50; ++index4) { int type = this.inventory[index4].type; switch (num1) { case 0: switch (type) { case 8: case 427: case 428: case 429: case 430: case 431: case 432: case 433: case 523: case 974: case 1245: case 1333: case 2274: case 3004: case 3045: case 3114: if (this.nonTorch == -1) this.nonTorch = this.selectedItem; this.selectedItem = index4; return; case 282: case 286: case 3002: case 3112: if (this.nonTorch == -1) this.nonTorch = this.selectedItem; this.selectedItem = index4; continue; default: continue; } case 1: if (this.inventory[index4].hammer > 0) { if (this.nonTorch == -1) this.nonTorch = this.selectedItem; this.selectedItem = index4; return; } break; case 2: if (this.inventory[index4].axe > 0) { if (this.nonTorch == -1) this.nonTorch = this.selectedItem; this.selectedItem = index4; return; } break; case 3: if (this.inventory[index4].pick > 0) { if (this.nonTorch == -1) this.nonTorch = this.selectedItem; this.selectedItem = index4; return; } break; case 4: if (this.inventory[index4].type != 282 && this.inventory[index4].type != 286 && this.inventory[index4].type != 3002 && this.inventory[index4].type != 3112 && this.inventory[index4].type != 930 && (type == 8 || type == 427 || type == 428 || type == 429 || type == 430 || type == 431 || type == 432 || type == 433 || type == 974 || type == 1245 || type == 2274 || type == 3004 || type == 3045 || type == 3114)) { if (this.nonTorch == -1) this.nonTorch = this.selectedItem; if (this.inventory[this.selectedItem].createTile != 4) { this.selectedItem = index4; break; } break; } if (((type == 282 || type == 286 || type == 3002 ? 1 : (type == 3112 ? 1 : 0)) & (flag2 ? 1 : 0)) != 0) { if (this.nonTorch == -1) this.nonTorch = this.selectedItem; this.selectedItem = index4; return; } if (type == 930 & flag2) { bool flag3 = false; for (int index5 = 57; index5 >= 0; --index5) { if (this.inventory[index5].ammo == this.inventory[index4].useAmmo) { flag3 = true; break; } } if (flag3) { if (this.nonTorch == -1) this.nonTorch = this.selectedItem; this.selectedItem = index4; return; } break; } if (type == 1333 || type == 523) { if (this.nonTorch == -1) this.nonTorch = this.selectedItem; this.selectedItem = index4; return; } break; case 5: switch (type) { case 8: case 427: case 428: case 429: case 430: case 431: case 432: case 433: case 523: case 974: case 1245: case 1333: case 2274: case 3004: case 3045: case 3114: if (this.nonTorch == -1) this.nonTorch = this.selectedItem; if (this.inventory[this.selectedItem].createTile != 4) { this.selectedItem = index4; continue; } continue; case 282: case 286: case 3002: case 3112: if (this.nonTorch == -1) this.nonTorch = this.selectedItem; this.selectedItem = index4; return; case 930: bool flag4 = false; for (int index6 = 57; index6 >= 0; --index6) { if (this.inventory[index6].ammo == this.inventory[index4].useAmmo) { flag4 = true; break; } } if (flag4) { if (this.nonTorch == -1) this.nonTorch = this.selectedItem; this.selectedItem = index4; return; } continue; default: continue; } case 6: int num11 = 929; if (Main.tile[index1, index2].frameX >= (short) 144) num11 = 1345; else if (Main.tile[index1, index2].frameX >= (short) 72) num11 = 1338; if (type == num11) { if (this.nonTorch == -1) this.nonTorch = this.selectedItem; this.selectedItem = index4; return; } break; case 7: if (ItemID.Sets.ExtractinatorMode[type] >= 0) { if (this.nonTorch == -1) this.nonTorch = this.selectedItem; this.selectedItem = index4; return; } break; } } } else if (this.itemAnimation == 0 && this.DpadRadial.SelectedItem != -1 && this.inventory[this.DpadRadial.SelectedItem].stack > 0) { if (this.nonTorch == -1) this.nonTorch = this.selectedItem; this.selectedItem = this.DpadRadial.SelectedItem; } else if (this.itemAnimation == 0 && this.CircularRadial.SelectedItem != -1 && this.inventory[this.CircularRadial.SelectedItem].stack > 0) { if (this.nonTorch == -1) this.nonTorch = this.selectedItem; this.selectedItem = this.CircularRadial.SelectedItem; } else { if (this.nonTorch <= -1 || this.itemAnimation != 0) return; this.selectedItem = this.nonTorch; this.nonTorch = -1; } } public void ResetEffects() { this.extraAccessorySlots = !this.extraAccessory || !Main.expertMode && !Main.gameMenu ? 0 : 1; this.arcticDivingGear = false; this.noBuilding = false; this.strongBees = false; this.armorPenetration = 0; this.shroomiteStealth = false; this.statDefense = 0; this.accWatch = 0; this.accCompass = 0; this.accDepthMeter = 0; this.accDivingHelm = false; this.lifeRegen = 0; this.manaCost = 1f; this.meleeSpeed = 1f; this.meleeDamage = 1f; this.rangedDamage = 1f; this.thrownDamage = 1f; this.magicDamage = 1f; this.minionDamage = 1f; this.meleeCrit = 4; this.rangedCrit = 4; this.magicCrit = 4; this.thrownCrit = 4; this.thrownVelocity = 1f; this.minionKB = 0.0f; this.moveSpeed = 1f; this.boneArmor = false; this.honey = false; this.frostArmor = false; this.rocketBoots = 0; this.fireWalk = false; this.noKnockback = false; this.jumpBoost = false; this.noFallDmg = false; this.accFlipper = false; this.spawnMax = false; this.spaceGun = false; this.killGuide = false; this.killClothier = false; this.lavaImmune = false; this.gills = false; this.slowFall = false; this.findTreasure = false; this.invis = false; this.nightVision = false; this.enemySpawns = false; this.thorns = 0.0f; this.aggro = 0; this.waterWalk = false; this.waterWalk2 = false; this.detectCreature = false; this.gravControl = false; this.bee = false; this.gravControl2 = false; this.statLifeMax2 = this.statLifeMax; this.statManaMax2 = this.statManaMax; this.ammoCost80 = false; this.ammoCost75 = false; this.thrownCost50 = false; this.thrownCost33 = false; this.manaRegenBuff = false; this.arrowDamage = 1f; this.bulletDamage = 1f; this.rocketDamage = 1f; this.yoraiz0rEye = 0; this.yoraiz0rDarkness = false; this.leinforsHair = false; this.suspiciouslookingTentacle = false; this.crimsonHeart = false; this.lightOrb = false; this.blueFairy = false; this.redFairy = false; this.greenFairy = false; this.wisp = false; this.bunny = false; this.turtle = false; this.eater = false; this.skeletron = false; this.hornet = false; this.zephyrfish = false; this.tiki = false; this.lizard = false; this.parrot = false; this.sapling = false; this.cSapling = false; this.truffle = false; this.yoyoGlove = false; this.counterWeight = 0; this.stringColor = 0; this.yoyoString = false; this.shadowDodge = false; this.palladiumRegen = false; this.chaosState = false; this.onHitDodge = false; this.onHitRegen = false; this.onHitPetal = false; this.iceBarrier = false; this.maxMinions = 1; this.maxTurrets = 1; this.ammoBox = false; this.ammoPotion = false; this.penguin = false; this.sporeSac = false; this.shinyStone = false; this.dd2Accessory = false; this.magicLantern = false; this.rabid = false; this.sunflower = false; this.wellFed = false; this.inferno = false; this.manaMagnet = false; this.lifeMagnet = false; this.lifeForce = false; this.dangerSense = false; this.endurance = 0.0f; this.calmed = false; this.beetleOrbs = 0; this.beetleBuff = false; this.miniMinotaur = false; this.goldRing = false; this.solarShields = 0; this.GoingDownWithGrapple = false; this.fishingSkill = 0; this.cratePotion = false; this.sonarPotion = false; this.accTackleBox = false; this.accFishingLine = false; this.accFishFinder = false; this.accWeatherRadio = false; this.accThirdEye = false; this.InfoAccMechShowWires = false; this.accJarOfSouls = false; this.accCalendar = false; this.accStopwatch = false; this.accOreFinder = false; this.accCritterGuide = false; this.accDreamCatcher = false; this.wallSpeed = 1f; this.tileSpeed = 1f; this.autoPaint = false; this.autoActuator = false; this.petFlagDD2Gato = false; this.petFlagDD2Dragon = false; this.petFlagDD2Ghost = false; this.companionCube = false; this.babyFaceMonster = false; this.manaSick = false; this.puppy = false; this.grinch = false; this.blackCat = false; this.spider = false; this.squashling = false; this.magicCuffs = false; this.coldDash = false; this.sailDash = false; this.cordage = false; this.magicQuiver = false; this.magmaStone = false; this.hasRaisableShield = false; this.lavaRose = false; this.eyeSpring = false; this.snowman = false; this.scope = false; this.panic = false; this.brainOfConfusion = false; this.dino = false; this.crystalLeaf = false; this.pygmy = false; this.raven = false; this.slime = false; this.hornetMinion = false; this.impMinion = false; this.twinsMinion = false; this.spiderMinion = false; this.pirateMinion = false; this.sharknadoMinion = false; this.stardustMinion = false; this.stardustGuardian = false; this.stardustDragon = false; this.UFOMinion = false; this.DeadlySphereMinion = false; this.chilled = false; this.dazed = false; this.frozen = false; this.stoned = false; this.webbed = false; this.ichor = false; this.manaRegenBonus = 0; this.manaRegenDelayBonus = 0; this.carpet = false; this.iceSkate = false; this.dash = 0; this.spikedBoots = 0; this.blackBelt = false; this.lavaMax = 0; this.archery = false; this.poisoned = false; this.venom = false; this.blind = false; this.blackout = false; this.onFire = false; this.dripping = false; this.drippingSlime = false; this.burned = false; this.suffocating = false; this.onFire2 = false; this.onFrostBurn = false; this.frostBurn = false; this.noItems = false; this.blockRange = 0; this.pickSpeed = 1f; this.wereWolf = false; this.rulerGrid = false; this.rulerLine = false; this.bleed = false; this.confused = false; this.witheredArmor = false; this.witheredWeapon = false; this.parryDamageBuff = false; this.slowOgreSpit = false; this.wings = 0; this.wingsLogic = 0; this.wingTimeMax = 0; this.brokenArmor = false; this.silence = false; this.slow = false; this.gross = false; this.tongued = false; this.kbGlove = false; this.kbBuff = false; this.starCloak = false; this.longInvince = false; this.pStone = false; this.manaFlower = false; this.crimsonRegen = false; this.ghostHeal = false; this.ghostHurt = false; this.turtleArmor = false; this.turtleThorns = false; this.spiderArmor = false; this.loveStruck = false; this.stinky = false; this.dryadWard = false; this.resistCold = false; this.electrified = false; this.moonLeech = false; this.headcovered = false; this.vortexDebuff = false; this.windPushed = false; this.ballistaPanic = false; this.setVortex = this.setNebula = this.setStardust = false; this.setForbidden = false; this.setHuntressT3 = false; this.setSquireT3 = false; this.setMonkT3 = false; this.setApprenticeT3 = false; this.setHuntressT2 = false; this.setSquireT2 = false; this.setMonkT2 = false; this.setApprenticeT2 = false; this.setForbiddenCooldownLocked = false; this.nebulaLevelDamage = this.nebulaLevelLife = this.nebulaLevelMana = 0; this.ignoreWater = false; this.meleeEnchant = (byte) 0; this.discount = false; this.coins = false; this.doubleJumpSail = false; this.doubleJumpSandstorm = false; this.doubleJumpBlizzard = false; this.doubleJumpFart = false; this.doubleJumpUnicorn = false; this.defendedByPaladin = false; this.hasPaladinShield = false; this.autoJump = false; this.justJumped = false; this.jumpSpeedBoost = 0.0f; this.extraFall = 0; if (this.phantasmTime > 0) --this.phantasmTime; if (this.wireOperationsCooldown > 0) --this.wireOperationsCooldown; if (this.releaseUseItem) this.ActuationRodLock = false; for (int index = 0; index < this.npcTypeNoAggro.Length; ++index) this.npcTypeNoAggro[index] = false; for (int index = 0; index < this.ownedProjectileCounts.Length; ++index) this.ownedProjectileCounts[index] = 0; if (this.whoAmI == Main.myPlayer) { Player.tileRangeX = 5; Player.tileRangeY = 4; } this.mount.CheckMountBuff(this); } public void UpdateImmunity() { if (this.immune) { --this.immuneTime; if (this.immuneTime <= 0) { this.immune = false; this.immuneNoBlink = false; } if (this.immuneNoBlink) { this.immuneAlpha = 0; } else { this.immuneAlpha += this.immuneAlphaDirection * 50; if (this.immuneAlpha <= 50) this.immuneAlphaDirection = 1; else if (this.immuneAlpha >= 205) this.immuneAlphaDirection = -1; } } else this.immuneAlpha = 0; for (int index = 0; index < this.hurtCooldowns.Length; ++index) { if (this.hurtCooldowns[index] > 0) --this.hurtCooldowns[index]; } } public void UpdateLifeRegen() { bool flag = false; if (this.shinyStone && (double) Math.Abs(this.velocity.X) < 0.05 && (double) Math.Abs(this.velocity.Y) < 0.05 && this.itemAnimation == 0) flag = true; if (this.poisoned) { if (this.lifeRegen > 0) this.lifeRegen = 0; this.lifeRegenTime = 0; this.lifeRegen -= 4; } if (this.venom) { if (this.lifeRegen > 0) this.lifeRegen = 0; this.lifeRegenTime = 0; this.lifeRegen -= 12; } if (this.onFire) { if (this.lifeRegen > 0) this.lifeRegen = 0; this.lifeRegenTime = 0; this.lifeRegen -= 8; } if (this.onFrostBurn) { if (this.lifeRegen > 0) this.lifeRegen = 0; this.lifeRegenTime = 0; this.lifeRegen -= 12; } if (this.onFire2) { if (this.lifeRegen > 0) this.lifeRegen = 0; this.lifeRegenTime = 0; this.lifeRegen -= 12; } if (this.burned) { if (this.lifeRegen > 0) this.lifeRegen = 0; this.lifeRegenTime = 0; this.lifeRegen -= 60; this.moveSpeed *= 0.5f; } if (this.suffocating) { if (this.lifeRegen > 0) this.lifeRegen = 0; this.lifeRegenTime = 0; this.lifeRegen -= 40; } if (this.electrified) { if (this.lifeRegen > 0) this.lifeRegen = 0; this.lifeRegenTime = 0; this.lifeRegen -= 8; if (this.controlLeft || this.controlRight) this.lifeRegen -= 32; } if (this.tongued && Main.expertMode) { if (this.lifeRegen > 0) this.lifeRegen = 0; this.lifeRegenTime = 0; this.lifeRegen -= 100; } if (this.honey && this.lifeRegen < 0) { this.lifeRegen += 4; if (this.lifeRegen > 0) this.lifeRegen = 0; } if (this.lifeRegen < 0 && this.nebulaLevelLife > 0) this.lifeRegen = 0; if (flag && this.lifeRegen < 0) this.lifeRegen /= 2; ++this.lifeRegenTime; if (this.crimsonRegen) ++this.lifeRegenTime; if (this.soulDrain > 0) this.lifeRegenTime += 2; if (flag) { if (this.lifeRegenTime > 90 && this.lifeRegenTime < 1800) this.lifeRegenTime = 1800; this.lifeRegenTime += 4; this.lifeRegen += 4; } if (this.honey) { this.lifeRegenTime += 2; this.lifeRegen += 2; } if (this.soulDrain > 0) { int num = (5 + this.soulDrain) / 2; this.lifeRegenTime += num; this.lifeRegen += num; } if (this.whoAmI == Main.myPlayer && Main.campfire) ++this.lifeRegen; if (this.whoAmI == Main.myPlayer && Main.heartLantern) this.lifeRegen += 2; if (this.bleed) this.lifeRegenTime = 0; float num1 = 0.0f; if (this.lifeRegenTime >= 300) ++num1; if (this.lifeRegenTime >= 600) ++num1; if (this.lifeRegenTime >= 900) ++num1; if (this.lifeRegenTime >= 1200) ++num1; if (this.lifeRegenTime >= 1500) ++num1; if (this.lifeRegenTime >= 1800) ++num1; if (this.lifeRegenTime >= 2400) ++num1; if (this.lifeRegenTime >= 3000) ++num1; if (flag) { float num2 = (float) (this.lifeRegenTime - 3000) / 300f; if ((double) num2 > 0.0) { if ((double) num2 > 30.0) num2 = 30f; num1 += num2; } } else if (this.lifeRegenTime >= 3600) { ++num1; this.lifeRegenTime = 3600; } float num3 = (double) this.velocity.X == 0.0 || this.grappling[0] > 0 ? num1 * 1.25f : num1 * 0.5f; if (this.crimsonRegen) num3 *= 1.5f; if (this.shinyStone) num3 *= 1.1f; if (this.whoAmI == Main.myPlayer && Main.campfire) num3 *= 1.1f; if (Main.expertMode && !this.wellFed) { if (this.shinyStone) num3 *= 0.75f; else num3 /= 2f; } if (this.rabid) { if (this.shinyStone) num3 *= 0.75f; else num3 /= 2f; } float num4 = (float) ((double) this.statLifeMax2 / 400.0 * 0.850000023841858 + 0.150000005960464); this.lifeRegen += (int) Math.Round((double) (num3 * num4)); this.lifeRegenCount += this.lifeRegen; if (this.palladiumRegen) this.lifeRegenCount += 6; if (flag && this.lifeRegen > 0 && this.statLife < this.statLifeMax2) { ++this.lifeRegenCount; if (flag && (Main.rand.Next(30000) < this.lifeRegenTime || Main.rand.Next(30) == 0)) { int index = Dust.NewDust(this.position, this.width, this.height, 55, Alpha: 200, Scale: 0.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.75f; Main.dust[index].fadeIn = 1.3f; Vector2 vector2_1 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101)); vector2_1.Normalize(); Vector2 vector2_2 = vector2_1 * ((float) Main.rand.Next(50, 100) * 0.04f); Main.dust[index].velocity = vector2_2; vector2_2.Normalize(); Vector2 vector2_3 = vector2_2 * 34f; Main.dust[index].position = this.Center - vector2_3; } } while (this.lifeRegenCount >= 120) { this.lifeRegenCount -= 120; if (this.statLife < this.statLifeMax2) { ++this.statLife; if (this.crimsonRegen) { for (int index1 = 0; index1 < 10; ++index1) { int index2 = Dust.NewDust(this.position, this.width, this.height, 5, Alpha: 175, Scale: 1.75f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 0.75f; int num5 = Main.rand.Next(-40, 41); int num6 = Main.rand.Next(-40, 41); Main.dust[index2].position.X += (float) num5; Main.dust[index2].position.Y += (float) num6; Main.dust[index2].velocity.X = (float) -num5 * 0.075f; Main.dust[index2].velocity.Y = (float) -num6 * 0.075f; } } } if (this.statLife > this.statLifeMax2) this.statLife = this.statLifeMax2; } if (this.burned || this.suffocating || this.tongued && Main.expertMode) { while (this.lifeRegenCount <= -600) { this.lifeRegenCount += 600; this.statLife -= 5; CombatText.NewText(new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), CombatText.LifeRegen, 5, dot: true); if (this.statLife <= 0 && this.whoAmI == Main.myPlayer) { if (this.suffocating) this.KillMe(PlayerDeathReason.ByOther(7), 10.0, 0); else this.KillMe(PlayerDeathReason.ByOther(8), 10.0, 0); } } } else { while (this.lifeRegenCount <= -120) { if (this.lifeRegenCount <= -480) { this.lifeRegenCount += 480; this.statLife -= 4; CombatText.NewText(new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), CombatText.LifeRegen, 4, dot: true); } else if (this.lifeRegenCount <= -360) { this.lifeRegenCount += 360; this.statLife -= 3; CombatText.NewText(new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), CombatText.LifeRegen, 3, dot: true); } else if (this.lifeRegenCount <= -240) { this.lifeRegenCount += 240; this.statLife -= 2; CombatText.NewText(new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), CombatText.LifeRegen, 2, dot: true); } else { this.lifeRegenCount += 120; --this.statLife; CombatText.NewText(new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), CombatText.LifeRegen, 1, dot: true); } if (this.statLife <= 0 && this.whoAmI == Main.myPlayer) { if (this.poisoned || this.venom) this.KillMe(PlayerDeathReason.ByOther(9), 10.0, 0); else if (this.electrified) this.KillMe(PlayerDeathReason.ByOther(10), 10.0, 0); else this.KillMe(PlayerDeathReason.ByOther(8), 10.0, 0); } } } } public void UpdateManaRegen() { if (this.nebulaLevelMana > 0) { int num = 6; this.nebulaManaCounter += this.nebulaLevelMana; if (this.nebulaManaCounter >= num) { this.nebulaManaCounter -= num; ++this.statMana; if (this.statMana >= this.statManaMax2) this.statMana = this.statManaMax2; } } else this.nebulaManaCounter = 0; if (this.manaRegenDelay > 0) { --this.manaRegenDelay; this.manaRegenDelay -= this.manaRegenDelayBonus; if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0 || this.grappling[0] >= 0 || this.manaRegenBuff) --this.manaRegenDelay; } if (this.manaRegenBuff && this.manaRegenDelay > 20) this.manaRegenDelay = 20; if (this.manaRegenDelay <= 0) { this.manaRegenDelay = 0; this.manaRegen = this.statManaMax2 / 7 + 1 + this.manaRegenBonus; if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0 || this.grappling[0] >= 0 || this.manaRegenBuff) this.manaRegen += this.statManaMax2 / 2; float num = (float) ((double) this.statMana / (double) this.statManaMax2 * 0.800000011920929 + 0.200000002980232); if (this.manaRegenBuff) num = 1f; this.manaRegen = (int) ((double) this.manaRegen * (double) num * 1.15); } else this.manaRegen = 0; this.manaRegenCount += this.manaRegen; while (this.manaRegenCount >= 120) { bool flag = false; this.manaRegenCount -= 120; if (this.statMana < this.statManaMax2) { ++this.statMana; flag = true; } if (this.statMana >= this.statManaMax2) { if (this.whoAmI == Main.myPlayer & flag) { Main.PlaySound(25); for (int index1 = 0; index1 < 5; ++index1) { int index2 = Dust.NewDust(this.position, this.width, this.height, 45, Alpha: ((int) byte.MaxValue), Scale: ((float) Main.rand.Next(20, 26) * 0.1f)); Main.dust[index2].noLight = true; Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 0.5f; } } this.statMana = this.statManaMax2; } } } public void UpdateJumpHeight() { if (this.mount.Active) { Player.jumpHeight = this.mount.JumpHeight(this.velocity.X); Player.jumpSpeed = this.mount.JumpSpeed(this.velocity.X); } else { if (this.jumpBoost) { Player.jumpHeight = 20; Player.jumpSpeed = 6.51f; } if (this.wereWolf) { Player.jumpHeight += 2; Player.jumpSpeed += 0.2f; } Player.jumpSpeed += this.jumpSpeedBoost; } if (this.sticky) { Player.jumpHeight /= 10; Player.jumpSpeed /= 5f; } if (!this.dazed) return; Player.jumpHeight /= 5; Player.jumpSpeed /= 2f; } public void FindPulley() { if (!this.controlUp && !this.controlDown) return; int index1 = (int) ((double) this.position.X + (double) (this.width / 2)) / 16; int index2 = (int) ((double) this.position.Y - 8.0) / 16; if (Main.tile[index1, index2] == null || !Main.tile[index1, index2].active() || !Main.tileRope[(int) Main.tile[index1, index2].type]) return; float num1 = this.position.Y; if (Main.tile[index1, index2 - 1] == null) Main.tile[index1, index2 - 1] = new Tile(); if (Main.tile[index1, index2 + 1] == null) Main.tile[index1, index2 + 1] = new Tile(); if ((!Main.tile[index1, index2 - 1].active() || !Main.tileRope[(int) Main.tile[index1, index2 - 1].type]) && (!Main.tile[index1, index2 + 1].active() || !Main.tileRope[(int) Main.tile[index1, index2 + 1].type])) num1 = (float) (index2 * 16 + 22); float x1 = (float) (index1 * 16 + 8 - this.width / 2 + 6 * this.direction); int num2 = index1 * 16 + 8 - this.width / 2 + 6; int num3 = index1 * 16 + 8 - this.width / 2; int num4 = index1 * 16 + 8 - this.width / 2 - 6; int num5 = 1; float num6 = Math.Abs(this.position.X - (float) num2); if ((double) Math.Abs(this.position.X - (float) num3) < (double) num6) { num5 = 2; num6 = Math.Abs(this.position.X - (float) num3); } if ((double) Math.Abs(this.position.X - (float) num4) < (double) num6) { num5 = 3; Math.Abs(this.position.X - (float) num4); } if (num5 == 1) { x1 = (float) num2; this.pulleyDir = (byte) 2; this.direction = 1; } if (num5 == 2) { x1 = (float) num3; this.pulleyDir = (byte) 1; } if (num5 == 3) { x1 = (float) num4; this.pulleyDir = (byte) 2; this.direction = -1; } if (!Collision.SolidCollision(new Vector2(x1, this.position.Y), this.width, this.height)) { if (this.whoAmI == Main.myPlayer) Main.cameraX = Main.cameraX + this.position.X - x1; this.pulley = true; this.position.X = x1; this.gfxOffY = this.position.Y - num1; this.stepSpeed = 2.5f; this.position.Y = num1; this.velocity.X = 0.0f; } else { float x2 = (float) num2; this.pulleyDir = (byte) 2; this.direction = 1; if (!Collision.SolidCollision(new Vector2(x2, this.position.Y), this.width, this.height)) { if (this.whoAmI == Main.myPlayer) Main.cameraX = Main.cameraX + this.position.X - x2; this.pulley = true; this.position.X = x2; this.gfxOffY = this.position.Y - num1; this.stepSpeed = 2.5f; this.position.Y = num1; this.velocity.X = 0.0f; } else { float x3 = (float) num4; this.pulleyDir = (byte) 2; this.direction = -1; if (Collision.SolidCollision(new Vector2(x3, this.position.Y), this.width, this.height)) return; if (this.whoAmI == Main.myPlayer) Main.cameraX = Main.cameraX + this.position.X - x3; this.pulley = true; this.position.X = x3; this.gfxOffY = this.position.Y - num1; this.stepSpeed = 2.5f; this.position.Y = num1; this.velocity.X = 0.0f; } } } public void HorizontalMovement() { if (this.chilled) this.accRunSpeed = this.maxRunSpeed; bool flag1 = (this.itemAnimation == 0 || this.inventory[this.selectedItem].useTurn) && this.mount.AllowDirectionChange; bool flag2 = this.controlLeft || this.controlRight; float num1 = (float) (((double) this.accRunSpeed + (double) this.maxRunSpeed) / 2.0); float num2 = 0.0f; bool flag3 = false; if (this.windPushed && ((!this.mount.Active ? 0 : ((double) this.velocity.Y == 0.0 ? 1 : 0)) & (flag2 ? 1 : 0)) == 0) { num2 = (float) Math.Sign(Main.windSpeed) * 0.07f; if ((double) Math.Abs(Main.windSpeed) > 0.5) num2 *= 1.37f; if ((double) this.velocity.Y != 0.0) num2 *= 1.5f; if (flag2) num2 *= 0.8f; flag3 = true; if (Math.Sign(this.direction) != Math.Sign(num2)) num1 -= Math.Abs(num2) * 40f; } if ((double) this.trackBoost != 0.0) { this.velocity.X += this.trackBoost; this.trackBoost = 0.0f; if ((double) this.velocity.X < 0.0) { if ((double) this.velocity.X < -(double) this.maxRunSpeed) this.velocity.X = -this.maxRunSpeed; } else if ((double) this.velocity.X > (double) this.maxRunSpeed) this.velocity.X = this.maxRunSpeed; } if (this.controlLeft && (double) this.velocity.X > -(double) this.maxRunSpeed) { if (!this.mount.Active || !this.mount.Cart || (double) this.velocity.Y == 0.0) { if ((double) this.velocity.X > (double) this.runSlowdown) this.velocity.X -= this.runSlowdown; this.velocity.X -= this.runAcceleration; } if (this.onWrongGround) { if ((double) this.velocity.X < -(double) this.runSlowdown) this.velocity.X += this.runSlowdown; else this.velocity.X = 0.0f; } if (this.mount.Active && this.mount.Cart && !this.onWrongGround) { if ((double) this.velocity.X < 0.0 & flag1) this.direction = -1; else if (this.itemAnimation <= 0 && (double) this.velocity.Y == 0.0) { Main.PlaySound(SoundID.Item55, (int) this.position.X + this.width / 2, (int) this.position.Y + this.height / 2); DelegateMethods.Minecart.rotation = this.fullRotation; DelegateMethods.Minecart.rotationOrigin = this.fullRotationOrigin; if ((double) Math.Abs(this.velocity.X) > (double) this.maxRunSpeed * 0.66) { if (Main.rand.Next(2) == 0) Minecart.WheelSparks(this.mount.MinecartDust, this.position + this.velocity * 0.66f, this.width, this.height, 1); if (Main.rand.Next(2) == 0) Minecart.WheelSparks(this.mount.MinecartDust, this.position + this.velocity * 0.33f, this.width, this.height, 1); if (Main.rand.Next(2) == 0) Minecart.WheelSparks(this.mount.MinecartDust, this.position, this.width, this.height, 1); } else if ((double) Math.Abs(this.velocity.X) > (double) this.maxRunSpeed * 0.33) { if (Main.rand.Next(3) != 0) Minecart.WheelSparks(this.mount.MinecartDust, this.position + this.velocity * 0.5f, this.width, this.height, 1); if (Main.rand.Next(3) != 0) Minecart.WheelSparks(this.mount.MinecartDust, this.position, this.width, this.height, 1); } else Minecart.WheelSparks(this.mount.MinecartDust, this.position, this.width, this.height, 1); } } else if (!this.sandStorm && (this.itemAnimation == 0 || this.inventory[this.selectedItem].useTurn) && this.mount.AllowDirectionChange) this.direction = -1; } else if (this.controlRight && (double) this.velocity.X < (double) this.maxRunSpeed) { if (!this.mount.Active || !this.mount.Cart || (double) this.velocity.Y == 0.0) { if ((double) this.velocity.X < -(double) this.runSlowdown) this.velocity.X += this.runSlowdown; this.velocity.X += this.runAcceleration; } if (this.onWrongGround) { if ((double) this.velocity.X > (double) this.runSlowdown) this.velocity.X -= this.runSlowdown; else this.velocity.X = 0.0f; } if (this.mount.Active && this.mount.Cart && !this.onWrongGround) { if ((double) this.velocity.X > 0.0 & flag1) this.direction = 1; else if (this.itemAnimation <= 0 && (double) this.velocity.Y == 0.0) { Main.PlaySound(SoundID.Item55, (int) this.position.X + this.width / 2, (int) this.position.Y + this.height / 2); DelegateMethods.Minecart.rotation = this.fullRotation; DelegateMethods.Minecart.rotationOrigin = this.fullRotationOrigin; if ((double) Math.Abs(this.velocity.X) > (double) this.maxRunSpeed * 0.66) { if (Main.rand.Next(2) == 0) Minecart.WheelSparks(this.mount.MinecartDust, this.position + this.velocity * 0.66f, this.width, this.height, 1); if (Main.rand.Next(2) == 0) Minecart.WheelSparks(this.mount.MinecartDust, this.position + this.velocity * 0.33f, this.width, this.height, 1); if (Main.rand.Next(2) == 0) Minecart.WheelSparks(this.mount.MinecartDust, this.position, this.width, this.height, 1); } else if ((double) Math.Abs(this.velocity.X) > (double) this.maxRunSpeed * 0.33) { if (Main.rand.Next(3) != 0) Minecart.WheelSparks(this.mount.MinecartDust, this.position + this.velocity * 0.5f, this.width, this.height, 1); if (Main.rand.Next(3) != 0) Minecart.WheelSparks(this.mount.MinecartDust, this.position, this.width, this.height, 1); } else Minecart.WheelSparks(this.mount.MinecartDust, this.position, this.width, this.height, 1); } } else if (!this.sandStorm && (this.itemAnimation == 0 || this.inventory[this.selectedItem].useTurn) && this.mount.AllowDirectionChange) this.direction = 1; } else if (this.controlLeft && (double) this.velocity.X > -(double) this.accRunSpeed && this.dashDelay >= 0) { if (this.mount.Active && this.mount.Cart) { if ((double) this.velocity.X < 0.0) this.direction = -1; } else if ((this.itemAnimation == 0 || this.inventory[this.selectedItem].useTurn) && this.mount.AllowDirectionChange) this.direction = -1; if ((double) this.velocity.Y == 0.0 || this.wingsLogic > 0 || this.mount.CanFly) { if ((double) this.velocity.X > (double) this.runSlowdown) this.velocity.X -= this.runSlowdown; this.velocity.X -= this.runAcceleration * 0.2f; if (this.wingsLogic > 0) this.velocity.X -= this.runAcceleration * 0.2f; } if (this.onWrongGround) { if ((double) this.velocity.X < (double) this.runSlowdown) this.velocity.X += this.runSlowdown; else this.velocity.X = 0.0f; } if ((double) this.velocity.X < -(double) num1 && (double) this.velocity.Y == 0.0 && !this.mount.Active) { int num3 = 0; if ((double) this.gravDir == -1.0) num3 -= this.height; if (this.runSoundDelay == 0 && (double) this.velocity.Y == 0.0) { Main.PlaySound(this.hermesStepSound.SoundType, (int) this.position.X, (int) this.position.Y, this.hermesStepSound.SoundStyle); this.runSoundDelay = this.hermesStepSound.IntendedCooldown; } if (this.wings == 3) { int index1 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float) this.height + (float) num3), this.width + 8, 4, 186, (float) (-(double) this.velocity.X * 0.5), this.velocity.Y * 0.5f, 50, Scale: 1.5f); Main.dust[index1].velocity *= 0.025f; Main.dust[index1].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); int index2 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float) this.height + (float) num3), this.width + 8, 4, 186, (float) (-(double) this.velocity.X * 0.5), this.velocity.Y * 0.5f, 50, Scale: 1.5f); Main.dust[index2].velocity *= 0.2f; Main.dust[index2].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } else if (this.sailDash) { for (int index3 = 0; index3 < 4; ++index3) { int index4 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y), this.width + 8, this.height, 253, (float) (-(double) this.velocity.X * 0.5), this.velocity.Y * 0.5f, 100, Scale: 1.5f); Main.dust[index4].noGravity = true; Main.dust[index4].velocity.X *= 0.2f; Main.dust[index4].velocity.Y *= 0.2f; Main.dust[index4].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this); Main.dust[index4].scale += (float) Main.rand.Next(-5, 3) * 0.1f; Vector2 vector2 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101)); vector2.Normalize(); vector2 *= (float) Main.rand.Next(81) * 0.1f; } } else if (this.coldDash) { for (int index5 = 0; index5 < 2; ++index5) { int index6 = index5 != 0 ? Dust.NewDust(new Vector2(this.position.X + (float) (this.width / 2), this.position.Y + (float) this.height + this.gfxOffY), this.width / 2, 6, 76, Scale: 1.35f) : Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float) this.height + this.gfxOffY), this.width / 2, 6, 76, Scale: 1.35f); Main.dust[index6].scale *= (float) (1.0 + (double) Main.rand.Next(20, 40) * 0.00999999977648258); Main.dust[index6].noGravity = true; Main.dust[index6].noLight = true; Main.dust[index6].velocity *= 1f / 1000f; Main.dust[index6].velocity.Y -= 3f / 1000f; Main.dust[index6].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this); } } else { int index = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float) this.height + (float) num3), this.width + 8, 4, 16, (float) (-(double) this.velocity.X * 0.5), this.velocity.Y * 0.5f, 50, Scale: 1.5f); Main.dust[index].velocity.X *= 0.2f; Main.dust[index].velocity.Y *= 0.2f; Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this); } } } else if (this.controlRight && (double) this.velocity.X < (double) this.accRunSpeed && this.dashDelay >= 0) { if (this.mount.Active && this.mount.Cart) { if ((double) this.velocity.X > 0.0) this.direction = -1; } else if ((this.itemAnimation == 0 || this.inventory[this.selectedItem].useTurn) && this.mount.AllowDirectionChange) this.direction = 1; if ((double) this.velocity.Y == 0.0 || this.wingsLogic > 0 || this.mount.CanFly) { if ((double) this.velocity.X < -(double) this.runSlowdown) this.velocity.X += this.runSlowdown; this.velocity.X += this.runAcceleration * 0.2f; if (this.wingsLogic > 0) this.velocity.X += this.runAcceleration * 0.2f; } if (this.onWrongGround) { if ((double) this.velocity.X > (double) this.runSlowdown) this.velocity.X -= this.runSlowdown; else this.velocity.X = 0.0f; } if ((double) this.velocity.X > (double) num1 && (double) this.velocity.Y == 0.0 && !this.mount.Active) { int num4 = 0; if ((double) this.gravDir == -1.0) num4 -= this.height; if (this.runSoundDelay == 0 && (double) this.velocity.Y == 0.0) { Main.PlaySound(this.hermesStepSound.SoundType, (int) this.position.X, (int) this.position.Y, this.hermesStepSound.SoundStyle); this.runSoundDelay = this.hermesStepSound.IntendedCooldown; } if (this.wings == 3) { int index7 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float) this.height + (float) num4), this.width + 8, 4, 186, (float) (-(double) this.velocity.X * 0.5), this.velocity.Y * 0.5f, 50, Scale: 1.5f); Main.dust[index7].velocity *= 0.025f; Main.dust[index7].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); int index8 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float) this.height + (float) num4), this.width + 8, 4, 186, (float) (-(double) this.velocity.X * 0.5), this.velocity.Y * 0.5f, 50, Scale: 1.5f); Main.dust[index8].velocity *= 0.2f; Main.dust[index8].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } else if (this.sailDash) { for (int index9 = 0; index9 < 4; ++index9) { int index10 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y), this.width + 8, this.height, 253, (float) (-(double) this.velocity.X * 0.5), this.velocity.Y * 0.5f, 100, Scale: 1.5f); Main.dust[index10].noGravity = true; Main.dust[index10].velocity.X *= 0.2f; Main.dust[index10].velocity.Y *= 0.2f; Main.dust[index10].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this); Main.dust[index10].scale += (float) Main.rand.Next(-5, 3) * 0.1f; Vector2 vector2 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101)); vector2.Normalize(); vector2 *= (float) Main.rand.Next(81) * 0.1f; } } else if (this.coldDash) { for (int index11 = 0; index11 < 2; ++index11) { int index12 = index11 != 0 ? Dust.NewDust(new Vector2(this.position.X + (float) (this.width / 2), this.position.Y + (float) this.height + this.gfxOffY), this.width / 2, 6, 76, Scale: 1.35f) : Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float) this.height + this.gfxOffY), this.width / 2, 6, 76, Scale: 1.35f); Main.dust[index12].scale *= (float) (1.0 + (double) Main.rand.Next(20, 40) * 0.00999999977648258); Main.dust[index12].noGravity = true; Main.dust[index12].noLight = true; Main.dust[index12].velocity *= 1f / 1000f; Main.dust[index12].velocity.Y -= 3f / 1000f; Main.dust[index12].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this); } } else { int index = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float) this.height + (float) num4), this.width + 8, 4, 16, (float) (-(double) this.velocity.X * 0.5), this.velocity.Y * 0.5f, 50, Scale: 1.5f); Main.dust[index].velocity.X *= 0.2f; Main.dust[index].velocity.Y *= 0.2f; Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this); } } } else if (this.mount.Active && this.mount.Cart && (double) Math.Abs(this.velocity.X) >= 1.0) { if (this.onWrongGround) { if ((double) this.velocity.X > 0.0) { if ((double) this.velocity.X > (double) this.runSlowdown) this.velocity.X -= this.runSlowdown; else this.velocity.X = 0.0f; } else if ((double) this.velocity.X < 0.0) { if ((double) this.velocity.X < -(double) this.runSlowdown) this.velocity.X += this.runSlowdown; else this.velocity.X = 0.0f; } } if ((double) this.velocity.X > (double) this.maxRunSpeed) this.velocity.X = this.maxRunSpeed; if ((double) this.velocity.X < -(double) this.maxRunSpeed) this.velocity.X = -this.maxRunSpeed; } else if ((double) this.velocity.Y == 0.0) { if ((double) this.velocity.X > (double) this.runSlowdown) this.velocity.X -= this.runSlowdown; else if ((double) this.velocity.X < -(double) this.runSlowdown) this.velocity.X += this.runSlowdown; else this.velocity.X = 0.0f; } else if (!this.PortalPhysicsEnabled) { if ((double) this.velocity.X > (double) this.runSlowdown * 0.5) this.velocity.X -= this.runSlowdown * 0.5f; else if ((double) this.velocity.X < -(double) this.runSlowdown * 0.5) this.velocity.X += this.runSlowdown * 0.5f; else this.velocity.X = 0.0f; } if (flag3) { if ((double) num2 < 0.0 && (double) this.velocity.X > (double) num2) { this.velocity.X += num2; if ((double) this.velocity.X < (double) num2) this.velocity.X = num2; } if ((double) num2 > 0.0 && (double) this.velocity.X < (double) num2) { this.velocity.X += num2; if ((double) this.velocity.X > (double) num2) this.velocity.X = num2; } } if (this.mount.Active && this.mount.Type == 10 && (double) Math.Abs(this.velocity.X) > (double) this.mount.DashSpeed - (double) this.mount.RunSpeed / 2.0) { Microsoft.Xna.Framework.Rectangle rect = this.getRect(); if (this.direction == 1) rect.Offset(this.width - 1, 0); rect.Width = 2; rect.Inflate(6, 12); float Damage = 80f * this.minionDamage; float Knockback = 10f; int NPCImmuneTime = 30; int PlayerImmuneTime = 6; this.CollideWithNPCs(rect, Damage, Knockback, NPCImmuneTime, PlayerImmuneTime); } if (!this.mount.Active || this.mount.Type != 14 || (double) Math.Abs(this.velocity.X) <= (double) this.mount.RunSpeed / 2.0) return; Microsoft.Xna.Framework.Rectangle rect1 = this.getRect(); if (this.direction == 1) rect1.Offset(this.width - 1, 0); rect1.Width = 2; rect1.Inflate(6, 12); float Damage1 = 90f * this.minionDamage; float Knockback1 = 10f; int NPCImmuneTime1 = 30; int PlayerImmuneTime1 = 6; this.CollideWithNPCs(rect1, Damage1, Knockback1, NPCImmuneTime1, PlayerImmuneTime1); } private int CollideWithNPCs( Microsoft.Xna.Framework.Rectangle myRect, float Damage, float Knockback, int NPCImmuneTime, int PlayerImmuneTime) { int num = 0; for (int index = 0; index < 200; ++index) { NPC npc = Main.npc[index]; if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[this.whoAmI] == 0) { Microsoft.Xna.Framework.Rectangle rect = npc.getRect(); if (myRect.Intersects(rect) && (npc.noTileCollide || Collision.CanHit(this.position, this.width, this.height, npc.position, npc.width, npc.height))) { int direction = this.direction; if ((double) this.velocity.X < 0.0) direction = -1; if ((double) this.velocity.X > 0.0) direction = 1; if (this.whoAmI == Main.myPlayer) this.ApplyDamageToNPC(npc, (int) Damage, Knockback, direction, false); npc.immune[this.whoAmI] = NPCImmuneTime; this.immune = true; this.immuneNoBlink = true; this.immuneTime = PlayerImmuneTime; ++num; break; } } } return num; } public void ApplyDamageToNPC(NPC npc, int damage, float knockback, int direction, bool crit) { npc.StrikeNPC(damage, knockback, direction, crit); if (Main.netMode != 0) NetMessage.SendData(28, number: npc.whoAmI, number2: ((float) damage), number3: knockback, number4: ((float) direction), number5: crit.ToInt()); int num = Item.NPCtoBanner(npc.BannerID()); if (num < 0) return; this.lastCreatureHit = num; } public bool SlimeDontHyperJump => this.mount.Active && this.mount.Type == 3 && this.wetSlime > (byte) 0 && !this.controlJump; public void JumpMovement() { if (this.mount.Active && this.mount.Type == 3 && this.wetSlime == (byte) 0 && (double) this.velocity.Y > 0.0) { Microsoft.Xna.Framework.Rectangle rect1 = this.getRect(); rect1.Offset(0, this.height - 1); rect1.Height = 2; rect1.Inflate(12, 6); for (int index = 0; index < 200; ++index) { NPC npc = Main.npc[index]; if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[this.whoAmI] == 0) { Microsoft.Xna.Framework.Rectangle rect2 = npc.getRect(); if (rect1.Intersects(rect2) && (npc.noTileCollide || Collision.CanHit(this.position, this.width, this.height, npc.position, npc.width, npc.height))) { float num = 40f * this.minionDamage; float knockback = 5f; int direction = this.direction; if ((double) this.velocity.X < 0.0) direction = -1; if ((double) this.velocity.X > 0.0) direction = 1; if (this.whoAmI == Main.myPlayer) this.ApplyDamageToNPC(npc, (int) num, knockback, direction, false); npc.immune[this.whoAmI] = 10; this.velocity.Y = -10f; this.immune = true; this.immuneNoBlink = true; this.immuneTime = 6; break; } } } } if (this.controlJump) { bool flag1 = false; if (this.mount.Active && this.mount.Type == 3 && this.wetSlime > (byte) 0) flag1 = true; if (this.jump > 0) { if ((double) this.velocity.Y == 0.0) { this.jump = 0; } else { this.velocity.Y = -Player.jumpSpeed * this.gravDir; if (this.merman && (!this.mount.Active || !this.mount.Cart)) { if (this.swimTime <= 10) this.swimTime = 30; } else --this.jump; } } else if ((((this.sliding ? 1 : ((double) this.velocity.Y == 0.0 ? 1 : 0)) | (flag1 ? 1 : 0)) != 0 || this.jumpAgainCloud || this.jumpAgainSandstorm || this.jumpAgainBlizzard || this.jumpAgainFart || this.jumpAgainSail || this.jumpAgainUnicorn || this.wet && this.accFlipper && (!this.mount.Active || !this.mount.Cart)) && (this.releaseJump || this.autoJump && ((double) this.velocity.Y == 0.0 || this.sliding))) { if (this.sliding || (double) this.velocity.Y == 0.0) this.justJumped = true; bool flag2 = false; if (this.wet && this.accFlipper) { if (this.swimTime == 0) this.swimTime = 30; flag2 = true; } bool flag3 = false; bool flag4 = false; bool flag5 = false; bool flag6 = false; bool flag7 = false; if (!flag1) { if (this.jumpAgainUnicorn) { flag7 = true; this.jumpAgainUnicorn = false; } else if (this.jumpAgainSandstorm) { flag3 = true; this.jumpAgainSandstorm = false; } else if (this.jumpAgainBlizzard) { flag4 = true; this.jumpAgainBlizzard = false; } else if (this.jumpAgainFart) { this.jumpAgainFart = false; flag5 = true; } else if (this.jumpAgainSail) { this.jumpAgainSail = false; flag6 = true; } else this.jumpAgainCloud = false; } this.canRocket = false; this.rocketRelease = false; if (((double) this.velocity.Y == 0.0 || this.sliding || this.autoJump && this.justJumped) && this.doubleJumpCloud) this.jumpAgainCloud = true; if (((double) this.velocity.Y == 0.0 || this.sliding || this.autoJump && this.justJumped) && this.doubleJumpSandstorm) this.jumpAgainSandstorm = true; if (((double) this.velocity.Y == 0.0 || this.sliding || this.autoJump && this.justJumped) && this.doubleJumpBlizzard) this.jumpAgainBlizzard = true; if (((double) this.velocity.Y == 0.0 || this.sliding || this.autoJump && this.justJumped) && this.doubleJumpFart) this.jumpAgainFart = true; if (((double) this.velocity.Y == 0.0 || this.sliding || this.autoJump && this.justJumped) && this.doubleJumpSail) this.jumpAgainSail = true; if (((double) this.velocity.Y == 0.0 || this.sliding || this.autoJump && this.justJumped) && this.doubleJumpUnicorn) this.jumpAgainUnicorn = true; if ((((double) this.velocity.Y == 0.0 | flag2 ? 1 : (this.sliding ? 1 : 0)) | (flag1 ? 1 : 0)) != 0) { this.velocity.Y = -Player.jumpSpeed * this.gravDir; this.jump = Player.jumpHeight; if (this.sliding) this.velocity.X = (float) (3 * -this.slideDir); } else if (flag3) { this.dJumpEffectSandstorm = true; int height = this.height; double gravDir = (double) this.gravDir; Main.PlaySound(16, (int) this.position.X, (int) this.position.Y); this.velocity.Y = -Player.jumpSpeed * this.gravDir; this.jump = Player.jumpHeight * 3; } else if (flag4) { this.dJumpEffectBlizzard = true; int height = this.height; double gravDir = (double) this.gravDir; Main.PlaySound(16, (int) this.position.X, (int) this.position.Y); this.velocity.Y = -Player.jumpSpeed * this.gravDir; this.jump = (int) ((double) Player.jumpHeight * 1.5); } else if (flag6) { this.dJumpEffectSail = true; int num = this.height; if ((double) this.gravDir == -1.0) num = 0; Main.PlaySound(16, (int) this.position.X, (int) this.position.Y); this.velocity.Y = -Player.jumpSpeed * this.gravDir; this.jump = (int) ((double) Player.jumpHeight * 1.25); for (int index1 = 0; index1 < 30; ++index1) { int index2 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float) num), this.width, 12, 253, this.velocity.X * 0.3f, this.velocity.Y * 0.3f, 100, Scale: 1.5f); if (index1 % 2 == 0) Main.dust[index2].velocity.X += (float) Main.rand.Next(30, 71) * 0.1f; else Main.dust[index2].velocity.X -= (float) Main.rand.Next(30, 71) * 0.1f; Main.dust[index2].velocity.Y += (float) Main.rand.Next(-10, 31) * 0.1f; Main.dust[index2].noGravity = true; Main.dust[index2].scale += (float) Main.rand.Next(-10, 41) * 0.01f; Main.dust[index2].velocity *= Main.dust[index2].scale * 0.7f; Vector2 vector2 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101)); vector2.Normalize(); vector2 *= (float) Main.rand.Next(81) * 0.1f; } } else if (flag5) { this.dJumpEffectFart = true; int num = this.height; if ((double) this.gravDir == -1.0) num = 0; Main.PlaySound(SoundID.Item16, this.position); this.velocity.Y = -Player.jumpSpeed * this.gravDir; this.jump = Player.jumpHeight * 2; for (int index3 = 0; index3 < 10; ++index3) { int index4 = Dust.NewDust(new Vector2(this.position.X - 34f, (float) ((double) this.position.Y + (double) num - 16.0)), 102, 32, 188, (float) (-(double) this.velocity.X * 0.5), this.velocity.Y * 0.5f, 100, Scale: 1.5f); Main.dust[index4].velocity.X = (float) ((double) Main.dust[index4].velocity.X * 0.5 - (double) this.velocity.X * 0.100000001490116); Main.dust[index4].velocity.Y = (float) ((double) Main.dust[index4].velocity.Y * 0.5 - (double) this.velocity.Y * 0.300000011920929); } int index5 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 16.0), (float) ((double) this.position.Y + (double) num - 16.0)), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(435, 438)); Main.gore[index5].velocity.X = (float) ((double) Main.gore[index5].velocity.X * 0.100000001490116 - (double) this.velocity.X * 0.100000001490116); Main.gore[index5].velocity.Y = (float) ((double) Main.gore[index5].velocity.Y * 0.100000001490116 - (double) this.velocity.Y * 0.0500000007450581); int index6 = Gore.NewGore(new Vector2(this.position.X - 36f, (float) ((double) this.position.Y + (double) num - 16.0)), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(435, 438)); Main.gore[index6].velocity.X = (float) ((double) Main.gore[index6].velocity.X * 0.100000001490116 - (double) this.velocity.X * 0.100000001490116); Main.gore[index6].velocity.Y = (float) ((double) Main.gore[index6].velocity.Y * 0.100000001490116 - (double) this.velocity.Y * 0.0500000007450581); int index7 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) this.width + 4.0), (float) ((double) this.position.Y + (double) num - 16.0)), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(435, 438)); Main.gore[index7].velocity.X = (float) ((double) Main.gore[index7].velocity.X * 0.100000001490116 - (double) this.velocity.X * 0.100000001490116); Main.gore[index7].velocity.Y = (float) ((double) Main.gore[index7].velocity.Y * 0.100000001490116 - (double) this.velocity.Y * 0.0500000007450581); } else if (flag7) { this.dJumpEffectUnicorn = true; int height = this.height; double gravDir = (double) this.gravDir; Main.PlaySound(16, (int) this.position.X, (int) this.position.Y); this.velocity.Y = -Player.jumpSpeed * this.gravDir; this.jump = Player.jumpHeight * 2; Vector2 center = this.Center; Vector2 vector2_1 = new Vector2(50f, 20f); float num1 = 6.283185f * Main.rand.NextFloat(); for (int index = 0; index < 5; ++index) { for (float num2 = 0.0f; (double) num2 < 14.0; ++num2) { Dust dust = Main.dust[Dust.NewDust(center, 0, 0, Utils.SelectRandom(Main.rand, 176, 177, 179))]; Vector2 vector2_2 = Vector2.UnitY.RotatedBy((double) num2 * 6.28318548202515 / 14.0 + (double) num1) * (0.2f * (float) index); dust.position = center + vector2_2 * vector2_1; dust.velocity = vector2_2 + new Vector2(0.0f, this.gravDir * 4f); dust.noGravity = true; dust.scale = (float) (1.0 + (double) Main.rand.NextFloat() * 0.800000011920929); dust.fadeIn = Main.rand.NextFloat() * 2f; dust.shader = GameShaders.Armor.GetSecondaryShader(this.cMount, this); } } } else { this.dJumpEffectCloud = true; int num = this.height; if ((double) this.gravDir == -1.0) num = 0; Main.PlaySound(16, (int) this.position.X, (int) this.position.Y); this.velocity.Y = -Player.jumpSpeed * this.gravDir; this.jump = (int) ((double) Player.jumpHeight * 0.75); for (int index8 = 0; index8 < 10; ++index8) { int index9 = Dust.NewDust(new Vector2(this.position.X - 34f, (float) ((double) this.position.Y + (double) num - 16.0)), 102, 32, 16, (float) (-(double) this.velocity.X * 0.5), this.velocity.Y * 0.5f, 100, Scale: 1.5f); Main.dust[index9].velocity.X = (float) ((double) Main.dust[index9].velocity.X * 0.5 - (double) this.velocity.X * 0.100000001490116); Main.dust[index9].velocity.Y = (float) ((double) Main.dust[index9].velocity.Y * 0.5 - (double) this.velocity.Y * 0.300000011920929); } int index10 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 16.0), (float) ((double) this.position.Y + (double) num - 16.0)), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(11, 14)); Main.gore[index10].velocity.X = (float) ((double) Main.gore[index10].velocity.X * 0.100000001490116 - (double) this.velocity.X * 0.100000001490116); Main.gore[index10].velocity.Y = (float) ((double) Main.gore[index10].velocity.Y * 0.100000001490116 - (double) this.velocity.Y * 0.0500000007450581); int index11 = Gore.NewGore(new Vector2(this.position.X - 36f, (float) ((double) this.position.Y + (double) num - 16.0)), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(11, 14)); Main.gore[index11].velocity.X = (float) ((double) Main.gore[index11].velocity.X * 0.100000001490116 - (double) this.velocity.X * 0.100000001490116); Main.gore[index11].velocity.Y = (float) ((double) Main.gore[index11].velocity.Y * 0.100000001490116 - (double) this.velocity.Y * 0.0500000007450581); int index12 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) this.width + 4.0), (float) ((double) this.position.Y + (double) num - 16.0)), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(11, 14)); Main.gore[index12].velocity.X = (float) ((double) Main.gore[index12].velocity.X * 0.100000001490116 - (double) this.velocity.X * 0.100000001490116); Main.gore[index12].velocity.Y = (float) ((double) Main.gore[index12].velocity.Y * 0.100000001490116 - (double) this.velocity.Y * 0.0500000007450581); } } this.releaseJump = false; } else { this.jump = 0; this.releaseJump = true; this.rocketRelease = true; } } public void DashMovement() { if (this.dash == 2 && this.eocDash > 0) { if (this.eocHit < 0) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) ((double) this.position.X + (double) this.velocity.X * 0.5 - 4.0), (int) ((double) this.position.Y + (double) this.velocity.Y * 0.5 - 4.0), this.width + 8, this.height + 8); for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && !Main.npc[index].dontTakeDamage && !Main.npc[index].friendly) { NPC npc = Main.npc[index]; Microsoft.Xna.Framework.Rectangle rect = npc.getRect(); if (rectangle.Intersects(rect) && (npc.noTileCollide || this.CanHit((Entity) npc))) { float num = 30f * this.meleeDamage; float knockback = 9f; bool crit = false; if (this.kbGlove) knockback *= 2f; if (this.kbBuff) knockback *= 1.5f; if (Main.rand.Next(100) < this.meleeCrit) crit = true; int direction = this.direction; if ((double) this.velocity.X < 0.0) direction = -1; if ((double) this.velocity.X > 0.0) direction = 1; if (this.whoAmI == Main.myPlayer) this.ApplyDamageToNPC(npc, (int) num, knockback, direction, crit); this.eocDash = 10; this.dashDelay = 30; this.velocity.X = (float) (-direction * 9); this.velocity.Y = -4f; this.immune = true; this.immuneNoBlink = true; this.immuneTime = 4; this.eocHit = index; } } } } else if ((!this.controlLeft || (double) this.velocity.X >= 0.0) && (!this.controlRight || (double) this.velocity.X <= 0.0)) this.velocity.X *= 0.95f; } if (this.dash == 3 && this.dashDelay < 0 && this.whoAmI == Main.myPlayer) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) ((double) this.position.X + (double) this.velocity.X * 0.5 - 4.0), (int) ((double) this.position.Y + (double) this.velocity.Y * 0.5 - 4.0), this.width + 8, this.height + 8); for (int index1 = 0; index1 < 200; ++index1) { if (Main.npc[index1].active && !Main.npc[index1].dontTakeDamage && !Main.npc[index1].friendly && Main.npc[index1].immune[this.whoAmI] <= 0) { NPC npc = Main.npc[index1]; Microsoft.Xna.Framework.Rectangle rect = npc.getRect(); if (rectangle.Intersects(rect) && (npc.noTileCollide || this.CanHit((Entity) npc))) { if (!this.solarDashConsumedFlare) { this.solarDashConsumedFlare = true; this.ConsumeSolarFlare(); } float num = 150f * this.meleeDamage; float knockback = 9f; bool crit = false; if (this.kbGlove) knockback *= 2f; if (this.kbBuff) knockback *= 1.5f; if (Main.rand.Next(100) < this.meleeCrit) crit = true; int direction = this.direction; if ((double) this.velocity.X < 0.0) direction = -1; if ((double) this.velocity.X > 0.0) direction = 1; if (this.whoAmI == Main.myPlayer) { this.ApplyDamageToNPC(npc, (int) num, knockback, direction, crit); int index2 = Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 608, 150, 15f, Main.myPlayer); Main.projectile[index2].Kill(); } npc.immune[this.whoAmI] = 6; this.immune = true; this.immuneNoBlink = true; this.immuneTime = 4; } } } } if (this.dashDelay > 0) { if (this.eocDash > 0) --this.eocDash; if (this.eocDash == 0) this.eocHit = -1; --this.dashDelay; } else if (this.dashDelay < 0) { float num1 = 12f; float num2 = 0.992f; float num3 = Math.Max(this.accRunSpeed, this.maxRunSpeed); float num4 = 0.96f; int num5 = 20; if (this.dash == 1) { for (int index3 = 0; index3 < 2; ++index3) { int index4 = (double) this.velocity.Y != 0.0 ? Dust.NewDust(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0)), this.width, 16, 31, Alpha: 100, Scale: 1.4f) : Dust.NewDust(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) this.height - 4.0)), this.width, 8, 31, Alpha: 100, Scale: 1.4f); Main.dust[index4].velocity *= 0.1f; Main.dust[index4].scale *= (float) (1.0 + (double) Main.rand.Next(20) * 0.00999999977648258); Main.dust[index4].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this); } } else if (this.dash == 2) { for (int index5 = 0; index5 < 0; ++index5) { int index6 = (double) this.velocity.Y != 0.0 ? Dust.NewDust(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0)), this.width, 16, 31, Alpha: 100, Scale: 1.4f) : Dust.NewDust(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) this.height - 4.0)), this.width, 8, 31, Alpha: 100, Scale: 1.4f); Main.dust[index6].velocity *= 0.1f; Main.dust[index6].scale *= (float) (1.0 + (double) Main.rand.Next(20) * 0.00999999977648258); Main.dust[index6].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this); } num2 = 0.985f; num4 = 0.94f; num5 = 30; } else if (this.dash == 3) { for (int index7 = 0; index7 < 4; ++index7) { int index8 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 4f), this.width, this.height - 8, 6, Alpha: 100, Scale: 1.7f); Main.dust[index8].velocity *= 0.1f; Main.dust[index8].scale *= (float) (1.0 + (double) Main.rand.Next(20) * 0.00999999977648258); Main.dust[index8].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); Main.dust[index8].noGravity = true; if (Main.rand.Next(2) == 0) Main.dust[index8].fadeIn = 0.5f; } num1 = 14f; num2 = 0.985f; num4 = 0.94f; num5 = 20; } else if (this.dash == 4) { for (int index9 = 0; index9 < 2; ++index9) { int index10 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 4f), this.width, this.height - 8, 229, Alpha: 100, Scale: 1.2f); Main.dust[index10].velocity *= 0.1f; Main.dust[index10].scale *= (float) (1.0 + (double) Main.rand.Next(20) * 0.00999999977648258); Main.dust[index10].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); Main.dust[index10].noGravity = true; if (Main.rand.Next(2) == 0) Main.dust[index10].fadeIn = 0.3f; } num2 = 0.985f; num4 = 0.94f; num5 = 20; } if (this.dash <= 0) return; this.vortexStealthActive = false; if ((double) this.velocity.X > (double) num1 || (double) this.velocity.X < -(double) num1) this.velocity.X *= num2; else if ((double) this.velocity.X > (double) num3 || (double) this.velocity.X < -(double) num3) { this.velocity.X *= num4; } else { this.dashDelay = num5; if ((double) this.velocity.X < 0.0) { this.velocity.X = -num3; } else { if ((double) this.velocity.X <= 0.0) return; this.velocity.X = num3; } } } else { if (this.dash <= 0 || this.mount.Active) return; if (this.dash == 1) { int num = 0; bool flag = false; if (this.dashTime > 0) --this.dashTime; if (this.dashTime < 0) ++this.dashTime; if (this.controlRight && this.releaseRight) { if (this.dashTime > 0) { num = 1; flag = true; this.dashTime = 0; } else this.dashTime = 15; } else if (this.controlLeft && this.releaseLeft) { if (this.dashTime < 0) { num = -1; flag = true; this.dashTime = 0; } else this.dashTime = -15; } if (!flag) return; this.velocity.X = 16.9f * (float) num; Point tileCoordinates1 = (this.Center + new Vector2((float) (num * this.width / 2 + 2), (float) ((double) this.gravDir * (double) -this.height / 2.0 + (double) this.gravDir * 2.0))).ToTileCoordinates(); Point tileCoordinates2 = (this.Center + new Vector2((float) (num * this.width / 2 + 2), 0.0f)).ToTileCoordinates(); if (WorldGen.SolidOrSlopedTile(tileCoordinates1.X, tileCoordinates1.Y) || WorldGen.SolidOrSlopedTile(tileCoordinates2.X, tileCoordinates2.Y)) this.velocity.X /= 2f; this.dashDelay = -1; for (int index11 = 0; index11 < 20; ++index11) { int index12 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 2f); Main.dust[index12].position.X += (float) Main.rand.Next(-5, 6); Main.dust[index12].position.Y += (float) Main.rand.Next(-5, 6); Main.dust[index12].velocity *= 0.2f; Main.dust[index12].scale *= (float) (1.0 + (double) Main.rand.Next(20) * 0.00999999977648258); Main.dust[index12].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this); } int index13 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 24.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 34.0)), new Vector2(), Main.rand.Next(61, 64)); Main.gore[index13].velocity.X = (float) Main.rand.Next(-50, 51) * 0.01f; Main.gore[index13].velocity.Y = (float) Main.rand.Next(-50, 51) * 0.01f; Main.gore[index13].velocity *= 0.4f; int index14 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 24.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 14.0)), new Vector2(), Main.rand.Next(61, 64)); Main.gore[index14].velocity.X = (float) Main.rand.Next(-50, 51) * 0.01f; Main.gore[index14].velocity.Y = (float) Main.rand.Next(-50, 51) * 0.01f; Main.gore[index14].velocity *= 0.4f; } else if (this.dash == 2) { int num = 0; bool flag = false; if (this.dashTime > 0) --this.dashTime; if (this.dashTime < 0) ++this.dashTime; if (this.controlRight && this.releaseRight) { if (this.dashTime > 0) { num = 1; flag = true; this.dashTime = 0; } else this.dashTime = 15; } else if (this.controlLeft && this.releaseLeft) { if (this.dashTime < 0) { num = -1; flag = true; this.dashTime = 0; } else this.dashTime = -15; } if (!flag) return; this.velocity.X = 14.5f * (float) num; Point tileCoordinates3 = (this.Center + new Vector2((float) (num * this.width / 2 + 2), (float) ((double) this.gravDir * (double) -this.height / 2.0 + (double) this.gravDir * 2.0))).ToTileCoordinates(); Point tileCoordinates4 = (this.Center + new Vector2((float) (num * this.width / 2 + 2), 0.0f)).ToTileCoordinates(); if (WorldGen.SolidOrSlopedTile(tileCoordinates3.X, tileCoordinates3.Y) || WorldGen.SolidOrSlopedTile(tileCoordinates4.X, tileCoordinates4.Y)) this.velocity.X /= 2f; this.dashDelay = -1; this.eocDash = 15; for (int index15 = 0; index15 < 0; ++index15) { int index16 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 2f); Main.dust[index16].position.X += (float) Main.rand.Next(-5, 6); Main.dust[index16].position.Y += (float) Main.rand.Next(-5, 6); Main.dust[index16].velocity *= 0.2f; Main.dust[index16].scale *= (float) (1.0 + (double) Main.rand.Next(20) * 0.00999999977648258); Main.dust[index16].shader = GameShaders.Armor.GetSecondaryShader(this.cShield, this); } } else { if (this.dash != 3) return; int num = 0; bool flag = false; if (this.dashTime > 0) --this.dashTime; if (this.dashTime < 0) ++this.dashTime; if (this.controlRight && this.releaseRight) { if (this.dashTime > 0) { num = 1; flag = true; this.dashTime = 0; this.solarDashing = true; this.solarDashConsumedFlare = false; } else this.dashTime = 15; } else if (this.controlLeft && this.releaseLeft) { if (this.dashTime < 0) { num = -1; flag = true; this.dashTime = 0; this.solarDashing = true; this.solarDashConsumedFlare = false; } else this.dashTime = -15; } if (!flag) return; this.velocity.X = 21.9f * (float) num; Point tileCoordinates5 = (this.Center + new Vector2((float) (num * this.width / 2 + 2), (float) ((double) this.gravDir * (double) -this.height / 2.0 + (double) this.gravDir * 2.0))).ToTileCoordinates(); Point tileCoordinates6 = (this.Center + new Vector2((float) (num * this.width / 2 + 2), 0.0f)).ToTileCoordinates(); if (WorldGen.SolidOrSlopedTile(tileCoordinates5.X, tileCoordinates5.Y) || WorldGen.SolidOrSlopedTile(tileCoordinates6.X, tileCoordinates6.Y)) this.velocity.X /= 2f; this.dashDelay = -1; for (int index17 = 0; index17 < 20; ++index17) { int index18 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2f); Main.dust[index18].position.X += (float) Main.rand.Next(-5, 6); Main.dust[index18].position.Y += (float) Main.rand.Next(-5, 6); Main.dust[index18].velocity *= 0.2f; Main.dust[index18].scale *= (float) (1.0 + (double) Main.rand.Next(20) * 0.00999999977648258); Main.dust[index18].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); Main.dust[index18].noGravity = true; Main.dust[index18].fadeIn = 0.5f; } } } } public void WallslideMovement() { this.sliding = false; if (this.slideDir == 0 || this.spikedBoots <= 0 || this.mount.Active || (!this.controlLeft || this.slideDir != -1) && (!this.controlRight || this.slideDir != 1)) return; bool flag = false; float x = this.position.X; if (this.slideDir == 1) x += (float) this.width; float num1 = x + (float) this.slideDir; float num2 = (float) ((double) this.position.Y + (double) this.height + 1.0); if ((double) this.gravDir < 0.0) num2 = this.position.Y - 1f; float num3 = num1 / 16f; float num4 = num2 / 16f; if (WorldGen.SolidTile((int) num3, (int) num4) && WorldGen.SolidTile((int) num3, (int) num4 - 1)) flag = true; if (this.spikedBoots >= 2) { if (!flag || ((double) this.velocity.Y <= 0.0 || (double) this.gravDir != 1.0) && ((double) this.velocity.Y >= (double) this.gravity || (double) this.gravDir != -1.0)) return; float num5 = this.gravity; if (this.slowFall) num5 = !this.controlUp ? this.gravity / 3f * this.gravDir : this.gravity / 10f * this.gravDir; this.fallStart = (int) ((double) this.position.Y / 16.0); if (this.controlDown && (double) this.gravDir == 1.0 || this.controlUp && (double) this.gravDir == -1.0) { this.velocity.Y = 4f * this.gravDir; int index = Dust.NewDust(new Vector2(this.position.X + (float) (this.width / 2) + (float) ((this.width / 2 - 4) * this.slideDir), (float) ((double) this.position.Y + (double) (this.height / 2) + (double) (this.height / 2 - 4) * (double) this.gravDir)), 8, 8, 31); if (this.slideDir < 0) Main.dust[index].position.X -= 10f; if ((double) this.gravDir < 0.0) Main.dust[index].position.Y -= 12f; Main.dust[index].velocity *= 0.1f; Main.dust[index].scale *= 1.2f; Main.dust[index].noGravity = true; Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this); } else if ((double) this.gravDir == -1.0) this.velocity.Y = (float) (-(double) num5 + 9.99999974737875E-06) * this.gravDir; else this.velocity.Y = (float) (-(double) num5 + 9.99999974737875E-06) * this.gravDir; this.sliding = true; } else { if ((!flag || (double) this.velocity.Y <= 0.5 || (double) this.gravDir != 1.0) && ((double) this.velocity.Y >= -0.5 || (double) this.gravDir != -1.0)) return; this.fallStart = (int) ((double) this.position.Y / 16.0); if (this.controlDown) this.velocity.Y = 4f * this.gravDir; else this.velocity.Y = 0.5f * this.gravDir; this.sliding = true; int index = Dust.NewDust(new Vector2(this.position.X + (float) (this.width / 2) + (float) ((this.width / 2 - 4) * this.slideDir), (float) ((double) this.position.Y + (double) (this.height / 2) + (double) (this.height / 2 - 4) * (double) this.gravDir)), 8, 8, 31); if (this.slideDir < 0) Main.dust[index].position.X -= 10f; if ((double) this.gravDir < 0.0) Main.dust[index].position.Y -= 12f; Main.dust[index].velocity *= 0.1f; Main.dust[index].scale *= 1.2f; Main.dust[index].noGravity = true; Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this); } } public void CarpetMovement() { bool flag = false; if (this.grappling[0] == -1 && this.carpet && !this.jumpAgainCloud && !this.jumpAgainSandstorm && !this.jumpAgainBlizzard && !this.jumpAgainFart && !this.jumpAgainSail && !this.jumpAgainUnicorn && this.jump == 0 && (double) this.velocity.Y != 0.0 && this.rocketTime == 0 && (double) this.wingTime == 0.0 && !this.mount.Active) { if (this.controlJump && this.canCarpet) { this.canCarpet = false; this.carpetTime = 300; } if (this.carpetTime > 0 && this.controlJump) { this.fallStart = (int) ((double) this.position.Y / 16.0); flag = true; --this.carpetTime; float gravity = this.gravity; if ((double) this.gravDir == 1.0 && (double) this.velocity.Y > -(double) gravity) this.velocity.Y = (float) -((double) gravity + 9.99999997475243E-07); else if ((double) this.gravDir == -1.0 && (double) this.velocity.Y < (double) gravity) this.velocity.Y = gravity + 1E-06f; this.carpetFrameCounter += 1f + Math.Abs(this.velocity.X * 0.5f); if ((double) this.carpetFrameCounter > 8.0) { this.carpetFrameCounter = 0.0f; ++this.carpetFrame; } if (this.carpetFrame < 0) this.carpetFrame = 0; if (this.carpetFrame > 5) this.carpetFrame = 0; } } if (!flag) this.carpetFrame = -1; else this.slowFall = false; } public void DoubleJumpVisuals() { if (this.dJumpEffectCloud && this.doubleJumpCloud && !this.jumpAgainCloud && (this.jumpAgainSandstorm || !this.doubleJumpSandstorm) && ((double) this.gravDir == 1.0 && (double) this.velocity.Y < 0.0 || (double) this.gravDir == -1.0 && (double) this.velocity.Y > 0.0)) { int num = this.height; if ((double) this.gravDir == -1.0) num = -6; int index = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float) num), this.width + 8, 4, 16, (float) (-(double) this.velocity.X * 0.5), this.velocity.Y * 0.5f, 100, Scale: 1.5f); Main.dust[index].velocity.X = (float) ((double) Main.dust[index].velocity.X * 0.5 - (double) this.velocity.X * 0.100000001490116); Main.dust[index].velocity.Y = (float) ((double) Main.dust[index].velocity.Y * 0.5 - (double) this.velocity.Y * 0.300000011920929); } if (this.dJumpEffectSandstorm && this.doubleJumpSandstorm && !this.jumpAgainSandstorm && ((double) this.gravDir == 1.0 && (double) this.velocity.Y < 0.0 || (double) this.gravDir == -1.0 && (double) this.velocity.Y > 0.0)) { int num = this.height; if ((double) this.gravDir == -1.0) num = -6; float Scale = (float) (((double) this.jump / 75.0 + 1.0) / 2.0); for (int index1 = 0; index1 < 3; ++index1) { int index2 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float) (num / 2)), this.width, 32, 124, this.velocity.X * 0.3f, this.velocity.Y * 0.3f, 150, Scale: (1f * Scale)); Main.dust[index2].velocity *= 0.5f * Scale; Main.dust[index2].fadeIn = 1.5f * Scale; } this.sandStorm = true; if (this.miscCounter % 3 == 0) { int index = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 18.0), this.position.Y + (float) (num / 2)), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(220, 223), Scale); Main.gore[index].velocity = this.velocity * 0.3f * Scale; Main.gore[index].alpha = 100; } } if (this.dJumpEffectFart && this.doubleJumpFart && !this.jumpAgainFart && ((double) this.gravDir == 1.0 && (double) this.velocity.Y < 0.0 || (double) this.gravDir == -1.0 && (double) this.velocity.Y > 0.0)) { int num = this.height; if ((double) this.gravDir == -1.0) num = -6; int index = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float) num), this.width + 8, 4, 188, (float) (-(double) this.velocity.X * 0.5), this.velocity.Y * 0.5f, 100, Scale: 1.5f); Main.dust[index].velocity.X = (float) ((double) Main.dust[index].velocity.X * 0.5 - (double) this.velocity.X * 0.100000001490116); Main.dust[index].velocity.Y = (float) ((double) Main.dust[index].velocity.Y * 0.5 - (double) this.velocity.Y * 0.300000011920929); Main.dust[index].velocity *= 0.5f; } if (this.dJumpEffectUnicorn && this.doubleJumpUnicorn && !this.jumpAgainUnicorn && ((double) this.gravDir == 1.0 && (double) this.velocity.Y < 0.0 || (double) this.gravDir == -1.0 && (double) this.velocity.Y > 0.0)) { Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Utils.SelectRandom(Main.rand, 176, 177, 179))]; dust.velocity = Vector2.Zero; dust.noGravity = true; dust.scale = (float) (0.5 + (double) Main.rand.NextFloat() * 0.800000011920929); dust.fadeIn = (float) (1.0 + (double) Main.rand.NextFloat() * 2.0); dust.shader = GameShaders.Armor.GetSecondaryShader(this.cMount, this); } if (this.dJumpEffectSail && this.doubleJumpSail && !this.jumpAgainSail && ((double) this.gravDir == 1.0 && (double) this.velocity.Y < 1.0 || (double) this.gravDir == -1.0 && (double) this.velocity.Y > 1.0)) { int num1 = 1; if (this.jump > 0) num1 = 2; int num2 = this.height - 6; if ((double) this.gravDir == -1.0) num2 = 6; for (int index3 = 0; index3 < num1; ++index3) { int index4 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float) num2), this.width, 12, 253, this.velocity.X * 0.3f, this.velocity.Y * 0.3f, 100, Scale: 1.5f); Main.dust[index4].scale += (float) Main.rand.Next(-5, 3) * 0.1f; if (this.jump <= 0) Main.dust[index4].scale *= 0.8f; else Main.dust[index4].velocity -= this.velocity / 5f; Main.dust[index4].noGravity = true; Vector2 vector2 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101)); vector2.Normalize(); vector2 *= (float) Main.rand.Next(81) * 0.1f; } } if (!this.dJumpEffectBlizzard || !this.doubleJumpBlizzard || this.jumpAgainBlizzard || ((double) this.gravDir != 1.0 || (double) this.velocity.Y >= 0.0) && ((double) this.gravDir != -1.0 || (double) this.velocity.Y <= 0.0)) return; int num3 = this.height - 6; if ((double) this.gravDir == -1.0) num3 = 6; for (int index5 = 0; index5 < 2; ++index5) { int index6 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float) num3), this.width, 12, 76, this.velocity.X * 0.3f, this.velocity.Y * 0.3f); Main.dust[index6].velocity *= 0.1f; if (index5 == 0) Main.dust[index6].velocity += this.velocity * 0.03f; else Main.dust[index6].velocity -= this.velocity * 0.03f; Main.dust[index6].velocity -= this.velocity * 0.1f; Main.dust[index6].noGravity = true; Main.dust[index6].noLight = true; } for (int index7 = 0; index7 < 3; ++index7) { int index8 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float) num3), this.width, 12, 76, this.velocity.X * 0.3f, this.velocity.Y * 0.3f); Main.dust[index8].fadeIn = 1.5f; Main.dust[index8].velocity *= 0.6f; Main.dust[index8].velocity += this.velocity * 0.8f; Main.dust[index8].noGravity = true; Main.dust[index8].noLight = true; } for (int index9 = 0; index9 < 3; ++index9) { int index10 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float) num3), this.width, 12, 76, this.velocity.X * 0.3f, this.velocity.Y * 0.3f); Main.dust[index10].fadeIn = 1.5f; Main.dust[index10].velocity *= 0.6f; Main.dust[index10].velocity -= this.velocity * 0.8f; Main.dust[index10].noGravity = true; Main.dust[index10].noLight = true; } } public void WingMovement() { if (this.wingsLogic == 4 && this.controlUp) { this.velocity.Y -= 0.2f * this.gravDir; if ((double) this.gravDir == 1.0) { if ((double) this.velocity.Y > 0.0) --this.velocity.Y; else if ((double) this.velocity.Y > -(double) Player.jumpSpeed) this.velocity.Y -= 0.2f; if ((double) this.velocity.Y < -(double) Player.jumpSpeed * 3.0) this.velocity.Y = (float) (-(double) Player.jumpSpeed * 3.0); } else { if ((double) this.velocity.Y < 0.0) ++this.velocity.Y; else if ((double) this.velocity.Y < (double) Player.jumpSpeed) this.velocity.Y += 0.2f; if ((double) this.velocity.Y > (double) Player.jumpSpeed * 3.0) this.velocity.Y = Player.jumpSpeed * 3f; } this.wingTime -= 2f; } else { float num1 = 0.1f; float num2 = 0.5f; float num3 = 1.5f; float num4 = 0.5f; float num5 = 0.1f; if (this.wingsLogic == 26) { num2 = 0.75f; num5 = 0.15f; num4 = 1f; num3 = 2.5f; num1 = 0.125f; } if (this.wingsLogic == 37) { num2 = 0.75f; num5 = 0.15f; num4 = 1f; num3 = 2.5f; num1 = 0.125f; } if (this.wingsLogic == 29 || this.wingsLogic == 32) { num2 = 0.85f; num5 = 0.15f; num4 = 1f; num3 = 3f; num1 = 0.135f; } if (this.wingsLogic == 30 || this.wingsLogic == 31) { num4 = 1f; num3 = 2f; num1 = 0.15f; } this.velocity.Y -= num1 * this.gravDir; if ((double) this.gravDir == 1.0) { if ((double) this.velocity.Y > 0.0) this.velocity.Y -= num2; else if ((double) this.velocity.Y > -(double) Player.jumpSpeed * (double) num4) this.velocity.Y -= num5; if ((double) this.velocity.Y < -(double) Player.jumpSpeed * (double) num3) this.velocity.Y = -Player.jumpSpeed * num3; } else { if ((double) this.velocity.Y < 0.0) this.velocity.Y += num2; else if ((double) this.velocity.Y < (double) Player.jumpSpeed * (double) num4) this.velocity.Y += num5; if ((double) this.velocity.Y > (double) Player.jumpSpeed * (double) num3) this.velocity.Y = Player.jumpSpeed * num3; } if ((this.wingsLogic == 22 || this.wingsLogic == 28 || this.wingsLogic == 30 || this.wingsLogic == 31 || this.wingsLogic == 37) && this.controlDown && !this.controlLeft && !this.controlRight) this.wingTime -= 0.5f; else --this.wingTime; } } public void MoonLeechRope() { int index1 = -1; for (int index2 = 0; index2 < 1000; ++index2) { if (Main.projectile[index2].active && Main.projectile[index2].type == 456 && (double) Main.projectile[index2].ai[1] == (double) this.whoAmI) { index1 = index2; break; } } if (index1 == -1 || (double) Main.projectile[index1].ai[0] < 0.0) return; Projectile projectile = Main.projectile[index1]; Vector2 vector2_1 = new Vector2(0.0f, 216f); Vector2 vector2_2 = Main.npc[(int) Math.Abs(projectile.ai[0]) - 1].Center - this.Center + vector2_1; if ((double) vector2_2.Length() <= 200.0) return; this.position = this.position + Vector2.Normalize(vector2_2) * (vector2_2.Length() - 200f); } public void WOFTongue() { if (Main.wof < 0 || !Main.npc[Main.wof].active) return; float num1 = Main.npc[Main.wof].position.X + 40f; if (Main.npc[Main.wof].direction > 0) num1 -= 96f; if ((double) this.position.X + (double) this.width > (double) num1 && (double) this.position.X < (double) num1 + 140.0 && this.gross) { this.noKnockback = false; this.Hurt(PlayerDeathReason.LegacyDefault(), 50, Main.npc[Main.wof].direction); } if (!this.gross && (double) this.position.Y > (double) ((Main.maxTilesY - 250) * 16) && (double) this.position.X > (double) num1 - 1920.0 && (double) this.position.X < (double) num1 + 1920.0) { this.AddBuff(37, 10); Main.PlaySound(4, (int) Main.npc[Main.wof].position.X, (int) Main.npc[Main.wof].position.Y, 10); } if (this.gross) { if ((double) this.position.Y < (double) ((Main.maxTilesY - 200) * 16)) this.AddBuff(38, 10); if (Main.npc[Main.wof].direction < 0) { if ((double) this.position.X + (double) (this.width / 2) > (double) Main.npc[Main.wof].position.X + (double) (Main.npc[Main.wof].width / 2) + 40.0) this.AddBuff(38, 10); } else if ((double) this.position.X + (double) (this.width / 2) < (double) Main.npc[Main.wof].position.X + (double) (Main.npc[Main.wof].width / 2) - 40.0) this.AddBuff(38, 10); } if (!this.tongued) return; this.controlHook = false; this.controlUseItem = false; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && Main.projectile[index].aiStyle == 7) Main.projectile[index].Kill(); } Vector2 center = this.Center; double num2 = (double) Main.npc[Main.wof].position.X + (double) (Main.npc[Main.wof].width / 2) - (double) center.X; float num3 = Main.npc[Main.wof].position.Y + (float) (Main.npc[Main.wof].height / 2) - center.Y; if (Math.Sqrt(num2 * num2 + (double) num3 * (double) num3) > 3000.0) { this.KillMe(PlayerDeathReason.ByOther(11), 1000.0, 0); } else { if ((double) Main.npc[Main.wof].position.X >= 608.0 && (double) Main.npc[Main.wof].position.X <= (double) ((Main.maxTilesX - 38) * 16)) return; this.KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0); } } public void StatusPlayer(NPC npc) { if (Main.expertMode && (npc.type == 266 && Main.rand.Next(3) == 0 || npc.type == 267)) { int num1 = Main.rand.Next(9); switch (num1) { case 2: case 4: num1 = Main.rand.Next(9); break; } float num2 = (float) Main.rand.Next(75, 150) * 0.01f; if (num1 == 0) this.AddBuff(20, (int) (60.0 * (double) num2 * 3.5)); else if (num1 == 1) this.AddBuff(22, (int) (60.0 * (double) num2 * 2.0)); else if (num1 == 2) this.AddBuff(23, (int) (60.0 * (double) num2 * 0.5)); else if (num1 == 3) this.AddBuff(30, (int) (60.0 * (double) num2 * 5.0)); else if (num1 == 4) this.AddBuff(31, (int) (60.0 * (double) num2 * 1.0)); else if (num1 == 5) this.AddBuff(32, (int) (60.0 * (double) num2 * 3.5)); else if (num1 == 6) this.AddBuff(33, (int) (60.0 * (double) num2 * 7.5)); else if (num1 == 7) this.AddBuff(35, (int) (60.0 * (double) num2 * 1.0)); else if (num1 == 8) this.AddBuff(36, (int) (60.0 * (double) num2 * 6.5)); } if (npc.type == 530 || npc.type == 531) this.AddBuff(70, Main.rand.Next(240, 481)); if (npc.type == 159 || npc.type == 158) this.AddBuff(30, Main.rand.Next(300, 600)); if (npc.type == 525) this.AddBuff(39, 420); if (npc.type == 526) this.AddBuff(69, 420); if (npc.type == 527) this.AddBuff(31, 840); if (Main.expertMode && (npc.type == 49 || npc.type == 93 || npc.type == 51 || npc.type == 152) && Main.rand.Next(10) == 0) this.AddBuff(148, Main.rand.Next(1800, 5400)); if (Main.expertMode && npc.type == 222) this.AddBuff(20, Main.rand.Next(60, 240)); if (Main.expertMode && (npc.type == 210 || npc.type == 211)) this.AddBuff(20, Main.rand.Next(60, 180)); if (Main.expertMode && npc.type == 35) this.AddBuff(30, Main.rand.Next(180, 300)); if (Main.expertMode && npc.type == 36 && Main.rand.Next(2) == 0) this.AddBuff(32, Main.rand.Next(30, 60)); if (npc.type >= 269 && npc.type <= 272) { if (Main.rand.Next(3) == 0) this.AddBuff(30, 600); else if (Main.rand.Next(3) == 0) this.AddBuff(32, 300); } if (npc.type >= 273 && npc.type <= 276 && Main.rand.Next(2) == 0) this.AddBuff(36, 600); if (npc.type >= 277 && npc.type <= 280) this.AddBuff(24, 600); if (npc.type == 371) this.AddBuff(103, 60 * Main.rand.Next(3, 8)); if (npc.type == 370 && Main.expertMode) { int type = Utils.SelectRandom(Main.rand, 0, 148, 30); if (type != 0) this.AddBuff(type, 60 * Main.rand.Next(3, 11)); } if ((npc.type == 1 && npc.netID == -6 || npc.type == 81 || npc.type == 79) && Main.rand.Next(4) == 0) this.AddBuff(22, 900); if ((npc.type == 23 || npc.type == 25) && Main.rand.Next(3) == 0) this.AddBuff(24, 420); if ((npc.type == 34 || npc.type == 83 || npc.type == 84) && Main.rand.Next(3) == 0) this.AddBuff(23, 240); if ((npc.type == 104 || npc.type == 102) && Main.rand.Next(8) == 0) this.AddBuff(30, 2700); if (npc.type == 75 && Main.rand.Next(10) == 0) this.AddBuff(35, 420); if ((npc.type == 163 || npc.type == 238) && Main.rand.Next(10) == 0) this.AddBuff(70, 480); if ((npc.type == 79 || npc.type == 103) && Main.rand.Next(5) == 0) this.AddBuff(35, 420); if ((npc.type == 75 || npc.type == 78 || npc.type == 82) && Main.rand.Next(8) == 0) this.AddBuff(32, 900); if ((npc.type == 93 || npc.type == 109 || npc.type == 80) && Main.rand.Next(14) == 0) this.AddBuff(31, 300); if (npc.type >= 305 && npc.type <= 314 && Main.rand.Next(10) == 0) this.AddBuff(33, 3600); if (npc.type == 77 && Main.rand.Next(6) == 0) this.AddBuff(36, 7200); if (npc.type == 112 && Main.rand.Next(20) == 0) this.AddBuff(33, 18000); if (npc.type == 182 && Main.rand.Next(25) == 0) this.AddBuff(33, 7200); if (npc.type == 141 && Main.rand.Next(2) == 0) this.AddBuff(20, 600); if (npc.type == 147 && !this.frozen && Main.rand.Next(12) == 0) this.AddBuff(46, 600); if (npc.type == 150) { if (Main.rand.Next(2) == 0) this.AddBuff(46, 900); if (!this.frozen && Main.rand.Next(35) == 0) this.AddBuff(47, 60); else if (!this.frozen && Main.expertMode && Main.rand.Next(35) == 0) this.AddBuff(47, 60); } if (npc.type != 184) return; this.AddBuff(46, 1200); if (!this.frozen && Main.rand.Next(15) == 0) { this.AddBuff(47, 60); } else { if (this.frozen || !Main.expertMode || Main.rand.Next(25) != 0) return; this.AddBuff(47, 60); } } public void GrappleMovement() { if (this.grappling[0] < 0) return; if (Main.myPlayer == this.whoAmI && this.mount.Active) this.mount.Dismount(this); this.canCarpet = true; this.carpetFrame = -1; this.wingFrame = 1; if ((double) this.velocity.Y == 0.0 || this.wet && (double) this.velocity.Y > -0.02 && (double) this.velocity.Y < 0.02) this.wingFrame = 0; if (this.wings == 4) this.wingFrame = 3; if (this.wings == 30) this.wingFrame = 0; this.wingTime = (float) this.wingTimeMax; this.rocketTime = this.rocketTimeMax; this.rocketDelay = 0; this.rocketFrame = false; this.canRocket = false; this.rocketRelease = false; this.fallStart = (int) ((double) this.position.Y / 16.0); int index1 = -1; float num1 = 0.0f; float num2 = 0.0f; for (int index2 = 0; index2 < this.grapCount; ++index2) { Projectile projectile = Main.projectile[this.grappling[index2]]; num1 += projectile.position.X + (float) (projectile.width / 2); num2 += projectile.position.Y + (float) (projectile.height / 2); if (projectile.type == 403) index1 = index2; else if (projectile.type == 446) { Vector2 vector2_1 = new Vector2((float) (this.controlRight.ToInt() - this.controlLeft.ToInt()), (float) (this.controlDown.ToInt() - this.controlUp.ToInt()) * this.gravDir); if (vector2_1 != Vector2.Zero) vector2_1.Normalize(); vector2_1 *= 100f; Vector2 vector2_2 = Vector2.Normalize(this.Center - projectile.Center + vector2_1); if (float.IsNaN(vector2_2.X) || float.IsNaN(vector2_2.Y)) vector2_2 = -Vector2.UnitY; float num3 = 200f; num1 += vector2_2.X * num3; num2 += vector2_2.Y * num3; } else if (projectile.type == 652) { Vector2 vector2_3 = new Vector2((float) (this.controlRight.ToInt() - this.controlLeft.ToInt()), (float) (this.controlDown.ToInt() - this.controlUp.ToInt()) * this.gravDir); if (vector2_3 != Vector2.Zero) vector2_3.Normalize(); Vector2 vector2_4 = projectile.Center - this.Center; Vector2 vector2_5 = vector2_4; if (vector2_5 != Vector2.Zero) vector2_5.Normalize(); Vector2 vector2_6 = Vector2.Zero; if (vector2_3 != Vector2.Zero) vector2_6 = vector2_5 * Vector2.Dot(vector2_5, vector2_3); float num4 = 6f; if ((double) Vector2.Dot(vector2_6, vector2_4) < 0.0 && (double) vector2_4.Length() >= 600.0) num4 = 0.0f; num1 += (float) (-(double) vector2_4.X + (double) vector2_6.X * (double) num4); num2 += (float) (-(double) vector2_4.Y + (double) vector2_6.Y * (double) num4); } } float num5 = num1 / (float) this.grapCount; float num6 = num2 / (float) this.grapCount; Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); float num7 = num5 - vector2.X; float num8 = num6 - vector2.Y; float num9 = (float) Math.Sqrt((double) num7 * (double) num7 + (double) num8 * (double) num8); float num10 = 11f; if (Main.projectile[this.grappling[0]].type == 315) num10 = 16f; if (Main.projectile[this.grappling[0]].type >= 646 && Main.projectile[this.grappling[0]].type <= 649) num10 = 13f; float num11 = (double) num9 <= (double) num10 ? 1f : num10 / num9; float num12 = num7 * num11; float num13 = num8 * num11; if ((double) num13 > 0.0) this.GoingDownWithGrapple = true; this.velocity.X = num12; this.velocity.Y = num13; if (index1 != -1) { Projectile projectile = Main.projectile[this.grappling[index1]]; if ((double) projectile.position.X < (double) this.position.X + (double) this.width && (double) projectile.position.X + (double) projectile.width >= (double) this.position.X && (double) projectile.position.Y < (double) this.position.Y + (double) this.height && (double) projectile.position.Y + (double) projectile.height >= (double) this.position.Y) { int tileX = (int) ((double) projectile.position.X + (double) (projectile.width / 2)) / 16; int tileY = (int) ((double) projectile.position.Y + (double) (projectile.height / 2)) / 16; this.velocity = Vector2.Zero; if (Main.tile[tileX, tileY].type == (ushort) 314) { Vector2 Position; Position.X = projectile.position.X + (float) (projectile.width / 2) - (float) (this.width / 2); Position.Y = projectile.position.Y + (float) (projectile.height / 2) - (float) (this.height / 2); this.grappling[0] = -1; this.grapCount = 0; for (int index3 = 0; index3 < 1000; ++index3) { if (Main.projectile[index3].active && Main.projectile[index3].owner == this.whoAmI && Main.projectile[index3].aiStyle == 7) Main.projectile[index3].Kill(); } int num14 = 13; if (this.miscEquips[2].stack > 0 && this.miscEquips[2].mountType >= 0 && MountID.Sets.Cart[this.miscEquips[2].mountType] && (!this.miscEquips[2].expertOnly || Main.expertMode)) num14 = this.miscEquips[2].mountType; int Height = this.height + Mount.GetHeightBoost(num14); if (Minecart.GetOnTrack(tileX, tileY, ref Position, this.width, Height) && !Collision.SolidCollision(Position, this.width, Height - 20)) { this.position = Position; DelegateMethods.Minecart.rotation = this.fullRotation; DelegateMethods.Minecart.rotationOrigin = this.fullRotationOrigin; this.mount.SetMount(num14, this, this.minecartLeft); Minecart.WheelSparks(this.mount.MinecartDust, this.position, this.width, this.height, 25); } } } } if (this.itemAnimation == 0) { if ((double) this.velocity.X > 0.0) this.ChangeDir(1); if ((double) this.velocity.X < 0.0) this.ChangeDir(-1); } if (this.controlJump) { if (!this.releaseJump) return; if (((double) this.velocity.Y == 0.0 || this.wet && (double) this.velocity.Y > -0.02 && (double) this.velocity.Y < 0.02) && !this.controlDown) { this.velocity.Y = -Player.jumpSpeed; this.jump = Player.jumpHeight / 2; this.releaseJump = false; } else { this.velocity.Y += 0.01f; this.releaseJump = false; } if (this.doubleJumpCloud) this.jumpAgainCloud = true; if (this.doubleJumpSandstorm) this.jumpAgainSandstorm = true; if (this.doubleJumpBlizzard) this.jumpAgainBlizzard = true; if (this.doubleJumpFart) this.jumpAgainFart = true; if (this.doubleJumpSail) this.jumpAgainSail = true; if (this.doubleJumpUnicorn) this.jumpAgainUnicorn = true; this.grappling[0] = 0; this.grapCount = 0; for (int index4 = 0; index4 < 1000; ++index4) { if (Main.projectile[index4].active && Main.projectile[index4].owner == this.whoAmI && Main.projectile[index4].aiStyle == 7) Main.projectile[index4].Kill(); } } else this.releaseJump = true; } public void StickyMovement() { bool flag = false; if (this.mount.Type == 6 && (double) Math.Abs(this.velocity.X) > 5.0) flag = true; if (this.mount.Type == 13 && (double) Math.Abs(this.velocity.X) > 5.0) flag = true; if (this.mount.Type == 11 && (double) Math.Abs(this.velocity.X) > 5.0) flag = true; Vector2 vector2_1 = new Vector2(this.position.X + (float) (this.width / 2) - (float) (this.width / 2 / 2), this.position.Y + (float) (this.height / 2) - (float) (this.height / 2 / 2)); Vector2 vector2_2 = Collision.StickyTiles(this.position, this.velocity, this.width, this.height); if ((double) vector2_2.Y != -1.0 && (double) vector2_2.X != -1.0) { int x = (int) vector2_2.X; int y = (int) vector2_2.Y; int type = (int) Main.tile[x, y].type; if (this.whoAmI == Main.myPlayer && type == 51 && ((double) this.velocity.X != 0.0 || (double) this.velocity.Y != 0.0)) { ++this.stickyBreak; if (this.stickyBreak > Main.rand.Next(20, 100) | flag) { this.stickyBreak = 0; WorldGen.KillTile(x, y); if (Main.netMode == 1 && !Main.tile[x, y].active() && Main.netMode == 1) NetMessage.SendData(17, number2: ((float) x), number3: ((float) y)); } } if (flag) return; this.fallStart = (int) ((double) this.position.Y / 16.0); if (type != 229) this.jump = 0; if ((double) this.velocity.X > 1.0) this.velocity.X = 1f; if ((double) this.velocity.X < -1.0) this.velocity.X = -1f; if ((double) this.velocity.Y > 1.0) this.velocity.Y = 1f; if ((double) this.velocity.Y < -5.0) this.velocity.Y = -5f; if ((double) this.velocity.X > 0.75 || (double) this.velocity.X < -0.75) this.velocity.X *= 0.85f; else this.velocity.X *= 0.6f; if ((double) this.velocity.Y < 0.0) this.velocity.Y *= 0.96f; else this.velocity.Y *= 0.3f; if (type != 229 || Main.rand.Next(5) != 0 || (double) this.velocity.Y <= 0.15 && (double) this.velocity.Y >= 0.0) return; if ((double) (x * 16) < (double) this.position.X + (double) (this.width / 2)) { int index = Dust.NewDust(new Vector2(this.position.X - 4f, (float) (y * 16)), 4, 16, 153, Alpha: 50); Main.dust[index].scale += (float) Main.rand.Next(0, 6) * 0.1f; Main.dust[index].velocity *= 0.1f; Main.dust[index].noGravity = true; } else { int index = Dust.NewDust(new Vector2((float) ((double) this.position.X + (double) this.width - 2.0), (float) (y * 16)), 4, 16, 153, Alpha: 50); Main.dust[index].scale += (float) Main.rand.Next(0, 6) * 0.1f; Main.dust[index].velocity *= 0.1f; Main.dust[index].noGravity = true; } if (Main.tile[x, y + 1] != null && Main.tile[x, y + 1].type == (ushort) 229 && (double) this.position.Y + (double) this.height > (double) ((y + 1) * 16)) { if ((double) (x * 16) < (double) this.position.X + (double) (this.width / 2)) { int index = Dust.NewDust(new Vector2(this.position.X - 4f, (float) (y * 16 + 16)), 4, 16, 153, Alpha: 50); Main.dust[index].scale += (float) Main.rand.Next(0, 6) * 0.1f; Main.dust[index].velocity *= 0.1f; Main.dust[index].noGravity = true; } else { int index = Dust.NewDust(new Vector2((float) ((double) this.position.X + (double) this.width - 2.0), (float) (y * 16 + 16)), 4, 16, 153, Alpha: 50); Main.dust[index].scale += (float) Main.rand.Next(0, 6) * 0.1f; Main.dust[index].velocity *= 0.1f; Main.dust[index].noGravity = true; } } if (Main.tile[x, y + 2] == null || Main.tile[x, y + 2].type != (ushort) 229 || (double) this.position.Y + (double) this.height <= (double) ((y + 2) * 16)) return; if ((double) (x * 16) < (double) this.position.X + (double) (this.width / 2)) { int index = Dust.NewDust(new Vector2(this.position.X - 4f, (float) (y * 16 + 32)), 4, 16, 153, Alpha: 50); Main.dust[index].scale += (float) Main.rand.Next(0, 6) * 0.1f; Main.dust[index].velocity *= 0.1f; Main.dust[index].noGravity = true; } else { int index = Dust.NewDust(new Vector2((float) ((double) this.position.X + (double) this.width - 2.0), (float) (y * 16 + 32)), 4, 16, 153, Alpha: 50); Main.dust[index].scale += (float) Main.rand.Next(0, 6) * 0.1f; Main.dust[index].velocity *= 0.1f; Main.dust[index].noGravity = true; } } else this.stickyBreak = 0; } public bool IsStackingItems() { for (int index = 0; index < this.inventoryChestStack.Length; ++index) { if (this.inventoryChestStack[index]) { if (this.inventory[index].type != 0 && this.inventory[index].stack != 0) return true; this.inventoryChestStack[index] = false; } } return false; } public void QuickStackAllChests() { if (this.IsStackingItems()) return; if (Main.netMode == 1) { for (int number = 10; number < 50; ++number) { if (this.inventory[number].type > 0 && this.inventory[number].stack > 0 && !this.inventory[number].favorited && (this.inventory[number].type < 71 || this.inventory[number].type > 74)) { NetMessage.SendData(5, number: this.whoAmI, number2: ((float) number), number3: ((float) this.inventory[number].prefix)); NetMessage.SendData(85, number: number); this.inventoryChestStack[number] = true; } } } else { bool flag = false; for (int index = 10; index < 50; ++index) { if (this.inventory[index].type > 0 && this.inventory[index].stack > 0 && !this.inventory[index].favorited) { int type = this.inventory[index].type; int stack = this.inventory[index].stack; this.inventory[index] = Chest.PutItemInNearbyChest(this.inventory[index], this.Center); if (this.inventory[index].type != type || this.inventory[index].stack != stack) flag = true; } } if (!flag) return; Main.PlaySound(7); } } public void CheckDrowning() { bool flag = Collision.DrownCollision(this.position, this.width, this.height, this.gravDir); if (this.armor[0].type == 250) flag = true; if (this.inventory[this.selectedItem].type == 186) { try { int index1 = (int) (((double) this.position.X + (double) (this.width / 2) + (double) (6 * this.direction)) / 16.0); int num = 0; if ((double) this.gravDir == -1.0) num = this.height; int index2 = (int) (((double) this.position.Y + (double) num - 44.0 * (double) this.gravDir) / 16.0); if (Main.tile[index1, index2].liquid < (byte) 128) { if (Main.tile[index1, index2] == null) Main.tile[index1, index2] = new Tile(); if (Main.tile[index1, index2].active() && Main.tileSolid[(int) Main.tile[index1, index2].type]) { if (!Main.tileSolidTop[(int) Main.tile[index1, index2].type]) goto label_13; } flag = false; } } catch { } } label_13: if (this.gills) flag = false; if (Main.myPlayer == this.whoAmI) { if (this.merman) flag = false; if (flag) { ++this.breathCD; int num = 7; if (this.inventory[this.selectedItem].type == 186) num *= 2; if (this.accDivingHelm) num *= 4; if (this.breathCD >= num) { this.breathCD = 0; --this.breath; if (this.breath == 0) Main.PlaySound(23); if (this.breath <= 0) { this.lifeRegenTime = 0; this.breath = 0; this.statLife -= 2; if (this.statLife <= 0) { this.statLife = 0; this.KillMe(PlayerDeathReason.ByOther(1), 10.0, 0); } } } } else { this.breath += 3; if (this.breath > this.breathMax) this.breath = this.breathMax; this.breathCD = 0; } } if (!flag || Main.rand.Next(20) != 0 || this.lavaWet || this.honeyWet) return; int num1 = 0; if ((double) this.gravDir == -1.0) num1 += this.height - 12; if (this.inventory[this.selectedItem].type == 186) Dust.NewDust(new Vector2((float) ((double) this.position.X + (double) (10 * this.direction) + 4.0), (float) ((double) this.position.Y + (double) num1 - 54.0 * (double) this.gravDir)), this.width - 8, 8, 34, Scale: 1.2f); else Dust.NewDust(new Vector2(this.position.X + (float) (12 * this.direction), (float) ((double) this.position.Y + (double) num1 + 4.0 * (double) this.gravDir)), this.width - 8, 8, 34, Scale: 1.2f); } public void CheckIceBreak() { if ((double) this.velocity.Y <= 7.0) return; Vector2 vector2 = this.position + this.velocity; int num1 = (int) ((double) vector2.X / 16.0); int num2 = (int) (((double) vector2.X + (double) this.width) / 16.0); int num3 = (int) (((double) this.position.Y + (double) this.height + 1.0) / 16.0); for (int i = num1; i <= num2; ++i) { for (int j = num3; j <= num3 + 1; ++j) { if (Main.tile[i, j].nactive() && Main.tile[i, j].type == (ushort) 162 && !WorldGen.SolidTile(i, j - 1)) { WorldGen.KillTile(i, j); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) i), number3: ((float) j)); } } } } public void SlopeDownMovement() { this.sloping = false; float y = this.velocity.Y; Vector4 vector4 = Collision.WalkDownSlope(this.position, this.velocity, this.width, this.height, this.gravity * this.gravDir); this.position.X = vector4.X; this.position.Y = vector4.Y; this.velocity.X = vector4.Z; this.velocity.Y = vector4.W; if ((double) this.velocity.Y == (double) y) return; this.sloping = true; } public void HoneyCollision(bool fallThrough, bool ignorePlats) { int Height = !this.onTrack ? this.height : this.height - 20; Vector2 velocity = this.velocity; this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, Height, fallThrough, ignorePlats, (int) this.gravDir); Vector2 vector2 = this.velocity * 0.25f; if ((double) this.velocity.X != (double) velocity.X) vector2.X = this.velocity.X; if ((double) this.velocity.Y != (double) velocity.Y) vector2.Y = this.velocity.Y; this.position = this.position + vector2; } public void WaterCollision(bool fallThrough, bool ignorePlats) { int Height = !this.onTrack ? this.height : this.height - 20; Vector2 velocity = this.velocity; this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, Height, fallThrough, ignorePlats, (int) this.gravDir); Vector2 vector2 = this.velocity * 0.5f; if ((double) this.velocity.X != (double) velocity.X) vector2.X = this.velocity.X; if ((double) this.velocity.Y != (double) velocity.Y) vector2.Y = this.velocity.Y; this.position = this.position + vector2; } public void DryCollision(bool fallThrough, bool ignorePlats) { int Height = !this.onTrack ? this.height : this.height - 10; if ((double) this.velocity.Length() > 16.0) { Vector2 vector2_1 = Collision.TileCollision(this.position, this.velocity, this.width, Height, fallThrough, ignorePlats, (int) this.gravDir); float num1 = this.velocity.Length(); Vector2 vector2_2 = Vector2.Normalize(this.velocity); if ((double) vector2_1.Y == 0.0) vector2_2.Y = 0.0f; Vector2 zero1 = Vector2.Zero; bool flag = this.mount.Type == 7 || this.mount.Type == 8 || this.mount.Type == 12; Vector2 zero2 = Vector2.Zero; while ((double) num1 > 0.0) { float num2 = num1; if ((double) num2 > 16.0) num2 = 16f; num1 -= num2; Vector2 velocity1 = vector2_2 * num2; this.velocity = velocity1; this.SlopeDownMovement(); velocity1 = this.velocity; if ((double) this.velocity.Y == (double) this.gravity && (!this.mount.Active || !this.mount.Cart && !flag)) Collision.StepDown(ref this.position, ref velocity1, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, (int) this.gravDir, this.waterWalk || this.waterWalk2); if ((double) this.gravDir == -1.0) { if ((this.carpetFrame != -1 || (double) this.velocity.Y <= (double) this.gravity) && !this.controlUp) Collision.StepUp(ref this.position, ref velocity1, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, (int) this.gravDir, this.controlUp); } else if (flag || (this.carpetFrame != -1 || (double) this.velocity.Y >= (double) this.gravity) && !this.controlDown && !this.mount.Cart) Collision.StepUp(ref this.position, ref velocity1, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, (int) this.gravDir, this.controlUp); Vector2 Velocity = Collision.TileCollision(this.position, velocity1, this.width, Height, fallThrough, ignorePlats, (int) this.gravDir); if (Collision.up && (double) this.gravDir == 1.0) this.jump = 0; if (this.waterWalk || this.waterWalk2) { Vector2 velocity2 = this.velocity; Velocity = Collision.WaterCollision(this.position, Velocity, this.width, this.height, fallThrough, lavaWalk: this.waterWalk); Vector2 velocity3 = this.velocity; if (velocity2 != velocity3) this.fallStart = (int) ((double) this.position.Y / 16.0); } this.position = this.position + Velocity; bool Falling = false; if ((double) Velocity.Y > (double) this.gravity) Falling = true; if ((double) Velocity.Y < -(double) this.gravity) Falling = true; this.velocity = Velocity; this.UpdateTouchingTiles(); this.TryBouncingBlocks(Falling); this.TryLandingOnDetonator(); this.SlopingCollision(fallThrough); Collision.StepConveyorBelt((Entity) this, this.gravDir); Vector2 velocity4 = this.velocity; zero1 += velocity4; } this.velocity = zero1; } else { this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, Height, fallThrough, ignorePlats, (int) this.gravDir); if (Collision.up && (double) this.gravDir == 1.0) this.jump = 0; if (this.waterWalk || this.waterWalk2) { Vector2 velocity5 = this.velocity; this.velocity = Collision.WaterCollision(this.position, this.velocity, this.width, this.height, fallThrough, lavaWalk: this.waterWalk); Vector2 velocity6 = this.velocity; if (velocity5 != velocity6) this.fallStart = (int) ((double) this.position.Y / 16.0); } this.position = this.position + this.velocity; } } public void SlopingCollision(bool fallThrough) { if (this.controlDown || this.grappling[0] >= 0 || (double) this.gravDir == -1.0) this.stairFall = true; Vector4 vector4 = Collision.SlopeCollision(this.position, this.velocity, this.width, this.height, this.gravity, this.stairFall); if (Collision.stairFall) this.stairFall = true; else if (!fallThrough) this.stairFall = false; if (Collision.stair && (double) Math.Abs(vector4.Y - this.position.Y) > 8.0 + (double) Math.Abs(this.velocity.X)) { this.gfxOffY -= vector4.Y - this.position.Y; this.stepSpeed = 4f; } Vector2 velocity = this.velocity; this.position.X = vector4.X; this.position.Y = vector4.Y; this.velocity.X = vector4.Z; this.velocity.Y = vector4.W; if ((double) this.gravDir != -1.0 || (double) this.velocity.Y != 0.0100999996066093) return; this.velocity.Y = 0.0f; } public void FloorVisuals(bool Falling) { int index1 = (int) (((double) this.position.X + (double) (this.width / 2)) / 16.0); int index2 = (int) (((double) this.position.Y + (double) this.height) / 16.0); if ((double) this.gravDir == -1.0) index2 = (int) ((double) this.position.Y - 0.100000001490116) / 16; int type = -1; if (Main.tile[index1 - 1, index2] == null) Main.tile[index1 - 1, index2] = new Tile(); if (Main.tile[index1 + 1, index2] == null) Main.tile[index1 + 1, index2] = new Tile(); if (Main.tile[index1, index2] == null) Main.tile[index1, index2] = new Tile(); if (Main.tile[index1, index2].nactive() && Main.tileSolid[(int) Main.tile[index1, index2].type]) type = (int) Main.tile[index1, index2].type; else if (Main.tile[index1 - 1, index2].nactive() && Main.tileSolid[(int) Main.tile[index1 - 1, index2].type]) type = (int) Main.tile[index1 - 1, index2].type; else if (Main.tile[index1 + 1, index2].nactive() && Main.tileSolid[(int) Main.tile[index1 + 1, index2].type]) type = (int) Main.tile[index1 + 1, index2].type; if (type <= -1) { this.slippy = false; this.slippy2 = false; this.sticky = false; this.powerrun = false; } else { this.sticky = type == 229; this.slippy = type == 161 || type == 162 || type == 163 || type == 164 || type == 200 || type == (int) sbyte.MaxValue; this.slippy2 = type == 197; this.powerrun = type == 198; if (Main.tile[index1 - 1, index2].slope() != (byte) 0 || Main.tile[index1, index2].slope() != (byte) 0 || Main.tile[index1 + 1, index2].slope() != (byte) 0) type = -1; if ((this.wet ? 0 : (!this.mount.Cart ? 1 : 0)) == 0) return; this.MakeFloorDust(Falling, type); } } private void MakeFloorDust(bool Falling, int type) { 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 != 371) return; int num1 = 1; if (Falling) num1 = 20; for (int index1 = 0; index1 < num1; ++index1) { bool flag = true; int Type = 76; if (type == 53) Type = 32; if (type == 189) Type = 16; if (type == 0) Type = 0; if (type == 123) Type = 53; if (type == 57) Type = 36; if (type == 112) Type = 14; if (type == 116) Type = 51; if (type == 196) Type = 108; if (type == 193) Type = 4; if (type == 195 || type == 199) Type = 5; if (type == 197) Type = 4; if (type == 229) Type = 153; if (type == 371) Type = 243; if (type == 25) Type = 37; if (Type == 32 && Main.rand.Next(2) == 0) flag = false; if (Type == 14 && Main.rand.Next(2) == 0) flag = false; if (Type == 51 && Main.rand.Next(2) == 0) flag = false; if (Type == 36 && Main.rand.Next(2) == 0) flag = false; if (Type == 0 && Main.rand.Next(3) != 0) flag = false; if (Type == 53 && Main.rand.Next(3) != 0) flag = false; Color newColor = new Color(); if (type == 193) newColor = new Color(30, 100, (int) byte.MaxValue, 100); if (type == 197) newColor = new Color(97, 200, (int) byte.MaxValue, 100); if (!Falling) { float num2 = Math.Abs(this.velocity.X) / 3f; if ((double) Main.rand.Next(100) > (double) num2 * 100.0) flag = false; } if (flag) { float num3 = this.velocity.X; if ((double) num3 > 6.0) num3 = 6f; if ((double) num3 < -6.0) num3 = -6f; if ((double) this.velocity.X != 0.0 | Falling) { int index2 = Dust.NewDust(new Vector2(this.position.X, (float) ((double) this.position.Y + (double) this.height - 2.0)), this.width, 6, Type, Alpha: 50, newColor: newColor); if ((double) this.gravDir == -1.0) Main.dust[index2].position.Y -= (float) (this.height + 4); if (Type == 76) { Main.dust[index2].scale += (float) Main.rand.Next(3) * 0.1f; Main.dust[index2].noLight = true; } if (Type == 16 || Type == 108 || Type == 153) Main.dust[index2].scale += (float) Main.rand.Next(6) * 0.1f; if (Type == 37) { Main.dust[index2].scale += 0.25f; Main.dust[index2].alpha = 50; } if (Type == 5) Main.dust[index2].scale += (float) Main.rand.Next(2, 8) * 0.1f; Main.dust[index2].noGravity = true; if (num1 > 1) { Main.dust[index2].velocity.X *= 1.2f; Main.dust[index2].velocity.Y *= 0.8f; --Main.dust[index2].velocity.Y; Main.dust[index2].velocity *= 0.8f; Main.dust[index2].scale += (float) Main.rand.Next(3) * 0.1f; Main.dust[index2].velocity.X = (float) (((double) Main.dust[index2].position.X - ((double) this.position.X + (double) (this.width / 2))) * 0.200000002980232); if ((double) Main.dust[index2].velocity.Y > 0.0) Main.dust[index2].velocity.Y *= -1f; Main.dust[index2].velocity.X += num3 * 0.3f; } else Main.dust[index2].velocity *= 0.2f; Main.dust[index2].position.X -= num3 * 1f; if ((double) this.gravDir == -1.0) Main.dust[index2].velocity.Y *= -1f; } } } } public void BordersMovement() { if ((double) this.position.X < (double) Main.leftWorld + 640.0 + 16.0) { this.position.X = (float) ((double) Main.leftWorld + 640.0 + 16.0); this.velocity.X = 0.0f; } if ((double) this.position.X + (double) this.width > (double) Main.rightWorld - 640.0 - 32.0) { this.position.X = (float) ((double) Main.rightWorld - 640.0 - 32.0) - (float) this.width; this.velocity.X = 0.0f; } if ((double) this.position.Y < (double) Main.topWorld + 640.0 + 16.0) { this.position.Y = (float) ((double) Main.topWorld + 640.0 + 16.0); if ((double) this.velocity.Y < 0.11) this.velocity.Y = 0.11f; this.gravDir = 1f; AchievementsHelper.HandleSpecialEvent(this, 11); } if ((double) this.position.Y > (double) Main.bottomWorld - 640.0 - 32.0 - (double) this.height) { this.position.Y = (float) ((double) Main.bottomWorld - 640.0 - 32.0) - (float) this.height; this.velocity.Y = 0.0f; } if ((double) this.position.Y <= (double) Main.bottomWorld - 640.0 - 150.0 - (double) this.height) return; AchievementsHelper.HandleSpecialEvent(this, 10); } public void CollectTaxes() { int num1 = Item.buyPrice(copper: 50); int num2 = Item.buyPrice(gold: 10); if (!NPC.taxCollector || this.taxMoney >= num2) return; int num3 = 0; for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && !Main.npc[index].homeless && NPC.TypeToHeadIndex(Main.npc[index].type) > 0) ++num3; } this.taxMoney += num1 * num3; if (this.taxMoney <= num2) return; this.taxMoney = num2; } public void GamepadEnableGrappleCooldown() => this._quickGrappleCooldown = 3; public void Update(int i) { // ISSUE: unable to decompile the method. } private void UpdateArmorLights() { if (this.vortexStealthActive) return; float num1 = 0.0f; float num2 = 0.0f; float num3 = 0.0f; switch (this.head) { case 11: num1 = 0.92f; num2 = 0.8f; num3 = 0.65f; break; case 169: num1 = 0.0f; num2 = 0.36f; num3 = 0.4f; break; case 170: num1 = 0.4f; num2 = 0.16f; num3 = 0.36f; break; case 171: num1 = 0.5f; num2 = 0.25f; num3 = 0.05f; break; case 178: num1 = 0.1f; num2 = 0.2f; num3 = 0.3f; break; case 189: num1 = 0.9f; num2 = 0.9f; num3 = 0.7f; break; case 211: num1 = 0.2f; num2 = 0.4f; num3 = 0.8f; break; } float num4 = 0.0f; float num5 = 0.0f; float num6 = 0.0f; switch (this.body) { case 175: num4 = 0.0f; num5 = 0.36f; num6 = 0.4f; break; case 176: num4 = 0.4f; num5 = 0.16f; num6 = 0.36f; break; case 177: num4 = 0.5f; num5 = 0.25f; num6 = 0.05f; break; case 190: num1 = 0.9f; num2 = 0.9f; num3 = 0.7f; break; case 205: num4 = 0.2f; num5 = 0.4f; num6 = 0.8f; break; } float num7 = 0.0f; float num8 = 0.0f; float num9 = 0.0f; switch (this.legs) { case 110: num7 = 0.0f; num8 = 0.36f; num9 = 0.4f; break; case 111: num7 = 0.4f; num8 = 0.16f; num9 = 0.36f; break; case 112: num7 = 0.5f; num8 = 0.25f; num9 = 0.05f; break; case 130: num1 = 0.9f; num2 = 0.9f; num3 = 0.7f; break; } if ((double) num1 != 0.0 || (double) num2 != 0.0 || (double) num3 != 0.0) { float num10 = 1f; if ((double) num1 == (double) num4 && (double) num2 == (double) num5 && (double) num3 == (double) num6) num10 += 0.5f; if ((double) num1 == (double) num7 && (double) num2 == (double) num8 && (double) num3 == (double) num9) num10 += 0.5f; Vector2 spinningpoint = new Vector2((float) (this.width / 2 + 8 * this.direction), 2f); if ((double) this.fullRotation != 0.0) spinningpoint = spinningpoint.RotatedBy((double) this.fullRotation, this.fullRotationOrigin); Lighting.AddLight((int) ((double) this.position.X + (double) spinningpoint.X) / 16, (int) ((double) this.position.Y + (double) spinningpoint.Y) / 16, num1 * num10, num2 * num10, num3 * num10); } if ((double) num4 != 0.0 || (double) num5 != 0.0 || (double) num6 != 0.0) { float num11 = 1f; if ((double) num4 == (double) num1 && (double) num5 == (double) num2 && (double) num6 == (double) num3) num11 += 0.5f; if ((double) num4 == (double) num7 && (double) num5 == (double) num8 && (double) num6 == (double) num9) num11 += 0.5f; Vector2 spinningpoint = new Vector2((float) (this.width / 2 + 8), (float) (this.height / 2)); if ((double) this.fullRotation != 0.0) spinningpoint = spinningpoint.RotatedBy((double) this.fullRotation, this.fullRotationOrigin); Lighting.AddLight((int) ((double) this.position.X + (double) spinningpoint.X) / 16, (int) ((double) this.position.Y + (double) spinningpoint.Y) / 16, num4 * num11, num5 * num11, num6 * num11); } if ((double) num7 == 0.0 && (double) num8 == 0.0 && (double) num9 == 0.0) return; float num12 = 1f; if ((double) num7 == (double) num4 && (double) num8 == (double) num5 && (double) num9 == (double) num6) num12 += 0.5f; if ((double) num7 == (double) num1 && (double) num8 == (double) num2 && (double) num9 == (double) num3) num12 += 0.5f; Vector2 spinningpoint1 = new Vector2((float) (this.width / 2 + 8 * this.direction), (float) this.height * 0.75f); if ((double) this.fullRotation != 0.0) spinningpoint1 = spinningpoint1.RotatedBy((double) this.fullRotation, this.fullRotationOrigin); Lighting.AddLight((int) ((double) this.position.X + (double) spinningpoint1.X) / 16, (int) ((double) this.position.Y + (double) spinningpoint1.Y) / 16, num7 * num12, num8 * num12, num9 * num12); } private void Update_NPCCollision() { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height); for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && !Main.npc[index].friendly && Main.npc[index].damage > 0) { int specialHitSetter = -1; switch (Main.npc[index].type) { case 396: case 397: case 398: case 400: case 401: specialHitSetter = 1; break; } if ((specialHitSetter != -1 || !this.immune) && (this.dash != 2 || index != this.eocHit || this.eocDash <= 0) && !this.npcTypeNoAggro[Main.npc[index].type]) { float damageMultiplier = 1f; Microsoft.Xna.Framework.Rectangle npcRect = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].position.X, (int) Main.npc[index].position.Y, Main.npc[index].width, Main.npc[index].height); NPC.GetMeleeCollisionData(rectangle, index, ref specialHitSetter, ref damageMultiplier, ref npcRect); if (rectangle.Intersects(npcRect) && !this.npcTypeNoAggro[Main.npc[index].type]) { bool flag1 = true; bool flag2 = false; int num1 = this.CanParryAgainst(rectangle, npcRect, Main.npc[index].velocity) ? 1 : 0; float num2 = this.thorns; float knockback = 10f; if (this.turtleThorns) num2 = 1f; if (num1 != 0) { num2 = 2f; knockback = 5f; flag1 = false; flag2 = true; } int hitDirection = -1; if ((double) Main.npc[index].position.X + (double) (Main.npc[index].width / 2) < (double) this.position.X + (double) (this.width / 2)) hitDirection = 1; int Damage = Main.DamageVar((float) Main.npc[index].damage * damageMultiplier); int banner = Item.NPCtoBanner(Main.npc[index].BannerID()); if (banner > 0 && this.NPCBannerBuff[banner]) Damage = !Main.expertMode ? (int) ((double) Damage * (double) ItemID.Sets.BannerStrength[Item.BannerToItem(banner)].NormalDamageReceived) : (int) ((double) Damage * (double) ItemID.Sets.BannerStrength[Item.BannerToItem(banner)].ExpertDamageReceived); if (this.whoAmI == Main.myPlayer && (double) num2 > 0.0 && !this.immune && !Main.npc[index].dontTakeDamage) { int damage = (int) ((double) Damage * (double) num2); this.ApplyDamageToNPC(Main.npc[index], damage, knockback, -hitDirection, false); } if (this.resistCold && Main.npc[index].coldDamage) Damage = (int) ((double) Damage * 0.699999988079071); if (!this.immune && !flag2) this.StatusPlayer(Main.npc[index]); if (flag1) this.Hurt(PlayerDeathReason.ByNPC(index), Damage, hitDirection, cooldownCounter: specialHitSetter); if (num1 != 0) { this.immune = true; this.immuneNoBlink = true; this.immuneTime = 30; if (this.longInvince) this.immuneTime = 60; this.AddBuff(198, 300, false); } } } } } } public bool CanParryAgainst( Microsoft.Xna.Framework.Rectangle blockingPlayerRect, Microsoft.Xna.Framework.Rectangle enemyRect, Vector2 enemyVelocity) { return this.shieldParryTimeLeft > 0 && Math.Sign(enemyRect.Center.X - blockingPlayerRect.Center.X) == this.direction && enemyVelocity != Vector2.Zero && !this.immune; } private void PurgeDD2EnergyCrystals() { if (this.trashItem.type == 3822) this.trashItem.TurnToAir(); for (int index = 0; index < 58; ++index) { Item obj = this.inventory[index]; if (obj.stack > 0 && obj.type == 3822) obj.TurnToAir(); } if (this.chest == -2) { Chest bank = this.bank; for (int index = 0; index < 40; ++index) { if (bank.item[index].stack > 0 && bank.item[index].type == 3822) bank.item[index].TurnToAir(); } } if (this.chest == -4) { Chest bank3 = this.bank3; for (int index = 0; index < 40; ++index) { if (bank3.item[index].stack > 0 && bank3.item[index].type == 3822) bank3.item[index].TurnToAir(); } } if (this.chest == -3) { Chest bank2 = this.bank2; for (int index = 0; index < 40; ++index) { if (bank2.item[index].stack > 0 && bank2.item[index].type == 3822) bank2.item[index].TurnToAir(); } } if (this.chest <= -1) return; Chest chest = Main.chest[this.chest]; for (int index = 0; index < 40; ++index) { if (chest.item[index].stack > 0 && chest.item[index].type == 3822) { chest.item[index].TurnToAir(); if (Main.netMode == 1) NetMessage.SendData(32, number: this.chest, number2: ((float) index)); } } } public void ItemCheck_ManageRightClickFeatures() { bool theGeneralCheck = this.selectedItem != 58 && this.controlUseTile && !this.tileInteractionHappened && this.releaseUseItem && !this.controlUseItem && !this.mouseInterface && !CaptureManager.Instance.Active && !Main.HoveringOverAnNPC && !Main.SmartInteractShowingGenuine; if (theGeneralCheck && this.altFunctionUse == 0 && this.inventory[this.selectedItem].type == 3384) { this.altFunctionUse = 1; this.controlUseItem = true; } if (theGeneralCheck && this.altFunctionUse == 0 && this.inventory[this.selectedItem].type == 3858) { this.altFunctionUse = 1; this.controlUseItem = true; } if (theGeneralCheck && this.altFunctionUse == 0 && this.inventory[this.selectedItem].type == 3852 && this.itemAnimation == 0 && this.CheckMana(20, true)) { this.altFunctionUse = 1; this.controlUseItem = true; } if (theGeneralCheck && this.altFunctionUse == 0 && this.inventory[this.selectedItem].shoot > 0 && ProjectileID.Sets.TurretFeature[this.inventory[this.selectedItem].shoot]) { this.altFunctionUse = 1; this.controlUseItem = true; } if (theGeneralCheck && this.altFunctionUse == 0 && this.inventory[this.selectedItem].shoot > 0 && ProjectileID.Sets.MinionTargettingFeature[this.inventory[this.selectedItem].shoot]) { this.altFunctionUse = 1; this.controlUseItem = true; } if (!this.controlUseItem && this.altFunctionUse == 1) this.altFunctionUse = 0; this.ItemCheck_ManageRightClickFeatures_ShieldRaise(theGeneralCheck); } public void ItemCheck_ManageRightClickFeatures_ShieldRaise(bool theGeneralCheck) { bool flag = false; if (theGeneralCheck && this.inventory[this.selectedItem].type == 3823 && this.hasRaisableShield && !this.mount.Active && (this.itemAnimation == 0 || PlayerInput.Triggers.JustPressed.MouseRight)) flag = true; if (this.shield_parry_cooldown > 0) { --this.shield_parry_cooldown; if (this.shield_parry_cooldown == 0) { Main.PlaySound(25); for (int index1 = 0; index1 < 10; ++index1) { int index2 = Dust.NewDust(this.Center + new Vector2((float) (this.direction * 6 + (this.direction == -1 ? -10 : 0)), -14f), 10, 16, 45, Alpha: ((int) byte.MaxValue), newColor: new Color((int) byte.MaxValue, 100, 0, (int) sbyte.MaxValue), Scale: ((float) Main.rand.Next(10, 16) * 0.1f)); Main.dust[index2].noLight = true; Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 0.5f; } } } if (this.shieldParryTimeLeft > 0 && ++this.shieldParryTimeLeft > 20) this.shieldParryTimeLeft = 0; if (flag != this.shieldRaised) { this.shieldRaised = flag; if (this.shieldRaised) { if (this.shield_parry_cooldown == 0) this.shieldParryTimeLeft = 1; this.itemAnimation = 0; this.itemTime = 0; this.reuseDelay = 0; } else { this.shield_parry_cooldown = 15; this.shieldParryTimeLeft = 0; if (this.attackCD < 20) this.attackCD = 20; } } int num = this.shieldRaised ? 1 : 0; } private void HandleHotbar() { int num = PlayerInput.Triggers.Current.HotbarPlus.ToInt() - PlayerInput.Triggers.Current.HotbarMinus.ToInt(); if (PlayerInput.CurrentProfile.HotbarAllowsRadial && num != 0 && PlayerInput.Triggers.Current.HotbarHoldTime > PlayerInput.CurrentProfile.HotbarRadialHoldTimeRequired && PlayerInput.CurrentProfile.HotbarRadialHoldTimeRequired != -1) { PlayerInput.MiscSettingsTEMP.HotbarRadialShouldBeUsed = true; PlayerInput.Triggers.Current.HotbarScrollCD = 2; } if (PlayerInput.CurrentProfile.HotbarRadialHoldTimeRequired != -1) { num = PlayerInput.Triggers.JustReleased.HotbarPlus.ToInt() - PlayerInput.Triggers.JustReleased.HotbarMinus.ToInt(); if (PlayerInput.Triggers.Current.HotbarScrollCD == 1 && num != 0) num = 0; } if (PlayerInput.Triggers.Current.HotbarScrollCD == 0 && num != 0) { this.HotbarOffset += num; PlayerInput.Triggers.Current.HotbarScrollCD = 8; } if (!Main.inFancyUI && !Main.ingameOptionsWindow) this.HotbarOffset += PlayerInput.ScrollWheelDelta / -120; this.ScrollHotbar(this.HotbarOffset); this.HotbarOffset = 0; } private void ItemCheckWrapped(int i) { LockOnHelper.SetUP(); int stack = this.inventory[this.selectedItem].stack; if (Main.ignoreErrors) { try { this.ItemCheck(i); } catch { } } else this.ItemCheck(i); if (stack != this.inventory[this.selectedItem].stack) Recipe.FindRecipes(); LockOnHelper.SetDOWN(); } public void ScrollHotbar(int Offset) { while (Offset > 9) Offset -= 10; while (Offset < 0) Offset += 10; this.selectedItem += Offset; if (Offset != 0) { Main.PlaySound(12); int num = this.selectedItem - Offset; this.DpadRadial.ChangeSelection(-1); this.CircularRadial.ChangeSelection(-1); this.selectedItem = num + Offset; this.nonTorch = -1; } if (this.changeItem >= 0) { if (this.selectedItem != this.changeItem) Main.PlaySound(12); this.selectedItem = this.changeItem; this.changeItem = -1; } if (this.itemAnimation != 0 || this.selectedItem == 58) return; while (this.selectedItem > 9) this.selectedItem -= 10; while (this.selectedItem < 0) this.selectedItem += 10; } private void OldInput() { bool flag1 = false; bool flag2 = false; Keys[] pressedKeys = Main.keyState.GetPressedKeys(); for (int index = 0; index < pressedKeys.Length; ++index) { if (pressedKeys[index] == Keys.LeftShift || pressedKeys[index] == Keys.RightShift) flag1 = true; else if (pressedKeys[index] == Keys.LeftAlt || pressedKeys[index] == Keys.RightAlt) flag2 = true; } string blockKey = Main.blockKey; Keys keys = Keys.None; string str1 = keys.ToString(); if (blockKey != str1) { bool flag3 = false; for (int index = 0; index < pressedKeys.Length; ++index) { if (pressedKeys[index].ToString() == Main.blockKey) { pressedKeys[index] = Keys.None; flag3 = true; } } if (!flag3) { keys = Keys.None; Main.blockKey = keys.ToString(); } } for (int index = 0; index < pressedKeys.Length; ++index) { string str2 = string.Concat((object) pressedKeys[index]); if (pressedKeys[index] != Keys.Tab || ((!flag1 ? 0 : (SocialAPI.Mode == SocialMode.Steam ? 1 : 0)) | (flag2 ? 1 : 0)) == 0) { if (str2 == Main.cUp) this.controlUp = true; if (str2 == Main.cLeft) this.controlLeft = true; if (str2 == Main.cDown) this.controlDown = true; if (str2 == Main.cRight) this.controlRight = true; if (str2 == Main.cJump) this.controlJump = true; if (str2 == Main.cThrowItem) this.controlThrow = true; if (str2 == Main.cInv) this.controlInv = true; if (str2 == Main.cBuff) this.QuickBuff(); if (str2 == Main.cHeal) this.controlQuickHeal = true; if (str2 == Main.cMana) this.controlQuickMana = true; if (str2 == Main.cHook) this.controlHook = true; if (str2 == Main.cTorch) this.controlTorch = true; if (str2 == Main.cSmart) this.controlSmart = true; if (str2 == Main.cMount) this.controlMount = true; if (Main.mapEnabled) { if (str2 == Main.cMapZoomIn) this.mapZoomIn = true; if (str2 == Main.cMapZoomOut) this.mapZoomOut = true; if (str2 == Main.cMapAlphaUp) this.mapAlphaUp = true; if (str2 == Main.cMapAlphaDown) this.mapAlphaDown = true; if (str2 == Main.cMapFull) this.mapFullScreen = true; if (str2 == Main.cMapStyle) this.mapStyle = true; } } } if (Main.gamePad) { GamePadState state = GamePad.GetState(PlayerIndex.One); GamePadDPad dpad = state.DPad; if (dpad.Up == ButtonState.Pressed) this.controlUp = true; dpad = state.DPad; if (dpad.Down == ButtonState.Pressed) this.controlDown = true; dpad = state.DPad; if (dpad.Left == ButtonState.Pressed) this.controlLeft = true; dpad = state.DPad; if (dpad.Right == ButtonState.Pressed) this.controlRight = true; GamePadTriggers triggers = state.Triggers; if ((double) triggers.Left > 0.0) this.controlJump = true; triggers = state.Triggers; if ((double) triggers.Right > 0.0) this.controlUseItem = true; Main.mouseX = (int) ((double) (Main.screenWidth / 2) + (double) state.ThumbSticks.Right.X * (double) Player.tileRangeX * 16.0); Main.mouseY = (int) ((double) (Main.screenHeight / 2) - (double) state.ThumbSticks.Right.Y * (double) Player.tileRangeX * 16.0); if ((double) state.ThumbSticks.Right.X == 0.0) Main.mouseX = Main.screenWidth / 2 + this.direction * 2; } if (Main.mouseLeft) { if (!Main.blockMouse && !this.mouseInterface) this.controlUseItem = true; } else Main.blockMouse = false; if (!Main.mouseRight || this.mouseInterface || Main.blockMouse) return; this.controlUseTile = true; } private void LookForTileInteractions() { if (Main.mapFullscreen) return; int myX = Player.tileTargetX; int myY = Player.tileTargetY; if (Main.SmartInteractShowingGenuine && Main.SmartInteractNPC == -1) { myX = Main.SmartInteractX; myY = Main.SmartInteractY; } bool flag = this.controlUseTile; if (PlayerInput.UsingGamepad && Main.HoveringOverAnNPC) flag = false; if (this.releaseUseTile) this.tileInteractionHappened = false; this.tileInteractAttempted = flag; if ((double) this.position.X / 16.0 - (double) Player.tileRangeX <= (double) myX && ((double) this.position.X + (double) this.width) / 16.0 + (double) Player.tileRangeX - 1.0 >= (double) myX && (double) this.position.Y / 16.0 - (double) Player.tileRangeY <= (double) myY && ((double) this.position.Y + (double) this.height) / 16.0 + (double) Player.tileRangeY - 2.0 >= (double) myY) { this.TileInteractionsCheckLongDistance(Player.tileTargetX, Player.tileTargetY); this.TileInteractionsCheck(myX, myY); } else this.TileInteractionsCheckLongDistance(myX, myY); } public void TileInteractionsCheck(int myX, int myY) { if (Main.tile[myX, myY] == null) Main.tile[myX, myY] = new Tile(); if (!Main.tile[myX, myY].active()) return; this.TileInteractionsMouseOver(myX, myY); this.TileInteractionsUse(myX, myY); } private void TileInteractionsCheckLongDistance(int myX, int myY) { if (Main.tile[myX, myY] == null) Main.tile[myX, myY] = new Tile(); if (Main.tile[myX, myY].type == (ushort) 21) { this.TileInteractionsMouseOver_Containers(myX, myY); if (this.showItemIconText == "") { this.showItemIcon = false; this.showItemIcon2 = 0; } } if (Main.tile[myX, myY].type == (ushort) 88) { Tile tile = Main.tile[myX, myY]; int num1 = myX; int num2 = myY; int num3 = (int) tile.frameX % 54 / 18; int X = num1 - num3; if ((int) tile.frameY % 36 != 0) --num2; int Y = num2; int chest = Chest.FindChest(X, Y); this.showItemIcon2 = -1; if (chest < 0) { this.showItemIconText = Lang.dresserType[0].Value; } else { this.showItemIconText = !(Main.chest[chest].name != "") ? Lang.dresserType[(int) tile.frameX / 54].Value : Main.chest[chest].name; if (this.showItemIconText == Lang.dresserType[(int) tile.frameX / 54].Value) { this.showItemIcon2 = Chest.dresserTypeToIcon[(int) tile.frameX / 54]; this.showItemIconText = ""; } } this.noThrow = 2; this.showItemIcon = true; if (this.showItemIconText == "") { this.showItemIcon = false; this.showItemIcon2 = 0; } } if (!Main.tileSign[(int) Main.tile[myX, myY].type]) return; this.noThrow = 2; int num4 = (int) Main.tile[myX, myY].frameX / 18; int num5 = (int) Main.tile[myX, myY].frameY / 18; int num6 = num4 % 2; int i = myX - num6; int j = myY - num5; Main.signBubble = true; Main.signX = i * 16 + 16; Main.signY = j * 16; int num7 = Sign.ReadSign(i, j); if (num7 == -1) return; Main.signHover = num7; this.showItemIcon = false; this.showItemIcon2 = -1; } private void TileInteractionsUse(int myX, int myY) { if (WiresUI.Open || this.ownedProjectileCounts[651] > 0) return; bool releaseUseTile = this.releaseUseTile; if (!this.tileInteractAttempted) return; bool flag1 = false; if (Main.tile[myX, myY].type == (ushort) 212 && this.launcherWait <= 0) { int index1 = myX; int index2 = myY; bool flag2 = false; for (int index3 = 0; index3 < 58; ++index3) { if (this.inventory[index3].type == 949 && this.inventory[index3].stack > 0) { --this.inventory[index3].stack; if (this.inventory[index3].stack <= 0) this.inventory[index3].SetDefaults(); flag2 = true; break; } } if (flag2) { flag1 = true; this.launcherWait = 10; Main.PlaySound(SoundID.Item11, this.position); int num1 = (int) Main.tile[index1, index2].frameX / 18; int num2 = 0; for (; num1 >= 3; num1 -= 3) ++num2; int num3 = index1 - num1; int num4 = (int) Main.tile[index1, index2].frameY / 18; while (num4 >= 3) num4 -= 3; int num5 = index2 - num4; double num6 = 12.0 + (double) Main.rand.Next(450) * 0.00999999977648258; float num7 = (float) Main.rand.Next(85, 105); double num8 = (double) Main.rand.Next(-35, 11); int Type = 166; int Damage = 35; float KnockBack = 3.5f; Vector2 vector2 = new Vector2((float) ((num3 + 2) * 16 - 8), (float) ((num5 + 2) * 16 - 8)); if (num2 == 0) { num7 *= -1f; vector2.X -= 12f; } else vector2.X += 12f; float num9 = num7; float num10 = (float) num8; double num11 = Math.Sqrt((double) num9 * (double) num9 + (double) num10 * (double) num10); float num12 = (float) (num6 / num11); float SpeedX = num9 * num12; float SpeedY = num10 * num12; Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, Type, Damage, KnockBack, Main.myPlayer); } } if (releaseUseTile) { if (Main.tile[myX, myY].type == (ushort) 132 || Main.tile[myX, myY].type == (ushort) 136 || Main.tile[myX, myY].type == (ushort) 144) { flag1 = true; Wiring.HitSwitch(myX, myY); NetMessage.SendData(59, number: myX, number2: ((float) myY)); } else if (Main.tile[myX, myY].type == (ushort) 441 || Main.tile[myX, myY].type == (ushort) 468) { flag1 = true; int num13 = (int) Main.tile[myX, myY].frameX / 18; while (num13 > 1) num13 -= 2; int num14 = myX - num13; int num15 = myY - (int) Main.tile[myX, myY].frameY / 18; Animation.NewTemporaryAnimation(2, Main.tile[myX, myY].type, num14, num15); NetMessage.SendTemporaryAnimation(-1, 2, (int) Main.tile[myX, myY].type, num14, num15); Wiring.HitSwitch(myX, myY); NetMessage.SendData(59, number: myX, number2: ((float) myY)); } else if (Main.tile[myX, myY].type == (ushort) 139) { flag1 = true; Main.PlaySound(28, myX * 16, myY * 16, 0); WorldGen.SwitchMB(myX, myY); } else if (Main.tile[myX, myY].type == (ushort) 215) { flag1 = true; Main.PlaySound(28, myX * 16, myY * 16, 0); int num16 = (int) Main.tile[myX, myY].frameX % 54 / 18; int num17 = (int) Main.tile[myX, myY].frameY % 36 / 18; int index4 = myX - num16; int index5 = myY - num17; int num18 = 36; if (Main.tile[index4, index5].frameY >= (short) 36) num18 = -36; for (int index6 = index4; index6 < index4 + 3; ++index6) { for (int index7 = index5; index7 < index5 + 2; ++index7) Main.tile[index6, index7].frameY += (short) num18; } NetMessage.SendTileSquare(-1, index4 + 1, index5 + 1, 3); } else if (Main.tile[myX, myY].type == (ushort) 207) { flag1 = true; Main.PlaySound(28, myX * 16, myY * 16, 0); WorldGen.SwitchFountain(myX, myY); } else if (Main.tile[myX, myY].type == (ushort) 410) { flag1 = true; Main.PlaySound(28, myX * 16, myY * 16, 0); this.GamepadEnableGrappleCooldown(); WorldGen.SwitchMonolith(myX, myY); } else if (Main.tile[myX, myY].type == (ushort) 455) { flag1 = true; Main.PlaySound(28, myX * 16, myY * 16, 0); this.GamepadEnableGrappleCooldown(); BirthdayParty.ToggleManualParty(); } else if (Main.tile[myX, myY].type == (ushort) 216) { flag1 = true; WorldGen.LaunchRocket(myX, myY); } else if (Main.tile[myX, myY].type == (ushort) 386 || Main.tile[myX, myY].type == (ushort) 387) { flag1 = true; bool flag3 = Main.tile[myX, myY].type == (ushort) 387; int num = WorldGen.ShiftTrapdoor(myX, myY, (double) (myY * 16) > (double) this.Center.Y).ToInt(); if (num == 0) num = -WorldGen.ShiftTrapdoor(myX, myY, (double) (myY * 16) <= (double) this.Center.Y).ToInt(); if (num != 0) NetMessage.SendData(19, number: (2 + flag3.ToInt()), number2: ((float) myX), number3: ((float) myY), number4: ((float) (num * Math.Sign((float) (myY * 16) - this.Center.Y)))); } else if (Main.tile[myX, myY].type == (ushort) 388 || Main.tile[myX, myY].type == (ushort) 389) { flag1 = true; bool closing = Main.tile[myX, myY].type == (ushort) 389; WorldGen.ShiftTallGate(myX, myY, closing); NetMessage.SendData(19, number: (4 + closing.ToInt()), number2: ((float) myX), number3: ((float) myY)); } else if (Main.tile[myX, myY].type == (ushort) 335) { flag1 = true; WorldGen.LaunchRocketSmall(myX, myY); } else if (Main.tile[myX, myY].type == (ushort) 411 && Main.tile[myX, myY].frameX < (short) 36) { flag1 = true; Wiring.HitSwitch(myX, myY); NetMessage.SendData(59, number: myX, number2: ((float) myY)); } else if (Main.tile[myX, myY].type == (ushort) 338) { flag1 = true; int index8 = myX; int index9 = myY; if (Main.tile[index8, index9].frameY == (short) 18) --index9; bool flag4 = false; for (int index10 = 0; index10 < 1000; ++index10) { if (Main.projectile[index10].active && Main.projectile[index10].aiStyle == 73 && (double) Main.projectile[index10].ai[0] == (double) index8 && (double) Main.projectile[index10].ai[1] == (double) index9) { flag4 = true; break; } } if (!flag4) Projectile.NewProjectile((float) (index8 * 16 + 8), (float) (index9 * 16 + 2), 0.0f, 0.0f, 419 + Main.rand.Next(4), 0, 0.0f, this.whoAmI, (float) index8, (float) index9); } else if (Main.tile[myX, myY].type == (ushort) 4 || Main.tile[myX, myY].type == (ushort) 13 || Main.tile[myX, myY].type == (ushort) 33 || Main.tile[myX, myY].type == (ushort) 49 || Main.tile[myX, myY].type == (ushort) 50 && Main.tile[myX, myY].frameX == (short) 90 || Main.tile[myX, myY].type == (ushort) 174) { flag1 = true; WorldGen.KillTile(myX, myY); this.GamepadEnableGrappleCooldown(); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) myX), number3: ((float) myY)); } else if (Main.tile[myX, myY].type == (ushort) 466) { flag1 = true; this.GamepadEnableGrappleCooldown(); int y = myY; Tile tileSafely = Framing.GetTileSafely(myX, myY); if (tileSafely.frameY == (short) 0) y += 3; if (tileSafely.frameY == (short) 18) y += 2; if (tileSafely.frameY == (short) 36) ++y; bool flag5 = !DD2Event.Ongoing && !NPC.AnyNPCs(548) && !Main.pumpkinMoon && !Main.snowMoon; if (flag5) flag5 = this.HasItem(3828); if (flag5) { flag5 = !DD2Event.WouldFailSpawningHere(myX, y); if (!flag5) DD2Event.FailureMessage(-1); } if (flag5) flag5 = this.ConsumeItem(3828, true); if (flag5) DD2Event.SummonCrystal(myX, y); } else if (Main.tile[myX, myY].type == (ushort) 334) { flag1 = true; if (this.ItemFitsWeaponRack(this.inventory[this.selectedItem])) { this.GamepadEnableGrappleCooldown(); this.PlaceWeapon(myX, myY); } else { int num19 = myX; int j = myY; if (Main.tile[myX, myY].frameY == (short) 0) ++j; if (Main.tile[myX, myY].frameY == (short) 36) --j; int frameX = (int) Main.tile[myX, j].frameX; int num20 = (int) Main.tile[myX, j].frameX; int num21 = 0; while (num20 >= 5000) { num20 -= 5000; ++num21; } if (num21 != 0) num20 = (num21 - 1) * 18; int num22 = num20 % 54; if (num22 == 18) { frameX = (int) Main.tile[myX - 1, j].frameX; --num19; } if (num22 == 36) { frameX = (int) Main.tile[myX - 2, j].frameX; int num23 = num19 - 2; } if (frameX >= 5000) { this.GamepadEnableGrappleCooldown(); WorldGen.KillTile(myX, j, true); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) myX), number3: ((float) j), number4: 1f); } } } else if (Main.tile[myX, myY].type == (ushort) 440) { flag1 = true; int index = myX; int j = myY; int num24 = (int) Main.tile[index, j].frameX / 54; int num25 = (int) Main.tile[index, j].frameY / 54; int num26 = (int) Main.tile[index, j].frameX % 54 / 18; int num27 = (int) Main.tile[index, j].frameY % 54 / 18; int type = -1; switch (num24) { case 0: type = 1526; break; case 1: type = 1524; break; case 2: type = 1525; break; case 3: type = 1523; break; case 4: type = 1522; break; case 5: type = 1527; break; case 6: type = 3643; break; } if (type != -1) { if (num25 == 0 && this.HasItem(type) && this.selectedItem != 58) { this.GamepadEnableGrappleCooldown(); if (Main.netMode != 1) { this.ConsumeItem(type); WorldGen.ToggleGemLock(index, j, true); } else { this.ConsumeItem(type); NetMessage.SendData(105, number: index, number2: ((float) j), number3: 1f); } } else if (num25 == 1) { this.GamepadEnableGrappleCooldown(); if (Main.netMode != 1) WorldGen.ToggleGemLock(index, j, false); else NetMessage.SendData(105, number: index, number2: ((float) j)); } } } else if (Main.tile[myX, myY].type == (ushort) 395) { flag1 = true; if (this.ItemFitsItemFrame(this.inventory[this.selectedItem]) && !this.inventory[this.selectedItem].favorited) { this.GamepadEnableGrappleCooldown(); this.PlaceItemInFrame(myX, myY); } else { int x = myX; int index = myY; if ((int) Main.tile[x, index].frameX % 36 != 0) --x; if ((int) Main.tile[x, index].frameY % 36 != 0) --index; int key = TEItemFrame.Find(x, index); if (key != -1 && ((TEItemFrame) TileEntity.ByID[key]).item.stack > 0) { this.GamepadEnableGrappleCooldown(); WorldGen.KillTile(myX, index, true); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) myX), number3: ((float) index), number4: 1f); } } } else if (Main.tile[myX, myY].type == (ushort) 125) { flag1 = true; this.AddBuff(29, 36000); Main.PlaySound(SoundID.Item4, this.position); } else if (Main.tile[myX, myY].type == (ushort) 377) { flag1 = true; this.AddBuff(159, 36000); Main.PlaySound(SoundID.Item37, this.position); } else if (Main.tile[myX, myY].type == (ushort) 354) { flag1 = true; this.AddBuff(150, 36000); Main.PlaySound(SoundID.Item4, this.position); } else if (Main.tile[myX, myY].type == (ushort) 287) { flag1 = true; this.AddBuff(93, 36000); Main.PlaySound(7, (int) this.position.X, (int) this.position.Y); } else if (Main.tile[myX, myY].type == (ushort) 356) { flag1 = true; if (!Main.fastForwardTime && (Main.netMode == 1 || Main.sundialCooldown == 0)) { Main.Sundialing(); Main.PlaySound(SoundID.Item4, this.position); } } else if (Main.tile[myX, myY].type == (ushort) 79) { flag1 = true; int num28 = myX; int num29 = myY; int num30 = num28 + (int) Main.tile[myX, myY].frameX / 18 * -1; int x = Main.tile[myX, myY].frameX < (short) 72 ? num30 + 2 : num30 + 4 + 1; int num31 = (int) Main.tile[myX, myY].frameY / 18; int num32 = 0; while (num31 > 1) { num31 -= 2; ++num32; } int y = num29 - num31 + 2; this.FindSpawn(); if (this.SpawnX == x && this.SpawnY == y) { this.RemoveSpawn(); Main.NewText(Language.GetTextValue("Game.SpawnPointRemoved"), G: (byte) 240, B: (byte) 20); } else if (Player.CheckSpawn(x, y)) { this.ChangeSpawn(x, y); Main.NewText(Language.GetTextValue("Game.SpawnPointSet"), G: (byte) 240, B: (byte) 20); } } else if (Main.tileSign[(int) Main.tile[myX, myY].type]) { flag1 = true; bool flag6 = true; if (this.sign >= 0 && Sign.ReadSign(myX, myY) == this.sign) { this.sign = -1; Main.npcChatText = ""; Main.editSign = false; Main.PlaySound(11); flag6 = false; } if (flag6) { if (Main.netMode == 0) { this.talkNPC = -1; Main.npcChatCornerItem = 0; Main.playerInventory = false; Main.editSign = false; Main.PlaySound(10); int index = Sign.ReadSign(myX, myY); this.sign = index; Main.npcChatText = Main.sign[index].text; } else { int num33 = (int) Main.tile[myX, myY].frameX / 18; int num34 = (int) Main.tile[myX, myY].frameY / 18; while (num33 > 1) num33 -= 2; int number = myX - num33; int index = myY - num34; if (Main.tileSign[(int) Main.tile[number, index].type]) NetMessage.SendData(46, number: number, number2: ((float) index)); } } } else if (Main.tile[myX, myY].type == (ushort) 104) { flag1 = true; string str1 = "AM"; double time = Main.time; if (!Main.dayTime) time += 54000.0; double num35 = time / 86400.0 * 24.0 - 7.5 - 12.0; if (num35 < 0.0) num35 += 24.0; if (num35 >= 12.0) str1 = "PM"; int num36 = (int) num35; double num37 = (double) (int) ((num35 - (double) num36) * 60.0); string str2 = string.Concat((object) num37); if (num37 < 10.0) str2 = "0" + str2; if (num36 > 12) num36 -= 12; if (num36 == 0) num36 = 12; Main.NewText(Language.GetTextValue("Game.Time", (object) (num36.ToString() + ":" + str2 + " " + str1)), G: (byte) 240, B: (byte) 20); } else if (Main.tile[myX, myY].type == (ushort) 237) { flag1 = true; bool flag7 = false; if (!NPC.AnyNPCs(245) && Main.hardMode && NPC.downedPlantBoss) { for (int index = 0; index < 58; ++index) { if (this.inventory[index].type == 1293) { --this.inventory[index].stack; if (this.inventory[index].stack <= 0) this.inventory[index].SetDefaults(); flag7 = true; break; } } } if (flag7) { Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); if (Main.netMode != 1) NPC.SpawnOnPlayer(this.whoAmI, 245); else NetMessage.SendData(61, number: this.whoAmI, number2: 245f); } } else if (Main.tile[myX, myY].type == (ushort) 10) { flag1 = true; int num38 = myX; int num39 = myY; if (WorldGen.IsLockedDoor(num38, num39)) { int num40 = 1141; for (int index = 0; index < 58; ++index) { if (this.inventory[index].type == num40 && this.inventory[index].stack > 0) { --this.inventory[index].stack; if (this.inventory[index].stack <= 0) this.inventory[index] = new Item(); WorldGen.UnlockDoor(num38, num39); if (Main.netMode == 1) NetMessage.SendData(52, number: this.whoAmI, number2: 2f, number3: ((float) num38), number4: ((float) num39)); } } } else { WorldGen.OpenDoor(myX, myY, this.direction); NetMessage.SendData(19, number2: ((float) myX), number3: ((float) myY), number4: ((float) this.direction)); } } else if (Main.tile[myX, myY].type == (ushort) 11) { flag1 = true; if (WorldGen.CloseDoor(myX, myY)) NetMessage.SendData(19, number: 1, number2: ((float) myX), number3: ((float) myY), number4: ((float) this.direction)); } else if (Main.tile[myX, myY].type == (ushort) 88) { flag1 = true; if (Main.tile[myX, myY].frameY == (short) 0) { Main.CancelClothesWindow(true); Main.mouseRightRelease = false; int num41 = (int) Main.tile[myX, myY].frameX / 18 % 3; int num42 = myX - num41; int Y = myY - (int) Main.tile[myX, myY].frameY / 18; if (this.sign > -1) { Main.PlaySound(11); this.sign = -1; Main.editSign = false; Main.npcChatText = string.Empty; } if (Main.editChest) { Main.PlaySound(12); Main.editChest = false; Main.npcChatText = string.Empty; } if (this.editedChestName) { NetMessage.SendData(33, text: NetworkText.FromLiteral(Main.chest[this.chest].name), number: this.chest, number2: 1f); this.editedChestName = false; } if (Main.netMode == 1) { if (num42 == this.chestX && Y == this.chestY && this.chest != -1) { this.chest = -1; Recipe.FindRecipes(); Main.PlaySound(11); } else { NetMessage.SendData(31, number: num42, number2: ((float) Y)); Main.stackSplit = 600; } } else { this.flyingPigChest = -1; int chest = Chest.FindChest(num42, Y); if (chest != -1) { Main.stackSplit = 600; if (chest == this.chest) { this.chest = -1; Recipe.FindRecipes(); Main.PlaySound(11); } else if (chest != this.chest && this.chest == -1) { this.chest = chest; Main.playerInventory = true; if (PlayerInput.GrappleAndInteractAreShared) PlayerInput.Triggers.JustPressed.Grapple = false; Main.recBigList = false; Main.PlaySound(10); this.chestX = num42; this.chestY = Y; } else { this.chest = chest; Main.playerInventory = true; if (PlayerInput.GrappleAndInteractAreShared) PlayerInput.Triggers.JustPressed.Grapple = false; Main.recBigList = false; Main.PlaySound(12); this.chestX = num42; this.chestY = Y; } Recipe.FindRecipes(); } } } else { Main.playerInventory = false; this.chest = -1; Recipe.FindRecipes(); Main.dresserX = myX; Main.dresserY = myY; Main.OpenClothesWindow(); } } else if (Main.tile[myX, myY].type == (ushort) 209) { flag1 = true; Tile tile = Main.tile[myX, myY]; int num43 = (int) tile.frameX % 72 / 18; int num44 = (int) tile.frameY % 54 / 18; int x = myX - num43; int y = myY - num44; int angle = (int) tile.frameY / 54; int num45 = (int) tile.frameX / 72; int num46 = -1; if (num43 == 1 || num43 == 2) num46 = num44; int num47 = 0; if (num43 == 3 || num43 == 2 && num45 != 3 && num45 != 4) num47 = -54; if (num43 == 0 || num43 == 1 && num45 != 3 && num45 != 4) num47 = 54; if (angle >= 8 && num47 > 0) num47 = 0; if (angle == 0 && num47 < 0) num47 = 0; bool flag8 = false; if (num47 != 0) { for (int index11 = x; index11 < x + 4; ++index11) { for (int index12 = y; index12 < y + 3; ++index12) Main.tile[index11, index12].frameY += (short) num47; } flag8 = true; } if ((num45 == 3 || num45 == 4) && (num46 == 1 || num46 == 0)) { int num48 = num45 == 3 ? 72 : -72; for (int index13 = x; index13 < x + 4; ++index13) { for (int index14 = y; index14 < y + 3; ++index14) Main.tile[index13, index14].frameX += (short) num48; } flag8 = true; } if (flag8) NetMessage.SendTileSquare(-1, x + 1, y + 1, 4); if (num46 != -1) { bool flag9 = false; if ((num45 == 3 || num45 == 4) && num46 == 2) flag9 = true; if (flag9) WorldGen.ShootFromCannon(x, y, angle, num45 + 1, 0, 0.0f, this.whoAmI); } } else if ((TileID.Sets.BasicChest[(int) Main.tile[myX, myY].type] || Main.tile[myX, myY].type == (ushort) 29 || Main.tile[myX, myY].type == (ushort) 97 || Main.tile[myX, myY].type == (ushort) 463) && this.talkNPC == -1) { flag1 = true; Main.mouseRightRelease = false; int num49 = 0; int num50 = (int) Main.tile[myX, myY].frameX / 18; while (num50 > 1) num50 -= 2; int index15 = myX - num50; int index16 = myY - (int) Main.tile[myX, myY].frameY / 18; if (Main.tile[myX, myY].type == (ushort) 29) num49 = 1; else if (Main.tile[myX, myY].type == (ushort) 97) num49 = 2; else if (Main.tile[myX, myY].type == (ushort) 463) { num49 = 3; if (Main.tile[myX, myY].frameX == (short) 36) --index15; else ++index15; index16 += 2; } if (this.sign > -1) { Main.PlaySound(11); this.sign = -1; Main.editSign = false; Main.npcChatText = string.Empty; } if (Main.editChest) { Main.PlaySound(12); Main.editChest = false; Main.npcChatText = string.Empty; } if (this.editedChestName) { NetMessage.SendData(33, text: NetworkText.FromLiteral(Main.chest[this.chest].name), number: this.chest, number2: 1f); this.editedChestName = false; } if (Main.netMode == 1 && num49 == 0 && (Main.tile[index15, index16].frameX < (short) 72 || Main.tile[index15, index16].frameX > (short) 106) && (Main.tile[index15, index16].frameX < (short) 144 || Main.tile[index15, index16].frameX > (short) 178) && (Main.tile[index15, index16].frameX < (short) 828 || Main.tile[index15, index16].frameX > (short) 1006) && (Main.tile[index15, index16].frameX < (short) 1296 || Main.tile[index15, index16].frameX > (short) 1330) && (Main.tile[index15, index16].frameX < (short) 1368 || Main.tile[index15, index16].frameX > (short) 1402) && (Main.tile[index15, index16].frameX < (short) 1440 || Main.tile[index15, index16].frameX > (short) 1474)) { if (index15 == this.chestX && index16 == this.chestY && this.chest != -1) { this.chest = -1; Recipe.FindRecipes(); Main.PlaySound(11); } else { NetMessage.SendData(31, number: index15, number2: ((float) index16)); Main.stackSplit = 600; } } else { int num51 = -1; switch (num49) { case 1: num51 = -2; break; case 2: num51 = -3; break; case 3: num51 = -4; break; default: bool flag10 = false; if (Chest.isLocked(index15, index16)) { int num52 = 327; if (Main.tile[index15, index16].frameX >= (short) 144 && Main.tile[index15, index16].frameX <= (short) 178) num52 = 329; if (Main.tile[index15, index16].frameX >= (short) 828 && Main.tile[index15, index16].frameX <= (short) 1006) { int num53 = (int) Main.tile[index15, index16].frameX / 18; int num54 = 0; while (num53 >= 2) { num53 -= 2; ++num54; } num52 = 1533 + (num54 - 23); } flag10 = true; for (int index17 = 0; index17 < 58; ++index17) { if (this.inventory[index17].type == num52 && this.inventory[index17].stack > 0 && Chest.Unlock(index15, index16)) { if (num52 != 329) { --this.inventory[index17].stack; if (this.inventory[index17].stack <= 0) this.inventory[index17] = new Item(); } if (Main.netMode == 1) NetMessage.SendData(52, number: this.whoAmI, number2: 1f, number3: ((float) index15), number4: ((float) index16)); } } } if (!flag10) { num51 = Chest.FindChest(index15, index16); break; } break; } if (num51 != -1) { Main.stackSplit = 600; if (num51 == this.chest) { this.chest = -1; Main.PlaySound(11); } else if (num51 != this.chest && this.chest == -1) { this.chest = num51; Main.playerInventory = true; if (PlayerInput.GrappleAndInteractAreShared) PlayerInput.Triggers.JustPressed.Grapple = false; Main.recBigList = false; Main.PlaySound(10); this.chestX = index15; this.chestY = index16; if (Main.tile[index15, index16].frameX >= (short) 36 && Main.tile[index15, index16].frameX < (short) 72) AchievementsHelper.HandleSpecialEvent(this, 16); } else { this.chest = num51; Main.playerInventory = true; if (PlayerInput.GrappleAndInteractAreShared) PlayerInput.Triggers.JustPressed.Grapple = false; Main.recBigList = false; Main.PlaySound(12); this.chestX = index15; this.chestY = index16; } Recipe.FindRecipes(); } } } else if (Main.tile[myX, myY].type == (ushort) 314 && (double) this.gravDir == 1.0) { flag1 = true; bool flag11 = true; if (this.mount.Active) { if (this.mount.Cart) flag11 = false; else this.mount.Dismount(this); } if (flag11) this.LaunchMinecartHook(myX, myY); } } if (!flag1) return; this.tileInteractionHappened = true; } private void LaunchMinecartHook(int myX, int myY) { Vector2 vector2 = new Vector2((float) Main.mouseX + Main.screenPosition.X, (float) Main.mouseY + Main.screenPosition.Y); vector2 = new Vector2((float) (myX * 16 + 8), (float) (myY * 16 + 8)); this.minecartLeft = this.direction <= 0; this.grappling[0] = -1; this.grapCount = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == this.whoAmI && Main.projectile[index].aiStyle == 7) Main.projectile[index].Kill(); } Projectile.NewProjectile(vector2.X, vector2.Y, 0.0f, 0.0f, 403, 0, 0.0f, this.whoAmI); } private void TileInteractionsMouseOver(int myX, int myY) { if ((myX != Player.tileTargetX ? 0 : (myY == Player.tileTargetY ? 1 : 0)) == 0) return; if (Main.tile[myX, myY].type == (ushort) 79) { this.noThrow = 2; this.showItemIcon = true; int num = (int) Main.tile[myX, myY].frameY / 36; this.showItemIcon2 = num != 0 ? (num != 1 ? (num != 2 ? (num != 3 ? (num != 4 ? (num != 5 ? (num != 6 ? (num != 7 ? (num != 8 ? (num != 9 ? (num != 10 ? (num != 11 ? (num != 12 ? (num < 13 || num > 18 ? (num < 19 || num > 20 ? (num != 21 ? (num != 22 ? (num != 23 ? (num != 24 ? (num != 25 ? (num != 26 ? (num != 27 ? (num != 28 ? (num != 29 ? (num != 30 ? (num != 31 ? 646 : 3897) : 3163) : 3164) : 3162) : 2811) : 2669) : 2568) : 2553) : 2538) : 2520) : 2231) : 2139 + num - 19) : 2066 + num - 13) : 1722) : 1721) : 1720) : 1719) : 1473) : 1472) : 1471) : 1470) : 920) : 646) : 645) : 644) : 224; } if (Main.tile[myX, myY].type == (ushort) 33) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 105; int num = (int) Main.tile[myX, myY].frameY / 22; if (num == 1) this.showItemIcon2 = 1405; if (num == 2) this.showItemIcon2 = 1406; if (num == 3) this.showItemIcon2 = 1407; if (num >= 4 && num <= 13) this.showItemIcon2 = 2045 + num - 4; if (num >= 14 && num <= 16) this.showItemIcon2 = 2153 + num - 14; if (num == 17) this.showItemIcon2 = 2236; if (num == 18) this.showItemIcon2 = 2523; if (num == 19) this.showItemIcon2 = 2542; if (num == 20) this.showItemIcon2 = 2556; if (num == 21) this.showItemIcon2 = 2571; if (num == 22) this.showItemIcon2 = 2648; if (num == 23) this.showItemIcon2 = 2649; if (num == 24) this.showItemIcon2 = 2650; if (num == 25) this.showItemIcon2 = 2651; else if (num == 26) this.showItemIcon2 = 2818; else if (num == 27) this.showItemIcon2 = 3171; else if (num == 28) this.showItemIcon2 = 3173; else if (num == 29) this.showItemIcon2 = 3172; else if (num == 30) this.showItemIcon2 = 3890; } if (Main.tile[myX, myY].type == (ushort) 21) this.TileInteractionsMouseOver_Containers(myX, myY); if (Main.tile[myX, myY].type == (ushort) 467) this.TileInteractionsMouseOver_Containers(myX, myY); if (Main.tile[myX, myY].type == (ushort) 441) { Tile tile = Main.tile[myX, myY]; int num1 = myX; int num2 = myY; if ((int) tile.frameX % 36 != 0) { int num3 = num1 - 1; } if ((int) tile.frameY % 36 != 0) { int num4 = num2 - 1; } this.showItemIcon2 = -1; this.showItemIcon2 = Chest.chestTypeToIcon[(int) tile.frameX / 36]; this.noThrow = 2; this.showItemIcon = true; } if (Main.tile[myX, myY].type == (ushort) 468) { Tile tile = Main.tile[myX, myY]; int num5 = myX; int num6 = myY; if ((int) tile.frameX % 36 != 0) { int num7 = num5 - 1; } if ((int) tile.frameY % 36 != 0) { int num8 = num6 - 1; } this.showItemIcon2 = -1; this.showItemIcon2 = Chest.chestTypeToIcon2[(int) tile.frameX / 36]; this.noThrow = 2; this.showItemIcon = true; } if (Main.tile[myX, myY].type == (ushort) 88) { Tile tile = Main.tile[myX, myY]; int num9 = myX; int num10 = myY; int num11 = (int) tile.frameX % 54 / 18; int X = num9 - num11; if ((int) tile.frameY % 36 != 0) --num10; int Y = num10; int chest = Chest.FindChest(X, Y); this.showItemIcon2 = -1; if (chest < 0) { this.showItemIconText = Lang.dresserType[0].Value; } else { this.showItemIconText = !(Main.chest[chest].name != "") ? Lang.dresserType[(int) tile.frameX / 54].Value : Main.chest[chest].name; if (this.showItemIconText == Lang.dresserType[(int) tile.frameX / 54].Value) { this.showItemIcon2 = Chest.dresserTypeToIcon[(int) tile.frameX / 54]; this.showItemIconText = ""; } } this.noThrow = 2; this.showItemIcon = true; if (Main.tile[myX, myY].frameY > (short) 0) this.showItemIcon2 = 269; } if (Main.tile[myX, myY].type == (ushort) 10 || Main.tile[myX, myY].type == (ushort) 11) { Tile tile = Main.tile[myX, myY]; this.noThrow = 2; this.showItemIcon = true; int frameY = (int) tile.frameY; int num = 0; while (frameY >= 54) { frameY -= 54; ++num; } if (tile.type == (ushort) 10) num += 36 * ((int) tile.frameX / 54); if (tile.type == (ushort) 11) num += 36 * ((int) tile.frameX / 72); this.showItemIcon2 = num != 0 ? (num != 9 ? (num != 10 ? (num != 11 ? (num != 12 ? (num != 13 ? (num != 14 ? (num != 15 ? (num != 16 ? (num != 17 ? (num != 18 ? (num != 19 ? (num < 20 || num > 23 ? (num != 24 ? (num != 25 ? (num != 26 ? (num != 27 ? (num != 28 ? (num != 29 ? (num != 30 ? (num != 31 ? (num != 32 ? (num != 33 ? (num != 34 ? (num != 35 ? (num != 36 ? (num < 4 || num > 8 ? 649 + num : 812 + num) : 3888) : 3130) : 3131) : 3129) : 2815) : 2576) : 2561) : 2528) : 2265) : 2044) : 1924) : 1815) : 1793) : 1709 + num - 20) : 1458) : 1413) : 1412) : 1411) : 1140) : 1139) : 1138) : 1137) : 1141) : 912) : 837) : 25; } if (Main.tile[myX, myY].type == (ushort) 104) { this.noThrow = 2; this.showItemIcon = true; switch ((int) Main.tile[myX, myY].frameX / 36) { case 0: this.showItemIcon2 = 359; break; case 1: this.showItemIcon2 = 2237; break; case 2: this.showItemIcon2 = 2238; break; case 3: this.showItemIcon2 = 2239; break; case 4: this.showItemIcon2 = 2240; break; case 5: this.showItemIcon2 = 2241; break; case 6: this.showItemIcon2 = 2560; break; case 7: this.showItemIcon2 = 2575; break; case 8: this.showItemIcon2 = 2591; break; case 9: this.showItemIcon2 = 2592; break; case 10: this.showItemIcon2 = 2593; break; case 11: this.showItemIcon2 = 2594; break; case 12: this.showItemIcon2 = 2595; break; case 13: this.showItemIcon2 = 2596; break; case 14: this.showItemIcon2 = 2597; break; case 15: this.showItemIcon2 = 2598; break; case 16: this.showItemIcon2 = 2599; break; case 17: this.showItemIcon2 = 2600; break; case 18: this.showItemIcon2 = 2601; break; case 19: this.showItemIcon2 = 2602; break; case 20: this.showItemIcon2 = 2603; break; case 21: this.showItemIcon2 = 2604; break; case 22: this.showItemIcon2 = 2605; break; case 23: this.showItemIcon2 = 2606; break; case 24: this.showItemIcon2 = 2809; break; case 25: this.showItemIcon2 = 3126; break; case 26: this.showItemIcon2 = 3128; break; case 27: this.showItemIcon2 = 3127; break; case 28: this.showItemIcon2 = 3898; break; case 29: this.showItemIcon2 = 3899; break; case 30: this.showItemIcon2 = 3900; break; case 31: this.showItemIcon2 = 3901; break; case 32: this.showItemIcon2 = 3902; break; } } if (Main.tile[myX, myY].type == (ushort) 356) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 3064; } if (Main.tile[myX, myY].type == (ushort) 377) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 3198; } if (Main.tile[myX, myY].type == (ushort) 209) { this.noThrow = 2; this.showItemIcon = true; if (Main.tile[myX, myY].frameX < (short) 72) this.showItemIcon2 = 928; else if (Main.tile[myX, myY].frameX < (short) 144) this.showItemIcon2 = 1337; else if (Main.tile[myX, myY].frameX < (short) 216) this.showItemIcon2 = 3369; else if (Main.tile[myX, myY].frameX < (short) 360) this.showItemIcon2 = 3664; int num = (int) Main.tile[myX, myY].frameX / 18; while (num >= 4) num -= 4; this.showItemIconR = num < 2; } if (Main.tile[myX, myY].type == (ushort) 216) { this.noThrow = 2; this.showItemIcon = true; int frameY = (int) Main.tile[myX, myY].frameY; int num = 0; while (frameY >= 40) { frameY -= 40; ++num; } this.showItemIcon2 = 970 + num; } if (Main.tile[myX, myY].type == (ushort) 387 || Main.tile[myX, myY].type == (ushort) 386) { this.noThrow = 2; this.showItemIcon = true; int x = 0; int y = 0; WorldGen.GetTopLeftAndStyles(ref x, ref y, 2, 1 + (Main.tile[myX, myY].type == (ushort) 386).ToInt(), 18, 18); this.showItemIcon2 = 3239; } if (Main.tile[myX, myY].type == (ushort) 389 || Main.tile[myX, myY].type == (ushort) 388) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 3240; } if (Main.tile[myX, myY].type == (ushort) 335) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 2700; } if (Main.tile[myX, myY].type == (ushort) 410) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 3536 + Math.Min((int) Main.tile[myX, myY].frameX / 36, 3); } if (Main.tile[myX, myY].type == (ushort) 463) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 3813; } if (Main.tile[myX, myY].type == (ushort) 411 && Main.tile[myX, myY].frameX < (short) 36) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 3545; } if (Main.tile[myX, myY].type == (ushort) 338) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 2738; } if (Main.tile[myX, myY].type == (ushort) 455) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 3747; } if (Main.tile[myX, myY].type == (ushort) 219 && (this.inventory[this.selectedItem].type == 424 || this.inventory[this.selectedItem].type == 1103)) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = this.inventory[this.selectedItem].type; } if (Main.tile[myX, myY].type == (ushort) 212) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 949; } if (Main.tile[myX, myY].type == (ushort) 314 && (double) this.gravDir == 1.0) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 2343; } if (Main.tile[myX, myY].type == (ushort) 215) { this.noThrow = 2; this.showItemIcon = true; int num = (int) Main.tile[myX, myY].frameX / 54; switch (num) { case 0: this.showItemIcon2 = 966; break; case 5: this.showItemIcon2 = 3050; break; case 6: this.showItemIcon2 = 3723; break; case 7: this.showItemIcon2 = 3724; break; default: this.showItemIcon2 = 3046 + num - 1; break; } } if (Main.tile[myX, myY].type == (ushort) 4) { this.noThrow = 2; this.showItemIcon = true; int num = (int) Main.tile[myX, myY].frameY / 22; switch (num) { case 0: this.showItemIcon2 = 8; break; case 8: this.showItemIcon2 = 523; break; case 9: this.showItemIcon2 = 974; break; case 10: this.showItemIcon2 = 1245; break; case 11: this.showItemIcon2 = 1333; break; case 12: this.showItemIcon2 = 2274; break; case 13: this.showItemIcon2 = 3004; break; case 14: this.showItemIcon2 = 3045; break; case 15: this.showItemIcon2 = 3114; break; default: this.showItemIcon2 = 426 + num; break; } } if (Main.tile[myX, myY].type == (ushort) 13) { this.noThrow = 2; this.showItemIcon = true; switch ((int) Main.tile[myX, myY].frameX / 18) { case 1: this.showItemIcon2 = 28; break; case 2: this.showItemIcon2 = 110; break; case 3: this.showItemIcon2 = 350; break; case 4: this.showItemIcon2 = 351; break; case 5: this.showItemIcon2 = 2234; break; case 6: this.showItemIcon2 = 2244; break; case 7: this.showItemIcon2 = 2257; break; case 8: this.showItemIcon2 = 2258; break; default: this.showItemIcon2 = 31; break; } } if (Main.tile[myX, myY].type == (ushort) 29) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 87; } if (Main.tile[myX, myY].type == (ushort) 97) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 346; } if (Main.tile[myX, myY].type == (ushort) 49) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 148; } if (Main.tile[myX, myY].type == (ushort) 174) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 713; } if (Main.tile[myX, myY].type == (ushort) 50) { this.noThrow = 2; if (Main.tile[myX, myY].frameX == (short) 90) { this.showItemIcon = true; this.showItemIcon2 = 165; } } if (Main.tile[myX, myY].type == (ushort) 139) { this.noThrow = 2; int index1 = myX; int index2 = myY; int num = 0; for (int index3 = (int) Main.tile[index1, index2].frameY / 18; index3 >= 2; index3 -= 2) ++num; this.showItemIcon = true; this.showItemIcon2 = num != 28 ? (num != 29 ? (num != 30 ? (num != 31 ? (num != 32 ? (num != 33 ? (num != 34 ? (num != 35 ? (num != 36 ? (num != 37 ? (num != 38 ? (num != 39 ? (num < 13 ? 562 + num : 1596 + num - 13) : 3869) : 3796) : 3371) : 3370) : 3237) : 3236) : 3235) : 3044) : 2742) : 1965) : 1964) : 1963; } if (Main.tile[myX, myY].type == (ushort) 207) { this.noThrow = 2; int index4 = myX; int index5 = myY; int num = 0; for (int index6 = (int) Main.tile[index4, index5].frameX / 18; index6 >= 2; index6 -= 2) ++num; this.showItemIcon = true; switch (num) { case 0: this.showItemIcon2 = 909; break; case 1: this.showItemIcon2 = 910; break; case 2: this.showItemIcon2 = 940; break; case 3: this.showItemIcon2 = 941; break; case 4: this.showItemIcon2 = 942; break; case 5: this.showItemIcon2 = 943; break; case 6: this.showItemIcon2 = 944; break; case 7: this.showItemIcon2 = 945; break; } } if (Main.tileSign[(int) Main.tile[myX, myY].type]) { this.noThrow = 2; int num12 = (int) Main.tile[myX, myY].frameX / 18; int num13 = (int) Main.tile[myX, myY].frameY / 18; int num14 = num12 % 2; int i = myX - num14; int j = myY - num13; Main.signBubble = true; Main.signX = i * 16 + 16; Main.signY = j * 16; int num15 = Sign.ReadSign(i, j, false); if (num15 != -1) Main.signHover = num15; if (num15 != -1) { Main.signHover = num15; this.showItemIcon = false; this.showItemIcon2 = -1; } } if (Main.tile[myX, myY].type == (ushort) 237) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 1293; } if (Main.tile[myX, myY].type == (ushort) 466) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 3828; } if (Main.tile[myX, myY].type == (ushort) 125) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 487; } if (Main.tile[myX, myY].type == (ushort) 354) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 2999; } if (Main.tile[myX, myY].type == (ushort) 287) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 2177; } if (Main.tile[myX, myY].type == (ushort) 132) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 513; } if (Main.tile[myX, myY].type == (ushort) 136) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 538; } if (Main.tile[myX, myY].type == (ushort) 144) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 583 + (int) Main.tile[myX, myY].frameX / 18; } if (Main.tile[myX, myY].type != (ushort) 440) return; int index = myY; int num16 = (int) Main.tile[myX, index].frameX / 54; int num17 = (int) Main.tile[myX, index].frameY / 54; int type = -1; switch (num16) { case 0: type = 1526; break; case 1: type = 1524; break; case 2: type = 1525; break; case 3: type = 1523; break; case 4: type = 1522; break; case 5: type = 1527; break; case 6: type = 3643; break; } if (type == -1 || num17 != 1 && !this.HasItem(type)) return; this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = type; } public Color ChatColor() { switch (this.difficulty) { case 1: return Main.mcColor; case 2: return Main.hcColor; default: return Color.White; } } private void TileInteractionsMouseOver_Containers(int myX, int myY) { LocalizedText[] localizedTextArray = Lang.chestType; int[] numArray = Chest.chestTypeToIcon; Tile tile = Main.tile[myX, myY]; if (tile.type == (ushort) 467) { localizedTextArray = Lang.chestType2; numArray = Chest.chestTypeToIcon2; } int X = myX; int Y = myY; if ((int) tile.frameX % 36 != 0) --X; if ((int) tile.frameY % 36 != 0) --Y; int chest = Chest.FindChest(X, Y); this.showItemIcon2 = -1; if (chest < 0) { this.showItemIconText = localizedTextArray[0].Value; } else { this.showItemIconText = !(Main.chest[chest].name != "") ? localizedTextArray[(int) tile.frameX / 36].Value : Main.chest[chest].name; if (this.showItemIconText == localizedTextArray[(int) tile.frameX / 36].Value) { this.showItemIcon2 = numArray[(int) tile.frameX / 36]; this.showItemIconText = ""; } } this.noThrow = 2; this.showItemIcon = true; } private void TryLandingOnDetonator() { if (this.whoAmI != Main.myPlayer || (double) this.velocity.Y < 3.0) return; Point tileCoordinates = (this.Bottom + new Vector2(0.0f, 0.01f)).ToTileCoordinates(); Tile tileSafely = Framing.GetTileSafely(tileCoordinates.X, tileCoordinates.Y); if (!tileSafely.active() || tileSafely.type != (ushort) 411 || tileSafely.frameY != (short) 0 || tileSafely.frameX >= (short) 36) return; Wiring.HitSwitch(tileCoordinates.X, tileCoordinates.Y); NetMessage.SendData(59, number: tileCoordinates.X, number2: ((float) tileCoordinates.Y)); } private void TryBouncingBlocks(bool Falling) { if ((double) this.velocity.Y < 5.0 && (double) this.velocity.Y > -5.0 || this.wet) return; int num = 0; bool flag = false; foreach (Point touchedTile in this.TouchedTiles) { Tile tile = Main.tile[touchedTile.X, touchedTile.Y]; if (tile != null && tile.active() && tile.nactive() && Main.tileBouncy[(int) tile.type]) { flag = true; num = touchedTile.Y; break; } } if (!flag) return; this.velocity.Y *= -0.8f; if (this.controlJump) this.velocity.Y = MathHelper.Clamp(this.velocity.Y, -13f, 13f); this.position.Y = (float) (num * 16 - ((double) this.velocity.Y < 0.0 ? this.height : -16)); this.FloorVisuals(Falling); this.velocity.Y = MathHelper.Clamp(this.velocity.Y, -20f, 20f); if ((double) this.velocity.Y * (double) this.gravDir >= 0.0) return; this.fallStart = (int) this.position.Y / 16; } private void GrabItems(int i) { for (int number = 0; number < 400; ++number) { if (Main.item[number].active && Main.item[number].noGrabDelay == 0 && Main.item[number].owner == i) { int defaultItemGrabRange = Player.defaultItemGrabRange; if (this.goldRing && Main.item[number].type >= 71 && Main.item[number].type <= 74) defaultItemGrabRange += Item.coinGrabRange; if (this.manaMagnet && (Main.item[number].type == 184 || Main.item[number].type == 1735 || Main.item[number].type == 1868)) defaultItemGrabRange += Item.manaGrabRange; if (this.lifeMagnet && (Main.item[number].type == 58 || Main.item[number].type == 1734 || Main.item[number].type == 1867)) defaultItemGrabRange += Item.lifeGrabRange; if (Main.item[number].type == 3822) defaultItemGrabRange += 50; if (ItemID.Sets.NebulaPickup[Main.item[number].type]) defaultItemGrabRange += 100; if (new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height).Intersects(new Microsoft.Xna.Framework.Rectangle((int) Main.item[number].position.X, (int) Main.item[number].position.Y, Main.item[number].width, Main.item[number].height))) { if (i == Main.myPlayer && (this.inventory[this.selectedItem].type != 0 || this.itemAnimation <= 0)) { if (ItemID.Sets.NebulaPickup[Main.item[number].type]) { Main.PlaySound(7, (int) this.position.X, (int) this.position.Y); int buffType = Main.item[number].buffType; Main.item[number] = new Item(); if (Main.netMode == 1) { NetMessage.SendData(102, number: i, number2: ((float) buffType), number3: this.Center.X, number4: this.Center.Y); NetMessage.SendData(21, number: number); } else this.NebulaLevelup(buffType); } if (Main.item[number].type == 58 || Main.item[number].type == 1734 || Main.item[number].type == 1867) { Main.PlaySound(7, (int) this.position.X, (int) this.position.Y); this.statLife += 20; if (Main.myPlayer == this.whoAmI) this.HealEffect(20); if (this.statLife > this.statLifeMax2) this.statLife = this.statLifeMax2; Main.item[number] = new Item(); if (Main.netMode == 1) NetMessage.SendData(21, number: number); } else if (Main.item[number].type == 184 || Main.item[number].type == 1735 || Main.item[number].type == 1868) { Main.PlaySound(7, (int) this.position.X, (int) this.position.Y); this.statMana += 100; if (Main.myPlayer == this.whoAmI) this.ManaEffect(100); if (this.statMana > this.statManaMax2) this.statMana = this.statManaMax2; Main.item[number] = new Item(); if (Main.netMode == 1) NetMessage.SendData(21, number: number); } else { Main.item[number] = this.GetItem(i, Main.item[number]); if (Main.netMode == 1) NetMessage.SendData(21, number: number); } } } else if (new Microsoft.Xna.Framework.Rectangle((int) this.position.X - defaultItemGrabRange, (int) this.position.Y - defaultItemGrabRange, this.width + defaultItemGrabRange * 2, this.height + defaultItemGrabRange * 2).Intersects(new Microsoft.Xna.Framework.Rectangle((int) Main.item[number].position.X, (int) Main.item[number].position.Y, Main.item[number].width, Main.item[number].height)) && this.ItemSpace(Main.item[number])) { Main.item[number].beingGrabbed = true; if (this.manaMagnet && (Main.item[number].type == 184 || Main.item[number].type == 1735 || Main.item[number].type == 1868)) { Vector2 vector2 = new Vector2(Main.item[number].position.X + (float) (Main.item[number].width / 2), Main.item[number].position.Y + (float) (Main.item[number].height / 2)); float num1 = this.Center.X - vector2.X; float num2 = this.Center.Y - vector2.Y; float num3 = (float) (12.0 / Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2)); float num4 = num1 * num3; float num5 = num2 * num3; int num6 = 5; Main.item[number].velocity.X = (Main.item[number].velocity.X * (float) (num6 - 1) + num4) / (float) num6; Main.item[number].velocity.Y = (Main.item[number].velocity.Y * (float) (num6 - 1) + num5) / (float) num6; } else if (this.lifeMagnet && (Main.item[number].type == 58 || Main.item[number].type == 1734 || Main.item[number].type == 1867)) { Vector2 vector2 = new Vector2(Main.item[number].position.X + (float) (Main.item[number].width / 2), Main.item[number].position.Y + (float) (Main.item[number].height / 2)); float num7 = this.Center.X - vector2.X; float num8 = this.Center.Y - vector2.Y; float num9 = (float) (15.0 / Math.Sqrt((double) num7 * (double) num7 + (double) num8 * (double) num8)); float num10 = num7 * num9; float num11 = num8 * num9; int num12 = 5; Main.item[number].velocity.X = (Main.item[number].velocity.X * (float) (num12 - 1) + num10) / (float) num12; Main.item[number].velocity.Y = (Main.item[number].velocity.Y * (float) (num12 - 1) + num11) / (float) num12; } else if (this.goldRing && Main.item[number].type >= 71 && Main.item[number].type <= 74) { Vector2 vector2 = new Vector2(Main.item[number].position.X + (float) (Main.item[number].width / 2), Main.item[number].position.Y + (float) (Main.item[number].height / 2)); float num13 = this.Center.X - vector2.X; float num14 = this.Center.Y - vector2.Y; float num15 = (float) (12.0 / Math.Sqrt((double) num13 * (double) num13 + (double) num14 * (double) num14)); float num16 = num13 * num15; float num17 = num14 * num15; int num18 = 5; Main.item[number].velocity.X = (Main.item[number].velocity.X * (float) (num18 - 1) + num16) / (float) num18; Main.item[number].velocity.Y = (Main.item[number].velocity.Y * (float) (num18 - 1) + num17) / (float) num18; } else if (ItemID.Sets.NebulaPickup[Main.item[number].type]) { Vector2 vector2 = new Vector2(Main.item[number].position.X + (float) (Main.item[number].width / 2), Main.item[number].position.Y + (float) (Main.item[number].height / 2)); float num19 = this.Center.X - vector2.X; float num20 = this.Center.Y - vector2.Y; float num21 = (float) (12.0 / Math.Sqrt((double) num19 * (double) num19 + (double) num20 * (double) num20)); float num22 = num19 * num21; float num23 = num20 * num21; int num24 = 5; Main.item[number].velocity.X = (Main.item[number].velocity.X * (float) (num24 - 1) + num22) / (float) num24; Main.item[number].velocity.Y = (Main.item[number].velocity.Y * (float) (num24 - 1) + num23) / (float) num24; } else { if ((double) this.position.X + (double) this.width * 0.5 > (double) Main.item[number].position.X + (double) Main.item[number].width * 0.5) { if ((double) Main.item[number].velocity.X < (double) Player.itemGrabSpeedMax + (double) this.velocity.X) Main.item[number].velocity.X += Player.itemGrabSpeed; if ((double) Main.item[number].velocity.X < 0.0) Main.item[number].velocity.X += Player.itemGrabSpeed * 0.75f; } else { if ((double) Main.item[number].velocity.X > -(double) Player.itemGrabSpeedMax + (double) this.velocity.X) Main.item[number].velocity.X -= Player.itemGrabSpeed; if ((double) Main.item[number].velocity.X > 0.0) Main.item[number].velocity.X -= Player.itemGrabSpeed * 0.75f; } if ((double) this.position.Y + (double) this.height * 0.5 > (double) Main.item[number].position.Y + (double) Main.item[number].height * 0.5) { if ((double) Main.item[number].velocity.Y < (double) Player.itemGrabSpeedMax) Main.item[number].velocity.Y += Player.itemGrabSpeed; if ((double) Main.item[number].velocity.Y < 0.0) Main.item[number].velocity.Y += Player.itemGrabSpeed * 0.75f; } else { if ((double) Main.item[number].velocity.Y > -(double) Player.itemGrabSpeedMax) Main.item[number].velocity.Y -= Player.itemGrabSpeed; if ((double) Main.item[number].velocity.Y > 0.0) Main.item[number].velocity.Y -= Player.itemGrabSpeed * 0.75f; } } } } } } public bool SellItem(int price, int stack) { if (price <= 0) return false; Item[] objArray = new Item[58]; for (int index = 0; index < 58; ++index) { objArray[index] = new Item(); objArray[index] = this.inventory[index].Clone(); } int num1 = price / 5; if (num1 < 1) num1 = 1; int num2 = num1 * stack; bool flag = false; while (num2 >= 1000000 && !flag) { int index = -1; for (int i = 53; i >= 0; --i) { if (index == -1 && (this.inventory[i].type == 0 || this.inventory[i].stack == 0)) index = i; while (this.inventory[i].type == 74 && this.inventory[i].stack < this.inventory[i].maxStack && num2 >= 1000000) { ++this.inventory[i].stack; num2 -= 1000000; this.DoCoins(i); if (this.inventory[i].stack == 0 && index == -1) index = i; } } if (num2 >= 1000000) { if (index == -1) { flag = true; } else { this.inventory[index].SetDefaults(74); num2 -= 1000000; } } } while (num2 >= 10000 && !flag) { int index = -1; for (int i = 53; i >= 0; --i) { if (index == -1 && (this.inventory[i].type == 0 || this.inventory[i].stack == 0)) index = i; while (this.inventory[i].type == 73 && this.inventory[i].stack < this.inventory[i].maxStack && num2 >= 10000) { ++this.inventory[i].stack; num2 -= 10000; this.DoCoins(i); if (this.inventory[i].stack == 0 && index == -1) index = i; } } if (num2 >= 10000) { if (index == -1) { flag = true; } else { this.inventory[index].SetDefaults(73); num2 -= 10000; } } } while (num2 >= 100 && !flag) { int index = -1; for (int i = 53; i >= 0; --i) { if (index == -1 && (this.inventory[i].type == 0 || this.inventory[i].stack == 0)) index = i; while (this.inventory[i].type == 72 && this.inventory[i].stack < this.inventory[i].maxStack && num2 >= 100) { ++this.inventory[i].stack; num2 -= 100; this.DoCoins(i); if (this.inventory[i].stack == 0 && index == -1) index = i; } } if (num2 >= 100) { if (index == -1) { flag = true; } else { this.inventory[index].SetDefaults(72); num2 -= 100; } } } while (num2 >= 1 && !flag) { int index = -1; for (int i = 53; i >= 0; --i) { if (index == -1 && (this.inventory[i].type == 0 || this.inventory[i].stack == 0)) index = i; while (this.inventory[i].type == 71 && this.inventory[i].stack < this.inventory[i].maxStack && num2 >= 1) { ++this.inventory[i].stack; --num2; this.DoCoins(i); if (this.inventory[i].stack == 0 && index == -1) index = i; } } if (num2 >= 1) { if (index == -1) { flag = true; } else { this.inventory[index].SetDefaults(71); --num2; } } } if (!flag) return true; for (int index = 0; index < 58; ++index) this.inventory[index] = objArray[index].Clone(); return false; } public bool BuyItem(int price, int customCurrency = -1) { if (customCurrency != -1) return CustomCurrencyManager.BuyItem(this, price, customCurrency); bool overFlowing; long num1 = Utils.CoinsCount(out overFlowing, this.inventory, 58, 57, 56, 55, 54); long num2 = Utils.CoinsCount(out overFlowing, this.bank.item); long num3 = Utils.CoinsCount(out overFlowing, this.bank2.item); long num4 = Utils.CoinsCount(out overFlowing, this.bank3.item); if (Utils.CoinsCombineStacks(out overFlowing, num1, num2, num3, num4) < (long) price) return false; List inv = new List(); Dictionary> dictionary = new Dictionary>(); List slotsEmpty = new List(); List slotCoins = new List(); List slotEmptyBank = new List(); List slotEmptyBank2 = new List(); List slotEmptyBank3 = new List(); inv.Add(this.inventory); inv.Add(this.bank.item); inv.Add(this.bank2.item); inv.Add(this.bank3.item); for (int key = 0; key < inv.Count; ++key) dictionary[key] = new List(); dictionary[0] = new List() { 58, 57, 56, 55, 54 }; for (int index = 0; index < inv.Count; ++index) { for (int y = 0; y < inv[index].Length; ++y) { if (!dictionary[index].Contains(y) && inv[index][y].type >= 71 && inv[index][y].type <= 74) slotCoins.Add(new Point(index, y)); } } int num5 = 0; for (int y = inv[num5].Length - 1; y >= 0; --y) { if (!dictionary[num5].Contains(y) && (inv[num5][y].type == 0 || inv[num5][y].stack == 0)) slotsEmpty.Add(new Point(num5, y)); } int num6 = 1; for (int y = inv[num6].Length - 1; y >= 0; --y) { if (!dictionary[num6].Contains(y) && (inv[num6][y].type == 0 || inv[num6][y].stack == 0)) slotEmptyBank.Add(new Point(num6, y)); } int num7 = 2; for (int y = inv[num7].Length - 1; y >= 0; --y) { if (!dictionary[num7].Contains(y) && (inv[num7][y].type == 0 || inv[num7][y].stack == 0)) slotEmptyBank2.Add(new Point(num7, y)); } int num8 = 3; for (int y = inv[num8].Length - 1; y >= 0; --y) { if (!dictionary[num8].Contains(y) && (inv[num8][y].type == 0 || inv[num8][y].stack == 0)) slotEmptyBank3.Add(new Point(num8, y)); } return !Player.TryPurchasing(price, inv, slotCoins, slotsEmpty, slotEmptyBank, slotEmptyBank2, slotEmptyBank3); } private static bool TryPurchasing( int price, List inv, List slotCoins, List slotsEmpty, List slotEmptyBank, List slotEmptyBank2, List slotEmptyBank3) { long num1 = (long) price; Dictionary dictionary = new Dictionary(); bool flag = false; while (num1 > 0L) { long num2 = 1000000; for (int index = 0; index < 4; ++index) { if (num1 >= num2) { foreach (Point slotCoin in slotCoins) { if (inv[slotCoin.X][slotCoin.Y].type == 74 - index) { long num3 = num1 / num2; dictionary[slotCoin] = inv[slotCoin.X][slotCoin.Y].Clone(); if (num3 < (long) inv[slotCoin.X][slotCoin.Y].stack) { inv[slotCoin.X][slotCoin.Y].stack -= (int) num3; } else { inv[slotCoin.X][slotCoin.Y].SetDefaults(); slotsEmpty.Add(slotCoin); } num1 -= num2 * (long) (dictionary[slotCoin].stack - inv[slotCoin.X][slotCoin.Y].stack); } } } num2 /= 100L; } if (num1 > 0L) { if (slotsEmpty.Count > 0) { slotsEmpty.Sort(new Comparison(DelegateMethods.CompareYReverse)); Point point = new Point(-1, -1); for (int index1 = 0; index1 < inv.Count; ++index1) { long num4 = 10000; for (int index2 = 0; index2 < 3; ++index2) { if (num1 >= num4) { foreach (Point slotCoin in slotCoins) { if (slotCoin.X == index1 && inv[slotCoin.X][slotCoin.Y].type == 74 - index2 && inv[slotCoin.X][slotCoin.Y].stack >= 1) { List pointList = slotsEmpty; if (index1 == 1 && slotEmptyBank.Count > 0) pointList = slotEmptyBank; if (index1 == 2 && slotEmptyBank2.Count > 0) pointList = slotEmptyBank2; if (--inv[slotCoin.X][slotCoin.Y].stack <= 0) { inv[slotCoin.X][slotCoin.Y].SetDefaults(); pointList.Add(slotCoin); } dictionary[pointList[0]] = inv[pointList[0].X][pointList[0].Y].Clone(); inv[pointList[0].X][pointList[0].Y].SetDefaults(73 - index2); inv[pointList[0].X][pointList[0].Y].stack = 100; point = pointList[0]; pointList.RemoveAt(0); break; } } } if (point.X == -1 && point.Y == -1) num4 /= 100L; else break; } for (int index3 = 0; index3 < 2; ++index3) { if (point.X == -1 && point.Y == -1) { foreach (Point slotCoin in slotCoins) { if (slotCoin.X == index1 && inv[slotCoin.X][slotCoin.Y].type == 73 + index3 && inv[slotCoin.X][slotCoin.Y].stack >= 1) { List pointList = slotsEmpty; if (index1 == 1 && slotEmptyBank.Count > 0) pointList = slotEmptyBank; if (index1 == 2 && slotEmptyBank2.Count > 0) pointList = slotEmptyBank2; if (index1 == 3 && slotEmptyBank3.Count > 0) pointList = slotEmptyBank3; if (--inv[slotCoin.X][slotCoin.Y].stack <= 0) { inv[slotCoin.X][slotCoin.Y].SetDefaults(); pointList.Add(slotCoin); } dictionary[pointList[0]] = inv[pointList[0].X][pointList[0].Y].Clone(); inv[pointList[0].X][pointList[0].Y].SetDefaults(72 + index3); inv[pointList[0].X][pointList[0].Y].stack = 100; point = pointList[0]; pointList.RemoveAt(0); break; } } } } if (point.X != -1 && point.Y != -1) { slotCoins.Add(point); break; } } slotsEmpty.Sort(new Comparison(DelegateMethods.CompareYReverse)); slotEmptyBank.Sort(new Comparison(DelegateMethods.CompareYReverse)); slotEmptyBank2.Sort(new Comparison(DelegateMethods.CompareYReverse)); slotEmptyBank3.Sort(new Comparison(DelegateMethods.CompareYReverse)); } else { foreach (KeyValuePair keyValuePair in dictionary) inv[keyValuePair.Key.X][keyValuePair.Key.Y] = keyValuePair.Value.Clone(); flag = true; break; } } } return flag; } public bool BuyItemOld(int price) { if (price == 0) return true; long num1 = 0; Item[] objArray = new Item[54]; for (int index = 0; index < 54; ++index) { objArray[index] = new Item(); objArray[index] = this.inventory[index].Clone(); if (this.inventory[index].type == 71) num1 += (long) this.inventory[index].stack; if (this.inventory[index].type == 72) num1 += (long) (this.inventory[index].stack * 100); if (this.inventory[index].type == 73) num1 += (long) (this.inventory[index].stack * 10000); if (this.inventory[index].type == 74) num1 += (long) (this.inventory[index].stack * 1000000); } if (num1 < (long) price) return false; int num2 = price; while (num2 > 0) { if (num2 >= 1000000) { for (int index = 0; index < 54; ++index) { if (this.inventory[index].type == 74) { while (this.inventory[index].stack > 0 && num2 >= 1000000) { num2 -= 1000000; --this.inventory[index].stack; if (this.inventory[index].stack == 0) this.inventory[index].type = 0; } } } } if (num2 >= 10000) { for (int index = 0; index < 54; ++index) { if (this.inventory[index].type == 73) { while (this.inventory[index].stack > 0 && num2 >= 10000) { num2 -= 10000; --this.inventory[index].stack; if (this.inventory[index].stack == 0) this.inventory[index].type = 0; } } } } if (num2 >= 100) { for (int index = 0; index < 54; ++index) { if (this.inventory[index].type == 72) { while (this.inventory[index].stack > 0 && num2 >= 100) { num2 -= 100; --this.inventory[index].stack; if (this.inventory[index].stack == 0) this.inventory[index].type = 0; } } } } if (num2 >= 1) { for (int index = 0; index < 54; ++index) { if (this.inventory[index].type == 71) { while (this.inventory[index].stack > 0 && num2 >= 1) { --num2; --this.inventory[index].stack; if (this.inventory[index].stack == 0) this.inventory[index].type = 0; } } } } if (num2 > 0) { int index1 = -1; for (int index2 = 53; index2 >= 0; --index2) { if (this.inventory[index2].type == 0 || this.inventory[index2].stack == 0) { index1 = index2; break; } } if (index1 >= 0) { bool flag = true; if (num2 >= 10000) { for (int index3 = 0; index3 < 58; ++index3) { if (this.inventory[index3].type == 74 && this.inventory[index3].stack >= 1) { --this.inventory[index3].stack; if (this.inventory[index3].stack == 0) this.inventory[index3].type = 0; this.inventory[index1].SetDefaults(73); this.inventory[index1].stack = 100; flag = false; break; } } } else if (num2 >= 100) { for (int index4 = 0; index4 < 54; ++index4) { if (this.inventory[index4].type == 73 && this.inventory[index4].stack >= 1) { --this.inventory[index4].stack; if (this.inventory[index4].stack == 0) this.inventory[index4].type = 0; this.inventory[index1].SetDefaults(72); this.inventory[index1].stack = 100; flag = false; break; } } } else if (num2 >= 1) { for (int index5 = 0; index5 < 54; ++index5) { if (this.inventory[index5].type == 72 && this.inventory[index5].stack >= 1) { --this.inventory[index5].stack; if (this.inventory[index5].stack == 0) this.inventory[index5].type = 0; this.inventory[index1].SetDefaults(71); this.inventory[index1].stack = 100; flag = false; break; } } } if (flag) { if (num2 < 10000) { for (int index6 = 0; index6 < 54; ++index6) { if (this.inventory[index6].type == 73 && this.inventory[index6].stack >= 1) { --this.inventory[index6].stack; if (this.inventory[index6].stack == 0) this.inventory[index6].type = 0; this.inventory[index1].SetDefaults(72); this.inventory[index1].stack = 100; flag = false; break; } } } if (flag && num2 < 1000000) { for (int index7 = 0; index7 < 54; ++index7) { if (this.inventory[index7].type == 74 && this.inventory[index7].stack >= 1) { --this.inventory[index7].stack; if (this.inventory[index7].stack == 0) this.inventory[index7].type = 0; this.inventory[index1].SetDefaults(73); this.inventory[index1].stack = 100; break; } } } } } else { for (int index8 = 0; index8 < 54; ++index8) this.inventory[index8] = objArray[index8].Clone(); return false; } } } return true; } public void AdjTiles() { int num1 = 4; int num2 = 3; for (int index = 0; index < 470; ++index) { this.oldAdjTile[index] = this.adjTile[index]; this.adjTile[index] = false; } this.oldAdjWater = this.adjWater; this.adjWater = false; this.oldAdjHoney = this.adjHoney; this.adjHoney = false; this.oldAdjLava = this.adjLava; this.adjLava = false; this.alchemyTable = false; int num3 = (int) (((double) this.position.X + (double) (this.width / 2)) / 16.0); int num4 = (int) (((double) this.position.Y + (double) this.height) / 16.0); for (int index1 = num3 - num1; index1 <= num3 + num1; ++index1) { for (int index2 = num4 - num2; index2 < num4 + num2; ++index2) { if (Main.tile[index1, index2].active()) { this.adjTile[(int) Main.tile[index1, index2].type] = true; if (Main.tile[index1, index2].type == (ushort) 302) this.adjTile[17] = true; if (Main.tile[index1, index2].type == (ushort) 77) this.adjTile[17] = true; if (Main.tile[index1, index2].type == (ushort) 133) { this.adjTile[17] = true; this.adjTile[77] = true; } if (Main.tile[index1, index2].type == (ushort) 134) this.adjTile[16] = true; if (Main.tile[index1, index2].type == (ushort) 354 || Main.tile[index1, index2].type == (ushort) 469) this.adjTile[14] = true; if (Main.tile[index1, index2].type == (ushort) 355) { this.adjTile[13] = true; this.adjTile[14] = true; this.alchemyTable = true; } } if (Main.tile[index1, index2].liquid > (byte) 200 && Main.tile[index1, index2].liquidType() == (byte) 0) this.adjWater = true; if (Main.tile[index1, index2].liquid > (byte) 200 && Main.tile[index1, index2].liquidType() == (byte) 2) this.adjHoney = true; if (Main.tile[index1, index2].liquid > (byte) 200 && Main.tile[index1, index2].liquidType() == (byte) 1) this.adjLava = true; } } if (!Main.playerInventory) return; bool flag = false; for (int index = 0; index < 470; ++index) { if (this.oldAdjTile[index] != this.adjTile[index]) { flag = true; break; } } if (this.adjWater != this.oldAdjWater) flag = true; if (this.adjHoney != this.oldAdjHoney) flag = true; if (this.adjLava != this.oldAdjLava) flag = true; if (!flag) return; Recipe.FindRecipes(); } public void PlayerFrame() { if (this.swimTime > 0) { --this.swimTime; if (!this.wet) this.swimTime = 0; } this.head = this.armor[0].headSlot; this.body = this.armor[1].bodySlot; this.legs = this.armor[2].legSlot; for (int index = 3; index < 8 + this.extraAccessorySlots; ++index) { if (this.armor[index].shieldSlot == (sbyte) 5 && this.eocDash > 0 && this.shield == (sbyte) -1) this.shield = this.armor[index].shieldSlot; if (this.shieldRaised && this.shield == (sbyte) -1 && this.armor[index].shieldSlot != (sbyte) -1) this.shield = this.armor[index].shieldSlot; if ((this.shield <= (sbyte) 0 || this.armor[index].frontSlot < (sbyte) 1 || this.armor[index].frontSlot > (sbyte) 4) && (this.front < (sbyte) 1 || this.front > (sbyte) 4 || this.armor[index].shieldSlot <= (sbyte) 0)) { if (this.armor[index].wingSlot > (sbyte) 0) { if (!this.hideVisual[index] || (double) this.velocity.Y != 0.0 && !this.mount.Active) this.wings = (int) this.armor[index].wingSlot; else continue; } if (!this.hideVisual[index]) { if (this.armor[index].stringColor > 0) this.stringColor = this.armor[index].stringColor; if (this.armor[index].handOnSlot > (sbyte) 0) this.handon = this.armor[index].handOnSlot; if (this.armor[index].handOffSlot > (sbyte) 0) this.handoff = this.armor[index].handOffSlot; if (this.armor[index].backSlot > (sbyte) 0) { this.back = this.armor[index].backSlot; this.front = (sbyte) -1; } if (this.armor[index].frontSlot > (sbyte) 0) this.front = this.armor[index].frontSlot; if (this.armor[index].shoeSlot > (sbyte) 0) this.shoe = this.armor[index].shoeSlot; if (this.armor[index].waistSlot > (sbyte) 0) this.waist = this.armor[index].waistSlot; if (this.armor[index].shieldSlot > (sbyte) 0) this.shield = this.armor[index].shieldSlot; if (this.armor[index].neckSlot > (sbyte) 0) this.neck = this.armor[index].neckSlot; if (this.armor[index].faceSlot > (sbyte) 0) this.face = this.armor[index].faceSlot; if (this.armor[index].balloonSlot > (sbyte) 0) this.balloon = this.armor[index].balloonSlot; if (this.armor[index].type == 3580) this.yoraiz0rEye = index - 2; if (this.armor[index].type == 3581) this.yoraiz0rDarkness = true; if (this.armor[index].type == 3929) this.leinforsHair = true; } } } for (int index = 13; index < 18 + this.extraAccessorySlots; ++index) { if (this.armor[index].stringColor > 0) this.stringColor = this.armor[index].stringColor; if (this.armor[index].handOnSlot > (sbyte) 0) this.handon = this.armor[index].handOnSlot; if (this.armor[index].handOffSlot > (sbyte) 0) this.handoff = this.armor[index].handOffSlot; if (this.armor[index].backSlot > (sbyte) 0) { this.back = this.armor[index].backSlot; this.front = (sbyte) -1; } if (this.armor[index].frontSlot > (sbyte) 0) this.front = this.armor[index].frontSlot; if (this.armor[index].shoeSlot > (sbyte) 0) this.shoe = this.armor[index].shoeSlot; if (this.armor[index].waistSlot > (sbyte) 0) this.waist = this.armor[index].waistSlot; if (this.armor[index].shieldSlot > (sbyte) 0) this.shield = this.armor[index].shieldSlot; if (this.armor[index].neckSlot > (sbyte) 0) this.neck = this.armor[index].neckSlot; if (this.armor[index].faceSlot > (sbyte) 0) this.face = this.armor[index].faceSlot; if (this.armor[index].balloonSlot > (sbyte) 0) this.balloon = this.armor[index].balloonSlot; if (this.armor[index].wingSlot > (sbyte) 0) this.wings = (int) this.armor[index].wingSlot; if (this.armor[index].type == 3580) this.yoraiz0rEye = index - 2; if (this.armor[index].type == 3581) this.yoraiz0rDarkness = true; if (this.armor[index].type == 3929) this.leinforsHair = true; } if (this.armor[10].headSlot >= 0) this.head = this.armor[10].headSlot; if (this.armor[11].bodySlot >= 0) this.body = this.armor[11].bodySlot; if (this.armor[12].legSlot >= 0) this.legs = this.armor[12].legSlot; this.wearsRobe = false; bool somethingSpecial = false; int num1 = Player.SetMatch(1, this.body, this.Male, ref this.wearsRobe); if (num1 != -1) this.legs = num1; int num2 = Player.SetMatch(2, this.legs, this.Male, ref somethingSpecial); if (num2 != -1) this.legs = num2; int num3 = Player.SetMatch(0, this.head, this.Male, ref somethingSpecial); if (num3 != -1) this.head = num3; if (this.body == 93) { this.shield = (sbyte) 0; this.handoff = (sbyte) 0; } if (this.body == 206 && this.back == (sbyte) -1) this.back = (sbyte) 12; if (this.body == 207 && this.back == (sbyte) -1) this.back = (sbyte) 13; if (this.body == 205 && this.back == (sbyte) -1) this.back = (sbyte) 11; if (this.legs == 67) this.shoe = (sbyte) 0; if (this.legs == 140) this.shoe = (sbyte) 0; if ((this.wereWolf || this.forceWerewolf) && !this.hideWolf) { this.legs = 20; this.body = 21; this.head = 38; } bool flag = this.wet && !this.lavaWet && (!this.mount.Active || this.mount.Type != 3); if (this.merman || this.forceMerman) { if (!this.hideMerman) { this.head = 39; this.legs = 21; this.body = 22; } if (flag) this.wings = 0; } this.socialShadowRocketBoots = false; this.socialIgnoreLight = false; this.socialGhost = false; this.armorEffectDrawShadow = false; this.armorEffectDrawShadowSubtle = false; this.armorEffectDrawOutlines = false; this.armorEffectDrawShadowLokis = false; this.armorEffectDrawShadowBasilisk = false; this.armorEffectDrawOutlinesForbidden = false; this.armorEffectDrawShadowEOCShield = false; if (this.head == 101 && this.body == 66 && this.legs == 55) this.socialGhost = true; if (this.head == 156 && this.body == 66 && this.legs == 55) this.socialGhost = true; this.SetArmorEffectVisuals(this); this.hermesStepSound.SoundType = 17; this.hermesStepSound.SoundStyle = -1; this.hermesStepSound.IntendedCooldown = 9; if (this.head == 99 && this.body == 65 && this.legs == 54) this.turtleArmor = true; if (this.head == 162 && this.body == 170 && this.legs == 105) this.spiderArmor = true; if ((this.head == 75 || this.head == 7) && this.body == 7 && this.legs == 7) this.boneArmor = true; if (this.legs == 140) { this.hermesStepSound.SoundType = 2; this.hermesStepSound.SoundStyle = 24; this.hermesStepSound.IntendedCooldown = 6; } if (this.wings > 0) { this.back = (sbyte) -1; this.front = (sbyte) -1; } if (this.head > 0 && this.face != (sbyte) 7) this.face = (sbyte) -1; if (this.webbed || this.frozen || this.stoned || Main.gamePaused && !Main.gameMenu) return; if ((this.body == 68 && this.legs == 57 && this.head == 106 || this.body == 74 && this.legs == 63 && this.head == 106) && Main.rand.Next(10) == 0) { int index = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 2f, (float) ((double) this.position.Y - 2.0 - (double) this.velocity.Y * 2.0)), this.width, this.height, 43, Alpha: 100, newColor: new Color((int) byte.MaxValue, 0, (int) byte.MaxValue), Scale: 0.3f); Main.dust[index].fadeIn = 0.8f; Main.dust[index].noGravity = true; Main.dust[index].velocity *= 2f; Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } if (this.wings == 27) { float R = 0.4f * this.stealth; Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, R, R * 0.9f, R * 0.2f); } if (this.head == 5 && this.body == 5 && this.legs == 5) this.socialShadowRocketBoots = true; if (this.head == 5 && this.body == 5 && this.legs == 5 && Main.rand.Next(10) == 0) { int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 14, Alpha: 200, Scale: 1.2f); Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } if (this.head == 76 && this.body == 49 && this.legs == 45) this.socialShadowRocketBoots = true; if (this.head == 74 && this.body == 48 && this.legs == 44) this.socialShadowRocketBoots = true; if (this.head == 74 && this.body == 48 && this.legs == 44 && Main.rand.Next(10) == 0) { int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 14, Alpha: 200, Scale: 1.2f); Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } if (this.head == 57 && this.body == 37 && this.legs == 35) { int maxValue = 10; if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > 1.0) maxValue = 2; if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 115, Alpha: 140, Scale: 0.75f); Main.dust[index].noGravity = true; Main.dust[index].fadeIn = 1.5f; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity += this.velocity * 0.2f; Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } } if (this.head == 6 && this.body == 6 && this.legs == 6 && (double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > 1.0 && !this.rocketFrame) { for (int index1 = 0; index1 < 2; ++index1) { int index2 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 2f, (float) ((double) this.position.Y - 2.0 - (double) this.velocity.Y * 2.0)), this.width, this.height, 6, Alpha: 100, Scale: 2f); Main.dust[index2].noGravity = true; Main.dust[index2].noLight = true; Main.dust[index2].velocity.X -= this.velocity.X * 0.5f; Main.dust[index2].velocity.Y -= this.velocity.Y * 0.5f; Main.dust[index2].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } } if (this.head == 8 && this.body == 8 && this.legs == 8 && (double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > 1.0) { int index = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 2f, (float) ((double) this.position.Y - 2.0 - (double) this.velocity.Y * 2.0)), this.width, this.height, 40, Alpha: 50, Scale: 1.4f); Main.dust[index].noGravity = true; Main.dust[index].velocity.X = this.velocity.X * 0.25f; Main.dust[index].velocity.Y = this.velocity.Y * 0.25f; Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } if (this.head == 9 && this.body == 9 && this.legs == 9 && (double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > 1.0 && !this.rocketFrame) { for (int index3 = 0; index3 < 2; ++index3) { int index4 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 2f, (float) ((double) this.position.Y - 2.0 - (double) this.velocity.Y * 2.0)), this.width, this.height, 6, Alpha: 100, Scale: 2f); Main.dust[index4].noGravity = true; Main.dust[index4].noLight = true; Main.dust[index4].velocity.X -= this.velocity.X * 0.5f; Main.dust[index4].velocity.Y -= this.velocity.Y * 0.5f; Main.dust[index4].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } } if (this.body == 18 && this.legs == 17 && (this.head == 32 || this.head == 33 || this.head == 34) && Main.rand.Next(10) == 0) { int index = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 2f, (float) ((double) this.position.Y - 2.0 - (double) this.velocity.Y * 2.0)), this.width, this.height, 43, Alpha: 100, Scale: 0.3f); Main.dust[index].fadeIn = 0.8f; Main.dust[index].velocity *= 0.0f; Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } if (this.body == 24 && this.legs == 23 && (this.head == 42 || this.head == 43 || this.head == 41) && (double) this.velocity.X != 0.0 && (double) this.velocity.Y != 0.0 && Main.rand.Next(10) == 0) { int index = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 2f, (float) ((double) this.position.Y - 2.0 - (double) this.velocity.Y * 2.0)), this.width, this.height, 43, Alpha: 100, Scale: 0.3f); Main.dust[index].fadeIn = 0.8f; Main.dust[index].velocity *= 0.0f; Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } if (this.body == 36 && this.head == 56 && (double) this.velocity.X != 0.0 && (double) this.velocity.Y == 0.0) { for (int index5 = 0; index5 < 2; ++index5) { int index6 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + ((double) this.gravDir == 1.0 ? (float) (this.height - 2) : -4f)), this.width, 6, 106, Alpha: 100, Scale: 0.1f); Main.dust[index6].fadeIn = 1f; Main.dust[index6].noGravity = true; Main.dust[index6].velocity *= 0.2f; Main.dust[index6].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } } if (this.body == 27 && this.head == 46 && this.legs == 26) { this.frostArmor = true; if ((double) this.velocity.X != 0.0 && (double) this.velocity.Y == 0.0 && this.miscCounter % 2 == 0) { for (int index7 = 0; index7 < 2; ++index7) { int index8 = index7 != 0 ? Dust.NewDust(new Vector2(this.position.X + (float) (this.width / 2), this.position.Y + (float) this.height + this.gfxOffY), this.width / 2, 6, 76, Scale: 1.35f) : Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float) this.height + this.gfxOffY), this.width / 2, 6, 76, Scale: 1.35f); Main.dust[index8].scale *= (float) (1.0 + (double) Main.rand.Next(20, 40) * 0.00999999977648258); Main.dust[index8].noGravity = true; Main.dust[index8].noLight = true; Main.dust[index8].velocity *= 1f / 1000f; Main.dust[index8].velocity.Y -= 3f / 1000f; Main.dust[index8].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } } } if (this.mount.Active) { this.legFrameCounter = 0.0; this.legFrame.Y = this.legFrame.Height * 6; if ((double) this.velocity.Y != 0.0) { if (this.mount.FlyTime > 0 && this.jump == 0 && this.controlJump && !this.mount.CanHover) { if (this.mount.Type == 0) { if (this.direction > 0) { if (Main.rand.Next(4) == 0) { int index = Dust.NewDust(new Vector2(this.Center.X - 22f, (float) ((double) this.position.Y + (double) this.height - 6.0)), 20, 10, 64, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, (int) byte.MaxValue); Main.dust[index].velocity *= 0.1f; Main.dust[index].noLight = true; } if (Main.rand.Next(4) == 0) { int index = Dust.NewDust(new Vector2(this.Center.X + 12f, (float) ((double) this.position.Y + (double) this.height - 6.0)), 20, 10, 64, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, (int) byte.MaxValue); Main.dust[index].velocity *= 0.1f; Main.dust[index].noLight = true; } } else { if (Main.rand.Next(4) == 0) { int index = Dust.NewDust(new Vector2(this.Center.X - 32f, (float) ((double) this.position.Y + (double) this.height - 6.0)), 20, 10, 64, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, (int) byte.MaxValue); Main.dust[index].velocity *= 0.1f; Main.dust[index].noLight = true; } if (Main.rand.Next(4) == 0) { int index = Dust.NewDust(new Vector2(this.Center.X + 2f, (float) ((double) this.position.Y + (double) this.height - 6.0)), 20, 10, 64, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, (int) byte.MaxValue); Main.dust[index].velocity *= 0.1f; Main.dust[index].noLight = true; } } } this.mount.UpdateFrame(this, 3, this.velocity); } else if (this.wet) this.mount.UpdateFrame(this, 4, this.velocity); else this.mount.UpdateFrame(this, 2, this.velocity); } else if ((double) this.velocity.X == 0.0 || (this.slippy || this.slippy2 || this.windPushed) && !this.controlLeft && !this.controlRight) this.mount.UpdateFrame(this, 0, this.velocity); else this.mount.UpdateFrame(this, 1, this.velocity); } else if (this.legs == 140) { this.legFrameCounter = 0.0; this.legFrame.Y = this.legFrame.Height * ((double) this.velocity.Y != 0.0).ToInt(); if (this.wings == 22 || this.wings == 28) this.legFrame.Y = 0; } else if (this.swimTime > 0) { this.legFrameCounter += 2.0; while (this.legFrameCounter > 8.0) { this.legFrameCounter -= 8.0; this.legFrame.Y += this.legFrame.Height; } if (this.legFrame.Y < this.legFrame.Height * 7) this.legFrame.Y = this.legFrame.Height * 19; else if (this.legFrame.Y > this.legFrame.Height * 19) this.legFrame.Y = this.legFrame.Height * 7; } else if ((double) this.velocity.Y != 0.0 || this.grappling[0] > -1) { this.legFrameCounter = 0.0; this.legFrame.Y = this.legFrame.Height * 5; if (this.wings == 22 || this.wings == 28) this.legFrame.Y = 0; } else if ((double) this.velocity.X != 0.0) { if ((this.slippy || this.slippy2 || this.windPushed) && !this.controlLeft && !this.controlRight) { this.legFrameCounter = 0.0; ref Microsoft.Xna.Framework.Rectangle local = ref this.legFrame; Microsoft.Xna.Framework.Rectangle legFrame = this.legFrame; local.Y = 0; } else { this.legFrameCounter += (double) Math.Abs(this.velocity.X) * 1.3; while (this.legFrameCounter > 8.0) { this.legFrameCounter -= 8.0; this.legFrame.Y += this.legFrame.Height; } if (this.legFrame.Y < this.legFrame.Height * 7) this.legFrame.Y = this.legFrame.Height * 19; else if (this.legFrame.Y > this.legFrame.Height * 19) this.legFrame.Y = this.legFrame.Height * 7; } } else { this.legFrameCounter = 0.0; ref Microsoft.Xna.Framework.Rectangle local = ref this.legFrame; Microsoft.Xna.Framework.Rectangle legFrame = this.legFrame; local.Y = 0; } if (this.carpetFrame >= 0) { this.legFrameCounter = 0.0; ref Microsoft.Xna.Framework.Rectangle local = ref this.legFrame; Microsoft.Xna.Framework.Rectangle legFrame = this.legFrame; local.Y = 0; } if (this.sandStorm) { if (this.miscCounter % 4 == 0 && this.itemAnimation == 0) { this.ChangeDir(this.direction * -1); if (this.inventory[this.selectedItem].holdStyle == 2) { if (this.inventory[this.selectedItem].type == 946) this.itemLocation.X = this.position.X + (float) this.width * 0.5f - (float) (16 * this.direction); if (this.inventory[this.selectedItem].type == 186) { this.itemLocation.X = this.position.X + (float) this.width * 0.5f + (float) (6 * this.direction); this.itemRotation = 0.79f * (float) -this.direction; } } } this.legFrameCounter = 0.0; ref Microsoft.Xna.Framework.Rectangle local = ref this.legFrame; Microsoft.Xna.Framework.Rectangle legFrame = this.legFrame; local.Y = 0; } if (this.itemAnimation > 0 && this.inventory[this.selectedItem].useStyle != 10) { if (this.inventory[this.selectedItem].useStyle == 1 || this.inventory[this.selectedItem].type == 0) { if ((double) this.itemAnimation < (double) this.itemAnimationMax * 0.333) this.bodyFrame.Y = this.bodyFrame.Height * 3; else if ((double) this.itemAnimation < (double) this.itemAnimationMax * 0.666) this.bodyFrame.Y = this.bodyFrame.Height * 2; else this.bodyFrame.Y = this.bodyFrame.Height; } else if (this.inventory[this.selectedItem].useStyle == 2) { if ((double) this.itemAnimation > (double) this.itemAnimationMax * 0.5) this.bodyFrame.Y = this.bodyFrame.Height * 3; else this.bodyFrame.Y = this.bodyFrame.Height * 2; } else if (this.inventory[this.selectedItem].useStyle == 3) { if ((double) this.itemAnimation > (double) this.itemAnimationMax * 0.666) this.bodyFrame.Y = this.bodyFrame.Height * 3; else this.bodyFrame.Y = this.bodyFrame.Height * 3; } else if (this.inventory[this.selectedItem].useStyle == 4) { this.bodyFrame.Y = this.bodyFrame.Height * 2; } else { if (this.inventory[this.selectedItem].useStyle != 5) return; if (this.inventory[this.selectedItem].type == 281 || this.inventory[this.selectedItem].type == 986) { this.bodyFrame.Y = this.bodyFrame.Height * 2; } else { double num4 = (double) this.itemRotation * (double) this.direction; this.bodyFrame.Y = this.bodyFrame.Height * 3; if (num4 < -0.75) { this.bodyFrame.Y = this.bodyFrame.Height * 2; if ((double) this.gravDir == -1.0) this.bodyFrame.Y = this.bodyFrame.Height * 4; } if (num4 <= 0.6) return; this.bodyFrame.Y = this.bodyFrame.Height * 4; if ((double) this.gravDir != -1.0) return; this.bodyFrame.Y = this.bodyFrame.Height * 2; } } } else if (this.mount.Active) { this.bodyFrameCounter = 0.0; this.bodyFrame.Y = this.bodyFrame.Height * this.mount.BodyFrame; } else if (this.pulley) { if (this.pulleyDir == (byte) 2) this.bodyFrame.Y = this.bodyFrame.Height; else this.bodyFrame.Y = this.bodyFrame.Height * 2; } else if (this.inventory[this.selectedItem].holdStyle == 1 && (!this.wet || !this.inventory[this.selectedItem].noWet)) this.bodyFrame.Y = this.bodyFrame.Height * 3; else if (this.inventory[this.selectedItem].holdStyle == 2 && (!this.wet || !this.inventory[this.selectedItem].noWet)) this.bodyFrame.Y = this.bodyFrame.Height * 2; else if (this.inventory[this.selectedItem].holdStyle == 3) this.bodyFrame.Y = this.bodyFrame.Height * 3; else if (this.shieldRaised) this.bodyFrame.Y = this.bodyFrame.Height * 10; else if (this.grappling[0] >= 0) { this.sandStorm = false; this.dJumpEffectCloud = false; this.dJumpEffectSandstorm = false; this.dJumpEffectBlizzard = false; this.dJumpEffectFart = false; this.dJumpEffectSail = false; this.dJumpEffectUnicorn = false; Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); float num5 = 0.0f; float num6 = 0.0f; for (int index = 0; index < this.grapCount; ++index) { num5 += Main.projectile[this.grappling[index]].position.X + (float) (Main.projectile[this.grappling[index]].width / 2); num6 += Main.projectile[this.grappling[index]].position.Y + (float) (Main.projectile[this.grappling[index]].height / 2); } float num7 = num5 / (float) this.grapCount; float num8 = num6 / (float) this.grapCount; float num9 = num7 - vector2.X; float num10 = num8 - vector2.Y; if ((double) num10 < 0.0 && (double) Math.Abs(num10) > (double) Math.Abs(num9)) { this.bodyFrame.Y = this.bodyFrame.Height * 2; if ((double) this.gravDir != -1.0) return; this.bodyFrame.Y = this.bodyFrame.Height * 4; } else if ((double) num10 > 0.0 && (double) Math.Abs(num10) > (double) Math.Abs(num9)) { this.bodyFrame.Y = this.bodyFrame.Height * 4; if ((double) this.gravDir != -1.0) return; this.bodyFrame.Y = this.bodyFrame.Height * 2; } else this.bodyFrame.Y = this.bodyFrame.Height * 3; } else if (this.swimTime > 0) { if (this.swimTime > 20) { ref Microsoft.Xna.Framework.Rectangle local = ref this.bodyFrame; Microsoft.Xna.Framework.Rectangle bodyFrame = this.bodyFrame; local.Y = 0; } else if (this.swimTime > 10) { this.bodyFrame.Y = this.bodyFrame.Height * 5; } else { ref Microsoft.Xna.Framework.Rectangle local = ref this.bodyFrame; Microsoft.Xna.Framework.Rectangle bodyFrame = this.bodyFrame; local.Y = 0; } } else if ((double) this.velocity.Y != 0.0) { this.bodyFrame.Y = !this.sliding ? (this.sandStorm || this.carpetFrame >= 0 ? this.bodyFrame.Height * 6 : (this.eocDash <= 0 ? (this.wings <= 0 ? this.bodyFrame.Height * 5 : (this.wings == 22 || this.wings == 28 ? 0 : ((double) this.velocity.Y <= 0.0 ? this.bodyFrame.Height * 6 : (!this.controlJump ? this.bodyFrame.Height * 5 : this.bodyFrame.Height * 6)))) : this.bodyFrame.Height * 6)) : this.bodyFrame.Height * 3; this.bodyFrameCounter = 0.0; } else if ((double) this.velocity.X != 0.0) { if (this.legs == 140) { this.bodyFrameCounter += (double) Math.Abs(this.velocity.X) * 0.5; while (this.bodyFrameCounter > 8.0) { this.bodyFrameCounter -= 8.0; this.bodyFrame.Y += this.bodyFrame.Height; } if (this.bodyFrame.Y < this.bodyFrame.Height * 7) { this.bodyFrame.Y = this.bodyFrame.Height * 19; } else { if (this.bodyFrame.Y <= this.bodyFrame.Height * 19) return; this.bodyFrame.Y = this.bodyFrame.Height * 7; } } else { this.bodyFrameCounter += (double) Math.Abs(this.velocity.X) * 1.5; this.bodyFrame.Y = this.legFrame.Y; } } else { this.bodyFrameCounter = 0.0; ref Microsoft.Xna.Framework.Rectangle local = ref this.bodyFrame; Microsoft.Xna.Framework.Rectangle bodyFrame = this.bodyFrame; local.Y = 0; } } public void SetArmorEffectVisuals(Player drawPlayer) { if (drawPlayer.head == 111 && drawPlayer.body == 73 && drawPlayer.legs == 62) { this.armorEffectDrawShadowSubtle = true; this.armorEffectDrawOutlines = true; } if (drawPlayer.head == 134 && drawPlayer.body == 95 && drawPlayer.legs == 79) { this.armorEffectDrawShadowSubtle = true; this.armorEffectDrawOutlines = true; } if (drawPlayer.head == 107 && drawPlayer.body == 69 && drawPlayer.legs == 58) { this.armorEffectDrawShadowSubtle = true; this.armorEffectDrawShadow = true; } if (drawPlayer.head == 108 && drawPlayer.body == 70 && drawPlayer.legs == 59) { this.armorEffectDrawShadowSubtle = true; this.armorEffectDrawShadow = true; } if (drawPlayer.head == 109 && drawPlayer.body == 71 && drawPlayer.legs == 60) { this.armorEffectDrawShadowSubtle = true; this.armorEffectDrawShadow = true; } if (drawPlayer.head == 110 && drawPlayer.body == 72 && drawPlayer.legs == 61) { this.armorEffectDrawShadowSubtle = true; this.armorEffectDrawShadow = true; } if (drawPlayer.head == 193 && drawPlayer.body == 194 && drawPlayer.legs == 134) { this.armorEffectDrawShadowSubtle = true; this.armorEffectDrawShadowLokis = true; this.armorEffectDrawOutlines = true; } if (drawPlayer.mount.Active && drawPlayer.mount.Type == 3 && (double) drawPlayer.velocity.Y != 0.0 && !drawPlayer.SlimeDontHyperJump) this.armorEffectDrawShadow = true; if (drawPlayer.mount.Active && drawPlayer.mount.Type == 10 && (double) Math.Abs(drawPlayer.velocity.X) > (double) drawPlayer.mount.DashSpeed - (double) drawPlayer.mount.RunSpeed / 2.0) this.armorEffectDrawShadow = true; if (drawPlayer.mount.Active && drawPlayer.mount.Type == 14 && (double) Math.Abs(drawPlayer.velocity.X) > (double) drawPlayer.mount.RunSpeed / 2.0) this.armorEffectDrawShadowBasilisk = true; if (drawPlayer.body == 67 && drawPlayer.legs == 56 && drawPlayer.head >= 103 && drawPlayer.head <= 105) this.armorEffectDrawShadow = true; if ((drawPlayer.head == 78 || drawPlayer.head == 79 || drawPlayer.head == 80) && drawPlayer.body == 51 && drawPlayer.legs == 47) this.armorEffectDrawShadowSubtle = true; if (drawPlayer.head == 200 && drawPlayer.body == 198 && drawPlayer.legs == 142) { this.armorEffectDrawShadowLokis = true; this.armorEffectDrawOutlinesForbidden = true; } if (drawPlayer.head == 171 && drawPlayer.body == 177 && drawPlayer.legs == 112) { this.armorEffectDrawShadow = true; this.armorEffectDrawOutlines = true; } if (drawPlayer.head == 169 && drawPlayer.body == 175 && drawPlayer.legs == 110) this.armorEffectDrawShadow = true; if (drawPlayer.head == 170 && drawPlayer.body == 176 && drawPlayer.legs == 111) { this.armorEffectDrawShadowLokis = true; this.armorEffectDrawOutlines = true; } if (drawPlayer.body == 209 && drawPlayer.legs == 159) this.armorEffectDrawShadow = true; if (drawPlayer.eocDash > 0) this.armorEffectDrawShadowEOCShield = true; else if (drawPlayer.dashDelay < 0) this.armorEffectDrawShadow = true; if (drawPlayer.head == 5 && drawPlayer.body == 5 && drawPlayer.legs == 5) this.armorEffectDrawShadow = true; if (drawPlayer.head == 74 && drawPlayer.body == 48 && drawPlayer.legs == 44) this.armorEffectDrawShadow = true; if (drawPlayer.head == 76 && drawPlayer.body == 49 && drawPlayer.legs == 45) this.armorEffectDrawShadow = true; if (drawPlayer.head == 7 && drawPlayer.body == 7 && drawPlayer.legs == 7) this.armorEffectDrawShadow = true; if (drawPlayer.head == 22 && drawPlayer.body == 14 && drawPlayer.legs == 14) this.armorEffectDrawShadow = true; if (drawPlayer.dye[0].dye == (byte) 30 && drawPlayer.dye[1].dye == (byte) 30 && drawPlayer.dye[2].dye == (byte) 30 && drawPlayer.head == 4 && drawPlayer.body == 27 && drawPlayer.legs == 26) { this.armorEffectDrawShadow = true; this.armorEffectDrawOutlines = true; } if (drawPlayer.head == 189 && drawPlayer.body == 190 && drawPlayer.legs == 130) this.armorEffectDrawOutlines = true; if (drawPlayer.body == 17 && drawPlayer.legs == 16 && (drawPlayer.head == 29 || drawPlayer.head == 30 || drawPlayer.head == 31)) this.armorEffectDrawShadow = true; if (drawPlayer.body == 19 && drawPlayer.legs == 18 && (drawPlayer.head == 35 || drawPlayer.head == 36 || drawPlayer.head == 37)) this.armorEffectDrawOutlines = true; if (drawPlayer.body == 24 && drawPlayer.legs == 23 && (drawPlayer.head == 41 || drawPlayer.head == 42 || drawPlayer.head == 43)) { this.armorEffectDrawOutlines = true; this.armorEffectDrawShadow = true; } if (drawPlayer.head == 157 && drawPlayer.legs == 98 && drawPlayer.body != 105) { int body = drawPlayer.body; } if (drawPlayer.body == 36 && drawPlayer.head == 56) this.armorEffectDrawOutlines = true; if (!drawPlayer.stoned && (double) drawPlayer.stealth == 1.0) return; this.armorEffectDrawOutlines = false; this.armorEffectDrawShadow = false; this.armorEffectDrawShadowSubtle = false; } public static int SetMatch(int armorslot, int type, bool male, ref bool somethingSpecial) { int num = -1; if (armorslot == 0 && type == 201) num = male ? 201 : 202; if (armorslot == 1) { switch (type) { case 15: num = 88; break; case 36: num = 89; break; case 41: num = 97; break; case 42: num = 90; break; case 58: num = 91; break; case 59: num = 92; break; case 60: num = 93; break; case 61: num = 94; break; case 62: num = 95; break; case 63: num = 96; break; case 77: num = 121; break; case 165: num = !male ? 99 : 118; break; case 166: num = !male ? 100 : 119; break; case 167: num = male ? 101 : 102; break; case 180: num = 115; break; case 181: num = 116; break; case 183: num = male ? 136 : 123; break; case 191: num = 131; break; } if (num != -1) somethingSpecial = true; } if (armorslot == 2) { switch (type) { case 57: if (male) { num = 137; break; } break; case 83: if (male) { num = 117; break; } break; case 84: if (male) { num = 120; break; } break; case 132: if (male) { num = 135; break; } break; case 146: num = male ? 146 : 147; break; case 154: num = male ? 155 : 154; break; case 158: if (male) { num = 157; break; } break; } } return num; } public void Teleport(Vector2 newPos, int Style = 0, int extraInfo = 0) { try { this.grappling[0] = -1; this.grapCount = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == this.whoAmI && Main.projectile[index].aiStyle == 7) Main.projectile[index].Kill(); } int extraInfo1 = 0; if (Style == 4) extraInfo1 = this.lastPortalColorIndex; float dustCountMult = MathHelper.Clamp((float) (1.0 - (double) this.teleportTime * 0.990000009536743), 0.01f, 1f); Main.TeleportEffect(this.getRect(), Style, extraInfo1, dustCountMult); float num = Vector2.Distance(this.position, newPos); PressurePlateHelper.UpdatePlayerPosition(this); this.position = newPos; this.fallStart = (int) ((double) this.position.Y / 16.0); if (this.whoAmI == Main.myPlayer) { bool flag = false; if ((double) num < (double) new Vector2((float) Main.screenWidth, (float) Main.screenHeight).Length() / 2.0 + 100.0) { int time = 0; if (Style == 1) time = 10; Main.SetCameraLerp(0.1f, time); flag = true; } else { Main.BlackFadeIn = (int) byte.MaxValue; Lighting.BlackOut(); Main.screenLastPosition = Main.screenPosition; Main.screenPosition.X = this.position.X + (float) (this.width / 2) - (float) (Main.screenWidth / 2); Main.screenPosition.Y = this.position.Y + (float) (this.height / 2) - (float) (Main.screenHeight / 2); Main.quickBG = 10; } if ((double) dustCountMult > 0.100000001490116 || !flag || Style != 0) { if (Main.mapTime < 5) Main.mapTime = 5; Main.maxQ = true; Main.renderNow = true; } } if (Style == 4) { this.lastPortalColorIndex = extraInfo; extraInfo1 = this.lastPortalColorIndex; this.portalPhysicsFlag = true; this.gravity = 0.0f; } PressurePlateHelper.UpdatePlayerPosition(this); for (int index = 0; index < 3; ++index) this.UpdateSocialShadow(); this.oldPosition = this.position + this.BlehOldPositionFixer; Main.TeleportEffect(this.getRect(), Style, extraInfo1, dustCountMult); this.teleportTime = 1f; this.teleportStyle = Style; } catch { } } public void Spawn() { Main.InitLifeBytes(); if (this.whoAmI == Main.myPlayer) { if (Main.mapTime < 5) Main.mapTime = 5; Main.quickBG = 10; this.FindSpawn(); if (!Player.CheckSpawn(this.SpawnX, this.SpawnY)) { this.SpawnX = -1; this.SpawnY = -1; } Main.maxQ = true; } if (Main.netMode == 1 && this.whoAmI == Main.myPlayer) { NetMessage.SendData(12, number: Main.myPlayer); Main.gameMenu = false; } this.headPosition = Vector2.Zero; this.bodyPosition = Vector2.Zero; this.legPosition = Vector2.Zero; this.headRotation = 0.0f; this.bodyRotation = 0.0f; this.legRotation = 0.0f; this.lavaTime = this.lavaMax; if (this.statLife <= 0) { int num = this.statLifeMax2 / 2; this.statLife = 100; if (num > this.statLife) this.statLife = num; this.breath = this.breathMax; if (this.spawnMax) { this.statLife = this.statLifeMax2; this.statMana = this.statManaMax2; } } this.immune = true; this.dead = false; this.immuneTime = 0; this.active = true; if (this.SpawnX >= 0 && this.SpawnY >= 0) { this.position.X = (float) (this.SpawnX * 16 + 8 - this.width / 2); this.position.Y = (float) (this.SpawnY * 16 - this.height); } else { this.position.X = (float) (Main.spawnTileX * 16 + 8 - this.width / 2); this.position.Y = (float) (Main.spawnTileY * 16 - this.height); for (int i = Main.spawnTileX - 1; i < Main.spawnTileX + 2; ++i) { for (int j = Main.spawnTileY - 3; j < Main.spawnTileY; ++j) { if (Main.tile[i, j] != null) { if (Main.tileSolid[(int) Main.tile[i, j].type] && !Main.tileSolidTop[(int) Main.tile[i, j].type]) WorldGen.KillTile(i, j); if (Main.tile[i, j].liquid > (byte) 0) { Main.tile[i, j].lava(false); Main.tile[i, j].liquid = (byte) 0; WorldGen.SquareTileFrame(i, j); } } } } } this.wet = false; this.wetCount = (byte) 0; this.lavaWet = false; this.fallStart = (int) ((double) this.position.Y / 16.0); this.fallStart2 = this.fallStart; this.velocity.X = 0.0f; this.velocity.Y = 0.0f; for (int index = 0; index < 3; ++index) this.UpdateSocialShadow(); this.oldPosition = this.position + this.BlehOldPositionFixer; this.talkNPC = -1; if (this.whoAmI == Main.myPlayer) Main.npcChatCornerItem = 0; if (this.pvpDeath) { this.pvpDeath = false; this.immuneTime = 300; this.statLife = this.statLifeMax; } else this.immuneTime = 60; if (this.whoAmI != Main.myPlayer) return; Main.BlackFadeIn = (int) byte.MaxValue; Main.renderNow = true; if (Main.netMode == 1) Netplay.newRecent(); Main.screenPosition.X = this.position.X + (float) (this.width / 2) - (float) (Main.screenWidth / 2); Main.screenPosition.Y = this.position.Y + (float) (this.height / 2) - (float) (Main.screenHeight / 2); } public void ShadowDodge() { this.immune = true; this.immuneTime = 80; if (this.longInvince) this.immuneTime += 40; for (int index = 0; index < this.hurtCooldowns.Length; ++index) this.hurtCooldowns[index] = this.immuneTime; if (this.whoAmI != Main.myPlayer) return; for (int b = 0; b < 22; ++b) { if (this.buffTime[b] > 0 && this.buffType[b] == 59) this.DelBuff(b); } NetMessage.SendData(62, number: this.whoAmI, number2: 2f); } public void NinjaDodge() { this.immune = true; this.immuneTime = 80; if (this.longInvince) this.immuneTime += 40; for (int index = 0; index < this.hurtCooldowns.Length; ++index) this.hurtCooldowns[index] = this.immuneTime; for (int index1 = 0; index1 < 100; ++index1) { int index2 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 2f); Main.dust[index2].position.X += (float) Main.rand.Next(-20, 21); Main.dust[index2].position.Y += (float) Main.rand.Next(-20, 21); Main.dust[index2].velocity *= 0.4f; Main.dust[index2].scale *= (float) (1.0 + (double) Main.rand.Next(40) * 0.00999999977648258); Main.dust[index2].shader = GameShaders.Armor.GetSecondaryShader(this.cWaist, this); if (Main.rand.Next(2) == 0) { Main.dust[index2].scale *= (float) (1.0 + (double) Main.rand.Next(40) * 0.00999999977648258); Main.dust[index2].noGravity = true; } } int index3 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 24.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64)); Main.gore[index3].scale = 1.5f; Main.gore[index3].velocity.X = (float) Main.rand.Next(-50, 51) * 0.01f; Main.gore[index3].velocity.Y = (float) Main.rand.Next(-50, 51) * 0.01f; Main.gore[index3].velocity *= 0.4f; int index4 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 24.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64)); Main.gore[index4].scale = 1.5f; Main.gore[index4].velocity.X = (float) (1.5 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258); Main.gore[index4].velocity.Y = (float) (1.5 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258); Main.gore[index4].velocity *= 0.4f; int index5 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 24.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64)); Main.gore[index5].scale = 1.5f; Main.gore[index5].velocity.X = (float) (-1.5 - (double) Main.rand.Next(-50, 51) * 0.00999999977648258); Main.gore[index5].velocity.Y = (float) (1.5 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258); Main.gore[index5].velocity *= 0.4f; int index6 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 24.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64)); Main.gore[index6].scale = 1.5f; Main.gore[index6].velocity.X = (float) (1.5 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258); Main.gore[index6].velocity.Y = (float) (-1.5 - (double) Main.rand.Next(-50, 51) * 0.00999999977648258); Main.gore[index6].velocity *= 0.4f; int index7 = Gore.NewGore(new Vector2((float) ((double) this.position.X + (double) (this.width / 2) - 24.0), (float) ((double) this.position.Y + (double) (this.height / 2) - 24.0)), new Vector2(), Main.rand.Next(61, 64)); Main.gore[index7].scale = 1.5f; Main.gore[index7].velocity.X = (float) (-1.5 - (double) Main.rand.Next(-50, 51) * 0.00999999977648258); Main.gore[index7].velocity.Y = (float) (-1.5 - (double) Main.rand.Next(-50, 51) * 0.00999999977648258); Main.gore[index7].velocity *= 0.4f; if (this.whoAmI != Main.myPlayer) return; NetMessage.SendData(62, number: this.whoAmI, number2: 1f); } public double HurtOld( int Damage, int hitDirection, bool pvp = false, bool quiet = false, string deathText = " was slain...", bool Crit = false, int cooldownCounter = -1) { return 0.0; } public double Hurt( PlayerDeathReason damageSource, int Damage, int hitDirection, bool pvp = false, bool quiet = false, bool Crit = false, int cooldownCounter = -1) { bool flag1 = !this.immune; bool flag2 = false; int hitContext = cooldownCounter; if (cooldownCounter == 0) flag1 = this.hurtCooldowns[cooldownCounter] <= 0; if (cooldownCounter == 1) flag1 = this.hurtCooldowns[cooldownCounter] <= 0; if (cooldownCounter == 2) { flag2 = true; cooldownCounter = -1; } if (!flag1) return 0.0; if (this.whoAmI == Main.myPlayer && this.blackBelt && Main.rand.Next(10) == 0) { this.NinjaDodge(); return 0.0; } if (this.whoAmI == Main.myPlayer && this.shadowDodge) { this.ShadowDodge(); return 0.0; } if (this.whoAmI == Main.myPlayer && this.panic) this.AddBuff(63, 300); if (this.whoAmI == Main.myPlayer && this.setSquireT2) this.AddBuff(205, 300); this.stealth = 1f; if (Main.netMode == 1) NetMessage.SendData(84, number: this.whoAmI); int Damage1 = Damage; double dmg = Main.CalculatePlayerDamage(Damage1, this.statDefense); if (Crit) Damage1 *= 2; if (dmg >= 1.0) { if (this.invis) { for (int b = 0; b < 22; ++b) { if (this.buffType[b] == 10) this.DelBuff(b); } } dmg = (double) (int) ((1.0 - (double) this.endurance) * dmg); if (dmg < 1.0) dmg = 1.0; if (this.ConsumeSolarFlare()) { dmg = (double) (int) ((1.0 - 0.300000011920929) * dmg); if (dmg < 1.0) dmg = 1.0; if (this.whoAmI == Main.myPlayer) { int index = Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 608, 150, 15f, Main.myPlayer); Main.projectile[index].Kill(); } } if (this.beetleDefense && this.beetleOrbs > 0) { dmg = (double) (int) ((1.0 - (double) (0.15f * (float) this.beetleOrbs)) * dmg); --this.beetleOrbs; for (int b = 0; b < 22; ++b) { if (this.buffType[b] >= 95 && this.buffType[b] <= 97) this.DelBuff(b); } if (this.beetleOrbs > 0) this.AddBuff(95 + this.beetleOrbs - 1, 5, false); this.beetleCounter = 0.0f; if (dmg < 1.0) dmg = 1.0; } if (this.magicCuffs) { int manaAmount = Damage1; this.statMana += manaAmount; if (this.statMana > this.statManaMax2) this.statMana = this.statManaMax2; this.ManaEffect(manaAmount); } if (this.defendedByPaladin) { if (this.whoAmI != Main.myPlayer) { if (Main.player[Main.myPlayer].hasPaladinShield) { Player player = Main.player[Main.myPlayer]; if (player.team == this.team && this.team != 0) { float num1 = player.Distance(this.Center); bool flag3 = (double) num1 < 800.0; if (flag3) { for (int index = 0; index < (int) byte.MaxValue; ++index) { if (index != Main.myPlayer && Main.player[index].active && !Main.player[index].dead && !Main.player[index].immune && Main.player[index].hasPaladinShield && Main.player[index].team == this.team && (double) Main.player[index].statLife > (double) Main.player[index].statLifeMax2 * 0.25) { float num2 = Main.player[index].Distance(this.Center); if ((double) num1 > (double) num2 || (double) num1 == (double) num2 && index < Main.myPlayer) { flag3 = false; break; } } } } if (flag3) { int Damage2 = (int) (dmg * 0.25); dmg = (double) (int) (dmg * 0.75); player.Hurt(PlayerDeathReason.LegacyEmpty(), Damage2, 0); } } } } else { bool flag4 = false; for (int index = 0; index < (int) byte.MaxValue; ++index) { if (index != Main.myPlayer && Main.player[index].active && !Main.player[index].dead && !Main.player[index].immune && Main.player[index].hasPaladinShield && Main.player[index].team == this.team && (double) Main.player[index].statLife > (double) Main.player[index].statLifeMax2 * 0.25) { flag4 = true; break; } } if (flag4) dmg = (double) (int) (dmg * 0.75); } } if (this.brainOfConfusion && Main.myPlayer == this.whoAmI) { for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && !Main.npc[index].friendly) { int num3 = 300 + (int) dmg * 2; if (Main.rand.Next(500) < num3) { double num4 = (double) (Main.npc[index].Center - this.Center).Length(); float num5 = (float) Main.rand.Next(200 + (int) dmg / 2, 301 + (int) dmg * 2); if ((double) num5 > 500.0) num5 = (float) (500.0 + ((double) num5 - 500.0) * 0.75); if ((double) num5 > 700.0) num5 = (float) (700.0 + ((double) num5 - 700.0) * 0.5); if ((double) num5 > 900.0) num5 = (float) (900.0 + ((double) num5 - 900.0) * 0.25); double num6 = (double) num5; if (num4 < num6) { float num7 = (float) Main.rand.Next(90 + (int) dmg / 3, 300 + (int) dmg / 2); Main.npc[index].AddBuff(31, (int) num7); } } } } Projectile.NewProjectile(this.Center.X + (float) Main.rand.Next(-40, 40), this.Center.Y - (float) Main.rand.Next(20, 60), this.velocity.X * 0.3f, this.velocity.Y * 0.3f, 565, 0, 0.0f, this.whoAmI); } if (Main.netMode == 1 && this.whoAmI == Main.myPlayer && !quiet) { NetMessage.SendData(13, number: this.whoAmI); NetMessage.SendData(16, number: this.whoAmI); NetMessage.SendPlayerHurt(this.whoAmI, damageSource, Damage, hitDirection, Crit, pvp, hitContext); } CombatText.NewText(new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), Crit ? CombatText.DamagedFriendlyCrit : CombatText.DamagedFriendly, (int) dmg, Crit); this.statLife -= (int) dmg; switch (cooldownCounter) { case -1: this.immune = true; if (dmg == 1.0) { this.immuneTime = 20; if (this.longInvince) this.immuneTime += 20; } else { this.immuneTime = 40; if (this.longInvince) this.immuneTime += 40; } if (pvp) { this.immuneTime = 8; break; } break; case 0: this.hurtCooldowns[cooldownCounter] = dmg != 1.0 ? (this.longInvince ? 80 : 40) : (this.longInvince ? 40 : 20); break; case 1: this.hurtCooldowns[cooldownCounter] = dmg != 1.0 ? (this.longInvince ? 80 : 40) : (this.longInvince ? 40 : 20); break; } this.lifeRegenTime = 0; if (this.whoAmI == Main.myPlayer) { if (this.starCloak) { for (int index1 = 0; index1 < 3; ++index1) { float num8 = this.position.X + (float) Main.rand.Next(-400, 400); float num9 = this.position.Y - (float) Main.rand.Next(500, 800); Vector2 vector2 = new Vector2(num8, num9); float num10 = this.position.X + (float) (this.width / 2) - vector2.X; float num11 = this.position.Y + (float) (this.height / 2) - vector2.Y; float num12 = num10 + (float) Main.rand.Next(-100, 101); float num13 = 23f / (float) Math.Sqrt((double) num12 * (double) num12 + (double) num11 * (double) num11); float SpeedX = num12 * num13; float SpeedY = num11 * num13; int index2 = Projectile.NewProjectile(num8, num9, SpeedX, SpeedY, 92, 30, 5f, this.whoAmI); Main.projectile[index2].ai[1] = this.position.Y; } } if (this.bee) { int num = 1; if (Main.rand.Next(3) == 0) ++num; if (Main.rand.Next(3) == 0) ++num; if (this.strongBees && Main.rand.Next(3) == 0) ++num; for (int index = 0; index < num; ++index) Projectile.NewProjectile(this.position.X, this.position.Y, (float) Main.rand.Next(-35, 36) * 0.02f, (float) Main.rand.Next(-35, 36) * 0.02f, this.beeType(), this.beeDamage(7), this.beeKB(0.0f), Main.myPlayer); } } if (flag2 && hitDirection != 0) { if (!this.mount.Active || !this.mount.Cart) { float num14 = 10.5f; float num15 = -7.5f; if (this.noKnockback) { num14 = 2.5f; num15 = -1.5f; } this.velocity.X = num14 * (float) hitDirection; this.velocity.Y = num15; } } else if (!this.noKnockback && hitDirection != 0 && (!this.mount.Active || !this.mount.Cart)) { this.velocity.X = 4.5f * (float) hitDirection; this.velocity.Y = -3.5f; } if (this.stoned) Main.PlaySound(0, (int) this.position.X, (int) this.position.Y); else if (this.frostArmor) Main.PlaySound(SoundID.Item27, this.position); else if ((this.wereWolf || this.forceWerewolf) && !this.hideWolf) Main.PlaySound(3, (int) this.position.X, (int) this.position.Y, 6); else if (this.boneArmor) Main.PlaySound(3, (int) this.position.X, (int) this.position.Y, 2); else if (!this.Male) Main.PlaySound(20, (int) this.position.X, (int) this.position.Y); else Main.PlaySound(1, (int) this.position.X, (int) this.position.Y); if (this.statLife > 0) { double num16 = dmg / (double) this.statLifeMax2 * 100.0; float num17 = (float) (2 * hitDirection); float num18 = 0.0f; if (flag2) { num16 *= 12.0; num18 = 6f; } for (int index3 = 0; (double) index3 < num16; ++index3) { if (this.stoned) Dust.NewDust(this.position, this.width, this.height, 1, num17 + (float) hitDirection * num18 * Main.rand.NextFloat(), -2f); else if (this.frostArmor) { int index4 = Dust.NewDust(this.position, this.width, this.height, 135, num17 + (float) hitDirection * num18 * Main.rand.NextFloat(), -2f); Main.dust[index4].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } else if (this.boneArmor) { int index5 = Dust.NewDust(this.position, this.width, this.height, 26, num17 + (float) hitDirection * num18 * Main.rand.NextFloat(), -2f); Main.dust[index5].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } else Dust.NewDust(this.position, this.width, this.height, 5, num17 + (float) hitDirection * num18 * Main.rand.NextFloat(), -2f); } } else { this.statLife = 0; if (this.whoAmI == Main.myPlayer) this.KillMe(damageSource, dmg, hitDirection, pvp); } } if (pvp) dmg = Main.CalculateDamage(Damage1, this.statDefense); return dmg; } public void KillMeForGood() { bool isCloudSave = Main.ActivePlayerFileData.IsCloudSave; if (FileUtilities.Exists(Main.playerPathName, isCloudSave)) FileUtilities.Delete(Main.playerPathName, isCloudSave); if (FileUtilities.Exists(Main.playerPathName + ".bak", isCloudSave)) FileUtilities.Delete(Main.playerPathName + ".bak", isCloudSave); Main.ActivePlayerFileData = new PlayerFileData(); } public void KillMeOld(double dmg, int hitDirection, bool pvp = false, string deathText = " was slain...") { } public void KillMe(PlayerDeathReason damageSource, double dmg, int hitDirection, bool pvp = false) { if (this.dead) return; if (pvp) this.pvpDeath = true; if (this.trapDebuffSource) AchievementsHelper.HandleSpecialEvent(this, 4); this.lastDeathPostion = this.Center; this.lastDeathTime = DateTime.Now; this.showLastDeath = true; int coinsOwned = (int) Utils.CoinsCount(out bool _, this.inventory); if (Main.myPlayer == this.whoAmI) { this.lostCoins = coinsOwned; this.lostCoinString = Main.ValueToCoins(this.lostCoins); } if (Main.myPlayer == this.whoAmI) Main.mapFullscreen = false; if (Main.myPlayer == this.whoAmI) { this.trashItem.SetDefaults(); if (this.difficulty == (byte) 0) { for (int index = 0; index < 59; ++index) { if ((this.inventory[index].stack <= 0 ? 0 : (this.inventory[index].type < 1522 || this.inventory[index].type > 1527 ? (this.inventory[index].type == 3643 ? 1 : 0) : 1)) != 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, this.inventory[index].type); Main.item[number].netDefaults(this.inventory[index].netID); Main.item[number].Prefix((int) this.inventory[index].prefix); Main.item[number].stack = this.inventory[index].stack; Main.item[number].velocity.Y = (float) Main.rand.Next(-20, 1) * 0.2f; Main.item[number].velocity.X = (float) Main.rand.Next(-20, 21) * 0.2f; Main.item[number].noGrabDelay = 100; Main.item[number].favorited = false; Main.item[number].newAndShiny = false; if (Main.netMode == 1) NetMessage.SendData(21, number: number); this.inventory[index].SetDefaults(); } } } else if (this.difficulty == (byte) 1) this.DropItems(); else if (this.difficulty == (byte) 2) { this.DropItems(); this.KillMeForGood(); } } Main.PlaySound(5, (int) this.position.X, (int) this.position.Y); this.headVelocity.Y = (float) Main.rand.Next(-40, -10) * 0.1f; this.bodyVelocity.Y = (float) Main.rand.Next(-40, -10) * 0.1f; this.legVelocity.Y = (float) Main.rand.Next(-40, -10) * 0.1f; this.headVelocity.X = (float) Main.rand.Next(-20, 21) * 0.1f + (float) (2 * hitDirection); this.bodyVelocity.X = (float) Main.rand.Next(-20, 21) * 0.1f + (float) (2 * hitDirection); this.legVelocity.X = (float) Main.rand.Next(-20, 21) * 0.1f + (float) (2 * hitDirection); if (this.stoned) { this.headPosition = Vector2.Zero; this.bodyPosition = Vector2.Zero; this.legPosition = Vector2.Zero; } for (int index1 = 0; index1 < 100; ++index1) { if (this.stoned) Dust.NewDust(this.position, this.width, this.height, 1, (float) (2 * hitDirection), -2f); else if (this.frostArmor) { int index2 = Dust.NewDust(this.position, this.width, this.height, 135, (float) (2 * hitDirection), -2f); Main.dust[index2].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } else if (this.boneArmor) { int index3 = Dust.NewDust(this.position, this.width, this.height, 26, (float) (2 * hitDirection), -2f); Main.dust[index3].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this); } else Dust.NewDust(this.position, this.width, this.height, 5, (float) (2 * hitDirection), -2f); } this.mount.Dismount(this); this.dead = true; this.respawnTimer = 600; bool flag = false; if (Main.netMode != 0 && !pvp) { for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && (Main.npc[index].boss || Main.npc[index].type == 13 || Main.npc[index].type == 14 || Main.npc[index].type == 15) && (double) Math.Abs(this.Center.X - Main.npc[index].Center.X) + (double) Math.Abs(this.Center.Y - Main.npc[index].Center.Y) < 4000.0) { flag = true; break; } } } if (flag) this.respawnTimer += 600; if (Main.expertMode) this.respawnTimer = (int) ((double) this.respawnTimer * 1.5); this.immuneAlpha = 0; this.palladiumRegen = false; this.iceBarrier = false; this.crystalLeaf = false; NetworkText deathText = damageSource.GetDeathText(this.name); switch (Main.netMode) { case 0: Main.NewText(deathText.ToString(), (byte) 225, (byte) 25, (byte) 25); break; case 2: NetMessage.BroadcastChatMessage(deathText, new Color(225, 25, 25)); break; } if (Main.netMode == 1 && this.whoAmI == Main.myPlayer) NetMessage.SendPlayerDeath(this.whoAmI, damageSource, (int) dmg, hitDirection, pvp); if (this.whoAmI == Main.myPlayer && this.difficulty == (byte) 0) { if (!pvp) { this.DropCoins(); } else { this.lostCoins = 0; this.lostCoinString = Main.ValueToCoins(this.lostCoins); } } this.DropTombstone(coinsOwned, deathText, hitDirection); if (this.whoAmI != Main.myPlayer) return; try { WorldGen.saveToonWhilePlaying(); } catch { } } public void DropTombstone(int coinsOwned, NetworkText deathText, int hitDirection) { if (Main.netMode == 1) return; float num1 = (float) Main.rand.Next(-35, 36) * 0.1f; while ((double) num1 < 2.0 && (double) num1 > -2.0) num1 += (float) Main.rand.Next(-30, 31) * 0.1f; int num2 = Main.rand.Next(6); int Type = coinsOwned <= 100000 ? (num2 != 0 ? 200 + num2 : 43) : Main.rand.Next(5) + 527; int index = Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), (float) Main.rand.Next(10, 30) * 0.1f * (float) hitDirection + num1, (float) Main.rand.Next(-40, -20) * 0.1f, Type, 0, 0.0f, Main.myPlayer); Main.projectile[index].miscText = deathText.ToString(); } public bool ItemSpace(Item newItem) { if (newItem.uniqueStack && this.HasItem(newItem.type)) return false; if (newItem.type == 58 || newItem.type == 184 || newItem.type == 1734 || newItem.type == 1735 || newItem.type == 1867 || newItem.type == 1868 || ItemID.Sets.NebulaPickup[newItem.type]) return true; int num = 50; if (newItem.type == 71 || newItem.type == 72 || newItem.type == 73 || newItem.type == 74) num = 54; for (int index = 0; index < num; ++index) { if (this.inventory[index].type == 0) return true; } for (int index = 0; index < num; ++index) { if (this.inventory[index].type > 0 && this.inventory[index].stack < this.inventory[index].maxStack && newItem.IsTheSameAs(this.inventory[index])) return true; } if (newItem.ammo > 0 && !newItem.notAmmo) { if (newItem.type != 75 && newItem.type != 169 && newItem.type != 23 && newItem.type != 408 && newItem.type != 370 && newItem.type != 1246) { for (int index = 54; index < 58; ++index) { if (this.inventory[index].type == 0) return true; } } for (int index = 54; index < 58; ++index) { if (this.inventory[index].type > 0 && this.inventory[index].stack < this.inventory[index].maxStack && newItem.IsTheSameAs(this.inventory[index])) return true; } } for (int index = 54; index < 58; ++index) { if (this.inventory[index].type > 0 && this.inventory[index].stack < this.inventory[index].maxStack && newItem.IsTheSameAs(this.inventory[index])) return true; } return false; } public void DoCoins(int i) { if (this.inventory[i].stack != 100 || this.inventory[i].type != 71 && this.inventory[i].type != 72 && this.inventory[i].type != 73) return; this.inventory[i].SetDefaults(this.inventory[i].type + 1); for (int i1 = 0; i1 < 54; ++i1) { if (this.inventory[i1].IsTheSameAs(this.inventory[i]) && i1 != i && this.inventory[i1].type == this.inventory[i].type && this.inventory[i1].stack < this.inventory[i1].maxStack) { ++this.inventory[i1].stack; this.inventory[i].SetDefaults(); this.inventory[i].active = false; this.inventory[i].TurnToAir(); this.DoCoins(i1); } } } public Item FillAmmo(int plr, Item newItem, bool noText = false) { Item obj = newItem; for (int i = 54; i < 58; ++i) { if (this.inventory[i].type > 0 && this.inventory[i].stack < this.inventory[i].maxStack && obj.IsTheSameAs(this.inventory[i])) { Main.PlaySound(7, (int) this.position.X, (int) this.position.Y); if (obj.stack + this.inventory[i].stack <= this.inventory[i].maxStack) { this.inventory[i].stack += obj.stack; if (!noText) ItemText.NewText(newItem, obj.stack); this.DoCoins(i); if (plr == Main.myPlayer) Recipe.FindRecipes(); return new Item(); } obj.stack -= this.inventory[i].maxStack - this.inventory[i].stack; if (!noText) ItemText.NewText(newItem, this.inventory[i].maxStack - this.inventory[i].stack); this.inventory[i].stack = this.inventory[i].maxStack; this.DoCoins(i); if (plr == Main.myPlayer) Recipe.FindRecipes(); } } if (obj.bait <= 0 && obj.type != 169 && obj.type != 75 && obj.type != 23 && obj.type != 408 && obj.type != 370 && obj.type != 1246 && obj.type != 154 && !obj.notAmmo) { for (int i = 54; i < 58; ++i) { if (this.inventory[i].type == 0) { this.inventory[i] = obj; if (!noText) ItemText.NewText(newItem, newItem.stack); this.DoCoins(i); Main.PlaySound(7, (int) this.position.X, (int) this.position.Y); if (plr == Main.myPlayer) Recipe.FindRecipes(); return new Item(); } } } return obj; } public Item GetItem(int plr, Item newItem, bool longText = false, bool noText = false) { bool flag = newItem.type >= 71 && newItem.type <= 74; Item newItem1 = newItem; int num1 = 50; if (newItem.noGrabDelay > 0) return newItem1; int num2 = 0; if (newItem.uniqueStack && this.HasItem(newItem.type)) return newItem1; if (newItem.type == 71 || newItem.type == 72 || newItem.type == 73 || newItem.type == 74) { num2 = -4; num1 = 54; } if ((newItem1.ammo > 0 || newItem1.bait > 0) && !newItem1.notAmmo || newItem1.type == 530) { newItem1 = this.FillAmmo(plr, newItem1, noText); if (newItem1.type == 0 || newItem1.stack == 0) return new Item(); } for (int index = num2; index < 50; ++index) { int i = index; if (i < 0) i = 54 + index; if (this.inventory[i].type > 0 && this.inventory[i].stack < this.inventory[i].maxStack && newItem1.IsTheSameAs(this.inventory[i])) { if (flag) Main.PlaySound(38, (int) this.position.X, (int) this.position.Y); else Main.PlaySound(7, (int) this.position.X, (int) this.position.Y); if (newItem1.stack + this.inventory[i].stack <= this.inventory[i].maxStack) { this.inventory[i].stack += newItem1.stack; if (!noText) ItemText.NewText(newItem, newItem1.stack, longText: longText); this.DoCoins(i); if (plr == Main.myPlayer) Recipe.FindRecipes(); AchievementsHelper.NotifyItemPickup(this, newItem1); return new Item(); } AchievementsHelper.NotifyItemPickup(this, newItem1, this.inventory[i].maxStack - this.inventory[i].stack); newItem1.stack -= this.inventory[i].maxStack - this.inventory[i].stack; if (!noText) ItemText.NewText(newItem, this.inventory[i].maxStack - this.inventory[i].stack, longText: longText); this.inventory[i].stack = this.inventory[i].maxStack; this.DoCoins(i); if (plr == Main.myPlayer) Recipe.FindRecipes(); } } if (newItem.type != 71 && newItem.type != 72 && newItem.type != 73 && newItem.type != 74 && newItem.useStyle > 0) { for (int i = 0; i < 10; ++i) { if (this.inventory[i].type == 0) { this.inventory[i] = newItem1; if (!noText) ItemText.NewText(newItem, newItem.stack, longText: longText); this.DoCoins(i); if (flag) Main.PlaySound(38, (int) this.position.X, (int) this.position.Y); else Main.PlaySound(7, (int) this.position.X, (int) this.position.Y); if (plr == Main.myPlayer) Recipe.FindRecipes(); AchievementsHelper.NotifyItemPickup(this, newItem1); return new Item(); } } } if (newItem.favorited) { for (int i = 0; i < num1; ++i) { if (this.inventory[i].type == 0) { this.inventory[i] = newItem1; if (!noText) ItemText.NewText(newItem, newItem.stack, longText: longText); this.DoCoins(i); if (flag) Main.PlaySound(38, (int) this.position.X, (int) this.position.Y); else Main.PlaySound(7, (int) this.position.X, (int) this.position.Y); if (plr == Main.myPlayer) Recipe.FindRecipes(); AchievementsHelper.NotifyItemPickup(this, newItem1); return new Item(); } } } else { for (int i = num1 - 1; i >= 0; --i) { if (this.inventory[i].type == 0) { this.inventory[i] = newItem1; if (!noText) ItemText.NewText(newItem, newItem.stack, longText: longText); this.DoCoins(i); if (flag) Main.PlaySound(38, (int) this.position.X, (int) this.position.Y); else Main.PlaySound(7, (int) this.position.X, (int) this.position.Y); if (plr == Main.myPlayer) Recipe.FindRecipes(); AchievementsHelper.NotifyItemPickup(this, newItem1); return new Item(); } } } return newItem1; } public void PlaceThing() { if ((this.inventory[this.selectedItem].type == 1071 || this.inventory[this.selectedItem].type == 1543) && (double) this.position.X / 16.0 - (double) Player.tileRangeX - (double) this.inventory[this.selectedItem].tileBoost - (double) this.blockRange <= (double) Player.tileTargetX && ((double) this.position.X + (double) this.width) / 16.0 + (double) Player.tileRangeX + (double) this.inventory[this.selectedItem].tileBoost - 1.0 + (double) this.blockRange >= (double) Player.tileTargetX && (double) this.position.Y / 16.0 - (double) Player.tileRangeY - (double) this.inventory[this.selectedItem].tileBoost - (double) this.blockRange <= (double) Player.tileTargetY && ((double) this.position.Y + (double) this.height) / 16.0 + (double) Player.tileRangeY + (double) this.inventory[this.selectedItem].tileBoost - 2.0 + (double) this.blockRange >= (double) Player.tileTargetY) { int tileTargetX = Player.tileTargetX; int tileTargetY = Player.tileTargetY; if (Main.tile[tileTargetX, tileTargetY] != null && Main.tile[tileTargetX, tileTargetY].active()) { this.showItemIcon = true; if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem) { int num1 = -1; int num2 = -1; for (int index = 0; index < 58; ++index) { if (this.inventory[index].stack > 0 && this.inventory[index].paint > (byte) 0) { num1 = (int) this.inventory[index].paint; num2 = index; break; } } if (num1 > 0 && (int) Main.tile[tileTargetX, tileTargetY].color() != num1 && WorldGen.paintTile(tileTargetX, tileTargetY, (byte) num1, true)) { int index = num2; --this.inventory[index].stack; if (this.inventory[index].stack <= 0) this.inventory[index].SetDefaults(); this.itemTime = this.inventory[this.selectedItem].useTime; } } } } if ((this.inventory[this.selectedItem].type == 1072 || this.inventory[this.selectedItem].type == 1544) && (double) this.position.X / 16.0 - (double) Player.tileRangeX - (double) this.inventory[this.selectedItem].tileBoost - (double) this.blockRange <= (double) Player.tileTargetX && ((double) this.position.X + (double) this.width) / 16.0 + (double) Player.tileRangeX + (double) this.inventory[this.selectedItem].tileBoost - 1.0 + (double) this.blockRange >= (double) Player.tileTargetX && (double) this.position.Y / 16.0 - (double) Player.tileRangeY - (double) this.inventory[this.selectedItem].tileBoost - (double) this.blockRange <= (double) Player.tileTargetY && ((double) this.position.Y + (double) this.height) / 16.0 + (double) Player.tileRangeY + (double) this.inventory[this.selectedItem].tileBoost - 2.0 + (double) this.blockRange >= (double) Player.tileTargetY) { int tileTargetX = Player.tileTargetX; int tileTargetY = Player.tileTargetY; if (Main.tile[tileTargetX, tileTargetY] != null && Main.tile[tileTargetX, tileTargetY].wall > (byte) 0) { this.showItemIcon = true; if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem) { int num3 = -1; int num4 = -1; for (int index = 0; index < 58; ++index) { if (this.inventory[index].stack > 0 && this.inventory[index].paint > (byte) 0) { num3 = (int) this.inventory[index].paint; num4 = index; break; } } if (num3 > 0 && (int) Main.tile[tileTargetX, tileTargetY].wallColor() != num3 && WorldGen.paintWall(tileTargetX, tileTargetY, (byte) num3, true)) { int index = num4; --this.inventory[index].stack; if (this.inventory[index].stack <= 0) this.inventory[index].SetDefaults(); this.itemTime = this.inventory[this.selectedItem].useTime; } } } } if ((this.inventory[this.selectedItem].type == 1100 || this.inventory[this.selectedItem].type == 1545) && (double) this.position.X / 16.0 - (double) Player.tileRangeX - (double) this.inventory[this.selectedItem].tileBoost - (double) this.blockRange <= (double) Player.tileTargetX && ((double) this.position.X + (double) this.width) / 16.0 + (double) Player.tileRangeX + (double) this.inventory[this.selectedItem].tileBoost - 1.0 + (double) this.blockRange >= (double) Player.tileTargetX && (double) this.position.Y / 16.0 - (double) Player.tileRangeY - (double) this.inventory[this.selectedItem].tileBoost - (double) this.blockRange <= (double) Player.tileTargetY && ((double) this.position.Y + (double) this.height) / 16.0 + (double) Player.tileRangeY + (double) this.inventory[this.selectedItem].tileBoost - 2.0 + (double) this.blockRange >= (double) Player.tileTargetY) { int tileTargetX = Player.tileTargetX; int tileTargetY = Player.tileTargetY; if (Main.tile[tileTargetX, tileTargetY] != null && (Main.tile[tileTargetX, tileTargetY].wallColor() > (byte) 0 && Main.tile[tileTargetX, tileTargetY].wall > (byte) 0 || Main.tile[tileTargetX, tileTargetY].color() > (byte) 0 && Main.tile[tileTargetX, tileTargetY].active())) { this.showItemIcon = true; if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem) { if (Main.tile[tileTargetX, tileTargetY].color() > (byte) 0 && Main.tile[tileTargetX, tileTargetY].active() && WorldGen.paintTile(tileTargetX, tileTargetY, (byte) 0, true)) this.itemTime = this.inventory[this.selectedItem].useTime; else if (Main.tile[tileTargetX, tileTargetY].wallColor() > (byte) 0 && Main.tile[tileTargetX, tileTargetY].wall > (byte) 0 && WorldGen.paintWall(tileTargetX, tileTargetY, (byte) 0, true)) this.itemTime = this.inventory[this.selectedItem].useTime; } } } if ((this.inventory[this.selectedItem].type == 929 || this.inventory[this.selectedItem].type == 1338 || this.inventory[this.selectedItem].type == 1345) && (double) this.position.X / 16.0 - (double) Player.tileRangeX - (double) this.inventory[this.selectedItem].tileBoost - (double) this.blockRange <= (double) Player.tileTargetX && ((double) this.position.X + (double) this.width) / 16.0 + (double) Player.tileRangeX + (double) this.inventory[this.selectedItem].tileBoost - 1.0 + (double) this.blockRange >= (double) Player.tileTargetX && (double) this.position.Y / 16.0 - (double) Player.tileRangeY - (double) this.inventory[this.selectedItem].tileBoost - (double) this.blockRange <= (double) Player.tileTargetY && ((double) this.position.Y + (double) this.height) / 16.0 + (double) Player.tileRangeY + (double) this.inventory[this.selectedItem].tileBoost - 2.0 + (double) this.blockRange >= (double) Player.tileTargetY) { int tileTargetX = Player.tileTargetX; int tileTargetY = Player.tileTargetY; if (Main.tile[tileTargetX, tileTargetY].active() && Main.tile[tileTargetX, tileTargetY].type == (ushort) 209) this.ShootFromCannon(tileTargetX, tileTargetY); } if (this.inventory[this.selectedItem].type >= 1874 && this.inventory[this.selectedItem].type <= 1905 && Main.tile[Player.tileTargetX, Player.tileTargetY].active() && Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 171 && (double) this.position.X / 16.0 - (double) Player.tileRangeX - (double) this.inventory[this.selectedItem].tileBoost - (double) this.blockRange <= (double) Player.tileTargetX && ((double) this.position.X + (double) this.width) / 16.0 + (double) Player.tileRangeX + (double) this.inventory[this.selectedItem].tileBoost - 1.0 + (double) this.blockRange >= (double) Player.tileTargetX && (double) this.position.Y / 16.0 - (double) Player.tileRangeY - (double) this.inventory[this.selectedItem].tileBoost - (double) this.blockRange <= (double) Player.tileTargetY && ((double) this.position.Y + (double) this.height) / 16.0 + (double) Player.tileRangeY + (double) this.inventory[this.selectedItem].tileBoost - 2.0 + (double) this.blockRange >= (double) Player.tileTargetY && this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem) { int type = this.inventory[this.selectedItem].type; if (type >= 1874 && type <= 1877) { int style = type - 1873; if (WorldGen.checkXmasTreeDrop(Player.tileTargetX, Player.tileTargetY, 0) != style) { this.itemTime = this.inventory[this.selectedItem].useTime; WorldGen.dropXmasTree(Player.tileTargetX, Player.tileTargetY, 0); WorldGen.setXmasTree(Player.tileTargetX, Player.tileTargetY, 0, style); int tileTargetX = Player.tileTargetX; int tileTargetY = Player.tileTargetY; if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < (short) 10) { tileTargetX -= (int) Main.tile[Player.tileTargetX, Player.tileTargetY].frameX; tileTargetY -= (int) Main.tile[Player.tileTargetX, Player.tileTargetY].frameY; } NetMessage.SendTileSquare(-1, tileTargetX, tileTargetY, 1); } } else if (type >= 1878 && type <= 1883) { int style = type - 1877; if (WorldGen.checkXmasTreeDrop(Player.tileTargetX, Player.tileTargetY, 1) != style) { this.itemTime = this.inventory[this.selectedItem].useTime; WorldGen.dropXmasTree(Player.tileTargetX, Player.tileTargetY, 1); WorldGen.setXmasTree(Player.tileTargetX, Player.tileTargetY, 1, style); int tileTargetX = Player.tileTargetX; int tileTargetY = Player.tileTargetY; if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < (short) 10) { tileTargetX -= (int) Main.tile[Player.tileTargetX, Player.tileTargetY].frameX; tileTargetY -= (int) Main.tile[Player.tileTargetX, Player.tileTargetY].frameY; } NetMessage.SendTileSquare(-1, tileTargetX, tileTargetY, 1); } } else if (type >= 1884 && type <= 1894) { int style = type - 1883; if (WorldGen.checkXmasTreeDrop(Player.tileTargetX, Player.tileTargetY, 2) != style) { this.itemTime = this.inventory[this.selectedItem].useTime; WorldGen.dropXmasTree(Player.tileTargetX, Player.tileTargetY, 2); WorldGen.setXmasTree(Player.tileTargetX, Player.tileTargetY, 2, style); int tileTargetX = Player.tileTargetX; int tileTargetY = Player.tileTargetY; if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < (short) 10) { tileTargetX -= (int) Main.tile[Player.tileTargetX, Player.tileTargetY].frameX; tileTargetY -= (int) Main.tile[Player.tileTargetX, Player.tileTargetY].frameY; } NetMessage.SendTileSquare(-1, tileTargetX, tileTargetY, 1); } } else if (type >= 1895 && type <= 1905) { int style = type - 1894; if (WorldGen.checkXmasTreeDrop(Player.tileTargetX, Player.tileTargetY, 3) != style) { this.itemTime = this.inventory[this.selectedItem].useTime; WorldGen.dropXmasTree(Player.tileTargetX, Player.tileTargetY, 3); WorldGen.setXmasTree(Player.tileTargetX, Player.tileTargetY, 3, style); int tileTargetX = Player.tileTargetX; int tileTargetY = Player.tileTargetY; if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < (short) 10) { tileTargetX -= (int) Main.tile[Player.tileTargetX, Player.tileTargetY].frameX; tileTargetY -= (int) Main.tile[Player.tileTargetX, Player.tileTargetY].frameY; } NetMessage.SendTileSquare(-1, tileTargetX, tileTargetY, 1); } } } if (ItemID.Sets.ExtractinatorMode[this.inventory[this.selectedItem].type] >= 0 && Main.tile[Player.tileTargetX, Player.tileTargetY].active() && Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 219) { if ((double) this.position.X / 16.0 - (double) Player.tileRangeX - (double) this.inventory[this.selectedItem].tileBoost - (double) this.blockRange <= (double) Player.tileTargetX && ((double) this.position.X + (double) this.width) / 16.0 + (double) Player.tileRangeX + (double) this.inventory[this.selectedItem].tileBoost - 1.0 + (double) this.blockRange >= (double) Player.tileTargetX && (double) this.position.Y / 16.0 - (double) Player.tileRangeY - (double) this.inventory[this.selectedItem].tileBoost - (double) this.blockRange <= (double) Player.tileTargetY && ((double) this.position.Y + (double) this.height) / 16.0 + (double) Player.tileRangeY + (double) this.inventory[this.selectedItem].tileBoost - 2.0 + (double) this.blockRange >= (double) Player.tileTargetY && this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem) { this.itemTime = this.inventory[this.selectedItem].useTime; Main.PlaySound(7); Player.ExtractinatorUse(ItemID.Sets.ExtractinatorMode[this.inventory[this.selectedItem].type]); } } else if (!this.noBuilding && this.inventory[this.selectedItem].createTile >= 0 && (double) this.position.X / 16.0 - (double) Player.tileRangeX - (double) this.inventory[this.selectedItem].tileBoost - (double) this.blockRange <= (double) Player.tileTargetX && ((double) this.position.X + (double) this.width) / 16.0 + (double) Player.tileRangeX + (double) this.inventory[this.selectedItem].tileBoost - 1.0 + (double) this.blockRange >= (double) Player.tileTargetX && (double) this.position.Y / 16.0 - (double) Player.tileRangeY - (double) this.inventory[this.selectedItem].tileBoost - (double) this.blockRange <= (double) Player.tileTargetY && ((double) this.position.Y + (double) this.height) / 16.0 + (double) Player.tileRangeY + (double) this.inventory[this.selectedItem].tileBoost - 2.0 + (double) this.blockRange >= (double) Player.tileTargetY) { this.showItemIcon = true; bool flag1 = false; if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid > (byte) 0 && Main.tile[Player.tileTargetX, Player.tileTargetY].lava()) { if (Main.tileSolid[this.inventory[this.selectedItem].createTile]) flag1 = true; else if (!TileObjectData.CheckLiquidPlacement(this.inventory[this.selectedItem].createTile, this.inventory[this.selectedItem].placeStyle, Main.tile[Player.tileTargetX, Player.tileTargetY])) flag1 = true; } bool flag2 = true; if (PlayerInput.UsingGamepad && this.inventory[this.selectedItem].createTile == 4 && Main.SmartCursorEnabled && !Main.SmartCursorShowing) flag2 = false; if (this.inventory[this.selectedItem].tileWand > 0) { int tileWand = this.inventory[this.selectedItem].tileWand; flag2 = false; for (int index = 0; index < 58; ++index) { if (tileWand == this.inventory[index].type && this.inventory[index].stack > 0) { flag2 = true; break; } } } if (Main.tileRope[this.inventory[this.selectedItem].createTile] && flag2 && Main.tile[Player.tileTargetX, Player.tileTargetY].active() && Main.tileRope[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { int tileTargetY = Player.tileTargetY; int tileTargetX = Player.tileTargetX; int createTile = this.inventory[this.selectedItem].createTile; while (Main.tile[tileTargetX, tileTargetY].active() && Main.tileRope[(int) Main.tile[tileTargetX, tileTargetY].type] && tileTargetY < Main.maxTilesX - 5 && Main.tile[tileTargetX, tileTargetY + 2] != null && !Main.tile[tileTargetX, tileTargetY + 1].lava()) { ++tileTargetY; if (Main.tile[tileTargetX, tileTargetY] == null) { flag2 = false; tileTargetY = Player.tileTargetY; } } if (!Main.tile[tileTargetX, tileTargetY].active()) Player.tileTargetY = tileTargetY; } if (flag2 && (!Main.tile[Player.tileTargetX, Player.tileTargetY].active() && !flag1 || Main.tileCut[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type] || Main.tile[Player.tileTargetX, Player.tileTargetY].type >= (ushort) 373 && Main.tile[Player.tileTargetX, Player.tileTargetY].type <= (ushort) 375 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 461 || this.inventory[this.selectedItem].createTile == 199 || this.inventory[this.selectedItem].createTile == 23 || this.inventory[this.selectedItem].createTile == 2 || this.inventory[this.selectedItem].createTile == 109 || this.inventory[this.selectedItem].createTile == 60 || this.inventory[this.selectedItem].createTile == 70 || TileID.Sets.BreakableWhenPlacing[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type]) && this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem) { bool flag3 = false; bool flag4 = false; TileObject objectData = new TileObject(); if (TileObjectData.CustomPlace(this.inventory[this.selectedItem].createTile, this.inventory[this.selectedItem].placeStyle) && this.inventory[this.selectedItem].createTile != 82) { flag4 = true; flag3 = TileObject.CanPlace(Player.tileTargetX, Player.tileTargetY, (int) (ushort) this.inventory[this.selectedItem].createTile, this.inventory[this.selectedItem].placeStyle, this.direction, out objectData); int width = 0; int height = 0; int x = 0; int y = 0; switch (objectData.type) { case 138: width = 32; height = 32; x = objectData.xCoord * 16; y = objectData.yCoord * 16; break; case 235: width = 48; height = 16; x = objectData.xCoord * 16; y = objectData.yCoord * 16; break; } if (width != 0 && height != 0) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(x, y, width, height); for (int index = 0; index < (int) byte.MaxValue; ++index) { Player player = Main.player[index]; if (player.active && !player.dead && player.Hitbox.Intersects(rectangle)) { flag3 = false; break; } } } if (objectData.type == 454) { for (int index = -2; index < 2; ++index) { Tile tile = Main.tile[Player.tileTargetX + index, Player.tileTargetY]; if (tile.active() && tile.type == (ushort) 454) flag3 = false; } } if (objectData.type == 254) { for (int index1 = -1; index1 < 1; ++index1) { for (int index2 = -1; index2 < 1; ++index2) { if (!WorldGen.CanCutTile(Player.tileTargetX + index2, Player.tileTargetY + index1, TileCuttingContext.TilePlacement)) flag3 = false; } } } } else { if (this.inventory[this.selectedItem].type == 213) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 0 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 1) flag3 = true; } else if (this.inventory[this.selectedItem].createTile == 23 || this.inventory[this.selectedItem].createTile == 2 || this.inventory[this.selectedItem].createTile == 109 || this.inventory[this.selectedItem].createTile == 199) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].nactive() && Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 0) flag3 = true; } else if (this.inventory[this.selectedItem].createTile == 227) flag3 = true; else if (this.inventory[this.selectedItem].createTile >= 373 && this.inventory[this.selectedItem].createTile <= 375) { int tileTargetX = Player.tileTargetX; int index = Player.tileTargetY - 1; if (Main.tile[tileTargetX, index].nactive() && Main.tileSolid[(int) Main.tile[tileTargetX, index].type] && !Main.tileSolidTop[(int) Main.tile[tileTargetX, index].type]) flag3 = true; } else if (this.inventory[this.selectedItem].createTile == 461) { int tileTargetX = Player.tileTargetX; int index = Player.tileTargetY - 1; if (Main.tile[tileTargetX, index].nactive() && Main.tileSolid[(int) Main.tile[tileTargetX, index].type] && !Main.tileSolidTop[(int) Main.tile[tileTargetX, index].type]) flag3 = true; } else if (this.inventory[this.selectedItem].createTile == 60 || this.inventory[this.selectedItem].createTile == 70) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].nactive() && Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 59) flag3 = true; } else if (this.inventory[this.selectedItem].createTile == 4 || this.inventory[this.selectedItem].createTile == 136) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].wall > (byte) 0) { flag3 = true; } else { if (!WorldGen.SolidTileNoAttach(Player.tileTargetX, Player.tileTargetY + 1) && !WorldGen.SolidTileNoAttach(Player.tileTargetX - 1, Player.tileTargetY) && !WorldGen.SolidTileNoAttach(Player.tileTargetX + 1, Player.tileTargetY)) { if (!WorldGen.SolidTileNoAttach(Player.tileTargetX, Player.tileTargetY + 1) && (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].halfBrick() || Main.tile[Player.tileTargetX, Player.tileTargetY + 1].slope() != (byte) 0)) { if (!TileID.Sets.Platforms[(int) Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type]) { WorldGen.SlopeTile(Player.tileTargetX, Player.tileTargetY + 1); if (Main.netMode == 1) NetMessage.SendData(17, number: 14, number2: ((float) Player.tileTargetX), number3: ((float) (Player.tileTargetY + 1))); } } else if (!WorldGen.SolidTileNoAttach(Player.tileTargetX, Player.tileTargetY + 1) && !WorldGen.SolidTileNoAttach(Player.tileTargetX - 1, Player.tileTargetY) && (Main.tile[Player.tileTargetX - 1, Player.tileTargetY].halfBrick() || Main.tile[Player.tileTargetX - 1, Player.tileTargetY].slope() != (byte) 0)) { if (!TileID.Sets.Platforms[(int) Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type]) { WorldGen.SlopeTile(Player.tileTargetX - 1, Player.tileTargetY); if (Main.netMode == 1) NetMessage.SendData(17, number: 14, number2: ((float) (Player.tileTargetX - 1)), number3: ((float) Player.tileTargetY)); } } else if (!WorldGen.SolidTileNoAttach(Player.tileTargetX, Player.tileTargetY + 1) && !WorldGen.SolidTileNoAttach(Player.tileTargetX - 1, Player.tileTargetY) && !WorldGen.SolidTileNoAttach(Player.tileTargetX + 1, Player.tileTargetY) && (Main.tile[Player.tileTargetX + 1, Player.tileTargetY].halfBrick() || Main.tile[Player.tileTargetX + 1, Player.tileTargetY].slope() != (byte) 0) && TileID.Sets.Platforms[(int) Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type]) { WorldGen.SlopeTile(Player.tileTargetX + 1, Player.tileTargetY); if (Main.netMode == 1) NetMessage.SendData(17, number: 14, number2: ((float) (Player.tileTargetX + 1)), number3: ((float) Player.tileTargetY)); } } int index3 = (int) Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type; if (Main.tile[Player.tileTargetX, Player.tileTargetY].halfBrick()) index3 = -1; int index4 = (int) Main.tile[Player.tileTargetX - 1, Player.tileTargetY].type; int index5 = (int) Main.tile[Player.tileTargetX + 1, Player.tileTargetY].type; int num5 = (int) Main.tile[Player.tileTargetX - 1, Player.tileTargetY - 1].type; int num6 = (int) Main.tile[Player.tileTargetX + 1, Player.tileTargetY - 1].type; int num7 = (int) Main.tile[Player.tileTargetX - 1, Player.tileTargetY - 1].type; int num8 = (int) Main.tile[Player.tileTargetX + 1, Player.tileTargetY + 1].type; if (!Main.tile[Player.tileTargetX, Player.tileTargetY + 1].nactive()) index3 = -1; if (!Main.tile[Player.tileTargetX - 1, Player.tileTargetY].nactive()) index4 = -1; if (!Main.tile[Player.tileTargetX + 1, Player.tileTargetY].nactive()) index5 = -1; if (!Main.tile[Player.tileTargetX - 1, Player.tileTargetY - 1].nactive()) num5 = -1; if (!Main.tile[Player.tileTargetX + 1, Player.tileTargetY - 1].nactive()) num6 = -1; if (!Main.tile[Player.tileTargetX - 1, Player.tileTargetY + 1].nactive()) num7 = -1; if (!Main.tile[Player.tileTargetX + 1, Player.tileTargetY + 1].nactive()) num8 = -1; if (index3 >= 0 && Main.tileSolid[index3] && (!Main.tileNoAttach[index3] || index3 >= 0 && TileID.Sets.Platforms[index3])) flag3 = true; else if (index4 >= 0 && Main.tileSolid[index4] && !Main.tileNoAttach[index4] || index4 == 5 && num5 == 5 && num7 == 5 || index4 == 124) flag3 = true; else if (index5 >= 0 && Main.tileSolid[index5] && !Main.tileNoAttach[index5] || index5 == 5 && num6 == 5 && num8 == 5 || index5 == 124) flag3 = true; } } else if (this.inventory[this.selectedItem].createTile == 78 || this.inventory[this.selectedItem].createTile == 98 || this.inventory[this.selectedItem].createTile == 100 || this.inventory[this.selectedItem].createTile == 173 || this.inventory[this.selectedItem].createTile == 174 || this.inventory[this.selectedItem].createTile == 324) { if (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].nactive() && (Main.tileSolid[(int) Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type] || Main.tileTable[(int) Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type])) flag3 = true; } else if (this.inventory[this.selectedItem].createTile == 419) { if (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].active() && (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type == (ushort) 419 || this.inventory[this.selectedItem].placeStyle != 2 && Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type == (ushort) 420)) flag3 = true; } else if (this.inventory[this.selectedItem].createTile == 13 || this.inventory[this.selectedItem].createTile == 29 || this.inventory[this.selectedItem].createTile == 33 || this.inventory[this.selectedItem].createTile == 49 || this.inventory[this.selectedItem].createTile == 50 || this.inventory[this.selectedItem].createTile == 103) { if (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].nactive() && Main.tileTable[(int) Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type]) flag3 = true; } else if (this.inventory[this.selectedItem].createTile == 275 || this.inventory[this.selectedItem].createTile == 276 || this.inventory[this.selectedItem].createTile == 277) flag3 = true; else if (this.inventory[this.selectedItem].createTile == 51 || this.inventory[this.selectedItem].createTile == 330 || this.inventory[this.selectedItem].createTile == 331 || this.inventory[this.selectedItem].createTile == 332 || this.inventory[this.selectedItem].createTile == 333 || this.inventory[this.selectedItem].createTile == 336 || this.inventory[this.selectedItem].createTile == 340 || this.inventory[this.selectedItem].createTile == 342 || this.inventory[this.selectedItem].createTile == 341 || this.inventory[this.selectedItem].createTile == 343 || this.inventory[this.selectedItem].createTile == 344 || this.inventory[this.selectedItem].createTile == 379 || this.inventory[this.selectedItem].createTile == 351) { if (Main.tile[Player.tileTargetX + 1, Player.tileTargetY].active() || Main.tile[Player.tileTargetX + 1, Player.tileTargetY].wall > (byte) 0 || Main.tile[Player.tileTargetX - 1, Player.tileTargetY].active() || Main.tile[Player.tileTargetX - 1, Player.tileTargetY].wall > (byte) 0 || Main.tile[Player.tileTargetX, Player.tileTargetY + 1].active() || Main.tile[Player.tileTargetX, Player.tileTargetY + 1].wall > (byte) 0 || Main.tile[Player.tileTargetX, Player.tileTargetY - 1].active() || Main.tile[Player.tileTargetX, Player.tileTargetY - 1].wall > (byte) 0) flag3 = true; } else if (this.inventory[this.selectedItem].createTile == 314) { for (int index6 = Player.tileTargetX - 1; index6 <= Player.tileTargetX + 1; ++index6) { for (int index7 = Player.tileTargetY - 1; index7 <= Player.tileTargetY + 1; ++index7) { Tile tile = Main.tile[index6, index7]; if (tile.active() || tile.wall > (byte) 0) { flag3 = true; break; } } } } else { Tile tile1 = Main.tile[Player.tileTargetX - 1, Player.tileTargetY]; Tile tile2 = Main.tile[Player.tileTargetX + 1, Player.tileTargetY]; Tile tile3 = Main.tile[Player.tileTargetX, Player.tileTargetY - 1]; Tile tile4 = Main.tile[Player.tileTargetX, Player.tileTargetY + 1]; if (tile2.active() && (Main.tileSolid[(int) tile2.type] || Main.tileRope[(int) tile2.type] || tile2.type == (ushort) 314) || tile2.wall > (byte) 0 || tile1.active() && (Main.tileSolid[(int) tile1.type] || Main.tileRope[(int) tile1.type] || tile1.type == (ushort) 314) || tile1.wall > (byte) 0 || tile4.active() && (Main.tileSolid[(int) tile4.type] || tile4.type == (ushort) 124 || Main.tileRope[(int) tile4.type] || tile4.type == (ushort) 314) || tile4.wall > (byte) 0 || tile3.active() && (Main.tileSolid[(int) tile3.type] || tile3.type == (ushort) 124 || Main.tileRope[(int) tile3.type] || tile3.type == (ushort) 314) || tile3.wall > (byte) 0) flag3 = true; } if (this.inventory[this.selectedItem].type == 213 && Main.tile[Player.tileTargetX, Player.tileTargetY].active()) { int tileTargetX = Player.tileTargetX; int tileTargetY = Player.tileTargetY; if (Main.tile[tileTargetX, tileTargetY].type == (ushort) 3 || Main.tile[tileTargetX, tileTargetY].type == (ushort) 73 || Main.tile[tileTargetX, tileTargetY].type == (ushort) 84) { WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY); if (!Main.tile[Player.tileTargetX, Player.tileTargetY].active() && Main.netMode == 1) NetMessage.SendData(17, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); } else if (Main.tile[tileTargetX, tileTargetY].type == (ushort) 83) { bool flag5 = false; int num = (int) Main.tile[tileTargetX, tileTargetY].frameX / 18; if (num == 0 && Main.dayTime) flag5 = true; if (num == 1 && !Main.dayTime) flag5 = true; if (num == 3 && !Main.dayTime && (Main.bloodMoon || Main.moonPhase == 0)) flag5 = true; if (num == 4 && (Main.raining || (double) Main.cloudAlpha > 0.0)) flag5 = true; if (num == 5 && !Main.raining && Main.dayTime && Main.time > 40500.0) flag5 = true; if (flag5) { WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY); NetMessage.SendData(17, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); } } } if (Main.tileAlch[this.inventory[this.selectedItem].createTile]) flag3 = true; if (Main.tile[Player.tileTargetX, Player.tileTargetY].active() && (Main.tileCut[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type] || TileID.Sets.BreakableWhenPlacing[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type] || Main.tile[Player.tileTargetX, Player.tileTargetY].type >= (ushort) 373 && Main.tile[Player.tileTargetX, Player.tileTargetY].type <= (ushort) 375 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 461)) { if ((int) Main.tile[Player.tileTargetX, Player.tileTargetY].type != this.inventory[this.selectedItem].createTile) { if (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type != (ushort) 78 && Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type != (ushort) 380 || (Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 3 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 73) && Main.tileAlch[this.inventory[this.selectedItem].createTile]) { WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY); if (!Main.tile[Player.tileTargetX, Player.tileTargetY].active() && Main.netMode == 1) NetMessage.SendData(17, number: 4, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); } else flag3 = false; } else flag3 = false; } if (!flag3 && this.inventory[this.selectedItem].createTile >= 0 && TileID.Sets.Platforms[this.inventory[this.selectedItem].createTile]) { for (int index8 = Player.tileTargetX - 1; index8 <= Player.tileTargetX + 1; ++index8) { for (int index9 = Player.tileTargetY - 1; index9 <= Player.tileTargetY + 1; ++index9) { if (Main.tile[index8, index9].active()) { flag3 = true; break; } } } } } if (flag3) { int num9 = this.inventory[this.selectedItem].placeStyle; if (!flag4) { if (this.inventory[this.selectedItem].createTile == 36) num9 = Main.rand.Next(7); if (this.inventory[this.selectedItem].createTile == 212 && this.direction > 0) num9 = 1; if (this.inventory[this.selectedItem].createTile == 141) num9 = Main.rand.Next(2); if (this.inventory[this.selectedItem].createTile == 128 || this.inventory[this.selectedItem].createTile == 269 || this.inventory[this.selectedItem].createTile == 334) num9 = this.direction >= 0 ? 1 : -1; if (this.inventory[this.selectedItem].createTile == 241 && this.inventory[this.selectedItem].placeStyle == 0) num9 = Main.rand.Next(0, 9); if (this.inventory[this.selectedItem].createTile == 35 && this.inventory[this.selectedItem].placeStyle == 0) num9 = Main.rand.Next(9); } if (this.inventory[this.selectedItem].createTile == 314 && num9 == 2 && this.direction == 1) ++num9; int[,] numArray = (int[,]) null; if (this.autoPaint || this.autoActuator) { numArray = new int[11, 11]; for (int index10 = 0; index10 < 11; ++index10) { for (int index11 = 0; index11 < 11; ++index11) { int index12 = Player.tileTargetX - 5 + index10; int index13 = Player.tileTargetY - 5 + index11; numArray[index10, index11] = !Main.tile[index12, index13].active() ? -1 : (int) Main.tile[index12, index13].type; } } } bool forced = false; bool flag6; if (flag4) { flag6 = TileObject.Place(objectData); WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY); Main.PlaySound(0, Player.tileTargetX * 16, Player.tileTargetY * 16); } else flag6 = WorldGen.PlaceTile(Player.tileTargetX, Player.tileTargetY, this.inventory[this.selectedItem].createTile, forced: forced, plr: this.whoAmI, style: num9); if (this.inventory[this.selectedItem].type == 213 && !flag6 && Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 1 && Main.tile[Player.tileTargetX, Player.tileTargetY].active()) { int num10 = 0; int num11 = 0; Point tileCoordinates = this.Center.ToTileCoordinates(); Dictionary resultsOutput = new Dictionary(); WorldUtils.Gen(new Point(tileCoordinates.X - 25, tileCoordinates.Y - 25), (GenShape) new Shapes.Rectangle(50, 50), (GenAction) new Actions.TileScanner(new ushort[6] { (ushort) 182, (ushort) 180, (ushort) 179, (ushort) 183, (ushort) 181, (ushort) 381 }).Output(resultsOutput)); foreach (KeyValuePair keyValuePair in resultsOutput) { if (keyValuePair.Value > num11) { num11 = keyValuePair.Value; num10 = (int) keyValuePair.Key; } } if (num11 == 0) num10 = Utils.SelectRandom(Main.rand, 182, 180, 179, 183, 181); if (num10 != 0) { Main.tile[Player.tileTargetX, Player.tileTargetY].type = (ushort) num10; WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY); NetMessage.SendTileSquare(-1, Player.tileTargetX, Player.tileTargetY, 1); flag6 = true; } } if (flag6) { this.itemTime = (int) ((double) this.inventory[this.selectedItem].useTime * (double) this.tileSpeed); if (flag4) { TileObjectData.CallPostPlacementPlayerHook(Player.tileTargetX, Player.tileTargetY, this.inventory[this.selectedItem].createTile, num9, this.direction, objectData); if (Main.netMode == 1 && !Main.tileContainer[this.inventory[this.selectedItem].createTile] && this.inventory[this.selectedItem].createTile != 423) NetMessage.SendObjectPlacment(-1, Player.tileTargetX, Player.tileTargetY, objectData.type, objectData.style, objectData.alternate, objectData.random, this.direction); } else { NetMessage.SendData(17, number: 1, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY), number4: ((float) this.inventory[this.selectedItem].createTile), number5: num9); if (this.inventory[this.selectedItem].createTile == 15) { if (this.direction == 1) { Main.tile[Player.tileTargetX, Player.tileTargetY].frameX += (short) 18; Main.tile[Player.tileTargetX, Player.tileTargetY - 1].frameX += (short) 18; } if (Main.netMode == 1) NetMessage.SendTileSquare(-1, Player.tileTargetX - 1, Player.tileTargetY - 1, 3); } else if ((this.inventory[this.selectedItem].createTile == 79 || this.inventory[this.selectedItem].createTile == 90) && Main.netMode == 1) NetMessage.SendTileSquare(-1, Player.tileTargetX, Player.tileTargetY, 5); } if (this.inventory[this.selectedItem].createTile == 137) { if (this.direction == 1) Main.tile[Player.tileTargetX, Player.tileTargetY].frameX += (short) 18; if (Main.netMode == 1) NetMessage.SendTileSquare(-1, Player.tileTargetX, Player.tileTargetY, 1); } if (this.inventory[this.selectedItem].createTile == 419) { if (Main.netMode == 1) NetMessage.SendData(17, number: 18, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); else Wiring.PokeLogicGate(Player.tileTargetX, Player.tileTargetY); } if (this.inventory[this.selectedItem].createTile >= 0 && TileID.Sets.Platforms[this.inventory[this.selectedItem].createTile] && Main.SmartCursorEnabled) { int tileTargetX = Player.tileTargetX; int tileTargetY = Player.tileTargetY; int slope1 = -1; int num12 = 0; int num13 = 0; bool flag7 = true; for (int index14 = -1; index14 < 2; ++index14) { for (int index15 = -1; index15 < 2; ++index15) { if ((index14 != 0 || index15 != 0) && TileID.Sets.Platforms[(int) Main.tile[tileTargetX + index14, tileTargetY + index15].type]) flag7 = false; } } if (!flag7) { Tile tile5 = Main.tile[tileTargetX - 1, tileTargetY - 1]; if (tile5.active() && TileID.Sets.Platforms[(int) tile5.type] && tile5.slope() != (byte) 2) ++num12; Tile tile6 = Main.tile[tileTargetX - 1, tileTargetY + 1]; if (tile6.active() && TileID.Sets.Platforms[(int) tile6.type] && tile6.slope() != (byte) 1) ++num13; Tile tile7 = Main.tile[tileTargetX + 1, tileTargetY - 1]; if (tile7.active() && TileID.Sets.Platforms[(int) tile7.type] && tile7.slope() != (byte) 1) ++num13; Tile tile8 = Main.tile[tileTargetX + 1, tileTargetY + 1]; if (tile8.active() && TileID.Sets.Platforms[(int) tile8.type] && tile8.slope() != (byte) 2) ++num12; Tile testTile1 = Main.tile[tileTargetX - 1, tileTargetY]; if (WorldGen.SolidTile(testTile1)) { ++num12; if (TileID.Sets.Platforms[(int) testTile1.type] && testTile1.slope() == (byte) 0) ++num12; } Tile testTile2 = Main.tile[tileTargetX + 1, tileTargetY]; if (WorldGen.SolidTile(testTile2)) { ++num13; if (TileID.Sets.Platforms[(int) testTile2.type] && testTile2.slope() == (byte) 0) ++num13; } if (num12 > num13) slope1 = 1; else if (num13 > num12) slope1 = 2; Tile tile9 = Main.tile[tileTargetX - 1, tileTargetY]; if (tile9.active() && TileID.Sets.Platforms[(int) tile9.type]) slope1 = 0; Tile tile10 = Main.tile[tileTargetX + 1, tileTargetY]; if (tile10.active() && TileID.Sets.Platforms[(int) tile10.type]) slope1 = 0; if (slope1 != -1) { WorldGen.SlopeTile(tileTargetX, tileTargetY, slope1); int num14 = (int) Main.tile[tileTargetX, tileTargetY].slope(); if (Main.netMode == 1) NetMessage.SendData(17, number: 14, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY), number4: ((float) num14)); int num15; int num16; if (slope1 == 1) { num15 = -1; num16 = -1; } else { num15 = 1; num16 = -1; } Tile tile11 = Main.tile[tileTargetX + num15, tileTargetY + num16]; if (tile11.active() && TileID.Sets.Platforms[(int) tile11.type] && tile11.slope() == (byte) 0 && (!Main.tile[tileTargetX + num15 + num15, tileTargetY + num16].active() || !TileID.Sets.Platforms[(int) Main.tile[tileTargetX + num15 + num15, tileTargetY + num16].type] || !Main.tile[tileTargetX + num15 + num15, tileTargetY + num16].halfBrick())) { WorldGen.SlopeTile(tileTargetX + num15, tileTargetY + num16, slope1); int num17 = (int) tile11.slope(); if (Main.netMode == 1) NetMessage.SendData(17, number: 14, number2: ((float) (tileTargetX + num15)), number3: ((float) (tileTargetY + num16)), number4: ((float) num17)); } int num18; int num19; if (slope1 == 1) { num18 = 1; num19 = 1; } else { num18 = -1; num19 = 1; } Tile tile12 = Main.tile[tileTargetX + num18, tileTargetY + num19]; if (tile12.active() && TileID.Sets.Platforms[(int) tile12.type] && tile12.slope() == (byte) 0 && WorldGen.PlatformProperSides(tileTargetX + num18, tileTargetY + num19, true) <= 0) { WorldGen.SlopeTile(tileTargetX + num18, tileTargetY + num19, slope1); int num20 = (int) tile12.slope(); if (Main.netMode == 1) NetMessage.SendData(17, number: 14, number2: ((float) (tileTargetX + num18)), number3: ((float) (tileTargetY + num19)), number4: ((float) num20)); } } else { int num21 = -1; Tile tile13 = Main.tile[tileTargetX + num21, tileTargetY]; if (tile13.active() && TileID.Sets.Platforms[(int) tile13.type] && tile13.slope() != (byte) 0) { int num22 = (tile13.slope() == (byte) 1).ToDirectionInt() * num21; int slope2 = num22 == -1 ? 0 : (int) tile13.slope(); bool flag8 = true; if (Main.tile[tileTargetX + num21 * 2, tileTargetY + num22].active() && TileID.Sets.Platforms[(int) Main.tile[tileTargetX + num21 * 2, tileTargetY].type] && slope2 == (int) Main.tile[tileTargetX + num21 * 2, tileTargetY + num22].slope()) flag8 = false; if (Main.tile[tileTargetX, tileTargetY - num22].active() && TileID.Sets.Platforms[(int) Main.tile[tileTargetX, tileTargetY - num22].type] && (int) tile13.slope() == (int) Main.tile[tileTargetX, tileTargetY - num22].slope()) flag8 = false; if (flag8) { WorldGen.SlopeTile(tileTargetX + num21, tileTargetY, slope2); int num23 = (int) tile13.slope(); if (Main.netMode == 1) NetMessage.SendData(17, number: 14, number2: ((float) (tileTargetX + num21)), number3: ((float) tileTargetY), number4: ((float) num23)); } } int num24 = 1; int num25 = 0; Tile tile14 = Main.tile[tileTargetX + num24, tileTargetY + num25]; if (tile14.active() && TileID.Sets.Platforms[(int) tile14.type] && tile14.slope() != (byte) 0) { int num26 = (tile14.slope() == (byte) 1).ToDirectionInt() * num24; int slope3 = num26 == -1 ? 0 : (int) tile14.slope(); bool flag9 = true; if (Main.tile[tileTargetX + num24 * 2, tileTargetY + num26].active() && TileID.Sets.Platforms[(int) Main.tile[tileTargetX + num24 * 2, tileTargetY].type] && slope3 == (int) Main.tile[tileTargetX + num24 * 2, tileTargetY + num26].slope()) flag9 = false; if (Main.tile[tileTargetX, tileTargetY - num26].active() && TileID.Sets.Platforms[(int) Main.tile[tileTargetX, tileTargetY - num26].type] && (int) tile14.slope() == (int) Main.tile[tileTargetX, tileTargetY - num26].slope()) flag9 = false; if (flag9) { WorldGen.SlopeTile(tileTargetX + num24, tileTargetY, slope3); int num27 = (int) tile14.slope(); if (Main.netMode == 1) NetMessage.SendData(17, number: 14, number2: ((float) (tileTargetX + num24)), number3: ((float) tileTargetY), number4: ((float) num27)); } } if (num12 == num13 && WorldGen.PlatformProperSides(tileTargetX, tileTargetY) == 0) { Tile tile15 = Main.tile[tileTargetX, tileTargetY + 1]; if (tile15.active() && !tile15.halfBrick() && tile15.slope() == (byte) 0 && Main.tileSolid[(int) tile15.type]) { int slope4 = this.direction == 1 ? 2 : 1; WorldGen.SlopeTile(tileTargetX, tileTargetY, slope4); int num28 = (int) Main.tile[tileTargetX, tileTargetY].slope(); if (Main.netMode == 1) NetMessage.SendData(17, number: 14, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY), number4: ((float) num28)); } } } } } if (Main.tileSolid[this.inventory[this.selectedItem].createTile] && (this.inventory[this.selectedItem].createTile < 0 || !TileID.Sets.Platforms[this.inventory[this.selectedItem].createTile])) { int tileTargetX1 = Player.tileTargetX; int j1 = Player.tileTargetY + 1; if (Main.tile[tileTargetX1, j1] != null && !TileID.Sets.Platforms[(int) Main.tile[tileTargetX1, j1].type] && (Main.tile[tileTargetX1, j1].topSlope() || Main.tile[tileTargetX1, j1].halfBrick())) { WorldGen.SlopeTile(tileTargetX1, j1); if (Main.netMode == 1) NetMessage.SendData(17, number: 14, number2: ((float) tileTargetX1), number3: ((float) j1)); } int tileTargetX2 = Player.tileTargetX; int j2 = Player.tileTargetY - 1; if (Main.tile[tileTargetX2, j2] != null && !TileID.Sets.Platforms[(int) Main.tile[tileTargetX2, j2].type] && Main.tile[tileTargetX2, j2].bottomSlope()) { WorldGen.SlopeTile(tileTargetX2, j2); if (Main.netMode == 1) NetMessage.SendData(17, number: 14, number2: ((float) tileTargetX2), number3: ((float) j2)); } } if (Main.tileSolid[this.inventory[this.selectedItem].createTile]) { for (int i1 = Player.tileTargetX - 1; i1 <= Player.tileTargetX + 1; ++i1) { for (int j3 = Player.tileTargetY - 1; j3 <= Player.tileTargetY + 1; ++j3) { if (Main.tile[i1, j3].active() && this.inventory[this.selectedItem].createTile != (int) Main.tile[i1, j3].type && (Main.tile[i1, j3].type == (ushort) 2 || Main.tile[i1, j3].type == (ushort) 23 || Main.tile[i1, j3].type == (ushort) 60 || Main.tile[i1, j3].type == (ushort) 70 || Main.tile[i1, j3].type == (ushort) 109 || Main.tile[i1, j3].type == (ushort) 199)) { bool flag10 = true; for (int i2 = i1 - 1; i2 <= i1 + 1; ++i2) { for (int j4 = j3 - 1; j4 <= j3 + 1; ++j4) { if (!WorldGen.SolidTile(i2, j4)) flag10 = false; } } if (flag10) { WorldGen.KillTile(i1, j3, true); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) i1), number3: ((float) j3), number4: 1f); } } } } } if (this.autoPaint || this.autoActuator) { int num29 = 0; int num30 = 0; int num31 = 11; int num32 = 11; if (!Main.tileFrameImportant[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { num29 = num30 = 5; num31 = num32 = 6; } for (int index16 = num29; index16 < num31; ++index16) { for (int index17 = num30; index17 < num32; ++index17) { int index18 = Player.tileTargetX - 5 + index16; int index19 = Player.tileTargetY - 5 + index17; if ((Main.tile[index18, index19].active() || numArray[index16, index17] != -1) && (!Main.tile[index18, index19].active() || numArray[index16, index17] != (int) Main.tile[index18, index19].type && (int) Main.tile[index18, index19].type == this.inventory[this.selectedItem].createTile)) { if (this.autoPaint && this.builderAccStatus[3] == 0) { int num33 = -1; int num34 = -1; for (int index20 = 0; index20 < 58; ++index20) { if (this.inventory[index20].stack > 0 && this.inventory[index20].paint > (byte) 0) { num33 = (int) this.inventory[index20].paint; num34 = index20; break; } } if (num33 > 0 && (int) Main.tile[index18, index19].color() != num33 && WorldGen.paintTile(index18, index19, (byte) num33, true)) { int index21 = num34; --this.inventory[index21].stack; if (this.inventory[index21].stack <= 0) this.inventory[index21].SetDefaults(); this.itemTime = (int) ((double) this.inventory[this.selectedItem].useTime * (double) this.tileSpeed); } } if (this.autoActuator && this.builderAccStatus[2] == 0) { bool flag11 = Main.tileSolid[(int) Main.tile[index18, index19].type] && !TileID.Sets.NotReallySolid[(int) Main.tile[index18, index19].type]; switch (Main.tile[index18, index19].type) { case 314: case 386: case 387: case 388: case 389: flag11 = false; break; } if (flag11) { int index22 = this.FindItem(849); if (index22 > -1 && WorldGen.PlaceActuator(index18, index19)) { NetMessage.SendData(17, number: 8, number2: ((float) index18), number3: ((float) index19)); --this.inventory[index22].stack; if (this.inventory[index22].stack <= 0) this.inventory[index22].SetDefaults(); this.itemTime = (int) ((double) this.inventory[this.selectedItem].useTime * (double) this.tileSpeed); } } } } } } } if (PlayerInput.UsingGamepad && ItemID.Sets.SingleUseInGamepad[this.inventory[this.selectedItem].type] && Main.myPlayer == this.whoAmI && !Main.SmartCursorEnabled) Main.blockMouse = true; } } } } if (this.inventory[this.selectedItem].createWall < 0 || (double) this.position.X / 16.0 - (double) Player.tileRangeX - (double) this.inventory[this.selectedItem].tileBoost > (double) Player.tileTargetX || ((double) this.position.X + (double) this.width) / 16.0 + (double) Player.tileRangeX + (double) this.inventory[this.selectedItem].tileBoost - 1.0 < (double) Player.tileTargetX || (double) this.position.Y / 16.0 - (double) Player.tileRangeY - (double) this.inventory[this.selectedItem].tileBoost > (double) Player.tileTargetY || ((double) this.position.Y + (double) this.height) / 16.0 + (double) Player.tileRangeY + (double) this.inventory[this.selectedItem].tileBoost - 2.0 < (double) Player.tileTargetY) return; this.showItemIcon = true; if (this.itemTime != 0 || this.itemAnimation <= 0 || !this.controlUseItem || !Main.tile[Player.tileTargetX + 1, Player.tileTargetY].active() && Main.tile[Player.tileTargetX + 1, Player.tileTargetY].wall <= (byte) 0 && !Main.tile[Player.tileTargetX - 1, Player.tileTargetY].active() && Main.tile[Player.tileTargetX - 1, Player.tileTargetY].wall <= (byte) 0 && !Main.tile[Player.tileTargetX, Player.tileTargetY + 1].active() && Main.tile[Player.tileTargetX, Player.tileTargetY + 1].wall <= (byte) 0 && !Main.tile[Player.tileTargetX, Player.tileTargetY - 1].active() && Main.tile[Player.tileTargetX, Player.tileTargetY - 1].wall <= (byte) 0 || (int) Main.tile[Player.tileTargetX, Player.tileTargetY].wall == this.inventory[this.selectedItem].createWall) return; if (Player.SmartCursorSettings.SmartWallReplacement && Main.tile[Player.tileTargetX, Player.tileTargetY].wall != (byte) 0 && WorldGen.NearFriendlyWall(Player.tileTargetX, Player.tileTargetY)) { WorldGen.KillWall(Player.tileTargetX, Player.tileTargetY); if (Main.tile[Player.tileTargetX, Player.tileTargetY].wall == (byte) 0 && Main.netMode == 1) NetMessage.SendData(17, number: 2, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); if (this.inventory[this.selectedItem].consumable) ++this.inventory[this.selectedItem].stack; this.itemTime = (int) ((double) this.inventory[this.selectedItem].useTime * (double) this.wallSpeed); } else { WorldGen.PlaceWall(Player.tileTargetX, Player.tileTargetY, this.inventory[this.selectedItem].createWall); if ((int) Main.tile[Player.tileTargetX, Player.tileTargetY].wall != this.inventory[this.selectedItem].createWall) return; this.itemTime = (int) ((double) this.inventory[this.selectedItem].useTime * (double) this.wallSpeed); if (Main.netMode == 1) NetMessage.SendData(17, number: 3, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY), number4: ((float) this.inventory[this.selectedItem].createWall)); if (this.inventory[this.selectedItem].stack > 1) { int createWall = this.inventory[this.selectedItem].createWall; for (int index23 = 0; index23 < 4; ++index23) { int tileTargetX = Player.tileTargetX; int tileTargetY = Player.tileTargetY; if (index23 == 0) --tileTargetX; if (index23 == 1) ++tileTargetX; if (index23 == 2) --tileTargetY; if (index23 == 3) ++tileTargetY; if (Main.tile[tileTargetX, tileTargetY].wall == (byte) 0) { int num35 = 0; for (int index24 = 0; index24 < 4; ++index24) { int index25 = tileTargetX; int index26 = tileTargetY; if (index24 == 0) --index25; if (index24 == 1) ++index25; if (index24 == 2) --index26; if (index24 == 3) ++index26; if ((int) Main.tile[index25, index26].wall == createWall) ++num35; } if (num35 == 4) { WorldGen.PlaceWall(tileTargetX, tileTargetY, createWall); if ((int) Main.tile[tileTargetX, tileTargetY].wall == createWall) { --this.inventory[this.selectedItem].stack; if (this.inventory[this.selectedItem].stack == 0) this.inventory[this.selectedItem].SetDefaults(); if (Main.netMode == 1) NetMessage.SendData(17, number: 3, number2: ((float) tileTargetX), number3: ((float) tileTargetY), number4: ((float) createWall)); if (this.autoPaint && this.builderAccStatus[3] == 0) { int x = tileTargetX; int y = tileTargetY; int num36 = -1; int num37 = -1; for (int index27 = 0; index27 < 58; ++index27) { if (this.inventory[index27].stack > 0 && this.inventory[index27].paint > (byte) 0) { num36 = (int) this.inventory[index27].paint; num37 = index27; break; } } if (num36 > 0 && (int) Main.tile[x, y].wallColor() != num36 && WorldGen.paintWall(x, y, (byte) num36, true)) { int index28 = num37; --this.inventory[index28].stack; if (this.inventory[index28].stack <= 0) this.inventory[index28].SetDefaults(); this.itemTime = (int) ((double) this.inventory[this.selectedItem].useTime * (double) this.wallSpeed); } } } } } } } if (!this.autoPaint || this.builderAccStatus[3] != 0) return; int tileTargetX3 = Player.tileTargetX; int tileTargetY1 = Player.tileTargetY; int num38 = -1; int num39 = -1; for (int index = 0; index < 58; ++index) { if (this.inventory[index].stack > 0 && this.inventory[index].paint > (byte) 0) { num38 = (int) this.inventory[index].paint; num39 = index; break; } } if (num38 <= 0 || (int) Main.tile[tileTargetX3, tileTargetY1].wallColor() == num38 || !WorldGen.paintWall(tileTargetX3, tileTargetY1, (byte) num38, true)) return; int index29 = num39; --this.inventory[index29].stack; if (this.inventory[index29].stack <= 0) this.inventory[index29].SetDefaults(); this.itemTime = (int) ((double) this.inventory[this.selectedItem].useTime * (double) this.wallSpeed); } } private void ShootFromCannon(int x, int y) { int ammo = 0; if (Main.tile[x, y].frameX < (short) 72) { if (this.inventory[this.selectedItem].type == 929) ammo = 1; } else if (Main.tile[x, y].frameX < (short) 144) { if (this.inventory[this.selectedItem].type == 1338) ammo = 2; } else if (Main.tile[x, y].frameX < (short) 288 && this.inventory[this.selectedItem].type == 1345) ammo = 3; if (ammo <= 0) return; this.showItemIcon = true; if (this.itemTime != 0 || this.itemAnimation <= 0 || !this.controlUseItem) return; int num1 = (int) Main.tile[x, y].frameX / 18; int num2 = 0; int angle = 0; for (; num1 >= 4; num1 -= 4) ++num2; int x1 = x - num1; int num3; for (num3 = (int) Main.tile[x, y].frameY / 18; num3 >= 3; num3 -= 3) ++angle; int y1 = y - num3; this.itemTime = this.inventory[this.selectedItem].useTime; WorldGen.ShootFromCannon(x1, y1, angle, ammo, this.inventory[this.selectedItem].damage, 8f, Main.myPlayer); } private static void ExtractinatorUse(int extractType) { int maxValue1 = 5000; int maxValue2 = 25; int maxValue3 = 50; int maxValue4 = -1; if (extractType == 1) { maxValue1 /= 3; maxValue2 *= 2; maxValue3 /= 2; maxValue4 = 10; } int Stack = 1; int Type; if (maxValue4 != -1 && Main.rand.Next(maxValue4) == 0) { Type = 3380; if (Main.rand.Next(5) == 0) Stack += Main.rand.Next(2); if (Main.rand.Next(10) == 0) Stack += Main.rand.Next(3); if (Main.rand.Next(15) == 0) Stack += Main.rand.Next(4); } else if (Main.rand.Next(2) == 0) { if (Main.rand.Next(12000) == 0) { Type = 74; if (Main.rand.Next(14) == 0) Stack += Main.rand.Next(0, 2); if (Main.rand.Next(14) == 0) Stack += Main.rand.Next(0, 2); if (Main.rand.Next(14) == 0) Stack += Main.rand.Next(0, 2); } else if (Main.rand.Next(800) == 0) { Type = 73; if (Main.rand.Next(6) == 0) Stack += Main.rand.Next(1, 21); if (Main.rand.Next(6) == 0) Stack += Main.rand.Next(1, 21); if (Main.rand.Next(6) == 0) Stack += Main.rand.Next(1, 21); if (Main.rand.Next(6) == 0) Stack += Main.rand.Next(1, 21); if (Main.rand.Next(6) == 0) Stack += Main.rand.Next(1, 20); } else if (Main.rand.Next(60) == 0) { Type = 72; if (Main.rand.Next(4) == 0) Stack += Main.rand.Next(5, 26); if (Main.rand.Next(4) == 0) Stack += Main.rand.Next(5, 26); if (Main.rand.Next(4) == 0) Stack += Main.rand.Next(5, 26); if (Main.rand.Next(4) == 0) Stack += Main.rand.Next(5, 25); } else { Type = 71; if (Main.rand.Next(3) == 0) Stack += Main.rand.Next(10, 26); if (Main.rand.Next(3) == 0) Stack += Main.rand.Next(10, 26); if (Main.rand.Next(3) == 0) Stack += Main.rand.Next(10, 26); if (Main.rand.Next(3) == 0) Stack += Main.rand.Next(10, 25); } } else if (maxValue1 != -1 && Main.rand.Next(maxValue1) == 0) Type = 1242; else if (maxValue2 != -1 && Main.rand.Next(maxValue2) == 0) { switch (Main.rand.Next(6)) { case 0: Type = 181; break; case 1: Type = 180; break; case 2: Type = 177; break; case 3: Type = 179; break; case 4: Type = 178; break; default: Type = 182; break; } if (Main.rand.Next(20) == 0) Stack += Main.rand.Next(0, 2); if (Main.rand.Next(30) == 0) Stack += Main.rand.Next(0, 3); if (Main.rand.Next(40) == 0) Stack += Main.rand.Next(0, 4); if (Main.rand.Next(50) == 0) Stack += Main.rand.Next(0, 5); if (Main.rand.Next(60) == 0) Stack += Main.rand.Next(0, 6); } else if (maxValue3 != -1 && Main.rand.Next(maxValue3) == 0) { Type = 999; if (Main.rand.Next(20) == 0) Stack += Main.rand.Next(0, 2); if (Main.rand.Next(30) == 0) Stack += Main.rand.Next(0, 3); if (Main.rand.Next(40) == 0) Stack += Main.rand.Next(0, 4); if (Main.rand.Next(50) == 0) Stack += Main.rand.Next(0, 5); if (Main.rand.Next(60) == 0) Stack += Main.rand.Next(0, 6); } else if (Main.rand.Next(3) == 0) { if (Main.rand.Next(5000) == 0) { Type = 74; if (Main.rand.Next(10) == 0) Stack += Main.rand.Next(0, 3); if (Main.rand.Next(10) == 0) Stack += Main.rand.Next(0, 3); if (Main.rand.Next(10) == 0) Stack += Main.rand.Next(0, 3); if (Main.rand.Next(10) == 0) Stack += Main.rand.Next(0, 3); if (Main.rand.Next(10) == 0) Stack += Main.rand.Next(0, 3); } else if (Main.rand.Next(400) == 0) { Type = 73; if (Main.rand.Next(5) == 0) Stack += Main.rand.Next(1, 21); if (Main.rand.Next(5) == 0) Stack += Main.rand.Next(1, 21); if (Main.rand.Next(5) == 0) Stack += Main.rand.Next(1, 21); if (Main.rand.Next(5) == 0) Stack += Main.rand.Next(1, 21); if (Main.rand.Next(5) == 0) Stack += Main.rand.Next(1, 20); } else if (Main.rand.Next(30) == 0) { Type = 72; if (Main.rand.Next(3) == 0) Stack += Main.rand.Next(5, 26); if (Main.rand.Next(3) == 0) Stack += Main.rand.Next(5, 26); if (Main.rand.Next(3) == 0) Stack += Main.rand.Next(5, 26); if (Main.rand.Next(3) == 0) Stack += Main.rand.Next(5, 25); } else { Type = 71; if (Main.rand.Next(2) == 0) Stack += Main.rand.Next(10, 26); if (Main.rand.Next(2) == 0) Stack += Main.rand.Next(10, 26); if (Main.rand.Next(2) == 0) Stack += Main.rand.Next(10, 26); if (Main.rand.Next(2) == 0) Stack += Main.rand.Next(10, 25); } } else { switch (Main.rand.Next(8)) { case 0: Type = 12; break; case 1: Type = 11; break; case 2: Type = 14; break; case 3: Type = 13; break; case 4: Type = 699; break; case 5: Type = 700; break; case 6: Type = 701; break; default: Type = 702; break; } if (Main.rand.Next(20) == 0) Stack += Main.rand.Next(0, 2); if (Main.rand.Next(30) == 0) Stack += Main.rand.Next(0, 3); if (Main.rand.Next(40) == 0) Stack += Main.rand.Next(0, 4); if (Main.rand.Next(50) == 0) Stack += Main.rand.Next(0, 5); if (Main.rand.Next(60) == 0) Stack += Main.rand.Next(0, 6); } if (Type <= 0) return; Vector2 vector2 = Main.ReverseGravitySupport(Main.MouseScreen) + Main.screenPosition; int number = Item.NewItem((int) vector2.X, (int) vector2.Y, 1, 1, Type, Stack, pfix: -1); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } public void ChangeDir(int dir) { if (!this.pulley || this.pulleyDir != (byte) 2) { this.direction = dir; } else { if (this.pulleyDir == (byte) 2 && dir == this.direction) return; int num = (int) ((double) this.position.X + (double) (this.width / 2)) / 16 * 16 + 8 - this.width / 2; if (Collision.SolidCollision(new Vector2((float) num, this.position.Y), this.width, this.height)) return; if (this.whoAmI == Main.myPlayer) Main.cameraX = Main.cameraX + this.position.X - (float) num; this.pulleyDir = (byte) 1; this.position.X = (float) num; this.direction = dir; } } public Microsoft.Xna.Framework.Rectangle getRect() => new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height); private void pumpkinSword(int i, int dmg, float kb) { int checkScreenHeight = Main.LogicCheckScreenHeight; int checkScreenWidth = Main.LogicCheckScreenWidth; int num1 = Main.rand.Next(100, 300); int num2 = Main.rand.Next(100, 300); int num3 = Main.rand.Next(2) != 0 ? num1 + (checkScreenWidth / 2 - num1) : num1 - (checkScreenWidth / 2 + num1); int num4 = Main.rand.Next(2) != 0 ? num2 + (checkScreenHeight / 2 - num2) : num2 - (checkScreenHeight / 2 + num2); int num5 = num3 + (int) this.position.X; int num6 = num4 + (int) this.position.Y; Vector2 vector2 = new Vector2((float) num5, (float) num6); float num7 = Main.npc[i].position.X - vector2.X; float num8 = Main.npc[i].position.Y - vector2.Y; float num9 = (float) (8.0 / Math.Sqrt((double) num7 * (double) num7 + (double) num8 * (double) num8)); float SpeedX = num7 * num9; float SpeedY = num8 * num9; Projectile.NewProjectile((float) num5, (float) num6, SpeedX, SpeedY, 321, dmg, kb, this.whoAmI, (float) i); } public void PutItemInInventory(int type, int selItem = -1) { for (int index = 0; index < 58; ++index) { Item obj = this.inventory[index]; if (obj.stack > 0 && obj.type == type && obj.stack < obj.maxStack) { ++obj.stack; return; } } if (selItem >= 0 && (this.inventory[selItem].type == 0 || this.inventory[selItem].stack <= 0)) { this.inventory[selItem].SetDefaults(type); } else { Item newItem = new Item(); newItem.SetDefaults(type); if (this.GetItem(this.whoAmI, newItem).stack > 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, type, noGrabDelay: true); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } else { newItem.position.X = this.Center.X - (float) (newItem.width / 2); newItem.position.Y = this.Center.Y - (float) (newItem.height / 2); newItem.active = true; ItemText.NewText(newItem, 0); } } } public bool SummonItemCheck() { for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && (this.inventory[this.selectedItem].type == 43 && Main.npc[index].type == 4 || this.inventory[this.selectedItem].type == 70 && Main.npc[index].type == 13 || this.inventory[this.selectedItem].type == 560 & Main.npc[index].type == 50 || this.inventory[this.selectedItem].type == 544 && Main.npc[index].type == 125 || this.inventory[this.selectedItem].type == 544 && Main.npc[index].type == 126 || this.inventory[this.selectedItem].type == 556 && Main.npc[index].type == 134 || this.inventory[this.selectedItem].type == 557 && Main.npc[index].type == (int) sbyte.MaxValue || this.inventory[this.selectedItem].type == 1133 && Main.npc[index].type == 222 || this.inventory[this.selectedItem].type == 1331 && Main.npc[index].type == 266)) return false; } return true; } public int FishingLevel() { int num1 = 0; int fishingPole = this.inventory[this.selectedItem].fishingPole; if (fishingPole == 0) { for (int index = 0; index < 58; ++index) { if (this.inventory[index].fishingPole > fishingPole) fishingPole = this.inventory[index].fishingPole; } } for (int index = 0; index < 58; ++index) { if (this.inventory[index].stack > 0 && this.inventory[index].bait > 0) { if (this.inventory[index].type == 2673) return -1; num1 = this.inventory[index].bait; break; } } if (num1 == 0 || fishingPole == 0) return 0; int num2 = num1 + fishingPole + this.fishingSkill; if (Main.raining) num2 = (int) ((double) num2 * 1.20000004768372); if ((double) Main.cloudBGAlpha > 0.0) num2 = (int) ((double) num2 * 1.10000002384186); if (Main.dayTime && (Main.time < 5400.0 || Main.time > 48600.0)) num2 = (int) ((double) num2 * 1.29999995231628); if (Main.dayTime && Main.time > 16200.0 && Main.time < 37800.0) num2 = (int) ((double) num2 * 0.800000011920929); if (!Main.dayTime && Main.time > 6480.0 && Main.time < 25920.0) num2 = (int) ((double) num2 * 0.800000011920929); if (Main.moonPhase == 0) num2 = (int) ((double) num2 * 1.10000002384186); if (Main.moonPhase == 1 || Main.moonPhase == 7) num2 = (int) ((double) num2 * 1.04999995231628); if (Main.moonPhase == 3 || Main.moonPhase == 5) num2 = (int) ((double) num2 * 0.949999988079071); if (Main.moonPhase == 4) num2 = (int) ((double) num2 * 0.899999976158142); return num2; } public bool HasUnityPotion() { for (int index = 0; index < 58; ++index) { if (this.inventory[index].type == 2997 && this.inventory[index].stack > 0) return true; } return false; } public void TakeUnityPotion() { for (int index = 0; index < 400; ++index) { if (this.inventory[index].type == 2997 && this.inventory[index].stack > 0) { --this.inventory[index].stack; if (this.inventory[index].stack > 0) break; this.inventory[index].SetDefaults(); break; } } } public void UnityTeleport(Vector2 telePos) { int num = 3; if (Main.netMode == 0) this.Teleport(telePos, num); else NetMessage.SendData(65, number: 2, number2: ((float) this.whoAmI), number3: telePos.X, number4: telePos.Y, number5: num); } private void PayDD2CrystalsBeforeUse(Item item) { int dd2CrystalsToUse = this.GetRequiredDD2CrystalsToUse(item); for (int index = 0; index < dd2CrystalsToUse; ++index) this.ConsumeItem(3822, true); } private bool CheckDD2CrystalPaymentLock(Item item) { if (!DD2Event.Ongoing) return true; int dd2CrystalsToUse = this.GetRequiredDD2CrystalsToUse(item); return this.CountItem(3822, dd2CrystalsToUse) >= dd2CrystalsToUse; } private int GetRequiredDD2CrystalsToUse(Item item) { switch (item.type) { case 3818: case 3819: case 3820: return 10; case 3824: case 3825: case 3826: return 10; case 3829: case 3830: case 3831: return 10; case 3832: case 3833: case 3834: return 10; default: return 0; } } public void SporeSac() { int Damage = 70; float KnockBack = 1.5f; if (Main.rand.Next(15) != 0) return; int num1 = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == this.whoAmI && (Main.projectile[index].type == 567 || Main.projectile[index].type == 568)) ++num1; } if (Main.rand.Next(15) < num1 || num1 >= 10) return; int num2 = 50; int num3 = 24; int num4 = 90; for (int index1 = 0; index1 < num2; ++index1) { int num5 = Main.rand.Next(200 - index1 * 2, 400 + index1 * 2); Vector2 center = this.Center; center.X += (float) Main.rand.Next(-num5, num5 + 1); center.Y += (float) Main.rand.Next(-num5, num5 + 1); if (!Collision.SolidCollision(center, num3, num3) && !Collision.WetCollision(center, num3, num3)) { center.X += (float) (num3 / 2); center.Y += (float) (num3 / 2); if (Collision.CanHit(new Vector2(this.Center.X, this.position.Y), 1, 1, center, 1, 1) || Collision.CanHit(new Vector2(this.Center.X, this.position.Y - 50f), 1, 1, center, 1, 1)) { int index2 = (int) center.X / 16; int index3 = (int) center.Y / 16; bool flag = false; if (Main.rand.Next(3) == 0 && Main.tile[index2, index3] != null && Main.tile[index2, index3].wall > (byte) 0) { flag = true; } else { center.X -= (float) (num4 / 2); center.Y -= (float) (num4 / 2); if (Collision.SolidCollision(center, num4, num4)) { center.X += (float) (num4 / 2); center.Y += (float) (num4 / 2); flag = true; } } if (flag) { for (int index4 = 0; index4 < 1000; ++index4) { if (Main.projectile[index4].active && Main.projectile[index4].owner == this.whoAmI && Main.projectile[index4].aiStyle == 105 && (double) (center - Main.projectile[index4].Center).Length() < 48.0) { flag = false; break; } } if (flag && Main.myPlayer == this.whoAmI) { Projectile.NewProjectile(center.X, center.Y, 0.0f, 0.0f, 567 + Main.rand.Next(2), Damage, KnockBack, this.whoAmI); break; } } } } } } public bool CanHit(Entity ent) => Collision.CanHit(this.position, this.width, this.height, ent.position, ent.width, ent.height) || Collision.CanHitLine(this.Center + new Vector2((float) (this.direction * this.width / 2), (float) ((double) this.gravDir * (double) -this.height / 3.0)), 0, 0, ent.Center + new Vector2(0.0f, (float) (-ent.height / 3)), 0, 0) || Collision.CanHitLine(this.Center + new Vector2((float) (this.direction * this.width / 2), (float) ((double) this.gravDir * (double) -this.height / 3.0)), 0, 0, ent.Center, 0, 0) || Collision.CanHitLine(this.Center + new Vector2((float) (this.direction * this.width / 2), 0.0f), 0, 0, ent.Center + new Vector2(0.0f, (float) (ent.height / 3)), 0, 0); public void ItemCheck(int i) { if (this.webbed || this.frozen || this.stoned) return; bool flag1 = false; float playerOffsetHitbox = (float) this.mount.PlayerOffsetHitbox; Item sItem = this.inventory[this.selectedItem]; if (this.mount.Active) { if (this.mount.Type == 8) { this.noItems = true; if (this.controlUseItem) { this.channel = true; if (this.releaseUseItem) this.mount.UseAbility(this, Vector2.Zero, true); this.releaseUseItem = false; } } if (this.whoAmI == Main.myPlayer && (double) this.gravDir == -1.0) this.mount.Dismount(this); } int weaponDamage = this.GetWeaponDamage(sItem); if (sItem.autoReuse && !this.noItems) { this.releaseUseItem = true; if (this.itemAnimation == 1 && sItem.stack > 0) { if (sItem.shoot > 0 && this.whoAmI != Main.myPlayer && this.controlUseItem && sItem.useStyle == 5) { this.ApplyAnimation(sItem); if (sItem.UseSound != null) Main.PlaySound(sItem.UseSound, this.Center); } else this.itemAnimation = 0; } } if (sItem.fishingPole > 0) { sItem.holdStyle = 0; if (this.itemTime == 0 && this.itemAnimation == 0) { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == this.whoAmI && Main.projectile[index].bobber) sItem.holdStyle = 1; } } } if (this.itemAnimation == 0 && this.reuseDelay > 0) { this.itemAnimation = this.reuseDelay; this.itemTime = this.reuseDelay; this.reuseDelay = 0; } if (this.controlUseItem && this.releaseUseItem && (sItem.headSlot > 0 || sItem.bodySlot > 0 || sItem.legSlot > 0)) { if (sItem.useStyle == 0) this.releaseUseItem = false; if ((double) this.position.X / 16.0 - (double) Player.tileRangeX - (double) sItem.tileBoost <= (double) Player.tileTargetX && ((double) this.position.X + (double) this.width) / 16.0 + (double) Player.tileRangeX + (double) sItem.tileBoost - 1.0 >= (double) Player.tileTargetX && (double) this.position.Y / 16.0 - (double) Player.tileRangeY - (double) sItem.tileBoost <= (double) Player.tileTargetY && ((double) this.position.Y + (double) this.height) / 16.0 + (double) Player.tileRangeY + (double) sItem.tileBoost - 2.0 >= (double) Player.tileTargetY) { int tileTargetX = Player.tileTargetX; int tileTargetY = Player.tileTargetY; if (Main.tile[tileTargetX, tileTargetY].active() && (Main.tile[tileTargetX, tileTargetY].type == (ushort) 128 || Main.tile[tileTargetX, tileTargetY].type == (ushort) 269)) { int frameY = (int) Main.tile[tileTargetX, tileTargetY].frameY; int num1 = 0; if (sItem.bodySlot >= 0) num1 = 1; if (sItem.legSlot >= 0) num1 = 2; int num2; for (num2 = frameY / 18; num1 > num2; num2 = (int) Main.tile[tileTargetX, tileTargetY].frameY / 18) ++tileTargetY; for (; num1 < num2; num2 = (int) Main.tile[tileTargetX, tileTargetY].frameY / 18) --tileTargetY; int frameX1 = (int) Main.tile[tileTargetX, tileTargetY].frameX; while (frameX1 >= 100) frameX1 -= 100; if (frameX1 >= 36) frameX1 -= 36; int index = tileTargetX - frameX1 / 18; int frameX2 = (int) Main.tile[index, tileTargetY].frameX; WorldGen.KillTile(index, tileTargetY, true); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) index), number3: ((float) tileTargetY), number4: 1f); while (frameX2 >= 100) frameX2 -= 100; if (num2 == 0 && sItem.headSlot >= 0) { Main.blockMouse = true; Main.tile[index, tileTargetY].frameX = (short) (frameX2 + sItem.headSlot * 100); if (Main.netMode == 1) NetMessage.SendTileSquare(-1, index, tileTargetY, 1); --sItem.stack; if (sItem.stack <= 0) { sItem.SetDefaults(); Main.mouseItem.SetDefaults(); } if (this.selectedItem == 58) Main.mouseItem = sItem.Clone(); this.releaseUseItem = false; this.mouseInterface = true; } else if (num2 == 1 && sItem.bodySlot >= 0) { Main.blockMouse = true; Main.tile[index, tileTargetY].frameX = (short) (frameX2 + sItem.bodySlot * 100); if (Main.netMode == 1) NetMessage.SendTileSquare(-1, index, tileTargetY, 1); --sItem.stack; if (sItem.stack <= 0) { sItem.SetDefaults(); Main.mouseItem.SetDefaults(); } if (this.selectedItem == 58) Main.mouseItem = sItem.Clone(); this.releaseUseItem = false; this.mouseInterface = true; } else if (num2 == 2 && sItem.legSlot >= 0 && !ArmorIDs.Legs.Sets.MannequinIncompatible.Contains(sItem.legSlot)) { Main.blockMouse = true; Main.tile[index, tileTargetY].frameX = (short) (frameX2 + sItem.legSlot * 100); if (Main.netMode == 1) NetMessage.SendTileSquare(-1, index, tileTargetY, 1); --sItem.stack; if (sItem.stack <= 0) { sItem.SetDefaults(); Main.mouseItem.SetDefaults(); } if (this.selectedItem == 58) Main.mouseItem = sItem.Clone(); this.releaseUseItem = false; this.mouseInterface = true; } } } } if (Main.myPlayer == i && this.itemAnimation == 0 && TileObjectData.CustomPlace(sItem.createTile, sItem.placeStyle)) TileObject.CanPlace(Player.tileTargetX, Player.tileTargetY, sItem.createTile, sItem.placeStyle, this.direction, out TileObject _, true); if (this.itemAnimation == 0 && this.altFunctionUse == 2) this.altFunctionUse = 0; if (this.controlUseItem && this.itemAnimation == 0 && this.releaseUseItem && sItem.useStyle > 0) { if (this.altFunctionUse == 1) this.altFunctionUse = 2; bool canUse = true; if (sItem.shoot == 0) this.itemRotation = 0.0f; if (sItem.type == 3335 && (this.extraAccessory || !Main.expertMode)) canUse = false; if (this.pulley && sItem.fishingPole > 0) canUse = false; if (sItem.type == 3611 && (WiresUI.Settings.ToolMode & (WiresUI.Settings.MultiToolMode.Red | WiresUI.Settings.MultiToolMode.Green | WiresUI.Settings.MultiToolMode.Blue | WiresUI.Settings.MultiToolMode.Yellow | WiresUI.Settings.MultiToolMode.Actuator)) == (WiresUI.Settings.MultiToolMode) 0) canUse = false; if ((sItem.type == 3611 || sItem.type == 3625) && this.wireOperationsCooldown > 0) canUse = false; if (!this.CheckDD2CrystalPaymentLock(sItem)) canUse = false; if (this.whoAmI == Main.myPlayer && sItem.shoot > -1 && ProjectileID.Sets.IsADD2Turret[sItem.shoot] && !this.downedDD2EventAnyDifficulty && !DD2Event.Ongoing) canUse = false; if (sItem.shoot > -1 && ProjectileID.Sets.IsADD2Turret[sItem.shoot] && DD2Event.Ongoing && i == Main.myPlayer) { int worldX; int worldY; this.FindSentryRestingSpot(sItem.shoot, out worldX, out worldY, out int _); if (Player.WouldSpotOverlapWithSentry(worldX, worldY)) canUse = false; } if (sItem.shoot > -1 && ProjectileID.Sets.IsADD2Turret[sItem.shoot] && i == Main.myPlayer) { int worldX; int worldY; this.FindSentryRestingSpot(sItem.shoot, out worldX, out worldY, out int _); if (WorldGen.SolidTile(worldX / 16, worldY / 16 - 1)) canUse = false; } if (this.wet && (sItem.shoot == 85 || sItem.shoot == 15 || sItem.shoot == 34)) canUse = false; if (sItem.makeNPC > (short) 0 && !NPC.CanReleaseNPCs(this.whoAmI)) canUse = false; if (this.whoAmI == Main.myPlayer && sItem.type == 603 && !Main.cEd) canUse = false; if (sItem.type == 1071 || sItem.type == 1072) { bool flag2 = false; for (int index = 0; index < 58; ++index) { if (this.inventory[index].paint > (byte) 0) { flag2 = true; break; } } if (!flag2) canUse = false; } if (this.noItems) canUse = false; if (sItem.tileWand > 0) { int tileWand = sItem.tileWand; canUse = false; for (int index = 0; index < 58; ++index) { if (tileWand == this.inventory[index].type && this.inventory[index].stack > 0) { canUse = true; break; } } } if (sItem.fishingPole > 0) { for (int index1 = 0; index1 < 1000; ++index1) { if (Main.projectile[index1].active && Main.projectile[index1].owner == this.whoAmI && Main.projectile[index1].bobber) { canUse = false; if (this.whoAmI == Main.myPlayer && (double) Main.projectile[index1].ai[0] == 0.0) { Main.projectile[index1].ai[0] = 1f; float num3 = -10f; if (Main.projectile[index1].wet && (double) Main.projectile[index1].velocity.Y > (double) num3) Main.projectile[index1].velocity.Y = num3; Main.projectile[index1].netUpdate2 = true; if ((double) Main.projectile[index1].ai[1] < 0.0 && (double) Main.projectile[index1].localAI[1] != 0.0) { bool flag3 = false; int num4 = 0; for (int index2 = 0; index2 < 58; ++index2) { if (this.inventory[index2].stack > 0 && this.inventory[index2].bait > 0) { bool flag4 = false; int maxValue = 1 + this.inventory[index2].bait / 5; if (maxValue < 1) maxValue = 1; if (this.accTackleBox) ++maxValue; if (Main.rand.Next(maxValue) == 0) flag4 = true; if ((double) Main.projectile[index1].localAI[1] < 0.0) flag4 = true; if ((double) Main.projectile[index1].localAI[1] > 0.0) { Item obj = new Item(); obj.SetDefaults((int) Main.projectile[index1].localAI[1]); if (obj.rare < 0) flag4 = false; } if (flag4) { num4 = this.inventory[index2].type; --this.inventory[index2].stack; if (this.inventory[index2].stack <= 0) this.inventory[index2].SetDefaults(); } flag3 = true; break; } } if (flag3) { if (num4 == 2673) { if (Main.netMode != 1) NPC.SpawnOnPlayer(this.whoAmI, 370); else NetMessage.SendData(61, number: this.whoAmI, number2: 370f); Main.projectile[index1].ai[0] = 2f; } else if (Main.rand.Next(7) == 0 && !this.accFishingLine) Main.projectile[index1].ai[0] = 2f; else Main.projectile[index1].ai[1] = Main.projectile[index1].localAI[1]; Main.projectile[index1].netUpdate = true; } } } } } } 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) { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && Main.projectile[index].type == sItem.shoot) canUse = false; } } if (sItem.shoot == 106) { int num = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && Main.projectile[index].type == sItem.shoot) ++num; } if (num >= sItem.stack) canUse = false; } if (sItem.shoot == 272) { int num = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && Main.projectile[index].type == sItem.shoot) ++num; } if (num >= sItem.stack) canUse = false; } if (sItem.shoot == 13 || sItem.shoot == 32 || sItem.shoot >= 230 && sItem.shoot <= 235 || sItem.shoot == 315 || sItem.shoot == 331 || sItem.shoot == 372) { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && Main.projectile[index].type == sItem.shoot && (double) Main.projectile[index].ai[0] != 2.0) canUse = false; } } if (sItem.shoot == 332) { int num = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && Main.projectile[index].type == sItem.shoot && (double) Main.projectile[index].ai[0] != 2.0) ++num; } if (num >= 3) canUse = false; } if (sItem.potion & canUse) { if (this.potionDelay <= 0) { if (sItem.type == 227) { this.potionDelay = this.restorationDelayTime; this.AddBuff(21, this.potionDelay); } else { this.potionDelay = this.potionDelayTime; this.AddBuff(21, this.potionDelay); } } else canUse = false; } if (sItem.mana > 0 && this.silence) canUse = false; if (sItem.mana > 0 & canUse) { bool flag5 = false; if (sItem.type == 2795) flag5 = true; if (sItem.shoot > 0 && ProjectileID.Sets.TurretFeature[sItem.shoot] && this.altFunctionUse == 2) flag5 = true; if (sItem.shoot > 0 && ProjectileID.Sets.MinionTargettingFeature[sItem.shoot] && this.altFunctionUse == 2) flag5 = true; if (sItem.type != (int) sbyte.MaxValue || !this.spaceGun) { if (this.statMana >= (int) ((double) sItem.mana * (double) this.manaCost)) { if (!flag5) this.statMana -= (int) ((double) sItem.mana * (double) this.manaCost); } else if (this.manaFlower) { this.QuickMana(); if (this.statMana >= (int) ((double) sItem.mana * (double) this.manaCost)) { if (!flag5) this.statMana -= (int) ((double) sItem.mana * (double) this.manaCost); } else canUse = false; } else canUse = false; } if (((this.whoAmI != Main.myPlayer || sItem.buffType == 0 ? 0 : ((uint) sItem.buffTime > 0U ? 1 : 0)) & (canUse ? 1 : 0)) != 0) this.AddBuff(sItem.buffType, sItem.buffTime); } if ((sItem.shoot <= 0 || !ProjectileID.Sets.MinionTargettingFeature[sItem.shoot] ? 0 : (this.altFunctionUse == 2 ? 1 : 0)) == 0) this.ItemCheck_ApplyPetBuffs(sItem); if (this.whoAmI == Main.myPlayer && (double) this.gravDir == 1.0 && sItem.mountType != -1 && this.mount.CanMount(sItem.mountType, this)) this.mount.SetMount(sItem.mountType, this); if (sItem.type == 43 && Main.dayTime) canUse = false; if (sItem.type == 544 && Main.dayTime) canUse = false; if (sItem.type == 556 && Main.dayTime) canUse = false; if (sItem.type == 557 && Main.dayTime) canUse = false; if (sItem.type == 70 && !this.ZoneCorrupt) canUse = false; if (sItem.type == 1133 && !this.ZoneJungle) canUse = false; if (sItem.type == 1844 && (Main.dayTime || Main.pumpkinMoon || Main.snowMoon || DD2Event.Ongoing)) canUse = false; if (sItem.type == 1958 && (Main.dayTime || Main.pumpkinMoon || Main.snowMoon || DD2Event.Ongoing)) canUse = false; if (sItem.type == 2767 && (!Main.dayTime || Main.eclipse || !Main.hardMode)) canUse = false; if (sItem.type == 3601 && (!NPC.downedGolemBoss || !Main.hardMode || NPC.AnyDanger() || NPC.AnyoneNearCultists())) canUse = false; if (!this.SummonItemCheck()) canUse = false; if (sItem.shoot == 17 & canUse && i == Main.myPlayer) { int i1 = (int) ((double) Main.mouseX + (double) Main.screenPosition.X) / 16; int j = (int) ((double) Main.mouseY + (double) Main.screenPosition.Y) / 16; if ((double) this.gravDir == -1.0) j = (int) ((double) Main.screenPosition.Y + (double) Main.screenHeight - (double) Main.mouseY) / 16; Tile tile = Main.tile[i1, j]; if (tile.active() && (tile.type == (ushort) 0 || tile.type == (ushort) 2 || tile.type == (ushort) 23 || tile.type == (ushort) 109 || tile.type == (ushort) 199)) { WorldGen.KillTile(i1, j, noItem: true); if (!Main.tile[i1, j].active()) { if (Main.netMode == 1) NetMessage.SendData(17, number: 4, number2: ((float) i1), number3: ((float) j)); } else canUse = false; } else canUse = false; } if (canUse) canUse = this.HasAmmo(sItem, canUse); if (canUse) { if (sItem.pick > 0 || sItem.axe > 0 || sItem.hammer > 0) this.toolTime = 1; if (this.grappling[0] > -1) { this.pulley = false; this.pulleyDir = (byte) 1; if (this.controlRight) this.direction = 1; else if (this.controlLeft) this.direction = -1; } this.channel = sItem.channel; this.attackCD = 0; this.ApplyAnimation(sItem); if (sItem.UseSound != null) Main.PlaySound(sItem.UseSound, this.Center); } if ((sItem.shoot <= 0 || !ProjectileID.Sets.MinionTargettingFeature[sItem.shoot] ? 0 : (this.altFunctionUse == 2 ? 1 : 0)) == 0 & canUse && this.whoAmI == Main.myPlayer && sItem.shoot >= 0 && sItem.shoot < 714 && (ProjectileID.Sets.LightPet[sItem.shoot] || Main.projPet[sItem.shoot])) { if (ProjectileID.Sets.MinionSacrificable[sItem.shoot]) { List intList = new List(); float num5 = 0.0f; for (int index3 = 0; index3 < 1000; ++index3) { if (Main.projectile[index3].active && Main.projectile[index3].owner == i && Main.projectile[index3].minion) { int index4; for (index4 = 0; index4 < intList.Count; ++index4) { if ((double) Main.projectile[intList[index4]].minionSlots > (double) Main.projectile[index3].minionSlots) { intList.Insert(index4, index3); break; } } if (index4 == intList.Count) intList.Add(index3); num5 += Main.projectile[index3].minionSlots; } } float num6 = (float) ItemID.Sets.StaffMinionSlotsRequired[sItem.type]; float num7 = 0.0f; int num8 = 388; int index5 = -1; for (int index6 = 0; index6 < intList.Count; ++index6) { int type = Main.projectile[intList[index6]].type; if (type == 626) { intList.RemoveAt(index6); --index6; } if (type == 627) { if (Main.projectile[(int) Main.projectile[intList[index6]].localAI[1]].type == 628) index5 = intList[index6]; intList.RemoveAt(index6); --index6; } } if (index5 != -1) { intList.Add(index5); intList.Add(Projectile.GetByUUID(Main.projectile[index5].owner, Main.projectile[index5].ai[0])); } for (int index7 = 0; index7 < intList.Count && (double) num5 - (double) num7 > (double) this.maxMinions - (double) num6; ++index7) { int type = Main.projectile[intList[index7]].type; if (type != num8 && type != 625 && type != 628 && type != 623) { if (type == 388 && num8 == 387) num8 = 388; if (type == 387 && num8 == 388) num8 = 387; num7 += Main.projectile[intList[index7]].minionSlots; if (type == 626 || type == 627) { int byUuid = Projectile.GetByUUID(Main.projectile[intList[index7]].owner, Main.projectile[intList[index7]].ai[0]); if (byUuid >= 0) { Projectile projectile1 = Main.projectile[byUuid]; if (projectile1.type != 625) projectile1.localAI[1] = Main.projectile[intList[index7]].localAI[1]; Projectile projectile2 = Main.projectile[(int) Main.projectile[intList[index7]].localAI[1]]; projectile2.ai[0] = Main.projectile[intList[index7]].ai[0]; projectile2.ai[1] = 1f; projectile2.netUpdate = true; } } Main.projectile[intList[index7]].Kill(); } } intList.Clear(); if ((double) num5 + (double) num6 >= 9.0) AchievementsHelper.HandleSpecialEvent(this, 6); } else { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == i && Main.projectile[index].type == sItem.shoot) Main.projectile[index].Kill(); if (sItem.shoot == 72) { if (Main.projectile[index].active && Main.projectile[index].owner == i && Main.projectile[index].type == 86) Main.projectile[index].Kill(); if (Main.projectile[index].active && Main.projectile[index].owner == i && Main.projectile[index].type == 87) Main.projectile[index].Kill(); } } } } } if (!this.controlUseItem) { int num = this.channel ? 1 : 0; this.channel = false; } if (this.itemAnimation > 0) { this.itemAnimationMax = !sItem.melee ? sItem.useAnimation : (int) ((double) sItem.useAnimation * (double) this.meleeSpeed); if (sItem.mana > 0 && !flag1 && (sItem.type != (int) sbyte.MaxValue || !this.spaceGun)) this.manaRegenDelay = (int) this.maxRegenDelay; if (Main.dedServ) { this.itemHeight = sItem.height; this.itemWidth = sItem.width; } else { this.itemHeight = Main.itemTexture[sItem.type].Height; this.itemWidth = Main.itemTexture[sItem.type].Width; } --this.itemAnimation; if (!Main.dedServ) { if (sItem.useStyle == 1) { if (sItem.type > -1 && Item.claw[sItem.type]) { if ((double) this.itemAnimation < (double) this.itemAnimationMax * 0.333) { float num = 10f; this.itemLocation.X = (float) ((double) this.position.X + (double) this.width * 0.5 + ((double) Main.itemTexture[sItem.type].Width * 0.5 - (double) num) * (double) this.direction); this.itemLocation.Y = this.position.Y + 26f + playerOffsetHitbox; } else if ((double) this.itemAnimation < (double) this.itemAnimationMax * 0.666) { float num = 8f; this.itemLocation.X = (float) ((double) this.position.X + (double) this.width * 0.5 + ((double) Main.itemTexture[sItem.type].Width * 0.5 - (double) num) * (double) this.direction); this.itemLocation.Y = this.position.Y + 24f + playerOffsetHitbox; } else { float num = 6f; this.itemLocation.X = (float) ((double) this.position.X + (double) this.width * 0.5 - ((double) Main.itemTexture[sItem.type].Width * 0.5 - (double) num) * (double) this.direction); this.itemLocation.Y = this.position.Y + 20f + playerOffsetHitbox; } this.itemRotation = (float) (((double) this.itemAnimation / (double) this.itemAnimationMax - 0.5) * (double) -this.direction * 3.5 - (double) this.direction * 0.300000011920929); } else { if ((double) this.itemAnimation < (double) this.itemAnimationMax * 0.333) { float num = 10f; if (Main.itemTexture[sItem.type].Width > 32) num = 14f; if (Main.itemTexture[sItem.type].Width >= 52) num = 24f; if (Main.itemTexture[sItem.type].Width >= 64) num = 28f; if (Main.itemTexture[sItem.type].Width >= 92) num = 38f; if (sItem.type == 2330 || sItem.type == 2320 || sItem.type == 2341) num += 8f; this.itemLocation.X = (float) ((double) this.position.X + (double) this.width * 0.5 + ((double) Main.itemTexture[sItem.type].Width * 0.5 - (double) num) * (double) this.direction); this.itemLocation.Y = this.position.Y + 24f + playerOffsetHitbox; } else if ((double) this.itemAnimation < (double) this.itemAnimationMax * 0.666) { float num9 = 10f; if (Main.itemTexture[sItem.type].Width > 32) num9 = 18f; if (Main.itemTexture[sItem.type].Width >= 52) num9 = 24f; if (Main.itemTexture[sItem.type].Width >= 64) num9 = 28f; if (Main.itemTexture[sItem.type].Width >= 92) num9 = 38f; if (sItem.type == 2330 || sItem.type == 2320 || sItem.type == 2341) num9 += 4f; this.itemLocation.X = (float) ((double) this.position.X + (double) this.width * 0.5 + ((double) Main.itemTexture[sItem.type].Width * 0.5 - (double) num9) * (double) this.direction); float num10 = 10f; if (Main.itemTexture[sItem.type].Height > 32) num10 = 8f; if (Main.itemTexture[sItem.type].Height > 52) num10 = 12f; if (Main.itemTexture[sItem.type].Height > 64) num10 = 14f; if (sItem.type == 2330 || sItem.type == 2320 || sItem.type == 2341) num10 += 4f; this.itemLocation.Y = this.position.Y + num10 + playerOffsetHitbox; } else { float num11 = 6f; if (Main.itemTexture[sItem.type].Width > 32) num11 = 14f; if (Main.itemTexture[sItem.type].Width >= 48) num11 = 18f; if (Main.itemTexture[sItem.type].Width >= 52) num11 = 24f; if (Main.itemTexture[sItem.type].Width >= 64) num11 = 28f; if (Main.itemTexture[sItem.type].Width >= 92) num11 = 38f; if (sItem.type == 2330 || sItem.type == 2320 || sItem.type == 2341) num11 += 4f; this.itemLocation.X = (float) ((double) this.position.X + (double) this.width * 0.5 - ((double) Main.itemTexture[sItem.type].Width * 0.5 - (double) num11) * (double) this.direction); float num12 = 10f; if (Main.itemTexture[sItem.type].Height > 32) num12 = 10f; if (Main.itemTexture[sItem.type].Height > 52) num12 = 12f; if (Main.itemTexture[sItem.type].Height > 64) num12 = 14f; if (sItem.type == 2330 || sItem.type == 2320 || sItem.type == 2341) num12 += 4f; this.itemLocation.Y = this.position.Y + num12 + playerOffsetHitbox; } this.itemRotation = (float) (((double) this.itemAnimation / (double) this.itemAnimationMax - 0.5) * (double) -this.direction * 3.5 - (double) this.direction * 0.300000011920929); } if ((double) this.gravDir == -1.0) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = (float) ((double) this.position.Y + (double) this.height + ((double) this.position.Y - (double) this.itemLocation.Y)); } } else if (sItem.useStyle == 2) { this.itemRotation = (float) ((double) this.itemAnimation / (double) this.itemAnimationMax * (double) this.direction * 2.0 + -1.39999997615814 * (double) this.direction); if ((double) this.itemAnimation < (double) this.itemAnimationMax * 0.5) { this.itemLocation.X = (float) ((double) this.position.X + (double) this.width * 0.5 + ((double) Main.itemTexture[sItem.type].Width * 0.5 - 9.0 - (double) this.itemRotation * 12.0 * (double) this.direction) * (double) this.direction); this.itemLocation.Y = (float) ((double) this.position.Y + 38.0 + (double) this.itemRotation * (double) this.direction * 4.0) + playerOffsetHitbox; } else { this.itemLocation.X = (float) ((double) this.position.X + (double) this.width * 0.5 + ((double) Main.itemTexture[sItem.type].Width * 0.5 - 9.0 - (double) this.itemRotation * 16.0 * (double) this.direction) * (double) this.direction); this.itemLocation.Y = (float) ((double) this.position.Y + 38.0 + (double) this.itemRotation * (double) this.direction) + playerOffsetHitbox; } if ((double) this.gravDir == -1.0) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = (float) ((double) this.position.Y + (double) this.height + ((double) this.position.Y - (double) this.itemLocation.Y)); } } else if (sItem.useStyle == 3) { if ((double) this.itemAnimation > (double) this.itemAnimationMax * 0.666) { this.itemLocation.X = -1000f; this.itemLocation.Y = -1000f; this.itemRotation = -1.3f * (float) this.direction; } else { this.itemLocation.X = (float) ((double) this.position.X + (double) this.width * 0.5 + ((double) Main.itemTexture[sItem.type].Width * 0.5 - 4.0) * (double) this.direction); this.itemLocation.Y = this.position.Y + 24f + playerOffsetHitbox; float num = (float) ((double) this.itemAnimation / (double) this.itemAnimationMax * (double) Main.itemTexture[sItem.type].Width * (double) this.direction * (double) sItem.scale * 1.20000004768372) - (float) (10 * this.direction); if ((double) num > -4.0 && this.direction == -1) num = -8f; if ((double) num < 4.0 && this.direction == 1) num = 8f; this.itemLocation.X -= num; this.itemRotation = 0.8f * (float) this.direction; } if ((double) this.gravDir == -1.0) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = (float) ((double) this.position.Y + (double) this.height + ((double) this.position.Y - (double) this.itemLocation.Y)); } } else if (sItem.useStyle == 4) { int num = 0; if (sItem.type == 3601) num = 10; this.itemRotation = 0.0f; this.itemLocation.X = (float) ((double) this.position.X + (double) this.width * 0.5 + ((double) Main.itemTexture[sItem.type].Width * 0.5 - 9.0 - (double) this.itemRotation * 14.0 * (double) this.direction - 4.0 - (double) num) * (double) this.direction); this.itemLocation.Y = (float) ((double) this.position.Y + (double) Main.itemTexture[sItem.type].Height * 0.5 + 4.0) + playerOffsetHitbox; if ((double) this.gravDir == -1.0) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = (float) ((double) this.position.Y + (double) this.height + ((double) this.position.Y - (double) this.itemLocation.Y)); } } else if (sItem.useStyle == 5) { if (sItem.type == 3779) { this.itemRotation = 0.0f; this.itemLocation.X = this.Center.X + (float) (6 * this.direction); this.itemLocation.Y = this.MountedCenter.Y + 6f; } else if (Item.staff[sItem.type]) { float num = 6f; if (sItem.type == 3476) num = 14f; this.itemLocation = this.MountedCenter; this.itemLocation += this.itemRotation.ToRotationVector2() * num * (float) this.direction; } else { this.itemLocation.X = (float) ((double) this.position.X + (double) this.width * 0.5 - (double) Main.itemTexture[sItem.type].Width * 0.5) - (float) (this.direction * 2); this.itemLocation.Y = this.MountedCenter.Y - (float) Main.itemTexture[sItem.type].Height * 0.5f; } } } } else if (sItem.holdStyle == 1 && !this.pulley) { if (Main.dedServ) this.itemLocation.X = (float) ((double) this.position.X + (double) this.width * 0.5 + 20.0 * (double) this.direction); else if (sItem.type == 930) { this.itemLocation.X = (float) ((double) this.position.X + (double) (this.width / 2) * 0.5 - 12.0) - (float) (2 * this.direction); float x = this.position.X + (float) (this.width / 2) + (float) (38 * this.direction); if (this.direction == 1) x -= 10f; float y = this.MountedCenter.Y - 4f * this.gravDir; if ((double) this.gravDir == -1.0) y -= 8f; this.RotateRelativePoint(ref x, ref y); int Type = 0; for (int index = 54; index < 58; ++index) { if (this.inventory[index].stack > 0 && this.inventory[index].ammo == 931) { Type = this.inventory[index].type; break; } } if (Type == 0) { for (int index = 0; index < 54; ++index) { if (this.inventory[index].stack > 0 && this.inventory[index].ammo == 931) { Type = this.inventory[index].type; break; } } } if (Type == 931) Type = (int) sbyte.MaxValue; else if (Type == 1614) Type = 187; if (Type > 0) { int index = Dust.NewDust(new Vector2(x, y + this.gfxOffY), 6, 6, Type, Alpha: 100, Scale: 1.6f); Main.dust[index].noGravity = true; Main.dust[index].velocity.Y -= 4f * this.gravDir; } } else if (sItem.type == 968) { this.itemLocation.X = this.position.X + (float) this.width * 0.5f + (float) (8 * this.direction); if (this.whoAmI == Main.myPlayer) { int index8 = (int) ((double) this.itemLocation.X + (double) Main.itemTexture[sItem.type].Width * 0.800000011920929 * (double) this.direction) / 16; int index9 = (int) ((double) this.itemLocation.Y + (double) playerOffsetHitbox + (double) (Main.itemTexture[sItem.type].Height / 2)) / 16; if (Main.tile[index8, index9] == null) Main.tile[index8, index9] = new Tile(); if (Main.tile[index8, index9].active() && Main.tile[index8, index9].type == (ushort) 215 && Main.tile[index8, index9].frameY < (short) 54) { ++this.miscTimer; if (Main.rand.Next(5) == 0) ++this.miscTimer; if (this.miscTimer > 900) { this.miscTimer = 0; sItem.SetDefaults(969); if (this.selectedItem == 58) Main.mouseItem.SetDefaults(969); for (int index10 = 0; index10 < 58; ++index10) { if (this.inventory[index10].type == sItem.type && index10 != this.selectedItem && this.inventory[index10].stack < this.inventory[index10].maxStack) { Main.PlaySound(7); ++this.inventory[index10].stack; sItem.SetDefaults(); if (this.selectedItem == 58) Main.mouseItem.SetDefaults(); } } } } else this.miscTimer = 0; } } else if (sItem.type == 856) this.itemLocation.X = this.position.X + (float) this.width * 0.5f + (float) (4 * this.direction); else if (sItem.fishingPole > 0) { this.itemLocation.X = (float) ((double) this.position.X + (double) this.width * 0.5 + (double) Main.itemTexture[sItem.type].Width * 0.180000007152557 * (double) this.direction); } else { this.itemLocation.X = (float) ((double) this.position.X + (double) this.width * 0.5 + ((double) Main.itemTexture[sItem.type].Width * 0.5 + 2.0) * (double) this.direction); if (sItem.type == 282 || sItem.type == 286 || sItem.type == 3112) { this.itemLocation.X -= (float) (this.direction * 2); this.itemLocation.Y += 4f; } else if (sItem.type == 3002) { this.itemLocation.X -= (float) (4 * this.direction); this.itemLocation.Y += 2f; } } this.itemLocation.Y = this.position.Y + 24f + playerOffsetHitbox; if (sItem.type == 856) this.itemLocation.Y = this.position.Y + 34f + playerOffsetHitbox; if (sItem.type == 930) this.itemLocation.Y = this.position.Y + 9f + playerOffsetHitbox; if (sItem.fishingPole > 0) this.itemLocation.Y += 4f; else if (sItem.type == 3476) { this.itemLocation.X = this.Center.X + (float) (14 * this.direction); this.itemLocation.Y = this.MountedCenter.Y; } else if (sItem.type == 3779) { this.itemLocation.X = this.Center.X + (float) (6 * this.direction); this.itemLocation.Y = this.MountedCenter.Y + 6f; } else if (sItem.type == 353) { this.itemLocation.X = this.Center.X + (float) (8 * this.direction); this.itemLocation.Y = this.MountedCenter.Y + 11f; } this.itemRotation = 0.0f; if ((double) this.gravDir == -1.0) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = (float) ((double) this.position.Y + (double) this.height + ((double) this.position.Y - (double) this.itemLocation.Y)) + playerOffsetHitbox; if (sItem.type == 930) this.itemLocation.Y -= 24f; } } else if (sItem.holdStyle == 2 && !this.pulley) { if (sItem.type == 946) { this.itemRotation = 0.0f; this.itemLocation.X = this.position.X + (float) this.width * 0.5f - (float) (16 * this.direction); this.itemLocation.Y = this.position.Y + 22f + playerOffsetHitbox; this.fallStart = (int) ((double) this.position.Y / 16.0); if ((double) this.gravDir == -1.0) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = (float) ((double) this.position.Y + (double) this.height + ((double) this.position.Y - (double) this.itemLocation.Y)); if ((double) this.velocity.Y < -2.0) this.velocity.Y = -2f; } else if ((double) this.velocity.Y > 2.0) this.velocity.Y = 2f; } else { this.itemLocation.X = this.position.X + (float) this.width * 0.5f + (float) (6 * this.direction); this.itemLocation.Y = this.position.Y + 16f + playerOffsetHitbox; this.itemRotation = 0.79f * (float) -this.direction; if ((double) this.gravDir == -1.0) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = (float) ((double) this.position.Y + (double) this.height + ((double) this.position.Y - (double) this.itemLocation.Y)); } } } else if (sItem.holdStyle == 3 && !this.pulley && !Main.dedServ) { this.itemLocation.X = (float) ((double) this.position.X + (double) this.width * 0.5 - (double) Main.itemTexture[sItem.type].Width * 0.5) - (float) (this.direction * 2); this.itemLocation.Y = this.MountedCenter.Y - (float) Main.itemTexture[sItem.type].Height * 0.5f; this.itemRotation = 0.0f; } if (((sItem.type == 974 || sItem.type == 8 || sItem.type == 1245 || sItem.type == 2274 || sItem.type == 3004 || sItem.type == 3045 || sItem.type == 3114 || sItem.type >= 427 && sItem.type <= 433) && !this.wet || sItem.type == 523 || sItem.type == 1333) && !this.pulley) { float R = 1f; float G = 0.95f; float B = 0.8f; int num13 = 0; if (sItem.type == 523) num13 = 8; else if (sItem.type == 974) num13 = 9; else if (sItem.type == 1245) num13 = 10; else if (sItem.type == 1333) num13 = 11; else if (sItem.type == 2274) num13 = 12; else if (sItem.type == 3004) num13 = 13; else if (sItem.type == 3045) num13 = 14; else if (sItem.type == 3114) num13 = 15; else if (sItem.type >= 427) num13 = sItem.type - 426; switch (num13) { case 1: R = 0.0f; G = 0.1f; B = 1.3f; break; case 2: R = 1f; G = 0.1f; B = 0.1f; break; case 3: R = 0.0f; G = 1f; B = 0.1f; break; case 4: R = 0.9f; G = 0.0f; B = 0.9f; break; case 5: R = 1.3f; G = 1.3f; B = 1.3f; break; case 6: R = 0.9f; G = 0.9f; B = 0.0f; break; case 7: R = (float) (0.5 * (double) Main.demonTorch + 1.0 * (1.0 - (double) Main.demonTorch)); G = 0.3f; B = (float) (1.0 * (double) Main.demonTorch + 0.5 * (1.0 - (double) Main.demonTorch)); break; case 8: B = 0.7f; R = 0.85f; G = 1f; break; case 9: B = 1f; R = 0.7f; G = 0.85f; break; case 10: B = 0.0f; R = 1f; G = 0.5f; break; case 11: B = 0.8f; R = 1.25f; G = 1.25f; break; case 12: R *= 0.75f; G *= 1.35f; B *= 1.5f; break; case 13: R = 0.95f; G = 0.65f; B = 1.3f; break; case 14: R = (float) Main.DiscoR / (float) byte.MaxValue; G = (float) Main.DiscoG / (float) byte.MaxValue; B = (float) Main.DiscoB / (float) byte.MaxValue; break; case 15: R = 1f; G = 0.0f; B = 1f; break; } int num14 = num13; int Type; switch (num14) { case 0: Type = 6; break; case 8: Type = 75; break; case 9: Type = 135; break; case 10: Type = 158; break; case 11: Type = 169; break; case 12: Type = 156; break; case 13: Type = 234; break; case 14: Type = 66; break; case 15: Type = 242; break; default: Type = 58 + num14; break; } int maxValue = 30; if (this.itemAnimation > 0) maxValue = 7; if (this.direction == -1) { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X - 16f, this.itemLocation.Y - 14f * this.gravDir), 4, 4, Type, Alpha: 100); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position); if (Type == 66) { Main.dust[index].color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); Main.dust[index].noGravity = true; } } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 12f + this.velocity.X, this.itemLocation.Y - 14f + this.velocity.Y)), R, G, B); } else { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X + 6f, this.itemLocation.Y - 14f * this.gravDir), 4, 4, Type, Alpha: 100); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position); if (Type == 66) { Main.dust[index].color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); Main.dust[index].noGravity = true; } } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 12f + this.velocity.X, this.itemLocation.Y - 14f + this.velocity.Y)), R, G, B); } } if ((sItem.type == 105 || sItem.type == 713) && !this.wet && !this.pulley) { int maxValue = 20; if (this.itemAnimation > 0) maxValue = 7; if (this.direction == -1) { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X - 12f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 6, Alpha: 100); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position); } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f)), 1f, 0.95f, 0.8f); } else { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X + 4f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 6, Alpha: 100); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position); } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f)), 1f, 0.95f, 0.8f); } } else if (sItem.type == 148 && !this.wet) { int maxValue = 10; if (this.itemAnimation > 0) maxValue = 7; if (this.direction == -1) { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X - 12f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 172, Alpha: 100); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position); } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f)), 0.0f, 0.5f, 1f); } else { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X + 4f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 172, Alpha: 100); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position); } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f)), 0.0f, 0.5f, 1f); } } else if (sItem.type == 3117 && !this.wet) { this.itemLocation.X -= (float) (this.direction * 4); int maxValue = 10; if (this.itemAnimation > 0) maxValue = 7; if (this.direction == -1) { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X - 10f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 242, Alpha: 100); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position); } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f)), 0.9f, 0.1f, 0.75f); } else { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X + 6f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 242, Alpha: 100); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position); } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f)), 0.9f, 0.1f, 0.75f); } } if (sItem.type == 282 && !this.pulley) { if (this.direction == -1) Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f)), 0.7f, 1f, 0.8f); else Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f)), 0.7f, 1f, 0.8f); } if (sItem.type == 3002 && !this.pulley) { float R = 1.05f; float G = 0.95f; float B = 0.55f; if (this.direction == -1) Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f)), R, G, B); else Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f)), R, G, B); ++this.spelunkerTimer; if (this.spelunkerTimer >= (byte) 10) { this.spelunkerTimer = (byte) 0; int num15 = 30; int num16 = (int) this.Center.X / 16; int num17 = (int) this.Center.Y / 16; for (int index11 = num16 - num15; index11 <= num16 + num15; ++index11) { for (int index12 = num17 - num15; index12 <= num17 + num15; ++index12) { if (Main.rand.Next(4) == 0 && (double) new Vector2((float) (num16 - index11), (float) (num17 - index12)).Length() < (double) num15 && index11 > 0 && index11 < Main.maxTilesX - 1 && index12 > 0 && index12 < Main.maxTilesY - 1 && Main.tile[index11, index12] != null && Main.tile[index11, index12].active()) { bool flag6 = false; if (Main.tile[index11, index12].type == (ushort) 185 && Main.tile[index11, index12].frameY == (short) 18) { if (Main.tile[index11, index12].frameX >= (short) 576 && Main.tile[index11, index12].frameX <= (short) 882) flag6 = true; } else if (Main.tile[index11, index12].type == (ushort) 186 && Main.tile[index11, index12].frameX >= (short) 864 && Main.tile[index11, index12].frameX <= (short) 1170) flag6 = true; if (flag6 || Main.tileSpelunker[(int) Main.tile[index11, index12].type] || Main.tileAlch[(int) Main.tile[index11, index12].type] && Main.tile[index11, index12].type != (ushort) 82) { int index13 = Dust.NewDust(new Vector2((float) (index11 * 16), (float) (index12 * 16)), 16, 16, 204, Alpha: 150, Scale: 0.3f); Main.dust[index13].fadeIn = 0.75f; Main.dust[index13].velocity *= 0.1f; Main.dust[index13].noLight = true; } } } } } } if (sItem.type == 286 && !this.pulley) { if (this.direction == -1) Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f)), 0.7f, 0.8f, 1f); else Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f)), 0.7f, 0.8f, 1f); } if (sItem.type == 3112 && !this.pulley) { if (this.direction == -1) Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f)), 1f, 0.6f, 0.85f); else Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f)), 1f, 0.6f, 0.85f); } this.releaseUseItem = !this.controlUseItem; if (this.itemTime > 0) { --this.itemTime; if (this.itemTime == 0 && this.whoAmI == Main.myPlayer) { switch (sItem.type) { case 65: case 676: case 723: case 724: case 989: case 1226: case 1227: Main.PlaySound(25); for (int index14 = 0; index14 < 5; ++index14) { int index15 = Dust.NewDust(this.position, this.width, this.height, 45, Alpha: ((int) byte.MaxValue), Scale: ((float) Main.rand.Next(20, 26) * 0.1f)); Main.dust[index15].noLight = true; Main.dust[index15].noGravity = true; Main.dust[index15].velocity *= 0.5f; } break; } } } if (i == Main.myPlayer) { bool flag7 = true; int type1 = sItem.type; if ((type1 == 65 || type1 == 676 || type1 == 723 || type1 == 724 || type1 == 757 || type1 == 674 || type1 == 675 || type1 == 989 || type1 == 1226 || type1 == 1227) && this.itemAnimation != this.itemAnimationMax - 1) flag7 = false; if (type1 == 3852) { if (this.itemAnimation < this.itemAnimationMax - 12) flag7 = false; if (this.altFunctionUse == 2 && this.itemAnimation != this.itemAnimationMax - 1) flag7 = false; } if (sItem.shoot > 0 && ProjectileID.Sets.TurretFeature[sItem.shoot] && this.altFunctionUse == 2 && flag7 && this.itemTime == 0) { this.itemTime = sItem.useTime; for (int index = 0; index < 1000; ++index) { Projectile projectile = Main.projectile[index]; if (projectile.active && projectile.owner == Main.myPlayer && ProjectileID.Sets.TurretFeature[projectile.type]) projectile.Kill(); } } if (sItem.shoot > 0 && ProjectileID.Sets.MinionTargettingFeature[sItem.shoot] && this.altFunctionUse == 2 && flag7 && this.itemTime == 0) { this.itemTime = sItem.useTime; this.MinionNPCTargetAim(); } if (((sItem.shoot <= 0 || this.itemAnimation <= 0 ? 0 : (this.itemTime == 0 ? 1 : 0)) & (flag7 ? 1 : 0)) != 0) { int shoot = sItem.shoot; float speed = sItem.shootSpeed; if (this.inventory[this.selectedItem].thrown && (double) speed < 16.0) { speed *= this.thrownVelocity; if ((double) speed > 16.0) speed = 16f; } if (sItem.melee && shoot != 25 && shoot != 26 && shoot != 35) speed /= this.meleeSpeed; bool canShoot = false; int Damage = weaponDamage; float knockBack = sItem.knockBack; if (shoot == 13 || shoot == 32 || shoot == 315 || shoot >= 230 && shoot <= 235 || shoot == 331) { this.grappling[0] = -1; this.grapCount = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == i) { if (Main.projectile[index].type == 13) Main.projectile[index].Kill(); if (Main.projectile[index].type == 331) Main.projectile[index].Kill(); if (Main.projectile[index].type == 315) Main.projectile[index].Kill(); if (Main.projectile[index].type >= 230 && Main.projectile[index].type <= 235) Main.projectile[index].Kill(); } } } if (sItem.useAmmo > 0) this.PickAmmo(sItem, ref shoot, ref speed, ref canShoot, ref Damage, ref knockBack, ItemID.Sets.gunProj[sItem.type]); else canShoot = true; if (ItemID.Sets.gunProj[sItem.type]) { knockBack = sItem.knockBack; Damage = weaponDamage; speed = sItem.shootSpeed; } if (sItem.type == 71) canShoot = false; if (sItem.type == 72) canShoot = false; if (sItem.type == 73) canShoot = false; if (sItem.type == 74) canShoot = false; if (sItem.type == 1254 && shoot == 14) shoot = 242; if (sItem.type == 1255 && shoot == 14) shoot = 242; if (sItem.type == 1265 && shoot == 14) shoot = 242; if (sItem.type == 3542) { if (Main.rand.Next(100) < 20) { ++shoot; Damage *= 3; } else --speed; } if (shoot == 73) { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == i) { if (Main.projectile[index].type == 73) shoot = 74; if (shoot == 74 && Main.projectile[index].type == 74) canShoot = false; } } } if (canShoot) { float num18 = this.GetWeaponKnockback(sItem, knockBack); if (shoot == 228) num18 = 0.0f; if (shoot == 1 && sItem.type == 120) shoot = 2; if (sItem.type == 682) shoot = 117; if (sItem.type == 725) shoot = 120; if (sItem.type == 2796) shoot = 442; if (sItem.type == 2223) shoot = 357; this.itemTime = sItem.useTime; Vector2 vector2_1 = this.RotatedRelativePoint(this.MountedCenter); bool flag8 = true; if (sItem.type == 3611) flag8 = false; Vector2 vector2_2 = Vector2.UnitX.RotatedBy((double) this.fullRotation); Vector2 v1 = Main.MouseWorld - vector2_1; Vector2 vector2_3 = this.itemRotation.ToRotationVector2() * (float) this.direction; if (sItem.type == 3852 && this.itemAnimation != this.itemAnimationMax - 1) v1 = vector2_3; if (v1 != Vector2.Zero) v1.Normalize(); Vector2 vector2_4 = v1; float num19 = Vector2.Dot(vector2_2, vector2_4); if (flag8) { if ((double) num19 > 0.0) this.ChangeDir(1); else this.ChangeDir(-1); } if (sItem.type == 3094 || sItem.type == 3378 || sItem.type == 3543) vector2_1.Y = this.position.Y + (float) (this.height / 3); if (sItem.type == 2611) { Vector2 vector2_5 = v1; if (vector2_5 != Vector2.Zero) vector2_5.Normalize(); vector2_1 += vector2_5; } if (sItem.type == 3827) vector2_1 += v1.SafeNormalize(Vector2.Zero).RotatedBy((double) this.direction * -1.57079637050629) * 24f; if (shoot == 9) { vector2_1 = new Vector2((float) ((double) this.position.X + (double) this.width * 0.5 + (double) (Main.rand.Next(201) * -this.direction) + ((double) Main.mouseX + (double) Main.screenPosition.X - (double) this.position.X)), this.MountedCenter.Y - 600f); num18 = 0.0f; Damage *= 2; } if (sItem.type == 986 || sItem.type == 281) { vector2_1.X += (float) (6 * this.direction); vector2_1.Y -= 6f * this.gravDir; } if (sItem.type == 3007) { vector2_1.X -= (float) (4 * this.direction); vector2_1.Y -= 1f * this.gravDir; } float f1 = (float) Main.mouseX + Main.screenPosition.X - vector2_1.X; float f2 = (float) Main.mouseY + Main.screenPosition.Y - vector2_1.Y; if (sItem.type == 3852 && this.itemAnimation != this.itemAnimationMax - 1) { Vector2 vector2_6 = vector2_3; f1 = vector2_6.X; f2 = vector2_6.Y; } if ((double) this.gravDir == -1.0) f2 = Main.screenPosition.Y + (float) Main.screenHeight - (float) Main.mouseY - vector2_1.Y; float num20 = (float) Math.Sqrt((double) f1 * (double) f1 + (double) f2 * (double) f2); float num21 = num20; float num22; if (float.IsNaN(f1) && float.IsNaN(f2) || (double) f1 == 0.0 && (double) f2 == 0.0) { f1 = (float) this.direction; f2 = 0.0f; num22 = speed; } else num22 = speed / num20; if (sItem.type == 1929 || sItem.type == 2270) { f1 += (float) Main.rand.Next(-50, 51) * 0.03f / num22; f2 += (float) Main.rand.Next(-50, 51) * 0.03f / num22; } float num23 = f1 * num22; float num24 = f2 * num22; if (sItem.type == 757) Damage = (int) ((double) Damage * 1.25); if (shoot == 250) { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == this.whoAmI && (Main.projectile[index].type == 250 || Main.projectile[index].type == 251)) Main.projectile[index].Kill(); } } if (shoot == 12) { vector2_1.X += num23 * 3f; vector2_1.Y += num24 * 3f; } if (sItem.useStyle == 5) { if (sItem.type == 3029) { Vector2 vector2_7 = new Vector2(num23, num24); vector2_7.X = (float) Main.mouseX + Main.screenPosition.X - vector2_1.X; vector2_7.Y = (float) ((double) Main.mouseY + (double) Main.screenPosition.Y - (double) vector2_1.Y - 1000.0); this.itemRotation = (float) Math.Atan2((double) vector2_7.Y * (double) this.direction, (double) vector2_7.X * (double) this.direction); NetMessage.SendData(13, number: this.whoAmI); NetMessage.SendData(41, number: this.whoAmI); } else if (sItem.type == 3779) { this.itemRotation = 0.0f; NetMessage.SendData(13, number: this.whoAmI); NetMessage.SendData(41, number: this.whoAmI); } else { this.itemRotation = (float) Math.Atan2((double) num24 * (double) this.direction, (double) num23 * (double) this.direction) - this.fullRotation; NetMessage.SendData(13, number: this.whoAmI); NetMessage.SendData(41, number: this.whoAmI); } } if (shoot == 17) { vector2_1.X = (float) Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float) Main.mouseY + Main.screenPosition.Y; if ((double) this.gravDir == -1.0) vector2_1.Y = Main.screenPosition.Y + (float) Main.screenHeight - (float) Main.mouseY; } if (shoot == 76) { shoot += Main.rand.Next(3); float num25 = num21 / (float) (Main.screenHeight / 2); if ((double) num25 > 1.0) num25 = 1f; float num26 = num23 + (float) Main.rand.Next(-40, 41) * 0.01f; float num27 = num24 + (float) Main.rand.Next(-40, 41) * 0.01f; float SpeedX = num26 * (num25 + 0.25f); float SpeedY = num27 * (num25 + 0.25f); int number = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); Main.projectile[number].ai[1] = 1f; float num28 = (float) ((double) num25 * 2.0 - 1.0); if ((double) num28 < -1.0) num28 = -1f; if ((double) num28 > 1.0) num28 = 1f; Main.projectile[number].ai[0] = num28; NetMessage.SendData(27, number: number); } else if (sItem.type == 3029) { int num29 = 3; if (Main.rand.Next(3) == 0) ++num29; for (int index16 = 0; index16 < num29; ++index16) { vector2_1 = new Vector2((float) ((double) this.position.X + (double) this.width * 0.5 + (double) (Main.rand.Next(201) * -this.direction) + ((double) Main.mouseX + (double) Main.screenPosition.X - (double) this.position.X)), this.MountedCenter.Y - 600f); vector2_1.X = (float) (((double) vector2_1.X * 10.0 + (double) this.Center.X) / 11.0) + (float) Main.rand.Next(-100, 101); vector2_1.Y -= (float) (150 * index16); float num30 = (float) Main.mouseX + Main.screenPosition.X - vector2_1.X; float num31 = (float) Main.mouseY + Main.screenPosition.Y - vector2_1.Y; if ((double) num31 < 0.0) num31 *= -1f; if ((double) num31 < 20.0) num31 = 20f; float num32 = (float) Math.Sqrt((double) num30 * (double) num30 + (double) num31 * (double) num31); float num33 = speed / num32; float num34 = num30 * num33; float num35 = num31 * num33; float num36 = num34 + (float) Main.rand.Next(-40, 41) * 0.03f; float SpeedY = num35 + (float) Main.rand.Next(-40, 41) * 0.03f; float SpeedX = num36 * ((float) Main.rand.Next(75, 150) * 0.01f); vector2_1.X += (float) Main.rand.Next(-50, 51); int index17 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); Main.projectile[index17].noDropItem = true; } } else if (sItem.type == 98 || sItem.type == 533) { float SpeedX = num23 + (float) Main.rand.Next(-40, 41) * 0.01f; float SpeedY = num24 + (float) Main.rand.Next(-40, 41) * 0.01f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } else if (sItem.type == 1319) { float SpeedX = num23 + (float) Main.rand.Next(-40, 41) * 0.02f; float SpeedY = num24 + (float) Main.rand.Next(-40, 41) * 0.02f; int index = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); Main.projectile[index].ranged = true; Main.projectile[index].thrown = false; } else if (sItem.type == 3107) { float SpeedX = num23 + (float) Main.rand.Next(-40, 41) * 0.02f; float SpeedY = num24 + (float) Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } else if (sItem.type == 3053) { Vector2 vector2_8 = new Vector2(num23, num24); vector2_8.Normalize(); Vector2 vector2_9 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101)); vector2_9.Normalize(); Vector2 vector2_10 = vector2_8 * 4f + vector2_9; vector2_10.Normalize(); vector2_10 *= sItem.shootSpeed; float ai1 = (float) Main.rand.Next(10, 80) * (1f / 1000f); if (Main.rand.Next(2) == 0) ai1 *= -1f; float ai0 = (float) Main.rand.Next(10, 80) * (1f / 1000f); if (Main.rand.Next(2) == 0) ai0 *= -1f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, vector2_10.X, vector2_10.Y, shoot, Damage, num18, i, ai0, ai1); } else if (sItem.type == 3019) { Vector2 vector2_11 = new Vector2(num23, num24); float num37 = vector2_11.Length(); vector2_11.X += (float) ((double) Main.rand.Next(-100, 101) * 0.00999999977648258 * (double) num37 * 0.150000005960464); vector2_11.Y += (float) ((double) Main.rand.Next(-100, 101) * 0.00999999977648258 * (double) num37 * 0.150000005960464); float num38 = num23 + (float) Main.rand.Next(-40, 41) * 0.03f; float num39 = num24 + (float) Main.rand.Next(-40, 41) * 0.03f; vector2_11.Normalize(); Vector2 vector2_12 = vector2_11 * num37; Vector2 vector2_13 = new Vector2(num38 * ((float) Main.rand.Next(50, 150) * 0.01f), num39 * ((float) Main.rand.Next(50, 150) * 0.01f)); vector2_13.X += (float) Main.rand.Next(-100, 101) * 0.025f; vector2_13.Y += (float) Main.rand.Next(-100, 101) * 0.025f; vector2_13.Normalize(); Vector2 vector2_14 = vector2_13 * num37; float x = vector2_14.X; float y = vector2_14.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, x, y, shoot, Damage, num18, i, vector2_12.X, vector2_12.Y); } else if (sItem.type == 2797) { Vector2 vector2_15 = Vector2.Normalize(new Vector2(num23, num24)) * 40f * sItem.scale; if (Collision.CanHit(vector2_1, 0, 0, vector2_1 + vector2_15, 0, 0)) vector2_1 += vector2_15; float rotation = new Vector2(num23, num24).ToRotation(); float num40 = 2.094395f; int num41 = Main.rand.Next(4, 5); if (Main.rand.Next(4) == 0) ++num41; for (int index18 = 0; index18 < num41; ++index18) { float num42 = (float) (Main.rand.NextDouble() * 0.200000002980232 + 0.0500000007450581); Vector2 vector2_16 = new Vector2(num23, num24).RotatedBy((double) num40 * Main.rand.NextDouble() - (double) num40 / 2.0) * num42; int index19 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, vector2_16.X, vector2_16.Y, 444, Damage, num18, i, rotation); Main.projectile[index19].localAI[0] = (float) shoot; Main.projectile[index19].localAI[1] = speed; } } else if (sItem.type == 2270) { float SpeedX = num23 + (float) Main.rand.Next(-40, 41) * 0.05f; float SpeedY = num24 + (float) Main.rand.Next(-40, 41) * 0.05f; if (Main.rand.Next(3) == 0) { SpeedX *= (float) (1.0 + (double) Main.rand.Next(-30, 31) * 0.0199999995529652); SpeedY *= (float) (1.0 + (double) Main.rand.Next(-30, 31) * 0.0199999995529652); } Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } else if (sItem.type == 1930) { int num43 = 2 + Main.rand.Next(3); for (int index = 0; index < num43; ++index) { float num44 = num23; float num45 = num24; float num46 = 0.025f * (float) index; float num47 = num44 + (float) Main.rand.Next(-35, 36) * num46; float num48 = num45 + (float) Main.rand.Next(-35, 36) * num46; float num49 = (float) Math.Sqrt((double) num47 * (double) num47 + (double) num48 * (double) num48); float num50 = speed / num49; float SpeedX = num47 * num50; float SpeedY = num48 * num50; Projectile.NewProjectile(vector2_1.X + (float) ((double) num23 * (double) (num43 - index) * 1.75), vector2_1.Y + (float) ((double) num24 * (double) (num43 - index) * 1.75), SpeedX, SpeedY, shoot, Damage, num18, i, (float) Main.rand.Next(0, 10 * (index + 1))); } } else if (sItem.type == 1931) { int num51 = 2; for (int index = 0; index < num51; ++index) { vector2_1 = new Vector2((float) ((double) this.position.X + (double) this.width * 0.5 + (double) (Main.rand.Next(201) * -this.direction) + ((double) Main.mouseX + (double) Main.screenPosition.X - (double) this.position.X)), this.MountedCenter.Y - 600f); vector2_1.X = (float) (((double) vector2_1.X + (double) this.Center.X) / 2.0) + (float) Main.rand.Next(-200, 201); vector2_1.Y -= (float) (100 * index); float num52 = (float) Main.mouseX + Main.screenPosition.X - vector2_1.X; float num53 = (float) Main.mouseY + Main.screenPosition.Y - vector2_1.Y; if ((double) num53 < 0.0) num53 *= -1f; if ((double) num53 < 20.0) num53 = 20f; float num54 = (float) Math.Sqrt((double) num52 * (double) num52 + (double) num53 * (double) num53); float num55 = speed / num54; float num56 = num52 * num55; float num57 = num53 * num55; float SpeedX = num56 + (float) Main.rand.Next(-40, 41) * 0.02f; float SpeedY = num57 + (float) Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i, ai1: ((float) Main.rand.Next(5))); } } else if (sItem.type == 2750) { int num58 = 1; for (int index = 0; index < num58; ++index) { vector2_1 = new Vector2((float) ((double) this.position.X + (double) this.width * 0.5 + (double) (Main.rand.Next(201) * -this.direction) + ((double) Main.mouseX + (double) Main.screenPosition.X - (double) this.position.X)), this.MountedCenter.Y - 600f); vector2_1.X = (float) (((double) vector2_1.X + (double) this.Center.X) / 2.0) + (float) Main.rand.Next(-200, 201); vector2_1.Y -= (float) (100 * index); float num59 = (float) ((double) Main.mouseX + (double) Main.screenPosition.X - (double) vector2_1.X + (double) Main.rand.Next(-40, 41) * 0.0299999993294477); float num60 = (float) Main.mouseY + Main.screenPosition.Y - vector2_1.Y; if ((double) num60 < 0.0) num60 *= -1f; if ((double) num60 < 20.0) num60 = 20f; float num61 = (float) Math.Sqrt((double) num59 * (double) num59 + (double) num60 * (double) num60); float num62 = speed / num61; float num63 = num59 * num62; float num64 = num60 * num62; float num65 = num63; float num66 = num64 + (float) Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num65 * 0.75f, num66 * 0.75f, shoot + Main.rand.Next(3), Damage, num18, i, ai1: ((float) (0.5 + Main.rand.NextDouble() * 0.300000011920929))); } } else if (sItem.type == 3570) { int num67 = 3; for (int index = 0; index < num67; ++index) { vector2_1 = new Vector2((float) ((double) this.position.X + (double) this.width * 0.5 + (double) (Main.rand.Next(201) * -this.direction) + ((double) Main.mouseX + (double) Main.screenPosition.X - (double) this.position.X)), this.MountedCenter.Y - 600f); vector2_1.X = (float) (((double) vector2_1.X + (double) this.Center.X) / 2.0) + (float) Main.rand.Next(-200, 201); vector2_1.Y -= (float) (100 * index); float num68 = (float) Main.mouseX + Main.screenPosition.X - vector2_1.X; float num69 = (float) Main.mouseY + Main.screenPosition.Y - vector2_1.Y; float ai1 = num69 + vector2_1.Y; if ((double) num69 < 0.0) num69 *= -1f; if ((double) num69 < 20.0) num69 = 20f; float num70 = (float) Math.Sqrt((double) num68 * (double) num68 + (double) num69 * (double) num69); float num71 = speed / num70; Vector2 vector2_17 = new Vector2(num68 * num71, num69 * num71) / 2f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, vector2_17.X, vector2_17.Y, shoot, Damage, num18, i, ai1: ai1); } } else if (sItem.type == 3065) { Vector2 vector2_18 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY); float ai1 = vector2_18.Y; if ((double) ai1 > (double) this.Center.Y - 200.0) ai1 = this.Center.Y - 200f; for (int index = 0; index < 3; ++index) { vector2_1 = this.Center + new Vector2((float) (-Main.rand.Next(0, 401) * this.direction), -600f); vector2_1.Y -= (float) (100 * index); Vector2 vector2_19 = vector2_18 - vector2_1; if ((double) vector2_19.Y < 0.0) vector2_19.Y *= -1f; if ((double) vector2_19.Y < 20.0) vector2_19.Y = 20f; vector2_19.Normalize(); Vector2 vector2_20 = vector2_19 * speed; float x = vector2_20.X; float y = vector2_20.Y; float SpeedX = x; float SpeedY = y + (float) Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage * 2, num18, i, ai1: ai1); } } else if (sItem.type == 2624) { float num72 = 0.3141593f; int num73 = 5; Vector2 spinningpoint = new Vector2(num23, num24); spinningpoint.Normalize(); spinningpoint *= 40f; bool flag9 = Collision.CanHit(vector2_1, 0, 0, vector2_1 + spinningpoint, 0, 0); for (int index20 = 0; index20 < num73; ++index20) { float num74 = (float) index20 - (float) (((double) num73 - 1.0) / 2.0); Vector2 vector2_21 = spinningpoint.RotatedBy((double) num72 * (double) num74); if (!flag9) vector2_21 -= spinningpoint; int index21 = Projectile.NewProjectile(vector2_1.X + vector2_21.X, vector2_1.Y + vector2_21.Y, num23, num24, shoot, Damage, num18, i); Main.projectile[index21].noDropItem = true; } } else if (sItem.type == 1929) { float SpeedX = num23 + (float) Main.rand.Next(-40, 41) * 0.03f; float SpeedY = num24 + (float) Main.rand.Next(-40, 41) * 0.03f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } else if (sItem.type == 1553) { float SpeedX = num23 + (float) Main.rand.Next(-40, 41) * 0.005f; float SpeedY = num24 + (float) Main.rand.Next(-40, 41) * 0.005f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } else if (sItem.type == 518) { float num75 = num23; float num76 = num24; float SpeedX = num75 + (float) Main.rand.Next(-40, 41) * 0.04f; float SpeedY = num76 + (float) Main.rand.Next(-40, 41) * 0.04f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } else if (sItem.type == 1265) { float num77 = num23; float num78 = num24; float SpeedX = num77 + (float) Main.rand.Next(-30, 31) * 0.03f; float SpeedY = num78 + (float) Main.rand.Next(-30, 31) * 0.03f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } else if (sItem.type == 534) { int num79 = Main.rand.Next(4, 6); for (int index = 0; index < num79; ++index) { float num80 = num23; float num81 = num24; float SpeedX = num80 + (float) Main.rand.Next(-40, 41) * 0.05f; float SpeedY = num81 + (float) Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } } else if (sItem.type == 2188) { int num82 = 4; if (Main.rand.Next(3) == 0) ++num82; if (Main.rand.Next(4) == 0) ++num82; if (Main.rand.Next(5) == 0) ++num82; for (int index = 0; index < num82; ++index) { float num83 = num23; float num84 = num24; float num85 = 0.05f * (float) index; float num86 = num83 + (float) Main.rand.Next(-35, 36) * num85; float num87 = num84 + (float) Main.rand.Next(-35, 36) * num85; float num88 = (float) Math.Sqrt((double) num86 * (double) num86 + (double) num87 * (double) num87); float num89 = speed / num88; float SpeedX = num86 * num89; float SpeedY = num87 * num89; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } } else if (sItem.type == 1308) { int num90 = 3; if (Main.rand.Next(3) == 0) ++num90; for (int index = 0; index < num90; ++index) { float num91 = num23; float num92 = num24; float num93 = 0.05f * (float) index; float num94 = num91 + (float) Main.rand.Next(-35, 36) * num93; float num95 = num92 + (float) Main.rand.Next(-35, 36) * num93; float num96 = (float) Math.Sqrt((double) num94 * (double) num94 + (double) num95 * (double) num95); float num97 = speed / num96; float SpeedX = num94 * num97; float SpeedY = num95 * num97; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } } else if (sItem.type == 1258) { float num98 = num23; float num99 = num24; float SpeedX = num98 + (float) Main.rand.Next(-40, 41) * 0.01f; float SpeedY = num99 + (float) Main.rand.Next(-40, 41) * 0.01f; vector2_1.X += (float) Main.rand.Next(-40, 41) * 0.05f; vector2_1.Y += (float) Main.rand.Next(-45, 36) * 0.05f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } else if (sItem.type == 964) { int num100 = Main.rand.Next(3, 5); for (int index = 0; index < num100; ++index) { float num101 = num23; float num102 = num24; float SpeedX = num101 + (float) Main.rand.Next(-35, 36) * 0.04f; float SpeedY = num102 + (float) Main.rand.Next(-35, 36) * 0.04f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } } else if (sItem.type == 1569) { int num103 = 4; if (Main.rand.Next(2) == 0) ++num103; if (Main.rand.Next(4) == 0) ++num103; if (Main.rand.Next(8) == 0) ++num103; if (Main.rand.Next(16) == 0) ++num103; for (int index = 0; index < num103; ++index) { float num104 = num23; float num105 = num24; float num106 = 0.05f * (float) index; float num107 = num104 + (float) Main.rand.Next(-35, 36) * num106; float num108 = num105 + (float) Main.rand.Next(-35, 36) * num106; float num109 = (float) Math.Sqrt((double) num107 * (double) num107 + (double) num108 * (double) num108); float num110 = speed / num109; float SpeedX = num107 * num110; float SpeedY = num108 * num110; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } } else if (sItem.type == 1572 || sItem.type == 2366 || sItem.type == 3571 || sItem.type == 3569) { int num111 = sItem.type == 3571 ? 1 : (sItem.type == 3569 ? 1 : 0); int i2 = (int) ((double) Main.mouseX + (double) Main.screenPosition.X) / 16; int j = (int) ((double) Main.mouseY + (double) Main.screenPosition.Y) / 16; if ((double) this.gravDir == -1.0) j = (int) ((double) Main.screenPosition.Y + (double) Main.screenHeight - (double) Main.mouseY) / 16; if (num111 == 0) { while (j < Main.maxTilesY - 10 && Main.tile[i2, j] != null && !WorldGen.SolidTile2(i2, j) && Main.tile[i2 - 1, j] != null && !WorldGen.SolidTile2(i2 - 1, j) && Main.tile[i2 + 1, j] != null && !WorldGen.SolidTile2(i2 + 1, j)) ++j; --j; } Projectile.NewProjectile((float) Main.mouseX + Main.screenPosition.X, (float) (j * 16 - 24), 0.0f, 15f, shoot, Damage, num18, i); this.UpdateMaxTurrets(); } else if (sItem.type == 1244 || sItem.type == 1256) { int index = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num23, num24, shoot, Damage, num18, i); Main.projectile[index].ai[0] = (float) Main.mouseX + Main.screenPosition.X; Main.projectile[index].ai[1] = (float) Main.mouseY + Main.screenPosition.Y; } else if (sItem.type == 1229) { int num112 = Main.rand.Next(2, 4); if (Main.rand.Next(5) == 0) ++num112; for (int index22 = 0; index22 < num112; ++index22) { float SpeedX = num23; float SpeedY = num24; if (index22 > 0) { SpeedX += (float) Main.rand.Next(-35, 36) * 0.04f; SpeedY += (float) Main.rand.Next(-35, 36) * 0.04f; } if (index22 > 1) { SpeedX += (float) Main.rand.Next(-35, 36) * 0.04f; SpeedY += (float) Main.rand.Next(-35, 36) * 0.04f; } if (index22 > 2) { SpeedX += (float) Main.rand.Next(-35, 36) * 0.04f; SpeedY += (float) Main.rand.Next(-35, 36) * 0.04f; } int index23 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); Main.projectile[index23].noDropItem = true; } } else if (sItem.type == 1121) { int num113 = Main.rand.Next(1, 4); if (Main.rand.Next(6) == 0) ++num113; if (Main.rand.Next(6) == 0) ++num113; if (this.strongBees && Main.rand.Next(3) == 0) ++num113; for (int index24 = 0; index24 < num113; ++index24) { float num114 = num23; float num115 = num24; float SpeedX = num114 + (float) Main.rand.Next(-35, 36) * 0.02f; float SpeedY = num115 + (float) Main.rand.Next(-35, 36) * 0.02f; int index25 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, this.beeType(), this.beeDamage(Damage), this.beeKB(num18), i); Main.projectile[index25].magic = true; } } else if (sItem.type == 1155) { int num116 = Main.rand.Next(2, 5); if (Main.rand.Next(5) == 0) ++num116; if (Main.rand.Next(5) == 0) ++num116; for (int index = 0; index < num116; ++index) { float num117 = num23; float num118 = num24; float SpeedX = num117 + (float) Main.rand.Next(-35, 36) * 0.02f; float SpeedY = num118 + (float) Main.rand.Next(-35, 36) * 0.02f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } } else if (sItem.type == 1801) { int num119 = Main.rand.Next(1, 4); for (int index = 0; index < num119; ++index) { float num120 = num23; float num121 = num24; float SpeedX = num120 + (float) Main.rand.Next(-35, 36) * 0.05f; float SpeedY = num121 + (float) Main.rand.Next(-35, 36) * 0.05f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } } else if (sItem.type == 679) { for (int index = 0; index < 6; ++index) { float num122 = num23; float num123 = num24; float SpeedX = num122 + (float) Main.rand.Next(-40, 41) * 0.05f; float SpeedY = num123 + (float) Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } } else if (sItem.type == 2623) { for (int index = 0; index < 3; ++index) { float num124 = num23; float num125 = num24; float SpeedX = num124 + (float) Main.rand.Next(-40, 41) * 0.1f; float SpeedY = num125 + (float) Main.rand.Next(-40, 41) * 0.1f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } } else if (sItem.type == 3210) { Vector2 vector2_22 = new Vector2(num23, num24); vector2_22.X += (float) Main.rand.Next(-30, 31) * 0.04f; vector2_22.Y += (float) Main.rand.Next(-30, 31) * 0.03f; vector2_22.Normalize(); Vector2 vector2_23 = vector2_22 * ((float) Main.rand.Next(70, 91) * 0.1f); vector2_23.X += (float) Main.rand.Next(-30, 31) * 0.04f; vector2_23.Y += (float) Main.rand.Next(-30, 31) * 0.03f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, vector2_23.X, vector2_23.Y, shoot, Damage, num18, i, (float) Main.rand.Next(20)); } else if (sItem.type == 434) { float SpeedX = num23; float SpeedY = num24; if (this.itemAnimation < 5) { float num126 = SpeedX + (float) Main.rand.Next(-40, 41) * 0.01f; float num127 = SpeedY + (float) Main.rand.Next(-40, 41) * 0.01f; SpeedX = num126 * 1.1f; SpeedY = num127 * 1.1f; } else if (this.itemAnimation < 10) { float num128 = SpeedX + (float) Main.rand.Next(-20, 21) * 0.01f; float num129 = SpeedY + (float) Main.rand.Next(-20, 21) * 0.01f; SpeedX = num128 * 1.05f; SpeedY = num129 * 1.05f; } Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } else if (sItem.type == 1157) { shoot = Main.rand.Next(191, 195); float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float) Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float) Main.mouseY + Main.screenPosition.Y; int index = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); Main.projectile[index].localAI[0] = 30f; } else if (sItem.type == 1802) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float) Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float) Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } else if (sItem.type == 2364 || sItem.type == 2365) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float) Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float) Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } else if (sItem.type == 2535) { float x = 0.0f; float y = 0.0f; vector2_1.X = (float) Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float) Main.mouseY + Main.screenPosition.Y; Vector2 spinningpoint = new Vector2(x, y).RotatedBy(1.57079637050629); Projectile.NewProjectile(vector2_1.X + spinningpoint.X, vector2_1.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, shoot, Damage, num18, i); Vector2 vector2_24 = spinningpoint.RotatedBy(-3.14159274101257); Projectile.NewProjectile(vector2_1.X + vector2_24.X, vector2_1.Y + vector2_24.Y, vector2_24.X, vector2_24.Y, shoot + 1, Damage, num18, i); } else if (sItem.type == 2551) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float) Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float) Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot + Main.rand.Next(3), Damage, num18, i); } else if (sItem.type == 2584) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float) Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float) Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot + Main.rand.Next(3), Damage, num18, i); } else if (sItem.type == 2621) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float) Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float) Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } else if (sItem.type == 2749 || sItem.type == 3249 || sItem.type == 3474) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float) Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float) Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } else if (sItem.type == 3531) { int num130 = -1; int index26 = -1; for (int index27 = 0; index27 < 1000; ++index27) { if (Main.projectile[index27].active && Main.projectile[index27].owner == Main.myPlayer) { if (num130 == -1 && Main.projectile[index27].type == 625) num130 = index27; if (index26 == -1 && Main.projectile[index27].type == 628) index26 = index27; if (num130 != -1 && index26 != -1) break; } } if (num130 == -1 && index26 == -1) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float) Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float) Main.mouseY + Main.screenPosition.Y; int num131 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); int num132 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot + 1, Damage, num18, i, (float) num131); int index28 = num132; int num133 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot + 2, Damage, num18, i, (float) num132); Main.projectile[index28].localAI[1] = (float) num133; int index29 = num133; int num134 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot + 3, Damage, num18, i, (float) num133); Main.projectile[index29].localAI[1] = (float) num134; } else if (num130 != -1 && index26 != -1) { int num135 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num23, num24, shoot + 1, Damage, num18, i, (float) Projectile.GetByUUID(Main.myPlayer, Main.projectile[index26].ai[0])); int index30 = num135; int index31 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num23, num24, shoot + 2, Damage, num18, i, (float) num135); Main.projectile[index30].localAI[1] = (float) index31; Main.projectile[index30].netUpdate = true; Main.projectile[index30].ai[1] = 1f; Main.projectile[index31].localAI[1] = (float) index26; Main.projectile[index31].netUpdate = true; Main.projectile[index31].ai[1] = 1f; Main.projectile[index26].ai[0] = (float) Main.projectile[index31].projUUID; Main.projectile[index26].netUpdate = true; Main.projectile[index26].ai[1] = 1f; } } else if (sItem.type == 1309) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float) Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float) Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, num18, i); } else if (sItem.shoot > 0 && (Main.projPet[sItem.shoot] || sItem.shoot == 72 || sItem.shoot == 18 || sItem.shoot == 500 || sItem.shoot == 650) && !sItem.summon) { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == this.whoAmI) { if (sItem.shoot == 72) { if (Main.projectile[index].type == 72 || Main.projectile[index].type == 86 || Main.projectile[index].type == 87) Main.projectile[index].Kill(); } else if (sItem.shoot == Main.projectile[index].type) Main.projectile[index].Kill(); } } Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num23, num24, shoot, Damage, num18, i); } else if (sItem.type == 3006) { Vector2 vector2_25; vector2_25.X = (float) Main.mouseX + Main.screenPosition.X; vector2_25.Y = (float) Main.mouseY + Main.screenPosition.Y; while (Collision.CanHitLine(this.position, this.width, this.height, vector2_1, 1, 1)) { vector2_1.X += num23; vector2_1.Y += num24; if ((double) (vector2_1 - vector2_25).Length() < 20.0 + (double) Math.Abs(num23) + (double) Math.Abs(num24)) { vector2_1 = vector2_25; break; } } Projectile.NewProjectile(vector2_1.X, vector2_1.Y, 0.0f, 0.0f, shoot, Damage, num18, i); } else if (sItem.type == 3014) { Vector2 vector2_26; vector2_26.X = (float) Main.mouseX + Main.screenPosition.X; vector2_26.Y = (float) Main.mouseY + Main.screenPosition.Y; while (Collision.CanHitLine(this.position, this.width, this.height, vector2_1, 1, 1)) { vector2_1.X += num23; vector2_1.Y += num24; if ((double) (vector2_1 - vector2_26).Length() < 20.0 + (double) Math.Abs(num23) + (double) Math.Abs(num24)) { vector2_1 = vector2_26; break; } } bool flag10 = false; int j1 = (int) vector2_1.Y / 16; int i3 = (int) vector2_1.X / 16; int num136 = j1; while (j1 < Main.maxTilesY - 10 && j1 - num136 < 30 && !WorldGen.SolidTile(i3, j1) && !TileID.Sets.Platforms[(int) Main.tile[i3, j1].type]) ++j1; if (!WorldGen.SolidTile(i3, j1) && !TileID.Sets.Platforms[(int) Main.tile[i3, j1].type]) flag10 = true; float num137 = (float) (j1 * 16); int j2 = num136; while (j2 > 10 && num136 - j2 < 30 && !WorldGen.SolidTile(i3, j2)) --j2; float num138 = (float) (j2 * 16 + 16); float ai1 = num137 - num138; int num139 = 10; if ((double) ai1 > (double) (16 * num139)) ai1 = (float) (16 * num139); float ai0 = num137 - ai1; vector2_1.X = (float) ((int) ((double) vector2_1.X / 16.0) * 16); if (!flag10) Projectile.NewProjectile(vector2_1.X, vector2_1.Y, 0.0f, 0.0f, shoot, Damage, num18, i, ai0, ai1); } else if (sItem.type == 3384) { int num140 = this.altFunctionUse == 2 ? 1 : 0; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num23, num24, shoot, Damage, num18, i, ai1: ((float) num140)); } else if (sItem.type == 3473) { float ai1 = (float) (((double) Main.rand.NextFloat() - 0.5) * 0.785398185253143); Vector2 vector2_27 = new Vector2(num23, num24); Projectile.NewProjectile(vector2_1.X, vector2_1.Y, vector2_27.X, vector2_27.Y, shoot, Damage, num18, i, ai1: ai1); } else if (sItem.type == 3836) { float ai0 = (float) ((double) Main.rand.NextFloat() * (double) speed * 0.75) * (float) this.direction; Vector2 velocity = new Vector2(num23, num24); Projectile.NewProjectile(vector2_1, velocity, shoot, Damage, num18, i, ai0); } else if (sItem.type == 3858) { int num141 = this.altFunctionUse == 2 ? 1 : 0; Vector2 velocity1 = new Vector2(num23, num24); if (num141 != 0) { Vector2 velocity2 = velocity1 * 1.5f; float ai0 = (float) ((0.300000011920929 + 0.699999988079071 * (double) Main.rand.NextFloat()) * (double) speed * 1.75) * (float) this.direction; Projectile.NewProjectile(vector2_1, velocity2, 708, (int) ((double) Damage * 0.75), num18 + 4f, i, ai0); } else Projectile.NewProjectile(vector2_1, velocity1, shoot, Damage, num18, i); } else if (sItem.type == 3859) { Vector2 vector2_28 = new Vector2(num23, num24); shoot = 710; Damage = (int) ((double) Damage * 0.699999988079071); Vector2 v2 = vector2_28 * 0.8f; Vector2 vector2_29 = v2.SafeNormalize(-Vector2.UnitY); float num142 = (float) Math.PI / 180f * (float) -this.direction; for (float num143 = -2.5f; (double) num143 < 3.0; ++num143) Projectile.NewProjectile(vector2_1, (v2 + vector2_29 * num143 * 0.5f).RotatedBy((double) num143 * (double) num142), shoot, Damage, num18, i); } else if (sItem.type == 3870) { Vector2 vector2_30 = Vector2.Normalize(new Vector2(num23, num24)) * 40f * sItem.scale; if (Collision.CanHit(vector2_1, 0, 0, vector2_1 + vector2_30, 0, 0)) vector2_1 += vector2_30; Vector2 v3 = new Vector2(num23, num24) * 0.8f; Vector2 vector2_31 = v3.SafeNormalize(-Vector2.UnitY); float num144 = (float) Math.PI / 180f * (float) -this.direction; for (int index = 0; index <= 2; ++index) Projectile.NewProjectile(vector2_1, (v3 + vector2_31 * (float) index * 1f).RotatedBy((double) index * (double) num144), shoot, Damage, num18, i); } else if (sItem.type == 3542) { float num145 = (float) (((double) Main.rand.NextFloat() - 0.5) * 0.785398185253143 * 0.699999988079071); for (int index = 0; index < 10 && !Collision.CanHit(vector2_1, 0, 0, vector2_1 + new Vector2(num23, num24).RotatedBy((double) num145) * 100f, 0, 0); ++index) num145 = (float) (((double) Main.rand.NextFloat() - 0.5) * 0.785398185253143 * 0.699999988079071); Vector2 vector2_32 = new Vector2(num23, num24).RotatedBy((double) num145) * (float) (0.949999988079071 + (double) Main.rand.NextFloat() * 0.300000011920929); Projectile.NewProjectile(vector2_1.X, vector2_1.Y, vector2_32.X, vector2_32.Y, shoot, Damage, num18, i); } else if (sItem.type == 3779) { float num146 = Main.rand.NextFloat() * 6.283185f; for (int index = 0; index < 10 && !Collision.CanHit(vector2_1, 0, 0, vector2_1 + new Vector2(num23, num24).RotatedBy((double) num146) * 100f, 0, 0); ++index) num146 = Main.rand.NextFloat() * 6.283185f; Vector2 vector2_33 = new Vector2(num23, num24).RotatedBy((double) num146) * (float) (0.949999988079071 + (double) Main.rand.NextFloat() * 0.300000011920929); Projectile.NewProjectile(vector2_1 + vector2_33 * 30f, Vector2.Zero, shoot, Damage, num18, i, -2f); } else if (sItem.type == 3787) { float f3 = Main.rand.NextFloat() * 6.283185f; float num147 = 20f; float num148 = 60f; Vector2 position = vector2_1 + f3.ToRotationVector2() * MathHelper.Lerp(num147, num148, Main.rand.NextFloat()); for (int index = 0; index < 50; ++index) { position = vector2_1 + f3.ToRotationVector2() * MathHelper.Lerp(num147, num148, Main.rand.NextFloat()); if (!Collision.CanHit(vector2_1, 0, 0, position + (position - vector2_1).SafeNormalize(Vector2.UnitX) * 8f, 0, 0)) f3 = Main.rand.NextFloat() * 6.283185f; else break; } Vector2 v4 = Main.MouseWorld - position; Vector2 defaultValue = new Vector2(num23, num24).SafeNormalize(Vector2.UnitY) * speed; Vector2 velocity = Vector2.Lerp(v4.SafeNormalize(defaultValue) * speed, defaultValue, 0.25f); Projectile.NewProjectile(position, velocity, shoot, Damage, num18, i); } else if (sItem.type == 3788) { Vector2 v5 = new Vector2(num23, num24); float num149 = 0.7853982f; for (int index = 0; index < 2; ++index) { Projectile.NewProjectile(vector2_1, v5 + v5.SafeNormalize(Vector2.Zero).RotatedBy((double) num149 * ((double) Main.rand.NextFloat() * 0.5 + 0.5)) * Main.rand.NextFloatDirection() * 2f, shoot, Damage, num18, i); Projectile.NewProjectile(vector2_1, v5 + v5.SafeNormalize(Vector2.Zero).RotatedBy(-(double) num149 * ((double) Main.rand.NextFloat() * 0.5 + 0.5)) * Main.rand.NextFloatDirection() * 2f, shoot, Damage, num18, i); } Projectile.NewProjectile(vector2_1, v5.SafeNormalize(Vector2.UnitX * (float) this.direction) * (speed * 1.3f), 661, Damage * 2, num18, i); } else if (sItem.type == 3475) Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num23, num24, 615, Damage, num18, i, (float) (5 * Main.rand.Next(0, 20))); else if (sItem.type == 3540) Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num23, num24, 630, Damage, num18, i); else if (sItem.type == 3854) Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num23, num24, 705, Damage, num18, i); else if (sItem.type == 3546) { for (int index = 0; index < 2; ++index) { float num150 = num23; float num151 = num24; float num152 = num150 + (float) Main.rand.Next(-40, 41) * 0.05f; float num153 = num151 + (float) Main.rand.Next(-40, 41) * 0.05f; Vector2 vector2_34 = vector2_1 + Vector2.Normalize(new Vector2(num152, num153).RotatedBy(-1.57079637050629 * (double) this.direction)) * 6f; Projectile.NewProjectile(vector2_34.X, vector2_34.Y, num152, num153, 167 + Main.rand.Next(4), Damage, num18, i, ai1: 1f); } } else if (sItem.type == 3350) { float num154 = num23; float num155 = num24; float num156 = num154 + (float) Main.rand.Next(-1, 2) * 0.5f; float num157 = num155 + (float) Main.rand.Next(-1, 2) * 0.5f; if (Collision.CanHitLine(this.Center, 0, 0, vector2_1 + new Vector2(num156, num157) * 2f, 0, 0)) vector2_1 += new Vector2(num156, num157); Projectile.NewProjectile(vector2_1.X, vector2_1.Y - this.gravDir * 4f, num156, num157, shoot, Damage, num18, i, ai1: ((float) Main.rand.Next(12) / 6f)); } else if (sItem.type == 3852) { if (this.altFunctionUse == 2) Projectile.NewProjectile(vector2_1.X, this.Bottom.Y - 100f, (float) this.direction * speed, 0.0f, 704, Damage * 2, num18, i); else Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num23, num24, shoot, Damage, num18, i); } 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) { this.PayDD2CrystalsBeforeUse(sItem); int worldX; int worldY; int pushYUp; this.FindSentryRestingSpot(sItem.shoot, out worldX, out worldY, out pushYUp); Projectile.NewProjectile((float) worldX, (float) (worldY - pushYUp), 0.0f, 0.0f, shoot, Damage, num18, i); this.UpdateMaxTurrets(); } else { int index = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num23, num24, shoot, Damage, num18, i); if (sItem.type == 726) Main.projectile[index].magic = true; if (sItem.type == 724 || sItem.type == 676) Main.projectile[index].melee = true; if (shoot == 80) { Main.projectile[index].ai[0] = (float) Player.tileTargetX; Main.projectile[index].ai[1] = (float) Player.tileTargetY; } if (shoot == 442) { Main.projectile[index].ai[0] = (float) Player.tileTargetX; Main.projectile[index].ai[1] = (float) Player.tileTargetY; } if ((this.thrownCost50 || this.thrownCost33) && this.inventory[this.selectedItem].thrown) Main.projectile[index].noDropItem = true; if (Main.projectile[index].aiStyle == 99) AchievementsHelper.HandleSpecialEvent(this, 7); } } else if (sItem.useStyle == 5) { this.itemRotation = 0.0f; NetMessage.SendData(41, number: this.whoAmI); } } if (this.whoAmI == Main.myPlayer && (sItem.type == 509 || sItem.type == 510 || sItem.type == 849 || sItem.type == 850 || sItem.type == 851 || sItem.type == 3612 || sItem.type == 3620 || sItem.type == 3625) && (double) this.position.X / 16.0 - (double) Player.tileRangeX - (double) sItem.tileBoost - (double) this.blockRange <= (double) Player.tileTargetX && ((double) this.position.X + (double) this.width) / 16.0 + (double) Player.tileRangeX + (double) sItem.tileBoost - 1.0 + (double) this.blockRange >= (double) Player.tileTargetX && (double) this.position.Y / 16.0 - (double) Player.tileRangeY - (double) sItem.tileBoost - (double) this.blockRange <= (double) Player.tileTargetY && ((double) this.position.Y + (double) this.height) / 16.0 + (double) Player.tileRangeY + (double) sItem.tileBoost - 2.0 + (double) this.blockRange >= (double) Player.tileTargetY) { if (!Main.GamepadDisableCursorItemIcon) { this.showItemIcon = true; Main.ItemIconCacheUpdate(sItem.type); } if (this.itemAnimation > 0 && this.itemTime == 0 && this.controlUseItem) { int tileTargetX = Player.tileTargetX; int tileTargetY = Player.tileTargetY; if (sItem.type == 509) { int index32 = -1; for (int index33 = 0; index33 < 58; ++index33) { if (this.inventory[index33].stack > 0 && this.inventory[index33].type == 530) { index32 = index33; break; } } if (index32 >= 0 && WorldGen.PlaceWire(tileTargetX, tileTargetY)) { --this.inventory[index32].stack; if (this.inventory[index32].stack <= 0) this.inventory[index32].SetDefaults(); this.itemTime = sItem.useTime; NetMessage.SendData(17, number: 5, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); } } else if (sItem.type == 850) { int index34 = -1; for (int index35 = 0; index35 < 58; ++index35) { if (this.inventory[index35].stack > 0 && this.inventory[index35].type == 530) { index34 = index35; break; } } if (index34 >= 0 && WorldGen.PlaceWire2(tileTargetX, tileTargetY)) { --this.inventory[index34].stack; if (this.inventory[index34].stack <= 0) this.inventory[index34].SetDefaults(); this.itemTime = sItem.useTime; NetMessage.SendData(17, number: 10, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); } } if (sItem.type == 851) { int index36 = -1; for (int index37 = 0; index37 < 58; ++index37) { if (this.inventory[index37].stack > 0 && this.inventory[index37].type == 530) { index36 = index37; break; } } if (index36 >= 0 && WorldGen.PlaceWire3(tileTargetX, tileTargetY)) { --this.inventory[index36].stack; if (this.inventory[index36].stack <= 0) this.inventory[index36].SetDefaults(); this.itemTime = sItem.useTime; NetMessage.SendData(17, number: 12, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); } } if (sItem.type == 3612) { int index38 = -1; for (int index39 = 0; index39 < 58; ++index39) { if (this.inventory[index39].stack > 0 && this.inventory[index39].type == 530) { index38 = index39; break; } } if (index38 >= 0 && WorldGen.PlaceWire4(tileTargetX, tileTargetY)) { --this.inventory[index38].stack; if (this.inventory[index38].stack <= 0) this.inventory[index38].SetDefaults(); this.itemTime = sItem.useTime; NetMessage.SendData(17, number: 16, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); } } else if (sItem.type == 510) { if (WorldGen.KillActuator(tileTargetX, tileTargetY)) { this.itemTime = sItem.useTime; NetMessage.SendData(17, number: 9, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); } else if (WorldGen.KillWire4(tileTargetX, tileTargetY)) { this.itemTime = sItem.useTime; NetMessage.SendData(17, number: 17, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); } else if (WorldGen.KillWire3(tileTargetX, tileTargetY)) { this.itemTime = sItem.useTime; NetMessage.SendData(17, number: 13, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); } else if (WorldGen.KillWire2(tileTargetX, tileTargetY)) { this.itemTime = sItem.useTime; NetMessage.SendData(17, number: 11, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); } else if (WorldGen.KillWire(tileTargetX, tileTargetY)) { this.itemTime = sItem.useTime; NetMessage.SendData(17, number: 6, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); } } else if (sItem.type == 849 && sItem.stack > 0 && WorldGen.PlaceActuator(tileTargetX, tileTargetY)) { this.itemTime = sItem.useTime; NetMessage.SendData(17, number: 8, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); --sItem.stack; if (sItem.stack <= 0) sItem.SetDefaults(); } if (sItem.type == 3620) { Tile tile = Main.tile[tileTargetX, tileTargetY]; if (tile != null && tile.actuator()) { bool flag11 = tile.inActive(); if ((!this.ActuationRodLock || this.ActuationRodLockSetting == tile.inActive()) && Wiring.Actuate(tileTargetX, tileTargetY) && flag11 != tile.inActive()) { this.ActuationRodLock = true; this.ActuationRodLockSetting = !tile.inActive(); this.itemTime = sItem.useTime; NetMessage.SendData(17, number: 19, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); } } } if (sItem.type == 3625) { Point point = new Point(Player.tileTargetX, Player.tileTargetY); this.itemTime = sItem.useTime; int toolMode = (int) WiresUI.Settings.ToolMode; WiresUI.Settings.ToolMode &= ~WiresUI.Settings.MultiToolMode.Actuator; if (Main.netMode == 1) NetMessage.SendData(109, number: point.X, number2: ((float) point.Y), number3: ((float) point.X), number4: ((float) point.Y), number5: ((int) WiresUI.Settings.ToolMode)); else Wiring.MassWireOperation(point, point, this); WiresUI.Settings.ToolMode = (WiresUI.Settings.MultiToolMode) toolMode; } } } if (this.itemAnimation > 0 && this.itemTime == 0 && (sItem.type == 507 || sItem.type == 508)) { this.itemTime = sItem.useTime; Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f); double num158 = (double) Main.mouseX + (double) Main.screenPosition.X - (double) vector2.X; float num159 = (float) Main.mouseY + Main.screenPosition.Y - vector2.Y; float num160 = (float) Math.Sqrt(num158 * num158 + (double) num159 * (double) num159) / (float) (Main.screenHeight / 2); if ((double) num160 > 1.0) num160 = 1f; float number2 = (float) ((double) num160 * 2.0 - 1.0); if ((double) number2 < -1.0) number2 = -1f; if ((double) number2 > 1.0) number2 = 1f; Main.harpNote = number2; LegacySoundStyle type2 = SoundID.Item26; if (sItem.type == 507) type2 = SoundID.Item35; Main.PlaySound(type2, this.position); NetMessage.SendData(58, number: this.whoAmI, number2: number2); } if ((sItem.type >= 205 && sItem.type <= 207 || sItem.type == 1128 || sItem.type == 3031 || sItem.type == 3032) && !this.noBuilding && (double) this.position.X / 16.0 - (double) Player.tileRangeX - (double) sItem.tileBoost <= (double) Player.tileTargetX && ((double) this.position.X + (double) this.width) / 16.0 + (double) Player.tileRangeX + (double) sItem.tileBoost - 1.0 >= (double) Player.tileTargetX && (double) this.position.Y / 16.0 - (double) Player.tileRangeY - (double) sItem.tileBoost <= (double) Player.tileTargetY && ((double) this.position.Y + (double) this.height) / 16.0 + (double) Player.tileRangeY + (double) sItem.tileBoost - 2.0 >= (double) Player.tileTargetY) { if (!Main.GamepadDisableCursorItemIcon) { this.showItemIcon = true; Main.ItemIconCacheUpdate(sItem.type); } if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem) { if (sItem.type == 205 || sItem.type == 3032 && Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == (byte) 0) { int num161 = (int) Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(); int num162 = 0; for (int index40 = Player.tileTargetX - 1; index40 <= Player.tileTargetX + 1; ++index40) { for (int index41 = Player.tileTargetY - 1; index41 <= Player.tileTargetY + 1; ++index41) { if ((int) Main.tile[index40, index41].liquidType() == num161) num162 += (int) Main.tile[index40, index41].liquid; } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid > (byte) 0 && (num162 > 100 || sItem.type == 3032)) { int liquidType = (int) Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(); if (sItem.type != 3032) { if (!Main.tile[Player.tileTargetX, Player.tileTargetY].lava()) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].honey()) { --sItem.stack; this.PutItemInInventory(1128, this.selectedItem); } else { --sItem.stack; this.PutItemInInventory(206, this.selectedItem); } } else { --sItem.stack; this.PutItemInInventory(207, this.selectedItem); } } Main.PlaySound(19, (int) this.position.X, (int) this.position.Y); this.itemTime = sItem.useTime; int liquid = (int) Main.tile[Player.tileTargetX, Player.tileTargetY].liquid; Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = (byte) 0; Main.tile[Player.tileTargetX, Player.tileTargetY].lava(false); Main.tile[Player.tileTargetX, Player.tileTargetY].honey(false); WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, false); if (Main.netMode == 1) NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); else Liquid.AddWater(Player.tileTargetX, Player.tileTargetY); for (int index42 = Player.tileTargetX - 1; index42 <= Player.tileTargetX + 1; ++index42) { for (int index43 = Player.tileTargetY - 1; index43 <= Player.tileTargetY + 1; ++index43) { if (liquid < 256 && (int) Main.tile[index42, index43].liquidType() == num161) { int num163 = (int) Main.tile[index42, index43].liquid; if (num163 + liquid > (int) byte.MaxValue) num163 = (int) byte.MaxValue - liquid; liquid += num163; Main.tile[index42, index43].liquid -= (byte) num163; Main.tile[index42, index43].liquidType(liquidType); if (Main.tile[index42, index43].liquid == (byte) 0) { Main.tile[index42, index43].lava(false); Main.tile[index42, index43].honey(false); } WorldGen.SquareTileFrame(index42, index43, false); if (Main.netMode == 1) NetMessage.sendWater(index42, index43); else Liquid.AddWater(index42, index43); } } } } } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid < (byte) 200 && (!Main.tile[Player.tileTargetX, Player.tileTargetY].nactive() || !Main.tileSolid[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type] || Main.tileSolidTop[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type])) { if (sItem.type == 207) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid == (byte) 0 || Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == (byte) 1) { Main.PlaySound(19, (int) this.position.X, (int) this.position.Y); Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(1); Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = byte.MaxValue; WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY); --sItem.stack; this.PutItemInInventory(205, this.selectedItem); this.itemTime = sItem.useTime; if (Main.netMode == 1) NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); } } else if (sItem.type == 206 || sItem.type == 3031) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid == (byte) 0 || Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == (byte) 0) { Main.PlaySound(19, (int) this.position.X, (int) this.position.Y); Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(0); Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = byte.MaxValue; WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY); if (sItem.type != 3031) { --sItem.stack; this.PutItemInInventory(205, this.selectedItem); } this.itemTime = sItem.useTime; if (Main.netMode == 1) NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); } } else if (sItem.type == 1128 && (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid == (byte) 0 || Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == (byte) 2)) { Main.PlaySound(19, (int) this.position.X, (int) this.position.Y); Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(2); Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = byte.MaxValue; WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY); --sItem.stack; this.PutItemInInventory(205, this.selectedItem); this.itemTime = sItem.useTime; if (Main.netMode == 1) NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); } } } } if (!this.channel) { this.toolTime = this.itemTime; } else { --this.toolTime; if (this.toolTime < 0) this.toolTime = sItem.pick <= 0 ? (int) ((double) sItem.useTime * (double) this.pickSpeed) : sItem.useTime; } if (sItem.pick > 0 || sItem.axe > 0 || sItem.hammer > 0) { bool flag12 = (double) this.position.X / 16.0 - (double) Player.tileRangeX - (double) sItem.tileBoost <= (double) Player.tileTargetX && ((double) this.position.X + (double) this.width) / 16.0 + (double) Player.tileRangeX + (double) sItem.tileBoost - 1.0 >= (double) Player.tileTargetX && (double) this.position.Y / 16.0 - (double) Player.tileRangeY - (double) sItem.tileBoost <= (double) Player.tileTargetY && ((double) this.position.Y + (double) this.height) / 16.0 + (double) Player.tileRangeY + (double) sItem.tileBoost - 2.0 >= (double) Player.tileTargetY; if (this.noBuilding) flag12 = false; if (flag12) { int damageAmount1 = 0; bool flag13 = true; if (!Main.GamepadDisableCursorItemIcon) { this.showItemIcon = true; Main.ItemIconCacheUpdate(sItem.type); } if (this.toolTime == 0 && this.itemAnimation > 0 && this.controlUseItem && (!Main.tile[Player.tileTargetX, Player.tileTargetY].active() || !Main.tileHammer[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type] && !Main.tileSolid[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type] && Main.tile[Player.tileTargetX, Player.tileTargetY].type != (ushort) 314 && Main.tile[Player.tileTargetX, Player.tileTargetY].type != (ushort) 424 && Main.tile[Player.tileTargetX, Player.tileTargetY].type != (ushort) 442 && Main.tile[Player.tileTargetX, Player.tileTargetY].type != (ushort) 351)) this.poundRelease = false; if (Main.tile[Player.tileTargetX, Player.tileTargetY].active()) { if (sItem.pick > 0 && !Main.tileAxe[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type] && !Main.tileHammer[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type] || sItem.axe > 0 && Main.tileAxe[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type] || sItem.hammer > 0 && Main.tileHammer[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type]) flag13 = false; if (this.toolTime == 0 && this.itemAnimation > 0 && this.controlUseItem) { int tileId = this.hitTile.HitObject(Player.tileTargetX, Player.tileTargetY, 1); if (Main.tileNoFail[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type]) damageAmount1 = 100; if (Main.tileHammer[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { flag13 = false; if (sItem.hammer > 0) { damageAmount1 += sItem.hammer; if (!WorldGen.CanKillTile(Player.tileTargetX, Player.tileTargetY)) damageAmount1 = 0; if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 26 && (sItem.hammer < 80 || !Main.hardMode)) { damageAmount1 = 0; this.Hurt(PlayerDeathReason.ByOther(4), this.statLife / 2, -this.direction); } AchievementsHelper.CurrentlyMining = true; if (this.hitTile.AddDamage(tileId, damageAmount1) >= 100) { this.hitTile.Clear(tileId); WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); } else { WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, true); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY), number4: 1f); } if (damageAmount1 != 0) this.hitTile.Prune(); this.itemTime = sItem.useTime; AchievementsHelper.CurrentlyMining = false; } } else if (Main.tileAxe[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 80) damageAmount1 += sItem.axe * 3; else damageAmount1 += sItem.axe; if (sItem.axe > 0) { AchievementsHelper.CurrentlyMining = true; if (!WorldGen.CanKillTile(Player.tileTargetX, Player.tileTargetY)) damageAmount1 = 0; if (this.hitTile.AddDamage(tileId, damageAmount1) >= 100) { this.hitTile.Clear(tileId); WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY)); } else { WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, true); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY), number4: 1f); } if (damageAmount1 != 0) this.hitTile.Prune(); this.itemTime = sItem.useTime; AchievementsHelper.CurrentlyMining = false; } } else if (sItem.pick > 0) { this.PickTile(Player.tileTargetX, Player.tileTargetY, sItem.pick); this.itemTime = (int) ((double) sItem.useTime * (double) this.pickSpeed); } if (sItem.pick > 0) this.itemTime = (int) ((double) sItem.useTime * (double) this.pickSpeed); if (sItem.hammer > 0 && Main.tile[Player.tileTargetX, Player.tileTargetY].active() && (Main.tileSolid[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type] && Main.tile[Player.tileTargetX, Player.tileTargetY].type != (ushort) 10 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 314 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 351 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 424 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == (ushort) 442) && this.poundRelease) { flag13 = false; this.itemTime = sItem.useTime; int num164 = damageAmount1 + (int) ((double) sItem.hammer * 1.25); int damageAmount2 = 100; if (Main.tile[Player.tileTargetX, Player.tileTargetY - 1].active() && Main.tile[Player.tileTargetX, Player.tileTargetY - 1].type == (ushort) 10) damageAmount2 = 0; if (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].active() && Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type == (ushort) 10) damageAmount2 = 0; if (this.hitTile.AddDamage(tileId, damageAmount2) >= 100) { this.hitTile.Clear(tileId); if (this.poundRelease) { int tileTargetX = Player.tileTargetX; int tileTargetY = Player.tileTargetY; if (TileID.Sets.Platforms[(int) Main.tile[tileTargetX, tileTargetY].type]) { if (Main.tile[tileTargetX, tileTargetY].halfBrick()) { WorldGen.PoundTile(tileTargetX, tileTargetY); if (Main.netMode == 1) NetMessage.SendData(17, number: 7, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY), number4: 1f); } else { int slope1 = 1; int slope2 = 2; if (TileID.Sets.Platforms[(int) Main.tile[tileTargetX + 1, tileTargetY - 1].type] || TileID.Sets.Platforms[(int) Main.tile[tileTargetX - 1, tileTargetY + 1].type] || WorldGen.SolidTile(tileTargetX + 1, tileTargetY) && !WorldGen.SolidTile(tileTargetX - 1, tileTargetY)) { slope1 = 2; slope2 = 1; } if (Main.tile[tileTargetX, tileTargetY].slope() == (byte) 0) { WorldGen.SlopeTile(tileTargetX, tileTargetY, slope1); int num165 = (int) Main.tile[tileTargetX, tileTargetY].slope(); if (Main.netMode == 1) NetMessage.SendData(17, number: 14, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY), number4: ((float) num165)); } else if ((int) Main.tile[tileTargetX, tileTargetY].slope() == slope1) { WorldGen.SlopeTile(tileTargetX, tileTargetY, slope2); int num166 = (int) Main.tile[tileTargetX, tileTargetY].slope(); if (Main.netMode == 1) NetMessage.SendData(17, number: 14, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY), number4: ((float) num166)); } else { WorldGen.SlopeTile(tileTargetX, tileTargetY); int num167 = (int) Main.tile[tileTargetX, tileTargetY].slope(); if (Main.netMode == 1) NetMessage.SendData(17, number: 14, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY), number4: ((float) num167)); WorldGen.PoundTile(tileTargetX, tileTargetY); if (Main.netMode == 1) NetMessage.SendData(17, number: 7, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY), number4: 1f); } } } else if (Main.tile[tileTargetX, tileTargetY].type == (ushort) 314) { if (Minecart.FrameTrack(tileTargetX, tileTargetY, true) && Main.netMode == 1) NetMessage.SendData(17, number: 15, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY), number4: 1f); } else if (Main.tile[tileTargetX, tileTargetY].type == (ushort) 137) { int num168 = 0; switch ((int) Main.tile[tileTargetX, tileTargetY].frameY / 18) { case 0: case 1: case 2: switch ((int) Main.tile[tileTargetX, tileTargetY].frameX / 18) { case 0: num168 = 2; break; case 1: num168 = 3; break; case 2: num168 = 4; break; case 3: num168 = 5; break; case 4: num168 = 1; break; case 5: num168 = 0; break; } break; case 3: case 4: switch ((int) Main.tile[tileTargetX, tileTargetY].frameX / 18) { case 0: case 1: num168 = 3; break; case 2: num168 = 4; break; case 3: num168 = 2; break; case 4: num168 = 0; break; } break; } Main.tile[tileTargetX, tileTargetY].frameX = (short) (num168 * 18); if (Main.netMode == 1) NetMessage.SendTileSquare(-1, Player.tileTargetX, Player.tileTargetY, 1); } else if (Main.tile[tileTargetX, tileTargetY].type == (ushort) 424) { Main.tile[tileTargetX, tileTargetY].frameX = Main.tile[tileTargetX, tileTargetY].frameX != (short) 0 ? (Main.tile[tileTargetX, tileTargetY].frameX != (short) 18 ? (short) 0 : (short) 36) : (short) 18; if (Main.netMode == 1) NetMessage.SendTileSquare(-1, Player.tileTargetX, Player.tileTargetY, 1); } else if (Main.tile[tileTargetX, tileTargetY].type == (ushort) 442) { Tile tile1 = Main.tile[tileTargetX, tileTargetY - 1]; Tile tile2 = Main.tile[tileTargetX, tileTargetY + 1]; Tile tile3 = Main.tile[tileTargetX - 1, tileTargetY]; Tile tile4 = Main.tile[tileTargetX + 1, tileTargetY]; Tile tile5 = Main.tile[tileTargetX - 1, tileTargetY + 1]; Tile tile6 = Main.tile[tileTargetX + 1, tileTargetY + 1]; Tile tile7 = Main.tile[tileTargetX - 1, tileTargetY - 1]; Tile tile8 = Main.tile[tileTargetX + 1, tileTargetY - 1]; int index44 = -1; int index45 = -1; int index46 = -1; int index47 = -1; int num169 = -1; int num170 = -1; int num171 = -1; int num172 = -1; if (tile1 != null && tile1.nactive() && !tile1.bottomSlope()) index45 = (int) tile1.type; if (tile2 != null && tile2.nactive() && !tile2.halfBrick() && !tile2.topSlope()) index44 = (int) tile2.type; if (tile3 != null && tile3.nactive() && (tile3.slope() == (byte) 0 || (int) tile3.slope() % 2 != 1)) index46 = (int) tile3.type; if (tile4 != null && tile4.nactive() && (tile4.slope() == (byte) 0 || (int) tile4.slope() % 2 != 0)) index47 = (int) tile4.type; if (tile5 != null && tile5.nactive()) num169 = (int) tile5.type; if (tile6 != null && tile6.nactive()) num170 = (int) tile6.type; if (tile7 != null && tile7.nactive()) num171 = (int) tile7.type; if (tile8 != null && tile8.nactive()) num172 = (int) tile8.type; bool flag14 = false; bool flag15 = false; bool flag16 = false; bool flag17 = false; if (index44 >= 0 && Main.tileSolid[index44] && (!Main.tileNoAttach[index44] || TileID.Sets.Platforms[index44]) && (tile2.bottomSlope() || tile2.slope() == (byte) 0) && !tile2.halfBrick()) flag17 = true; if (index45 >= 0 && Main.tileSolid[index45] && (!Main.tileNoAttach[index45] || TileID.Sets.Platforms[index45] && tile1.halfBrick()) && (tile1.topSlope() || tile1.slope() == (byte) 0 || tile1.halfBrick())) flag14 = true; if (index46 >= 0 && Main.tileSolid[index46] && !Main.tileNoAttach[index46] && (tile3.leftSlope() || tile3.slope() == (byte) 0) && !tile3.halfBrick() || index46 == 124 || index46 == 5 && num171 == 5 && num169 == 5) flag15 = true; if (index47 >= 0 && Main.tileSolid[index47] && !Main.tileNoAttach[index47] && (tile4.rightSlope() || tile4.slope() == (byte) 0) && !tile4.halfBrick() || index47 == 124 || index47 == 5 && num172 == 5 && num170 == 5) flag16 = true; int num173 = (int) Main.tile[tileTargetX, tileTargetY].frameX / 22; short num174 = -2; switch (num173) { case 0: num174 = !flag15 ? (!flag14 ? (!flag16 ? (short) -1 : (short) 3) : (short) 1) : (short) 2; break; case 1: num174 = !flag16 ? (!flag17 ? (!flag15 ? (short) -1 : (short) 2) : (short) 0) : (short) 3; break; case 2: num174 = !flag14 ? (!flag16 ? (!flag17 ? (short) -1 : (short) 0) : (short) 3) : (short) 1; break; case 3: num174 = !flag17 ? (!flag15 ? (!flag14 ? (short) -1 : (short) 1) : (short) 2) : (short) 0; break; } switch (num174) { case -2: num174 = (short) 0; break; case -1: goto label_1392; } Main.tile[tileTargetX, tileTargetY].frameX = (short) (22 * (int) num174); if (Main.netMode == 1) NetMessage.SendTileSquare(-1, Player.tileTargetX, Player.tileTargetY, 1); } else if ((Main.tile[tileTargetX, tileTargetY].halfBrick() || Main.tile[tileTargetX, tileTargetY].slope() != (byte) 0) && !Main.tileSolidTop[(int) Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { int num175 = 1; int slope3 = 1; int slope4 = 2; if ((WorldGen.SolidTile(tileTargetX + 1, tileTargetY) || Main.tile[tileTargetX + 1, tileTargetY].slope() == (byte) 1 || Main.tile[tileTargetX + 1, tileTargetY].slope() == (byte) 3) && !WorldGen.SolidTile(tileTargetX - 1, tileTargetY)) { slope3 = 2; slope4 = 1; } if (WorldGen.SolidTile(tileTargetX, tileTargetY - 1) && !WorldGen.SolidTile(tileTargetX, tileTargetY + 1)) num175 = -1; if (num175 == 1) { if (Main.tile[tileTargetX, tileTargetY].slope() == (byte) 0) WorldGen.SlopeTile(tileTargetX, tileTargetY, slope3); else if ((int) Main.tile[tileTargetX, tileTargetY].slope() == slope3) WorldGen.SlopeTile(tileTargetX, tileTargetY, slope4); else if ((int) Main.tile[tileTargetX, tileTargetY].slope() == slope4) WorldGen.SlopeTile(tileTargetX, tileTargetY, slope3 + 2); else if ((int) Main.tile[tileTargetX, tileTargetY].slope() == slope3 + 2) WorldGen.SlopeTile(tileTargetX, tileTargetY, slope4 + 2); else WorldGen.SlopeTile(tileTargetX, tileTargetY); } else if (Main.tile[tileTargetX, tileTargetY].slope() == (byte) 0) WorldGen.SlopeTile(tileTargetX, tileTargetY, slope3 + 2); else if ((int) Main.tile[tileTargetX, tileTargetY].slope() == slope3 + 2) WorldGen.SlopeTile(tileTargetX, tileTargetY, slope4 + 2); else if ((int) Main.tile[tileTargetX, tileTargetY].slope() == slope4 + 2) WorldGen.SlopeTile(tileTargetX, tileTargetY, slope3); else if ((int) Main.tile[tileTargetX, tileTargetY].slope() == slope3) WorldGen.SlopeTile(tileTargetX, tileTargetY, slope4); else WorldGen.SlopeTile(tileTargetX, tileTargetY); int num176 = (int) Main.tile[tileTargetX, tileTargetY].slope(); if (Main.netMode == 1) NetMessage.SendData(17, number: 14, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY), number4: ((float) num176)); } else { WorldGen.PoundTile(tileTargetX, tileTargetY); if (Main.netMode == 1) NetMessage.SendData(17, number: 7, number2: ((float) Player.tileTargetX), number3: ((float) Player.tileTargetY), number4: 1f); } label_1392: this.poundRelease = false; } } else { WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, true, true); Main.PlaySound(0, Player.tileTargetX * 16, Player.tileTargetY * 16); } } else this.poundRelease = false; } } if (this.releaseUseItem) this.poundRelease = true; int index48 = Player.tileTargetX; int index49 = Player.tileTargetY; bool flag18 = true; if (Main.tile[index48, index49].wall > (byte) 0) { if (!Main.wallHouse[(int) Main.tile[index48, index49].wall]) { for (int index50 = index48 - 1; index50 < index48 + 2; ++index50) { for (int index51 = index49 - 1; index51 < index49 + 2; ++index51) { if ((int) Main.tile[index50, index51].wall != (int) Main.tile[index48, index49].wall) { flag18 = false; break; } } } } else flag18 = false; } if (flag18 && !Main.tile[index48, index49].active()) { int num177 = -1; if (((double) Main.mouseX + (double) Main.screenPosition.X) / 16.0 < Math.Round(((double) Main.mouseX + (double) Main.screenPosition.X) / 16.0)) num177 = 0; int num178 = -1; if (((double) Main.mouseY + (double) Main.screenPosition.Y) / 16.0 < Math.Round(((double) Main.mouseY + (double) Main.screenPosition.Y) / 16.0)) num178 = 0; for (int index52 = Player.tileTargetX + num177; index52 <= Player.tileTargetX + num177 + 1; ++index52) { for (int index53 = Player.tileTargetY + num178; index53 <= Player.tileTargetY + num178 + 1; ++index53) { if (flag18) { index48 = index52; index49 = index53; if (Main.tile[index48, index49].wall > (byte) 0) { if (!Main.wallHouse[(int) Main.tile[index48, index49].wall]) { for (int index54 = index48 - 1; index54 < index48 + 2; ++index54) { for (int index55 = index49 - 1; index55 < index49 + 2; ++index55) { if ((int) Main.tile[index54, index55].wall != (int) Main.tile[index48, index49].wall) { flag18 = false; break; } } } } else flag18 = false; } } } } } if (flag13 && Main.tile[index48, index49].wall > (byte) 0 && (!Main.tile[index48, index49].active() || index48 != Player.tileTargetX || index49 != Player.tileTargetY || !Main.tileHammer[(int) Main.tile[index48, index49].type] && !this.poundRelease) && this.toolTime == 0 && this.itemAnimation > 0 && this.controlUseItem && sItem.hammer > 0) { bool flag19 = true; if (!Main.wallHouse[(int) Main.tile[index48, index49].wall]) { flag19 = false; for (int index56 = index48 - 1; index56 < index48 + 2; ++index56) { for (int index57 = index49 - 1; index57 < index49 + 2; ++index57) { if (Main.tile[index56, index57].wall == (byte) 0 || Main.wallHouse[(int) Main.tile[index56, index57].wall]) { flag19 = true; break; } } } } if (flag19) { int tileId = this.hitTile.HitObject(index48, index49, 2); int damageAmount3 = (int) ((double) sItem.hammer * 1.5); if (this.hitTile.AddDamage(tileId, damageAmount3) >= 100) { this.hitTile.Clear(tileId); WorldGen.KillWall(index48, index49); if (Main.netMode == 1) NetMessage.SendData(17, number: 2, number2: ((float) index48), number3: ((float) index49)); } else { WorldGen.KillWall(index48, index49, true); if (Main.netMode == 1) NetMessage.SendData(17, number: 2, number2: ((float) index48), number3: ((float) index49), number4: 1f); } if (damageAmount3 != 0) this.hitTile.Prune(); this.itemTime = sItem.useTime / 2; } } } } if (Main.myPlayer == this.whoAmI && sItem.type == 1326 && this.itemAnimation > 0 && this.itemTime == 0) { this.itemTime = sItem.useTime; Vector2 vector2; vector2.X = (float) Main.mouseX + Main.screenPosition.X; vector2.Y = (double) this.gravDir != 1.0 ? Main.screenPosition.Y + (float) Main.screenHeight - (float) Main.mouseY : (float) Main.mouseY + Main.screenPosition.Y - (float) this.height; vector2.X -= (float) (this.width / 2); if ((double) vector2.X > 50.0 && (double) vector2.X < (double) (Main.maxTilesX * 16 - 50) && (double) vector2.Y > 50.0 && (double) vector2.Y < (double) (Main.maxTilesY * 16 - 50)) { int index58 = (int) ((double) vector2.X / 16.0); int index59 = (int) ((double) vector2.Y / 16.0); if ((Main.tile[index58, index59].wall != (byte) 87 || (double) index59 <= Main.worldSurface || NPC.downedPlantBoss) && !Collision.SolidCollision(vector2, this.width, this.height)) { this.Teleport(vector2, 1); NetMessage.SendData(65, number2: ((float) this.whoAmI), number3: vector2.X, number4: vector2.Y, number5: 1); if (this.chaosState) { this.statLife -= this.statLifeMax2 / 7; PlayerDeathReason damageSource = PlayerDeathReason.ByOther(13); if (Main.rand.Next(2) == 0) damageSource = PlayerDeathReason.ByOther(this.Male ? 14 : 15); if (this.statLife <= 0) this.KillMe(damageSource, 1.0, 0); this.lifeRegenCount = 0; this.lifeRegenTime = 0; } this.AddBuff(88, 360); } } } if (sItem.type == 29 && this.itemAnimation > 0 && this.statLifeMax < 400 && this.itemTime == 0) { this.itemTime = sItem.useTime; this.statLifeMax += 20; this.statLifeMax2 += 20; this.statLife += 20; if (Main.myPlayer == this.whoAmI) this.HealEffect(20); AchievementsHelper.HandleSpecialEvent(this, 0); } if (sItem.type == 1291 && this.itemAnimation > 0 && this.statLifeMax >= 400 && this.statLifeMax < 500 && this.itemTime == 0) { this.itemTime = sItem.useTime; this.statLifeMax += 5; this.statLifeMax2 += 5; this.statLife += 5; if (Main.myPlayer == this.whoAmI) this.HealEffect(5); AchievementsHelper.HandleSpecialEvent(this, 2); } if (sItem.type == 109 && this.itemAnimation > 0 && this.statManaMax < 200 && this.itemTime == 0) { this.itemTime = sItem.useTime; this.statManaMax += 20; this.statManaMax2 += 20; this.statMana += 20; if (Main.myPlayer == this.whoAmI) this.ManaEffect(20); AchievementsHelper.HandleSpecialEvent(this, 1); } if (sItem.type == 3335 && this.itemAnimation > 0 && !this.extraAccessory && Main.expertMode && this.itemTime == 0) { this.itemTime = sItem.useTime; this.extraAccessory = true; NetMessage.SendData(4, number: this.whoAmI); } this.PlaceThing(); } if (sItem.type == 3542) { Vector2 vector2_35 = Main.OffsetsPlayerOnhand[this.bodyFrame.Y / 56] * 2f; if (this.direction != 1) vector2_35.X = (float) this.bodyFrame.Width - vector2_35.X; if ((double) this.gravDir != 1.0) vector2_35.Y = (float) this.bodyFrame.Height - vector2_35.Y; Vector2 vector2_36 = this.RotatedRelativePoint(this.position + (vector2_35 - new Vector2((float) (this.bodyFrame.Width - this.width), (float) (this.bodyFrame.Height - 42)) / 2f)) - this.velocity; for (int index = 0; index < 4; ++index) { Dust dust = Main.dust[Dust.NewDust(this.Center, 0, 0, 242, (float) (this.direction * 2), Alpha: 150, Scale: 1.3f)]; dust.position = vector2_36; dust.velocity *= 0.0f; dust.noGravity = true; dust.fadeIn = 1f; dust.velocity += this.velocity; if (Main.rand.Next(2) == 0) { dust.position += Utils.RandomVector2(Main.rand, -4f, 4f); dust.scale += Main.rand.NextFloat(); if (Main.rand.Next(2) == 0) dust.customData = (object) this; } } } if ((sItem.damage >= 0 && sItem.type > 0 && !sItem.noMelee || sItem.type == 1450 || sItem.type == 1991 || sItem.type == 3183 || sItem.type == 3542 || sItem.type == 3779) && this.itemAnimation > 0) { bool flag20 = false; Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle((int) this.itemLocation.X, (int) this.itemLocation.Y, 32, 32); if (!Main.dedServ) r = new Microsoft.Xna.Framework.Rectangle((int) this.itemLocation.X, (int) this.itemLocation.Y, Main.itemTexture[sItem.type].Width, Main.itemTexture[sItem.type].Height); r.Width = (int) ((double) r.Width * (double) sItem.scale); r.Height = (int) ((double) r.Height * (double) sItem.scale); if (this.direction == -1) r.X -= r.Width; if ((double) this.gravDir == 1.0) r.Y -= r.Height; if (sItem.useStyle == 1) { if ((double) this.itemAnimation < (double) this.itemAnimationMax * 0.333) { if (this.direction == -1) r.X -= (int) ((double) r.Width * 1.4 - (double) r.Width); r.Width = (int) ((double) r.Width * 1.4); r.Y += (int) ((double) r.Height * 0.5 * (double) this.gravDir); r.Height = (int) ((double) r.Height * 1.1); } else if ((double) this.itemAnimation >= (double) this.itemAnimationMax * 0.666) { if (this.direction == 1) r.X -= (int) ((double) r.Width * 1.2); r.Width *= 2; r.Y -= (int) (((double) r.Height * 1.4 - (double) r.Height) * (double) this.gravDir); r.Height = (int) ((double) r.Height * 1.4); } } else if (sItem.useStyle == 3) { if ((double) this.itemAnimation > (double) this.itemAnimationMax * 0.666) { flag20 = true; } else { if (this.direction == -1) r.X -= (int) ((double) r.Width * 1.4 - (double) r.Width); r.Width = (int) ((double) r.Width * 1.4); r.Y += (int) ((double) r.Height * 0.6); r.Height = (int) ((double) r.Height * 0.6); } } double gravDir = (double) this.gravDir; if (sItem.type == 1450 && Main.rand.Next(3) == 0) { int index = -1; float x = (float) (r.X + Main.rand.Next(r.Width)); float y = (float) (r.Y + Main.rand.Next(r.Height)); if (Main.rand.Next(500) == 0) index = Gore.NewGore(new Vector2(x, y), new Vector2(), 415, (float) Main.rand.Next(51, 101) * 0.01f); else if (Main.rand.Next(250) == 0) index = Gore.NewGore(new Vector2(x, y), new Vector2(), 414, (float) Main.rand.Next(51, 101) * 0.01f); else if (Main.rand.Next(80) == 0) index = Gore.NewGore(new Vector2(x, y), new Vector2(), 413, (float) Main.rand.Next(51, 101) * 0.01f); else if (Main.rand.Next(10) == 0) index = Gore.NewGore(new Vector2(x, y), new Vector2(), 412, (float) Main.rand.Next(51, 101) * 0.01f); else if (Main.rand.Next(3) == 0) index = Gore.NewGore(new Vector2(x, y), new Vector2(), 411, (float) Main.rand.Next(51, 101) * 0.01f); if (index >= 0) { Main.gore[index].velocity.X += (float) (this.direction * 2); Main.gore[index].velocity.Y *= 0.3f; } } if (sItem.type == 3542) flag20 = true; if (sItem.type == 3779) { flag20 = true; Vector2 vector2_37 = this.itemLocation + new Vector2((float) (this.direction * 30), -8f); int itemAnimation = this.itemAnimation; int num = this.itemAnimationMax - 2; Vector2 vector2_38 = vector2_37 - this.position; for (float amount = 0.0f; (double) amount < 1.0; amount += 0.2f) { Vector2 vector2_39 = Vector2.Lerp(this.oldPosition + vector2_38 + new Vector2(0.0f, this.gfxOffY), vector2_37, amount); Dust dust = Main.dust[Dust.NewDust(vector2_37 - Vector2.One * 8f, 16, 16, 27, SpeedY: -2f)]; dust.noGravity = true; dust.position = vector2_39; dust.velocity = new Vector2(0.0f, (float) (-(double) this.gravDir * 2.0)); dust.scale = 1.2f; dust.alpha = 200; } } if (!flag20) { if (sItem.type == 989 && Main.rand.Next(5) == 0) { int Type; switch (Main.rand.Next(3)) { case 0: Type = 15; break; case 1: Type = 57; break; default: Type = 58; break; } int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, Type, (float) (this.direction * 2), Alpha: 150, Scale: 1.3f); Main.dust[index].velocity *= 0.2f; } if (sItem.type == 2880 && Main.rand.Next(2) == 0) { int Type = Utils.SelectRandom(Main.rand, 226, 229); int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, Type, (float) (this.direction * 2), Alpha: 150); Main.dust[index].velocity *= 0.2f; Main.dust[index].noGravity = true; } if ((sItem.type == 44 || sItem.type == 45 || sItem.type == 46 || sItem.type == 103 || sItem.type == 104) && Main.rand.Next(15) == 0) Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 14, (float) (this.direction * 2), Alpha: 150, Scale: 1.3f); if (sItem.type == 273 || sItem.type == 675) { if (Main.rand.Next(5) == 0) Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 14, (float) (this.direction * 2), Alpha: 150, Scale: 1.4f); int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 27, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 1.2f); Main.dust[index].noGravity = true; Main.dust[index].velocity.X /= 2f; Main.dust[index].velocity.Y /= 2f; } if (sItem.type == 723 && Main.rand.Next(2) == 0) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 64, Alpha: 150, Scale: 1.2f); Main.dust[index].noGravity = true; } if (sItem.type == 65) { if (Main.rand.Next(5) == 0) Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 58, Alpha: 150, Scale: 1.2f); if (Main.rand.Next(10) == 0) Gore.NewGore(new Vector2((float) r.X, (float) r.Y), new Vector2(), Main.rand.Next(16, 18)); } if (sItem.type == 3065) { int index60 = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 58, Alpha: 150, Scale: 1.2f); Main.dust[index60].velocity *= 0.5f; if (Main.rand.Next(8) == 0) { int index61 = Gore.NewGore(new Vector2((float) r.Center.X, (float) r.Center.Y), new Vector2(), 16); Main.gore[index61].velocity *= 0.5f; Main.gore[index61].velocity += new Vector2((float) this.direction, 0.0f); } } if (sItem.type == 190) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 40, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, Scale: 1.2f); Main.dust[index].noGravity = true; } else if (sItem.type == 213) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 3, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, Scale: 1.2f); Main.dust[index].noGravity = true; } if (sItem.type == 121) { for (int index62 = 0; index62 < 2; ++index62) { int index63 = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 6, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 2.5f); Main.dust[index63].noGravity = true; Main.dust[index63].velocity.X *= 2f; Main.dust[index63].velocity.Y *= 2f; } } if (sItem.type == 122 || sItem.type == 217) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 6, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 1.9f); Main.dust[index].noGravity = true; } if (sItem.type == 155) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 172, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 0.9f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.1f; } if (sItem.type == 676 && Main.rand.Next(3) == 0) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 67, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 90, Scale: 1.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.2f; } if (sItem.type == 3063) { int index = Dust.NewDust(r.TopLeft(), r.Width, r.Height, 66, Alpha: 150, newColor: Color.Transparent, Scale: 0.85f); Main.dust[index].color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity /= 2f; } if (sItem.type == 3823) { Dust dust = Dust.NewDustDirect(r.TopLeft(), r.Width, r.Height, 6, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Color.Transparent, 0.7f); dust.noGravity = true; dust.velocity *= 2f; dust.fadeIn = 0.9f; } if (sItem.type == 724 && Main.rand.Next(5) == 0) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 67, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 90, Scale: 1.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.2f; } if (sItem.type >= 795 && sItem.type <= 802 && Main.rand.Next(3) == 0) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 115, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 140, Scale: 1.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.25f; } if (sItem.type == 367 || sItem.type == 368 || sItem.type == 674) { if (Main.rand.Next(3) == 0) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 57, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 1.1f); Main.dust[index].noGravity = true; Main.dust[index].velocity.X /= 2f; Main.dust[index].velocity.Y /= 2f; Main.dust[index].velocity.X += (float) (this.direction * 2); } if (Main.rand.Next(4) == 0) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 43, Alpha: 254, Scale: 0.3f); Main.dust[index].velocity *= 0.0f; } } if (sItem.type >= 198 && sItem.type <= 203 || sItem.type >= 3764 && sItem.type <= 3769) { float R = 0.5f; float G = 0.5f; float B = 0.5f; if (sItem.type == 198 || sItem.type == 3764) { R *= 0.1f; G *= 0.5f; B *= 1.2f; } else if (sItem.type == 199 || sItem.type == 3765) { R *= 1f; G *= 0.2f; B *= 0.1f; } else if (sItem.type == 200 || sItem.type == 3766) { R *= 0.1f; G *= 1f; B *= 0.2f; } else if (sItem.type == 201 || sItem.type == 3767) { R *= 0.8f; G *= 0.1f; B *= 1f; } else if (sItem.type == 202 || sItem.type == 3768) { R *= 0.8f; G *= 0.9f; B *= 1f; } else if (sItem.type == 203 || sItem.type == 3769) { R *= 0.9f; G *= 0.9f; B *= 0.1f; } Lighting.AddLight((int) (((double) this.itemLocation.X + 6.0 + (double) this.velocity.X) / 16.0), (int) (((double) this.itemLocation.Y - 14.0) / 16.0), R, G, B); } if (this.frostBurn && sItem.melee && !sItem.noMelee && !sItem.noUseGraphic && Main.rand.Next(2) == 0) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 135, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 2.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.7f; Main.dust[index].velocity.Y -= 0.5f; } if (sItem.melee && !sItem.noMelee && !sItem.noUseGraphic && this.meleeEnchant > (byte) 0) { if (this.meleeEnchant == (byte) 1) { if (Main.rand.Next(3) == 0) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 171, Alpha: 100); Main.dust[index].noGravity = true; Main.dust[index].fadeIn = 1.5f; Main.dust[index].velocity *= 0.25f; } } else if (this.meleeEnchant == (byte) 2) { if (Main.rand.Next(2) == 0) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 75, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 2.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.7f; Main.dust[index].velocity.Y -= 0.5f; } } else if (this.meleeEnchant == (byte) 3) { if (Main.rand.Next(2) == 0) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 6, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 2.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.7f; Main.dust[index].velocity.Y -= 0.5f; } } else if (this.meleeEnchant == (byte) 4) { if (Main.rand.Next(2) == 0) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 57, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 1.1f); Main.dust[index].noGravity = true; Main.dust[index].velocity.X /= 2f; Main.dust[index].velocity.Y /= 2f; } } else if (this.meleeEnchant == (byte) 5) { if (Main.rand.Next(2) == 0) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 169, Alpha: 100); Main.dust[index].velocity.X += (float) this.direction; Main.dust[index].velocity.Y += 0.2f; Main.dust[index].noGravity = true; } } else if (this.meleeEnchant == (byte) 6) { if (Main.rand.Next(2) == 0) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 135, Alpha: 100); Main.dust[index].velocity.X += (float) this.direction; Main.dust[index].velocity.Y += 0.2f; Main.dust[index].noGravity = true; } } else if (this.meleeEnchant == (byte) 7) { if (Main.rand.Next(20) == 0) { int Type = Main.rand.Next(139, 143); int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, Type, this.velocity.X, this.velocity.Y, Scale: 1.2f); Main.dust[index].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258); Main.dust[index].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258); Main.dust[index].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f; Main.dust[index].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f; Main.dust[index].scale *= (float) (1.0 + (double) Main.rand.Next(-30, 31) * 0.00999999977648258); } if (Main.rand.Next(40) == 0) { int Type = Main.rand.Next(276, 283); int index = Gore.NewGore(new Vector2((float) r.X, (float) r.Y), this.velocity, Type); Main.gore[index].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258); Main.gore[index].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258); Main.gore[index].scale *= (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.00999999977648258); Main.gore[index].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f; Main.gore[index].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f; } } else if (this.meleeEnchant == (byte) 8 && Main.rand.Next(4) == 0) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 46, Alpha: 100); Main.dust[index].noGravity = true; Main.dust[index].fadeIn = 1.5f; Main.dust[index].velocity *= 0.25f; } } if (this.magmaStone && sItem.melee && !sItem.noMelee && !sItem.noUseGraphic && Main.rand.Next(3) != 0) { int index = Dust.NewDust(new Vector2((float) r.X, (float) r.Y), r.Width, r.Height, 6, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 2.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity.X *= 2f; Main.dust[index].velocity.Y *= 2f; } if (Main.myPlayer == i && (sItem.type == 1991 || sItem.type == 3183)) { for (int i4 = 0; i4 < 200; ++i4) { if (Main.npc[i4].active && Main.npc[i4].catchItem > (short) 0) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[i4].position.X, (int) Main.npc[i4].position.Y, Main.npc[i4].width, Main.npc[i4].height); if (r.Intersects(rectangle) && (sItem.type == 3183 || Main.npc[i4].noTileCollide || this.CanHit((Entity) Main.npc[i4]))) NPC.CatchNPC(i4, i); } } } if (Main.myPlayer == i && (sItem.damage > 0 || sItem.type == 3183)) { int num179 = sItem.damage; if (sItem.melee) num179 = (int) ((double) sItem.damage * (double) this.meleeDamage); if (sItem.ranged) num179 = (int) ((double) sItem.damage * (double) this.rangedDamage); if (sItem.magic) num179 = (int) ((double) sItem.damage * (double) this.magicDamage); if (sItem.summon) num179 = (int) ((double) sItem.damage * (double) this.minionDamage); if (sItem.thrown) num179 = (int) ((double) sItem.damage * (double) this.thrownDamage); float knockBack = sItem.knockBack; float num180 = 1f; if (this.kbGlove) ++num180; if (this.kbBuff) num180 += 0.5f; float num181 = knockBack * num180; if (this.inventory[this.selectedItem].type == 3106) num181 += num181 * (1f - this.stealth); List ushortList = (List) null; if (sItem.type == 213) ushortList = new List((IEnumerable) new ushort[17] { (ushort) 3, (ushort) 24, (ushort) 52, (ushort) 61, (ushort) 62, (ushort) 71, (ushort) 73, (ushort) 74, (ushort) 82, (ushort) 83, (ushort) 84, (ushort) 110, (ushort) 113, (ushort) 115, (ushort) 184, (ushort) 205, (ushort) 201 }); int num182 = r.X / 16; int num183 = (r.X + r.Width) / 16 + 1; int num184 = r.Y / 16; int num185 = (r.Y + r.Height) / 16 + 1; for (int index64 = num182; index64 < num183; ++index64) { for (int index65 = num184; index65 < num185; ++index65) { if (Main.tile[index64, index65] != null && Main.tileCut[(int) Main.tile[index64, index65].type] && (ushortList == null || !ushortList.Contains(Main.tile[index64, index65].type)) && WorldGen.CanCutTile(index64, index65, TileCuttingContext.AttackMelee)) { if (sItem.type == 1786) { int type = (int) Main.tile[index64, index65].type; WorldGen.KillTile(index64, index65); if (!Main.tile[index64, index65].active()) { int Stack = 0; if (type == 3 || type == 24 || type == 61 || type == 110 || type == 201) Stack = Main.rand.Next(1, 3); if (type == 73 || type == 74 || type == 113) Stack = Main.rand.Next(2, 5); if (Stack > 0) { int number = Item.NewItem(index64 * 16, index65 * 16, 16, 16, 1727, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } } if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) index64), number3: ((float) index65)); } else { WorldGen.KillTile(index64, index65); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) index64), number3: ((float) index65)); } } } } if (sItem.type != 3183) { for (int index66 = 0; index66 < 200; ++index66) { if (Main.npc[index66].active && Main.npc[index66].immune[i] == 0 && this.attackCD == 0) { if (!Main.npc[index66].dontTakeDamage) { if (!Main.npc[index66].friendly || Main.npc[index66].type == 22 && this.killGuide || Main.npc[index66].type == 54 && this.killClothier) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index66].position.X, (int) Main.npc[index66].position.Y, Main.npc[index66].width, Main.npc[index66].height); if (r.Intersects(rectangle) && (Main.npc[index66].noTileCollide || this.CanHit((Entity) Main.npc[index66]))) { bool crit = false; if (sItem.melee && Main.rand.Next(1, 101) <= this.meleeCrit) crit = true; if (sItem.ranged && Main.rand.Next(1, 101) <= this.rangedCrit) crit = true; if (sItem.magic && Main.rand.Next(1, 101) <= this.magicCrit) crit = true; if (sItem.thrown && Main.rand.Next(1, 101) <= this.thrownCrit) crit = true; int banner = Item.NPCtoBanner(Main.npc[index66].BannerID()); if (banner > 0 && this.NPCBannerBuff[banner]) num179 = !Main.expertMode ? (int) ((double) num179 * (double) ItemID.Sets.BannerStrength[Item.BannerToItem(banner)].NormalDamageDealt) : (int) ((double) num179 * (double) ItemID.Sets.BannerStrength[Item.BannerToItem(banner)].ExpertDamageDealt); if (this.parryDamageBuff && sItem.melee) { num179 *= 5; this.parryDamageBuff = false; this.ClearBuff(198); } int num186 = Main.DamageVar((float) num179); this.StatusNPC(sItem.type, index66); this.OnHit(Main.npc[index66].Center.X, Main.npc[index66].Center.Y, (Entity) Main.npc[index66]); if (this.armorPenetration > 0) num186 += Main.npc[index66].checkArmorPenetration(this.armorPenetration); int num187 = (int) Main.npc[index66].StrikeNPC(num186, num181, this.direction, crit); if (this.inventory[this.selectedItem].type == 3211) { Vector2 vector2_40 = new Vector2((float) (this.direction * 100 + Main.rand.Next(-25, 26)), (float) Main.rand.Next(-75, 76)); vector2_40.Normalize(); vector2_40 *= (float) Main.rand.Next(30, 41) * 0.1f; Vector2 vector2_41 = new Vector2((float) (r.X + Main.rand.Next(r.Width)), (float) (r.Y + Main.rand.Next(r.Height))); vector2_41 = (vector2_41 + Main.npc[index66].Center * 2f) / 3f; Projectile.NewProjectile(vector2_41.X, vector2_41.Y, vector2_40.X, vector2_40.Y, 524, (int) ((double) num179 * 0.7), num181 * 0.7f, this.whoAmI); } bool flag21 = !Main.npc[index66].immortal; if (this.beetleOffense & flag21) { this.beetleCounter += (float) num187; this.beetleCountdown = 0; } if (sItem.type == 1826 && ((double) Main.npc[index66].value > 0.0 || Main.npc[index66].damage > 0 && !Main.npc[index66].friendly)) this.pumpkinSword(index66, (int) ((double) num179 * 1.5), num181); if (this.meleeEnchant == (byte) 7) Projectile.NewProjectile(Main.npc[index66].Center.X, Main.npc[index66].Center.Y, Main.npc[index66].velocity.X, Main.npc[index66].velocity.Y, 289, 0, 0.0f, this.whoAmI); if (this.inventory[this.selectedItem].type == 3106) { this.stealth = 1f; if (Main.netMode == 1) NetMessage.SendData(84, number: this.whoAmI); } if (sItem.type == 1123 & flag21) { int num188 = Main.rand.Next(1, 4); if (this.strongBees && Main.rand.Next(3) == 0) ++num188; for (int index67 = 0; index67 < num188; ++index67) { float num189 = (float) (this.direction * 2) + (float) Main.rand.Next(-35, 36) * 0.02f; float num190 = (float) Main.rand.Next(-35, 36) * 0.02f; float SpeedX = num189 * 0.2f; float SpeedY = num190 * 0.2f; Projectile.NewProjectile((float) (r.X + r.Width / 2), (float) (r.Y + r.Height / 2), SpeedX, SpeedY, this.beeType(), this.beeDamage(num186 / 3), this.beeKB(0.0f), i); } } if ((double) Main.npc[index66].value > 0.0 && this.coins && Main.rand.Next(5) == 0) { int Type = 71; if (Main.rand.Next(10) == 0) Type = 72; if (Main.rand.Next(100) == 0) Type = 73; int number = Item.NewItem((int) Main.npc[index66].position.X, (int) Main.npc[index66].position.Y, Main.npc[index66].width, Main.npc[index66].height, Type); Main.item[number].stack = Main.rand.Next(1, 11); Main.item[number].velocity.Y = (float) Main.rand.Next(-20, 1) * 0.2f; Main.item[number].velocity.X = (float) Main.rand.Next(10, 31) * 0.2f * (float) this.direction; if (Main.netMode == 1) NetMessage.SendData(21, number: number); } int num191 = Item.NPCtoBanner(Main.npc[index66].BannerID()); if (num191 >= 0) this.lastCreatureHit = num191; if (Main.netMode != 0) { if (crit) NetMessage.SendData(28, number: index66, number2: ((float) num186), number3: num181, number4: ((float) this.direction), number5: 1); else NetMessage.SendData(28, number: index66, number2: ((float) num186), number3: num181, number4: ((float) this.direction)); } if (this.accDreamCatcher) this.addDPS(num186); Main.npc[index66].immune[i] = this.itemAnimation; this.attackCD = (int) ((double) this.itemAnimationMax * 0.33); } } } else if (Main.npc[index66].type == 63 || Main.npc[index66].type == 64 || Main.npc[index66].type == 103 || Main.npc[index66].type == 242) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index66].position.X, (int) Main.npc[index66].position.Y, Main.npc[index66].width, Main.npc[index66].height); if (r.Intersects(rectangle) && (Main.npc[index66].noTileCollide || this.CanHit((Entity) Main.npc[index66]))) { this.Hurt(PlayerDeathReason.LegacyDefault(), (int) ((double) Main.npc[index66].damage * 1.3), -this.direction); Main.npc[index66].immune[i] = this.itemAnimation; this.attackCD = (int) ((double) this.itemAnimationMax * 0.33); } } } } if (this.hostile) { for (int index68 = 0; index68 < (int) byte.MaxValue; ++index68) { if ((index68 == i || !Main.player[index68].active || !Main.player[index68].hostile || Main.player[index68].immune ? 0 : (!Main.player[index68].dead ? 1 : 0)) != 0 && (Main.player[i].team == 0 || Main.player[i].team != Main.player[index68].team)) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.player[index68].position.X, (int) Main.player[index68].position.Y, Main.player[index68].width, Main.player[index68].height); if (r.Intersects(rectangle) && this.CanHit((Entity) Main.player[index68])) { bool flag22 = false; if (Main.rand.Next(1, 101) <= 10) flag22 = true; int num192 = Main.DamageVar((float) num179); this.StatusPvP(sItem.type, index68); this.OnHit(Main.player[index68].Center.X, Main.player[index68].Center.Y, (Entity) Main.player[index68]); PlayerDeathReason playerDeathReason = PlayerDeathReason.ByPlayer(this.whoAmI); int num193 = (int) Main.player[index68].Hurt(playerDeathReason, num192, this.direction, true, Crit: flag22); if (this.inventory[this.selectedItem].type == 3211) { Vector2 vector2_42 = new Vector2((float) (this.direction * 100 + Main.rand.Next(-25, 26)), (float) Main.rand.Next(-75, 76)); vector2_42.Normalize(); vector2_42 *= (float) Main.rand.Next(30, 41) * 0.1f; Vector2 vector2_43 = new Vector2((float) (r.X + Main.rand.Next(r.Width)), (float) (r.Y + Main.rand.Next(r.Height))); vector2_43 = (vector2_43 + Main.player[index68].Center * 2f) / 3f; Projectile.NewProjectile(vector2_43.X, vector2_43.Y, vector2_42.X, vector2_42.Y, 524, (int) ((double) num179 * 0.7), num181 * 0.7f, this.whoAmI); } if (this.beetleOffense) { this.beetleCounter += (float) num193; this.beetleCountdown = 0; } if (this.meleeEnchant == (byte) 7) Projectile.NewProjectile(Main.player[index68].Center.X, Main.player[index68].Center.Y, Main.player[index68].velocity.X, Main.player[index68].velocity.Y, 289, 0, 0.0f, this.whoAmI); if (sItem.type == 1123) { int num194 = Main.rand.Next(1, 4); if (this.strongBees && Main.rand.Next(3) == 0) ++num194; for (int index69 = 0; index69 < num194; ++index69) { float num195 = (float) (this.direction * 2) + (float) Main.rand.Next(-35, 36) * 0.02f; float num196 = (float) Main.rand.Next(-35, 36) * 0.02f; float SpeedX = num195 * 0.2f; float SpeedY = num196 * 0.2f; Projectile.NewProjectile((float) (r.X + r.Width / 2), (float) (r.Y + r.Height / 2), SpeedX, SpeedY, this.beeType(), this.beeDamage(num192 / 3), this.beeKB(0.0f), i); } } if (this.inventory[this.selectedItem].type == 3106) { this.stealth = 1f; if (Main.netMode == 1) NetMessage.SendData(84, number: this.whoAmI); } if (sItem.type == 1826 && (double) Main.npc[index68].value > 0.0) this.pumpkinSword(index68, (int) ((double) num179 * 1.5), num181); if (Main.netMode != 0) NetMessage.SendPlayerHurt(index68, playerDeathReason, num192, this.direction, flag22, true, -1); this.attackCD = (int) ((double) this.itemAnimationMax * 0.33); } } } } if (sItem.type == 787 && (this.itemAnimation == (int) ((double) this.itemAnimationMax * 0.1) || this.itemAnimation == (int) ((double) this.itemAnimationMax * 0.3) || this.itemAnimation == (int) ((double) this.itemAnimationMax * 0.5) || this.itemAnimation == (int) ((double) this.itemAnimationMax * 0.7) || this.itemAnimation == (int) ((double) this.itemAnimationMax * 0.9))) { float num197 = 0.0f; float num198 = 0.0f; float num199 = 0.0f; float num200 = 0.0f; if (this.itemAnimation == (int) ((double) this.itemAnimationMax * 0.9)) num197 = -7f; if (this.itemAnimation == (int) ((double) this.itemAnimationMax * 0.7)) { num197 = -6f; num198 = 2f; } if (this.itemAnimation == (int) ((double) this.itemAnimationMax * 0.5)) { num197 = -4f; num198 = 4f; } if (this.itemAnimation == (int) ((double) this.itemAnimationMax * 0.3)) { num197 = -2f; num198 = 6f; } if (this.itemAnimation == (int) ((double) this.itemAnimationMax * 0.1)) num198 = 7f; if (this.itemAnimation == (int) ((double) this.itemAnimationMax * 0.7)) num200 = 26f; if (this.itemAnimation == (int) ((double) this.itemAnimationMax * 0.3)) { num200 -= 4f; num199 -= 20f; } if (this.itemAnimation == (int) ((double) this.itemAnimationMax * 0.1)) num199 += 6f; if (this.direction == -1) { if (this.itemAnimation == (int) ((double) this.itemAnimationMax * 0.9)) num200 -= 8f; if (this.itemAnimation == (int) ((double) this.itemAnimationMax * 0.7)) num200 -= 6f; } float num201 = num197 * 1.5f; float num202 = num198 * 1.5f; float num203 = num200 * (float) this.direction; float num204 = num199 * this.gravDir; Projectile.NewProjectile((float) (r.X + r.Width / 2) + num203, (float) (r.Y + r.Height / 2) + num204, (float) this.direction * num202, num201 * this.gravDir, 131, num179 / 2, 0.0f, i); } } } } } if (this.itemTime == 0 && this.itemAnimation > 0) { if (sItem.hairDye >= (short) 0) { this.itemTime = sItem.useTime; if (this.whoAmI == Main.myPlayer) { this.hairDye = (byte) sItem.hairDye; NetMessage.SendData(4, number: this.whoAmI); } } if (sItem.healLife > 0) { this.statLife += sItem.healLife; this.itemTime = sItem.useTime; if (Main.myPlayer == this.whoAmI) this.HealEffect(sItem.healLife); } if (sItem.healMana > 0) { this.statMana += sItem.healMana; this.itemTime = sItem.useTime; if (Main.myPlayer == this.whoAmI) { this.AddBuff(94, Player.manaSickTime); this.ManaEffect(sItem.healMana); } } if (sItem.buffType > 0) { if (this.whoAmI == Main.myPlayer && sItem.buffType != 90 && sItem.buffType != 27) this.AddBuff(sItem.buffType, sItem.buffTime); this.itemTime = sItem.useTime; } if (sItem.type == 678) { this.itemTime = sItem.useTime; if (this.whoAmI == Main.myPlayer) { this.AddBuff(20, 216000); this.AddBuff(22, 216000); this.AddBuff(23, 216000); this.AddBuff(24, 216000); this.AddBuff(30, 216000); this.AddBuff(31, 216000); this.AddBuff(32, 216000); this.AddBuff(33, 216000); this.AddBuff(35, 216000); this.AddBuff(36, 216000); this.AddBuff(68, 216000); } } } if (this.whoAmI == Main.myPlayer) { if (this.itemTime == 0 && this.itemAnimation > 0 && sItem.type == 361 && Main.CanStartInvasion(ignoreDelay: true)) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); if (Main.netMode != 1) { if (Main.invasionType == 0) { Main.invasionDelay = 0; Main.StartInvasion(); } } else NetMessage.SendData(61, number: this.whoAmI, number2: -1f); } if (this.itemTime == 0 && this.itemAnimation > 0 && sItem.type == 602 && Main.CanStartInvasion(2, true)) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); if (Main.netMode != 1) { if (Main.invasionType == 0) { Main.invasionDelay = 0; Main.StartInvasion(2); } } else NetMessage.SendData(61, number: this.whoAmI, number2: -2f); } if (this.itemTime == 0 && this.itemAnimation > 0 && sItem.type == 1315 && Main.CanStartInvasion(3, true)) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); if (Main.netMode != 1) { if (Main.invasionType == 0) { Main.invasionDelay = 0; Main.StartInvasion(3); } } else NetMessage.SendData(61, number: this.whoAmI, number2: -3f); } if (this.itemTime == 0 && this.itemAnimation > 0 && sItem.type == 1844 && !Main.dayTime && !Main.pumpkinMoon && !Main.snowMoon && !DD2Event.Ongoing) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); if (Main.netMode != 1) { Main.NewText(Lang.misc[31].Value, (byte) 50, B: (byte) 130); Main.startPumpkinMoon(); } else NetMessage.SendData(61, number: this.whoAmI, number2: -4f); } if (this.itemTime == 0 && this.itemAnimation > 0 && sItem.type == 2767 && Main.dayTime && !Main.eclipse) { Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); this.itemTime = sItem.useTime; if (Main.netMode == 0) { Main.eclipse = true; Main.NewText(Lang.misc[20].Value, (byte) 50, B: (byte) 130); } else NetMessage.SendData(61, number: this.whoAmI, number2: -6f); } if (this.itemTime == 0 && this.itemAnimation > 0 && sItem.type == 3601 && NPC.downedGolemBoss && Main.hardMode && !NPC.AnyDanger() && !NPC.AnyoneNearCultists()) { Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); this.itemTime = sItem.useTime; if (Main.netMode == 0) WorldGen.StartImpendingDoom(); else NetMessage.SendData(61, number: this.whoAmI, number2: -8f); } if (this.itemTime == 0 && this.itemAnimation > 0 && sItem.type == 1958 && !Main.dayTime && !Main.pumpkinMoon && !Main.snowMoon && !DD2Event.Ongoing) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); if (Main.netMode != 1) { Main.NewText(Lang.misc[34].Value, (byte) 50, B: (byte) 130); Main.startSnowMoon(); } else NetMessage.SendData(61, number: this.whoAmI, number2: -5f); } if (this.itemTime == 0 && this.itemAnimation > 0 && sItem.makeNPC > (short) 0 && this.controlUseItem && (double) this.position.X / 16.0 - (double) Player.tileRangeX - (double) sItem.tileBoost <= (double) Player.tileTargetX && ((double) this.position.X + (double) this.width) / 16.0 + (double) Player.tileRangeX + (double) sItem.tileBoost - 1.0 >= (double) Player.tileTargetX && (double) this.position.Y / 16.0 - (double) Player.tileRangeY - (double) sItem.tileBoost <= (double) Player.tileTargetY && ((double) this.position.Y + (double) this.height) / 16.0 + (double) Player.tileRangeY + (double) sItem.tileBoost - 2.0 >= (double) Player.tileTargetY) { int x = Main.mouseX + (int) Main.screenPosition.X; int y = Main.mouseY + (int) Main.screenPosition.Y; this.itemTime = sItem.useTime; if (!WorldGen.SolidTile(x / 16, y / 16)) NPC.ReleaseNPC(x, y, (int) sItem.makeNPC, sItem.placeStyle, this.whoAmI); } if (this.itemTime == 0 && this.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) && this.SummonItemCheck()) { if (sItem.type == 560) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); if (Main.netMode != 1) NPC.SpawnOnPlayer(i, 50); else NetMessage.SendData(61, number: this.whoAmI, number2: 50f); } else if (sItem.type == 43) { if (!Main.dayTime) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); if (Main.netMode != 1) NPC.SpawnOnPlayer(i, 4); else NetMessage.SendData(61, number: this.whoAmI, number2: 4f); } } else if (sItem.type == 70) { if (this.ZoneCorrupt) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); if (Main.netMode != 1) NPC.SpawnOnPlayer(i, 13); else NetMessage.SendData(61, number: this.whoAmI, number2: 13f); } } else if (sItem.type == 544) { if (!Main.dayTime) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); if (Main.netMode != 1) { NPC.SpawnOnPlayer(i, 125); NPC.SpawnOnPlayer(i, 126); } else { NetMessage.SendData(61, number: this.whoAmI, number2: 125f); NetMessage.SendData(61, number: this.whoAmI, number2: 126f); } } } else if (sItem.type == 556) { if (!Main.dayTime) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); if (Main.netMode != 1) NPC.SpawnOnPlayer(i, 134); else NetMessage.SendData(61, number: this.whoAmI, number2: 134f); } } else if (sItem.type == 557) { if (!Main.dayTime) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); if (Main.netMode != 1) NPC.SpawnOnPlayer(i, (int) sbyte.MaxValue); else NetMessage.SendData(61, number: this.whoAmI, number2: ((float) sbyte.MaxValue)); } } else if (sItem.type == 1133) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); if (Main.netMode != 1) NPC.SpawnOnPlayer(i, 222); else NetMessage.SendData(61, number: this.whoAmI, number2: 222f); } else if (sItem.type == 1331 && this.ZoneCrimson) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); if (Main.netMode != 1) NPC.SpawnOnPlayer(i, 266); else NetMessage.SendData(61, number: this.whoAmI, number2: 266f); } } } if ((sItem.type == 50 || sItem.type == 3124 || sItem.type == 3199) && this.itemAnimation > 0) { if (Main.rand.Next(2) == 0) Dust.NewDust(this.position, this.width, this.height, 15, Alpha: 150, Scale: 1.1f); if (this.itemTime == 0) this.itemTime = sItem.useTime; else if (this.itemTime == sItem.useTime / 2) { for (int index = 0; index < 70; ++index) Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, Scale: 1.5f); this.grappling[0] = -1; this.grapCount = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == i && Main.projectile[index].aiStyle == 7) Main.projectile[index].Kill(); } this.Spawn(); for (int index = 0; index < 70; ++index) Dust.NewDust(this.position, this.width, this.height, 15, Alpha: 150, Scale: 1.5f); } } if (sItem.type == 2350 && this.itemAnimation > 0) { if (this.itemTime == 0) this.itemTime = sItem.useTime; else if (this.itemTime == 2) { for (int index = 0; index < 70; ++index) Main.dust[Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f; this.grappling[0] = -1; this.grapCount = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == i && Main.projectile[index].aiStyle == 7) Main.projectile[index].Kill(); } bool immune = this.immune; int immuneTime = this.immuneTime; this.Spawn(); this.immune = immune; this.immuneTime = immuneTime; for (int index = 0; index < 70; ++index) Main.dust[Dust.NewDust(this.position, this.width, this.height, 15, Alpha: 150, newColor: Color.Cyan, Scale: 1.2f)].velocity *= 0.5f; if (sItem.stack > 0) --sItem.stack; } } if (sItem.type == 2351 && this.itemAnimation > 0) { if (this.itemTime == 0) this.itemTime = sItem.useTime; else if (this.itemTime == 2) { switch (Main.netMode) { case 0: this.TeleportationPotion(); break; case 1: if (this.whoAmI == Main.myPlayer) { NetMessage.SendData(73); break; } break; } if (sItem.stack > 0) --sItem.stack; } } if (sItem.type == 2756 && this.itemAnimation > 0) { if (this.itemTime == 0) this.itemTime = sItem.useTime; else if (this.itemTime == 2) { if (this.whoAmI == Main.myPlayer) { this.Male = !this.Male; if (Main.netMode == 1) NetMessage.SendData(4, number: this.whoAmI); } if (sItem.stack > 0) --sItem.stack; } else { float useTime = (float) sItem.useTime; float num205 = (useTime - (float) this.itemTime) / useTime; float num206 = 44f; Vector2 vector2 = new Vector2(15f, 0.0f).RotatedBy(9.42477798461914 * (double) num205); vector2.X *= (float) this.direction; for (int index70 = 0; index70 < 2; ++index70) { int Type = 221; if (index70 == 1) { vector2.X *= -1f; Type = 219; } Vector2 Position = new Vector2(vector2.X, num206 * (1f - num205) - num206 + (float) (this.height / 2)); Position += this.Center; int index71 = Dust.NewDust(Position, 0, 0, Type, Alpha: 100); Main.dust[index71].position = Position; Main.dust[index71].noGravity = true; Main.dust[index71].velocity = Vector2.Zero; Main.dust[index71].scale = 1.3f; Main.dust[index71].customData = (object) this; } } } if (i != Main.myPlayer) return; if (this.itemTime == (int) ((double) sItem.useTime * (double) this.tileSpeed) && sItem.tileWand > 0) { int tileWand = sItem.tileWand; for (int index = 0; index < 58; ++index) { if (tileWand == this.inventory[index].type && this.inventory[index].stack > 0) { --this.inventory[index].stack; if (this.inventory[index].stack <= 0) { this.inventory[index] = new Item(); break; } break; } } } if (this.itemTime == (sItem.createTile < 0 ? (sItem.createWall <= 0 ? sItem.useTime : (int) ((double) sItem.useTime * (double) this.wallSpeed)) : (int) ((double) sItem.useTime * (double) this.tileSpeed)) && sItem.consumable) { bool flag23 = true; if (sItem.type == 2350 || sItem.type == 2351) flag23 = false; if (sItem.type == 2756) flag23 = false; if (sItem.ranged) { if (this.ammoCost80 && Main.rand.Next(5) == 0) flag23 = false; if (this.ammoCost75 && Main.rand.Next(4) == 0) flag23 = false; } if (sItem.thrown) { if (this.thrownCost50 && Main.rand.Next(100) < 50) flag23 = false; if (this.thrownCost33 && Main.rand.Next(100) < 33) flag23 = false; } if (sItem.type >= 71 && sItem.type <= 74) flag23 = true; if (flag23) { if (sItem.stack > 0) --sItem.stack; if (sItem.stack <= 0) { this.itemTime = this.itemAnimation; Main.blockMouse = true; } } } if (sItem.stack <= 0 && this.itemAnimation == 0) this.inventory[this.selectedItem] = new Item(); if (this.selectedItem != 58 || this.itemAnimation == 0) return; Main.mouseItem = sItem.Clone(); } public static bool WouldSpotOverlapWithSentry(int worldX, int worldY) { Point point1 = new Point(worldX, worldY - 8); Point point2 = new Point(worldX + 16, worldY - 8); Point point3 = new Point(worldX - 16, worldY - 8); bool flag = false; for (int index = 0; index < 1000; ++index) { Projectile projectile = Main.projectile[index]; if (projectile.active && projectile.sentry) { Microsoft.Xna.Framework.Rectangle hitbox = projectile.Hitbox; if (hitbox.Contains(point1) || hitbox.Contains(point2) || hitbox.Contains(point3)) { flag = true; break; } } } return flag; } public void FindSentryRestingSpot( int checkProj, out int worldX, out int worldY, out int pushYUp) { bool flag = false; int i = (int) ((double) Main.mouseX + (double) Main.screenPosition.X) / 16; int j = (int) ((double) Main.mouseY + (double) Main.screenPosition.Y) / 16; if ((double) this.gravDir == -1.0) j = (int) ((double) Main.screenPosition.Y + (double) Main.screenHeight - (double) Main.mouseY) / 16; worldX = i * 16 + 8; pushYUp = 41; switch (checkProj) { case 663: worldX += this.direction; break; case 665: pushYUp += 2; break; case 667: pushYUp += 3; break; case 677: worldX += this.direction; break; case 678: worldX += this.direction; break; case 691: case 692: case 693: pushYUp = 20; worldX += this.direction; pushYUp += 2; break; } if (!flag) { while (j < Main.maxTilesY - 10 && Main.tile[i, j] != null && !WorldGen.SolidTile2(i, j) && Main.tile[i - 1, j] != null && !WorldGen.SolidTile2(i - 1, j) && Main.tile[i + 1, j] != null && !WorldGen.SolidTile2(i + 1, j)) ++j; ++j; } int num = j - 1; pushYUp -= 14; worldY = num * 16; } public void WipeOldestTurret() { List projectileList = new List(); for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].WipableTurret) projectileList.Add(Main.projectile[index]); } if (projectileList.Count == 0) return; Projectile projectile = projectileList[0]; for (int index = 1; index < projectileList.Count; ++index) { if (projectileList[index].timeLeft < projectile.timeLeft) projectile = projectileList[index]; } projectile.Kill(); } public void UpdateMaxTurrets() { List projectileList = new List(); for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].WipableTurret) projectileList.Add(Main.projectile[index]); } int num = 0; while (projectileList.Count > this.maxTurrets && ++num < 1000) { Projectile projectile = projectileList[0]; for (int index = 1; index < projectileList.Count; ++index) { if (projectileList[index].timeLeft < projectile.timeLeft) projectile = projectileList[index]; } projectile.Kill(); projectileList.Remove(projectile); } } private void ItemCheck_ApplyPetBuffs(Item sItem) { if (this.whoAmI == Main.myPlayer && sItem.type == 603 && Main.cEd) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 669) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 115) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 3060) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 3628) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 3062) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 3577) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 425) { int type = Main.rand.Next(3); if (type == 0) type = 27; if (type == 1) type = 101; if (type == 2) type = 102; for (int b = 0; b < 22; ++b) { if (this.buffType[b] == 27 || this.buffType[b] == 101 || this.buffType[b] == 102) { this.DelBuff(b); --b; } } this.AddBuff(type, 3600); } if (this.whoAmI == Main.myPlayer && sItem.type == 753) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 994) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1169) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1170) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1171) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1172) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1180) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1181) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1182) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1183) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1242) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1157) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1309) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1311) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1837) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1312) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1798) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1799) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1802) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1810) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1927) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 1959) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 2364) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 2365) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 3043) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 2420) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 2535) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 2551) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 2584) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 2587) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 2621) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 2749) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 3249) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 3474) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI == Main.myPlayer && sItem.type == 3531) this.AddBuff(sItem.buffType, 3600); if (this.whoAmI != Main.myPlayer) return; switch (sItem.type) { case 3855: case 3856: case 3857: this.AddBuff(sItem.buffType, 3600); break; } } public float GetWeaponKnockback(Item sItem, float KnockBack) { if (sItem.summon) KnockBack += this.minionKB; if (sItem.melee && this.kbGlove) KnockBack *= 2f; if (this.kbBuff) KnockBack *= 1.5f; if (sItem.ranged && this.shroomiteStealth) KnockBack *= (float) (1.0 + (1.0 - (double) this.stealth) * 0.5); if (sItem.ranged && this.setVortex) KnockBack *= (float) (1.0 + (1.0 - (double) this.stealth) * 0.5); return KnockBack; } public int GetWeaponDamage(Item sItem) { int num = sItem.damage; if (num > 0) { if (sItem.melee) num = (int) ((double) num * (double) this.meleeDamage + 4.99999987368938E-06); else if (sItem.ranged) { num = (int) ((double) num * (double) this.rangedDamage + 4.99999987368938E-06); if (sItem.useAmmo == AmmoID.Arrow || sItem.useAmmo == AmmoID.Stake) num = (int) ((double) num * (double) this.arrowDamage + 4.99999987368938E-06); if (sItem.useAmmo == AmmoID.Bullet || sItem.useAmmo == AmmoID.CandyCorn) num = (int) ((double) num * (double) this.bulletDamage + 4.99999987368938E-06); if (sItem.useAmmo == AmmoID.Rocket || sItem.useAmmo == AmmoID.StyngerBolt || sItem.useAmmo == AmmoID.JackOLantern || sItem.useAmmo == AmmoID.NailFriendly) num = (int) ((double) num * (double) this.rocketDamage + 4.99999987368938E-06); } else if (sItem.thrown) num = (int) ((double) num * (double) this.thrownDamage + 4.99999987368938E-06); else if (sItem.magic) num = (int) ((double) num * (double) this.magicDamage + 4.99999987368938E-06); else if (sItem.summon) num = (int) ((double) num * (double) this.minionDamage); } return num; } private void ApplyAnimation(Item sItem) { if (sItem.melee) { this.itemAnimation = (int) ((double) sItem.useAnimation * (double) this.meleeSpeed); this.itemAnimationMax = (int) ((double) sItem.useAnimation * (double) this.meleeSpeed); } else if (sItem.createTile >= 0) { this.itemAnimation = (int) ((double) sItem.useAnimation * (double) this.tileSpeed); this.itemAnimationMax = (int) ((double) sItem.useAnimation * (double) this.tileSpeed); } else if (sItem.createWall >= 0) { this.itemAnimation = (int) ((double) sItem.useAnimation * (double) this.wallSpeed); this.itemAnimationMax = (int) ((double) sItem.useAnimation * (double) this.wallSpeed); } else { this.itemAnimation = sItem.useAnimation; this.itemAnimationMax = sItem.useAnimation; this.reuseDelay = sItem.reuseDelay; } } public bool HasAmmo(Item sItem, bool canUse) { if (sItem.useAmmo > 0) { canUse = false; for (int index = 0; index < 58; ++index) { if (this.inventory[index].ammo == sItem.useAmmo && this.inventory[index].stack > 0) { canUse = true; break; } } } return canUse; } public void PickAmmo( Item sItem, ref int shoot, ref float speed, ref bool canShoot, ref int Damage, ref float KnockBack, bool dontConsume = false) { Item obj = new Item(); bool flag1 = false; for (int index = 54; index < 58; ++index) { if (this.inventory[index].ammo == sItem.useAmmo && this.inventory[index].stack > 0) { obj = this.inventory[index]; canShoot = true; flag1 = true; break; } } if (!flag1) { for (int index = 0; index < 54; ++index) { if (this.inventory[index].ammo == sItem.useAmmo && this.inventory[index].stack > 0) { obj = this.inventory[index]; canShoot = true; break; } } } if (!canShoot) return; if (sItem.type == 1946) shoot = 338 + obj.type - 771; else if (sItem.useAmmo == AmmoID.Rocket) shoot += obj.shoot; else if (sItem.useAmmo == 780) shoot += obj.shoot; else if (obj.shoot > 0) shoot = obj.shoot; if (sItem.type == 3019 && shoot == 1) shoot = 485; if (sItem.type == 3052) shoot = 495; if (sItem.type == 3245 && shoot == 21) shoot = 532; if (shoot == 42) { if (obj.type == 370) { shoot = 65; Damage += 5; } else if (obj.type == 408) { shoot = 68; Damage += 5; } else if (obj.type == 1246) { shoot = 354; Damage += 5; } } if (this.inventory[this.selectedItem].type == 2888 && shoot == 1) shoot = 469; if (this.magicQuiver && (sItem.useAmmo == AmmoID.Arrow || sItem.useAmmo == AmmoID.Stake)) { KnockBack = (float) (int) ((double) KnockBack * 1.1); speed *= 1.1f; } speed += obj.shootSpeed; if (obj.ranged) { if (obj.damage > 0) Damage += (int) ((double) obj.damage * (double) this.rangedDamage); } else Damage += obj.damage; if (sItem.useAmmo == AmmoID.Arrow && this.archery) { if ((double) speed < 20.0) { speed *= 1.2f; if ((double) speed > 20.0) speed = 20f; } Damage = (int) ((double) Damage * 1.2); } KnockBack += obj.knockBack; bool flag2 = dontConsume; if (sItem.type == 3245) { if (Main.rand.Next(3) == 0) flag2 = true; else if (this.thrownCost33 && Main.rand.Next(100) < 33) flag2 = true; else if (this.thrownCost50 && Main.rand.Next(100) < 50) flag2 = true; } if (sItem.type == 3475 && Main.rand.Next(3) != 0) flag2 = true; if (sItem.type == 3540 && Main.rand.Next(3) != 0) flag2 = true; if (this.magicQuiver && sItem.useAmmo == AmmoID.Arrow && Main.rand.Next(5) == 0) flag2 = true; if (this.ammoBox && Main.rand.Next(5) == 0) flag2 = true; if (this.ammoPotion && Main.rand.Next(5) == 0) flag2 = true; if (sItem.type == 1782 && Main.rand.Next(3) == 0) flag2 = true; if (sItem.type == 98 && Main.rand.Next(3) == 0) flag2 = true; if (sItem.type == 2270 && Main.rand.Next(2) == 0) flag2 = true; if (sItem.type == 533 && Main.rand.Next(2) == 0) flag2 = true; if (sItem.type == 1929 && Main.rand.Next(2) == 0) flag2 = true; if (sItem.type == 1553 && Main.rand.Next(2) == 0) flag2 = true; if (sItem.type == 434 && this.itemAnimation < sItem.useAnimation - 2) flag2 = true; if (this.ammoCost80 && Main.rand.Next(5) == 0) flag2 = true; if (this.ammoCost75 && Main.rand.Next(4) == 0) flag2 = true; if (shoot == 85 && this.itemAnimation < this.itemAnimationMax - 6) flag2 = true; if ((shoot == 145 || shoot == 146 || shoot == 147 || shoot == 148 || shoot == 149) && this.itemAnimation < this.itemAnimationMax - 5) flag2 = true; if (flag2 || !obj.consumable) return; --obj.stack; if (obj.stack > 0) return; obj.active = false; obj.TurnToAir(); } public void PickTile(int x, int y, int pickPower) { int num1 = 0; int tileId = this.hitTile.HitObject(x, y, 1); Tile tile = Main.tile[x, y]; if (Main.tileNoFail[(int) tile.type]) num1 = 100; int damageAmount = Main.tileDungeon[(int) tile.type] || tile.type == (ushort) 25 || tile.type == (ushort) 58 || tile.type == (ushort) 117 || tile.type == (ushort) 203 ? num1 + pickPower / 2 : (tile.type == (ushort) 48 || tile.type == (ushort) 232 ? num1 + pickPower / 4 : (tile.type != (ushort) 226 ? (tile.type == (ushort) 107 || tile.type == (ushort) 221 ? num1 + pickPower / 2 : (tile.type == (ushort) 108 || tile.type == (ushort) 222 ? num1 + pickPower / 3 : (tile.type == (ushort) 111 || tile.type == (ushort) 223 ? num1 + pickPower / 4 : (tile.type != (ushort) 211 ? num1 + pickPower : num1 + pickPower / 5)))) : num1 + pickPower / 4)); if (tile.type == (ushort) 211 && pickPower < 200) damageAmount = 0; if ((tile.type == (ushort) 25 || tile.type == (ushort) 203) && pickPower < 65) damageAmount = 0; else if (tile.type == (ushort) 117 && pickPower < 65) damageAmount = 0; else if (tile.type == (ushort) 37 && pickPower < 50) damageAmount = 0; else if (tile.type == (ushort) 404 && pickPower < 65) damageAmount = 0; else if ((tile.type == (ushort) 22 || tile.type == (ushort) 204) && (double) y > Main.worldSurface && pickPower < 55) damageAmount = 0; else if (tile.type == (ushort) 56 && pickPower < 65) damageAmount = 0; else if (tile.type == (ushort) 58 && pickPower < 65) damageAmount = 0; else if ((tile.type == (ushort) 226 || tile.type == (ushort) 237) && pickPower < 210) damageAmount = 0; else if (Main.tileDungeon[(int) tile.type] && pickPower < 65) { if ((double) x < (double) Main.maxTilesX * 0.35 || (double) x > (double) Main.maxTilesX * 0.65) damageAmount = 0; } else if (tile.type == (ushort) 107 && pickPower < 100) damageAmount = 0; else if (tile.type == (ushort) 108 && pickPower < 110) damageAmount = 0; else if (tile.type == (ushort) 111 && pickPower < 150) damageAmount = 0; else if (tile.type == (ushort) 221 && pickPower < 100) damageAmount = 0; else if (tile.type == (ushort) 222 && pickPower < 110) damageAmount = 0; else if (tile.type == (ushort) 223 && pickPower < 150) damageAmount = 0; if (tile.type == (ushort) 147 || tile.type == (ushort) 0 || tile.type == (ushort) 40 || tile.type == (ushort) 53 || tile.type == (ushort) 57 || tile.type == (ushort) 59 || tile.type == (ushort) 123 || tile.type == (ushort) 224 || tile.type == (ushort) 397) damageAmount += pickPower; if (tile.type == (ushort) 165 || Main.tileRope[(int) tile.type] || tile.type == (ushort) 199 || Main.tileMoss[(int) tile.type]) damageAmount = 100; if (this.hitTile.AddDamage(tileId, damageAmount, false) >= 100 && (tile.type == (ushort) 2 || tile.type == (ushort) 23 || tile.type == (ushort) 60 || tile.type == (ushort) 70 || tile.type == (ushort) 109 || tile.type == (ushort) 199 || Main.tileMoss[(int) tile.type])) damageAmount = 0; if (tile.type == (ushort) 128 || tile.type == (ushort) 269) { if (tile.frameX == (short) 18 || tile.frameX == (short) 54) { --x; tile = Main.tile[x, y]; this.hitTile.UpdatePosition(tileId, x, y); } if (tile.frameX >= (short) 100) { damageAmount = 0; Main.blockMouse = true; } } if (tile.type == (ushort) 334) { if (tile.frameY == (short) 0) { ++y; tile = Main.tile[x, y]; this.hitTile.UpdatePosition(tileId, x, y); } if (tile.frameY == (short) 36) { --y; tile = Main.tile[x, y]; this.hitTile.UpdatePosition(tileId, x, y); } int frameX1 = (int) tile.frameX; bool flag1 = frameX1 >= 5000; bool flag2 = false; if (!flag1) { int num2 = frameX1 / 18 % 3; x -= num2; tile = Main.tile[x, y]; if (tile.frameX >= (short) 5000) flag1 = true; } if (flag1) { int frameX2 = (int) tile.frameX; int num3 = 0; while (frameX2 >= 5000) { frameX2 -= 5000; ++num3; } if (num3 != 0) flag2 = true; } if (flag2) { damageAmount = 0; Main.blockMouse = true; } } if (!WorldGen.CanKillTile(x, y)) damageAmount = 0; if (this.hitTile.AddDamage(tileId, damageAmount) >= 100) { AchievementsHelper.CurrentlyMining = true; this.hitTile.Clear(tileId); if (Main.netMode == 1 && Main.tileContainer[(int) Main.tile[x, y].type]) { WorldGen.KillTile(x, y, true); NetMessage.SendData(17, number2: ((float) x), number3: ((float) y), number4: 1f); if (Main.tile[x, y].type == (ushort) 21) NetMessage.SendData(34, number: 1, number2: ((float) x), number3: ((float) y)); if (Main.tile[x, y].type == (ushort) 467) NetMessage.SendData(34, number: 5, number2: ((float) x), number3: ((float) y)); if (Main.tile[x, y].type == (ushort) 88) NetMessage.SendData(34, number: 3, number2: ((float) x), number3: ((float) y)); } else { int j = y; int num4 = Main.tile[x, j].active() ? 1 : 0; WorldGen.KillTile(x, j); if (num4 != 0 && !Main.tile[x, j].active()) AchievementsHelper.HandleMining(); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) x), number3: ((float) j)); } AchievementsHelper.CurrentlyMining = false; } else { WorldGen.KillTile(x, y, true); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) x), number3: ((float) y), number4: 1f); } if (damageAmount == 0) return; this.hitTile.Prune(); } public bool ItemFitsWeaponRack(Item i) { bool flag = false; if (i.fishingPole > 0) flag = true; switch (i.netID) { case 905: case 1326: flag = true; break; } return i.damage > 0 | flag && i.useStyle > 0 && i.stack > 0; } public void PlaceWeapon(int x, int y) { if (!Main.tile[x, y].active() || Main.tile[x, y].type != (ushort) 334) return; int frameY = (int) Main.tile[x, y].frameY; int num1 = 1; int num2; for (num2 = frameY / 18; num1 > num2; num2 = (int) Main.tile[x, y].frameY / 18) ++y; for (; num1 < num2; num2 = (int) Main.tile[x, y].frameY / 18) --y; int num3 = (int) Main.tile[x, y].frameX; int num4 = 0; while (num3 >= 5000) { num3 -= 5000; ++num4; } if (num4 != 0) num3 = (num4 - 1) * 18; bool flag = false; if (num3 >= 54) { num3 -= 54; flag = true; } x -= num3 / 18; int frameX = (int) Main.tile[x, y].frameX; WorldGen.KillTile(x, y, true); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) x), number3: ((float) y), number4: 1f); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) (x + 1)), number3: ((float) y), number4: 1f); while (frameX >= 5000) frameX -= 5000; Main.blockMouse = true; int num5 = 5000; int num6 = 10000; if (flag) { num5 = 20000; num6 = 25000; } Main.tile[x, y].frameX = (short) (this.inventory[this.selectedItem].netID + num5 + 100); Main.tile[x + 1, y].frameX = (short) ((int) this.inventory[this.selectedItem].prefix + num6); if (Main.netMode == 1) NetMessage.SendTileSquare(-1, x, y, 1); if (Main.netMode == 1) NetMessage.SendTileSquare(-1, x + 1, y, 1); --this.inventory[this.selectedItem].stack; if (this.inventory[this.selectedItem].stack <= 0) { this.inventory[this.selectedItem].SetDefaults(); Main.mouseItem.SetDefaults(); } if (this.selectedItem == 58) Main.mouseItem = this.inventory[this.selectedItem].Clone(); this.releaseUseItem = false; this.mouseInterface = true; } public bool ItemFitsItemFrame(Item i) => i.stack > 0; public void PlaceItemInFrame(int x, int y) { if ((int) Main.tile[x, y].frameX % 36 != 0) --x; if ((int) Main.tile[x, y].frameY % 36 != 0) --y; int key = TEItemFrame.Find(x, y); if (key == -1) return; if (((TEItemFrame) TileEntity.ByID[key]).item.stack > 0) { WorldGen.KillTile(x, y, true); if (Main.netMode == 1) NetMessage.SendData(17, number2: ((float) Player.tileTargetX), number3: ((float) y), number4: 1f); } if (Main.netMode == 1) NetMessage.SendData(89, number: x, number2: ((float) y), number3: ((float) this.selectedItem), number4: ((float) this.whoAmI)); else TEItemFrame.TryPlacing(x, y, this.inventory[this.selectedItem].netID, (int) this.inventory[this.selectedItem].prefix, this.inventory[this.selectedItem].stack); --this.inventory[this.selectedItem].stack; if (this.inventory[this.selectedItem].stack <= 0) { this.inventory[this.selectedItem].SetDefaults(); Main.mouseItem.SetDefaults(); } if (this.selectedItem == 58) Main.mouseItem = this.inventory[this.selectedItem].Clone(); this.releaseUseItem = false; this.mouseInterface = true; } public Color GetImmuneAlpha(Color newColor, float alphaReduction) { float scale = (float) ((int) byte.MaxValue - this.immuneAlpha) / (float) byte.MaxValue; if ((double) alphaReduction > 0.0) scale *= 1f - alphaReduction; return this.immuneAlpha > 125 ? Color.Transparent : Color.Multiply(newColor, scale); } public Color GetImmuneAlphaPure(Color newColor, float alphaReduction) { float scale = (float) ((int) byte.MaxValue - this.immuneAlpha) / (float) byte.MaxValue; if ((double) alphaReduction > 0.0) scale *= 1f - alphaReduction; return Color.Multiply(newColor, scale); } public Color GetDeathAlpha(Color newColor) { int r = (int) newColor.R + (int) ((double) this.immuneAlpha * 0.9); int num1 = (int) newColor.G + (int) ((double) this.immuneAlpha * 0.5); int num2 = (int) newColor.B + (int) ((double) this.immuneAlpha * 0.5); int num3 = (int) newColor.A + (int) ((double) this.immuneAlpha * 0.4); if (num3 < 0) num3 = 0; if (num3 > (int) byte.MaxValue) num3 = (int) byte.MaxValue; int g = num1; int b = num2; int a = num3; return new Color(r, g, b, a); } public void addDPS(int dmg) { if (this.dpsStarted) { this.dpsLastHit = DateTime.Now; this.dpsDamage += dmg; this.dpsEnd = DateTime.Now; } else { this.dpsStarted = true; this.dpsStart = DateTime.Now; this.dpsEnd = DateTime.Now; this.dpsLastHit = DateTime.Now; this.dpsDamage = dmg; } } public void checkDPSTime() { int num = 3; if (!this.dpsStarted || (DateTime.Now - this.dpsLastHit).Seconds < num) return; this.dpsStarted = false; } public int getDPS() { TimeSpan timeSpan1 = this.dpsEnd - this.dpsStart; float num = (float) timeSpan1.Milliseconds / 1000f + (float) timeSpan1.Seconds + (float) timeSpan1.Minutes / 60f; if ((double) num >= 3.0) { this.dpsStart = DateTime.Now; this.dpsStart = this.dpsStart.AddSeconds(-1.0); this.dpsDamage = (int) ((double) this.dpsDamage / (double) num); TimeSpan timeSpan2 = this.dpsEnd - this.dpsStart; num = (float) timeSpan2.Milliseconds / 1000f + (float) timeSpan2.Seconds + (float) timeSpan2.Minutes / 60f; } if ((double) num < 1.0) num = 1f; return (int) ((double) this.dpsDamage / (double) num); } public int DropCoins() { int num1 = 0; for (int index = 0; index < 59; ++index) { if (this.inventory[index].type >= 71 && this.inventory[index].type <= 74) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, this.inventory[index].type); int num2 = this.inventory[index].stack / 2; if (Main.expertMode) num2 = (int) ((double) this.inventory[index].stack * 0.25); int num3 = this.inventory[index].stack - num2; this.inventory[index].stack -= num3; if (this.inventory[index].type == 71) num1 += num3; if (this.inventory[index].type == 72) num1 += num3 * 100; if (this.inventory[index].type == 73) num1 += num3 * 10000; if (this.inventory[index].type == 74) num1 += num3 * 1000000; if (this.inventory[index].stack <= 0) this.inventory[index] = new Item(); Main.item[number].stack = num3; Main.item[number].velocity.Y = (float) Main.rand.Next(-20, 1) * 0.2f; Main.item[number].velocity.X = (float) Main.rand.Next(-20, 21) * 0.2f; Main.item[number].noGrabDelay = 100; if (Main.netMode == 1) NetMessage.SendData(21, number: number); if (index == 58) Main.mouseItem = this.inventory[index].Clone(); } } this.lostCoins = num1; this.lostCoinString = Main.ValueToCoins(this.lostCoins); return num1; } public void DropItems() { for (int index = 0; index < 59; ++index) { if (this.inventory[index].stack > 0 && this.inventory[index].Name != "Copper Pickaxe" && this.inventory[index].Name != "Copper Axe" && this.inventory[index].Name != "Copper Shortsword") { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, this.inventory[index].type); Main.item[number].netDefaults(this.inventory[index].netID); Main.item[number].Prefix((int) this.inventory[index].prefix); Main.item[number].stack = this.inventory[index].stack; Main.item[number].velocity.Y = (float) Main.rand.Next(-20, 1) * 0.2f; Main.item[number].velocity.X = (float) Main.rand.Next(-20, 21) * 0.2f; Main.item[number].noGrabDelay = 100; Main.item[number].newAndShiny = false; if (Main.netMode == 1) NetMessage.SendData(21, number: number); } this.inventory[index] = new Item(); if (index < this.armor.Length) { if (this.armor[index].stack > 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, this.armor[index].type); Main.item[number].netDefaults(this.armor[index].netID); Main.item[number].Prefix((int) this.armor[index].prefix); Main.item[number].stack = this.armor[index].stack; Main.item[number].velocity.Y = (float) Main.rand.Next(-20, 1) * 0.2f; Main.item[number].velocity.X = (float) Main.rand.Next(-20, 21) * 0.2f; Main.item[number].noGrabDelay = 100; Main.item[number].newAndShiny = false; if (Main.netMode == 1) NetMessage.SendData(21, number: number); } this.armor[index] = new Item(); } if (index < this.dye.Length) { if (this.dye[index].stack > 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, this.dye[index].type); Main.item[number].netDefaults(this.dye[index].netID); Main.item[number].Prefix((int) this.dye[index].prefix); Main.item[number].stack = this.dye[index].stack; Main.item[number].velocity.Y = (float) Main.rand.Next(-20, 1) * 0.2f; Main.item[number].velocity.X = (float) Main.rand.Next(-20, 21) * 0.2f; Main.item[number].noGrabDelay = 100; Main.item[number].newAndShiny = false; if (Main.netMode == 1) NetMessage.SendData(21, number: number); } this.dye[index] = new Item(); } if (index < this.miscEquips.Length) { if (this.miscEquips[index].stack > 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, this.miscEquips[index].type); Main.item[number].netDefaults(this.miscEquips[index].netID); Main.item[number].Prefix((int) this.miscEquips[index].prefix); Main.item[number].stack = this.miscEquips[index].stack; Main.item[number].velocity.Y = (float) Main.rand.Next(-20, 1) * 0.2f; Main.item[number].velocity.X = (float) Main.rand.Next(-20, 21) * 0.2f; Main.item[number].noGrabDelay = 100; Main.item[number].newAndShiny = false; if (Main.netMode == 1) NetMessage.SendData(21, number: number); } this.miscEquips[index] = new Item(); } if (index < this.miscDyes.Length) { if (this.miscDyes[index].stack > 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, this.miscDyes[index].type); Main.item[number].netDefaults(this.miscDyes[index].netID); Main.item[number].Prefix((int) this.miscDyes[index].prefix); Main.item[number].stack = this.miscDyes[index].stack; Main.item[number].velocity.Y = (float) Main.rand.Next(-20, 1) * 0.2f; Main.item[number].velocity.X = (float) Main.rand.Next(-20, 21) * 0.2f; Main.item[number].noGrabDelay = 100; Main.item[number].newAndShiny = false; if (Main.netMode == 1) NetMessage.SendData(21, number: number); } this.miscDyes[index] = new Item(); } } this.inventory[0].SetDefaults(3507); this.inventory[0].Prefix(-1); this.inventory[1].SetDefaults(3509); this.inventory[1].Prefix(-1); this.inventory[2].SetDefaults(3506); this.inventory[2].Prefix(-1); Main.mouseItem = new Item(); } public object Clone() => this.MemberwiseClone(); public object clientClone() { Player player = new Player(); player.zone1 = this.zone1; player.zone2 = this.zone2; player.zone3 = this.zone3; player.zone4 = this.zone4; player.extraAccessory = this.extraAccessory; player.MinionRestTargetPoint = this.MinionRestTargetPoint; player.MinionAttackTargetNPC = this.MinionAttackTargetNPC; player.direction = this.direction; player.selectedItem = this.selectedItem; player.controlUp = this.controlUp; player.controlDown = this.controlDown; player.controlLeft = this.controlLeft; player.controlRight = this.controlRight; player.controlJump = this.controlJump; player.controlUseItem = this.controlUseItem; player.statLife = this.statLife; player.statLifeMax = this.statLifeMax; player.statMana = this.statMana; player.statManaMax = this.statManaMax; player.position.X = this.position.X; player.chest = this.chest; player.talkNPC = this.talkNPC; player.hideVisual = this.hideVisual; player.hideMisc = this.hideMisc; for (int index = 0; index < 59; ++index) { player.inventory[index] = this.inventory[index].Clone(); if (index < this.armor.Length) player.armor[index] = this.armor[index].Clone(); if (index < this.dye.Length) player.dye[index] = this.dye[index].Clone(); if (index < this.miscEquips.Length) player.miscEquips[index] = this.miscEquips[index].Clone(); if (index < this.miscDyes.Length) player.miscDyes[index] = this.miscDyes[index].Clone(); if (index < this.bank.item.Length) player.bank.item[index] = this.bank.item[index].Clone(); if (index < this.bank2.item.Length) player.bank2.item[index] = this.bank2.item[index].Clone(); if (index < this.bank3.item.Length) player.bank3.item[index] = this.bank3.item[index].Clone(); } player.trashItem = this.trashItem.Clone(); for (int index = 0; index < 22; ++index) { player.buffType[index] = this.buffType[index]; player.buffTime[index] = this.buffTime[index]; } this.DpadRadial.CopyTo(player.DpadRadial); this.CircularRadial.CopyTo(player.CircularRadial); return (object) player; } public static bool CheckSpawn(int x, int y) { if (x < 10 || x > Main.maxTilesX - 10 || y < 10 || y > Main.maxTilesX - 10 || Main.tile[x, y - 1] == null || !Main.tile[x, y - 1].active() || Main.tile[x, y - 1].type != (ushort) 79) return false; for (int index1 = x - 1; index1 <= x + 1; ++index1) { for (int index2 = y - 3; index2 < y; ++index2) { if (Main.tile[index1, index2] == null) return false; if (Main.tile[index1, index2].nactive() && Main.tileSolid[(int) Main.tile[index1, index2].type] && !Main.tileSolidTop[(int) Main.tile[index1, index2].type]) { Main.NewText(Language.GetTextValue("Game.BedObstructed"), G: (byte) 240, B: (byte) 20); return false; } } } return WorldGen.StartRoomCheck(x, y - 1); } public void FindSpawn() { for (int index = 0; index < 200; ++index) { if (this.spN[index] == null) { this.SpawnX = -1; this.SpawnY = -1; break; } if (this.spN[index] == Main.worldName && this.spI[index] == Main.worldID) { this.SpawnX = this.spX[index]; this.SpawnY = this.spY[index]; break; } } } public void RemoveSpawn() { this.SpawnX = -1; this.SpawnY = -1; for (int index1 = 0; index1 < 200 && this.spN[index1] != null; ++index1) { if (this.spN[index1] == Main.worldName && this.spI[index1] == Main.worldID) { for (int index2 = index1; index2 < 199; ++index2) { this.spN[index2] = this.spN[index2 + 1]; this.spI[index2] = this.spI[index2 + 1]; this.spX[index2] = this.spX[index2 + 1]; this.spY[index2] = this.spY[index2 + 1]; } this.spN[199] = (string) null; this.spI[199] = 0; this.spX[199] = 0; this.spY[199] = 0; break; } } } public void ChangeSpawn(int x, int y) { for (int index1 = 0; index1 < 200 && this.spN[index1] != null; ++index1) { if (this.spN[index1] == Main.worldName && this.spI[index1] == Main.worldID) { for (int index2 = index1; index2 > 0; --index2) { this.spN[index2] = this.spN[index2 - 1]; this.spI[index2] = this.spI[index2 - 1]; this.spX[index2] = this.spX[index2 - 1]; this.spY[index2] = this.spY[index2 - 1]; } this.spN[0] = Main.worldName; this.spI[0] = Main.worldID; this.spX[0] = x; this.spY[0] = y; return; } } for (int index = 199; index > 0; --index) { if (this.spN[index - 1] != null) { this.spN[index] = this.spN[index - 1]; this.spI[index] = this.spI[index - 1]; this.spX[index] = this.spX[index - 1]; this.spY[index] = this.spY[index - 1]; } } this.spN[0] = Main.worldName; this.spI[0] = Main.worldID; this.spX[0] = x; this.spY[0] = y; } public static void SavePlayer(PlayerFileData playerFile, bool skipMapSave = false) { Main.Achievements.Save(); string path = playerFile.Path; Player player = playerFile.Player; bool isCloudSave = playerFile.IsCloudSave; if (!skipMapSave) { if (!string.IsNullOrEmpty(Main.playerPathName)) { try { if (Main.mapEnabled) Main.Map.Save(); } catch { } try { if (!isCloudSave) Directory.CreateDirectory(Main.PlayerPath); } catch { } } } if (Main.ServerSideCharacter || path == null || path == "") return; if (FileUtilities.Exists(path, isCloudSave)) FileUtilities.Copy(path, path + ".bak", isCloudSave); RijndaelManaged rijndaelManaged = new RijndaelManaged(); using (Stream stream = isCloudSave ? (Stream) new MemoryStream(2000) : (Stream) new FileStream(path, FileMode.Create)) { using (CryptoStream cryptoStream = new CryptoStream(stream, rijndaelManaged.CreateEncryptor(Player.ENCRYPTION_KEY, Player.ENCRYPTION_KEY), CryptoStreamMode.Write)) { using (BinaryWriter writer = new BinaryWriter((Stream) cryptoStream)) { writer.Write(194); playerFile.Metadata.Write(writer); writer.Write(player.name); writer.Write(player.difficulty); writer.Write(playerFile.GetPlayTime().Ticks); writer.Write(player.hair); writer.Write(player.hairDye); BitsByte bitsByte1 = (BitsByte) (byte) 0; for (int key = 0; key < 8; ++key) bitsByte1[key] = player.hideVisual[key]; writer.Write((byte) bitsByte1); BitsByte bitsByte2 = (BitsByte) (byte) 0; for (int key = 0; key < 2; ++key) bitsByte2[key] = player.hideVisual[key + 8]; writer.Write((byte) bitsByte2); writer.Write((byte) player.hideMisc); writer.Write((byte) player.skinVariant); writer.Write(player.statLife); writer.Write(player.statLifeMax); writer.Write(player.statMana); writer.Write(player.statManaMax); writer.Write(player.extraAccessory); writer.Write(player.downedDD2EventAnyDifficulty); writer.Write(player.taxMoney); writer.Write(player.hairColor.R); writer.Write(player.hairColor.G); writer.Write(player.hairColor.B); writer.Write(player.skinColor.R); writer.Write(player.skinColor.G); writer.Write(player.skinColor.B); writer.Write(player.eyeColor.R); writer.Write(player.eyeColor.G); writer.Write(player.eyeColor.B); writer.Write(player.shirtColor.R); writer.Write(player.shirtColor.G); writer.Write(player.shirtColor.B); writer.Write(player.underShirtColor.R); writer.Write(player.underShirtColor.G); writer.Write(player.underShirtColor.B); writer.Write(player.pantsColor.R); writer.Write(player.pantsColor.G); writer.Write(player.pantsColor.B); writer.Write(player.shoeColor.R); writer.Write(player.shoeColor.G); writer.Write(player.shoeColor.B); for (int index = 0; index < player.armor.Length; ++index) { writer.Write(player.armor[index].netID); writer.Write(player.armor[index].prefix); } for (int index = 0; index < player.dye.Length; ++index) { writer.Write(player.dye[index].netID); writer.Write(player.dye[index].prefix); } for (int index = 0; index < 58; ++index) { writer.Write(player.inventory[index].netID); writer.Write(player.inventory[index].stack); writer.Write(player.inventory[index].prefix); writer.Write(player.inventory[index].favorited); } for (int index = 0; index < player.miscEquips.Length; ++index) { writer.Write(player.miscEquips[index].netID); writer.Write(player.miscEquips[index].prefix); writer.Write(player.miscDyes[index].netID); writer.Write(player.miscDyes[index].prefix); } for (int index = 0; index < 40; ++index) { writer.Write(player.bank.item[index].netID); writer.Write(player.bank.item[index].stack); writer.Write(player.bank.item[index].prefix); } for (int index = 0; index < 40; ++index) { writer.Write(player.bank2.item[index].netID); writer.Write(player.bank2.item[index].stack); writer.Write(player.bank2.item[index].prefix); } for (int index = 0; index < 40; ++index) { writer.Write(player.bank3.item[index].netID); writer.Write(player.bank3.item[index].stack); writer.Write(player.bank3.item[index].prefix); } for (int index = 0; index < 22; ++index) { if (Main.buffNoSave[player.buffType[index]]) { writer.Write(0); writer.Write(0); } else { writer.Write(player.buffType[index]); writer.Write(player.buffTime[index]); } } for (int index = 0; index < 200; ++index) { if (player.spN[index] == null) { writer.Write(-1); break; } writer.Write(player.spX[index]); writer.Write(player.spY[index]); writer.Write(player.spI[index]); writer.Write(player.spN[index]); } writer.Write(player.hbLocked); for (int index = 0; index < player.hideInfo.Length; ++index) writer.Write(player.hideInfo[index]); writer.Write(player.anglerQuestsFinished); for (int index = 0; index < player.DpadRadial.Bindings.Length; ++index) writer.Write(player.DpadRadial.Bindings[index]); for (int index = 0; index < player.builderAccStatus.Length; ++index) writer.Write(player.builderAccStatus[index]); writer.Write(player.bartenderQuestLog); writer.Flush(); cryptoStream.FlushFinalBlock(); stream.Flush(); if (!isCloudSave || SocialAPI.Cloud == null) return; SocialAPI.Cloud.Write(playerFile.Path, ((MemoryStream) stream).ToArray()); } } } } public static PlayerFileData LoadPlayer(string playerPath, bool cloudSave) { PlayerFileData playerFileData = new PlayerFileData(playerPath, cloudSave); if (cloudSave && SocialAPI.Cloud == null) return playerFileData; if (Main.rand == null) Main.rand = new UnifiedRandom((int) DateTime.Now.Ticks); Player player1 = new Player(); try { RijndaelManaged rijndaelManaged = new RijndaelManaged(); rijndaelManaged.Padding = PaddingMode.None; using (MemoryStream memoryStream = new MemoryStream(FileUtilities.ReadAllBytes(playerPath, cloudSave))) { using (CryptoStream cryptoStream = new CryptoStream((Stream) memoryStream, rijndaelManaged.CreateDecryptor(Player.ENCRYPTION_KEY, Player.ENCRYPTION_KEY), CryptoStreamMode.Read)) { using (BinaryReader binaryReader = new BinaryReader((Stream) cryptoStream)) { int release = binaryReader.ReadInt32(); if (release >= 135) playerFileData.Metadata = FileMetadata.Read(binaryReader, FileType.Player); else playerFileData.Metadata = FileMetadata.FromCurrentSettings(FileType.Player); if (release > 194) { player1.loadStatus = 1; player1.name = binaryReader.ReadString(); playerFileData.Player = player1; return playerFileData; } player1.name = binaryReader.ReadString(); if (release >= 10) { if (release >= 17) player1.difficulty = binaryReader.ReadByte(); else if (binaryReader.ReadBoolean()) player1.difficulty = (byte) 2; } if (release >= 138) playerFileData.SetPlayTime(new TimeSpan(binaryReader.ReadInt64())); else playerFileData.SetPlayTime(TimeSpan.Zero); player1.hair = binaryReader.ReadInt32(); if (release >= 82) player1.hairDye = binaryReader.ReadByte(); if (release >= 124) { BitsByte bitsByte = (BitsByte) binaryReader.ReadByte(); for (int key = 0; key < 8; ++key) player1.hideVisual[key] = bitsByte[key]; bitsByte = (BitsByte) binaryReader.ReadByte(); for (int key = 0; key < 2; ++key) player1.hideVisual[key + 8] = bitsByte[key]; } else if (release >= 83) { BitsByte bitsByte = (BitsByte) binaryReader.ReadByte(); for (int key = 0; key < 8; ++key) player1.hideVisual[key] = bitsByte[key]; } if (release >= 119) player1.hideMisc = (BitsByte) binaryReader.ReadByte(); if (release <= 17) player1.Male = player1.hair != 5 && player1.hair != 6 && player1.hair != 9 && player1.hair != 11; else if (release < 107) player1.Male = binaryReader.ReadBoolean(); else player1.skinVariant = (int) binaryReader.ReadByte(); if (release < 161 && player1.skinVariant == 7) player1.skinVariant = 9; player1.statLife = binaryReader.ReadInt32(); player1.statLifeMax = binaryReader.ReadInt32(); if (player1.statLifeMax > 500) player1.statLifeMax = 500; player1.statMana = binaryReader.ReadInt32(); player1.statManaMax = binaryReader.ReadInt32(); if (player1.statManaMax > 200) player1.statManaMax = 200; if (player1.statMana > 400) player1.statMana = 400; if (release >= 125) player1.extraAccessory = binaryReader.ReadBoolean(); if (release >= 182) player1.downedDD2EventAnyDifficulty = binaryReader.ReadBoolean(); if (release >= 128) player1.taxMoney = binaryReader.ReadInt32(); player1.hairColor = binaryReader.ReadRGB(); player1.skinColor = binaryReader.ReadRGB(); player1.eyeColor = binaryReader.ReadRGB(); player1.shirtColor = binaryReader.ReadRGB(); player1.underShirtColor = binaryReader.ReadRGB(); player1.pantsColor = binaryReader.ReadRGB(); player1.shoeColor = binaryReader.ReadRGB(); Main.player[Main.myPlayer].shirtColor = player1.shirtColor; Main.player[Main.myPlayer].pantsColor = player1.pantsColor; Main.player[Main.myPlayer].hairColor = player1.hairColor; if (release >= 38) { if (release < 124) { int num = 11; if (release >= 81) num = 16; for (int index1 = 0; index1 < num; ++index1) { int index2 = index1; if (index2 >= 8) index2 += 2; player1.armor[index2].netDefaults(binaryReader.ReadInt32()); player1.armor[index2].Prefix((int) binaryReader.ReadByte()); } } else { int num = 20; for (int index = 0; index < num; ++index) { player1.armor[index].netDefaults(binaryReader.ReadInt32()); player1.armor[index].Prefix((int) binaryReader.ReadByte()); } } if (release >= 47) { int num = 3; if (release >= 81) num = 8; if (release >= 124) num = 10; for (int index3 = 0; index3 < num; ++index3) { int index4 = index3; player1.dye[index4].netDefaults(binaryReader.ReadInt32()); player1.dye[index4].Prefix((int) binaryReader.ReadByte()); } } if (release >= 58) { for (int index = 0; index < 58; ++index) { int type = binaryReader.ReadInt32(); if (type >= 3930) { player1.inventory[index].netDefaults(0); binaryReader.ReadInt32(); int num = (int) binaryReader.ReadByte(); if (release >= 114) binaryReader.ReadBoolean(); } else { player1.inventory[index].netDefaults(type); player1.inventory[index].stack = binaryReader.ReadInt32(); player1.inventory[index].Prefix((int) binaryReader.ReadByte()); if (release >= 114) player1.inventory[index].favorited = binaryReader.ReadBoolean(); } } } else { for (int index = 0; index < 48; ++index) { int type = binaryReader.ReadInt32(); if (type >= 3930) { player1.inventory[index].netDefaults(0); binaryReader.ReadInt32(); int num = (int) binaryReader.ReadByte(); } else { player1.inventory[index].netDefaults(type); player1.inventory[index].stack = binaryReader.ReadInt32(); player1.inventory[index].Prefix((int) binaryReader.ReadByte()); } } } if (release >= 117) { if (release < 136) { for (int index = 0; index < 5; ++index) { if (index != 1) { int type1 = binaryReader.ReadInt32(); if (type1 >= 3930) { player1.miscEquips[index].netDefaults(0); int num = (int) binaryReader.ReadByte(); } else { player1.miscEquips[index].netDefaults(type1); player1.miscEquips[index].Prefix((int) binaryReader.ReadByte()); } int type2 = binaryReader.ReadInt32(); if (type2 >= 3930) { player1.miscDyes[index].netDefaults(0); int num = (int) binaryReader.ReadByte(); } else { player1.miscDyes[index].netDefaults(type2); player1.miscDyes[index].Prefix((int) binaryReader.ReadByte()); } } } } else { for (int index = 0; index < 5; ++index) { int type3 = binaryReader.ReadInt32(); if (type3 >= 3930) { player1.miscEquips[index].netDefaults(0); int num = (int) binaryReader.ReadByte(); } else { player1.miscEquips[index].netDefaults(type3); player1.miscEquips[index].Prefix((int) binaryReader.ReadByte()); } int type4 = binaryReader.ReadInt32(); if (type4 >= 3930) { player1.miscDyes[index].netDefaults(0); int num = (int) binaryReader.ReadByte(); } else { player1.miscDyes[index].netDefaults(type4); player1.miscDyes[index].Prefix((int) binaryReader.ReadByte()); } } } } if (release >= 58) { for (int index = 0; index < 40; ++index) { player1.bank.item[index].netDefaults(binaryReader.ReadInt32()); player1.bank.item[index].stack = binaryReader.ReadInt32(); player1.bank.item[index].Prefix((int) binaryReader.ReadByte()); } for (int index = 0; index < 40; ++index) { player1.bank2.item[index].netDefaults(binaryReader.ReadInt32()); player1.bank2.item[index].stack = binaryReader.ReadInt32(); player1.bank2.item[index].Prefix((int) binaryReader.ReadByte()); } } else { for (int index = 0; index < 20; ++index) { player1.bank.item[index].netDefaults(binaryReader.ReadInt32()); player1.bank.item[index].stack = binaryReader.ReadInt32(); player1.bank.item[index].Prefix((int) binaryReader.ReadByte()); } for (int index = 0; index < 20; ++index) { player1.bank2.item[index].netDefaults(binaryReader.ReadInt32()); player1.bank2.item[index].stack = binaryReader.ReadInt32(); player1.bank2.item[index].Prefix((int) binaryReader.ReadByte()); } } if (release >= 182) { for (int index = 0; index < 40; ++index) { player1.bank3.item[index].netDefaults(binaryReader.ReadInt32()); player1.bank3.item[index].stack = binaryReader.ReadInt32(); player1.bank3.item[index].Prefix((int) binaryReader.ReadByte()); } } } else { for (int index = 0; index < 8; ++index) { player1.armor[index].SetDefaults((int) ItemID.FromLegacyName(binaryReader.ReadString(), release)); if (release >= 36) player1.armor[index].Prefix((int) binaryReader.ReadByte()); } if (release >= 6) { for (int index = 8; index < 11; ++index) { player1.armor[index].SetDefaults((int) ItemID.FromLegacyName(binaryReader.ReadString(), release)); if (release >= 36) player1.armor[index].Prefix((int) binaryReader.ReadByte()); } } for (int index = 0; index < 44; ++index) { player1.inventory[index].SetDefaults((int) ItemID.FromLegacyName(binaryReader.ReadString(), release)); player1.inventory[index].stack = binaryReader.ReadInt32(); if (release >= 36) player1.inventory[index].Prefix((int) binaryReader.ReadByte()); } if (release >= 15) { for (int index = 44; index < 48; ++index) { player1.inventory[index].SetDefaults((int) ItemID.FromLegacyName(binaryReader.ReadString(), release)); player1.inventory[index].stack = binaryReader.ReadInt32(); if (release >= 36) player1.inventory[index].Prefix((int) binaryReader.ReadByte()); } } for (int index = 0; index < 20; ++index) { player1.bank.item[index].SetDefaults((int) ItemID.FromLegacyName(binaryReader.ReadString(), release)); player1.bank.item[index].stack = binaryReader.ReadInt32(); if (release >= 36) player1.bank.item[index].Prefix((int) binaryReader.ReadByte()); } if (release >= 20) { for (int index = 0; index < 20; ++index) { player1.bank2.item[index].SetDefaults((int) ItemID.FromLegacyName(binaryReader.ReadString(), release)); player1.bank2.item[index].stack = binaryReader.ReadInt32(); if (release >= 36) player1.bank2.item[index].Prefix((int) binaryReader.ReadByte()); } } } if (release < 58) { for (int index = 40; index < 48; ++index) { player1.inventory[index + 10] = player1.inventory[index].Clone(); player1.inventory[index].SetDefaults(); } } if (release >= 11) { int num = 22; if (release < 74) num = 10; for (int index = 0; index < num; ++index) { player1.buffType[index] = binaryReader.ReadInt32(); player1.buffTime[index] = binaryReader.ReadInt32(); if (player1.buffType[index] == 0) { --index; --num; } } } for (int index = 0; index < 200; ++index) { int num = binaryReader.ReadInt32(); if (num != -1) { player1.spX[index] = num; player1.spY[index] = binaryReader.ReadInt32(); player1.spI[index] = binaryReader.ReadInt32(); player1.spN[index] = binaryReader.ReadString(); } else break; } if (release >= 16) player1.hbLocked = binaryReader.ReadBoolean(); if (release >= 115) { int num = 13; for (int index = 0; index < num; ++index) player1.hideInfo[index] = binaryReader.ReadBoolean(); } if (release >= 98) player1.anglerQuestsFinished = binaryReader.ReadInt32(); if (release >= 162) { for (int index = 0; index < 4; ++index) player1.DpadRadial.Bindings[index] = binaryReader.ReadInt32(); } if (release >= 164) { int num = 8; if (release >= 167) num = 10; for (int index = 0; index < num; ++index) player1.builderAccStatus[index] = binaryReader.ReadInt32(); } if (release >= 181) player1.bartenderQuestLog = binaryReader.ReadInt32(); player1.skinVariant = (int) MathHelper.Clamp((float) player1.skinVariant, 0.0f, 9f); for (int index = 3; index < 8 + player1.extraAccessorySlots; ++index) { int type = player1.armor[index].type; if (type == 908) player1.lavaMax += 420; if (type == 906) player1.lavaMax += 420; if (player1.wingsLogic == 0 && player1.armor[index].wingSlot >= (sbyte) 0) player1.wingsLogic = (int) player1.armor[index].wingSlot; if (type == 158 || type == 396 || type == 1250 || type == 1251 || type == 1252) player1.noFallDmg = true; player1.lavaTime = player1.lavaMax; } } } } player1.PlayerFrame(); player1.loadStatus = 0; playerFileData.Player = player1; return playerFileData; } catch { } Player player2 = new Player(); player2.loadStatus = 2; if (player1.name != "") { player2.name = player1.name; } else { string[] strArray = playerPath.Split(Path.DirectorySeparatorChar); player1.name = strArray[strArray.Length - 1].Split('.')[0]; } playerFileData.Player = player2; return playerFileData; } public static PlayerFileData GetFileData(string file, bool cloudSave) { if (file == null || cloudSave && SocialAPI.Cloud == null) return (PlayerFileData) null; PlayerFileData playerFileData = Player.LoadPlayer(file, cloudSave); if (playerFileData.Player == null) return (PlayerFileData) null; if (playerFileData.Player.loadStatus != 0 && playerFileData.Player.loadStatus != 1) { if (FileUtilities.Exists(file + ".bak", cloudSave)) FileUtilities.Move(file + ".bak", file, cloudSave); playerFileData = Player.LoadPlayer(file, cloudSave); if (playerFileData.Player == null) return (PlayerFileData) null; } return playerFileData; } public Color GetHairColor(bool useLighting = true) { Color color = Lighting.GetColor((int) ((double) this.position.X + (double) this.width * 0.5) / 16, (int) (((double) this.position.Y + (double) this.height * 0.25) / 16.0)); return GameShaders.Hair.GetColor((short) this.hairDye, this, useLighting ? color : Color.White); } public bool HasItem(int type) { for (int index = 0; index < 58; ++index) { if (type == this.inventory[index].type && this.inventory[index].stack > 0) return true; } return false; } public int FindItem(int netid) { for (int index = 0; index < 58; ++index) { if (netid == this.inventory[index].netID && this.inventory[index].stack > 0) return index; } return -1; } public int FindItem(List netids) { for (int index = 0; index < 58; ++index) { if (this.inventory[index].stack > 0 && netids.Contains(this.inventory[index].netID)) return index; } return -1; } public int FindItem(bool[] validtypes) { for (int index = 0; index < 58; ++index) { if (this.inventory[index].stack > 0 && validtypes[this.inventory[index].type]) return index; } return -1; } public Player() { this.width = 20; this.height = 42; this.name = string.Empty; this.bodyFrame.Width = 40; this.bodyFrame.Height = 56; this.legFrame.Width = 40; this.legFrame.Height = 56; for (int index = 0; index < 59; ++index) { if (index < this.armor.Length) this.armor[index] = new Item(); this.inventory[index] = new Item(); } for (int index = 0; index < 40; ++index) { this.bank.item[index] = new Item(); this.bank2.item[index] = new Item(); this.bank3.item[index] = new Item(); } for (int index = 0; index < this.dye.Length; ++index) this.dye[index] = new Item(); for (int index = 0; index < this.miscEquips.Length; ++index) this.miscEquips[index] = new Item(); for (int index = 0; index < this.miscDyes.Length; ++index) this.miscDyes[index] = new Item(); this.trashItem = new Item(); this.grappling[0] = -1; this.inventory[0].SetDefaults(3507); this.inventory[1].SetDefaults(3509); this.inventory[2].SetDefaults(3506); this.statManaMax = 20; this.extraAccessory = false; if (Main.cEd) this.inventory[3].SetDefaults(603); for (int index = 0; index < 470; ++index) { this.adjTile[index] = false; this.oldAdjTile[index] = false; } this.hitTile = new HitTile(); this.mount = new Mount(); } public void TeleportationPotion() { bool canSpawn = false; int teleportStartX = 100; int teleportRangeX = Main.maxTilesX - 200; int teleportStartY = 100; int teleportRangeY = Main.maxTilesY - 200; Vector2 vector2 = this.TestTeleport(ref canSpawn, teleportStartX, teleportRangeX, teleportStartY, teleportRangeY); if (!canSpawn) return; Vector2 newPos = vector2; this.Teleport(newPos, 2); this.velocity = Vector2.Zero; if (Main.netMode != 2) return; RemoteClient.CheckSection(this.whoAmI, this.position); NetMessage.SendData(65, number2: ((float) this.whoAmI), number3: newPos.X, number4: newPos.Y, number5: 3); } private Vector2 TestTeleport( ref bool canSpawn, int teleportStartX, int teleportRangeX, int teleportStartY, int teleportRangeY) { int num1 = 0; int num2 = 0; int num3 = 0; int width = this.width; Vector2 Position = new Vector2((float) num2, (float) num3) * 16f + new Vector2((float) (-width / 2 + 8), (float) -this.height); while (!canSpawn && num1 < 1000) { ++num1; int index1 = teleportStartX + Main.rand.Next(teleportRangeX); int index2 = teleportStartY + Main.rand.Next(teleportRangeY); Position = new Vector2((float) index1, (float) index2) * 16f + new Vector2((float) (-width / 2 + 8), (float) -this.height); if (!Collision.SolidCollision(Position, width, this.height)) { if (Main.tile[index1, index2] == null) Main.tile[index1, index2] = new Tile(); if ((Main.tile[index1, index2].wall != (byte) 87 || (double) index2 <= Main.worldSurface || NPC.downedPlantBoss) && (!Main.wallDungeon[(int) Main.tile[index1, index2].wall] || (double) index2 <= Main.worldSurface || NPC.downedBoss3)) { int num4 = 0; while (num4 < 100) { if (Main.tile[index1, index2 + num4] == null) Main.tile[index1, index2 + num4] = new Tile(); Tile tile = Main.tile[index1, index2 + num4]; Position = new Vector2((float) index1, (float) (index2 + num4)) * 16f + new Vector2((float) (-width / 2 + 8), (float) -this.height); Vector4 vector4 = Collision.SlopeCollision(Position, this.velocity, width, this.height, this.gravDir); int num5 = !Collision.SolidCollision(Position, width, this.height) ? 1 : 0; int num6 = (double) vector4.Z != (double) this.velocity.X || (double) vector4.Y != (double) this.velocity.Y || (double) vector4.X != (double) Position.X ? 0 : ((double) vector4.Y == (double) Position.Y ? 1 : 0); if (num5 != 0) ++num4; else if (!tile.active() || tile.inActive() || !Main.tileSolid[(int) tile.type]) ++num4; else break; } if (!Collision.LavaCollision(Position, width, this.height) && (double) Collision.HurtTiles(Position, this.velocity, width, this.height).Y <= 0.0) { Collision.SlopeCollision(Position, this.velocity, width, this.height, this.gravDir); if (Collision.SolidCollision(Position, width, this.height) && num4 < 99) { Vector2 Velocity1 = Vector2.UnitX * 16f; if (!(Collision.TileCollision(Position - Velocity1, Velocity1, this.width, this.height, gravDir: ((int) this.gravDir)) != Velocity1)) { Vector2 Velocity2 = -Vector2.UnitX * 16f; if (!(Collision.TileCollision(Position - Velocity2, Velocity2, this.width, this.height, gravDir: ((int) this.gravDir)) != Velocity2)) { Vector2 Velocity3 = Vector2.UnitY * 16f; if (!(Collision.TileCollision(Position - Velocity3, Velocity3, this.width, this.height, gravDir: ((int) this.gravDir)) != Velocity3)) { Vector2 Velocity4 = -Vector2.UnitY * 16f; if (!(Collision.TileCollision(Position - Velocity4, Velocity4, this.width, this.height, gravDir: ((int) this.gravDir)) != Velocity4)) { canSpawn = true; int num7 = index2 + num4; break; } } } } } } } } } return Position; } public void GetAnglerReward() { Item newItem1 = new Item(); newItem1.type = 0; float num1 = 1f; if (this.anglerQuestsFinished <= 50) num1 -= (float) this.anglerQuestsFinished * 0.01f; else if (this.anglerQuestsFinished <= 100) num1 = (float) (0.5 - (double) (this.anglerQuestsFinished - 50) * 0.00499999988824129); else if (this.anglerQuestsFinished <= 150) num1 = (float) (0.25 - (double) (this.anglerQuestsFinished - 100) * (1.0 / 500.0)); if (this.anglerQuestsFinished == 5) newItem1.SetDefaults(2428); else if (this.anglerQuestsFinished == 10) newItem1.SetDefaults(2367); else if (this.anglerQuestsFinished == 15) newItem1.SetDefaults(2368); else if (this.anglerQuestsFinished == 20) newItem1.SetDefaults(2369); else if (this.anglerQuestsFinished == 30) newItem1.SetDefaults(2294); else if (this.anglerQuestsFinished > 75 && Main.rand.Next((int) (250.0 * (double) num1)) == 0) newItem1.SetDefaults(2294); else if (Main.hardMode && this.anglerQuestsFinished > 25 && Main.rand.Next((int) (100.0 * (double) num1)) == 0) newItem1.SetDefaults(2422); else if (Main.hardMode && this.anglerQuestsFinished > 10 && Main.rand.Next((int) (70.0 * (double) num1)) == 0) newItem1.SetDefaults(2494); else if (Main.hardMode && this.anglerQuestsFinished > 10 && Main.rand.Next((int) (70.0 * (double) num1)) == 0) newItem1.SetDefaults(3031); else if (Main.hardMode && this.anglerQuestsFinished > 10 && Main.rand.Next((int) (70.0 * (double) num1)) == 0) newItem1.SetDefaults(3032); else if (Main.rand.Next((int) (80.0 * (double) num1)) == 0) newItem1.SetDefaults(3183); else if (Main.rand.Next((int) (60.0 * (double) num1)) == 0) newItem1.SetDefaults(2360); else if (Main.rand.Next((int) (40.0 * (double) num1)) == 0) newItem1.SetDefaults(2373); else if (Main.rand.Next((int) (40.0 * (double) num1)) == 0) newItem1.SetDefaults(2374); else if (Main.rand.Next((int) (40.0 * (double) num1)) == 0) newItem1.SetDefaults(2375); else if (Main.rand.Next((int) (40.0 * (double) num1)) == 0) newItem1.SetDefaults(3120); else if (Main.rand.Next((int) (40.0 * (double) num1)) == 0) newItem1.SetDefaults(3037); else if (Main.rand.Next((int) (40.0 * (double) num1)) == 0) newItem1.SetDefaults(3096); else if (Main.rand.Next((int) (40.0 * (double) num1)) == 0) newItem1.SetDefaults(2417); else if (Main.rand.Next((int) (40.0 * (double) num1)) == 0) { newItem1.SetDefaults(2498); } else { switch (Main.rand.Next(70)) { case 0: newItem1.SetDefaults(2442); break; case 1: newItem1.SetDefaults(2443); break; case 2: newItem1.SetDefaults(2444); break; case 3: newItem1.SetDefaults(2445); break; case 4: newItem1.SetDefaults(2497); break; case 5: newItem1.SetDefaults(2495); break; case 6: newItem1.SetDefaults(2446); break; case 7: newItem1.SetDefaults(2447); break; case 8: newItem1.SetDefaults(2448); break; case 9: newItem1.SetDefaults(2449); break; case 10: newItem1.SetDefaults(2490); break; case 11: newItem1.SetDefaults(2435); newItem1.stack = Main.rand.Next(50, 151); break; case 12: newItem1.SetDefaults(2496); break; default: switch (Main.rand.Next(3)) { case 0: newItem1.SetDefaults(2354); newItem1.stack = Main.rand.Next(2, 6); break; case 1: newItem1.SetDefaults(2355); newItem1.stack = Main.rand.Next(2, 6); break; default: newItem1.SetDefaults(2356); newItem1.stack = Main.rand.Next(2, 6); break; } break; } } newItem1.position = this.Center; Item obj1 = this.GetItem(this.whoAmI, newItem1, true); if (obj1.stack > 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, obj1.type, obj1.stack, noGrabDelay: true); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } if (newItem1.type == 2417) { Item newItem2 = new Item(); Item newItem3 = new Item(); newItem2.SetDefaults(2418); newItem2.position = this.Center; Item obj2 = this.GetItem(this.whoAmI, newItem2, true); if (obj2.stack > 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, obj2.type, obj2.stack, noGrabDelay: true); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } newItem3.SetDefaults(2419); newItem3.position = this.Center; Item obj3 = this.GetItem(this.whoAmI, newItem3, true); if (obj3.stack > 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, obj3.type, obj3.stack, noGrabDelay: true); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } } else if (newItem1.type == 2498) { Item newItem4 = new Item(); Item newItem5 = new Item(); newItem4.SetDefaults(2499); newItem4.position = this.Center; Item obj4 = this.GetItem(this.whoAmI, newItem4, true); if (obj4.stack > 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, obj4.type, obj4.stack, noGrabDelay: true); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } newItem5.SetDefaults(2500); newItem5.position = this.Center; Item obj5 = this.GetItem(this.whoAmI, newItem5, true); if (obj5.stack > 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, obj5.type, obj5.stack, noGrabDelay: true); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } } Item newItem6 = new Item(); int num2 = (int) ((double) (int) ((double) ((this.anglerQuestsFinished + 50) / 2 * Main.rand.Next(50, 201)) * 0.0149999996647239) * 1.5); if (Main.expertMode) num2 *= 2; if (num2 > 100) { int num3 = num2 / 100; if (num3 > 10) num3 = 10; if (num3 < 1) num3 = 1; newItem6.SetDefaults(73); newItem6.stack = num3; } else { if (num2 > 99) num2 = 99; if (num2 < 1) num2 = 1; newItem6.SetDefaults(72); newItem6.stack = num2; } newItem6.position = this.Center; Item obj6 = this.GetItem(this.whoAmI, newItem6, true); if (obj6.stack > 0) { int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, obj6.type, obj6.stack, noGrabDelay: true); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } if (Main.rand.Next((int) (100.0 * (double) num1)) > 50) return; Item newItem7 = new Item(); if (Main.rand.Next((int) (15.0 * (double) num1)) == 0) newItem7.SetDefaults(2676); else if (Main.rand.Next((int) (5.0 * (double) num1)) == 0) newItem7.SetDefaults(2675); else newItem7.SetDefaults(2674); if (Main.rand.Next(25) <= this.anglerQuestsFinished) ++newItem7.stack; if (Main.rand.Next(50) <= this.anglerQuestsFinished) ++newItem7.stack; if (Main.rand.Next(100) <= this.anglerQuestsFinished) ++newItem7.stack; if (Main.rand.Next(150) <= this.anglerQuestsFinished) ++newItem7.stack; if (Main.rand.Next(200) <= this.anglerQuestsFinished) ++newItem7.stack; if (Main.rand.Next(250) <= this.anglerQuestsFinished) ++newItem7.stack; newItem7.position = this.Center; Item obj7 = this.GetItem(this.whoAmI, newItem7, true); if (obj7.stack <= 0) return; int number1 = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, obj7.type, obj7.stack, noGrabDelay: true); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number1, number2: 1f); } public void GetDyeTraderReward() { List intList = new List() { 3560, 3028, 3041, 3040, 3025, 3190, 3027, 3026, 3554, 3553, 3555, 2872, 3534, 2871 }; if (Main.hardMode) { intList.Add(3039); intList.Add(3038); intList.Add(3598); intList.Add(3597); intList.Add(3600); intList.Add(3042); intList.Add(3533); intList.Add(3561); if (NPC.downedMechBossAny) { intList.Add(2883); intList.Add(2869); intList.Add(2873); intList.Add(2870); } if (NPC.downedPlantBoss) { intList.Add(2878); intList.Add(2879); intList.Add(2884); intList.Add(2885); } if (NPC.downedMartians) { intList.Add(2864); intList.Add(3556); } if (NPC.downedMoonlord) intList.Add(3024); } int Type = intList[Main.rand.Next(intList.Count)]; Item newItem = new Item(); newItem.SetDefaults(Type); newItem.stack = 3; newItem.position = this.Center; Item obj = this.GetItem(this.whoAmI, newItem, true); if (obj.stack <= 0) return; int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, obj.type, obj.stack, noGrabDelay: true); if (Main.netMode != 1) return; NetMessage.SendData(21, number: number, number2: 1f); } public bool CheckMana(int amount, bool pay = false, bool blockQuickMana = false) { int num = (int) ((double) amount * (double) this.manaCost); if (this.statMana >= num) { if (pay) this.statMana -= num; return true; } if (!this.manaFlower || blockQuickMana) return false; this.QuickMana(); if (this.statMana < num) return false; if (pay) this.statMana -= num; return true; } public void TryPortalJumping() { if (this.mount.Active || this.dead) return; PortalHelper.TryGoingThroughPortals((Entity) this); } public bool ConsumeSolarFlare() { if (!this.setSolar || this.solarShields <= 0) return false; if (Main.netMode == 1 && this.whoAmI != Main.myPlayer) return true; --this.solarShields; for (int b = 0; b < 22; ++b) { if (this.buffType[b] >= 170 && this.buffType[b] <= 172) this.DelBuff(b); } if (this.solarShields > 0) this.AddBuff(170 + this.solarShields - 1, 5, false); this.solarCounter = 0; return true; } public void KeyDoubleTap(int keyDir) { int num = 0; if (Main.ReversedUpDownArmorSetBonuses) num = 1; if (keyDir != num) return; if (this.setVortex && !this.mount.Active) this.vortexStealthActive = !this.vortexStealthActive; if (this.setStardust) this.MinionRestTargetAim(); if (!this.setForbidden) return; this.MinionRestTargetAim(); if (this.setForbiddenCooldownLocked) return; this.CommandForbiddenStorm(); } public void UpdateForbiddenSetLock() { List intList = new List(); for (int index = 0; index < 1000; ++index) { Projectile projectile = Main.projectile[index]; if (projectile.active && projectile.type == 656 && projectile.owner == this.whoAmI) intList.Add(index); } this.setForbiddenCooldownLocked = intList.Count > 1; } public void CommandForbiddenStorm() { List intList = new List(); for (int index = 0; index < 1000; ++index) { Projectile projectile = Main.projectile[index]; if (projectile.active && projectile.type == 656 && projectile.owner == this.whoAmI) intList.Add(index); } bool flag1 = StrayMethods.CanSpawnSandstormFriendly(this.MinionRestTargetPoint, 30, 30); int num1 = this.MinionRestTargetPoint == Vector2.Zero ? 1 : 0; Vector2 center = this.Center; Vector2 vector2_1 = this.MinionRestTargetPoint; if (num1 != 0) vector2_1 = center; bool flag2 = false; float[] samples = new float[10]; Vector2 v = vector2_1 - center; Collision.LaserScan(center, v.SafeNormalize(Vector2.Zero), 60f, v.Length(), samples); float num2 = 0.0f; for (int index = 0; index < samples.Length; ++index) { if ((double) samples[index] > (double) num2) num2 = samples[index]; } foreach (float num3 in samples) { if ((double) Math.Abs(num3 - v.Length()) < 10.0) { flag2 = true; break; } } if (intList.Count <= 1) { Vector2 Position1 = center + v.SafeNormalize(Vector2.Zero) * num2; Vector2 vector2_2 = Position1 - center; if ((double) vector2_2.Length() > 0.0) { for (float num4 = 0.0f; (double) num4 < (double) vector2_2.Length(); num4 += 15f) { Vector2 Position2 = center + vector2_2 * (num4 / vector2_2.Length()); Dust dust = Main.dust[Dust.NewDust(Position2, 0, 0, 269)]; dust.position = Position2; dust.fadeIn = 0.5f; dust.scale = 0.7f; dust.velocity *= 0.4f; dust.noLight = true; } } for (float num5 = 0.0f; (double) num5 < 6.28318548202515; num5 += 0.2094395f) { Dust dust = Main.dust[Dust.NewDust(Position1, 0, 0, 269)]; dust.position = Position1; dust.fadeIn = 1f; dust.scale = 0.3f; dust.noLight = true; } } bool flag3 = flag1 & intList.Count <= 1 & flag2; if (flag3) { flag3 = this.CheckMana(20, true); if (flag3) this.manaRegenDelay = (int) this.maxRegenDelay; } if (!flag3) return; foreach (int index in intList) { Projectile projectile = Main.projectile[index]; if ((double) projectile.ai[0] < 780.0) { projectile.ai[0] = (float) (780.0 + (double) projectile.ai[0] % 60.0); projectile.netUpdate = true; } } int Damage = (int) (20.0 * (1.0 + (double) this.magicDamage + (double) this.minionDamage - 2.0)); Projectile projectile1 = Main.projectile[Projectile.NewProjectile(this.MinionRestTargetPoint, Vector2.Zero, 656, Damage, 0.0f, Main.myPlayer)]; } public void KeyHoldDown(int keyDir, int holdTime) { int num = 0; if (Main.ReversedUpDownArmorSetBonuses) num = 1; if (keyDir != num) return; if (this.setStardust && holdTime >= 60) this.MinionRestTargetPoint = Vector2.Zero; if (!this.setForbidden || holdTime < 60) return; this.MinionRestTargetPoint = Vector2.Zero; } public void MinionNPCTargetAim() { Vector2 mouseWorld = Main.MouseWorld; int index1 = -1; for (int index2 = 0; index2 < 200; ++index2) { if (Main.npc[index2].CanBeChasedBy((object) this) && (index1 == -1 || (double) Main.npc[index2].Hitbox.Distance(mouseWorld) < (double) Main.npc[index1].Hitbox.Distance(mouseWorld))) index1 = index2; } if (this.MinionAttackTargetNPC == index1) this.MinionAttackTargetNPC = -1; else this.MinionAttackTargetNPC = index1; } public void MinionRestTargetAim() { Vector2 mouseWorld = Main.MouseWorld; float y = mouseWorld.Y; int i = (int) mouseWorld.X / 16; int index1 = (int) y / 16; int num1 = 0; if ((!Main.tile[i, index1].nactive() || !Main.tileSolid[(int) Main.tile[i, index1].type] ? 0 : (!Main.tileSolidTop[(int) Main.tile[i, index1].type] ? 1 : 0)) != 0) { int num2 = 0; for (int index2 = 0; index2 > -20 && index1 + index2 > 1; --index2) { int index3 = index1 + index2; if ((!Main.tile[i, index3].nactive() || !Main.tileSolid[(int) Main.tile[i, index3].type] ? 0 : (!Main.tileSolidTop[(int) Main.tile[i, index3].type] ? 1 : 0)) != 0) { num2 = index2; } else { num2 = index2; break; } } int num3 = 0; for (int index4 = 0; index4 < 20 && index1 + index4 < Main.maxTilesY; ++index4) { int index5 = index1 + index4; if ((!Main.tile[i, index5].nactive() || !Main.tileSolid[(int) Main.tile[i, index5].type] ? 0 : (!Main.tileSolidTop[(int) Main.tile[i, index5].type] ? 1 : 0)) != 0) { num3 = index4; } else { num3 = index4; break; } } num1 = num3 <= -num2 ? num3 + 3 : num2 - 2; } int num4 = index1 + num1; bool flag = false; for (int j = num4; j < num4 + 5; ++j) { if (WorldGen.SolidTileAllowBottomSlope(i, j)) flag = true; } while (!flag) { ++num4; for (int j = num4; j < num4 + 5; ++j) { if (WorldGen.SolidTileAllowBottomSlope(i, j)) flag = true; } } Vector2 Other = new Vector2((float) (i * 16 + 8), (float) (num4 * 16)); if ((double) this.Distance(Other) > 1000.0) return; this.MinionRestTargetPoint = Other; } public void UpdateMinionTarget() { if (this.whoAmI != Main.myPlayer) return; if ((double) this.Distance(this.MinionRestTargetPoint) > 1000.0) this.MinionRestTargetPoint = Vector2.Zero; if (this.MinionAttackTargetNPC != -1 && (!Main.npc[this.MinionAttackTargetNPC].CanBeChasedBy((object) this) || (double) Main.npc[this.MinionAttackTargetNPC].Hitbox.Distance(this.Center) > 3000.0)) this.MinionAttackTargetNPC = -1; if (this.stardustGuardian && this.HasMinionRestTarget) { Vector2 minionRestTargetPoint = this.MinionRestTargetPoint; float num1 = (float) this.miscCounter / 150f; float num2 = 2.094395f; for (int index1 = 0; index1 < 3; ++index1) { int index2 = Dust.NewDust(minionRestTargetPoint, 0, 0, 135, Alpha: 100, Scale: 1.5f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity = Vector2.Zero; Main.dust[index2].noLight = true; Main.dust[index2].position = minionRestTargetPoint + ((float) ((double) num1 * 6.28318548202515 + (double) num2 * (double) index1)).ToRotationVector2() * 4f; Main.dust[index2].shader = GameShaders.Armor.GetSecondaryShader(this.cPet, this); } } if (this.MinionAttackTargetNPC == -1) return; Vector2 center = Main.npc[this.MinionAttackTargetNPC].Center; float num3 = (float) this.miscCounter / 60f; float num4 = 2.094395f; for (int index3 = 0; index3 < 3; ++index3) { int index4 = Dust.NewDust(center, 0, 0, 272, Alpha: 100, Scale: 0.5f); Main.dust[index4].noGravity = true; Main.dust[index4].velocity = Vector2.Zero; Main.dust[index4].noLight = true; Main.dust[index4].position = center + ((float) ((double) num3 * 6.28318548202515 + (double) num4 * (double) index3)).ToRotationVector2() * 12f; } } public void NebulaLevelup(int type) { if (this.whoAmI != Main.myPlayer) return; int time1 = 480; for (int b = 0; b < 22; ++b) { if (this.buffType[b] >= type && this.buffType[b] < type + 3) this.DelBuff(b); } switch (type) { case 173: this.nebulaLevelLife = (int) MathHelper.Clamp((float) (this.nebulaLevelLife + 1), 0.0f, 3f); this.AddBuff(type + this.nebulaLevelLife - 1, time1); break; case 176: this.nebulaLevelMana = (int) MathHelper.Clamp((float) (this.nebulaLevelMana + 1), 0.0f, 3f); this.AddBuff(type + this.nebulaLevelMana - 1, time1); break; case 179: this.nebulaLevelDamage = (int) MathHelper.Clamp((float) (this.nebulaLevelDamage + 1), 0.0f, 3f); this.AddBuff(type + this.nebulaLevelDamage - 1, time1); break; } } public void UpdateTouchingTiles() { this.TouchedTiles.Clear(); List pointList1 = (List) null; List pointList2 = (List) null; if (!Collision.IsClearSpotTest(this.position + this.velocity, 16f, this.width, this.height, gravDir: ((int) this.gravDir), checkSlopes: true)) pointList1 = Collision.FindCollisionTile(Math.Sign(this.velocity.Y) == 1 ? 2 : 3, this.position + this.velocity, 16f, this.width, this.height, gravDir: ((int) this.gravDir)); if (!Collision.IsClearSpotTest(this.position, Math.Abs(this.velocity.Y), this.width, this.height, gravDir: ((int) this.gravDir), checkSlopes: true)) pointList2 = Collision.FindCollisionTile(Math.Sign(this.velocity.Y) == 1 ? 2 : 3, this.position, Math.Abs(this.velocity.Y), this.width, this.height, gravDir: ((int) this.gravDir), checkSlopes: true); if (pointList1 != null && pointList2 != null) { for (int index = 0; index < pointList2.Count; ++index) { if (!pointList1.Contains(pointList2[index])) pointList1.Add(pointList2[index]); } } if (pointList1 == null && pointList2 != null) pointList1 = pointList2; if (pointList1 == null) return; this.TouchedTiles = pointList1; } public static class Hooks { public static event Action OnEnterWorld; public static void PlayerConnect(int playerIndex) => PressurePlateHelper.ResetPlayer(playerIndex); public static void PlayerDisconnect(int playerIndex) => PressurePlateHelper.ResetPlayer(playerIndex); public static void EnterWorld(int playerIndex) { if (Player.Hooks.OnEnterWorld == null) return; Player.Hooks.OnEnterWorld(Main.player[playerIndex]); } } public class SmartCursorSettings { public static bool SmartBlocksEnabled = false; public static bool SmartWallReplacement = true; public static bool SmartAxeAfterPickaxe = false; } public class SelectionRadial { private int _SelectedBinding = -1; public int RadialCount; public int[] Bindings; public Player.SelectionRadial.SelectionMode Mode; public int SelectedBinding => this._SelectedBinding; public int SelectedItem => this._SelectedBinding == -1 ? -1 : this.Bindings[this._SelectedBinding]; public SelectionRadial(Player.SelectionRadial.SelectionMode mode = Player.SelectionRadial.SelectionMode.Dpad4) { this.Mode = mode; int num = 0; switch (mode) { case Player.SelectionRadial.SelectionMode.Dpad4: num = 4; break; case Player.SelectionRadial.SelectionMode.RadialCircular: num = 10; break; case Player.SelectionRadial.SelectionMode.RadialQuicks: num = 3; break; } this.RadialCount = num; this.Bindings = new int[this.RadialCount]; for (int index = 0; index < this.RadialCount; ++index) this.Bindings[index] = -1; } public void Update() { switch (this.Mode) { case Player.SelectionRadial.SelectionMode.Dpad4: if (PlayerInput.Triggers.JustPressed.DpadRadial1) this.ChangeSelection(0); if (PlayerInput.Triggers.JustPressed.DpadRadial2) this.ChangeSelection(1); if (PlayerInput.Triggers.JustPressed.DpadRadial3) this.ChangeSelection(2); if (!PlayerInput.Triggers.JustPressed.DpadRadial4) break; this.ChangeSelection(3); break; case Player.SelectionRadial.SelectionMode.RadialCircular: case Player.SelectionRadial.SelectionMode.RadialQuicks: for (int index = 0; index < this.RadialCount; ++index) this.Bindings[index] = index; if ((this.Mode != Player.SelectionRadial.SelectionMode.RadialCircular || !PlayerInput.Triggers.Current.RadialHotbar ? (this.Mode != Player.SelectionRadial.SelectionMode.RadialQuicks ? 0 : (PlayerInput.Triggers.Current.RadialQuickbar ? 1 : 0)) : 1) == 0) break; bool flag = this.Mode == Player.SelectionRadial.SelectionMode.RadialCircular; float num = (float) (6.28318548202515 / (double) this.RadialCount / 2.0); Vector2 v = PlayerInput.GamepadThumbstickRight.RotatedBy((double) num - 1.57079637050629); if ((double) v.Length() == 0.0) v = PlayerInput.GamepadThumbstickLeft.RotatedBy((double) num - 1.57079637050629); int to = -1; if ((double) v.Length() > 0.300000011920929) { to = (int) (((double) v.ToRotation() + 3.14159274101257) / (6.28318548202515 / (double) this.RadialCount)); if (to >= this.RadialCount) to -= this.RadialCount; } if (to == -1 && flag || this._SelectedBinding == to || to == -1 && v != Vector2.Zero) break; this.ChangeSelection(to); break; } } public void ChangeBinding(int itemSlot) { if (itemSlot < 0 || itemSlot >= 50 || this.Mode != Player.SelectionRadial.SelectionMode.Dpad4) return; if (PlayerInput.Triggers.JustPressed.DpadRadial1) this.Bind(itemSlot, 0); if (PlayerInput.Triggers.JustPressed.DpadRadial2) this.Bind(itemSlot, 1); if (PlayerInput.Triggers.JustPressed.DpadRadial3) this.Bind(itemSlot, 2); if (!PlayerInput.Triggers.JustPressed.DpadRadial4) return; this.Bind(itemSlot, 3); } public void ChangeSelection(int to) { if (this._SelectedBinding == to) this._SelectedBinding = -1; else this._SelectedBinding = to; } private void Bind(int itemslot, int radialslot) { this.ChangeSelection(-1); if (this.Bindings[radialslot] == itemslot) { this.Bindings[radialslot] = -1; } else { for (int index = 0; index < this.RadialCount; ++index) { if (this.Bindings[index] == itemslot) this.Bindings[index] = -1; } this.Bindings[radialslot] = itemslot; } } public int GetDrawMode(int itemslot) { if (this.SelectedBinding != -1 && this.Bindings[this.SelectedBinding] == itemslot) return 2; for (int index = 0; index < this.RadialCount; ++index) { if (this.Bindings[index] == itemslot) return 1; } return 0; } public void CopyTo(Player.SelectionRadial that) { that._SelectedBinding = this._SelectedBinding; that.Mode = this.Mode; that.RadialCount = this.RadialCount; Array.Resize(ref that.Bindings, this.RadialCount); for (int index = 0; index < this.RadialCount; ++index) that.Bindings[index] = this.Bindings[index]; } public enum SelectionMode { Dpad4, RadialCircular, RadialQuicks, } } public struct OverheadMessage { public string chatText; public TextSnippet[] snippets; public Vector2 messageSize; public int timeLeft; public void NewMessage(string message, int displayTime) { this.chatText = message; this.snippets = ChatManager.ParseMessage(this.chatText, Color.White).ToArray(); this.messageSize = ChatManager.GetStringSize(Main.fontMouseText, this.snippets, Vector2.One); this.timeLeft = displayTime; } } } }