Skip to content

Instantly share code, notes, and snippets.

@hakusaro
Created June 30, 2015 17:30
Show Gist options
  • Save hakusaro/911a4a5830c387c15197 to your computer and use it in GitHub Desktop.
Save hakusaro/911a4a5830c387c15197 to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using Terraria.DataStructures;
using Terraria.GameContent;
using Terraria.GameContent.Achievements;
using Terraria.GameContent.Tile_Entities;
using Terraria.Graphics.Capture;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.IO;
using Terraria.ObjectData;
using Terraria.Social;
using Terraria.UI;
using Terraria.UI.Chat;
using Terraria.Utilities;
using Terraria.World.Generation;
namespace Terraria
{
public class Player : Entity
{
public class SmartCursorSettings
{
public static bool SmartBlocksEnabled;
}
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);
this.messageSize = ChatManager.GetStringSize(Main.fontMouseText, this.snippets, Vector2.One, -1f);
this.timeLeft = displayTime;
}
}
public const int maxSolarShields = 3;
public const int nebulaMaxLevel = 3;
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 const int maxBuffs = 22;
public const int defaultWidth = 20;
public const int defaultHeight = 42;
private const int shadowMax = 3;
private static byte[] ENCRYPTION_KEY = new UnicodeEncoding().GetBytes("h3y_gUyZ");
public Player.OverheadMessage chatOverhead = default(Player.OverheadMessage);
public bool alchemyTable;
private bool GoingDownWithGrapple;
private byte spelunkerTimer;
public bool[] hideInfo = new bool[13];
public int lostCoins;
public string lostCoinString = "";
public int soulDrain;
public float drainBoost;
public int taxMoney;
public int taxTimer;
public static int taxRate = 3600;
public static int crystalLeafDamage = 100;
public static int crystalLeafKB = 10;
public bool[] NPCBannerBuff = new bool[251];
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 Vector2[] solarShieldPos = new Vector2[3];
public Vector2[] solarShieldVel = new Vector2[3];
public bool solarDashing;
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 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 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 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 = 0;
public BitsByte zone2 = 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 paladinBuff;
public bool paladinGive;
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 int immuneTime;
public int immuneAlphaDirection;
public int immuneAlpha;
public int team;
public bool hbLocked;
public static int nameLen = 20;
private 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 Item[] armor = new Item[20];
public Item[] dye = new Item[10];
public Item[] miscEquips = new Item[5];
public Item[] miscDyes = new Item[5];
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 int[] buffType = new int[22];
public int[] buffTime = new int[22];
public bool[] buffImmune = new bool[191];
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 socialShadow;
public bool socialGhost;
public bool shroomiteStealth;
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 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 = 0;
public Rectangle headFrame;
public Rectangle bodyFrame;
public Rectangle legFrame;
public 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 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 bool showItemIcon;
public bool showItemIconR;
public int showItemIcon2;
public string showItemIconText = "";
public int runSoundDelay;
public float shadow;
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 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 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 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 wereWolf;
public bool wolfAcc;
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 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 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;
private static int jumpHeight = 15;
private 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[419];
public bool[] oldAdjTile = new bool[419];
private 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(255, 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(255, 230, 175);
public Color shoeColor = new Color(160, 105, 60);
public int hair;
public bool hostile;
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 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 vortexStealthActive;
public bool waterWalk;
public bool waterWalk2;
public bool gravControl;
public bool gravControl2;
public bool bee;
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;
private int cHead;
private int cBody;
private int cLegs;
private int cHandOn;
private int cHandOff;
private int cBack;
private int cFront;
private int cShoe;
private int cWaist;
private int cShield;
private int cNeck;
private int cFace;
private int cBalloon;
private int cWings;
private 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[651];
public bool[] npcTypeNoAggro = new bool[540];
public int lastPortalColorIndex;
public int _portalPhysicsTime;
public bool justGotOutOfPortal;
public float MountFishronSpecialCounter;
public Vector2 MinionTargetPoint = Vector2.Zero;
public List<Point> TouchedTiles = new List<Point>();
private bool makeStrongBee;
public static bool lastPound = true;
public static event Action<Player> OnEnterWorld;
public Vector2 MountedCenter
{
get
{
return 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 bool Male
{
get
{
return this.skinVariant < 4;
}
set
{
if (value)
{
if (this.skinVariant >= 4)
{
this.skinVariant -= 4;
return;
}
}
else if (this.skinVariant < 4)
{
this.skinVariant += 4;
}
}
}
public bool ZoneDungeon
{
get
{
return this.zone1[0];
}
set
{
this.zone1[0] = value;
}
}
public bool ZoneCorrupt
{
get
{
return this.zone1[1];
}
set
{
this.zone1[1] = value;
}
}
public bool ZoneHoly
{
get
{
return this.zone1[2];
}
set
{
this.zone1[2] = value;
}
}
public bool ZoneMeteor
{
get
{
return this.zone1[3];
}
set
{
this.zone1[3] = value;
}
}
public bool ZoneJungle
{
get
{
return this.zone1[4];
}
set
{
this.zone1[4] = value;
}
}
public bool ZoneSnow
{
get
{
return this.zone1[5];
}
set
{
this.zone1[5] = value;
}
}
public bool ZoneCrimson
{
get
{
return this.zone1[6];
}
set
{
this.zone1[6] = value;
}
}
public bool ZoneWaterCandle
{
get
{
return this.zone1[7];
}
set
{
this.zone1[7] = value;
}
}
public bool ZonePeaceCandle
{
get
{
return this.zone2[0];
}
set
{
this.zone2[0] = value;
}
}
public bool ZoneTowerSolar
{
get
{
return this.zone2[1];
}
set
{
this.zone2[1] = value;
}
}
public bool ZoneTowerVortex
{
get
{
return this.zone2[2];
}
set
{
this.zone2[2] = value;
}
}
public bool ZoneTowerNebula
{
get
{
return this.zone2[3];
}
set
{
this.zone2[3] = value;
}
}
public bool ZoneTowerStardust
{
get
{
return this.zone2[4];
}
set
{
this.zone2[4] = value;
}
}
public bool ZoneDesert
{
get
{
return this.zone2[5];
}
set
{
this.zone2[5] = value;
}
}
public bool ZoneGlowshroom
{
get
{
return this.zone2[6];
}
set
{
this.zone2[6] = value;
}
}
public bool ZoneUndergroundDesert
{
get
{
return this.zone2[7];
}
set
{
this.zone2[7] = value;
}
}
public Vector2 Directions
{
get
{
return new Vector2((float)this.direction, this.gravDir);
}
}
public bool PortalPhysicsEnabled
{
get
{
return this._portalPhysicsTime > 0 && !this.mount.Active;
}
}
public bool MountFishronSpecial
{
get
{
return this.statLife < this.statLifeMax2 / 2 || (this.wet && !this.lavaWet && !this.honeyWet) || this.dripping || this.MountFishronSpecialCounter > 0f;
}
}
public bool HasMinionTarget
{
get
{
return this.MinionTargetPoint != Vector2.Zero;
}
}
public bool SlimeDontHyperJump
{
get
{
return this.mount.Active && this.mount.Type == 3 && this.wetSlime > 0 && !this.controlJump;
}
}
public void RotateRelativePoint(ref float x, ref float y)
{
Vector2 vector = this.RotatedRelativePoint(new Vector2(x, y), true);
x = vector.X;
y = vector.Y;
}
public Vector2 RotatedRelativePoint(Vector2 pos, bool rotateForward = true)
{
Vector2 value = this.position + this.fullRotationOrigin;
Matrix matrix = Matrix.CreateRotationZ(this.fullRotation * (float)rotateForward.ToInt());
pos -= this.position + this.fullRotationOrigin;
pos = Vector2.Transform(pos, matrix);
return pos + value;
}
public void HealEffect(int healAmount, bool broadcast = true)
{
CombatText.NewText(new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height), CombatText.HealLife, string.Concat(healAmount), false, false);
if (broadcast && Main.netMode == 1 && this.whoAmI == Main.myPlayer)
{
NetMessage.SendData(35, -1, -1, "", this.whoAmI, (float)healAmount, 0f, 0f, 0, 0, 0);
}
}
public void ManaEffect(int manaAmount)
{
CombatText.NewText(new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height), CombatText.HealMana, string.Concat(manaAmount), false, false);
if (Main.netMode == 1 && this.whoAmI == Main.myPlayer)
{
NetMessage.SendData(43, -1, -1, "", this.whoAmI, (float)manaAmount, 0f, 0f, 0, 0, 0);
}
}
public static void EnterWorld(Player player)
{
if (Player.OnEnterWorld != null)
{
Player.OnEnterWorld(player);
}
}
public static byte FindClosest(Vector2 Position, int Width, int Height)
{
byte result = 0;
for (int i = 0; i < 255; i++)
{
if (Main.player[i].active)
{
result = (byte)i;
break;
}
}
float num = -1f;
for (int j = 0; j < 255; j++)
{
if (Main.player[j].active && !Main.player[j].dead)
{
float num2 = Math.Abs(Main.player[j].position.X + (float)(Main.player[j].width / 2) - (Position.X + (float)(Width / 2))) + Math.Abs(Main.player[j].position.Y + (float)(Main.player[j].height / 2) - (Position.Y + (float)(Height / 2)));
if (num == -1f || num2 < num)
{
num = num2;
result = (byte)j;
}
}
}
return result;
}
public void checkArmor()
{
}
public void ToggleInv()
{
if (Main.ingameOptionsWindow)
{
IngameOptions.Close();
return;
}
if (Main.achievementsWindow)
{
AchievementsUI.Close();
return;
}
if (CaptureManager.Instance.Active)
{
CaptureManager.Instance.Active = false;
return;
}
if (this.talkNPC >= 0)
{
this.talkNPC = -1;
Main.npcChatCornerItem = 0;
Main.npcChatText = "";
Main.PlaySound(11, -1, -1, 1);
return;
}
if (this.sign >= 0)
{
this.sign = -1;
Main.editSign = false;
Main.npcChatText = "";
Main.PlaySound(11, -1, -1, 1);
return;
}
if (Main.clothesWindow)
{
Main.CancelClothesWindow(false);
return;
}
if (!Main.playerInventory)
{
Recipe.FindRecipes();
Main.playerInventory = true;
Main.EquipPageSelected = 0;
Main.PlaySound(10, -1, -1, 1);
return;
}
Main.playerInventory = false;
Main.EquipPageSelected = 0;
Main.PlaySound(11, -1, -1, 1);
}
public void dropItemCheck()
{
if (!Main.playerInventory)
{
this.noThrow = 0;
}
if (this.noThrow > 0)
{
this.noThrow--;
}
if (!Main.craftGuide && Main.guideItem.type > 0)
{
Main.guideItem.position = base.Center;
Item item = this.GetItem(this.whoAmI, Main.guideItem, false, true);
if (item.stack > 0)
{
int number = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, item.type, item.stack, false, (int)Main.guideItem.prefix, true);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number, 1f, 0f, 0f, 0, 0, 0);
}
}
Main.guideItem = new Item();
}
if (!Main.reforge && Main.reforgeItem.type > 0)
{
Main.reforgeItem.position = base.Center;
Item item2 = this.GetItem(this.whoAmI, Main.reforgeItem, false, true);
if (item2.stack > 0)
{
int number2 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, item2.type, item2.stack, false, (int)Main.reforgeItem.prefix, true);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number2, 1f, 0f, 0f, 0, 0, 0);
}
}
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 && !Main.gamePaused)
{
Player.tileTargetX = (int)(((float)Main.mouseX + Main.screenPosition.X) / 16f);
Player.tileTargetY = (int)(((float)Main.mouseY + Main.screenPosition.Y) / 16f);
if (this.gravDir == -1f)
{
Player.tileTargetY = (int)((Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16f);
}
if (this.selectedItem != 58)
{
this.oldSelectItem = this.selectedItem;
}
this.selectedItem = 58;
flag = false;
}
if (flag && this.selectedItem == 58)
{
this.selectedItem = this.oldSelectItem;
}
if (WorldGen.InWorld(Player.tileTargetX, Player.tileTargetY, 0) && Main.tile[Player.tileTargetX, Player.tileTargetY] != null && Main.tile[Player.tileTargetX, Player.tileTargetY].type == 334 && this.ItemFitsWeaponRack(this.inventory[this.selectedItem]))
{
this.noThrow = 2;
}
if (WorldGen.InWorld(Player.tileTargetX, Player.tileTargetY, 0) && Main.tile[Player.tileTargetX, Player.tileTargetY] != null && Main.tile[Player.tileTargetX, Player.tileTargetY].type == 395 && this.ItemFitsItemFrame(this.inventory[this.selectedItem]))
{
this.noThrow = 2;
}
if (Main.mouseItem.type > 0 && !Main.playerInventory)
{
Main.mouseItem.position = base.Center;
Item item3 = this.GetItem(this.whoAmI, Main.mouseItem, false, true);
if (item3.stack > 0)
{
int number3 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, item3.type, item3.stack, false, 0, true);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number3, 1f, 0f, 0f, 0, 0, 0);
}
}
Main.mouseItem = new Item();
Recipe.FindRecipes();
}
if (((this.controlThrow && this.releaseThrow && !this.inventory[this.selectedItem].favorited && this.inventory[this.selectedItem].type > 0 && !Main.chatMode) || (((Main.mouseRight && !this.mouseInterface && Main.mouseRightRelease) || !Main.playerInventory) && Main.mouseItem.type > 0 && Main.mouseItem.stack > 0)) && this.noThrow <= 0)
{
if (this.inventory[this.selectedItem].favorited)
{
this.inventory[this.selectedItem] = this.GetItem(this.whoAmI, this.inventory[this.selectedItem], false, true);
if (this.selectedItem == 58)
{
Main.mouseItem = this.inventory[this.selectedItem];
}
Recipe.FindRecipes();
if (this.inventory[this.selectedItem].type == 0)
{
return;
}
}
Item item4 = new Item();
bool flag2 = false;
if (((Main.mouseRight && !this.mouseInterface && Main.mouseRightRelease) || !Main.playerInventory) && Main.mouseItem.type > 0 && Main.mouseItem.stack > 0)
{
item4 = this.inventory[this.selectedItem];
this.inventory[this.selectedItem] = Main.mouseItem;
this.delayUseItem = true;
this.controlUseItem = false;
flag2 = true;
}
int num = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, this.inventory[this.selectedItem].type, 1, false, 0, false);
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[num].position;
Main.item[num] = this.inventory[this.selectedItem];
this.inventory[this.selectedItem] = new Item();
}
if (Main.netMode == 0)
{
Main.item[num].noGrabDelay = 100;
}
Main.item[num].velocity.Y = -2f;
Main.item[num].velocity.X = (float)(4 * this.direction) + this.velocity.X;
Main.item[num].favorited = false;
if (((Main.mouseRight && !this.mouseInterface) || !Main.playerInventory) && Main.mouseItem.type > 0)
{
this.inventory[this.selectedItem] = item4;
Main.mouseItem = new Item();
}
else
{
this.itemAnimation = 10;
this.itemAnimationMax = 10;
}
Recipe.FindRecipes();
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", num, 0f, 0f, 0f, 0, 0, 0);
}
}
}
public int HasBuff(int type)
{
if (this.buffImmune[type])
{
return -1;
}
for (int i = 0; i < 22; i++)
{
if (this.buffTime[i] >= 1 && this.buffType[i] == type)
{
return i;
}
}
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)(Main.expertDebuffTime * (float)num);
}
if (!quiet && Main.netMode == 1)
{
bool flag = true;
for (int i = 0; i < 22; i++)
{
if (this.buffType[i] == type)
{
flag = false;
break;
}
}
if (flag)
{
NetMessage.SendData(55, -1, -1, "", this.whoAmI, (float)type, (float)num, 0f, 0, 0, 0);
}
}
int num2 = -1;
for (int j = 0; j < 22; j++)
{
if (this.buffType[j] == type)
{
if (type == 94)
{
this.buffTime[j] += num;
if (this.buffTime[j] > Player.manaSickTimeMax)
{
this.buffTime[j] = Player.manaSickTimeMax;
return;
}
}
else if (this.buffTime[j] < num)
{
this.buffTime[j] = num;
}
return;
}
}
if (Main.vanityPet[type] || Main.lightPet[type])
{
for (int k = 0; k < 22; k++)
{
if (Main.vanityPet[type] && Main.vanityPet[this.buffType[k]])
{
this.DelBuff(k);
}
if (Main.lightPet[type] && Main.lightPet[this.buffType[k]])
{
this.DelBuff(k);
}
}
}
while (num2 == -1)
{
int num3 = -1;
for (int l = 0; l < 22; l++)
{
if (!Main.debuff[this.buffType[l]])
{
num3 = l;
break;
}
}
if (num3 == -1)
{
return;
}
for (int m = num3; m < 22; m++)
{
if (this.buffType[m] == 0)
{
num2 = m;
break;
}
}
if (num2 == -1)
{
this.DelBuff(num3);
}
}
this.buffType[num2] = type;
this.buffTime[num2] = num;
if (Main.meleeBuff[type])
{
for (int n = 0; n < 22; n++)
{
if (n != num2 && Main.meleeBuff[this.buffType[n]])
{
this.DelBuff(n);
}
}
}
}
public void DelBuff(int b)
{
this.buffTime[b] = 0;
this.buffType[b] = 0;
for (int i = 0; i < 21; i++)
{
if (this.buffTime[i] == 0 || this.buffType[i] == 0)
{
for (int j = i + 1; j < 22; j++)
{
this.buffTime[j - 1] = this.buffTime[j];
this.buffType[j - 1] = this.buffType[j];
this.buffTime[j] = 0;
this.buffType[j] = 0;
}
}
}
}
public void ClearBuff(int type)
{
for (int i = 0; i < 22; i++)
{
if (this.buffType[i] == type)
{
this.DelBuff(i);
}
}
}
public int CountBuffs()
{
int num = 0;
for (int i = 0; i < 22; i++)
{
if (this.buffType[num] > 0)
{
num++;
}
}
return num;
}
public void QuickHeal()
{
if (this.noItems)
{
return;
}
if (this.statLife == this.statLifeMax2 || this.potionDelay > 0)
{
return;
}
int num = this.statLifeMax2 - this.statLife;
Item item = null;
int num2 = -this.statLifeMax2;
for (int i = 0; i < 58; i++)
{
Item item2 = this.inventory[i];
if (item2.stack > 0 && item2.type > 0 && item2.potion && item2.healLife > 0)
{
int num3 = item2.healLife - num;
if (num2 < 0)
{
if (num3 > num2)
{
item = item2;
num2 = num3;
}
}
else if (num3 < num2 && num3 >= 0)
{
item = item2;
num2 = num3;
}
}
}
if (item == null)
{
return;
}
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, item.useSound);
if (item.potion)
{
if (item.type == 227)
{
this.potionDelay = this.restorationDelayTime;
this.AddBuff(21, this.potionDelay, true);
}
else
{
this.potionDelay = this.potionDelayTime;
this.AddBuff(21, this.potionDelay, true);
}
}
this.statLife += item.healLife;
this.statMana += item.healMana;
if (this.statLife > this.statLifeMax2)
{
this.statLife = this.statLifeMax2;
}
if (this.statMana > this.statManaMax2)
{
this.statMana = this.statManaMax2;
}
if (item.healLife > 0 && Main.myPlayer == this.whoAmI)
{
this.HealEffect(item.healLife, true);
}
if (item.healMana > 0 && Main.myPlayer == this.whoAmI)
{
this.ManaEffect(item.healMana);
}
item.stack--;
if (item.stack <= 0)
{
item.type = 0;
item.name = "";
}
Recipe.FindRecipes();
}
public void QuickMana()
{
if (this.noItems)
{
return;
}
if (this.statMana == this.statManaMax2)
{
return;
}
for (int i = 0; i < 58; i++)
{
if (this.inventory[i].stack > 0 && this.inventory[i].type > 0 && this.inventory[i].healMana > 0 && (this.potionDelay == 0 || !this.inventory[i].potion))
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, this.inventory[i].useSound);
if (this.inventory[i].potion)
{
if (this.inventory[i].type == 227)
{
this.potionDelay = this.restorationDelayTime;
this.AddBuff(21, this.potionDelay, true);
}
else
{
this.potionDelay = this.potionDelayTime;
this.AddBuff(21, this.potionDelay, true);
}
}
this.statLife += this.inventory[i].healLife;
this.statMana += this.inventory[i].healMana;
if (this.statLife > this.statLifeMax2)
{
this.statLife = this.statLifeMax2;
}
if (this.statMana > this.statManaMax2)
{
this.statMana = this.statManaMax2;
}
if (this.inventory[i].healLife > 0 && Main.myPlayer == this.whoAmI)
{
this.HealEffect(this.inventory[i].healLife, true);
}
if (this.inventory[i].healMana > 0)
{
this.AddBuff(94, Player.manaSickTime, true);
if (Main.myPlayer == this.whoAmI)
{
this.ManaEffect(this.inventory[i].healMana);
}
}
this.inventory[i].stack--;
if (this.inventory[i].stack <= 0)
{
this.inventory[i].type = 0;
this.inventory[i].name = "";
}
Recipe.FindRecipes();
return;
}
}
}
public void QuickBuff()
{
if (this.noItems)
{
return;
}
int num = 0;
for (int i = 0; i < 58; i++)
{
if (this.CountBuffs() == 22)
{
return;
}
if (this.inventory[i].stack > 0 && this.inventory[i].type > 0 && this.inventory[i].buffType > 0 && !this.inventory[i].summon && this.inventory[i].buffType != 90)
{
int num2 = this.inventory[i].buffType;
bool flag = true;
for (int j = 0; j < 22; j++)
{
if (num2 == 27 && (this.buffType[j] == num2 || this.buffType[j] == 101 || this.buffType[j] == 102))
{
flag = false;
break;
}
if (this.buffType[j] == num2)
{
flag = false;
break;
}
if (Main.meleeBuff[num2] && Main.meleeBuff[this.buffType[j]])
{
flag = false;
break;
}
}
if (Main.lightPet[this.inventory[i].buffType] || Main.vanityPet[this.inventory[i].buffType])
{
for (int k = 0; k < 22; k++)
{
if (Main.lightPet[this.buffType[k]] && Main.lightPet[this.inventory[i].buffType])
{
flag = false;
}
if (Main.vanityPet[this.buffType[k]] && Main.vanityPet[this.inventory[i].buffType])
{
flag = false;
}
}
}
if (this.inventory[i].mana > 0 && flag)
{
if (this.statMana >= (int)((float)this.inventory[i].mana * this.manaCost))
{
this.manaRegenDelay = (int)this.maxRegenDelay;
this.statMana -= (int)((float)this.inventory[i].mana * this.manaCost);
}
else
{
flag = false;
}
}
if (this.whoAmI == Main.myPlayer && this.inventory[i].type == 603 && !Main.cEd)
{
flag = false;
}
if (num2 == 27)
{
num2 = Main.rand.Next(3);
if (num2 == 0)
{
num2 = 27;
}
if (num2 == 1)
{
num2 = 101;
}
if (num2 == 2)
{
num2 = 102;
}
}
if (flag)
{
num = this.inventory[i].useSound;
int num3 = this.inventory[i].buffTime;
if (num3 == 0)
{
num3 = 3600;
}
this.AddBuff(num2, num3, true);
if (this.inventory[i].consumable)
{
this.inventory[i].stack--;
if (this.inventory[i].stack <= 0)
{
this.inventory[i].type = 0;
this.inventory[i].name = "";
}
}
}
}
}
if (num > 0)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, num);
Recipe.FindRecipes();
}
}
public void QuickMount()
{
if (this.mount.Active)
{
this.mount.Dismount(this);
return;
}
if (this.frozen || this.tongued || this.webbed || this.stoned || this.gravDir == -1f)
{
return;
}
if (this.noItems)
{
return;
}
Item item = null;
if (item == null && this.miscEquips[3].mountType != -1 && !MountID.Sets.Cart[this.miscEquips[3].mountType])
{
item = this.miscEquips[3];
}
if (item == null)
{
for (int i = 0; i < 58; i++)
{
if (this.inventory[i].mountType != -1 && !MountID.Sets.Cart[this.inventory[i].mountType])
{
item = this.inventory[i];
break;
}
}
}
if (item != null && item.mountType != -1 && this.mount.CanMount(item.mountType, this))
{
this.mount.SetMount(item.mountType, this, false);
if (item.useSound > 0)
{
Main.PlaySound(2, (int)base.Center.X, (int)base.Center.Y, item.useSound);
}
}
}
public void QuickGrapple()
{
if (this.frozen || this.tongued || this.webbed || this.stoned)
{
return;
}
if (this.mount.Active)
{
this.mount.Dismount(this);
}
if (this.noItems)
{
return;
}
Item item = null;
if (item == null && Main.projHook[this.miscEquips[4].shoot])
{
item = this.miscEquips[4];
}
if (item == null)
{
for (int i = 0; i < 58; i++)
{
if (Main.projHook[this.inventory[i].shoot])
{
item = this.inventory[i];
break;
}
}
}
if (item == null)
{
return;
}
if (item.shoot == 73)
{
int num = 0;
for (int j = 0; j < 1000; j++)
{
if (Main.projectile[j].active && Main.projectile[j].owner == Main.myPlayer && (Main.projectile[j].type == 73 || Main.projectile[j].type == 74))
{
num++;
}
}
if (num > 1)
{
item = null;
}
}
else if (item.shoot == 165)
{
int num2 = 0;
for (int k = 0; k < 1000; k++)
{
if (Main.projectile[k].active && Main.projectile[k].owner == Main.myPlayer && Main.projectile[k].type == 165)
{
num2++;
}
}
if (num2 > 8)
{
item = null;
}
}
else if (item.shoot == 372)
{
int num3 = 0;
for (int l = 0; l < 1000; l++)
{
if (Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == 372)
{
num3++;
}
}
if (num3 > 2)
{
item = null;
}
}
else if (item.shoot == 165)
{
int num4 = 0;
for (int m = 0; m < 1000; m++)
{
if (Main.projectile[m].active && Main.projectile[m].owner == Main.myPlayer && Main.projectile[m].type >= 646 && Main.projectile[m].type <= 649)
{
num4++;
}
}
if (num4 > 4)
{
item = null;
}
}
else
{
for (int n = 0; n < 1000; n++)
{
if (Main.projectile[n].active && Main.projectile[n].owner == Main.myPlayer && Main.projectile[n].type == item.shoot && Main.projectile[n].ai[0] != 2f)
{
item = null;
break;
}
}
}
if (item != null)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, item.useSound);
if (Main.netMode == 1 && this.whoAmI == Main.myPlayer)
{
NetMessage.SendData(51, -1, -1, "", this.whoAmI, 2f, 0f, 0f, 0, 0, 0);
}
int num5 = item.shoot;
float shootSpeed = item.shootSpeed;
int damage = item.damage;
float knockBack = item.knockBack;
if (num5 == 13 || num5 == 32 || num5 == 315 || (num5 >= 230 && num5 <= 235) || num5 == 331)
{
this.grappling[0] = -1;
this.grapCount = 0;
for (int num6 = 0; num6 < 1000; num6++)
{
if (Main.projectile[num6].active && Main.projectile[num6].owner == this.whoAmI)
{
if (Main.projectile[num6].type == 13)
{
Main.projectile[num6].Kill();
}
if (Main.projectile[num6].type == 331)
{
Main.projectile[num6].Kill();
}
if (Main.projectile[num6].type == 315)
{
Main.projectile[num6].Kill();
}
if (Main.projectile[num6].type >= 230 && Main.projectile[num6].type <= 235)
{
Main.projectile[num6].Kill();
}
}
}
}
if (num5 == 256)
{
int num7 = 0;
int num8 = -1;
int num9 = 100000;
for (int num10 = 0; num10 < 1000; num10++)
{
if (Main.projectile[num10].active && Main.projectile[num10].owner == this.whoAmI && Main.projectile[num10].type == 256)
{
num7++;
if (Main.projectile[num10].timeLeft < num9)
{
num8 = num10;
num9 = Main.projectile[num10].timeLeft;
}
}
}
if (num7 > 1)
{
Main.projectile[num8].Kill();
}
}
if (num5 == 73)
{
for (int num11 = 0; num11 < 1000; num11++)
{
if (Main.projectile[num11].active && Main.projectile[num11].owner == this.whoAmI && Main.projectile[num11].type == 73)
{
num5 = 74;
}
}
}
if (item.type == 3572)
{
int num12 = -1;
int num13 = -1;
for (int num14 = 0; num14 < 1000; num14++)
{
Projectile projectile = Main.projectile[num14];
if (projectile.active && projectile.owner == this.whoAmI && projectile.type >= 646 && projectile.type <= 649 && (num13 == -1 || num13 < projectile.timeLeft))
{
num12 = projectile.type;
num13 = projectile.timeLeft;
}
}
int num15 = num12;
if (num15 != -1)
{
switch (num15)
{
case 646:
num5 = 647;
goto IL_636;
case 647:
num5 = 648;
goto IL_636;
case 648:
num5 = 649;
goto IL_636;
case 649:
break;
default:
goto IL_636;
}
}
num5 = 646;
}
IL_636:
Vector2 vector = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num16 = (float)Main.mouseX + Main.screenPosition.X - vector.X;
float num17 = (float)Main.mouseY + Main.screenPosition.Y - vector.Y;
if (this.gravDir == -1f)
{
num17 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector.Y;
}
float num18 = (float)Math.Sqrt((double)(num16 * num16 + num17 * num17));
if ((float.IsNaN(num16) && float.IsNaN(num17)) || (num16 == 0f && num17 == 0f))
{
num16 = (float)this.direction;
num17 = 0f;
num18 = shootSpeed;
}
else
{
num18 = shootSpeed / num18;
}
num16 *= num18;
num17 *= num18;
Projectile.NewProjectile(vector.X, vector.Y, num16, num17, num5, damage, knockBack, this.whoAmI, 0f, 0f);
}
}
public void StatusNPC(int type, int i)
{
if (this.meleeEnchant > 0)
{
if (this.meleeEnchant == 1)
{
Main.npc[i].AddBuff(70, 60 * Main.rand.Next(5, 10), false);
}
if (this.meleeEnchant == 2)
{
Main.npc[i].AddBuff(39, 60 * Main.rand.Next(3, 7), false);
}
if (this.meleeEnchant == 3)
{
Main.npc[i].AddBuff(24, 60 * Main.rand.Next(3, 7), false);
}
if (this.meleeEnchant == 5)
{
Main.npc[i].AddBuff(69, 60 * Main.rand.Next(10, 20), false);
}
if (this.meleeEnchant == 6)
{
Main.npc[i].AddBuff(31, 60 * Main.rand.Next(1, 4), false);
}
if (this.meleeEnchant == 8)
{
Main.npc[i].AddBuff(20, 60 * Main.rand.Next(5, 10), false);
}
if (this.meleeEnchant == 4)
{
Main.npc[i].AddBuff(72, 120, false);
}
}
if (this.frostBurn)
{
Main.npc[i].AddBuff(44, 60 * Main.rand.Next(5, 15), false);
}
if (this.magmaStone)
{
if (Main.rand.Next(4) == 0)
{
Main.npc[i].AddBuff(24, 360, false);
}
else if (Main.rand.Next(2) == 0)
{
Main.npc[i].AddBuff(24, 240, false);
}
else
{
Main.npc[i].AddBuff(24, 120, false);
}
}
if (type == 3211)
{
Main.npc[i].AddBuff(69, 60 * Main.rand.Next(5, 10), false);
}
if (type == 121)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[i].AddBuff(24, 180, false);
return;
}
}
else if (type == 122)
{
if (Main.rand.Next(10) == 0)
{
Main.npc[i].AddBuff(24, 180, false);
return;
}
}
else if (type == 190)
{
if (Main.rand.Next(4) == 0)
{
Main.npc[i].AddBuff(20, 420, false);
return;
}
}
else if (type == 217)
{
if (Main.rand.Next(5) == 0)
{
Main.npc[i].AddBuff(24, 180, false);
return;
}
}
else if (type == 1123 && Main.rand.Next(10) != 0)
{
Main.npc[i].AddBuff(31, 120, false);
}
}
public void StatusPvP(int type, int i)
{
if (this.meleeEnchant > 0)
{
if (this.meleeEnchant == 1)
{
Main.player[i].AddBuff(70, 60 * Main.rand.Next(5, 10), true);
}
if (this.meleeEnchant == 2)
{
Main.player[i].AddBuff(39, 60 * Main.rand.Next(3, 7), true);
}
if (this.meleeEnchant == 3)
{
Main.player[i].AddBuff(24, 60 * Main.rand.Next(3, 7), true);
}
if (this.meleeEnchant == 5)
{
Main.player[i].AddBuff(69, 60 * Main.rand.Next(10, 20), true);
}
if (this.meleeEnchant == 6)
{
Main.player[i].AddBuff(31, 60 * Main.rand.Next(1, 4), true);
}
if (this.meleeEnchant == 8)
{
Main.player[i].AddBuff(20, 60 * Main.rand.Next(5, 10), true);
}
}
if (this.frostBurn)
{
Main.player[i].AddBuff(44, 60 * Main.rand.Next(1, 8), true);
}
if (this.magmaStone)
{
if (Main.rand.Next(7) == 0)
{
Main.player[i].AddBuff(24, 360, true);
}
else if (Main.rand.Next(3) == 0)
{
Main.player[i].AddBuff(24, 120, true);
}
else
{
Main.player[i].AddBuff(24, 60, true);
}
}
if (type == 121)
{
if (Main.rand.Next(2) == 0)
{
Main.player[i].AddBuff(24, 180, false);
return;
}
}
else if (type == 122)
{
if (Main.rand.Next(10) == 0)
{
Main.player[i].AddBuff(24, 180, false);
return;
}
}
else if (type == 190)
{
if (Main.rand.Next(4) == 0)
{
Main.player[i].AddBuff(20, 420, false);
return;
}
}
else if (type == 217)
{
if (Main.rand.Next(5) == 0)
{
Main.player[i].AddBuff(24, 180, false);
return;
}
}
else if (type == 1123 && Main.rand.Next(9) != 0)
{
Main.player[i].AddBuff(31, 120, false);
}
}
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.chatMode && !Main.editSign && !Main.editChest && !Main.blockInput)
{
Keys[] pressedKeys = Main.keyState.GetPressedKeys();
if (Main.blockKey != Keys.None)
{
bool flag = false;
for (int i = 0; i < pressedKeys.Length; i++)
{
if (pressedKeys[i] == Main.blockKey)
{
pressedKeys[i] = Keys.None;
flag = true;
}
}
if (!flag)
{
Main.blockKey = Keys.None;
}
}
for (int j = 0; j < pressedKeys.Length; j++)
{
string a = string.Concat(pressedKeys[j]);
if (a == Main.cUp)
{
this.controlUp = true;
}
if (a == Main.cLeft)
{
this.controlLeft = true;
}
if (a == Main.cDown)
{
this.controlDown = true;
}
if (a == Main.cRight)
{
this.controlRight = true;
}
if (a == Main.cJump)
{
this.controlJump = true;
}
}
}
if (this.controlUp || this.controlJump)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.9f;
}
this.velocity.Y = this.velocity.Y - 0.1f;
if (this.velocity.Y < -3f)
{
this.velocity.Y = -3f;
}
}
else if (this.controlDown)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.9f;
}
this.velocity.Y = this.velocity.Y + 0.1f;
if (this.velocity.Y > 3f)
{
this.velocity.Y = 3f;
}
}
else if ((double)this.velocity.Y < -0.1 || (double)this.velocity.Y > 0.1)
{
this.velocity.Y = this.velocity.Y * 0.9f;
}
else
{
this.velocity.Y = 0f;
}
if (this.controlLeft && !this.controlRight)
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.9f;
}
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X < -3f)
{
this.velocity.X = -3f;
}
}
else if (this.controlRight && !this.controlLeft)
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.9f;
}
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X > 3f)
{
this.velocity.X = 3f;
}
}
else if ((double)this.velocity.X < -0.1 || (double)this.velocity.X > 0.1)
{
this.velocity.X = this.velocity.X * 0.9f;
}
else
{
this.velocity.X = 0f;
}
this.position += this.velocity;
this.ghostFrameCounter++;
if (this.velocity.X < 0f)
{
this.direction = -1;
}
else if (this.velocity.X > 0f)
{
this.direction = 1;
}
if (this.ghostFrameCounter >= 8)
{
this.ghostFrameCounter = 0;
this.ghostFrame++;
if (this.ghostFrame >= 4)
{
this.ghostFrame = 0;
}
}
if (this.position.X < Main.leftWorld + (float)(Lighting.offScreenTiles * 16) + 16f)
{
this.position.X = Main.leftWorld + (float)(Lighting.offScreenTiles * 16) + 16f;
this.velocity.X = 0f;
}
if (this.position.X + (float)this.width > Main.rightWorld - (float)(Lighting.offScreenTiles * 16) - 32f)
{
this.position.X = Main.rightWorld - (float)(Lighting.offScreenTiles * 16) - 32f - (float)this.width;
this.velocity.X = 0f;
}
if (this.position.Y < Main.topWorld + (float)(Lighting.offScreenTiles * 16) + 16f)
{
this.position.Y = Main.topWorld + (float)(Lighting.offScreenTiles * 16) + 16f;
if ((double)this.velocity.Y < -0.1)
{
this.velocity.Y = -0.1f;
}
}
if (this.position.Y > Main.bottomWorld - (float)(Lighting.offScreenTiles * 16) - 32f - (float)this.height)
{
this.position.Y = Main.bottomWorld - (float)(Lighting.offScreenTiles * 16) - 32f - (float)this.height;
this.velocity.Y = 0f;
}
}
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, true);
}
if (this.onHitRegen)
{
this.AddBuff(58, 300, true);
}
if (this.stardustMinion && victim is NPC)
{
for (int i = 0; i < 1000; i++)
{
Projectile projectile = Main.projectile[i];
if (projectile.active && projectile.owner == this.whoAmI && projectile.type == 613 && projectile.localAI[1] <= 0f && Main.rand.Next(2) == 0)
{
Vector2 value = new Vector2(x, y) - projectile.Center;
if (value.Length() > 0f)
{
value.Normalize();
}
value *= 20f;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value.X, value.Y, 614, projectile.damage / 3, 0f, projectile.owner, 0f, (float)victim.whoAmI);
projectile.localAI[1] = (float)(30 + Main.rand.Next(4) * 10);
}
}
}
if (this.onHitPetal && this.petalTimer == 0)
{
this.petalTimer = 20;
if (x < this.position.X + (float)(this.width / 2))
{
}
int direction = this.direction;
float num = Main.screenPosition.X;
if (direction < 0)
{
num += (float)Main.screenWidth;
}
float num2 = Main.screenPosition.Y;
num2 += (float)Main.rand.Next(Main.screenHeight);
Vector2 vector = new Vector2(num, num2);
float num3 = x - vector.X;
float num4 = y - vector.Y;
num3 += (float)Main.rand.Next(-50, 51) * 0.1f;
num4 += (float)Main.rand.Next(-50, 51) * 0.1f;
int num5 = 24;
float num6 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4));
num6 = (float)num5 / num6;
num3 *= num6;
num4 *= num6;
Projectile.NewProjectile(num, num2, num3, num4, 221, 36, 0f, this.whoAmI, 0f, 0f);
}
if (this.crystalLeaf && this.petalTimer == 0)
{
int arg_2D2_0 = this.inventory[this.selectedItem].type;
for (int j = 0; j < 1000; j++)
{
if (Main.projectile[j].owner == this.whoAmI && Main.projectile[j].type == 226)
{
this.petalTimer = 50;
float num7 = 12f;
Vector2 vector2 = new Vector2(Main.projectile[j].position.X + (float)this.width * 0.5f, Main.projectile[j].position.Y + (float)this.height * 0.5f);
float num8 = x - vector2.X;
float num9 = y - vector2.Y;
float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9));
num10 = num7 / num10;
num8 *= num10;
num9 *= num10;
Projectile.NewProjectile(Main.projectile[j].Center.X - 4f, Main.projectile[j].Center.Y, num8, num9, 227, Player.crystalLeafDamage, (float)Player.crystalLeafKB, this.whoAmI, 0f, 0f);
return;
}
}
}
}
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, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(30) == 0)
{
int number2 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1922, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number2, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(400) == 0)
{
int number3 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1927, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number3, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(150) == 0)
{
int number4 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1870, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number4, 1f, 0f, 0f, 0, 0, 0);
}
number4 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 97, Main.rand.Next(30, 61), false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number4, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(150) == 0)
{
int number5 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1909, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number5, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(150) == 0)
{
int number6 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1917, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number6, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(150) == 0)
{
int number7 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1915, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number7, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(150) == 0)
{
int number8 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1918, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number8, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(150) == 0)
{
int number9 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1921, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number9, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(300) == 0)
{
int number10 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1923, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number10, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(40) == 0)
{
int number11 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1907, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number11, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(10) == 0)
{
int number12 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1908, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number12, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(15) == 0)
{
int num = Main.rand.Next(5);
if (num == 0)
{
int number13 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1932, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number13, 1f, 0f, 0f, 0, 0, 0);
}
number13 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1933, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number13, 1f, 0f, 0f, 0, 0, 0);
}
number13 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1934, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number13, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 1)
{
int number14 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1935, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number14, 1f, 0f, 0f, 0, 0, 0);
}
number14 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1936, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number14, 1f, 0f, 0f, 0, 0, 0);
}
number14 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1937, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number14, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 2)
{
int number15 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1940, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number15, 1f, 0f, 0f, 0, 0, 0);
}
number15 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1941, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number15, 1f, 0f, 0f, 0, 0, 0);
}
number15 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1942, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number15, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 3)
{
int number16 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1938, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number16, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 4)
{
int number17 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1939, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number17, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
}
else if (Main.rand.Next(7) == 0)
{
int num2 = Main.rand.Next(3);
if (num2 == 0)
{
num2 = 1911;
}
if (num2 == 1)
{
num2 = 1919;
}
if (num2 == 2)
{
num2 = 1920;
}
int number18 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num2, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number18, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(8) == 0)
{
int number19 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1912, Main.rand.Next(1, 4), false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number19, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(9) == 0)
{
int number20 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1913, Main.rand.Next(20, 41), false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number20, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else
{
int num3 = Main.rand.Next(3);
if (num3 == 0)
{
int number21 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1872, Main.rand.Next(20, 50), false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number21, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num3 == 1)
{
int number22 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 586, Main.rand.Next(20, 50), false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number22, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else
{
int number23 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 591, Main.rand.Next(20, 50), false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number23, 1f, 0f, 0f, 0, 0, 0);
}
}
}
}
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, false, -1, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number, 1f, 0f, 0f, 0, 0, 0);
}
}
public void OpenBossBag(int type)
{
if (type == 3318)
{
if (Main.rand.Next(2) == 0)
{
this.QuickSpawnItem(2430, 1);
}
if (Main.rand.Next(7) == 0)
{
this.QuickSpawnItem(2493, 1);
}
int num = Main.rand.Next(256, 259);
int num2;
for (num2 = Main.rand.Next(256, 259); num2 == num; num2 = Main.rand.Next(256, 259))
{
}
this.QuickSpawnItem(num, 1);
this.QuickSpawnItem(num2, 1);
if (Main.rand.Next(2) == 0)
{
this.QuickSpawnItem(2610, 1);
}
else
{
this.QuickSpawnItem(2585, 1);
}
this.QuickSpawnItem(998, 1);
this.QuickSpawnItem(3090, 1);
}
else if (type == 3319)
{
if (Main.rand.Next(7) == 0)
{
this.QuickSpawnItem(2112, 1);
}
if (Main.rand.Next(30) == 0)
{
this.QuickSpawnItem(1299, 1);
}
if (WorldGen.crimson)
{
int num3 = Main.rand.Next(20) + 10;
num3 += Main.rand.Next(20) + 10;
num3 += Main.rand.Next(20) + 10;
this.QuickSpawnItem(880, num3);
num3 = Main.rand.Next(3) + 1;
this.QuickSpawnItem(2171, num3);
}
else
{
int num4 = Main.rand.Next(20) + 10;
num4 += Main.rand.Next(20) + 10;
num4 += Main.rand.Next(20) + 10;
this.QuickSpawnItem(56, num4);
num4 = Main.rand.Next(3) + 1;
this.QuickSpawnItem(59, num4);
num4 = Main.rand.Next(30) + 20;
this.QuickSpawnItem(47, num4);
}
this.QuickSpawnItem(3097, 1);
}
else if (type == 3320)
{
int num5 = Main.rand.Next(15, 30);
num5 += Main.rand.Next(15, 31);
this.QuickSpawnItem(56, num5);
num5 = Main.rand.Next(10, 20);
this.QuickSpawnItem(86, num5);
if (Main.rand.Next(20) == 0)
{
this.QuickSpawnItem(994, 1);
}
if (Main.rand.Next(7) == 0)
{
this.QuickSpawnItem(2111, 1);
}
this.QuickSpawnItem(3224, 1);
}
else if (type == 3321)
{
int num6 = Main.rand.Next(20, 46);
num6 += Main.rand.Next(20, 46);
this.QuickSpawnItem(880, num6);
num6 = Main.rand.Next(10, 20);
this.QuickSpawnItem(1329, num6);
if (Main.rand.Next(7) == 0)
{
this.QuickSpawnItem(2104, 1);
}
if (Main.rand.Next(20) == 0)
{
this.QuickSpawnItem(3060, 1);
}
this.QuickSpawnItem(3223, 1);
}
else if (type == 3322)
{
if (Main.rand.Next(7) == 0)
{
this.QuickSpawnItem(2108, 1);
}
int num7 = Main.rand.Next(3);
if (num7 == 0)
{
num7 = 1121;
}
else if (num7 == 1)
{
num7 = 1123;
}
else if (num7 == 2)
{
num7 = 2888;
}
this.QuickSpawnItem(num7, 1);
this.QuickSpawnItem(3333, 1);
if (Main.rand.Next(3) == 0)
{
this.QuickSpawnItem(1132, 1);
}
if (Main.rand.Next(9) == 0)
{
this.QuickSpawnItem(1170, 1);
}
if (Main.rand.Next(9) == 0)
{
this.QuickSpawnItem(2502, 1);
}
this.QuickSpawnItem(1129, 1);
this.QuickSpawnItem(Main.rand.Next(842, 845), 1);
this.QuickSpawnItem(1130, Main.rand.Next(10, 30));
this.QuickSpawnItem(2431, Main.rand.Next(17, 30));
}
else if (type == 3323)
{
this.QuickSpawnItem(3245, 1);
int num8 = Main.rand.Next(3);
if (num8 == 0)
{
this.QuickSpawnItem(1281, 1);
}
else if (num8 == 1)
{
this.QuickSpawnItem(1273, 1);
}
else
{
this.QuickSpawnItem(1313, 1);
}
}
else if (type == 3324)
{
if (Main.rand.Next(7) == 0)
{
this.QuickSpawnItem(2105, 1);
}
this.QuickSpawnItem(367, 1);
if (!this.extraAccessory)
{
this.QuickSpawnItem(3335, 1);
}
int num9 = Main.rand.Next(4);
if (num9 == 3)
{
num9 = 2998;
}
else
{
num9 = 489 + num9;
}
this.QuickSpawnItem(num9, 1);
int num10 = Main.rand.Next(3);
if (num10 == 0)
{
this.QuickSpawnItem(514, 1);
}
else if (num10 == 1)
{
this.QuickSpawnItem(426, 1);
}
else if (num10 == 2)
{
this.QuickSpawnItem(434, 1);
}
}
else if (type == 3325)
{
this.TryGettingDevArmor();
if (Main.rand.Next(7) == 0)
{
this.QuickSpawnItem(2113, 1);
}
this.QuickSpawnItem(548, Main.rand.Next(25, 41));
this.QuickSpawnItem(1225, Main.rand.Next(20, 36));
this.QuickSpawnItem(3355, 1);
}
else if (type == 3326)
{
this.TryGettingDevArmor();
if (Main.rand.Next(7) == 0)
{
this.QuickSpawnItem(2106, 1);
}
this.QuickSpawnItem(549, Main.rand.Next(25, 41));
this.QuickSpawnItem(1225, Main.rand.Next(20, 36));
this.QuickSpawnItem(3354, 1);
}
else if (type == 3327)
{
this.TryGettingDevArmor();
if (Main.rand.Next(7) == 0)
{
this.QuickSpawnItem(2107, 1);
}
this.QuickSpawnItem(547, Main.rand.Next(25, 41));
this.QuickSpawnItem(1225, Main.rand.Next(20, 36));
this.QuickSpawnItem(3356, 1);
}
else if (type == 3328)
{
this.TryGettingDevArmor();
if (Main.rand.Next(7) == 0)
{
this.QuickSpawnItem(2109, 1);
}
this.QuickSpawnItem(1141, 1);
this.QuickSpawnItem(3336, 1);
if (Main.rand.Next(15) == 0)
{
this.QuickSpawnItem(1182, 1);
}
if (Main.rand.Next(20) == 0)
{
this.QuickSpawnItem(1305, 1);
}
if (Main.rand.Next(2) == 0)
{
this.QuickSpawnItem(1157, 1);
}
if (Main.rand.Next(10) == 0)
{
this.QuickSpawnItem(3021, 1);
}
int num11 = Main.rand.Next(6);
if (num11 == 0)
{
this.QuickSpawnItem(758, 1);
this.QuickSpawnItem(771, Main.rand.Next(50, 150));
}
else if (num11 == 1)
{
this.QuickSpawnItem(1255, 1);
}
else if (num11 == 2)
{
this.QuickSpawnItem(788, 1);
}
else if (num11 == 3)
{
this.QuickSpawnItem(1178, 1);
}
else if (num11 == 4)
{
this.QuickSpawnItem(1259, 1);
}
else if (num11 == 5)
{
this.QuickSpawnItem(1155, 1);
}
}
else if (type == 3329)
{
this.TryGettingDevArmor();
this.QuickSpawnItem(3337, 1);
if (Main.rand.Next(7) == 0)
{
this.QuickSpawnItem(2110, 1);
}
int num12 = Main.rand.Next(8);
if (num12 == 0)
{
this.QuickSpawnItem(1258, 1);
this.QuickSpawnItem(1261, Main.rand.Next(60, 100));
}
else if (num12 == 1)
{
this.QuickSpawnItem(1122, 1);
}
else if (num12 == 2)
{
this.QuickSpawnItem(899, 1);
}
else if (num12 == 3)
{
this.QuickSpawnItem(1248, 1);
}
else if (num12 == 4)
{
this.QuickSpawnItem(1294, 1);
}
else if (num12 == 5)
{
this.QuickSpawnItem(1295, 1);
}
else if (num12 == 6)
{
this.QuickSpawnItem(1296, 1);
}
else if (num12 == 7)
{
this.QuickSpawnItem(1297, 1);
}
this.QuickSpawnItem(2218, Main.rand.Next(18, 24));
}
else if (type == 3330)
{
this.TryGettingDevArmor();
this.QuickSpawnItem(3367, 1);
if (Main.rand.Next(7) == 0)
{
this.QuickSpawnItem(2588, 1);
}
if (Main.rand.Next(10) == 0)
{
this.QuickSpawnItem(2609, 1);
}
int num13 = Main.rand.Next(5);
if (num13 == 0)
{
this.QuickSpawnItem(2611, 1);
}
else if (num13 == 1)
{
this.QuickSpawnItem(2624, 1);
}
else if (num13 == 2)
{
this.QuickSpawnItem(2622, 1);
}
else if (num13 == 3)
{
this.QuickSpawnItem(2621, 1);
}
else if (num13 == 4)
{
this.QuickSpawnItem(2623, 1);
}
}
else if (type == 3331)
{
this.TryGettingDevArmor();
if (Main.rand.Next(7) == 0)
{
this.QuickSpawnItem(3372, 1);
}
}
else if (type == 3332)
{
this.TryGettingDevArmor();
if (Main.rand.Next(7) == 0)
{
this.QuickSpawnItem(3373, 1);
}
if (!this.HasItem(3384))
{
this.QuickSpawnItem(3384, 1);
}
this.QuickSpawnItem(3460, Main.rand.Next(90, 111));
this.QuickSpawnItem(1131, 1);
this.QuickSpawnItem(3577, 1);
int item = Utils.SelectRandom<int>(Main.rand, new int[]
{
3063,
3389,
3065,
1553,
3546,
3541,
3570,
3571,
3569
});
this.QuickSpawnItem(item, 1);
}
int num14 = -1;
if (type == 3318)
{
num14 = 50;
}
if (type == 3319)
{
num14 = 4;
}
if (type == 3320)
{
num14 = 13;
}
if (type == 3321)
{
num14 = 266;
}
if (type == 3322)
{
num14 = 222;
}
if (type == 3323)
{
num14 = 35;
}
if (type == 3324)
{
num14 = 113;
}
if (type == 3325)
{
num14 = 134;
}
if (type == 3326)
{
num14 = 125;
}
if (type == 3327)
{
num14 = 127;
}
if (type == 3328)
{
num14 = 262;
}
if (type == 3329)
{
num14 = 245;
}
if (type == 3330)
{
num14 = 370;
}
if (type == 3331)
{
num14 = 439;
}
if (type == 3332)
{
num14 = 398;
}
if (num14 > 0)
{
NPC nPC = new NPC();
nPC.SetDefaults(num14, -1f);
float num15 = nPC.value;
num15 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
if (Main.rand.Next(5) == 0)
{
num15 *= 1f + (float)Main.rand.Next(5, 11) * 0.01f;
}
if (Main.rand.Next(10) == 0)
{
num15 *= 1f + (float)Main.rand.Next(10, 21) * 0.01f;
}
if (Main.rand.Next(15) == 0)
{
num15 *= 1f + (float)Main.rand.Next(15, 31) * 0.01f;
}
if (Main.rand.Next(20) == 0)
{
num15 *= 1f + (float)Main.rand.Next(20, 41) * 0.01f;
}
while ((int)num15 > 0)
{
if (num15 > 1000000f)
{
int num16 = (int)(num15 / 1000000f);
num15 -= (float)(1000000 * num16);
this.QuickSpawnItem(74, num16);
}
else if (num15 > 10000f)
{
int num17 = (int)(num15 / 10000f);
num15 -= (float)(10000 * num17);
this.QuickSpawnItem(73, num17);
}
else if (num15 > 100f)
{
int num18 = (int)(num15 / 100f);
num15 -= (float)(100 * num18);
this.QuickSpawnItem(72, num18);
}
else
{
int num19 = (int)num15;
if (num19 < 1)
{
num19 = 1;
}
num15 -= (float)num19;
this.QuickSpawnItem(71, num19);
}
}
}
}
private void TryGettingDevArmor()
{
if (Main.rand.Next(20) != 0)
{
return;
}
Main.rand.Next(7);
switch (Main.rand.Next(12))
{
case 0:
this.QuickSpawnItem(666, 1);
this.QuickSpawnItem(667, 1);
this.QuickSpawnItem(668, 1);
this.QuickSpawnItem(665, 1);
return;
case 1:
this.QuickSpawnItem(1554, 1);
this.QuickSpawnItem(1555, 1);
this.QuickSpawnItem(1556, 1);
this.QuickSpawnItem(1586, 1);
return;
case 2:
this.QuickSpawnItem(1587, 1);
this.QuickSpawnItem(1588, 1);
this.QuickSpawnItem(1586, 1);
return;
case 3:
this.QuickSpawnItem(1557, 1);
this.QuickSpawnItem(1558, 1);
this.QuickSpawnItem(1559, 1);
this.QuickSpawnItem(1585, 1);
return;
case 4:
this.QuickSpawnItem(1560, 1);
this.QuickSpawnItem(1561, 1);
this.QuickSpawnItem(1562, 1);
this.QuickSpawnItem(1584, 1);
return;
case 5:
this.QuickSpawnItem(1563, 1);
this.QuickSpawnItem(1564, 1);
this.QuickSpawnItem(1565, 1);
this.QuickSpawnItem(3582, 1);
return;
case 6:
this.QuickSpawnItem(1566, 1);
this.QuickSpawnItem(1567, 1);
this.QuickSpawnItem(1568, 1);
return;
case 7:
this.QuickSpawnItem(1580, 1);
this.QuickSpawnItem(1581, 1);
this.QuickSpawnItem(1582, 1);
this.QuickSpawnItem(1583, 1);
return;
case 8:
this.QuickSpawnItem(3226, 1);
this.QuickSpawnItem(3227, 1);
this.QuickSpawnItem(3228, 1);
return;
case 9:
this.QuickSpawnItem(3583, 1);
this.QuickSpawnItem(3581, 1);
this.QuickSpawnItem(3578, 1);
this.QuickSpawnItem(3579, 1);
this.QuickSpawnItem(3580, 1);
return;
case 10:
this.QuickSpawnItem(3585, 1);
this.QuickSpawnItem(3586, 1);
this.QuickSpawnItem(3587, 1);
this.QuickSpawnItem(3588, 1);
this.QuickSpawnItem(3024, 4);
return;
case 11:
this.QuickSpawnItem(3589, 1);
this.QuickSpawnItem(3590, 1);
this.QuickSpawnItem(3591, 1);
this.QuickSpawnItem(3592, 1);
this.QuickSpawnItem(3599, 4);
return;
default:
return;
}
}
public void openCrate(int type)
{
int num = type - 2334;
if (type >= 3203)
{
num = type - 3203 + 3;
}
if (num == 0)
{
bool flag = true;
while (flag)
{
if (Main.hardMode && flag && Main.rand.Next(200) == 0)
{
int number = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 3064, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number, 1f, 0f, 0f, 0, 0, 0);
}
flag = false;
}
if (flag && Main.rand.Next(40) == 0)
{
int type2 = 3200;
int stack = 1;
int number2 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type2, stack, false, -1, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number2, 1f, 0f, 0f, 0, 0, 0);
}
flag = false;
}
if (flag && Main.rand.Next(40) == 0)
{
int type3 = 3201;
int stack2 = 1;
int number3 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type3, stack2, false, -1, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number3, 1f, 0f, 0f, 0, 0, 0);
}
flag = false;
}
if (Main.hardMode && flag && Main.rand.Next(25) == 0)
{
int type4 = 2424;
int stack3 = 1;
int number4 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type4, stack3, false, -1, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number4, 1f, 0f, 0f, 0, 0, 0);
}
flag = false;
}
if (Main.rand.Next(45) == 0)
{
int num2 = Main.rand.Next(5);
if (num2 == 0)
{
num2 = 285;
}
else if (num2 == 1)
{
num2 = 953;
}
else if (num2 == 2)
{
num2 = 946;
}
else if (num2 == 3)
{
num2 = 3068;
}
else if (num2 == 4)
{
num2 = 3084;
}
int number5 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num2, 1, false, -1, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number5, 1f, 0f, 0f, 0, 0, 0);
}
flag = false;
}
if (!Main.hardMode && flag && Main.rand.Next(50) == 0)
{
int type5 = 997;
int stack4 = 1;
int number6 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type5, stack4, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number6, 1f, 0f, 0f, 0, 0, 0);
}
flag = false;
}
if (Main.rand.Next(7) == 0)
{
int type6;
int stack5;
if (Main.rand.Next(3) == 0)
{
type6 = 73;
stack5 = Main.rand.Next(1, 6);
}
else
{
type6 = 72;
stack5 = Main.rand.Next(20, 91);
}
int number7 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type6, stack5, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number7, 1f, 0f, 0f, 0, 0, 0);
}
flag = false;
}
if (Main.rand.Next(7) == 0)
{
int num3 = Main.rand.Next(8);
if (num3 == 0)
{
num3 = 12;
}
else if (num3 == 1)
{
num3 = 11;
}
else if (num3 == 2)
{
num3 = 14;
}
else if (num3 == 3)
{
num3 = 13;
}
else if (num3 == 4)
{
num3 = 699;
}
else if (num3 == 5)
{
num3 = 700;
}
else if (num3 == 6)
{
num3 = 701;
}
else if (num3 == 7)
{
num3 = 702;
}
if (Main.hardMode && Main.rand.Next(2) == 0)
{
num3 = Main.rand.Next(6);
if (num3 == 0)
{
num3 = 364;
}
else if (num3 == 1)
{
num3 = 365;
}
else if (num3 == 2)
{
num3 = 366;
}
else if (num3 == 3)
{
num3 = 1104;
}
else if (num3 == 4)
{
num3 = 1105;
}
else if (num3 == 5)
{
num3 = 1106;
}
}
int stack6 = Main.rand.Next(8, 21);
int number8 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num3, stack6, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number8, 1f, 0f, 0f, 0, 0, 0);
}
flag = false;
}
if (Main.rand.Next(8) == 0)
{
int num4 = Main.rand.Next(8);
if (num4 == 0)
{
num4 = 20;
}
else if (num4 == 1)
{
num4 = 22;
}
else if (num4 == 2)
{
num4 = 21;
}
else if (num4 == 3)
{
num4 = 19;
}
else if (num4 == 4)
{
num4 = 703;
}
else if (num4 == 5)
{
num4 = 704;
}
else if (num4 == 6)
{
num4 = 705;
}
else if (num4 == 7)
{
num4 = 706;
}
int num5 = Main.rand.Next(2, 8);
if (Main.hardMode && Main.rand.Next(2) == 0)
{
num4 = Main.rand.Next(6);
if (num4 == 0)
{
num4 = 381;
}
else if (num4 == 1)
{
num4 = 382;
}
else if (num4 == 2)
{
num4 = 391;
}
else if (num4 == 3)
{
num4 = 1184;
}
else if (num4 == 4)
{
num4 = 1191;
}
else if (num4 == 5)
{
num4 = 1198;
}
num5 -= Main.rand.Next(2);
}
int number9 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num4, num5, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number9, 1f, 0f, 0f, 0, 0, 0);
}
flag = false;
}
if (Main.rand.Next(7) == 0)
{
int num6 = Main.rand.Next(10);
if (num6 == 0)
{
num6 = 288;
}
else if (num6 == 1)
{
num6 = 290;
}
else if (num6 == 2)
{
num6 = 292;
}
else if (num6 == 3)
{
num6 = 299;
}
else if (num6 == 4)
{
num6 = 298;
}
else if (num6 == 5)
{
num6 = 304;
}
else if (num6 == 6)
{
num6 = 291;
}
else if (num6 == 7)
{
num6 = 2322;
}
else if (num6 == 8)
{
num6 = 2323;
}
else if (num6 == 9)
{
num6 = 2329;
}
int stack7 = Main.rand.Next(1, 4);
int number10 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num6, stack7, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number10, 1f, 0f, 0f, 0, 0, 0);
}
flag = false;
}
}
if (Main.rand.Next(3) == 0)
{
int num7 = Main.rand.Next(2);
if (num7 == 0)
{
num7 = 28;
}
else if (num7 == 1)
{
num7 = 110;
}
int stack8 = Main.rand.Next(5, 16);
int number11 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num7, stack8, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number11, 1f, 0f, 0f, 0, 0, 0);
}
}
if (Main.rand.Next(3) == 0)
{
int type7;
if (Main.rand.Next(3) == 0)
{
type7 = 2675;
}
else
{
type7 = 2674;
}
int stack9 = Main.rand.Next(1, 5);
int number12 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type7, stack9, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number12, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
}
else if (num == 1)
{
bool flag2 = true;
while (flag2)
{
if (Main.hardMode && flag2 && Main.rand.Next(60) == 0)
{
int number13 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 3064, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number13, 1f, 0f, 0f, 0, 0, 0);
}
flag2 = false;
}
if (flag2 && Main.rand.Next(25) == 0)
{
int type8 = 2501;
int stack10 = 1;
int number14 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type8, stack10, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number14, 1f, 0f, 0f, 0, 0, 0);
}
flag2 = false;
}
if (flag2 && Main.rand.Next(20) == 0)
{
int type9 = 2587;
int stack11 = 1;
int number15 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type9, stack11, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number15, 1f, 0f, 0f, 0, 0, 0);
}
flag2 = false;
}
if (flag2 && Main.rand.Next(15) == 0)
{
int type10 = 2608;
int stack12 = 1;
int number16 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type10, stack12, false, -1, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number16, 1f, 0f, 0f, 0, 0, 0);
}
flag2 = false;
}
if (flag2 && Main.rand.Next(20) == 0)
{
int type11 = 3200;
int stack13 = 1;
int number17 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type11, stack13, false, -1, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number17, 1f, 0f, 0f, 0, 0, 0);
}
flag2 = false;
}
if (flag2 && Main.rand.Next(20) == 0)
{
int type12 = 3201;
int stack14 = 1;
int number18 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type12, stack14, false, -1, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number18, 1f, 0f, 0f, 0, 0, 0);
}
flag2 = false;
}
if (Main.rand.Next(4) == 0)
{
int type13 = 73;
int stack15 = Main.rand.Next(5, 11);
int number19 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type13, stack15, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number19, 1f, 0f, 0f, 0, 0, 0);
}
flag2 = false;
}
if (Main.rand.Next(4) == 0)
{
int num8 = Main.rand.Next(8);
if (num8 == 0)
{
num8 = 20;
}
else if (num8 == 1)
{
num8 = 22;
}
else if (num8 == 2)
{
num8 = 21;
}
else if (num8 == 3)
{
num8 = 19;
}
else if (num8 == 4)
{
num8 = 703;
}
else if (num8 == 5)
{
num8 = 704;
}
else if (num8 == 6)
{
num8 = 705;
}
else if (num8 == 7)
{
num8 = 706;
}
int num9 = Main.rand.Next(6, 15);
if (Main.hardMode && Main.rand.Next(3) != 0)
{
num8 = Main.rand.Next(6);
if (num8 == 0)
{
num8 = 381;
}
else if (num8 == 1)
{
num8 = 382;
}
else if (num8 == 2)
{
num8 = 391;
}
else if (num8 == 3)
{
num8 = 1184;
}
else if (num8 == 4)
{
num8 = 1191;
}
else if (num8 == 5)
{
num8 = 1198;
}
num9 -= Main.rand.Next(2);
}
int number20 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num8, num9, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number20, 1f, 0f, 0f, 0, 0, 0);
}
flag2 = false;
}
if (Main.rand.Next(4) == 0)
{
int num10 = Main.rand.Next(8);
if (num10 == 0)
{
num10 = 288;
}
else if (num10 == 1)
{
num10 = 296;
}
else if (num10 == 2)
{
num10 = 304;
}
else if (num10 == 3)
{
num10 = 305;
}
else if (num10 == 4)
{
num10 = 2322;
}
else if (num10 == 5)
{
num10 = 2323;
}
else if (num10 == 6)
{
num10 = 2324;
}
else if (num10 == 7)
{
num10 = 2327;
}
int stack16 = Main.rand.Next(2, 5);
int number21 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num10, stack16, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number21, 1f, 0f, 0f, 0, 0, 0);
}
flag2 = false;
}
}
if (Main.rand.Next(2) == 0)
{
int type14 = Main.rand.Next(188, 190);
int stack17 = Main.rand.Next(5, 16);
int number22 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type14, stack17, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number22, 1f, 0f, 0f, 0, 0, 0);
}
}
if (Main.rand.Next(2) == 0)
{
int type15;
if (Main.rand.Next(3) == 0)
{
type15 = 2676;
}
else
{
type15 = 2675;
}
int stack18 = Main.rand.Next(2, 5);
int number23 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type15, stack18, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number23, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
}
else if (num == 2)
{
bool flag3 = true;
while (flag3)
{
if (Main.hardMode && flag3 && Main.rand.Next(20) == 0)
{
int number24 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 3064, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number24, 1f, 0f, 0f, 0, 0, 0);
}
flag3 = false;
}
if (flag3 && Main.rand.Next(10) == 0)
{
int type16 = 2491;
int stack19 = 1;
int number25 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type16, stack19, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number25, 1f, 0f, 0f, 0, 0, 0);
}
flag3 = false;
}
if (Main.rand.Next(3) == 0)
{
int type17 = 73;
int stack20 = Main.rand.Next(8, 21);
int number26 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type17, stack20, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number26, 1f, 0f, 0f, 0, 0, 0);
}
flag3 = false;
}
if (Main.rand.Next(3) == 0)
{
int num11 = Main.rand.Next(4);
if (num11 == 0)
{
num11 = 21;
}
else if (num11 == 1)
{
num11 = 19;
}
else if (num11 == 2)
{
num11 = 705;
}
else if (num11 == 3)
{
num11 = 706;
}
if (Main.hardMode && Main.rand.Next(3) != 0)
{
num11 = Main.rand.Next(4);
if (num11 == 0)
{
num11 = 382;
}
else if (num11 == 1)
{
num11 = 391;
}
else if (num11 == 2)
{
num11 = 1191;
}
else if (num11 == 3)
{
num11 = 1198;
}
}
int stack21 = Main.rand.Next(15, 31);
int number27 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num11, stack21, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number27, 1f, 0f, 0f, 0, 0, 0);
}
flag3 = false;
}
}
if (Main.rand.Next(3) == 0)
{
int num12 = Main.rand.Next(5);
if (num12 == 0)
{
num12 = 288;
}
else if (num12 == 1)
{
num12 = 296;
}
else if (num12 == 2)
{
num12 = 305;
}
else if (num12 == 3)
{
num12 = 2322;
}
else if (num12 == 4)
{
num12 = 2323;
}
int stack22 = Main.rand.Next(2, 6);
int number28 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num12, stack22, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number28, 1f, 0f, 0f, 0, 0, 0);
}
}
if (Main.rand.Next(2) == 0)
{
int type18 = Main.rand.Next(499, 501);
int stack23 = Main.rand.Next(5, 21);
int number29 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type18, stack23, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number29, 1f, 0f, 0f, 0, 0, 0);
}
}
if (Main.rand.Next(3) != 0)
{
int type19 = 2676;
int stack24 = Main.rand.Next(3, 8);
int number30 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type19, stack24, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number30, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
}
else
{
int maxValue = 6;
bool flag4 = true;
while (flag4)
{
if (num == 3 && flag4 && Main.rand.Next(maxValue) == 0)
{
int num13 = Main.rand.Next(5);
if (num13 == 0)
{
num13 = 162;
}
else if (num13 == 1)
{
num13 = 111;
}
else if (num13 == 2)
{
num13 = 96;
}
else if (num13 == 3)
{
num13 = 115;
}
else
{
num13 = 64;
}
int number31 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num13, 1, false, -1, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number31, 1f, 0f, 0f, 0, 0, 0);
}
flag4 = false;
}
if (num == 4 && flag4 && Main.rand.Next(maxValue) == 0)
{
int num14 = Main.rand.Next(5);
if (num14 == 0)
{
num14 = 800;
}
else if (num14 == 1)
{
num14 = 802;
}
else if (num14 == 2)
{
num14 = 1256;
}
else if (num14 == 3)
{
num14 = 1290;
}
else
{
num14 = 3062;
}
int number32 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num14, 1, false, -1, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number32, 1f, 0f, 0f, 0, 0, 0);
}
flag4 = false;
}
if (num == 5 && flag4 && Main.rand.Next(maxValue) == 0)
{
int type20 = 3085;
int number33 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type20, 1, false, -1, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number33, 1f, 0f, 0f, 0, 0, 0);
}
flag4 = false;
}
if (num == 6 && flag4 && Main.rand.Next(maxValue) == 0)
{
int num15 = Main.rand.Next(3);
if (num15 == 0)
{
num15 = 158;
}
else if (num15 == 1)
{
num15 = 65;
}
else
{
num15 = 159;
}
int number34 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num15, 1, false, -1, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number34, 1f, 0f, 0f, 0, 0, 0);
}
flag4 = false;
}
if (num == 8 && flag4 && Main.rand.Next(maxValue) == 0)
{
int num16 = Main.rand.Next(5);
if (num16 == 0)
{
num16 = 212;
}
else if (num16 == 1)
{
num16 = 964;
}
else if (num16 == 2)
{
num16 = 211;
}
else if (num16 == 3)
{
num16 = 213;
}
else
{
num16 = 2292;
}
int number35 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num16, 1, false, -1, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number35, 1f, 0f, 0f, 0, 0, 0);
}
flag4 = false;
}
if (Main.rand.Next(4) == 0)
{
int type21 = 73;
int stack25 = Main.rand.Next(5, 13);
int number36 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type21, stack25, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number36, 1f, 0f, 0f, 0, 0, 0);
}
flag4 = false;
}
if (Main.rand.Next(4) == 0)
{
int num17 = Main.rand.Next(6);
if (num17 == 0)
{
num17 = 22;
}
else if (num17 == 1)
{
num17 = 21;
}
else if (num17 == 2)
{
num17 = 19;
}
else if (num17 == 3)
{
num17 = 704;
}
else if (num17 == 4)
{
num17 = 705;
}
else if (num17 == 5)
{
num17 = 706;
}
int num18 = Main.rand.Next(10, 21);
if (Main.hardMode && Main.rand.Next(3) != 0)
{
num17 = Main.rand.Next(6);
if (num17 == 0)
{
num17 = 381;
}
else if (num17 == 1)
{
num17 = 382;
}
else if (num17 == 2)
{
num17 = 391;
}
else if (num17 == 3)
{
num17 = 1184;
}
else if (num17 == 4)
{
num17 = 1191;
}
else if (num17 == 5)
{
num17 = 1198;
}
num18 -= Main.rand.Next(3);
}
int number37 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num17, num18, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number37, 1f, 0f, 0f, 0, 0, 0);
}
flag4 = false;
}
}
if (Main.rand.Next(4) == 0)
{
int num19 = Main.rand.Next(6);
if (num19 == 0)
{
num19 = 288;
}
else if (num19 == 1)
{
num19 = 296;
}
else if (num19 == 2)
{
num19 = 304;
}
else if (num19 == 3)
{
num19 = 305;
}
else if (num19 == 4)
{
num19 = 2322;
}
else if (num19 == 5)
{
num19 = 2323;
}
int stack26 = Main.rand.Next(2, 5);
int number38 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num19, stack26, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number38, 1f, 0f, 0f, 0, 0, 0);
}
}
if (Main.rand.Next(2) == 0)
{
int type22 = Main.rand.Next(188, 190);
int stack27 = Main.rand.Next(5, 18);
int number39 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type22, stack27, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number39, 1f, 0f, 0f, 0, 0, 0);
}
}
if (Main.rand.Next(2) == 0)
{
int type23;
if (Main.rand.Next(2) == 0)
{
type23 = 2676;
}
else
{
type23 = 2675;
}
int stack28 = Main.rand.Next(2, 7);
int number40 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type23, stack28, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number40, 1f, 0f, 0f, 0, 0, 0);
}
}
if (num == 3 || num == 4 || num == 7)
{
if (Main.hardMode && Main.rand.Next(2) == 0)
{
int type24 = 521;
if (num == 7)
{
type24 = 520;
}
int stack29 = Main.rand.Next(2, 6);
int number41 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type24, stack29, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number41, 1f, 0f, 0f, 0, 0, 0);
}
}
if (Main.hardMode && Main.rand.Next(2) == 0)
{
int type25 = 522;
int stack30 = Main.rand.Next(2, 6);
if (num == 4)
{
type25 = 1332;
}
else if (num == 7)
{
type25 = 502;
stack30 = Main.rand.Next(4, 11);
}
int number42 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type25, stack30, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number42, 1f, 0f, 0f, 0, 0, 0);
}
}
}
}
}
public bool consumeItem(int type)
{
for (int i = 0; i < 58; i++)
{
if (this.inventory[i].stack > 0 && this.inventory[i].type == type)
{
this.inventory[i].stack--;
if (this.inventory[i].stack <= 0)
{
this.inventory[i].SetDefaults(0, false);
}
return true;
}
}
return false;
}
public void openLockBox()
{
bool flag = true;
while (flag)
{
flag = false;
int num = Main.rand.Next(7);
int type;
if (num == 1)
{
type = 329;
}
else if (num == 2)
{
type = 155;
}
else if (num == 3)
{
type = 156;
}
else if (num == 4)
{
type = 157;
}
else if (num == 5)
{
type = 163;
}
else if (num == 6)
{
type = 113;
}
else
{
type = 164;
}
int number = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type, 1, false, -1, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number, 1f, 0f, 0f, 0, 0, 0);
}
if (Main.rand.Next(3) == 0)
{
flag = false;
int num2 = Main.rand.Next(1, 4);
if (Main.rand.Next(2) == 0)
{
num2 += Main.rand.Next(2);
}
if (Main.rand.Next(3) == 0)
{
num2 += Main.rand.Next(3);
}
if (Main.rand.Next(4) == 0)
{
num2 += Main.rand.Next(3);
}
if (Main.rand.Next(5) == 0)
{
num2 += Main.rand.Next(1, 3);
}
int number2 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 73, num2, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number2, 1f, 0f, 0f, 0, 0, 0);
}
}
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), false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number3, 1f, 0f, 0f, 0, 0, 0);
}
}
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), false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number4, 1f, 0f, 0f, 0, 0, 0);
}
}
if (Main.rand.Next(3) == 0)
{
flag = false;
int num3 = Main.rand.Next(9);
if (num3 == 0)
{
num3 = 296;
}
else if (num3 == 1)
{
num3 = 2346;
}
else if (num3 == 2)
{
num3 = 305;
}
else if (num3 == 3)
{
num3 = 2323;
}
else if (num3 == 4)
{
num3 = 292;
}
else if (num3 == 5)
{
num3 = 294;
}
else if (num3 == 6)
{
num3 = 288;
}
else if (Main.netMode == 1)
{
num3 = 2997;
}
else
{
num3 = 2350;
}
int number5 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num3, Main.rand.Next(1, 4), false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number5, 1f, 0f, 0f, 0, 0, 0);
}
}
}
}
public void openHerbBag()
{
int num = Main.rand.Next(2, 5);
if (Main.rand.Next(3) == 0)
{
num++;
}
for (int i = 0; i < num; i++)
{
int num2 = Main.rand.Next(14);
if (num2 == 0)
{
num2 = 313;
}
if (num2 == 1)
{
num2 = 314;
}
if (num2 == 2)
{
num2 = 315;
}
if (num2 == 3)
{
num2 = 317;
}
if (num2 == 4)
{
num2 = 316;
}
if (num2 == 5)
{
num2 = 318;
}
if (num2 == 6)
{
num2 = 2358;
}
if (num2 == 7)
{
num2 = 307;
}
if (num2 == 8)
{
num2 = 308;
}
if (num2 == 9)
{
num2 = 309;
}
if (num2 == 10)
{
num2 = 311;
}
if (num2 == 11)
{
num2 = 310;
}
if (num2 == 12)
{
num2 = 312;
}
if (num2 == 13)
{
num2 = 2357;
}
int num3 = Main.rand.Next(2, 5);
if (Main.rand.Next(3) == 0)
{
num3 += Main.rand.Next(1, 5);
}
int number = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num2, num3, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number, 1f, 0f, 0f, 0, 0, 0);
}
}
}
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, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(150) == 0)
{
int number2 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1800, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number2, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(4) == 0)
{
int number3 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1809, Main.rand.Next(10, 41), false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number3, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (Main.rand.Next(10) == 0)
{
int number4 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, Main.rand.Next(1846, 1851), 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number4, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else
{
int num = Main.rand.Next(19);
if (num == 0)
{
int number5 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1749, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number5, 1f, 0f, 0f, 0, 0, 0);
}
number5 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1750, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number5, 1f, 0f, 0f, 0, 0, 0);
}
number5 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1751, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number5, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 1)
{
int number6 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1746, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number6, 1f, 0f, 0f, 0, 0, 0);
}
number6 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1747, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number6, 1f, 0f, 0f, 0, 0, 0);
}
number6 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1748, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number6, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 2)
{
int number7 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1752, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number7, 1f, 0f, 0f, 0, 0, 0);
}
number7 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1753, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number7, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 3)
{
int number8 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1767, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number8, 1f, 0f, 0f, 0, 0, 0);
}
number8 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1768, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number8, 1f, 0f, 0f, 0, 0, 0);
}
number8 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1769, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number8, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 4)
{
int number9 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1770, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number9, 1f, 0f, 0f, 0, 0, 0);
}
number9 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1771, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number9, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 5)
{
int number10 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1772, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number10, 1f, 0f, 0f, 0, 0, 0);
}
number10 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1773, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number10, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 6)
{
int number11 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1754, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number11, 1f, 0f, 0f, 0, 0, 0);
}
number11 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1755, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number11, 1f, 0f, 0f, 0, 0, 0);
}
number11 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1756, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number11, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 7)
{
int number12 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1757, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number12, 1f, 0f, 0f, 0, 0, 0);
}
number12 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1758, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number12, 1f, 0f, 0f, 0, 0, 0);
}
number12 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1759, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number12, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 8)
{
int number13 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1760, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number13, 1f, 0f, 0f, 0, 0, 0);
}
number13 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1761, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number13, 1f, 0f, 0f, 0, 0, 0);
}
number13 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1762, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number13, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 9)
{
int number14 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1763, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number14, 1f, 0f, 0f, 0, 0, 0);
}
number14 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1764, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number14, 1f, 0f, 0f, 0, 0, 0);
}
number14 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1765, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number14, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 10)
{
int number15 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1766, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number15, 1f, 0f, 0f, 0, 0, 0);
}
number15 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1775, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number15, 1f, 0f, 0f, 0, 0, 0);
}
number15 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1776, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number15, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 11)
{
int number16 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1777, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number16, 1f, 0f, 0f, 0, 0, 0);
}
number16 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1778, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number16, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 12)
{
int number17 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1779, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number17, 1f, 0f, 0f, 0, 0, 0);
}
number17 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1780, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number17, 1f, 0f, 0f, 0, 0, 0);
}
number17 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1781, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number17, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 13)
{
int number18 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1819, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number18, 1f, 0f, 0f, 0, 0, 0);
}
number18 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1820, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number18, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 14)
{
int number19 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1821, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number19, 1f, 0f, 0f, 0, 0, 0);
}
number19 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1822, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number19, 1f, 0f, 0f, 0, 0, 0);
}
number19 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1823, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number19, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 15)
{
int number20 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1824, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number20, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 16)
{
int number21 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1838, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number21, 1f, 0f, 0f, 0, 0, 0);
}
number21 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1839, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number21, 1f, 0f, 0f, 0, 0, 0);
}
number21 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1840, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number21, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 17)
{
int number22 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1841, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number22, 1f, 0f, 0f, 0, 0, 0);
}
number22 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1842, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number22, 1f, 0f, 0f, 0, 0, 0);
}
number22 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1843, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number22, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else if (num == 18)
{
int number23 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1851, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number23, 1f, 0f, 0f, 0, 0, 0);
}
number23 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1852, 1, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number23, 1f, 0f, 0f, 0, 0, 0);
}
}
}
}
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 i = 0; i < 20; i++)
{
int num = i % 10;
if (this.dye[num] != null && this.armor[i].type > 0 && this.armor[i].stack > 0 && (i / 10 >= 1 || !this.hideVisual[num] || this.armor[i].wingSlot > 0 || this.armor[i].type == 934))
{
if (this.armor[i].handOnSlot > 0 && this.armor[i].handOnSlot < 19)
{
this.cHandOn = (int)this.dye[num].dye;
}
if (this.armor[i].handOffSlot > 0 && this.armor[i].handOffSlot < 12)
{
this.cHandOff = (int)this.dye[num].dye;
}
if (this.armor[i].backSlot > 0 && this.armor[i].backSlot < 10)
{
this.cBack = (int)this.dye[num].dye;
}
if (this.armor[i].frontSlot > 0 && this.armor[i].frontSlot < 5)
{
this.cFront = (int)this.dye[num].dye;
}
if (this.armor[i].shoeSlot > 0 && this.armor[i].shoeSlot < 18)
{
this.cShoe = (int)this.dye[num].dye;
}
if (this.armor[i].waistSlot > 0 && this.armor[i].waistSlot < 12)
{
this.cWaist = (int)this.dye[num].dye;
}
if (this.armor[i].shieldSlot > 0 && this.armor[i].shieldSlot < 6)
{
this.cShield = (int)this.dye[num].dye;
}
if (this.armor[i].neckSlot > 0 && this.armor[i].neckSlot < 9)
{
this.cNeck = (int)this.dye[num].dye;
}
if (this.armor[i].faceSlot > 0 && this.armor[i].faceSlot < 9)
{
this.cFace = (int)this.dye[num].dye;
}
if (this.armor[i].balloonSlot > 0 && this.armor[i].balloonSlot < 16)
{
this.cBalloon = (int)this.dye[num].dye;
}
if (this.armor[i].wingSlot > 0 && this.armor[i].wingSlot < 37)
{
this.cWings = (int)this.dye[num].dye;
}
if (this.armor[i].type == 934)
{
this.cCarpet = (int)this.dye[num].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, true);
}
for (int j = 0; j < 1000; j++)
{
if (Main.projectile[j].active && Main.projectile[j].owner == i)
{
this.ownedProjectileCounts[Main.projectile[j].type]++;
}
}
for (int k = 0; k < 22; k++)
{
if (this.buffType[k] > 0 && this.buffTime[k] > 0)
{
if (this.whoAmI == Main.myPlayer && this.buffType[k] != 28)
{
this.buffTime[k]--;
}
if (this.buffType[k] == 1)
{
this.lavaImmune = true;
this.fireWalk = true;
this.buffImmune[24] = true;
}
else if (this.buffType[k] == 158)
{
this.manaRegen += 2;
}
else if (this.buffType[k] == 159 && this.inventory[this.selectedItem].melee)
{
this.armorPenetration = 4;
}
else if (this.buffType[k] == 2)
{
this.lifeRegen += 4;
}
else if (this.buffType[k] == 3)
{
this.moveSpeed += 0.25f;
}
else if (this.buffType[k] == 4)
{
this.gills = true;
}
else if (this.buffType[k] == 5)
{
this.statDefense += 8;
}
else if (this.buffType[k] == 6)
{
this.manaRegenBuff = true;
}
else if (this.buffType[k] == 7)
{
this.magicDamage += 0.2f;
}
else if (this.buffType[k] == 8)
{
this.slowFall = true;
}
else if (this.buffType[k] == 9)
{
this.findTreasure = true;
}
else if (this.buffType[k] == 10)
{
this.invis = true;
}
else if (this.buffType[k] == 11)
{
Lighting.AddLight((int)(this.position.X + (float)(this.width / 2)) / 16, (int)(this.position.Y + (float)(this.height / 2)) / 16, 0.8f, 0.95f, 1f);
}
else if (this.buffType[k] == 12)
{
this.nightVision = true;
}
else if (this.buffType[k] == 13)
{
this.enemySpawns = true;
}
else if (this.buffType[k] == 14)
{
if (this.thorns < 1f)
{
this.thorns = 0.333333343f;
}
}
else if (this.buffType[k] == 15)
{
this.waterWalk = true;
}
else if (this.buffType[k] == 16)
{
this.archery = true;
}
else if (this.buffType[k] == 17)
{
this.detectCreature = true;
}
else if (this.buffType[k] == 18)
{
this.gravControl = true;
}
else if (this.buffType[k] == 30)
{
this.bleed = true;
}
else if (this.buffType[k] == 31)
{
this.confused = true;
}
else if (this.buffType[k] == 32)
{
this.slow = true;
}
else if (this.buffType[k] == 35)
{
this.silence = true;
}
else if (this.buffType[k] == 160)
{
this.dazed = true;
}
else if (this.buffType[k] == 46)
{
this.chilled = true;
}
else if (this.buffType[k] == 47)
{
this.frozen = true;
}
else if (this.buffType[k] == 156)
{
this.stoned = true;
}
else if (this.buffType[k] == 69)
{
this.ichor = true;
this.statDefense -= 20;
}
else if (this.buffType[k] == 36)
{
this.brokenArmor = true;
}
else if (this.buffType[k] == 48)
{
this.honey = true;
}
else if (this.buffType[k] == 59)
{
this.shadowDodge = true;
}
else if (this.buffType[k] == 93)
{
this.ammoBox = true;
}
else if (this.buffType[k] == 58)
{
this.palladiumRegen = true;
}
else if (this.buffType[k] == 88)
{
this.chaosState = true;
}
else if (this.buffType[k] == 63)
{
this.moveSpeed += 1f;
}
else if (this.buffType[k] == 104)
{
this.pickSpeed -= 0.25f;
}
else if (this.buffType[k] == 105)
{
this.lifeMagnet = true;
}
else if (this.buffType[k] == 106)
{
this.calmed = true;
}
else if (this.buffType[k] == 121)
{
this.fishingSkill += 15;
}
else if (this.buffType[k] == 122)
{
this.sonarPotion = true;
}
else if (this.buffType[k] == 123)
{
this.cratePotion = true;
}
else if (this.buffType[k] == 107)
{
this.tileSpeed += 0.25f;
this.wallSpeed += 0.25f;
this.blockRange++;
}
else if (this.buffType[k] == 108)
{
this.kbBuff = true;
}
else if (this.buffType[k] == 109)
{
this.ignoreWater = true;
this.accFlipper = true;
}
else if (this.buffType[k] == 110)
{
this.maxMinions++;
}
else if (this.buffType[k] == 150)
{
this.maxMinions++;
}
else if (this.buffType[k] == 111)
{
this.dangerSense = true;
}
else if (this.buffType[k] == 112)
{
this.ammoPotion = true;
}
else if (this.buffType[k] == 113)
{
this.lifeForce = true;
this.statLifeMax2 += this.statLifeMax / 5 / 20 * 20;
}
else if (this.buffType[k] == 114)
{
this.endurance += 0.1f;
}
else if (this.buffType[k] == 115)
{
this.meleeCrit += 10;
this.rangedCrit += 10;
this.magicCrit += 10;
this.thrownCrit += 10;
}
else if (this.buffType[k] == 116)
{
this.inferno = true;
Lighting.AddLight((int)(base.Center.X / 16f), (int)(base.Center.Y / 16f), 0.65f, 0.4f, 0.1f);
int num = 24;
float num2 = 200f;
bool flag = this.infernoCounter % 60 == 0;
int num3 = 10;
if (this.whoAmI == Main.myPlayer)
{
for (int l = 0; l < 200; l++)
{
NPC nPC = Main.npc[l];
if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(base.Center, nPC.Center) <= num2)
{
if (nPC.HasBuff(num) == -1)
{
nPC.AddBuff(num, 120, false);
}
if (flag)
{
nPC.StrikeNPC(num3, 0f, 0, false, false, false);
if (Main.netMode != 0)
{
NetMessage.SendData(28, -1, -1, "", l, (float)num3, 0f, 0f, 0, 0, 0);
}
}
}
}
if (this.hostile)
{
for (int m = 0; m < 255; m++)
{
Player player = Main.player[m];
if (player != this && player.active && !player.dead && player.hostile && !player.buffImmune[num] && (player.team != this.team || player.team == 0) && Vector2.Distance(base.Center, player.Center) <= num2)
{
if (player.HasBuff(num) == -1)
{
player.AddBuff(num, 120, true);
}
if (flag)
{
player.Hurt(num3, 0, true, false, "", false);
if (Main.netMode != 0)
{
NetMessage.SendData(26, -1, -1, Lang.deathMsg(this.whoAmI, -1, -1, -1), m, 0f, (float)num3, 1f, 0, 0, 0);
}
}
}
}
}
}
}
else if (this.buffType[k] == 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[k] == 119)
{
this.loveStruck = true;
}
else if (this.buffType[k] == 120)
{
this.stinky = true;
}
else if (this.buffType[k] == 124)
{
this.resistCold = true;
}
else if (this.buffType[k] == 165)
{
this.lifeRegen += 6;
this.statDefense += 8;
this.dryadWard = true;
if (this.thorns < 1f)
{
this.thorns += 0.2f;
}
}
else if (this.buffType[k] == 144)
{
this.electrified = true;
Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.3f, 0.8f, 1.1f);
}
else if (this.buffType[k] == 94)
{
this.manaSick = true;
this.manaSickReduction = Player.manaSickLessDmg * ((float)this.buffTime[k] / (float)Player.manaSickTime);
}
else if (this.buffType[k] >= 95 && this.buffType[k] <= 97)
{
this.buffTime[k] = 5;
int num4 = (int)((byte)(1 + this.buffType[k] - 95));
if (this.beetleOrbs > 0 && this.beetleOrbs != num4)
{
if (this.beetleOrbs > num4)
{
this.DelBuff(k);
k--;
}
else
{
for (int n = 0; n < 22; n++)
{
if (this.buffType[n] >= 95 && this.buffType[n] <= 95 + num4 - 1)
{
this.DelBuff(n);
n--;
}
}
}
}
this.beetleOrbs = num4;
if (!this.beetleDefense)
{
this.beetleOrbs = 0;
this.DelBuff(k);
k--;
}
else
{
this.beetleBuff = true;
}
}
else if (this.buffType[k] >= 170 && this.buffType[k] <= 172)
{
this.buffTime[k] = 5;
int num5 = (int)((byte)(1 + this.buffType[k] - 170));
if (this.solarShields > 0 && this.solarShields != num5)
{
if (this.solarShields > num5)
{
this.DelBuff(k);
k--;
}
else
{
for (int num6 = 0; num6 < 22; num6++)
{
if (this.buffType[num6] >= 170 && this.buffType[num6] <= 170 + num5 - 1)
{
this.DelBuff(num6);
num6--;
}
}
}
}
this.solarShields = num5;
if (!this.setSolar)
{
this.solarShields = 0;
this.DelBuff(k);
k--;
}
}
else if (this.buffType[k] >= 98 && this.buffType[k] <= 100)
{
int num7 = (int)((byte)(1 + this.buffType[k] - 98));
if (this.beetleOrbs > 0 && this.beetleOrbs != num7)
{
if (this.beetleOrbs > num7)
{
this.DelBuff(k);
k--;
}
else
{
for (int num8 = 0; num8 < 22; num8++)
{
if (this.buffType[num8] >= 98 && this.buffType[num8] <= 98 + num7 - 1)
{
this.DelBuff(num8);
num8--;
}
}
}
}
this.beetleOrbs = num7;
this.meleeDamage += 0.1f * (float)this.beetleOrbs;
this.meleeSpeed += 0.1f * (float)this.beetleOrbs;
if (!this.beetleOffense)
{
this.beetleOrbs = 0;
this.DelBuff(k);
k--;
}
else
{
this.beetleBuff = true;
}
}
else if (this.buffType[k] >= 176 && this.buffType[k] <= 178)
{
int num9 = this.nebulaLevelMana;
int num10 = (int)((byte)(1 + this.buffType[k] - 176));
if (num9 > 0 && num9 != num10)
{
if (num9 > num10)
{
this.DelBuff(k);
k--;
}
else
{
for (int num11 = 0; num11 < 22; num11++)
{
if (this.buffType[num11] >= 176 && this.buffType[num11] <= 178 + num10 - 1)
{
this.DelBuff(num11);
num11--;
}
}
}
}
this.nebulaLevelMana = num10;
if (this.buffTime[k] == 2 && this.nebulaLevelMana > 1)
{
this.nebulaLevelMana--;
this.buffType[k]--;
this.buffTime[k] = 480;
}
}
else if (this.buffType[k] >= 173 && this.buffType[k] <= 175)
{
int num12 = this.nebulaLevelLife;
int num13 = (int)((byte)(1 + this.buffType[k] - 173));
if (num12 > 0 && num12 != num13)
{
if (num12 > num13)
{
this.DelBuff(k);
k--;
}
else
{
for (int num14 = 0; num14 < 22; num14++)
{
if (this.buffType[num14] >= 173 && this.buffType[num14] <= 175 + num13 - 1)
{
this.DelBuff(num14);
num14--;
}
}
}
}
this.nebulaLevelLife = num13;
if (this.buffTime[k] == 2 && this.nebulaLevelLife > 1)
{
this.nebulaLevelLife--;
this.buffType[k]--;
this.buffTime[k] = 480;
}
this.lifeRegen += 10 * this.nebulaLevelLife;
}
else if (this.buffType[k] >= 179 && this.buffType[k] <= 181)
{
int num15 = this.nebulaLevelDamage;
int num16 = (int)((byte)(1 + this.buffType[k] - 179));
if (num15 > 0 && num15 != num16)
{
if (num15 > num16)
{
this.DelBuff(k);
k--;
}
else
{
for (int num17 = 0; num17 < 22; num17++)
{
if (this.buffType[num17] >= 179 && this.buffType[num17] <= 181 + num16 - 1)
{
this.DelBuff(num17);
num17--;
}
}
}
}
this.nebulaLevelDamage = num16;
if (this.buffTime[k] == 2 && this.nebulaLevelDamage > 1)
{
this.nebulaLevelDamage--;
this.buffType[k]--;
this.buffTime[k] = 480;
}
float num18 = 0.15f * (float)this.nebulaLevelDamage;
this.meleeDamage += num18;
this.rangedDamage += num18;
this.magicDamage += num18;
this.minionDamage += num18;
this.thrownDamage += num18;
}
else if (this.buffType[k] == 62)
{
if ((double)this.statLife <= (double)this.statLifeMax2 * 0.5)
{
Lighting.AddLight((int)(base.Center.X / 16f), (int)(base.Center.Y / 16f), 0.1f, 0.2f, 0.45f);
this.iceBarrier = true;
this.endurance += 0.25f;
this.iceBarrierFrameCounter += 1;
if (this.iceBarrierFrameCounter > 2)
{
this.iceBarrierFrameCounter = 0;
this.iceBarrierFrame += 1;
if (this.iceBarrierFrame >= 12)
{
this.iceBarrierFrame = 0;
}
}
}
else
{
this.DelBuff(k);
k--;
}
}
else if (this.buffType[k] == 49)
{
for (int num19 = 191; num19 <= 194; num19++)
{
if (this.ownedProjectileCounts[num19] > 0)
{
this.pygmy = true;
}
}
if (!this.pygmy)
{
this.DelBuff(k);
k--;
}
else
{
this.buffTime[k] = 18000;
}
}
else if (this.buffType[k] == 83)
{
if (this.ownedProjectileCounts[317] > 0)
{
this.raven = true;
}
if (!this.raven)
{
this.DelBuff(k);
k--;
}
else
{
this.buffTime[k] = 18000;
}
}
else if (this.buffType[k] == 64)
{
if (this.ownedProjectileCounts[266] > 0)
{
this.slime = true;
}
if (!this.slime)
{
this.DelBuff(k);
k--;
}
else
{
this.buffTime[k] = 18000;
}
}
else if (this.buffType[k] == 125)
{
if (this.ownedProjectileCounts[373] > 0)
{
this.hornetMinion = true;
}
if (!this.hornetMinion)
{
this.DelBuff(k);
k--;
}
else
{
this.buffTime[k] = 18000;
}
}
else if (this.buffType[k] == 126)
{
if (this.ownedProjectileCounts[375] > 0)
{
this.impMinion = true;
}
if (!this.impMinion)
{
this.DelBuff(k);
k--;
}
else
{
this.buffTime[k] = 18000;
}
}
else if (this.buffType[k] == 133)
{
if (this.ownedProjectileCounts[390] > 0 || this.ownedProjectileCounts[391] > 0 || this.ownedProjectileCounts[392] > 0)
{
this.spiderMinion = true;
}
if (!this.spiderMinion)
{
this.DelBuff(k);
k--;
}
else
{
this.buffTime[k] = 18000;
}
}
else if (this.buffType[k] == 134)
{
if (this.ownedProjectileCounts[387] > 0 || this.ownedProjectileCounts[388] > 0)
{
this.twinsMinion = true;
}
if (!this.twinsMinion)
{
this.DelBuff(k);
k--;
}
else
{
this.buffTime[k] = 18000;
}
}
else if (this.buffType[k] == 135)
{
if (this.ownedProjectileCounts[393] > 0 || this.ownedProjectileCounts[394] > 0 || this.ownedProjectileCounts[395] > 0)
{
this.pirateMinion = true;
}
if (!this.pirateMinion)
{
this.DelBuff(k);
k--;
}
else
{
this.buffTime[k] = 18000;
}
}
else if (this.buffType[k] == 139)
{
if (this.ownedProjectileCounts[407] > 0)
{
this.sharknadoMinion = true;
}
if (!this.sharknadoMinion)
{
this.DelBuff(k);
k--;
}
else
{
this.buffTime[k] = 18000;
}
}
else if (this.buffType[k] == 140)
{
if (this.ownedProjectileCounts[423] > 0)
{
this.UFOMinion = true;
}
if (!this.UFOMinion)
{
this.DelBuff(k);
k--;
}
else
{
this.buffTime[k] = 18000;
}
}
else if (this.buffType[k] == 182)
{
if (this.ownedProjectileCounts[613] > 0)
{
this.stardustMinion = true;
}
if (!this.stardustMinion)
{
this.DelBuff(k);
k--;
}
else
{
this.buffTime[k] = 18000;
}
}
else if (this.buffType[k] == 187)
{
if (this.ownedProjectileCounts[623] > 0)
{
this.stardustGuardian = true;
}
if (!this.stardustGuardian)
{
this.DelBuff(k);
k--;
}
else
{
this.buffTime[k] = 18000;
}
}
else if (this.buffType[k] == 188)
{
if (this.ownedProjectileCounts[625] > 0)
{
this.stardustDragon = true;
}
if (!this.stardustDragon)
{
this.DelBuff(k);
k--;
}
else
{
this.buffTime[k] = 18000;
}
}
else if (this.buffType[k] == 161)
{
if (this.ownedProjectileCounts[533] > 0)
{
this.DeadlySphereMinion = true;
}
if (!this.DeadlySphereMinion)
{
this.DelBuff(k);
k--;
}
else
{
this.buffTime[k] = 18000;
}
}
else if (this.buffType[k] == 90)
{
this.mount.SetMount(0, this, false);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 128)
{
this.mount.SetMount(1, this, false);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 129)
{
this.mount.SetMount(2, this, false);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 130)
{
this.mount.SetMount(3, this, false);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 118)
{
this.mount.SetMount(6, this, true);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 138)
{
this.mount.SetMount(6, this, false);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 167)
{
this.mount.SetMount(11, this, true);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 166)
{
this.mount.SetMount(11, this, false);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 184)
{
this.mount.SetMount(13, this, true);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 185)
{
this.mount.SetMount(13, this, false);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 131)
{
this.ignoreWater = true;
this.accFlipper = true;
this.mount.SetMount(4, this, false);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 132)
{
this.mount.SetMount(5, this, false);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 168)
{
this.ignoreWater = true;
this.accFlipper = true;
this.mount.SetMount(12, this, false);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 141)
{
this.mount.SetMount(7, this, false);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 142)
{
this.mount.SetMount(8, this, false);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 143)
{
this.mount.SetMount(9, this, false);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 162)
{
this.mount.SetMount(10, this, false);
this.buffTime[k] = 10;
}
else if (this.buffType[k] == 37)
{
if (Main.wof >= 0 && Main.npc[Main.wof].type == 113)
{
this.gross = true;
this.buffTime[k] = 10;
}
else
{
this.DelBuff(k);
k--;
}
}
else if (this.buffType[k] == 38)
{
this.buffTime[k] = 10;
this.tongued = true;
}
else if (this.buffType[k] == 146)
{
this.moveSpeed += 0.1f;
this.moveSpeed *= 1.1f;
this.sunflower = true;
}
else if (this.buffType[k] == 19)
{
this.buffTime[k] = 18000;
this.lightOrb = true;
bool flag2 = true;
if (this.ownedProjectileCounts[18] > 0)
{
flag2 = false;
}
if (flag2)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 18, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 155)
{
this.buffTime[k] = 18000;
this.crimsonHeart = true;
bool flag3 = true;
if (this.ownedProjectileCounts[500] > 0)
{
flag3 = false;
}
if (flag3)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 500, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 190)
{
this.buffTime[k] = 18000;
this.suspiciouslookingTentacle = true;
bool flag4 = true;
if (this.ownedProjectileCounts[650] > 0)
{
flag4 = false;
}
if (flag4)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 650, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 27 || this.buffType[k] == 101 || this.buffType[k] == 102)
{
this.buffTime[k] = 18000;
bool flag5 = true;
int num20 = 72;
if (this.buffType[k] == 27)
{
this.blueFairy = true;
}
if (this.buffType[k] == 101)
{
num20 = 86;
this.redFairy = true;
}
if (this.buffType[k] == 102)
{
num20 = 87;
this.greenFairy = true;
}
if (this.head == 45 && this.body == 26 && this.legs == 25)
{
num20 = 72;
}
if (this.ownedProjectileCounts[num20] > 0)
{
flag5 = false;
}
if (flag5)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, num20, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 40)
{
this.buffTime[k] = 18000;
this.bunny = true;
bool flag6 = true;
if (this.ownedProjectileCounts[111] > 0)
{
flag6 = false;
}
if (flag6)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 111, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 148)
{
this.rabid = true;
if (Main.rand.Next(1200) == 0)
{
int num21 = Main.rand.Next(6);
float num22 = (float)Main.rand.Next(60, 100) * 0.01f;
if (num21 == 0)
{
this.AddBuff(22, (int)(60f * num22 * 3f), true);
}
else if (num21 == 1)
{
this.AddBuff(23, (int)(60f * num22 * 0.75f), true);
}
else if (num21 == 2)
{
this.AddBuff(31, (int)(60f * num22 * 1.5f), true);
}
else if (num21 == 3)
{
this.AddBuff(32, (int)(60f * num22 * 3.5f), true);
}
else if (num21 == 4)
{
this.AddBuff(33, (int)(60f * num22 * 5f), true);
}
else if (num21 == 5)
{
this.AddBuff(35, (int)(60f * num22 * 1f), true);
}
}
this.meleeDamage += 0.2f;
this.magicDamage += 0.2f;
this.rangedDamage += 0.2f;
this.thrownDamage += 0.2f;
this.minionDamage += 0.2f;
}
else if (this.buffType[k] == 41)
{
this.buffTime[k] = 18000;
this.penguin = true;
bool flag7 = true;
if (this.ownedProjectileCounts[112] > 0)
{
flag7 = false;
}
if (flag7)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 112, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 152)
{
this.buffTime[k] = 18000;
this.magicLantern = true;
if (this.ownedProjectileCounts[492] == 0)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 492, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 91)
{
this.buffTime[k] = 18000;
this.puppy = true;
bool flag8 = true;
if (this.ownedProjectileCounts[334] > 0)
{
flag8 = false;
}
if (flag8)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 334, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 92)
{
this.buffTime[k] = 18000;
this.grinch = true;
bool flag9 = true;
if (this.ownedProjectileCounts[353] > 0)
{
flag9 = false;
}
if (flag9)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 353, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 84)
{
this.buffTime[k] = 18000;
this.blackCat = true;
bool flag10 = true;
if (this.ownedProjectileCounts[319] > 0)
{
flag10 = false;
}
if (flag10)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 319, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 61)
{
this.buffTime[k] = 18000;
this.dino = true;
bool flag11 = true;
if (this.ownedProjectileCounts[236] > 0)
{
flag11 = false;
}
if (flag11)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 236, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 154)
{
this.buffTime[k] = 18000;
this.babyFaceMonster = true;
bool flag12 = true;
if (this.ownedProjectileCounts[499] > 0)
{
flag12 = false;
}
if (flag12)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 499, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 65)
{
this.buffTime[k] = 18000;
this.eyeSpring = true;
bool flag13 = true;
if (this.ownedProjectileCounts[268] > 0)
{
flag13 = false;
}
if (flag13)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 268, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 66)
{
this.buffTime[k] = 18000;
this.snowman = true;
bool flag14 = true;
if (this.ownedProjectileCounts[269] > 0)
{
flag14 = false;
}
if (flag14)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 269, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 42)
{
this.buffTime[k] = 18000;
this.turtle = true;
bool flag15 = true;
if (this.ownedProjectileCounts[127] > 0)
{
flag15 = false;
}
if (flag15)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 127, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 45)
{
this.buffTime[k] = 18000;
this.eater = true;
bool flag16 = true;
if (this.ownedProjectileCounts[175] > 0)
{
flag16 = false;
}
if (flag16)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 175, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 50)
{
this.buffTime[k] = 18000;
this.skeletron = true;
bool flag17 = true;
if (this.ownedProjectileCounts[197] > 0)
{
flag17 = false;
}
if (flag17)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 197, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 51)
{
this.buffTime[k] = 18000;
this.hornet = true;
bool flag18 = true;
if (this.ownedProjectileCounts[198] > 0)
{
flag18 = false;
}
if (flag18)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 198, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 52)
{
this.buffTime[k] = 18000;
this.tiki = true;
bool flag19 = true;
if (this.ownedProjectileCounts[199] > 0)
{
flag19 = false;
}
if (flag19)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 199, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 53)
{
this.buffTime[k] = 18000;
this.lizard = true;
bool flag20 = true;
if (this.ownedProjectileCounts[200] > 0)
{
flag20 = false;
}
if (flag20)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 200, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 54)
{
this.buffTime[k] = 18000;
this.parrot = true;
bool flag21 = true;
if (this.ownedProjectileCounts[208] > 0)
{
flag21 = false;
}
if (flag21)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 208, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 55)
{
this.buffTime[k] = 18000;
this.truffle = true;
bool flag22 = true;
if (this.ownedProjectileCounts[209] > 0)
{
flag22 = false;
}
if (flag22)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 209, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 56)
{
this.buffTime[k] = 18000;
this.sapling = true;
bool flag23 = true;
if (this.ownedProjectileCounts[210] > 0)
{
flag23 = false;
}
if (flag23)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 210, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 85)
{
this.buffTime[k] = 18000;
this.cSapling = true;
bool flag24 = true;
if (this.ownedProjectileCounts[324] > 0)
{
flag24 = false;
}
if (flag24)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 324, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 81)
{
this.buffTime[k] = 18000;
this.spider = true;
bool flag25 = true;
if (this.ownedProjectileCounts[313] > 0)
{
flag25 = false;
}
if (flag25)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 313, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 82)
{
this.buffTime[k] = 18000;
this.squashling = true;
bool flag26 = true;
if (this.ownedProjectileCounts[314] > 0)
{
flag26 = false;
}
if (flag26)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 314, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 57)
{
this.buffTime[k] = 18000;
this.wisp = true;
bool flag27 = true;
if (this.ownedProjectileCounts[211] > 0)
{
flag27 = false;
}
if (flag27)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 211, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 60)
{
this.buffTime[k] = 18000;
this.crystalLeaf = true;
bool flag28 = true;
for (int num23 = 0; num23 < 1000; num23++)
{
if (Main.projectile[num23].active && Main.projectile[num23].owner == this.whoAmI && Main.projectile[num23].type == 226)
{
if (!flag28)
{
Main.projectile[num23].Kill();
}
flag28 = false;
}
}
if (flag28)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 226, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 127)
{
this.buffTime[k] = 18000;
this.zephyrfish = true;
bool flag29 = true;
if (this.ownedProjectileCounts[380] > 0)
{
flag29 = false;
}
if (flag29)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 380, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 136)
{
this.buffTime[k] = 18000;
this.miniMinotaur = true;
bool flag30 = true;
if (this.ownedProjectileCounts[398] > 0)
{
flag30 = false;
}
if (flag30)
{
Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), 0f, 0f, 398, 0, 0f, this.whoAmI, 0f, 0f);
}
}
else if (this.buffType[k] == 70)
{
this.venom = true;
}
else if (this.buffType[k] == 20)
{
this.poisoned = true;
}
else if (this.buffType[k] == 21)
{
this.potionDelay = this.buffTime[k];
}
else if (this.buffType[k] == 22)
{
this.blind = true;
}
else if (this.buffType[k] == 80)
{
this.blackout = true;
}
else if (this.buffType[k] == 23)
{
this.noItems = true;
}
else if (this.buffType[k] == 24)
{
this.onFire = true;
}
else if (this.buffType[k] == 103)
{
this.dripping = true;
}
else if (this.buffType[k] == 137)
{
this.drippingSlime = true;
}
else if (this.buffType[k] == 67)
{
this.burned = true;
}
else if (this.buffType[k] == 68)
{
this.suffocating = true;
}
else if (this.buffType[k] == 39)
{
this.onFire2 = true;
}
else if (this.buffType[k] == 44)
{
this.onFrostBurn = true;
}
else if (this.buffType[k] == 163)
{
this.headcovered = true;
this.bleed = true;
}
else if (this.buffType[k] == 164)
{
this.vortexDebuff = true;
}
else if (this.buffType[k] == 145)
{
bool flag31 = false;
for (int num24 = 0; num24 < 1000; num24++)
{
Projectile projectile = Main.projectile[num24];
if (projectile.active && projectile.type == 456 && projectile.ai[1] == (float)this.whoAmI)
{
flag31 = true;
break;
}
}
if (flag31)
{
this.moonLeech = true;
}
else
{
this.DelBuff(k);
}
}
else if (this.buffType[k] == 149)
{
this.webbed = true;
if (this.velocity.Y != 0f)
{
this.velocity = new Vector2(0f, 1E-06f);
}
else
{
this.velocity = Vector2.Zero;
}
Player.jumpHeight = 0;
this.gravity = 0f;
this.moveSpeed = 0f;
this.dash = 0;
this.noKnockback = true;
this.grappling[0] = -1;
this.grapCount = 0;
for (int num25 = 0; num25 < 1000; num25++)
{
if (Main.projectile[num25].active && Main.projectile[num25].owner == this.whoAmI && Main.projectile[num25].aiStyle == 7)
{
Main.projectile[num25].Kill();
}
}
}
else if (this.buffType[k] == 43)
{
this.paladinBuff = true;
}
else if (this.buffType[k] == 29)
{
this.magicCrit += 2;
this.magicDamage += 0.05f;
this.statManaMax2 += 20;
this.manaCost -= 0.02f;
}
else if (this.buffType[k] == 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(k);
k--;
}
}
else if (this.buffType[k] == 33)
{
this.meleeDamage -= 0.051f;
this.meleeSpeed -= 0.051f;
this.statDefense -= 4;
this.moveSpeed -= 0.1f;
}
else if (this.buffType[k] == 25)
{
this.statDefense -= 4;
this.meleeCrit += 2;
this.meleeDamage += 0.1f;
this.meleeSpeed += 0.1f;
}
else if (this.buffType[k] == 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[k] == 71)
{
this.meleeEnchant = 1;
}
else if (this.buffType[k] == 73)
{
this.meleeEnchant = 2;
}
else if (this.buffType[k] == 74)
{
this.meleeEnchant = 3;
}
else if (this.buffType[k] == 75)
{
this.meleeEnchant = 4;
}
else if (this.buffType[k] == 76)
{
this.meleeEnchant = 5;
}
else if (this.buffType[k] == 77)
{
this.meleeEnchant = 6;
}
else if (this.buffType[k] == 78)
{
this.meleeEnchant = 7;
}
else if (this.buffType[k] == 79)
{
this.meleeEnchant = 8;
}
}
}
}
public void Counterweight(Vector2 hitPos, int dmg, float kb)
{
if (!this.yoyoGlove && this.counterWeight <= 0)
{
return;
}
int num = -1;
int num2 = 0;
int num3 = 0;
for (int i = 0; i < 1000; i++)
{
if (Main.projectile[i].active && Main.projectile[i].owner == this.whoAmI)
{
if (Main.projectile[i].counterweight)
{
num3++;
}
else if (Main.projectile[i].aiStyle == 99)
{
num2++;
num = i;
}
}
}
if (this.yoyoGlove && num2 < 2)
{
if (num >= 0)
{
Vector2 value = hitPos - base.Center;
value.Normalize();
value *= 16f;
Projectile.NewProjectile(base.Center.X, base.Center.Y, value.X, value.Y, Main.projectile[num].type, Main.projectile[num].damage, Main.projectile[num].knockBack, this.whoAmI, 1f, 0f);
return;
}
}
else if (num3 < num2)
{
Vector2 value2 = hitPos - base.Center;
value2.Normalize();
value2 *= 16f;
float knockBack = (kb + 6f) / 2f;
if (num3 > 0)
{
Projectile.NewProjectile(base.Center.X, base.Center.Y, value2.X, value2.Y, this.counterWeight, (int)((double)dmg * 0.8), knockBack, this.whoAmI, 1f, 0f);
return;
}
Projectile.NewProjectile(base.Center.X, base.Center.Y, value2.X, value2.Y, this.counterWeight, (int)((double)dmg * 0.8), knockBack, this.whoAmI, 0f, 0f);
}
}
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)
{
if (this.makeStrongBee)
{
return dmg + Main.rand.Next(1, 4);
}
return dmg + Main.rand.Next(2);
}
public float beeKB(float KB)
{
if (this.makeStrongBee)
{
return 0.5f + KB * 1.1f;
}
return KB;
}
public void Yoraiz0rEye()
{
int num = 0;
num += this.bodyFrame.Y / 56;
if (num >= Main.OffsetsPlayerHeadgear.Length)
{
num = 0;
}
Vector2 vector = new Vector2((float)(3 * this.direction - ((this.direction == 1) ? 1 : 0)), -11.5f * this.gravDir) + Vector2.UnitY * this.gfxOffY + base.Size / 2f + Main.OffsetsPlayerHeadgear[num];
Vector2 vector2 = new Vector2((float)(3 * this.shadowDirection[1] - ((this.direction == 1) ? 1 : 0)), -11.5f * this.gravDir) + base.Size / 2f + Main.OffsetsPlayerHeadgear[num];
Vector2 vector3 = Vector2.Zero;
if (this.mount.Active && this.mount.Cart)
{
int num2 = Math.Sign(this.velocity.X);
if (num2 == 0)
{
num2 = this.direction;
}
vector3 = new Vector2(MathHelper.Lerp(0f, -8f, this.fullRotation / 0.7853982f), MathHelper.Lerp(0f, 2f, Math.Abs(this.fullRotation / 0.7853982f))).RotatedBy((double)this.fullRotation, default(Vector2));
if (num2 == Math.Sign(this.fullRotation))
{
vector3 *= MathHelper.Lerp(1f, 0.6f, Math.Abs(this.fullRotation / 0.7853982f));
}
}
if (this.fullRotation != 0f)
{
vector = vector.RotatedBy((double)this.fullRotation, this.fullRotationOrigin);
vector2 = vector2.RotatedBy((double)this.fullRotation, this.fullRotationOrigin);
}
Vector2 vector4 = this.position + vector + vector3;
Vector2 vector5 = this.oldPosition + vector2 + vector3;
float num3 = 1f;
switch (this.yoraiz0rEye % 10)
{
case 1:
return;
case 2:
num3 = 0.5f;
break;
case 3:
num3 = 0.625f;
break;
case 4:
num3 = 0.75f;
break;
case 5:
num3 = 0.875f;
break;
case 6:
num3 = 1f;
break;
case 7:
num3 = 1.1f;
break;
}
if (this.yoraiz0rEye < 7)
{
DelegateMethods.v3_1 = Main.hslToRgb(Main.rgbToHsl(this.eyeColor).X, 1f, 0.5f).ToVector3() * 0.5f * num3;
if (this.velocity != Vector2.Zero)
{
Utils.PlotTileLine(base.Center, base.Center + this.velocity * 2f, 4f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
}
else
{
Utils.PlotTileLine(base.Left, base.Right, 4f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen));
}
}
int num4 = (int)Vector2.Distance(vector4, vector5) / 3 + 1;
if (Vector2.Distance(vector4, vector5) % 3f != 0f)
{
num4++;
}
for (float num5 = 1f; num5 <= (float)num4; num5 += 1f)
{
Dust dust = Main.dust[Dust.NewDust(base.Center, 0, 0, 182, 0f, 0f, 0, default(Color), 1f)];
dust.position = Vector2.Lerp(vector5, vector4, num5 / (float)num4);
dust.noGravity = true;
dust.velocity = Vector2.Zero;
dust.customData = this;
dust.scale = num3;
dust.shader = GameShaders.Armor.GetSecondaryShader(this.cYorai, this);
}
}
public void UpdateEquips(int i)
{
for (int j = 0; j < 58; j++)
{
int type = this.inventory[j].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;
}
}
for (int k = 0; k < 8 + this.extraAccessorySlots; k++)
{
if (!this.armor[k].expertOnly || Main.expertMode)
{
int type2 = this.armor[k].type;
if ((type2 == 15 || type2 == 707) && this.accWatch < 1)
{
this.accWatch = 1;
}
if ((type2 == 16 || type2 == 708) && this.accWatch < 2)
{
this.accWatch = 2;
}
if ((type2 == 17 || type2 == 709) && this.accWatch < 3)
{
this.accWatch = 3;
}
if (type2 == 393)
{
this.accCompass = 1;
}
if (type2 == 18)
{
this.accDepthMeter = 1;
}
if (type2 == 395 || type2 == 3123 || type2 == 3124)
{
this.accWatch = 3;
this.accDepthMeter = 1;
this.accCompass = 1;
}
if (type2 == 3120 || type2 == 3036 || type2 == 3123 || type2 == 3124)
{
this.accFishFinder = true;
}
if (type2 == 3037 || type2 == 3036 || type2 == 3123 || type2 == 3124)
{
this.accWeatherRadio = true;
}
if (type2 == 3096 || type2 == 3036 || type2 == 3123 || type2 == 3124)
{
this.accCalendar = true;
}
if (type2 == 3084 || type2 == 3122 || type2 == 3123 || type2 == 3124)
{
this.accThirdEye = true;
}
if (type2 == 3095 || type2 == 3122 || type2 == 3123 || type2 == 3124)
{
this.accJarOfSouls = true;
}
if (type2 == 3118 || type2 == 3122 || type2 == 3123 || type2 == 3124)
{
this.accCritterGuide = true;
}
if (type2 == 3099 || type2 == 3121 || type2 == 3123 || type2 == 3124)
{
this.accStopwatch = true;
}
if (type2 == 3102 || type2 == 3121 || type2 == 3123 || type2 == 3124)
{
this.accOreFinder = true;
}
if (type2 == 3119 || type2 == 3121 || type2 == 3123 || type2 == 3124)
{
this.accDreamCatcher = true;
}
if (this.armor[k].type == 3017 && this.whoAmI == Main.myPlayer && this.velocity.Y == 0f && this.grappling[0] == -1)
{
int num = (int)base.Center.X / 16;
int num2 = (int)(this.position.Y + (float)this.height - 1f) / 16;
if (Main.tile[num, num2] == null)
{
Main.tile[num, num2] = new Tile();
}
if (!Main.tile[num, num2].active() && Main.tile[num, num2].liquid == 0 && Main.tile[num, num2 + 1] != null && WorldGen.SolidTile(num, num2 + 1))
{
Main.tile[num, num2].frameY = 0;
Main.tile[num, num2].slope(0);
Main.tile[num, num2].halfBrick(false);
if (Main.tile[num, num2 + 1].type == 2)
{
if (Main.rand.Next(2) == 0)
{
Main.tile[num, num2].active(true);
Main.tile[num, num2].type = 3;
Main.tile[num, num2].frameX = (short)(18 * Main.rand.Next(6, 11));
while (Main.tile[num, num2].frameX == 144)
{
Main.tile[num, num2].frameX = (short)(18 * Main.rand.Next(6, 11));
}
}
else
{
Main.tile[num, num2].active(true);
Main.tile[num, num2].type = 73;
Main.tile[num, num2].frameX = (short)(18 * Main.rand.Next(6, 21));
while (Main.tile[num, num2].frameX == 144)
{
Main.tile[num, num2].frameX = (short)(18 * Main.rand.Next(6, 21));
}
}
if (Main.netMode == 1)
{
NetMessage.SendTileSquare(-1, num, num2, 1);
}
}
else if (Main.tile[num, num2 + 1].type == 109)
{
if (Main.rand.Next(2) == 0)
{
Main.tile[num, num2].active(true);
Main.tile[num, num2].type = 110;
Main.tile[num, num2].frameX = (short)(18 * Main.rand.Next(4, 7));
while (Main.tile[num, num2].frameX == 90)
{
Main.tile[num, num2].frameX = (short)(18 * Main.rand.Next(4, 7));
}
}
else
{
Main.tile[num, num2].active(true);
Main.tile[num, num2].type = 113;
Main.tile[num, num2].frameX = (short)(18 * Main.rand.Next(2, 8));
while (Main.tile[num, num2].frameX == 90)
{
Main.tile[num, num2].frameX = (short)(18 * Main.rand.Next(2, 8));
}
}
if (Main.netMode == 1)
{
NetMessage.SendTileSquare(-1, num, num2, 1);
}
}
else if (Main.tile[num, num2 + 1].type == 60)
{
Main.tile[num, num2].active(true);
Main.tile[num, num2].type = 74;
Main.tile[num, num2].frameX = (short)(18 * Main.rand.Next(9, 17));
if (Main.netMode == 1)
{
NetMessage.SendTileSquare(-1, num, num2, 1);
}
}
}
}
this.statDefense += this.armor[k].defense;
this.lifeRegen += this.armor[k].lifeRegen;
if (this.armor[k].type == 268)
{
this.accDivingHelm = true;
}
if (this.armor[k].type == 238)
{
this.magicDamage += 0.15f;
}
if (this.armor[k].type == 3212)
{
this.armorPenetration += 5;
}
if (this.armor[k].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[k].type == 2279)
{
this.magicDamage += 0.06f;
this.magicCrit += 6;
this.manaCost -= 0.1f;
}
if (this.armor[k].type == 3109)
{
this.nightVision = true;
}
if (this.armor[k].type == 256)
{
this.thrownVelocity += 0.15f;
}
if (this.armor[k].type == 257)
{
this.thrownDamage += 0.15f;
}
if (this.armor[k].type == 258)
{
this.thrownCrit += 10;
}
if (this.armor[k].type == 3374)
{
this.thrownVelocity += 0.2f;
}
if (this.armor[k].type == 3375)
{
this.thrownDamage += 0.2f;
}
if (this.armor[k].type == 3376)
{
this.thrownCrit += 15;
}
if (this.armor[k].type == 2275)
{
this.magicDamage += 0.07f;
this.magicCrit += 7;
}
if (this.armor[k].type == 123 || this.armor[k].type == 124 || this.armor[k].type == 125)
{
this.magicDamage += 0.07f;
}
if (this.armor[k].type == 151 || this.armor[k].type == 152 || this.armor[k].type == 153 || this.armor[k].type == 959)
{
this.rangedDamage += 0.05f;
}
if (this.armor[k].type == 111 || this.armor[k].type == 228 || this.armor[k].type == 229 || this.armor[k].type == 230 || this.armor[k].type == 960 || this.armor[k].type == 961 || this.armor[k].type == 962)
{
this.statManaMax2 += 20;
}
if (this.armor[k].type == 228 || this.armor[k].type == 960)
{
this.statManaMax2 += 20;
}
if (this.armor[k].type == 228 || this.armor[k].type == 229 || this.armor[k].type == 230 || this.armor[k].type == 960 || this.armor[k].type == 961 || this.armor[k].type == 962)
{
this.magicCrit += 4;
}
if (this.armor[k].type == 100 || this.armor[k].type == 101 || this.armor[k].type == 102)
{
this.meleeSpeed += 0.07f;
}
if (this.armor[k].type == 956 || this.armor[k].type == 957 || this.armor[k].type == 958)
{
this.meleeSpeed += 0.07f;
}
if (this.armor[k].type == 792 || this.armor[k].type == 793 || this.armor[k].type == 794)
{
this.meleeDamage += 0.02f;
this.rangedDamage += 0.02f;
this.magicDamage += 0.02f;
this.thrownDamage += 0.02f;
}
if (this.armor[k].type == 371)
{
this.magicCrit += 9;
this.statManaMax2 += 40;
}
if (this.armor[k].type == 372)
{
this.moveSpeed += 0.07f;
this.meleeSpeed += 0.12f;
}
if (this.armor[k].type == 373)
{
this.rangedDamage += 0.1f;
this.rangedCrit += 6;
}
if (this.armor[k].type == 374)
{
this.magicCrit += 3;
this.meleeCrit += 3;
this.rangedCrit += 3;
}
if (this.armor[k].type == 375)
{
this.moveSpeed += 0.1f;
}
if (this.armor[k].type == 376)
{
this.magicDamage += 0.15f;
this.statManaMax2 += 60;
}
if (this.armor[k].type == 377)
{
this.meleeCrit += 5;
this.meleeDamage += 0.1f;
}
if (this.armor[k].type == 378)
{
this.rangedDamage += 0.12f;
this.rangedCrit += 7;
}
if (this.armor[k].type == 379)
{
this.rangedDamage += 0.05f;
this.meleeDamage += 0.05f;
this.magicDamage += 0.05f;
}
if (this.armor[k].type == 380)
{
this.magicCrit += 3;
this.meleeCrit += 3;
this.rangedCrit += 3;
}
if (this.armor[k].type >= 2367 && this.armor[k].type <= 2369)
{
this.fishingSkill += 5;
}
if (this.armor[k].type == 400)
{
this.magicDamage += 0.11f;
this.magicCrit += 11;
this.statManaMax2 += 80;
}
if (this.armor[k].type == 401)
{
this.meleeCrit += 7;
this.meleeDamage += 0.14f;
}
if (this.armor[k].type == 402)
{
this.rangedDamage += 0.14f;
this.rangedCrit += 8;
}
if (this.armor[k].type == 403)
{
this.rangedDamage += 0.06f;
this.meleeDamage += 0.06f;
this.magicDamage += 0.06f;
}
if (this.armor[k].type == 404)
{
this.magicCrit += 4;
this.meleeCrit += 4;
this.rangedCrit += 4;
this.moveSpeed += 0.05f;
}
if (this.armor[k].type == 1205)
{
this.meleeDamage += 0.08f;
this.meleeSpeed += 0.12f;
}
if (this.armor[k].type == 1206)
{
this.rangedDamage += 0.09f;
this.rangedCrit += 9;
}
if (this.armor[k].type == 1207)
{
this.magicDamage += 0.07f;
this.magicCrit += 7;
this.statManaMax2 += 60;
}
if (this.armor[k].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[k].type == 1209)
{
this.meleeDamage += 0.02f;
this.rangedDamage += 0.02f;
this.magicDamage += 0.02f;
this.magicCrit++;
this.meleeCrit++;
this.rangedCrit++;
}
if (this.armor[k].type == 1210)
{
this.meleeDamage += 0.07f;
this.meleeSpeed += 0.07f;
this.moveSpeed += 0.07f;
}
if (this.armor[k].type == 1211)
{
this.rangedCrit += 15;
this.moveSpeed += 0.08f;
}
if (this.armor[k].type == 1212)
{
this.magicCrit += 18;
this.statManaMax2 += 80;
}
if (this.armor[k].type == 1213)
{
this.magicCrit += 6;
this.meleeCrit += 6;
this.rangedCrit += 6;
}
if (this.armor[k].type == 1214)
{
this.moveSpeed += 0.11f;
}
if (this.armor[k].type == 1215)
{
this.meleeDamage += 0.08f;
this.meleeCrit += 8;
this.meleeSpeed += 0.08f;
}
if (this.armor[k].type == 1216)
{
this.rangedDamage += 0.16f;
this.rangedCrit += 7;
}
if (this.armor[k].type == 1217)
{
this.magicDamage += 0.16f;
this.magicCrit += 7;
this.statManaMax2 += 100;
}
if (this.armor[k].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[k].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[k].type == 558)
{
this.magicDamage += 0.12f;
this.magicCrit += 12;
this.statManaMax2 += 100;
}
if (this.armor[k].type == 559)
{
this.meleeCrit += 10;
this.meleeDamage += 0.1f;
this.meleeSpeed += 0.1f;
}
if (this.armor[k].type == 553)
{
this.rangedDamage += 0.15f;
this.rangedCrit += 8;
}
if (this.armor[k].type == 551)
{
this.magicCrit += 7;
this.meleeCrit += 7;
this.rangedCrit += 7;
}
if (this.armor[k].type == 552)
{
this.rangedDamage += 0.07f;
this.meleeDamage += 0.07f;
this.magicDamage += 0.07f;
this.moveSpeed += 0.08f;
}
if (this.armor[k].type == 1001)
{
this.meleeDamage += 0.16f;
this.meleeCrit += 6;
}
if (this.armor[k].type == 1002)
{
this.rangedDamage += 0.16f;
this.ammoCost80 = true;
}
if (this.armor[k].type == 1003)
{
this.statManaMax2 += 80;
this.manaCost -= 0.17f;
this.magicDamage += 0.16f;
}
if (this.armor[k].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[k].type == 1005)
{
this.magicCrit += 8;
this.meleeCrit += 8;
this.rangedCrit += 8;
this.moveSpeed += 0.05f;
}
if (this.armor[k].type == 2189)
{
this.statManaMax2 += 60;
this.manaCost -= 0.13f;
this.magicDamage += 0.05f;
this.magicCrit += 5;
}
if (this.armor[k].type == 1503)
{
this.magicDamage -= 0.4f;
}
if (this.armor[k].type == 1504)
{
this.magicDamage += 0.07f;
this.magicCrit += 7;
}
if (this.armor[k].type == 1505)
{
this.magicDamage += 0.08f;
this.moveSpeed += 0.08f;
}
if (this.armor[k].type == 1546)
{
this.rangedCrit += 5;
this.arrowDamage += 0.15f;
}
if (this.armor[k].type == 1547)
{
this.rangedCrit += 5;
this.bulletDamage += 0.15f;
}
if (this.armor[k].type == 1548)
{
this.rangedCrit += 5;
this.rocketDamage += 0.15f;
}
if (this.armor[k].type == 1549)
{
this.rangedCrit += 13;
this.rangedDamage += 0.13f;
this.ammoCost80 = true;
}
if (this.armor[k].type == 1550)
{
this.rangedCrit += 7;
this.moveSpeed += 0.12f;
}
if (this.armor[k].type == 1282)
{
this.statManaMax2 += 20;
this.manaCost -= 0.05f;
}
if (this.armor[k].type == 1283)
{
this.statManaMax2 += 40;
this.manaCost -= 0.07f;
}
if (this.armor[k].type == 1284)
{
this.statManaMax2 += 40;
this.manaCost -= 0.09f;
}
if (this.armor[k].type == 1285)
{
this.statManaMax2 += 60;
this.manaCost -= 0.11f;
}
if (this.armor[k].type == 1286)
{
this.statManaMax2 += 60;
this.manaCost -= 0.13f;
}
if (this.armor[k].type == 1287)
{
this.statManaMax2 += 80;
this.manaCost -= 0.15f;
}
if (this.armor[k].type == 1316 || this.armor[k].type == 1317 || this.armor[k].type == 1318)
{
this.aggro += 250;
}
if (this.armor[k].type == 1316)
{
this.meleeDamage += 0.06f;
}
if (this.armor[k].type == 1317)
{
this.meleeDamage += 0.08f;
this.meleeCrit += 8;
}
if (this.armor[k].type == 1318)
{
this.meleeCrit += 4;
}
if (this.armor[k].type == 2199 || this.armor[k].type == 2202)
{
this.aggro += 250;
}
if (this.armor[k].type == 2201)
{
this.aggro += 400;
}
if (this.armor[k].type == 2199)
{
this.meleeDamage += 0.06f;
}
if (this.armor[k].type == 2200)
{
this.meleeDamage += 0.08f;
this.meleeCrit += 8;
this.meleeSpeed += 0.06f;
this.moveSpeed += 0.06f;
}
if (this.armor[k].type == 2201)
{
this.meleeDamage += 0.05f;
this.meleeCrit += 5;
}
if (this.armor[k].type == 2202)
{
this.meleeSpeed += 0.06f;
this.moveSpeed += 0.06f;
}
if (this.armor[k].type == 684)
{
this.rangedDamage += 0.16f;
this.meleeDamage += 0.16f;
}
if (this.armor[k].type == 685)
{
this.meleeCrit += 11;
this.rangedCrit += 11;
}
if (this.armor[k].type == 686)
{
this.moveSpeed += 0.08f;
this.meleeSpeed += 0.07f;
}
if (this.armor[k].type == 2361)
{
this.maxMinions++;
this.minionDamage += 0.04f;
}
if (this.armor[k].type == 2362)
{
this.maxMinions++;
this.minionDamage += 0.04f;
}
if (this.armor[k].type == 2363)
{
this.minionDamage += 0.05f;
}
if (this.armor[k].type >= 1158 && this.armor[k].type <= 1161)
{
this.maxMinions++;
}
if (this.armor[k].type >= 1159 && this.armor[k].type <= 1161)
{
this.minionDamage += 0.1f;
}
if (this.armor[k].type >= 2370 && this.armor[k].type <= 2371)
{
this.minionDamage += 0.05f;
this.maxMinions++;
}
if (this.armor[k].type == 2372)
{
this.minionDamage += 0.06f;
this.maxMinions++;
}
if (this.armor[k].type == 3381 || this.armor[k].type == 3382 || this.armor[k].type == 3383)
{
if (this.armor[k].type != 3381)
{
this.maxMinions++;
}
this.maxMinions++;
this.minionDamage += 0.22f;
}
if (this.armor[k].type == 2763)
{
this.aggro += 300;
this.meleeCrit += 17;
}
if (this.armor[k].type == 2764)
{
this.aggro += 300;
this.meleeDamage += 0.22f;
}
if (this.armor[k].type == 2765)
{
this.aggro += 300;
this.meleeSpeed += 0.15f;
this.moveSpeed += 0.15f;
}
if (this.armor[k].type == 2757)
{
this.rangedCrit += 7;
this.rangedDamage += 0.16f;
}
if (this.armor[k].type == 2758)
{
this.ammoCost75 = true;
this.rangedCrit += 12;
this.rangedDamage += 0.12f;
}
if (this.armor[k].type == 2759)
{
this.rangedCrit += 8;
this.rangedDamage += 0.08f;
this.moveSpeed += 0.1f;
}
if (this.armor[k].type == 2760)
{
this.statManaMax2 += 60;
this.manaCost -= 0.15f;
this.magicCrit += 7;
this.magicDamage += 0.07f;
}
if (this.armor[k].type == 2761)
{
this.magicDamage += 0.09f;
this.magicCrit += 9;
}
if (this.armor[k].type == 2762)
{
this.moveSpeed += 0.1f;
this.magicDamage += 0.1f;
}
if (this.armor[k].type >= 1832 && this.armor[k].type <= 1834)
{
this.maxMinions++;
}
if (this.armor[k].type >= 1832 && this.armor[k].type <= 1834)
{
this.minionDamage += 0.11f;
}
if (this.armor[k].prefix == 62)
{
this.statDefense++;
}
if (this.armor[k].prefix == 63)
{
this.statDefense += 2;
}
if (this.armor[k].prefix == 64)
{
this.statDefense += 3;
}
if (this.armor[k].prefix == 65)
{
this.statDefense += 4;
}
if (this.armor[k].prefix == 66)
{
this.statManaMax2 += 20;
}
if (this.armor[k].prefix == 67)
{
this.meleeCrit += 2;
this.rangedCrit += 2;
this.magicCrit += 2;
this.thrownCrit += 2;
}
if (this.armor[k].prefix == 68)
{
this.meleeCrit += 4;
this.rangedCrit += 4;
this.magicCrit += 4;
this.thrownCrit += 4;
}
if (this.armor[k].prefix == 69)
{
this.meleeDamage += 0.01f;
this.rangedDamage += 0.01f;
this.magicDamage += 0.01f;
this.minionDamage += 0.01f;
this.thrownDamage += 0.01f;
}
if (this.armor[k].prefix == 70)
{
this.meleeDamage += 0.02f;
this.rangedDamage += 0.02f;
this.magicDamage += 0.02f;
this.minionDamage += 0.02f;
this.thrownDamage += 0.02f;
}
if (this.armor[k].prefix == 71)
{
this.meleeDamage += 0.03f;
this.rangedDamage += 0.03f;
this.magicDamage += 0.03f;
this.minionDamage += 0.03f;
this.thrownDamage += 0.03f;
}
if (this.armor[k].prefix == 72)
{
this.meleeDamage += 0.04f;
this.rangedDamage += 0.04f;
this.magicDamage += 0.04f;
this.minionDamage += 0.04f;
this.thrownDamage += 0.04f;
}
if (this.armor[k].prefix == 73)
{
this.moveSpeed += 0.01f;
}
if (this.armor[k].prefix == 74)
{
this.moveSpeed += 0.02f;
}
if (this.armor[k].prefix == 75)
{
this.moveSpeed += 0.03f;
}
if (this.armor[k].prefix == 76)
{
this.moveSpeed += 0.04f;
}
if (this.armor[k].prefix == 77)
{
this.meleeSpeed += 0.01f;
}
if (this.armor[k].prefix == 78)
{
this.meleeSpeed += 0.02f;
}
if (this.armor[k].prefix == 79)
{
this.meleeSpeed += 0.03f;
}
if (this.armor[k].prefix == 80)
{
this.meleeSpeed += 0.04f;
}
}
}
bool flag = false;
bool flag2 = false;
bool flag3 = false;
for (int l = 3; l < 8 + this.extraAccessorySlots; l++)
{
if (!this.armor[l].expertOnly || Main.expertMode)
{
if (this.armor[l].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[l].type == 3016)
{
this.aggro += 400;
}
if (this.armor[l].type == 2373)
{
this.accFishingLine = true;
}
if (this.armor[l].type == 2374)
{
this.fishingSkill += 10;
}
if (this.armor[l].type == 2375)
{
this.accTackleBox = true;
}
if (this.armor[l].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[l].stringColor > 0)
{
this.yoyoString = true;
}
if (this.armor[l].type == 3366)
{
this.counterWeight = 556 + Main.rand.Next(6);
this.yoyoGlove = true;
this.yoyoString = true;
}
if (this.armor[l].type >= 3309 && this.armor[l].type <= 3314)
{
this.counterWeight = 556 + this.armor[l].type - 3309;
}
if (this.armor[l].type == 3334)
{
this.yoyoGlove = true;
}
if (this.armor[l].type == 3337)
{
this.shinyStone = true;
}
if (this.armor[l].type == 3336)
{
this.SporeSac();
this.sporeSac = true;
}
if (this.armor[l].type == 2423)
{
this.autoJump = true;
this.jumpSpeedBoost += 2.4f;
this.extraFall += 15;
}
if (this.armor[l].type == 857)
{
this.doubleJumpSandstorm = true;
}
if (this.armor[l].type == 983)
{
this.doubleJumpSandstorm = true;
this.jumpBoost = true;
}
if (this.armor[l].type == 987)
{
this.doubleJumpBlizzard = true;
}
if (this.armor[l].type == 1163)
{
this.doubleJumpBlizzard = true;
this.jumpBoost = true;
}
if (this.armor[l].type == 1724)
{
this.doubleJumpFart = true;
}
if (this.armor[l].type == 1863)
{
this.doubleJumpFart = true;
this.jumpBoost = true;
}
if (this.armor[l].type == 1164)
{
this.doubleJumpCloud = true;
this.doubleJumpSandstorm = true;
this.doubleJumpBlizzard = true;
this.jumpBoost = true;
}
if (this.armor[l].type == 1250)
{
this.jumpBoost = true;
this.doubleJumpCloud = true;
this.noFallDmg = true;
}
if (this.armor[l].type == 1252)
{
this.doubleJumpSandstorm = true;
this.jumpBoost = true;
this.noFallDmg = true;
}
if (this.armor[l].type == 1251)
{
this.doubleJumpBlizzard = true;
this.jumpBoost = true;
this.noFallDmg = true;
}
if (this.armor[l].type == 3250)
{
this.doubleJumpFart = true;
this.jumpBoost = true;
this.noFallDmg = true;
}
if (this.armor[l].type == 3252)
{
this.doubleJumpSail = true;
this.jumpBoost = true;
this.noFallDmg = true;
}
if (this.armor[l].type == 3251)
{
this.jumpBoost = true;
this.bee = true;
this.noFallDmg = true;
}
if (this.armor[l].type == 1249)
{
this.jumpBoost = true;
this.bee = true;
}
if (this.armor[l].type == 3241)
{
this.jumpBoost = true;
this.doubleJumpSail = true;
}
if (this.armor[l].type == 1253 && (double)this.statLife <= (double)this.statLifeMax2 * 0.5)
{
this.AddBuff(62, 5, true);
}
if (this.armor[l].type == 1290)
{
this.panic = true;
}
if ((this.armor[l].type == 1300 || this.armor[l].type == 1858) && (this.inventory[this.selectedItem].useAmmo == 14 || this.inventory[this.selectedItem].useAmmo == 311 || this.inventory[this.selectedItem].useAmmo == 323 || this.inventory[this.selectedItem].useAmmo == 23))
{
this.scope = true;
}
if (this.armor[l].type == 1858)
{
this.rangedCrit += 10;
this.rangedDamage += 0.1f;
}
if (this.armor[l].type == 1303 && this.wet)
{
Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.9f, 0.2f, 0.6f);
}
if (this.armor[l].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[l].type == 982)
{
this.statManaMax2 += 20;
this.manaRegenDelayBonus++;
this.manaRegenBonus += 25;
}
if (this.armor[l].type == 1595)
{
this.statManaMax2 += 20;
this.magicCuffs = true;
}
if (this.armor[l].type == 2219)
{
this.manaMagnet = true;
}
if (this.armor[l].type == 2220)
{
this.manaMagnet = true;
this.magicDamage += 0.15f;
}
if (this.armor[l].type == 2221)
{
this.manaMagnet = true;
this.magicCuffs = true;
}
if (this.whoAmI == Main.myPlayer && this.armor[l].type == 1923)
{
Player.tileRangeX++;
Player.tileRangeY++;
}
if (this.armor[l].type == 1247)
{
this.starCloak = true;
this.bee = true;
}
if (this.armor[l].type == 1248)
{
this.meleeCrit += 10;
this.rangedCrit += 10;
this.magicCrit += 10;
this.thrownCrit += 10;
}
if (this.armor[l].type == 854)
{
this.discount = true;
}
if (this.armor[l].type == 855)
{
this.coins = true;
}
if (this.armor[l].type == 3033)
{
this.goldRing = true;
}
if (this.armor[l].type == 3034)
{
this.goldRing = true;
this.coins = true;
}
if (this.armor[l].type == 3035)
{
this.goldRing = true;
this.coins = true;
this.discount = true;
}
if (this.armor[l].type == 53)
{
this.doubleJumpCloud = true;
}
if (this.armor[l].type == 3201)
{
this.doubleJumpSail = true;
}
if (this.armor[l].type == 54)
{
this.accRunSpeed = 6f;
}
if (this.armor[l].type == 3068)
{
this.cordage = true;
}
if (this.armor[l].type == 1579)
{
this.accRunSpeed = 6f;
this.coldDash = true;
}
if (this.armor[l].type == 3200)
{
this.accRunSpeed = 6f;
this.sailDash = true;
}
if (this.armor[l].type == 128)
{
this.rocketBoots = 1;
}
if (this.armor[l].type == 156)
{
this.noKnockback = true;
}
if (this.armor[l].type == 158)
{
this.noFallDmg = true;
}
if (this.armor[l].type == 934)
{
this.carpet = true;
}
if (this.armor[l].type == 953)
{
this.spikedBoots++;
}
if (this.armor[l].type == 975)
{
this.spikedBoots++;
}
if (this.armor[l].type == 976)
{
this.spikedBoots += 2;
}
if (this.armor[l].type == 977)
{
this.dash = 1;
}
if (this.armor[l].type == 3097)
{
this.dash = 2;
}
if (this.armor[l].type == 963)
{
this.blackBelt = true;
}
if (this.armor[l].type == 984)
{
this.blackBelt = true;
this.dash = 1;
this.spikedBoots = 2;
}
if (this.armor[l].type == 1131)
{
this.gravControl2 = true;
}
if (this.armor[l].type == 1132)
{
this.bee = true;
}
if (this.armor[l].type == 1578)
{
this.bee = true;
this.panic = true;
}
if (this.armor[l].type == 3224)
{
this.endurance += 0.17f;
}
if (this.armor[l].type == 3223)
{
this.brainOfConfusion = true;
}
if (this.armor[l].type == 950)
{
this.iceSkate = true;
}
if (this.armor[l].type == 159)
{
this.jumpBoost = true;
}
if (this.armor[l].type == 3225)
{
this.jumpBoost = true;
}
if (this.armor[l].type == 187)
{
this.accFlipper = true;
}
if (this.armor[l].type == 211)
{
this.meleeSpeed += 0.12f;
}
if (this.armor[l].type == 223)
{
this.manaCost -= 0.06f;
}
if (this.armor[l].type == 285)
{
this.moveSpeed += 0.05f;
}
if (this.armor[l].type == 212)
{
this.moveSpeed += 0.1f;
}
if (this.armor[l].type == 267)
{
this.killGuide = true;
}
if (this.armor[l].type == 1307)
{
this.killClothier = true;
}
if (this.armor[l].type == 193)
{
this.fireWalk = true;
}
if (this.armor[l].type == 861)
{
this.accMerman = true;
this.wolfAcc = true;
}
if (this.armor[l].type == 862)
{
this.starCloak = true;
this.longInvince = true;
}
if (this.armor[l].type == 860)
{
this.pStone = true;
}
if (this.armor[l].type == 863)
{
this.waterWalk2 = true;
}
if (this.armor[l].type == 907)
{
this.waterWalk2 = true;
this.fireWalk = true;
}
if (this.armor[l].type == 908)
{
this.waterWalk = true;
this.fireWalk = true;
this.lavaMax += 420;
}
if (this.armor[l].type == 906)
{
this.lavaMax += 420;
}
if (this.armor[l].type == 485)
{
this.wolfAcc = true;
}
if (this.armor[l].type == 486 && !this.hideVisual[l])
{
this.rulerLine = true;
}
if (this.armor[l].type == 2799 && !this.hideVisual[l])
{
this.rulerGrid = true;
}
if (this.armor[l].type == 394)
{
this.accFlipper = true;
this.accDivingHelm = true;
}
if (this.armor[l].type == 396)
{
this.noFallDmg = true;
this.fireWalk = true;
}
if (this.armor[l].type == 397)
{
this.noKnockback = true;
this.fireWalk = true;
}
if (this.armor[l].type == 399)
{
this.jumpBoost = true;
this.doubleJumpCloud = true;
}
if (this.armor[l].type == 405)
{
this.accRunSpeed = 6f;
this.rocketBoots = 2;
}
if (this.armor[l].type == 1860)
{
this.accFlipper = true;
this.accDivingHelm = true;
if (this.wet)
{
Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.9f, 0.2f, 0.6f);
}
}
if (this.armor[l].type == 1861)
{
this.arcticDivingGear = true;
this.accFlipper = true;
this.accDivingHelm = true;
this.iceSkate = true;
if (this.wet)
{
Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.2f, 0.8f, 0.9f);
}
}
if (this.armor[l].type == 2214)
{
flag2 = true;
}
if (this.armor[l].type == 2215)
{
flag3 = true;
}
if (this.armor[l].type == 2216)
{
this.autoPaint = true;
}
if (this.armor[l].type == 2217)
{
flag = true;
}
if (this.armor[l].type == 3061)
{
flag = true;
flag2 = true;
this.autoPaint = true;
flag3 = true;
}
if (this.armor[l].type == 897)
{
this.kbGlove = true;
this.meleeSpeed += 0.12f;
}
if (this.armor[l].type == 1343)
{
this.kbGlove = true;
this.meleeSpeed += 0.1f;
this.meleeDamage += 0.1f;
this.magmaStone = true;
}
if (this.armor[l].type == 1167)
{
this.minionKB += 2f;
this.minionDamage += 0.15f;
}
if (this.armor[l].type == 1864)
{
this.minionKB += 2f;
this.minionDamage += 0.15f;
this.maxMinions++;
}
if (this.armor[l].type == 1845)
{
this.minionDamage += 0.1f;
this.maxMinions++;
}
if (this.armor[l].type == 1321)
{
this.magicQuiver = true;
this.arrowDamage += 0.1f;
}
if (this.armor[l].type == 1322)
{
this.magmaStone = true;
}
if (this.armor[l].type == 1323)
{
this.lavaRose = true;
}
if (this.armor[l].type == 3333)
{
this.strongBees = true;
}
if (this.armor[l].type == 938)
{
this.noKnockback = true;
if ((double)this.statLife > (double)this.statLifeMax2 * 0.25)
{
if (i == Main.myPlayer)
{
this.paladinGive = true;
}
else if (this.miscCounter % 5 == 0)
{
int myPlayer = Main.myPlayer;
if (Main.player[myPlayer].team == this.team && this.team != 0)
{
float num3 = this.position.X - Main.player[myPlayer].position.X;
float num4 = this.position.Y - Main.player[myPlayer].position.Y;
float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4));
if (num5 < 800f)
{
Main.player[myPlayer].AddBuff(43, 10, true);
}
}
}
}
}
if (this.armor[l].type == 936)
{
this.kbGlove = true;
this.meleeSpeed += 0.12f;
this.meleeDamage += 0.12f;
}
if (this.armor[l].type == 898)
{
this.accRunSpeed = 6.75f;
this.rocketBoots = 2;
this.moveSpeed += 0.08f;
}
if (this.armor[l].type == 1862)
{
this.accRunSpeed = 6.75f;
this.rocketBoots = 3;
this.moveSpeed += 0.08f;
this.iceSkate = true;
}
if (this.armor[l].type == 3110)
{
this.accMerman = true;
this.wolfAcc = true;
}
if (this.armor[l].type == 1865 || this.armor[l].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[l].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[l].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[l].type == 407)
{
this.blockRange = 1;
}
if (this.armor[l].type == 489)
{
this.magicDamage += 0.15f;
}
if (this.armor[l].type == 490)
{
this.meleeDamage += 0.15f;
}
if (this.armor[l].type == 491)
{
this.rangedDamage += 0.15f;
}
if (this.armor[l].type == 2998)
{
this.minionDamage += 0.15f;
}
if (this.armor[l].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[l].type == 492)
{
this.wingTimeMax = 100;
}
if (this.armor[l].type == 493)
{
this.wingTimeMax = 100;
}
if (this.armor[l].type == 748)
{
this.wingTimeMax = 115;
}
if (this.armor[l].type == 749)
{
this.wingTimeMax = 130;
}
if (this.armor[l].type == 761)
{
this.wingTimeMax = 130;
}
if (this.armor[l].type == 785)
{
this.wingTimeMax = 140;
}
if (this.armor[l].type == 786)
{
this.wingTimeMax = 140;
}
if (this.armor[l].type == 821)
{
this.wingTimeMax = 160;
}
if (this.armor[l].type == 822)
{
this.wingTimeMax = 160;
}
if (this.armor[l].type == 823)
{
this.wingTimeMax = 160;
}
if (this.armor[l].type == 2280)
{
this.wingTimeMax = 160;
}
if (this.armor[l].type == 2494)
{
this.wingTimeMax = 100;
}
if (this.armor[l].type == 2609)
{
this.wingTimeMax = 180;
this.ignoreWater = true;
}
if (this.armor[l].type == 948)
{
this.wingTimeMax = 180;
}
if (this.armor[l].type == 1162)
{
this.wingTimeMax = 160;
}
if (this.armor[l].type == 1165)
{
this.wingTimeMax = 140;
}
if (this.armor[l].type == 1515)
{
this.wingTimeMax = 130;
}
if (this.armor[l].type == 665)
{
this.wingTimeMax = 150;
}
if (this.armor[l].type == 1583)
{
this.wingTimeMax = 150;
}
if (this.armor[l].type == 1584)
{
this.wingTimeMax = 150;
}
if (this.armor[l].type == 1585)
{
this.wingTimeMax = 150;
}
if (this.armor[l].type == 1586)
{
this.wingTimeMax = 150;
}
if (this.armor[l].type == 3228)
{
this.wingTimeMax = 150;
}
if (this.armor[l].type == 3580)
{
this.wingTimeMax = 150;
}
if (this.armor[l].type == 3582)
{
this.wingTimeMax = 150;
}
if (this.armor[l].type == 3588)
{
this.wingTimeMax = 150;
}
if (this.armor[l].type == 3592)
{
this.wingTimeMax = 150;
}
if (this.armor[l].type == 1797)
{
this.wingTimeMax = 180;
}
if (this.armor[l].type == 1830)
{
this.wingTimeMax = 180;
}
if (this.armor[l].type == 1866)
{
this.wingTimeMax = 170;
}
if (this.armor[l].type == 1871)
{
this.wingTimeMax = 170;
}
if (this.armor[l].type == 2770)
{
this.wingTimeMax = 160;
}
if (this.armor[l].type == 3468)
{
this.wingTimeMax = 180;
}
if (this.armor[l].type == 3469)
{
this.wingTimeMax = 160;
}
if (this.armor[l].type == 3470)
{
this.wingTimeMax = 180;
}
if (this.armor[l].type == 3471)
{
this.wingTimeMax = 220;
}
if (this.armor[l].type == 885)
{
this.buffImmune[30] = true;
}
if (this.armor[l].type == 886)
{
this.buffImmune[36] = true;
}
if (this.armor[l].type == 887)
{
this.buffImmune[20] = true;
}
if (this.armor[l].type == 888)
{
this.buffImmune[22] = true;
}
if (this.armor[l].type == 889)
{
this.buffImmune[32] = true;
}
if (this.armor[l].type == 890)
{
this.buffImmune[35] = true;
}
if (this.armor[l].type == 891)
{
this.buffImmune[23] = true;
}
if (this.armor[l].type == 892)
{
this.buffImmune[33] = true;
}
if (this.armor[l].type == 893)
{
this.buffImmune[31] = true;
}
if (this.armor[l].type == 901)
{
this.buffImmune[33] = true;
this.buffImmune[36] = true;
}
if (this.armor[l].type == 902)
{
this.buffImmune[30] = true;
this.buffImmune[20] = true;
}
if (this.armor[l].type == 903)
{
this.buffImmune[32] = true;
this.buffImmune[31] = true;
}
if (this.armor[l].type == 904)
{
this.buffImmune[35] = true;
this.buffImmune[23] = true;
}
if (this.armor[l].type == 1921)
{
this.buffImmune[46] = true;
this.buffImmune[47] = true;
}
if (this.armor[l].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[l].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[l].type == 497)
{
this.accMerman = true;
}
if (this.armor[l].type == 535)
{
this.pStone = true;
}
if (this.armor[l].type == 536)
{
this.kbGlove = true;
}
if (this.armor[l].type == 532)
{
this.starCloak = true;
}
if (this.armor[l].type == 554)
{
this.longInvince = true;
}
if (this.armor[l].type == 555)
{
this.manaFlower = true;
this.manaCost -= 0.08f;
}
if (Main.myPlayer == this.whoAmI)
{
if (this.armor[l].type == 576 && Main.rand.Next(10800) == 0 && Main.curMusic > 0 && Main.curMusic <= 39)
{
int num6 = 0;
if (Main.curMusic == 1)
{
num6 = 0;
}
if (Main.curMusic == 2)
{
num6 = 1;
}
if (Main.curMusic == 3)
{
num6 = 2;
}
if (Main.curMusic == 4)
{
num6 = 4;
}
if (Main.curMusic == 5)
{
num6 = 5;
}
if (Main.curMusic == 6)
{
num6 = 3;
}
if (Main.curMusic == 7)
{
num6 = 6;
}
if (Main.curMusic == 8)
{
num6 = 7;
}
if (Main.curMusic == 9)
{
num6 = 9;
}
if (Main.curMusic == 10)
{
num6 = 8;
}
if (Main.curMusic == 11)
{
num6 = 11;
}
if (Main.curMusic == 12)
{
num6 = 10;
}
if (Main.curMusic == 13)
{
num6 = 12;
}
if (Main.curMusic == 28)
{
this.armor[l].SetDefaults(1963, false);
}
else if (Main.curMusic == 29)
{
this.armor[l].SetDefaults(1610, false);
}
else if (Main.curMusic == 30)
{
this.armor[l].SetDefaults(1963, false);
}
else if (Main.curMusic == 31)
{
this.armor[l].SetDefaults(1964, false);
}
else if (Main.curMusic == 32)
{
this.armor[l].SetDefaults(1965, false);
}
else if (Main.curMusic == 33)
{
this.armor[l].SetDefaults(2742, false);
}
else if (Main.curMusic == 34)
{
this.armor[l].SetDefaults(3370, false);
}
else if (Main.curMusic == 35)
{
this.armor[l].SetDefaults(3236, false);
}
else if (Main.curMusic == 36)
{
this.armor[l].SetDefaults(3237, false);
}
else if (Main.curMusic == 37)
{
this.armor[l].SetDefaults(3235, false);
}
else if (Main.curMusic == 38)
{
this.armor[l].SetDefaults(3044, false);
}
else if (Main.curMusic == 39)
{
this.armor[l].SetDefaults(3371, false);
}
else if (Main.curMusic > 13)
{
this.armor[l].SetDefaults(1596 + Main.curMusic - 14, false);
}
else
{
this.armor[l].SetDefaults(num6 + 562, false);
}
}
if (this.armor[l].type >= 562 && this.armor[l].type <= 574)
{
Main.musicBox2 = this.armor[l].type - 562;
}
if (this.armor[l].type >= 1596 && this.armor[l].type <= 1609)
{
Main.musicBox2 = this.armor[l].type - 1596 + 13;
}
if (this.armor[l].type == 1610)
{
Main.musicBox2 = 27;
}
if (this.armor[l].type == 1963)
{
Main.musicBox2 = 28;
}
if (this.armor[l].type == 1964)
{
Main.musicBox2 = 29;
}
if (this.armor[l].type == 1965)
{
Main.musicBox2 = 30;
}
if (this.armor[l].type == 2742)
{
Main.musicBox2 = 31;
}
if (this.armor[l].type == 3044)
{
Main.musicBox2 = 32;
}
if (this.armor[l].type == 3235)
{
Main.musicBox2 = 33;
}
if (this.armor[l].type == 3236)
{
Main.musicBox2 = 34;
}
if (this.armor[l].type == 3237)
{
Main.musicBox2 = 35;
}
if (this.armor[l].type == 3370)
{
Main.musicBox2 = 36;
}
if (this.armor[l].type == 3371)
{
Main.musicBox2 = 37;
}
}
}
}
for (int m = 3; m < 8 + this.extraAccessorySlots; m++)
{
if (this.armor[m].wingSlot > 0)
{
if (!this.hideVisual[m] || (this.velocity.Y != 0f && !this.mount.Active))
{
this.wings = (int)this.armor[m].wingSlot;
}
this.wingsLogic = (int)this.armor[m].wingSlot;
}
}
for (int n = 13; n < 18 + this.extraAccessorySlots; n++)
{
if (this.armor[n].wingSlot > 0)
{
this.wings = (int)this.armor[n].wingSlot;
}
}
if (this.whoAmI == Main.myPlayer && Main.clock && this.accWatch < 3)
{
this.accWatch++;
}
if (flag2)
{
this.tileSpeed += 0.5f;
}
if (flag)
{
this.wallSpeed += 0.5f;
}
if (flag3 && this.whoAmI == Main.myPlayer)
{
Player.tileRangeX += 3;
Player.tileRangeY += 2;
}
if (!this.accThirdEye)
{
this.accThirdEyeCounter = 0;
}
if (Main.netMode == 1 && this.whoAmI == Main.myPlayer)
{
for (int num7 = 0; num7 < 255; num7++)
{
if (num7 != this.whoAmI && Main.player[num7].active && !Main.player[num7].dead && Main.player[num7].team == this.team && Main.player[num7].team != 0)
{
int num8 = 800;
if ((Main.player[num7].Center - base.Center).Length() < (float)num8)
{
if (Main.player[num7].accWatch > this.accWatch)
{
this.accWatch = Main.player[num7].accWatch;
}
if (Main.player[num7].accCompass > this.accCompass)
{
this.accCompass = Main.player[num7].accCompass;
}
if (Main.player[num7].accDepthMeter > this.accDepthMeter)
{
this.accDepthMeter = Main.player[num7].accDepthMeter;
}
if (Main.player[num7].accFishFinder)
{
this.accFishFinder = true;
}
if (Main.player[num7].accWeatherRadio)
{
this.accWeatherRadio = true;
}
if (Main.player[num7].accThirdEye)
{
this.accThirdEye = true;
}
if (Main.player[num7].accJarOfSouls)
{
this.accJarOfSouls = true;
}
if (Main.player[num7].accCalendar)
{
this.accCalendar = true;
}
if (Main.player[num7].accStopwatch)
{
this.accStopwatch = true;
}
if (Main.player[num7].accOreFinder)
{
this.accOreFinder = true;
}
if (Main.player[num7].accCritterGuide)
{
this.accCritterGuide = true;
}
if (Main.player[num7].accDreamCatcher)
{
this.accDreamCatcher = true;
}
}
}
}
}
if (!this.accDreamCatcher && this.dpsStarted)
{
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 = Lang.setBonus(31, false);
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 = Lang.setBonus(20, false);
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 = Lang.setBonus(0, false);
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 = Lang.setBonus(1, false);
this.statDefense += 3;
}
if (this.head == 188 && this.body == 189 && this.legs == 129)
{
this.setBonus = Lang.setBonus(42, false);
this.thrownCost50 = true;
}
if (this.head == 50 && this.body == 31 && this.legs == 30)
{
this.setBonus = Lang.setBonus(32, false);
this.statDefense += 4;
}
if (this.head == 112 && this.body == 75 && this.legs == 64)
{
this.setBonus = Lang.setBonus(33, false);
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 = Lang.setBonus(41, false);
}
if (this.head == 157 && this.body == 105 && this.legs == 98)
{
int num = 0;
this.setBonus = Lang.setBonus(38, false);
this.beetleOffense = true;
this.beetleCounter -= 3f;
this.beetleCounter -= (float)(this.beetleCountdown / 10);
this.beetleCountdown++;
if (this.beetleCounter < 0f)
{
this.beetleCounter = 0f;
}
int num2 = 400;
int num3 = 1200;
int num4 = 4600;
if (this.beetleCounter > (float)(num2 + num3 + num4 + num3))
{
this.beetleCounter = (float)(num2 + num3 + num4 + num3);
}
if (this.beetleCounter > (float)(num2 + num3 + num4))
{
this.AddBuff(100, 5, false);
num = 3;
}
else if (this.beetleCounter > (float)(num2 + num3))
{
this.AddBuff(99, 5, false);
num = 2;
}
else if (this.beetleCounter > (float)num2)
{
this.AddBuff(98, 5, false);
num = 1;
}
if (num < this.beetleOrbs)
{
this.beetleCountdown = 0;
}
else if (num > this.beetleOrbs)
{
this.beetleCounter += 200f;
}
if (num != this.beetleOrbs && this.beetleOrbs > 0)
{
for (int j = 0; j < 22; j++)
{
if (this.buffType[j] >= 98 && this.buffType[j] <= 100 && this.buffType[j] != 97 + num)
{
this.DelBuff(j);
}
}
}
}
else if (this.head == 157 && this.body == 106 && this.legs == 98)
{
this.setBonus = Lang.setBonus(37, false);
this.beetleDefense = true;
this.beetleCounter += 1f;
int num5 = 180;
if (this.beetleCounter >= (float)num5)
{
if (this.beetleOrbs > 0 && this.beetleOrbs < 3)
{
for (int k = 0; k < 22; k++)
{
if (this.buffType[k] >= 95 && this.buffType[k] <= 96)
{
this.DelBuff(k);
}
}
}
if (this.beetleOrbs < 3)
{
this.AddBuff(95 + this.beetleOrbs, 5, false);
this.beetleCounter = 0f;
}
else
{
this.beetleCounter = (float)num5;
}
}
}
if (!this.beetleDefense && !this.beetleOffense)
{
this.beetleCounter = 0f;
}
else
{
this.beetleFrameCounter++;
if (this.beetleFrameCounter >= 1)
{
this.beetleFrameCounter = 0;
this.beetleFrame++;
if (this.beetleFrame > 2)
{
this.beetleFrame = 0;
}
}
for (int l = this.beetleOrbs; l < 3; l++)
{
this.beetlePos[l].X = 0f;
this.beetlePos[l].Y = 0f;
}
for (int m = 0; m < this.beetleOrbs; m++)
{
this.beetlePos[m] += this.beetleVel[m];
Vector2[] expr_6EC_cp_0 = this.beetleVel;
int expr_6EC_cp_1 = m;
expr_6EC_cp_0[expr_6EC_cp_1].X = expr_6EC_cp_0[expr_6EC_cp_1].X + (float)Main.rand.Next(-100, 101) * 0.005f;
Vector2[] expr_71A_cp_0 = this.beetleVel;
int expr_71A_cp_1 = m;
expr_71A_cp_0[expr_71A_cp_1].Y = expr_71A_cp_0[expr_71A_cp_1].Y + (float)Main.rand.Next(-100, 101) * 0.005f;
float num6 = this.beetlePos[m].X;
float num7 = this.beetlePos[m].Y;
float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7));
if (num8 > 100f)
{
num8 = 20f / num8;
num6 *= -num8;
num7 *= -num8;
int num9 = 10;
this.beetleVel[m].X = (this.beetleVel[m].X * (float)(num9 - 1) + num6) / (float)num9;
this.beetleVel[m].Y = (this.beetleVel[m].Y * (float)(num9 - 1) + num7) / (float)num9;
}
else if (num8 > 30f)
{
num8 = 10f / num8;
num6 *= -num8;
num7 *= -num8;
int num10 = 20;
this.beetleVel[m].X = (this.beetleVel[m].X * (float)(num10 - 1) + num6) / (float)num10;
this.beetleVel[m].Y = (this.beetleVel[m].Y * (float)(num10 - 1) + num7) / (float)num10;
}
num6 = this.beetleVel[m].X;
num7 = this.beetleVel[m].Y;
num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7));
if (num8 > 2f)
{
this.beetleVel[m] *= 0.9f;
}
this.beetlePos[m] -= this.velocity * 0.25f;
}
}
if (this.head == 14 && ((this.body >= 58 && this.body <= 63) || this.body == 167))
{
this.setBonus = Lang.setBonus(28, false);
this.magicCrit += 10;
}
if (this.head == 159 && ((this.body >= 58 && this.body <= 63) || this.body == 167))
{
this.setBonus = Lang.setBonus(36, false);
this.statManaMax2 += 60;
}
if ((this.head == 5 || this.head == 74) && (this.body == 5 || this.body == 48) && (this.legs == 5 || this.legs == 44))
{
this.setBonus = Lang.setBonus(2, false);
this.moveSpeed += 0.15f;
}
if (this.head == 57 && this.body == 37 && this.legs == 35)
{
this.setBonus = Lang.setBonus(21, false);
this.crimsonRegen = true;
}
if (this.head == 101 && this.body == 66 && this.legs == 55)
{
this.setBonus = Lang.setBonus(30, false);
this.ghostHeal = true;
}
if (this.head == 156 && this.body == 66 && this.legs == 55)
{
this.setBonus = Lang.setBonus(35, false);
this.ghostHurt = true;
}
if (this.head == 6 && this.body == 6 && this.legs == 6)
{
this.setBonus = Lang.setBonus(3, false);
this.spaceGun = true;
}
if (this.head == 46 && this.body == 27 && this.legs == 26)
{
this.frostArmor = true;
this.setBonus = Lang.setBonus(22, false);
this.frostBurn = true;
}
if ((this.head == 75 || this.head == 7) && this.body == 7 && this.legs == 7)
{
this.boneArmor = true;
this.setBonus = Lang.setBonus(4, false);
this.ammoCost80 = true;
}
if ((this.head == 76 || this.head == 8) && (this.body == 49 || this.body == 8) && (this.legs == 45 || this.legs == 8))
{
this.setBonus = Lang.setBonus(5, false);
this.manaCost -= 0.16f;
}
if (this.head == 9 && this.body == 9 && this.legs == 9)
{
this.setBonus = Lang.setBonus(6, false);
this.meleeDamage += 0.17f;
}
if (this.head == 11 && this.body == 20 && this.legs == 19)
{
this.setBonus = Lang.setBonus(7, false);
this.pickSpeed -= 0.3f;
}
if ((this.head == 78 || this.head == 79 || this.head == 80) && this.body == 51 && this.legs == 47)
{
this.setBonus = Lang.setBonus(27, false);
this.AddBuff(60, 18000, true);
}
else if (this.crystalLeaf)
{
for (int n = 0; n < 22; n++)
{
if (this.buffType[n] == 60)
{
this.DelBuff(n);
}
}
}
if (this.head == 99 && this.body == 65 && this.legs == 54)
{
this.setBonus = Lang.setBonus(29, false);
this.thorns = 1f;
this.turtleThorns = true;
}
if (this.body == 17 && this.legs == 16)
{
if (this.head == 29)
{
this.setBonus = Lang.setBonus(8, false);
this.manaCost -= 0.14f;
}
else if (this.head == 30)
{
this.setBonus = Lang.setBonus(9, false);
this.meleeSpeed += 0.15f;
}
else if (this.head == 31)
{
this.setBonus = Lang.setBonus(10, false);
this.ammoCost80 = true;
}
}
if (this.body == 18 && this.legs == 17)
{
if (this.head == 32)
{
this.setBonus = Lang.setBonus(11, false);
this.manaCost -= 0.17f;
}
else if (this.head == 33)
{
this.setBonus = Lang.setBonus(12, false);
this.meleeCrit += 5;
}
else if (this.head == 34)
{
this.setBonus = Lang.setBonus(13, false);
this.ammoCost80 = true;
}
}
if (this.body == 19 && this.legs == 18)
{
if (this.head == 35)
{
this.setBonus = Lang.setBonus(14, false);
this.manaCost -= 0.19f;
}
else if (this.head == 36)
{
this.setBonus = Lang.setBonus(15, false);
this.meleeSpeed += 0.18f;
this.moveSpeed += 0.18f;
}
else if (this.head == 37)
{
this.setBonus = Lang.setBonus(16, false);
this.ammoCost75 = true;
}
}
if (this.body == 54 && this.legs == 49 && (this.head == 83 || this.head == 84 || this.head == 85))
{
this.setBonus = Lang.setBonus(24, false);
this.onHitRegen = true;
}
if (this.body == 55 && this.legs == 50 && (this.head == 86 || this.head == 87 || this.head == 88))
{
this.setBonus = Lang.setBonus(25, false);
this.onHitPetal = true;
}
if (this.body == 56 && this.legs == 51 && (this.head == 89 || this.head == 90 || this.head == 91))
{
this.setBonus = Lang.setBonus(26, false);
this.onHitDodge = true;
}
if (this.body == 24 && this.legs == 23)
{
if (this.head == 42)
{
this.setBonus = Lang.setBonus(17, false);
this.manaCost -= 0.2f;
}
else if (this.head == 43)
{
this.setBonus = Lang.setBonus(18, false);
this.meleeSpeed += 0.19f;
this.moveSpeed += 0.19f;
}
else if (this.head == 41)
{
this.setBonus = Lang.setBonus(19, false);
this.ammoCost75 = true;
}
}
if (this.head == 82 && this.body == 53 && this.legs == 48)
{
this.setBonus = Lang.setBonus(23, false);
this.maxMinions++;
}
if (this.head == 134 && this.body == 95 && this.legs == 79)
{
this.setBonus = Lang.setBonus(34, false);
this.minionDamage += 0.25f;
}
if (this.head == 160 && this.body == 168 && this.legs == 103)
{
this.setBonus = Lang.setBonus(39, false);
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 = Lang.setBonus(40, false);
this.minionDamage += 0.12f;
}
if (this.head == 171 && this.body == 177 && this.legs == 112)
{
this.setSolar = true;
this.setBonus = Lang.setBonus(43, false);
this.solarCounter++;
int num11 = 240;
if (this.solarCounter >= num11)
{
if (this.solarShields > 0 && this.solarShields < 3)
{
for (int num12 = 0; num12 < 22; num12++)
{
if (this.buffType[num12] >= 170 && this.buffType[num12] <= 171)
{
this.DelBuff(num12);
}
}
}
if (this.solarShields < 3)
{
this.AddBuff(170 + this.solarShields, 5, false);
for (int num13 = 0; num13 < 16; num13++)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 6, 0f, 0f, 100, default(Color), 1f)];
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 = num11;
}
}
for (int num14 = this.solarShields; num14 < 3; num14++)
{
this.solarShieldPos[num14] = Vector2.Zero;
}
for (int num15 = 0; num15 < this.solarShields; num15++)
{
this.solarShieldPos[num15] += this.solarShieldVel[num15];
Vector2 value = ((float)this.miscCounter / 100f * 6.28318548f + (float)num15 * (6.28318548f / (float)this.solarShields)).ToRotationVector2() * 6f;
value.X = (float)(this.direction * 20);
this.solarShieldVel[num15] = (value - this.solarShieldPos[num15]) * 0.2f;
}
if (this.dashDelay >= 0)
{
this.solarDashing = false;
}
bool flag = this.solarDashing && this.dashDelay < 0;
if (this.solarShields > 0 || flag)
{
this.dash = 3;
}
}
else
{
this.solarCounter = 0;
}
if (this.head == 169 && this.body == 175 && this.legs == 110)
{
this.setVortex = true;
this.setBonus = Lang.setBonus(44, false);
}
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 = Lang.setBonus(45, false);
}
if (this.head == 189 && this.body == 190 && this.legs == 130)
{
this.setBonus = Lang.setBonus(46, false);
this.setStardust = true;
if (this.whoAmI == Main.myPlayer)
{
if (this.HasBuff(187) == -1)
{
this.AddBuff(187, 3600, true);
}
if (this.ownedProjectileCounts[623] < 1)
{
Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, -1f, 623, 0, 0f, Main.myPlayer, 0f, 0f);
return;
}
}
}
else if (this.HasBuff(187) != -1)
{
this.DelBuff(this.HasBuff(187));
}
}
public void UpdateSocialShadow()
{
for (int i = 2; i > 0; i--)
{
this.shadowDirection[i] = this.shadowDirection[i - 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];
return;
}
if (this.shadowCount == 2)
{
this.shadowPos[1] = this.shadowPos[0];
this.shadowRotation[1] = this.shadowRotation[0];
this.shadowOrigin[1] = this.shadowOrigin[0];
return;
}
if (this.shadowCount >= 3)
{
this.shadowCount = 0;
this.shadowPos[0] = this.position;
Vector2[] expr_129_cp_0 = this.shadowPos;
int expr_129_cp_1 = 0;
expr_129_cp_0[expr_129_cp_1].Y = expr_129_cp_0[expr_129_cp_1].Y + this.gfxOffY;
this.shadowRotation[0] = this.fullRotation;
this.shadowOrigin[0] = this.fullRotationOrigin;
}
}
public void UpdateTeleportVisuals()
{
if (this.teleportTime > 0f)
{
if (this.teleportStyle == 0)
{
if ((float)Main.rand.Next(100) <= 100f * this.teleportTime * 2f)
{
int num = Dust.NewDust(new Vector2((float)this.getRect().X, (float)this.getRect().Y), this.getRect().Width, this.getRect().Height, 159, 0f, 0f, 0, default(Color), 1f);
Main.dust[num].scale = this.teleportTime * 1.5f;
Main.dust[num].noGravity = true;
Main.dust[num].velocity *= 1.1f;
}
}
else if (this.teleportStyle == 1)
{
if ((float)Main.rand.Next(100) <= 100f * this.teleportTime)
{
int num2 = Dust.NewDust(new Vector2((float)this.getRect().X, (float)this.getRect().Y), this.getRect().Width, this.getRect().Height, 164, 0f, 0f, 0, default(Color), 1f);
Main.dust[num2].scale = this.teleportTime * 1.5f;
Main.dust[num2].noGravity = true;
Main.dust[num2].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 ((float)Main.rand.Next(100) <= 100f * this.teleportTime)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 263, 0f, 0f, 0, default(Color), 1f)];
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()
{
this.ZoneDungeon = false;
if (Main.dungeonTiles >= 250 && (double)this.position.Y > Main.worldSurface * 16.0)
{
int num = (int)this.position.X / 16;
int num2 = (int)this.position.Y / 16;
if (Main.wallDungeon[(int)Main.tile[num, num2].wall])
{
this.ZoneDungeon = true;
}
}
if (Main.sandTiles > 1000 && this.position.Y > 3200f)
{
Point point = base.Center.ToTileCoordinates();
Tile tileSafely = Framing.GetTileSafely(point.X, point.Y);
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.ZoneTowerSolar = (this.ZoneTowerVortex = (this.ZoneTowerNebula = (this.ZoneTowerStardust = false)));
Vector2 value = Vector2.Zero;
Vector2 value2 = Vector2.Zero;
Vector2 value3 = Vector2.Zero;
Vector2 value4 = Vector2.Zero;
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].active)
{
if (Main.npc[i].type == 493)
{
if (base.Distance(Main.npc[i].Center) <= 4000f)
{
this.ZoneTowerStardust = true;
value4 = Main.npc[i].Center;
}
}
else if (Main.npc[i].type == 507)
{
if (base.Distance(Main.npc[i].Center) <= 4000f)
{
this.ZoneTowerNebula = true;
value3 = Main.npc[i].Center;
}
}
else if (Main.npc[i].type == 422)
{
if (base.Distance(Main.npc[i].Center) <= 4000f)
{
this.ZoneTowerVortex = true;
value2 = Main.npc[i].Center;
}
}
else if (Main.npc[i].type == 517 && base.Distance(Main.npc[i].Center) <= 4000f)
{
this.ZoneTowerSolar = true;
value = Main.npc[i].Center;
}
}
}
this.ManageSpecialBiomeVisuals("Stardust", this.ZoneTowerStardust, value4 - new Vector2(0f, 10f));
this.ManageSpecialBiomeVisuals("Nebula", this.ZoneTowerNebula, value3 - new Vector2(0f, 10f));
this.ManageSpecialBiomeVisuals("Vortex", this.ZoneTowerVortex, value2 - new Vector2(0f, 10f));
this.ManageSpecialBiomeVisuals("Solar", this.ZoneTowerSolar, value - new Vector2(0f, 10f));
this.ManageSpecialBiomeVisuals("MoonLord", NPC.AnyNPCs(398), default(Vector2));
this.ManageSpecialBiomeVisuals("BloodMoon", Main.bloodMoon, default(Vector2));
Point point2 = base.Center.ToTileCoordinates();
if (WorldGen.InWorld(point2.X, point2.Y, 1))
{
int num3 = 0;
if (Main.tile[point2.X, point2.Y] != null)
{
num3 = (int)Main.tile[point2.X, point2.Y].wall;
}
int num4 = num3;
if (num4 != 62)
{
if (num4 == 86)
{
AchievementsHelper.HandleSpecialEvent(this, 12);
}
}
else
{
AchievementsHelper.HandleSpecialEvent(this, 13);
}
}
if (this.position.Y / 16f > (float)(Main.maxTilesY - 200))
{
AchievementsHelper.HandleSpecialEvent(this, 14);
return;
}
if ((double)(this.position.Y / 16f) < Main.worldSurface && Main.shroomTiles >= 200)
{
AchievementsHelper.HandleSpecialEvent(this, 15);
}
}
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, new object[0]);
}
else
{
SkyManager.Instance.Deactivate(biomeName, new object[0]);
}
}
if (inZone == Filters.Scene[biomeName].IsActive())
{
if (inZone)
{
Filters.Scene[biomeName].TargetPosition = activationSource;
}
return;
}
if (inZone)
{
Filters.Scene.Activate(biomeName, activationSource, new object[0]);
return;
}
Filters.Scene[biomeName].Deactivate(new object[0]);
}
public void UpdateDead()
{
this._portalPhysicsTime = 0;
this.MountFishronSpecialCounter = 0f;
this.gem = -1;
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 = 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.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.gravDir = 1f;
for (int i = 0; i < 22; i++)
{
if (this.buffType[i] <= 0 || !Main.persistentBuff[this.buffType[i]])
{
this.buffTime[i] = 0;
this.buffType[i] = 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 > 255)
{
this.immuneAlpha = 255;
}
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 = this.headVelocity.Y + 0.1f;
this.bodyVelocity.Y = this.bodyVelocity.Y + 0.1f;
this.legVelocity.Y = this.legVelocity.Y + 0.1f;
this.headVelocity.X = this.headVelocity.X * 0.99f;
this.bodyVelocity.X = this.bodyVelocity.X * 0.99f;
this.legVelocity.X = this.legVelocity.X * 0.99f;
for (int j = 0; j < this.npcTypeNoAggro.Length; j++)
{
this.npcTypeNoAggro[j] = false;
}
if (this.difficulty == 2)
{
if (this.respawnTimer > 0)
{
this.respawnTimer--;
return;
}
if (this.whoAmI == Main.myPlayer || Main.netMode == 2)
{
this.ghost = true;
return;
}
}
else
{
this.respawnTimer--;
if (this.respawnTimer <= 0 && Main.myPlayer == this.whoAmI)
{
if (Main.mouseItem.type > 0)
{
Main.playerInventory = true;
}
this.Spawn();
}
}
}
public void UpdatePet(int i)
{
if (i != Main.myPlayer)
{
return;
}
if (this.miscEquips[0].buffType < 1 || this.miscEquips[0].stack < 1)
{
return;
}
int num = this.miscEquips[0].buffType;
if (!Main.vanityPet[num] && !Main.lightPet[num])
{
return;
}
if (this.hideMisc[0])
{
return;
}
if (this.miscEquips[0].type == 603 && !Main.cEd)
{
return;
}
int num2 = this.HasBuff(num);
if (num2 == -1)
{
this.AddBuff(num, 3600, true);
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, this.miscEquips[0].useSound);
}
}
public void UpdatePetLight(int i)
{
if (i != Main.myPlayer)
{
return;
}
if (this.miscEquips[1].buffType < 1 || this.miscEquips[1].stack < 1)
{
return;
}
int num = this.miscEquips[1].buffType;
if (!Main.vanityPet[num] && !Main.lightPet[num])
{
return;
}
if (this.hideMisc[1])
{
return;
}
if (this.miscEquips[1].type == 603 && !Main.cEd)
{
return;
}
int num2 = this.HasBuff(num);
if (num == 27 && num2 == -1)
{
num2 = this.HasBuff(102);
}
if (num == 27 && num2 == -1)
{
num2 = this.HasBuff(101);
}
if (num2 == -1)
{
if (num == 27)
{
num = Utils.SelectRandom<int>(Main.rand, new int[]
{
27,
102,
101
});
}
this.AddBuff(num, 3600, true);
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, this.miscEquips[1].useSound);
}
}
public void TogglePet()
{
this.hideMisc[0] = !this.hideMisc[0];
if (this.hideMisc[0])
{
this.ClearBuff(this.miscEquips[0].buffType);
}
}
public void ToggleLight()
{
this.hideMisc[1] = !this.hideMisc[1];
if (this.hideMisc[1])
{
this.ClearBuff(this.miscEquips[1].buffType);
if (this.miscEquips[1].buffType == 27)
{
this.ClearBuff(102);
this.ClearBuff(101);
}
}
}
public void SmartCursorLookup()
{
if (this.whoAmI != Main.myPlayer)
{
return;
}
Main.smartDigShowing = false;
if (!Main.smartDigEnabled)
{
return;
}
Item item = this.inventory[this.selectedItem];
Vector2 vector = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY);
if (this.gravDir == -1f)
{
vector.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
}
int num = Player.tileTargetX;
int num2 = Player.tileTargetY;
if (num < 10)
{
num = 10;
}
if (num > Main.maxTilesX - 10)
{
num = Main.maxTilesX - 10;
}
if (num2 < 10)
{
num2 = 10;
}
if (num2 > Main.maxTilesY - 10)
{
num2 = Main.maxTilesY - 10;
}
bool flag = false;
if (Main.tile[num, num2] == null)
{
return;
}
if (Main.tile[num, num2].active())
{
ushort type = Main.tile[num, num2].type;
if (type <= 132)
{
if (type <= 55)
{
if (type <= 21)
{
if (type != 4)
{
switch (type)
{
case 10:
case 11:
case 13:
break;
case 12:
goto IL_360;
default:
if (type != 21)
{
goto IL_360;
}
break;
}
}
}
else if (type <= 33)
{
if (type != 29 && type != 33)
{
goto IL_360;
}
}
else
{
switch (type)
{
case 49:
case 50:
break;
default:
if (type != 55)
{
goto IL_360;
}
break;
}
}
}
else if (type <= 88)
{
if (type != 79 && type != 85 && type != 88)
{
goto IL_360;
}
}
else if (type <= 104)
{
if (type != 97 && type != 104)
{
goto IL_360;
}
}
else if (type != 125 && type != 132)
{
goto IL_360;
}
}
else if (type <= 216)
{
if (type <= 144)
{
if (type != 136 && type != 139 && type != 144)
{
goto IL_360;
}
}
else if (type <= 209)
{
if (type != 174)
{
switch (type)
{
case 207:
case 209:
break;
case 208:
goto IL_360;
default:
goto IL_360;
}
}
}
else if (type != 212 && type != 216)
{
goto IL_360;
}
}
else if (type <= 314)
{
if (type <= 237)
{
if (type != 219 && type != 237)
{
goto IL_360;
}
}
else if (type != 287)
{
if (type != 314)
{
goto IL_360;
}
if (this.gravDir == 1f)
{
flag = true;
goto IL_360;
}
goto IL_360;
}
}
else if (type <= 354)
{
switch (type)
{
case 334:
case 335:
case 338:
break;
case 336:
case 337:
goto IL_360;
default:
if (type != 354)
{
goto IL_360;
}
break;
}
}
else
{
switch (type)
{
case 386:
case 387:
break;
default:
if (type != 411)
{
goto IL_360;
}
break;
}
}
flag = true;
}
IL_360:
int tileBoost = item.tileBoost;
int num3 = 0;
if (item.type == 1071 || item.type == 1543 || item.type == 1072 || item.type == 1544)
{
for (int i = 0; i < 58; i++)
{
if (this.inventory[i].stack > 0 && this.inventory[i].paint > 0)
{
num3 = (int)this.inventory[i].paint;
break;
}
}
}
int num4 = (int)(this.position.X / 16f) - Player.tileRangeX - tileBoost + 1;
int num5 = (int)((this.position.X + (float)this.width) / 16f) + Player.tileRangeX + tileBoost - 1;
int num6 = (int)(this.position.Y / 16f) - Player.tileRangeY - tileBoost + 1;
int num7 = (int)((this.position.Y + (float)this.height) / 16f) + Player.tileRangeY + tileBoost - 2;
if (num4 < 10)
{
num4 = 10;
}
if (num5 > Main.maxTilesX - 10)
{
num5 = Main.maxTilesX - 10;
}
if (num6 < 10)
{
num6 = 10;
}
if (num7 > Main.maxTilesY - 10)
{
num7 = Main.maxTilesY - 10;
}
if (flag && num >= num4 && num <= num5 && num2 >= num6 && num2 <= num7)
{
return;
}
List<Tuple<int, int>> list = new List<Tuple<int, int>>();
for (int j = 0; j < this.grapCount; j++)
{
Projectile projectile = Main.projectile[this.grappling[j]];
int item2 = (int)projectile.Center.X / 16;
int item3 = (int)projectile.Center.Y / 16;
list.Add(new Tuple<int, int>(item2, item3));
}
int num8 = -1;
int num9 = -1;
if (item.axe > 0 && num8 == -1 && num9 == -1)
{
float num10 = -1f;
for (int k = num4; k <= num5; k++)
{
for (int l = num6; l <= num7; l++)
{
if (Main.tile[k, l].active())
{
Tile tile = Main.tile[k, l];
if (Main.tileAxe[(int)tile.type])
{
int num11 = k;
int num12 = l;
if (tile.type == 5)
{
if (Collision.InTileBounds(num11 + 1, num12, num4, num6, num5, num7))
{
if (Main.tile[num11, num12].frameY >= 198 && Main.tile[num11, num12].frameX == 44)
{
num11++;
}
if (Main.tile[num11, num12].frameX == 66 && Main.tile[num11, num12].frameY <= 44)
{
num11++;
}
if (Main.tile[num11, num12].frameX == 44 && Main.tile[num11, num12].frameY >= 132 && Main.tile[num11, num12].frameY <= 176)
{
num11++;
}
}
if (Collision.InTileBounds(num11 - 1, num12, num4, num6, num5, num7))
{
if (Main.tile[num11, num12].frameY >= 198 && Main.tile[num11, num12].frameX == 66)
{
num11--;
}
if (Main.tile[num11, num12].frameX == 88 && Main.tile[num11, num12].frameY >= 66 && Main.tile[num11, num12].frameY <= 110)
{
num11--;
}
if (Main.tile[num11, num12].frameX == 22 && Main.tile[num11, num12].frameY >= 132 && Main.tile[num11, num12].frameY <= 176)
{
num11--;
}
}
while (Main.tile[num11, num12].active() && Main.tile[num11, num12].type == 5 && Main.tile[num11, num12 + 1].type == 5 && Collision.InTileBounds(num11, num12 + 1, num4, num6, num5, num7))
{
num12++;
}
}
if (tile.type == 80)
{
if (Collision.InTileBounds(num11 + 1, num12, num4, num6, num5, num7))
{
if (Main.tile[num11, num12].frameX == 54)
{
num11++;
}
if (Main.tile[num11, num12].frameX == 108 && Main.tile[num11, num12].frameY == 36)
{
num11++;
}
}
if (Collision.InTileBounds(num11 - 1, num12, num4, num6, num5, num7))
{
if (Main.tile[num11, num12].frameX == 36)
{
num11--;
}
if (Main.tile[num11, num12].frameX == 108 && Main.tile[num11, num12].frameY == 18)
{
num11--;
}
}
while (Main.tile[num11, num12].active() && Main.tile[num11, num12].type == 80 && Main.tile[num11, num12 + 1].type == 80 && Collision.InTileBounds(num11, num12 + 1, num4, num6, num5, num7))
{
num12++;
}
}
if (tile.type != 323)
{
if (tile.type != 72)
{
goto IL_9C6;
}
}
while (Main.tile[num11, num12].active() && ((Main.tile[num11, num12].type == 323 && Main.tile[num11, num12 + 1].type == 323) || (Main.tile[num11, num12].type == 72 && Main.tile[num11, num12 + 1].type == 72)) && Collision.InTileBounds(num11, num12 + 1, num4, num6, num5, num7))
{
num12++;
}
IL_9C6:
float num13 = Vector2.Distance(new Vector2((float)num11, (float)num12) * 16f + Vector2.One * 8f, vector);
if (num10 == -1f || num13 < num10)
{
num10 = num13;
num8 = num11;
num9 = num12;
}
}
}
}
}
}
if (item.pick > 0 && num8 == -1 && num9 == -1)
{
Vector2 vector2 = vector - base.Center;
int num14 = Math.Sign(vector2.X);
int num15 = Math.Sign(vector2.Y);
if (Math.Abs(vector2.X) > Math.Abs(vector2.Y) * 3f)
{
num15 = 0;
vector.Y = base.Center.Y;
}
if (Math.Abs(vector2.Y) > Math.Abs(vector2.X) * 3f)
{
num14 = 0;
vector.X = base.Center.X;
}
int arg_AEF_0 = (int)base.Center.X / 16;
int arg_AFF_0 = (int)base.Center.Y / 16;
List<Tuple<int, int>> list2 = new List<Tuple<int, int>>();
List<Tuple<int, int>> list3 = new List<Tuple<int, int>>();
int num16 = 1;
if (num15 == -1 && num14 != 0)
{
num16 = -1;
}
int num17 = (int)((this.position.X + (float)(this.width / 2) + (float)((this.width / 2 - 1) * num14)) / 16f);
int num18 = (int)(((double)this.position.Y + 0.1) / 16.0);
if (num16 == -1)
{
num18 = (int)((this.position.Y + (float)this.height - 1f) / 16f);
}
int num19 = this.width / 16 + ((this.width % 16 == 0) ? 0 : 1);
int num20 = this.height / 16 + ((this.height % 16 == 0) ? 0 : 1);
if (num14 != 0)
{
for (int m = 0; m < num20; m++)
{
if (Main.tile[num17, num18 + m * num16] == null)
{
return;
}
list2.Add(new Tuple<int, int>(num17, num18 + m * num16));
}
}
if (num15 != 0)
{
for (int n = 0; n < num19; n++)
{
if (Main.tile[(int)(this.position.X / 16f) + n, num18] == null)
{
return;
}
list2.Add(new Tuple<int, int>((int)(this.position.X / 16f) + n, num18));
}
}
int num21 = (int)((vector.X + (float)((this.width / 2 - 1) * num14)) / 16f);
int num22 = (int)(((double)vector.Y + 0.1 - (double)(this.height / 2 + 1)) / 16.0);
if (num16 == -1)
{
num22 = (int)((vector.Y + (float)(this.height / 2) - 1f) / 16f);
}
if (this.gravDir == -1f && num15 == 0)
{
num22++;
}
if (num22 < 10)
{
num22 = 10;
}
if (num22 > Main.maxTilesY - 10)
{
num22 = Main.maxTilesY - 10;
}
int num23 = this.width / 16 + ((this.width % 16 == 0) ? 0 : 1);
int num24 = this.height / 16 + ((this.height % 16 == 0) ? 0 : 1);
if (num14 != 0)
{
for (int num25 = 0; num25 < num24; num25++)
{
if (Main.tile[num21, num22 + num25 * num16] == null)
{
return;
}
list3.Add(new Tuple<int, int>(num21, num22 + num25 * num16));
}
}
if (num15 != 0)
{
for (int num26 = 0; num26 < num23; num26++)
{
if (Main.tile[(int)((vector.X - (float)(this.width / 2)) / 16f) + num26, num22] == null)
{
return;
}
list3.Add(new Tuple<int, int>((int)((vector.X - (float)(this.width / 2)) / 16f) + num26, num22));
}
}
List<Tuple<int, int>> list4 = new List<Tuple<int, int>>();
while (list2.Count > 0)
{
Tuple<int, int> tuple = list2[0];
Tuple<int, int> tuple2 = list3[0];
Tuple<int, int> tuple3;
if (!Collision.TupleHitLine(tuple.Item1, tuple.Item2, tuple2.Item1, tuple2.Item2, num14 * (int)this.gravDir, -num15 * (int)this.gravDir, list, out tuple3))
{
list2.Remove(tuple);
list3.Remove(tuple2);
}
else
{
if (tuple3.Item1 != tuple2.Item1 || tuple3.Item2 != tuple2.Item2)
{
list4.Add(tuple3);
}
Tile tile2 = Main.tile[tuple3.Item1, tuple3.Item2];
if (!tile2.inActive() && tile2.active() && Main.tileSolid[(int)tile2.type] && !Main.tileSolidTop[(int)tile2.type] && !list.Contains(tuple3))
{
list4.Add(tuple3);
}
list2.Remove(tuple);
list3.Remove(tuple2);
}
}
List<Tuple<int, int>> list5 = new List<Tuple<int, int>>();
for (int num27 = 0; num27 < list4.Count; num27++)
{
if (!WorldGen.CanKillTile(list4[num27].Item1, list4[num27].Item2))
{
list5.Add(list4[num27]);
}
}
for (int num28 = 0; num28 < list5.Count; num28++)
{
list4.Remove(list5[num28]);
}
list5.Clear();
if (list4.Count > 0)
{
float num29 = -1f;
Tuple<int, int> tuple4 = list4[0];
for (int num30 = 0; num30 < list4.Count; num30++)
{
float num31 = Vector2.Distance(new Vector2((float)list4[num30].Item1, (float)list4[num30].Item2) * 16f + Vector2.One * 8f, base.Center);
if (num29 == -1f || num31 < num29)
{
num29 = num31;
tuple4 = list4[num30];
}
}
if (Collision.InTileBounds(tuple4.Item1, tuple4.Item2, num4, num6, num5, num7))
{
num8 = tuple4.Item1;
num9 = tuple4.Item2;
}
}
list2.Clear();
list3.Clear();
list4.Clear();
}
if ((item.type == 509 || item.type == 850 || item.type == 851) && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list6 = new List<Tuple<int, int>>();
int num32 = 0;
if (item.type == 509)
{
num32 = 1;
}
if (item.type == 850)
{
num32 = 2;
}
if (item.type == 851)
{
num32 = 3;
}
bool flag2 = false;
if (Main.tile[num, num2].wire() && num32 == 1)
{
flag2 = true;
}
if (Main.tile[num, num2].wire2() && num32 == 2)
{
flag2 = true;
}
if (Main.tile[num, num2].wire3() && num32 == 3)
{
flag2 = true;
}
if (!flag2)
{
for (int num33 = num4; num33 <= num5; num33++)
{
for (int num34 = num6; num34 <= num7; num34++)
{
Tile tile3 = Main.tile[num33, num34];
if ((tile3.wire() && num32 == 1) || (tile3.wire2() && num32 == 2) || (tile3.wire3() && num32 == 3))
{
if (num32 == 1)
{
if (!Main.tile[num33 - 1, num34].wire())
{
list6.Add(new Tuple<int, int>(num33 - 1, num34));
}
if (!Main.tile[num33 + 1, num34].wire())
{
list6.Add(new Tuple<int, int>(num33 + 1, num34));
}
if (!Main.tile[num33, num34 - 1].wire())
{
list6.Add(new Tuple<int, int>(num33, num34 - 1));
}
if (!Main.tile[num33, num34 + 1].wire())
{
list6.Add(new Tuple<int, int>(num33, num34 + 1));
}
}
if (num32 == 2)
{
if (!Main.tile[num33 - 1, num34].wire2())
{
list6.Add(new Tuple<int, int>(num33 - 1, num34));
}
if (!Main.tile[num33 + 1, num34].wire2())
{
list6.Add(new Tuple<int, int>(num33 + 1, num34));
}
if (!Main.tile[num33, num34 - 1].wire2())
{
list6.Add(new Tuple<int, int>(num33, num34 - 1));
}
if (!Main.tile[num33, num34 + 1].wire2())
{
list6.Add(new Tuple<int, int>(num33, num34 + 1));
}
}
if (num32 == 3)
{
if (!Main.tile[num33 - 1, num34].wire3())
{
list6.Add(new Tuple<int, int>(num33 - 1, num34));
}
if (!Main.tile[num33 + 1, num34].wire3())
{
list6.Add(new Tuple<int, int>(num33 + 1, num34));
}
if (!Main.tile[num33, num34 - 1].wire3())
{
list6.Add(new Tuple<int, int>(num33, num34 - 1));
}
if (!Main.tile[num33, num34 + 1].wire3())
{
list6.Add(new Tuple<int, int>(num33, num34 + 1));
}
}
}
}
}
}
if (list6.Count > 0)
{
float num35 = -1f;
Tuple<int, int> tuple5 = list6[0];
for (int num36 = 0; num36 < list6.Count; num36++)
{
float num37 = Vector2.Distance(new Vector2((float)list6[num36].Item1, (float)list6[num36].Item2) * 16f + Vector2.One * 8f, vector);
if (num35 == -1f || num37 < num35)
{
num35 = num37;
tuple5 = list6[num36];
}
}
if (Collision.InTileBounds(tuple5.Item1, tuple5.Item2, num4, num6, num5, num7))
{
num8 = tuple5.Item1;
num9 = tuple5.Item2;
}
}
list6.Clear();
}
if (item.hammer > 0 && num8 == -1 && num9 == -1)
{
Vector2 vector3 = vector - base.Center;
int num38 = Math.Sign(vector3.X);
int num39 = Math.Sign(vector3.Y);
if (Math.Abs(vector3.X) > Math.Abs(vector3.Y) * 3f)
{
num39 = 0;
vector.Y = base.Center.Y;
}
if (Math.Abs(vector3.Y) > Math.Abs(vector3.X) * 3f)
{
num38 = 0;
vector.X = base.Center.X;
}
int arg_1540_0 = (int)base.Center.X / 16;
int arg_1550_0 = (int)base.Center.Y / 16;
List<Tuple<int, int>> list7 = new List<Tuple<int, int>>();
List<Tuple<int, int>> list8 = new List<Tuple<int, int>>();
int num40 = 1;
if (num39 == -1 && num38 != 0)
{
num40 = -1;
}
int num41 = (int)((this.position.X + (float)(this.width / 2) + (float)((this.width / 2 - 1) * num38)) / 16f);
int num42 = (int)(((double)this.position.Y + 0.1) / 16.0);
if (num40 == -1)
{
num42 = (int)((this.position.Y + (float)this.height - 1f) / 16f);
}
int num43 = this.width / 16 + ((this.width % 16 == 0) ? 0 : 1);
int num44 = this.height / 16 + ((this.height % 16 == 0) ? 0 : 1);
if (num38 != 0)
{
for (int num45 = 0; num45 < num44; num45++)
{
if (Main.tile[num41, num42 + num45 * num40] == null)
{
return;
}
list7.Add(new Tuple<int, int>(num41, num42 + num45 * num40));
}
}
if (num39 != 0)
{
for (int num46 = 0; num46 < num43; num46++)
{
if (Main.tile[(int)(this.position.X / 16f) + num46, num42] == null)
{
return;
}
list7.Add(new Tuple<int, int>((int)(this.position.X / 16f) + num46, num42));
}
}
int num47 = (int)((vector.X + (float)((this.width / 2 - 1) * num38)) / 16f);
int num48 = (int)(((double)vector.Y + 0.1 - (double)(this.height / 2 + 1)) / 16.0);
if (num40 == -1)
{
num48 = (int)((vector.Y + (float)(this.height / 2) - 1f) / 16f);
}
if (this.gravDir == -1f && num39 == 0)
{
num48++;
}
if (num48 < 10)
{
num48 = 10;
}
if (num48 > Main.maxTilesY - 10)
{
num48 = Main.maxTilesY - 10;
}
int num49 = this.width / 16 + ((this.width % 16 == 0) ? 0 : 1);
int num50 = this.height / 16 + ((this.height % 16 == 0) ? 0 : 1);
if (num38 != 0)
{
for (int num51 = 0; num51 < num50; num51++)
{
if (Main.tile[num47, num48 + num51 * num40] == null)
{
return;
}
list8.Add(new Tuple<int, int>(num47, num48 + num51 * num40));
}
}
if (num39 != 0)
{
for (int num52 = 0; num52 < num49; num52++)
{
if (Main.tile[(int)((vector.X - (float)(this.width / 2)) / 16f) + num52, num48] == null)
{
return;
}
list8.Add(new Tuple<int, int>((int)((vector.X - (float)(this.width / 2)) / 16f) + num52, num48));
}
}
List<Tuple<int, int>> list9 = new List<Tuple<int, int>>();
while (list7.Count > 0)
{
Tuple<int, int> tuple6 = list7[0];
Tuple<int, int> tuple7 = list8[0];
Tuple<int, int> tuple8 = Collision.TupleHitLineWall(tuple6.Item1, tuple6.Item2, tuple7.Item1, tuple7.Item2);
if (tuple8.Item1 == -1 || tuple8.Item2 == -1)
{
list7.Remove(tuple6);
list8.Remove(tuple7);
}
else
{
if (tuple8.Item1 != tuple7.Item1 || tuple8.Item2 != tuple7.Item2)
{
list9.Add(tuple8);
}
Main.tile[tuple8.Item1, tuple8.Item2];
if (Collision.HitWallSubstep(tuple8.Item1, tuple8.Item2))
{
list9.Add(tuple8);
}
list7.Remove(tuple6);
list8.Remove(tuple7);
}
}
if (list9.Count > 0)
{
float num53 = -1f;
Tuple<int, int> tuple9 = list9[0];
for (int num54 = 0; num54 < list9.Count; num54++)
{
float num55 = Vector2.Distance(new Vector2((float)list9[num54].Item1, (float)list9[num54].Item2) * 16f + Vector2.One * 8f, base.Center);
if (num53 == -1f || num55 < num53)
{
num53 = num55;
tuple9 = list9[num54];
}
}
if (Collision.InTileBounds(tuple9.Item1, tuple9.Item2, num4, num6, num5, num7))
{
this.poundRelease = false;
num8 = tuple9.Item1;
num9 = tuple9.Item2;
}
}
list9.Clear();
list7.Clear();
list8.Clear();
}
if (item.hammer > 0 && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list10 = new List<Tuple<int, int>>();
for (int num56 = num4; num56 <= num5; num56++)
{
for (int num57 = num6; num57 <= num7; num57++)
{
if (Main.tile[num56, num57].wall > 0 && Collision.HitWallSubstep(num56, num57))
{
list10.Add(new Tuple<int, int>(num56, num57));
}
}
}
if (list10.Count > 0)
{
float num58 = -1f;
Tuple<int, int> tuple10 = list10[0];
for (int num59 = 0; num59 < list10.Count; num59++)
{
float num60 = Vector2.Distance(new Vector2((float)list10[num59].Item1, (float)list10[num59].Item2) * 16f + Vector2.One * 8f, vector);
if (num58 == -1f || num60 < num58)
{
num58 = num60;
tuple10 = list10[num59];
}
}
if (Collision.InTileBounds(tuple10.Item1, tuple10.Item2, num4, num6, num5, num7))
{
this.poundRelease = false;
num8 = tuple10.Item1;
num9 = tuple10.Item2;
}
}
list10.Clear();
}
if (item.type == 510 && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list11 = new List<Tuple<int, int>>();
for (int num61 = num4; num61 <= num5; num61++)
{
for (int num62 = num6; num62 <= num7; num62++)
{
Tile tile4 = Main.tile[num61, num62];
if (tile4.wire() || tile4.wire2() || tile4.wire3())
{
list11.Add(new Tuple<int, int>(num61, num62));
}
}
}
if (list11.Count > 0)
{
float num63 = -1f;
Tuple<int, int> tuple11 = list11[0];
for (int num64 = 0; num64 < list11.Count; num64++)
{
float num65 = Vector2.Distance(new Vector2((float)list11[num64].Item1, (float)list11[num64].Item2) * 16f + Vector2.One * 8f, vector);
if (num63 == -1f || num65 < num63)
{
num63 = num65;
tuple11 = list11[num64];
}
}
if (Collision.InTileBounds(tuple11.Item1, tuple11.Item2, num4, num6, num5, num7))
{
num8 = tuple11.Item1;
num9 = tuple11.Item2;
}
}
list11.Clear();
}
if (item.createTile == 19 && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list12 = new List<Tuple<int, int>>();
bool flag3 = false;
if (Main.tile[num, num2].active() && Main.tile[num, num2].type == 19)
{
flag3 = true;
}
if (!flag3)
{
for (int num66 = num4; num66 <= num5; num66++)
{
for (int num67 = num6; num67 <= num7; num67++)
{
Tile tile5 = Main.tile[num66, num67];
if (tile5.active() && tile5.type == 19)
{
int num68 = (int)tile5.slope();
if (num68 != 2 && !Main.tile[num66 - 1, num67 - 1].active())
{
list12.Add(new Tuple<int, int>(num66 - 1, num67 - 1));
}
if (!Main.tile[num66 - 1, num67].active())
{
list12.Add(new Tuple<int, int>(num66 - 1, num67));
}
if (num68 != 1 && !Main.tile[num66 - 1, num67 + 1].active())
{
list12.Add(new Tuple<int, int>(num66 - 1, num67 + 1));
}
if (num68 != 1 && !Main.tile[num66 + 1, num67 - 1].active())
{
list12.Add(new Tuple<int, int>(num66 + 1, num67 - 1));
}
if (!Main.tile[num66 + 1, num67].active())
{
list12.Add(new Tuple<int, int>(num66 + 1, num67));
}
if (num68 != 2 && !Main.tile[num66 + 1, num67 + 1].active())
{
list12.Add(new Tuple<int, int>(num66 + 1, num67 + 1));
}
}
if (!tile5.active())
{
int num69 = 0;
int num70 = 1;
Tile tile6 = Main.tile[num66 + num69, num67 + num70];
if (tile6.active() && Main.tileSolid[(int)tile6.type] && !Main.tileSolidTop[(int)tile6.type])
{
list12.Add(new Tuple<int, int>(num66, num67));
}
num69 = -1;
num70 = 0;
tile6 = Main.tile[num66 + num69, num67 + num70];
if (tile6.active() && Main.tileSolid[(int)tile6.type] && !Main.tileSolidTop[(int)tile6.type])
{
list12.Add(new Tuple<int, int>(num66, num67));
}
num69 = 1;
num70 = 0;
tile6 = Main.tile[num66 + num69, num67 + num70];
if (tile6.active() && Main.tileSolid[(int)tile6.type] && !Main.tileSolidTop[(int)tile6.type])
{
list12.Add(new Tuple<int, int>(num66, num67));
}
}
}
}
}
if (list12.Count > 0)
{
float num71 = -1f;
Tuple<int, int> tuple12 = list12[0];
for (int num72 = 0; num72 < list12.Count; num72++)
{
float num73 = Vector2.Distance(new Vector2((float)list12[num72].Item1, (float)list12[num72].Item2) * 16f + Vector2.One * 8f, vector);
if (num71 == -1f || num73 < num71)
{
num71 = num73;
tuple12 = list12[num72];
}
}
if (Collision.InTileBounds(tuple12.Item1, tuple12.Item2, num4, num6, num5, num7))
{
num8 = tuple12.Item1;
num9 = tuple12.Item2;
}
}
list12.Clear();
}
if ((item.type == 2340 || item.type == 2739) && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list13 = new List<Tuple<int, int>>();
bool flag4 = false;
if (Main.tile[num, num2].active() && Main.tile[num, num2].type == 314)
{
flag4 = true;
}
if (!flag4)
{
for (int num74 = num4; num74 <= num5; num74++)
{
for (int num75 = num6; num75 <= num7; num75++)
{
Tile tile7 = Main.tile[num74, num75];
if (tile7.active() && tile7.type == 314)
{
bool flag5 = Main.tile[num74 + 1, num75 + 1].active() && Main.tile[num74 + 1, num75 + 1].type == 314;
bool flag6 = Main.tile[num74 + 1, num75 - 1].active() && Main.tile[num74 + 1, num75 - 1].type == 314;
bool flag7 = Main.tile[num74 - 1, num75 + 1].active() && Main.tile[num74 - 1, num75 + 1].type == 314;
bool flag8 = Main.tile[num74 - 1, num75 - 1].active() && Main.tile[num74 - 1, num75 - 1].type == 314;
if ((!Main.tile[num74 - 1, num75 - 1].active() || Main.tileCut[(int)Main.tile[num74 - 1, num75 - 1].type] || TileID.Sets.BreakableWhenPlacing[(int)Main.tile[num74 - 1, num75 - 1].type]) && (flag5 || !flag6))
{
list13.Add(new Tuple<int, int>(num74 - 1, num75 - 1));
}
if (!Main.tile[num74 - 1, num75].active() || Main.tileCut[(int)Main.tile[num74 - 1, num75].type] || TileID.Sets.BreakableWhenPlacing[(int)Main.tile[num74 - 1, num75].type])
{
list13.Add(new Tuple<int, int>(num74 - 1, num75));
}
if ((!Main.tile[num74 - 1, num75 + 1].active() || Main.tileCut[(int)Main.tile[num74 - 1, num75 + 1].type] || TileID.Sets.BreakableWhenPlacing[(int)Main.tile[num74 - 1, num75 + 1].type]) && (flag6 || !flag5))
{
list13.Add(new Tuple<int, int>(num74 - 1, num75 + 1));
}
if ((!Main.tile[num74 + 1, num75 - 1].active() || Main.tileCut[(int)Main.tile[num74 + 1, num75 - 1].type] || TileID.Sets.BreakableWhenPlacing[(int)Main.tile[num74 + 1, num75 - 1].type]) && (flag7 || !flag8))
{
list13.Add(new Tuple<int, int>(num74 + 1, num75 - 1));
}
if (!Main.tile[num74 + 1, num75].active() || Main.tileCut[(int)Main.tile[num74 + 1, num75].type] || TileID.Sets.BreakableWhenPlacing[(int)Main.tile[num74 + 1, num75].type])
{
list13.Add(new Tuple<int, int>(num74 + 1, num75));
}
if ((!Main.tile[num74 + 1, num75 + 1].active() || Main.tileCut[(int)Main.tile[num74 + 1, num75 + 1].type] || TileID.Sets.BreakableWhenPlacing[(int)Main.tile[num74 + 1, num75 + 1].type]) && (flag8 || !flag7))
{
list13.Add(new Tuple<int, int>(num74 + 1, num75 + 1));
}
}
}
}
}
if (list13.Count > 0)
{
float num76 = -1f;
Tuple<int, int> tuple13 = list13[0];
for (int num77 = 0; num77 < list13.Count; num77++)
{
if ((!Main.tile[list13[num77].Item1, list13[num77].Item2 - 1].active() || Main.tile[list13[num77].Item1, list13[num77].Item2 - 1].type != 314) && (!Main.tile[list13[num77].Item1, list13[num77].Item2 + 1].active() || Main.tile[list13[num77].Item1, list13[num77].Item2 + 1].type != 314))
{
float num78 = Vector2.Distance(new Vector2((float)list13[num77].Item1, (float)list13[num77].Item2) * 16f + Vector2.One * 8f, vector);
if (num76 == -1f || num78 < num76)
{
num76 = num78;
tuple13 = list13[num77];
}
}
}
if (Collision.InTileBounds(tuple13.Item1, tuple13.Item2, num4, num6, num5, num7) && num76 != -1f)
{
num8 = tuple13.Item1;
num9 = tuple13.Item2;
}
}
list13.Clear();
}
if (item.type == 2492 && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list14 = new List<Tuple<int, int>>();
bool flag9 = false;
if (Main.tile[num, num2].active() && Main.tile[num, num2].type == 314)
{
flag9 = true;
}
if (!flag9)
{
for (int num79 = num4; num79 <= num5; num79++)
{
for (int num80 = num6; num80 <= num7; num80++)
{
Tile tile8 = Main.tile[num79, num80];
if (tile8.active() && tile8.type == 314)
{
if (!Main.tile[num79 - 1, num80].active() || Main.tileCut[(int)Main.tile[num79 - 1, num80].type] || TileID.Sets.BreakableWhenPlacing[(int)Main.tile[num79 - 1, num80].type])
{
list14.Add(new Tuple<int, int>(num79 - 1, num80));
}
if (!Main.tile[num79 + 1, num80].active() || Main.tileCut[(int)Main.tile[num79 + 1, num80].type] || TileID.Sets.BreakableWhenPlacing[(int)Main.tile[num79 + 1, num80].type])
{
list14.Add(new Tuple<int, int>(num79 + 1, num80));
}
}
}
}
}
if (list14.Count > 0)
{
float num81 = -1f;
Tuple<int, int> tuple14 = list14[0];
for (int num82 = 0; num82 < list14.Count; num82++)
{
if ((!Main.tile[list14[num82].Item1, list14[num82].Item2 - 1].active() || Main.tile[list14[num82].Item1, list14[num82].Item2 - 1].type != 314) && (!Main.tile[list14[num82].Item1, list14[num82].Item2 + 1].active() || Main.tile[list14[num82].Item1, list14[num82].Item2 + 1].type != 314))
{
float num83 = Vector2.Distance(new Vector2((float)list14[num82].Item1, (float)list14[num82].Item2) * 16f + Vector2.One * 8f, vector);
if (num81 == -1f || num83 < num81)
{
num81 = num83;
tuple14 = list14[num82];
}
}
}
if (Collision.InTileBounds(tuple14.Item1, tuple14.Item2, num4, num6, num5, num7) && num81 != -1f)
{
num8 = tuple14.Item1;
num9 = tuple14.Item2;
}
}
list14.Clear();
}
if (item.createWall > 0 && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list15 = new List<Tuple<int, int>>();
for (int num84 = num4; num84 <= num5; num84++)
{
for (int num85 = num6; num85 <= num7; num85++)
{
Tile tile9 = Main.tile[num84, num85];
if (tile9.wall == 0 && (!tile9.active() || !Main.tileSolid[(int)tile9.type] || Main.tileSolidTop[(int)tile9.type]) && Collision.CanHitWithCheck(this.position, this.width, this.height, new Vector2((float)num84, (float)num85) * 16f, 16, 16, new Utils.PerLinePoint(DelegateMethods.NotDoorStand)))
{
bool flag10 = false;
if (Main.tile[num84 - 1, num85].active() || Main.tile[num84 - 1, num85].wall > 0)
{
flag10 = true;
}
if (Main.tile[num84 + 1, num85].active() || Main.tile[num84 + 1, num85].wall > 0)
{
flag10 = true;
}
if (Main.tile[num84, num85 - 1].active() || Main.tile[num84, num85 - 1].wall > 0)
{
flag10 = true;
}
if (Main.tile[num84, num85 + 1].active() || Main.tile[num84, num85 + 1].wall > 0)
{
flag10 = true;
}
if (Main.tile[num84, num85].active() && Main.tile[num84, num85].type == 11 && (Main.tile[num84, num85].frameX < 18 || Main.tile[num84, num85].frameX >= 54))
{
flag10 = false;
}
if (flag10)
{
list15.Add(new Tuple<int, int>(num84, num85));
}
}
}
}
if (list15.Count > 0)
{
float num86 = -1f;
Tuple<int, int> tuple15 = list15[0];
for (int num87 = 0; num87 < list15.Count; num87++)
{
float num88 = Vector2.Distance(new Vector2((float)list15[num87].Item1, (float)list15[num87].Item2) * 16f + Vector2.One * 8f, vector);
if (num86 == -1f || num88 < num86)
{
num86 = num88;
tuple15 = list15[num87];
}
}
if (Collision.InTileBounds(tuple15.Item1, tuple15.Item2, num4, num6, num5, num7))
{
num8 = tuple15.Item1;
num9 = tuple15.Item2;
}
}
list15.Clear();
}
if (Player.SmartCursorSettings.SmartBlocksEnabled && item.createTile > -1 && item.type != 213 && Main.tileSolid[item.createTile] && !Main.tileSolidTop[item.createTile] && !Main.tileFrameImportant[item.createTile] && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list16 = new List<Tuple<int, int>>();
bool flag11 = false;
if (Main.tile[num, num2].active())
{
flag11 = true;
}
if (!Collision.InTileBounds(num, num2, num4, num6, num5, num7))
{
flag11 = true;
}
if (!flag11)
{
for (int num89 = num4; num89 <= num5; num89++)
{
for (int num90 = num6; num90 <= num7; num90++)
{
Tile tile10 = Main.tile[num89, num90];
if (!tile10.active() || Main.tileCut[(int)tile10.type] || TileID.Sets.BreakableWhenPlacing[(int)tile10.type])
{
bool flag12 = false;
if (Main.tile[num89 - 1, num90].active() && Main.tileSolid[(int)Main.tile[num89 - 1, num90].type] && !Main.tileSolidTop[(int)Main.tile[num89 - 1, num90].type])
{
flag12 = true;
}
if (Main.tile[num89 + 1, num90].active() && Main.tileSolid[(int)Main.tile[num89 + 1, num90].type] && !Main.tileSolidTop[(int)Main.tile[num89 + 1, num90].type])
{
flag12 = true;
}
if (Main.tile[num89, num90 - 1].active() && Main.tileSolid[(int)Main.tile[num89, num90 - 1].type] && !Main.tileSolidTop[(int)Main.tile[num89, num90 - 1].type])
{
flag12 = true;
}
if (Main.tile[num89, num90 + 1].active() && Main.tileSolid[(int)Main.tile[num89, num90 + 1].type] && !Main.tileSolidTop[(int)Main.tile[num89, num90 + 1].type])
{
flag12 = true;
}
if (flag12)
{
list16.Add(new Tuple<int, int>(num89, num90));
}
}
}
}
}
if (list16.Count > 0)
{
float num91 = -1f;
Tuple<int, int> tuple16 = list16[0];
for (int num92 = 0; num92 < list16.Count; num92++)
{
if (Collision.EmptyTile(list16[num92].Item1, list16[num92].Item2, false))
{
float num93 = Vector2.Distance(new Vector2((float)list16[num92].Item1, (float)list16[num92].Item2) * 16f + Vector2.One * 8f, vector);
if (num91 == -1f || num93 < num91)
{
num91 = num93;
tuple16 = list16[num92];
}
}
}
if (Collision.InTileBounds(tuple16.Item1, tuple16.Item2, num4, num6, num5, num7) && num91 != -1f)
{
num8 = tuple16.Item1;
num9 = tuple16.Item2;
}
}
list16.Clear();
}
if ((item.type == 1072 || item.type == 1544) && num3 != 0 && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list17 = new List<Tuple<int, int>>();
for (int num94 = num4; num94 <= num5; num94++)
{
for (int num95 = num6; num95 <= num7; num95++)
{
Tile tile11 = Main.tile[num94, num95];
if (tile11.wall > 0 && (int)tile11.wallColor() != num3 && (!tile11.active() || !Main.tileSolid[(int)tile11.type] || Main.tileSolidTop[(int)tile11.type]))
{
list17.Add(new Tuple<int, int>(num94, num95));
}
}
}
if (list17.Count > 0)
{
float num96 = -1f;
Tuple<int, int> tuple17 = list17[0];
for (int num97 = 0; num97 < list17.Count; num97++)
{
float num98 = Vector2.Distance(new Vector2((float)list17[num97].Item1, (float)list17[num97].Item2) * 16f + Vector2.One * 8f, vector);
if (num96 == -1f || num98 < num96)
{
num96 = num98;
tuple17 = list17[num97];
}
}
if (Collision.InTileBounds(tuple17.Item1, tuple17.Item2, num4, num6, num5, num7))
{
num8 = tuple17.Item1;
num9 = tuple17.Item2;
}
}
list17.Clear();
}
if ((item.type == 1071 || item.type == 1543) && num3 != 0 && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list18 = new List<Tuple<int, int>>();
for (int num99 = num4; num99 <= num5; num99++)
{
for (int num100 = num6; num100 <= num7; num100++)
{
Tile tile12 = Main.tile[num99, num100];
if (tile12.active() && (int)tile12.color() != num3)
{
list18.Add(new Tuple<int, int>(num99, num100));
}
}
}
if (list18.Count > 0)
{
float num101 = -1f;
Tuple<int, int> tuple18 = list18[0];
for (int num102 = 0; num102 < list18.Count; num102++)
{
float num103 = Vector2.Distance(new Vector2((float)list18[num102].Item1, (float)list18[num102].Item2) * 16f + Vector2.One * 8f, vector);
if (num101 == -1f || num103 < num101)
{
num101 = num103;
tuple18 = list18[num102];
}
}
if (Collision.InTileBounds(tuple18.Item1, tuple18.Item2, num4, num6, num5, num7))
{
num8 = tuple18.Item1;
num9 = tuple18.Item2;
}
}
list18.Clear();
}
if ((item.type == 1100 || item.type == 1545) && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list19 = new List<Tuple<int, int>>();
for (int num104 = num4; num104 <= num5; num104++)
{
for (int num105 = num6; num105 <= num7; num105++)
{
Tile tile13 = Main.tile[num104, num105];
if ((tile13.active() && tile13.color() > 0) || (tile13.wall > 0 && tile13.wallColor() > 0))
{
list19.Add(new Tuple<int, int>(num104, num105));
}
}
}
if (list19.Count > 0)
{
float num106 = -1f;
Tuple<int, int> tuple19 = list19[0];
for (int num107 = 0; num107 < list19.Count; num107++)
{
float num108 = Vector2.Distance(new Vector2((float)list19[num107].Item1, (float)list19[num107].Item2) * 16f + Vector2.One * 8f, vector);
if (num106 == -1f || num108 < num106)
{
num106 = num108;
tuple19 = list19[num107];
}
}
if (Collision.InTileBounds(tuple19.Item1, tuple19.Item2, num4, num6, num5, num7))
{
num8 = tuple19.Item1;
num9 = tuple19.Item2;
}
}
list19.Clear();
}
if (item.type == 27 && num8 == -1 && num9 == -1 && num6 > 20)
{
List<Tuple<int, int>> list20 = new List<Tuple<int, int>>();
for (int num109 = num4; num109 <= num5; num109++)
{
for (int num110 = num6; num110 <= num7; num110++)
{
Tile tile14 = Main.tile[num109, num110];
Tile tile15 = Main.tile[num109, num110 - 1];
Tile tile16 = Main.tile[num109, num110 + 1];
Tile tile17 = Main.tile[num109 - 1, num110];
Tile tile18 = Main.tile[num109 + 1, num110];
if ((!tile14.active() || Main.tileCut[(int)tile14.type] || TileID.Sets.BreakableWhenPlacing[(int)tile14.type]) && (!tile15.active() || Main.tileCut[(int)tile15.type] || TileID.Sets.BreakableWhenPlacing[(int)tile15.type]) && (!tile17.active() || tile17.type != 20) && (!tile18.active() || tile18.type != 20) && tile16.active() && WorldGen.SolidTile2(tile16))
{
ushort type = tile16.type;
if (type <= 109)
{
if (type <= 23)
{
if (type != 2 && type != 23)
{
goto IL_3680;
}
}
else if (type != 53)
{
if (type != 60)
{
if (type != 109)
{
goto IL_3680;
}
}
else
{
if (WorldGen.EmptyTileCheck(num109 - 2, num109 + 2, num110 - 20, num110, 20))
{
list20.Add(new Tuple<int, int>(num109, num110));
goto IL_3680;
}
goto IL_3680;
}
}
}
else if (type <= 116)
{
if (type != 112 && type != 116)
{
goto IL_3680;
}
}
else if (type != 147 && type != 199 && type != 234)
{
goto IL_3680;
}
if (tile17.liquid == 0 && tile14.liquid == 0 && tile18.liquid == 0 && WorldGen.EmptyTileCheck(num109 - 2, num109 + 2, num110 - 20, num110, 20))
{
list20.Add(new Tuple<int, int>(num109, num110));
}
}
IL_3680:;
}
}
List<Tuple<int, int>> list21 = new List<Tuple<int, int>>();
for (int num111 = 0; num111 < list20.Count; num111++)
{
bool flag13 = false;
for (int num112 = -1; num112 < 2; num112 += 2)
{
Tile tile19 = Main.tile[list20[num111].Item1 + num112, list20[num111].Item2 + 1];
if (tile19.active())
{
ushort type = tile19.type;
if (type <= 109)
{
if (type <= 23)
{
if (type != 2 && type != 23)
{
goto IL_3775;
}
}
else if (type != 53 && type != 60 && type != 109)
{
goto IL_3775;
}
}
else if (type <= 116)
{
if (type != 112 && type != 116)
{
goto IL_3775;
}
}
else if (type != 147 && type != 199 && type != 234)
{
goto IL_3775;
}
flag13 = true;
}
IL_3775:;
}
if (!flag13)
{
list21.Add(list20[num111]);
}
}
for (int num113 = 0; num113 < list21.Count; num113++)
{
list20.Remove(list21[num113]);
}
list21.Clear();
if (list20.Count > 0)
{
float num114 = -1f;
Tuple<int, int> tuple20 = list20[0];
for (int num115 = 0; num115 < list20.Count; num115++)
{
float num116 = Vector2.Distance(new Vector2((float)list20[num115].Item1, (float)list20[num115].Item2) * 16f + Vector2.One * 8f, vector);
if (num114 == -1f || num116 < num114)
{
num114 = num116;
tuple20 = list20[num115];
}
}
if (Collision.InTileBounds(tuple20.Item1, tuple20.Item2, num4, num6, num5, num7))
{
num8 = tuple20.Item1;
num9 = tuple20.Item2;
}
}
list20.Clear();
}
if (item.type == 205 && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list22 = new List<Tuple<int, int>>();
for (int num117 = num4; num117 <= num5; num117++)
{
for (int num118 = num6; num118 <= num7; num118++)
{
Tile tile20 = Main.tile[num117, num118];
if (tile20.liquid > 0)
{
int num119 = (int)tile20.liquidType();
int num120 = 0;
for (int num121 = num117 - 1; num121 <= num117 + 1; num121++)
{
for (int num122 = num118 - 1; num122 <= num118 + 1; num122++)
{
if ((int)Main.tile[num121, num122].liquidType() == num119)
{
num120 += (int)Main.tile[num121, num122].liquid;
}
}
}
if (num120 > 100)
{
list22.Add(new Tuple<int, int>(num117, num118));
}
}
}
}
if (list22.Count > 0)
{
float num123 = -1f;
Tuple<int, int> tuple21 = list22[0];
for (int num124 = 0; num124 < list22.Count; num124++)
{
float num125 = Vector2.Distance(new Vector2((float)list22[num124].Item1, (float)list22[num124].Item2) * 16f + Vector2.One * 8f, vector);
if (num123 == -1f || num125 < num123)
{
num123 = num125;
tuple21 = list22[num124];
}
}
if (Collision.InTileBounds(tuple21.Item1, tuple21.Item2, num4, num6, num5, num7))
{
num8 = tuple21.Item1;
num9 = tuple21.Item2;
}
}
list22.Clear();
}
if (item.type == 849 && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list23 = new List<Tuple<int, int>>();
for (int num126 = num4; num126 <= num5; num126++)
{
for (int num127 = num6; num127 <= num7; num127++)
{
Tile tile21 = Main.tile[num126, num127];
if ((tile21.wire() || tile21.wire2() || tile21.wire3()) && !tile21.actuator() && tile21.active())
{
list23.Add(new Tuple<int, int>(num126, num127));
}
}
}
if (list23.Count > 0)
{
float num128 = -1f;
Tuple<int, int> tuple22 = list23[0];
for (int num129 = 0; num129 < list23.Count; num129++)
{
float num130 = Vector2.Distance(new Vector2((float)list23[num129].Item1, (float)list23[num129].Item2) * 16f + Vector2.One * 8f, vector);
if (num128 == -1f || num130 < num128)
{
num128 = num130;
tuple22 = list23[num129];
}
}
if (Collision.InTileBounds(tuple22.Item1, tuple22.Item2, num4, num6, num5, num7))
{
num8 = tuple22.Item1;
num9 = tuple22.Item2;
}
}
list23.Clear();
}
if (item.createTile == 82 && num8 == -1 && num9 == -1)
{
int placeStyle = item.placeStyle;
List<Tuple<int, int>> list24 = new List<Tuple<int, int>>();
for (int num131 = num4; num131 <= num5; num131++)
{
for (int num132 = num6; num132 <= num7; num132++)
{
Tile tile22 = Main.tile[num131, num132];
Tile tile23 = Main.tile[num131, num132 + 1];
if ((!tile22.active() || TileID.Sets.BreakableWhenPlacing[(int)tile22.type] || (Main.tileCut[(int)tile22.type] && tile22.type != 82 && tile22.type != 83)) && tile23.nactive() && !tile23.halfBrick() && tile23.slope() == 0)
{
if (placeStyle == 0)
{
if (tile23.type != 78 && tile23.type != 380 && tile23.type != 2 && tile23.type != 109)
{
goto IL_3EF0;
}
if (tile22.liquid > 0)
{
goto IL_3EF0;
}
}
else if (placeStyle == 1)
{
if (tile23.type != 78 && tile23.type != 380 && tile23.type != 60)
{
goto IL_3EF0;
}
if (tile22.liquid > 0)
{
goto IL_3EF0;
}
}
else if (placeStyle == 2)
{
if (tile23.type != 78 && tile23.type != 380 && tile23.type != 0 && tile23.type != 59)
{
goto IL_3EF0;
}
if (tile22.liquid > 0)
{
goto IL_3EF0;
}
}
else if (placeStyle == 3)
{
if (tile23.type != 78 && tile23.type != 380 && tile23.type != 203 && tile23.type != 199 && tile23.type != 23 && tile23.type != 25)
{
goto IL_3EF0;
}
if (tile22.liquid > 0)
{
goto IL_3EF0;
}
}
else if (placeStyle == 4)
{
if (tile23.type != 78 && tile23.type != 380 && tile23.type != 53 && tile23.type != 116)
{
goto IL_3EF0;
}
if (tile22.liquid > 0 && tile22.lava())
{
goto IL_3EF0;
}
}
else if (placeStyle == 5)
{
if (tile23.type != 78 && tile23.type != 380 && tile23.type != 57)
{
goto IL_3EF0;
}
if (tile22.liquid > 0 && !tile22.lava())
{
goto IL_3EF0;
}
}
else if (placeStyle == 6 && ((tile23.type != 78 && tile23.type != 380 && tile23.type != 147 && tile23.type != 161 && tile23.type != 163 && tile23.type != 164 && tile23.type != 200) || (tile22.liquid > 0 && tile22.lava())))
{
goto IL_3EF0;
}
list24.Add(new Tuple<int, int>(num131, num132));
}
IL_3EF0:;
}
}
if (list24.Count > 0)
{
float num133 = -1f;
Tuple<int, int> tuple23 = list24[0];
for (int num134 = 0; num134 < list24.Count; num134++)
{
float num135 = Vector2.Distance(new Vector2((float)list24[num134].Item1, (float)list24[num134].Item2) * 16f + Vector2.One * 8f, vector);
if (num133 == -1f || num135 < num133)
{
num133 = num135;
tuple23 = list24[num134];
}
}
if (Collision.InTileBounds(tuple23.Item1, tuple23.Item2, num4, num6, num5, num7))
{
num8 = tuple23.Item1;
num9 = tuple23.Item2;
}
}
list24.Clear();
}
if (item.createTile == 380 && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list25 = new List<Tuple<int, int>>();
bool flag14 = false;
if (Main.tile[num, num2].active() && Main.tile[num, num2].type == 380)
{
flag14 = true;
}
if (!flag14)
{
for (int num136 = num4; num136 <= num5; num136++)
{
for (int num137 = num6; num137 <= num7; num137++)
{
Tile tile24 = Main.tile[num136, num137];
if (tile24.active() && tile24.type == 380)
{
if (!Main.tile[num136 - 1, num137].active() || Main.tileCut[(int)Main.tile[num136 - 1, num137].type] || TileID.Sets.BreakableWhenPlacing[(int)Main.tile[num136 - 1, num137].type])
{
list25.Add(new Tuple<int, int>(num136 - 1, num137));
}
if (!Main.tile[num136 + 1, num137].active() || Main.tileCut[(int)Main.tile[num136 + 1, num137].type] || TileID.Sets.BreakableWhenPlacing[(int)Main.tile[num136 + 1, num137].type])
{
list25.Add(new Tuple<int, int>(num136 + 1, num137));
}
}
}
}
}
if (list25.Count > 0)
{
float num138 = -1f;
Tuple<int, int> tuple24 = list25[0];
for (int num139 = 0; num139 < list25.Count; num139++)
{
float num140 = Vector2.Distance(new Vector2((float)list25[num139].Item1, (float)list25[num139].Item2) * 16f + Vector2.One * 8f, vector);
if (num138 == -1f || num140 < num138)
{
num138 = num140;
tuple24 = list25[num139];
}
}
if (Collision.InTileBounds(tuple24.Item1, tuple24.Item2, num4, num6, num5, num7) && num138 != -1f)
{
num8 = tuple24.Item1;
num9 = tuple24.Item2;
}
}
list25.Clear();
}
if (item.createTile == 78 && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list26 = new List<Tuple<int, int>>();
bool flag15 = false;
if (Main.tile[num, num2].active())
{
flag15 = true;
}
if (!Collision.InTileBounds(num, num2, num4, num6, num5, num7))
{
flag15 = true;
}
if (!flag15)
{
for (int num141 = num4; num141 <= num5; num141++)
{
for (int num142 = num6; num142 <= num7; num142++)
{
Tile tile25 = Main.tile[num141, num142];
Tile tile26 = Main.tile[num141, num142 + 1];
if ((!tile25.active() || Main.tileCut[(int)tile25.type] || TileID.Sets.BreakableWhenPlacing[(int)tile25.type]) && tile26.nactive() && !tile26.halfBrick() && tile26.slope() == 0 && Main.tileSolid[(int)tile26.type])
{
list26.Add(new Tuple<int, int>(num141, num142));
}
}
}
}
if (list26.Count > 0)
{
float num143 = -1f;
Tuple<int, int> tuple25 = list26[0];
for (int num144 = 0; num144 < list26.Count; num144++)
{
if (Collision.EmptyTile(list26[num144].Item1, list26[num144].Item2, true))
{
float num145 = Vector2.Distance(new Vector2((float)list26[num144].Item1, (float)list26[num144].Item2) * 16f + Vector2.One * 8f, vector);
if (num143 == -1f || num145 < num143)
{
num143 = num145;
tuple25 = list26[num144];
}
}
}
if (Collision.InTileBounds(tuple25.Item1, tuple25.Item2, num4, num6, num5, num7) && num143 != -1f)
{
num8 = tuple25.Item1;
num9 = tuple25.Item2;
}
}
list26.Clear();
}
if (item.type == 213 && num8 == -1 && num9 == -1)
{
List<Tuple<int, int>> list27 = new List<Tuple<int, int>>();
for (int num146 = num4; num146 <= num5; num146++)
{
for (int num147 = num6; num147 <= num7; num147++)
{
Tile tile27 = Main.tile[num146, num147];
bool flag16 = !Main.tile[num146 - 1, num147].active() || !Main.tile[num146, num147 + 1].active() || !Main.tile[num146 + 1, num147].active() || !Main.tile[num146, num147 - 1].active();
bool flag17 = !Main.tile[num146 - 1, num147 - 1].active() || !Main.tile[num146 - 1, num147 + 1].active() || !Main.tile[num146 + 1, num147 + 1].active() || !Main.tile[num146 + 1, num147 - 1].active();
if (tile27.active() && !tile27.inActive() && (tile27.type == 0 || tile27.type == 1) && (flag16 || (tile27.type == 0 && flag17)))
{
list27.Add(new Tuple<int, int>(num146, num147));
}
}
}
if (list27.Count > 0)
{
float num148 = -1f;
Tuple<int, int> tuple26 = list27[0];
for (int num149 = 0; num149 < list27.Count; num149++)
{
float num150 = Vector2.Distance(new Vector2((float)list27[num149].Item1, (float)list27[num149].Item2) * 16f + Vector2.One * 8f, vector);
if (num148 == -1f || num150 < num148)
{
num148 = num150;
tuple26 = list27[num149];
}
}
if (Collision.InTileBounds(tuple26.Item1, tuple26.Item2, num4, num6, num5, num7))
{
num8 = tuple26.Item1;
num9 = tuple26.Item2;
}
}
list27.Clear();
}
if (num8 != -1 && num9 != -1)
{
Main.smartDigX = (Player.tileTargetX = num8);
Main.smartDigY = (Player.tileTargetY = num9);
Main.smartDigShowing = true;
}
list.Clear();
}
public void SmartitemLookup()
{
if (this.controlTorch && this.itemAnimation == 0)
{
int num = 0;
int num2 = (int)(((float)Main.mouseX + Main.screenPosition.X) / 16f);
int num3 = (int)(((float)Main.mouseY + Main.screenPosition.Y) / 16f);
if (this.gravDir == -1f)
{
num3 = (int)((Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16f);
}
int num4 = -10;
int num5 = -10;
int num6 = -10;
int num7 = -10;
int num8 = -10;
for (int i = 0; i < 50; i++)
{
if (this.inventory[i].pick > 0 && num4 == -10)
{
num4 = this.inventory[i].tileBoost;
}
if (this.inventory[i].axe > 0 && num5 == -10)
{
num5 = this.inventory[i].tileBoost;
}
if (this.inventory[i].hammer > 0 && num6 == -10)
{
num6 = this.inventory[i].tileBoost;
}
if ((this.inventory[i].type == 929 || this.inventory[i].type == 1338 || this.inventory[i].type == 1345) && num7 == -10)
{
num7 = this.inventory[i].tileBoost;
}
if ((this.inventory[i].type == 424 || this.inventory[i].type == 1103) && num8 == -10)
{
num8 = this.inventory[i].tileBoost;
}
}
int num9 = 0;
int num10 = 0;
if (this.position.X / 16f >= (float)num2)
{
num9 = (int)(this.position.X / 16f) - num2;
}
if ((this.position.X + (float)this.width) / 16f <= (float)num2)
{
num9 = num2 - (int)((this.position.X + (float)this.width) / 16f);
}
if (this.position.Y / 16f >= (float)num3)
{
num10 = (int)(this.position.Y / 16f) - num3;
}
if ((this.position.Y + (float)this.height) / 16f <= (float)num3)
{
num10 = num3 - (int)((this.position.Y + (float)this.height) / 16f);
}
bool flag = false;
bool flag2 = false;
try
{
flag2 = (Main.tile[num2, num3].liquid > 0);
if (Main.tile[num2, num3].active())
{
int type = (int)Main.tile[num2, num3].type;
if (type == 219 && num9 <= num8 + Player.tileRangeX && num10 <= num8 + Player.tileRangeY)
{
num = 7;
flag = true;
}
else if (type == 209 && num9 <= num7 + Player.tileRangeX && num10 <= num7 + Player.tileRangeY)
{
num = 6;
flag = true;
}
else if (Main.tileHammer[type] && num9 <= num6 + Player.tileRangeX && num10 <= num6 + Player.tileRangeY)
{
num = 1;
flag = true;
}
else if (Main.tileAxe[type] && num9 <= num5 + Player.tileRangeX && num10 <= num5 + Player.tileRangeY)
{
num = 2;
flag = true;
}
else if (num9 <= num4 + Player.tileRangeX && num10 <= num4 + Player.tileRangeY)
{
num = 3;
flag = true;
}
}
else if (flag2 && this.wet)
{
num = 4;
flag = true;
}
}
catch
{
}
if (!flag && this.wet)
{
num = 4;
}
if (num == 0 || num == 4)
{
float num11 = Math.Abs((float)Main.mouseX + Main.screenPosition.X - (this.position.X + (float)(this.width / 2)));
float num12 = Math.Abs((float)Main.mouseY + Main.screenPosition.Y - (this.position.Y + (float)(this.height / 2))) * 1.3f;
float num13 = (float)Math.Sqrt((double)(num11 * num11 + num12 * num12));
if (num13 > 200f)
{
num = 5;
}
}
for (int j = 0; j < 50; j++)
{
int type2 = this.inventory[j].type;
if (num == 0)
{
if (type2 == 8 || type2 == 427 || type2 == 428 || type2 == 429 || type2 == 430 || type2 == 431 || type2 == 432 || type2 == 433 || type2 == 523 || type2 == 974 || type2 == 1245 || type2 == 1333 || type2 == 2274 || type2 == 3004 || type2 == 3045 || type2 == 3114)
{
if (this.nonTorch == -1)
{
this.nonTorch = this.selectedItem;
}
this.selectedItem = j;
return;
}
if (type2 == 282 || type2 == 286 || type2 == 3002 || type2 == 3112)
{
if (this.nonTorch == -1)
{
this.nonTorch = this.selectedItem;
}
this.selectedItem = j;
}
}
else if (num == 1)
{
if (this.inventory[j].hammer > 0)
{
if (this.nonTorch == -1)
{
this.nonTorch = this.selectedItem;
}
this.selectedItem = j;
return;
}
}
else if (num == 2)
{
if (this.inventory[j].axe > 0)
{
if (this.nonTorch == -1)
{
this.nonTorch = this.selectedItem;
}
this.selectedItem = j;
return;
}
}
else if (num == 3)
{
if (this.inventory[j].pick > 0)
{
if (this.nonTorch == -1)
{
this.nonTorch = this.selectedItem;
}
this.selectedItem = j;
return;
}
}
else if (num == 4)
{
if (this.inventory[j].type != 282 && this.inventory[j].type != 286 && this.inventory[j].type != 3002 && this.inventory[j].type != 3112 && this.inventory[j].type != 930 && (type2 == 8 || type2 == 427 || type2 == 428 || type2 == 429 || type2 == 430 || type2 == 431 || type2 == 432 || type2 == 433 || type2 == 974 || type2 == 1245 || type2 == 2274 || type2 == 3004 || type2 == 3045 || type2 == 3114))
{
if (this.nonTorch == -1)
{
this.nonTorch = this.selectedItem;
}
if (this.inventory[this.selectedItem].createTile != 4)
{
this.selectedItem = j;
}
}
else
{
if ((type2 == 282 || type2 == 286 || type2 == 3002 || type2 == 3112) && flag2)
{
if (this.nonTorch == -1)
{
this.nonTorch = this.selectedItem;
}
this.selectedItem = j;
return;
}
if (type2 == 930 && flag2)
{
bool flag3 = false;
for (int k = 57; k >= 0; k--)
{
if (this.inventory[k].ammo == this.inventory[j].useAmmo)
{
flag3 = true;
break;
}
}
if (flag3)
{
if (this.nonTorch == -1)
{
this.nonTorch = this.selectedItem;
}
this.selectedItem = j;
return;
}
}
else if (type2 == 1333 || type2 == 523)
{
if (this.nonTorch == -1)
{
this.nonTorch = this.selectedItem;
}
this.selectedItem = j;
return;
}
}
}
else if (num == 5)
{
if (type2 == 8 || type2 == 427 || type2 == 428 || type2 == 429 || type2 == 430 || type2 == 431 || type2 == 432 || type2 == 433 || type2 == 523 || type2 == 974 || type2 == 1245 || type2 == 1333 || type2 == 2274 || type2 == 3004 || type2 == 3045 || type2 == 3114)
{
if (this.nonTorch == -1)
{
this.nonTorch = this.selectedItem;
}
if (this.inventory[this.selectedItem].createTile != 4)
{
this.selectedItem = j;
}
}
else if (type2 == 930)
{
bool flag4 = false;
for (int l = 57; l >= 0; l--)
{
if (this.inventory[l].ammo == this.inventory[j].useAmmo)
{
flag4 = true;
break;
}
}
if (flag4)
{
if (this.nonTorch == -1)
{
this.nonTorch = this.selectedItem;
}
this.selectedItem = j;
return;
}
}
else if (type2 == 282 || type2 == 286 || type2 == 3002 || type2 == 3112)
{
if (this.nonTorch == -1)
{
this.nonTorch = this.selectedItem;
}
this.selectedItem = j;
return;
}
}
else if (num == 6)
{
int num14 = 929;
if (Main.tile[num2, num3].frameX >= 144)
{
num14 = 1345;
}
else if (Main.tile[num2, num3].frameX >= 72)
{
num14 = 1338;
}
if (type2 == num14)
{
if (this.nonTorch == -1)
{
this.nonTorch = this.selectedItem;
}
this.selectedItem = j;
return;
}
}
else if (num == 7 && ItemID.Sets.ExtractinatorMode[type2] >= 0)
{
if (this.nonTorch == -1)
{
this.nonTorch = this.selectedItem;
}
this.selectedItem = j;
return;
}
}
return;
}
if (this.nonTorch > -1 && this.itemAnimation == 0)
{
this.selectedItem = this.nonTorch;
this.nonTorch = -1;
}
}
public void ResetEffects()
{
if (this.extraAccessory && (Main.expertMode || Main.gameMenu))
{
this.extraAccessorySlots = 1;
}
else
{
this.extraAccessorySlots = 0;
}
this.arcticDivingGear = 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 = 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 = 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.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.ammoBox = false;
this.ammoPotion = false;
this.penguin = false;
this.sporeSac = false;
this.shinyStone = 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 = 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.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.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.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.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.setVortex = (this.setNebula = (this.setStardust = false));
this.nebulaLevelDamage = (this.nebulaLevelLife = (this.nebulaLevelMana = 0));
this.ignoreWater = false;
this.meleeEnchant = 0;
this.discount = false;
this.coins = false;
this.doubleJumpSail = false;
this.doubleJumpSandstorm = false;
this.doubleJumpBlizzard = false;
this.doubleJumpFart = false;
this.doubleJumpUnicorn = false;
this.paladinBuff = false;
this.paladinGive = false;
this.autoJump = false;
this.justJumped = false;
this.jumpSpeedBoost = 0f;
this.extraFall = 0;
if (this.phantasmTime > 0)
{
this.phantasmTime--;
}
for (int i = 0; i < this.npcTypeNoAggro.Length; i++)
{
this.npcTypeNoAggro[i] = false;
}
for (int j = 0; j < this.ownedProjectileCounts.Length; j++)
{
this.ownedProjectileCounts[j] = 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.immuneAlpha += this.immuneAlphaDirection * 50;
if (this.immuneAlpha <= 50)
{
this.immuneAlphaDirection = 1;
return;
}
if (this.immuneAlpha >= 205)
{
this.immuneAlphaDirection = -1;
return;
}
}
else
{
this.immuneAlpha = 0;
}
}
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 num2 = 0f;
if (this.lifeRegenTime >= 300)
{
num2 += 1f;
}
if (this.lifeRegenTime >= 600)
{
num2 += 1f;
}
if (this.lifeRegenTime >= 900)
{
num2 += 1f;
}
if (this.lifeRegenTime >= 1200)
{
num2 += 1f;
}
if (this.lifeRegenTime >= 1500)
{
num2 += 1f;
}
if (this.lifeRegenTime >= 1800)
{
num2 += 1f;
}
if (this.lifeRegenTime >= 2400)
{
num2 += 1f;
}
if (this.lifeRegenTime >= 3000)
{
num2 += 1f;
}
if (flag)
{
float num3 = (float)(this.lifeRegenTime - 3000);
num3 /= 300f;
if (num3 > 0f)
{
if (num3 > 30f)
{
num3 = 30f;
}
num2 += num3;
}
}
else if (this.lifeRegenTime >= 3600)
{
num2 += 1f;
this.lifeRegenTime = 3600;
}
if (this.velocity.X == 0f || this.grappling[0] > 0)
{
num2 *= 1.25f;
}
else
{
num2 *= 0.5f;
}
if (this.crimsonRegen)
{
num2 *= 1.5f;
}
if (this.shinyStone)
{
num2 *= 1.1f;
}
if (this.whoAmI == Main.myPlayer && Main.campfire)
{
num2 *= 1.1f;
}
if (Main.expertMode && !this.wellFed)
{
if (this.shinyStone)
{
num2 *= 0.75f;
}
else
{
num2 /= 2f;
}
}
if (this.rabid)
{
if (this.shinyStone)
{
num2 *= 0.75f;
}
else
{
num2 /= 2f;
}
}
float num4 = (float)this.statLifeMax2 / 400f * 0.85f + 0.15f;
num2 *= num4;
this.lifeRegen += (int)Math.Round((double)num2);
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 num5 = Dust.NewDust(this.position, this.width, this.height, 55, 0f, 0f, 200, default(Color), 0.5f);
Main.dust[num5].noGravity = true;
Main.dust[num5].velocity *= 0.75f;
Main.dust[num5].fadeIn = 1.3f;
Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
vector.Normalize();
vector *= (float)Main.rand.Next(50, 100) * 0.04f;
Main.dust[num5].velocity = vector;
vector.Normalize();
vector *= 34f;
Main.dust[num5].position = base.Center - vector;
}
}
while (this.lifeRegenCount >= 120)
{
this.lifeRegenCount -= 120;
if (this.statLife < this.statLifeMax2)
{
this.statLife++;
if (this.crimsonRegen)
{
for (int i = 0; i < 10; i++)
{
int num6 = Dust.NewDust(this.position, this.width, this.height, 5, 0f, 0f, 175, default(Color), 1.75f);
Main.dust[num6].noGravity = true;
Main.dust[num6].velocity *= 0.75f;
int num7 = Main.rand.Next(-40, 41);
int num8 = Main.rand.Next(-40, 41);
Dust expr_7EE_cp_0 = Main.dust[num6];
expr_7EE_cp_0.position.X = expr_7EE_cp_0.position.X + (float)num7;
Dust expr_80A_cp_0 = Main.dust[num6];
expr_80A_cp_0.position.Y = expr_80A_cp_0.position.Y + (float)num8;
Main.dust[num6].velocity.X = (float)(-(float)num7) * 0.075f;
Main.dust[num6].velocity.Y = (float)(-(float)num8) * 0.075f;
}
}
}
if (this.statLife > this.statLifeMax2)
{
this.statLife = this.statLifeMax2;
}
}
if (!this.burned && !this.suffocating)
{
if (!this.tongued || !Main.expertMode)
{
while (this.lifeRegenCount <= -120)
{
if (this.lifeRegenCount <= -480)
{
this.lifeRegenCount += 480;
this.statLife -= 4;
CombatText.NewText(new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height), CombatText.LifeRegen, string.Concat(4), false, true);
}
else if (this.lifeRegenCount <= -360)
{
this.lifeRegenCount += 360;
this.statLife -= 3;
CombatText.NewText(new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height), CombatText.LifeRegen, string.Concat(3), false, true);
}
else if (this.lifeRegenCount <= -240)
{
this.lifeRegenCount += 240;
this.statLife -= 2;
CombatText.NewText(new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height), CombatText.LifeRegen, string.Concat(2), false, true);
}
else
{
this.lifeRegenCount += 120;
this.statLife--;
CombatText.NewText(new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height), CombatText.LifeRegen, string.Concat(1), false, true);
}
if (this.statLife <= 0 && this.whoAmI == Main.myPlayer)
{
if (this.poisoned || this.venom)
{
this.KillMe(10.0, 0, false, " " + Lang.dt[0]);
}
else if (this.electrified)
{
this.KillMe(10.0, 0, false, " " + Lang.dt[3]);
}
else
{
this.KillMe(10.0, 0, false, " " + Lang.dt[1]);
}
}
}
return;
}
}
while (this.lifeRegenCount <= -600)
{
this.lifeRegenCount += 600;
this.statLife -= 5;
CombatText.NewText(new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height), CombatText.LifeRegen, string.Concat(5), false, true);
if (this.statLife <= 0 && this.whoAmI == Main.myPlayer)
{
if (this.suffocating)
{
this.KillMe(10.0, 0, false, " " + Lang.dt[2]);
}
else
{
this.KillMe(10.0, 0, false, " " + Lang.dt[1]);
}
}
}
}
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 ((this.velocity.X == 0f && this.velocity.Y == 0f) || 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 ((this.velocity.X == 0f && this.velocity.Y == 0f) || this.grappling[0] >= 0 || this.manaRegenBuff)
{
this.manaRegen += this.statManaMax2 / 2;
}
float num2 = (float)this.statMana / (float)this.statManaMax2 * 0.8f + 0.2f;
if (this.manaRegenBuff)
{
num2 = 1f;
}
this.manaRegen = (int)((double)((float)this.manaRegen * num2) * 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, -1, -1, 1);
for (int i = 0; i < 5; i++)
{
int num3 = Dust.NewDust(this.position, this.width, this.height, 45, 0f, 0f, 255, default(Color), (float)Main.rand.Next(20, 26) * 0.1f);
Main.dust[num3].noLight = true;
Main.dust[num3].noGravity = true;
Main.dust[num3].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)
{
Player.jumpHeight /= 5;
Player.jumpSpeed /= 2f;
}
}
public void FindPulley()
{
if (this.controlUp || this.controlDown)
{
int num = (int)(this.position.X + (float)(this.width / 2)) / 16;
int num2 = (int)(this.position.Y - 8f) / 16;
if (Main.tile[num, num2] != null && Main.tile[num, num2].active() && Main.tileRope[(int)Main.tile[num, num2].type])
{
float num3 = this.position.Y;
if (Main.tile[num, num2 - 1] == null)
{
Main.tile[num, num2 - 1] = new Tile();
}
if (Main.tile[num, num2 + 1] == null)
{
Main.tile[num, num2 + 1] = new Tile();
}
if ((!Main.tile[num, num2 - 1].active() || !Main.tileRope[(int)Main.tile[num, num2 - 1].type]) && (!Main.tile[num, num2 + 1].active() || !Main.tileRope[(int)Main.tile[num, num2 + 1].type]))
{
num3 = (float)(num2 * 16 + 22);
}
float num4 = (float)(num * 16 + 8 - this.width / 2 + 6 * this.direction);
int num5 = num * 16 + 8 - this.width / 2 + 6;
int num6 = num * 16 + 8 - this.width / 2;
int num7 = num * 16 + 8 - this.width / 2 + -6;
int num8 = 1;
float num9 = Math.Abs(this.position.X - (float)num5);
if (Math.Abs(this.position.X - (float)num6) < num9)
{
num8 = 2;
num9 = Math.Abs(this.position.X - (float)num6);
}
if (Math.Abs(this.position.X - (float)num7) < num9)
{
num8 = 3;
num9 = Math.Abs(this.position.X - (float)num7);
}
if (num8 == 1)
{
num4 = (float)num5;
this.pulleyDir = 2;
this.direction = 1;
}
if (num8 == 2)
{
num4 = (float)num6;
this.pulleyDir = 1;
}
if (num8 == 3)
{
num4 = (float)num7;
this.pulleyDir = 2;
this.direction = -1;
}
if (!Collision.SolidCollision(new Vector2(num4, this.position.Y), this.width, this.height))
{
if (this.whoAmI == Main.myPlayer)
{
Main.cameraX = Main.cameraX + this.position.X - num4;
}
this.pulley = true;
this.position.X = num4;
this.gfxOffY = this.position.Y - num3;
this.stepSpeed = 2.5f;
this.position.Y = num3;
this.velocity.X = 0f;
return;
}
num4 = (float)num5;
this.pulleyDir = 2;
this.direction = 1;
if (!Collision.SolidCollision(new Vector2(num4, this.position.Y), this.width, this.height))
{
if (this.whoAmI == Main.myPlayer)
{
Main.cameraX = Main.cameraX + this.position.X - num4;
}
this.pulley = true;
this.position.X = num4;
this.gfxOffY = this.position.Y - num3;
this.stepSpeed = 2.5f;
this.position.Y = num3;
this.velocity.X = 0f;
return;
}
num4 = (float)num7;
this.pulleyDir = 2;
this.direction = -1;
if (!Collision.SolidCollision(new Vector2(num4, this.position.Y), this.width, this.height))
{
if (this.whoAmI == Main.myPlayer)
{
Main.cameraX = Main.cameraX + this.position.X - num4;
}
this.pulley = true;
this.position.X = num4;
this.gfxOffY = this.position.Y - num3;
this.stepSpeed = 2.5f;
this.position.Y = num3;
this.velocity.X = 0f;
}
}
}
}
public void HorizontalMovement()
{
if (this.chilled)
{
this.accRunSpeed = this.maxRunSpeed;
}
bool flag = (this.itemAnimation == 0 || this.inventory[this.selectedItem].useTurn) && this.mount.AllowDirectionChange;
if (this.trackBoost != 0f)
{
this.velocity.X = this.velocity.X + this.trackBoost;
this.trackBoost = 0f;
if (this.velocity.X < 0f)
{
if (this.velocity.X < -this.maxRunSpeed)
{
this.velocity.X = -this.maxRunSpeed;
}
}
else if (this.velocity.X > this.maxRunSpeed)
{
this.velocity.X = this.maxRunSpeed;
}
}
if (this.controlLeft && this.velocity.X > -this.maxRunSpeed)
{
if (!this.mount.Active || !this.mount.Cart || this.velocity.Y == 0f)
{
if (this.velocity.X > this.runSlowdown)
{
this.velocity.X = this.velocity.X - this.runSlowdown;
}
this.velocity.X = this.velocity.X - this.runAcceleration;
}
if (this.onWrongGround)
{
if (this.velocity.X < -this.runSlowdown)
{
this.velocity.X = this.velocity.X + this.runSlowdown;
}
else
{
this.velocity.X = 0f;
}
}
if (this.mount.Active && this.mount.Cart && !this.onWrongGround)
{
if (this.velocity.X < 0f && flag)
{
this.direction = -1;
}
else if (this.itemAnimation <= 0 && this.velocity.Y == 0f)
{
Main.PlaySound(2, (int)this.position.X + this.width / 2, (int)this.position.Y + this.height / 2, 55);
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 && this.velocity.X < this.maxRunSpeed)
{
if (!this.mount.Active || !this.mount.Cart || this.velocity.Y == 0f)
{
if (this.velocity.X < -this.runSlowdown)
{
this.velocity.X = this.velocity.X + this.runSlowdown;
}
this.velocity.X = this.velocity.X + this.runAcceleration;
}
if (this.onWrongGround)
{
if (this.velocity.X > this.runSlowdown)
{
this.velocity.X = this.velocity.X - this.runSlowdown;
}
else
{
this.velocity.X = 0f;
}
}
if (this.mount.Active && this.mount.Cart && !this.onWrongGround)
{
if (this.velocity.X > 0f && flag)
{
this.direction = 1;
}
else if (this.itemAnimation <= 0 && this.velocity.Y == 0f)
{
Main.PlaySound(2, (int)this.position.X + this.width / 2, (int)this.position.Y + this.height / 2, 55);
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 && this.velocity.X > -this.accRunSpeed && this.dashDelay >= 0)
{
if (this.mount.Active && this.mount.Cart)
{
if (this.velocity.X < 0f)
{
this.direction = -1;
}
}
else if ((this.itemAnimation == 0 || this.inventory[this.selectedItem].useTurn) && this.mount.AllowDirectionChange)
{
this.direction = -1;
}
if (this.velocity.Y == 0f || this.wingsLogic > 0 || this.mount.CanFly)
{
if (this.velocity.X > this.runSlowdown)
{
this.velocity.X = this.velocity.X - this.runSlowdown;
}
this.velocity.X = this.velocity.X - this.runAcceleration * 0.2f;
if (this.wingsLogic > 0)
{
this.velocity.X = this.velocity.X - this.runAcceleration * 0.2f;
}
}
if (this.onWrongGround)
{
if (this.velocity.X < this.runSlowdown)
{
this.velocity.X = this.velocity.X + this.runSlowdown;
}
else
{
this.velocity.X = 0f;
}
}
if (this.velocity.X < -(this.accRunSpeed + this.maxRunSpeed) / 2f && this.velocity.Y == 0f && !this.mount.Active)
{
int num = 0;
if (this.gravDir == -1f)
{
num -= this.height;
}
if (this.runSoundDelay == 0 && this.velocity.Y == 0f)
{
Main.PlaySound(17, (int)this.position.X, (int)this.position.Y, 1);
this.runSoundDelay = 9;
}
if (this.wings == 3)
{
int num2 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float)this.height + (float)num), this.width + 8, 4, 186, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 50, default(Color), 1.5f);
Main.dust[num2].velocity *= 0.025f;
Main.dust[num2].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
num2 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float)this.height + (float)num), this.width + 8, 4, 186, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 50, default(Color), 1.5f);
Main.dust[num2].velocity *= 0.2f;
Main.dust[num2].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
else if (this.sailDash)
{
for (int i = 0; i < 4; i++)
{
int num3 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y), this.width + 8, this.height, 253, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 100, default(Color), 1.5f);
Main.dust[num3].noGravity = true;
Main.dust[num3].velocity.X = Main.dust[num3].velocity.X * 0.2f;
Main.dust[num3].velocity.Y = Main.dust[num3].velocity.Y * 0.2f;
Main.dust[num3].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this);
Main.dust[num3].scale += (float)Main.rand.Next(-5, 3) * 0.1f;
Vector2 value = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
value.Normalize();
value *= (float)Main.rand.Next(81) * 0.1f;
}
}
else if (this.coldDash)
{
for (int j = 0; j < 2; j++)
{
int num4;
if (j == 0)
{
num4 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height + this.gfxOffY), this.width / 2, 6, 76, 0f, 0f, 0, default(Color), 1.35f);
}
else
{
num4 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2), this.position.Y + (float)this.height + this.gfxOffY), this.width / 2, 6, 76, 0f, 0f, 0, default(Color), 1.35f);
}
Main.dust[num4].scale *= 1f + (float)Main.rand.Next(20, 40) * 0.01f;
Main.dust[num4].noGravity = true;
Main.dust[num4].noLight = true;
Main.dust[num4].velocity *= 0.001f;
Dust expr_E1A_cp_0 = Main.dust[num4];
expr_E1A_cp_0.velocity.Y = expr_E1A_cp_0.velocity.Y - 0.003f;
Main.dust[num4].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this);
}
}
else
{
int num5 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float)this.height + (float)num), this.width + 8, 4, 16, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 50, default(Color), 1.5f);
Main.dust[num5].velocity.X = Main.dust[num5].velocity.X * 0.2f;
Main.dust[num5].velocity.Y = Main.dust[num5].velocity.Y * 0.2f;
Main.dust[num5].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this);
}
}
}
else if (this.controlRight && this.velocity.X < this.accRunSpeed && this.dashDelay >= 0)
{
if (this.mount.Active && this.mount.Cart)
{
if (this.velocity.X > 0f)
{
this.direction = -1;
}
}
else if ((this.itemAnimation == 0 || this.inventory[this.selectedItem].useTurn) && this.mount.AllowDirectionChange)
{
this.direction = 1;
}
if (this.velocity.Y == 0f || this.wingsLogic > 0 || this.mount.CanFly)
{
if (this.velocity.X < -this.runSlowdown)
{
this.velocity.X = this.velocity.X + this.runSlowdown;
}
this.velocity.X = this.velocity.X + this.runAcceleration * 0.2f;
if (this.wingsLogic > 0)
{
this.velocity.X = this.velocity.X + this.runAcceleration * 0.2f;
}
}
if (this.onWrongGround)
{
if (this.velocity.X > this.runSlowdown)
{
this.velocity.X = this.velocity.X - this.runSlowdown;
}
else
{
this.velocity.X = 0f;
}
}
if (this.velocity.X > (this.accRunSpeed + this.maxRunSpeed) / 2f && this.velocity.Y == 0f && !this.mount.Active)
{
int num6 = 0;
if (this.gravDir == -1f)
{
num6 -= this.height;
}
if (this.runSoundDelay == 0 && this.velocity.Y == 0f)
{
Main.PlaySound(17, (int)this.position.X, (int)this.position.Y, 1);
this.runSoundDelay = 9;
}
if (this.wings == 3)
{
int num7 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float)this.height + (float)num6), this.width + 8, 4, 186, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 50, default(Color), 1.5f);
Main.dust[num7].velocity *= 0.025f;
Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
num7 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float)this.height + (float)num6), this.width + 8, 4, 186, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 50, default(Color), 1.5f);
Main.dust[num7].velocity *= 0.2f;
Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
else if (this.sailDash)
{
for (int k = 0; k < 4; k++)
{
int num8 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y), this.width + 8, this.height, 253, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 100, default(Color), 1.5f);
Main.dust[num8].noGravity = true;
Main.dust[num8].velocity.X = Main.dust[num8].velocity.X * 0.2f;
Main.dust[num8].velocity.Y = Main.dust[num8].velocity.Y * 0.2f;
Main.dust[num8].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this);
Main.dust[num8].scale += (float)Main.rand.Next(-5, 3) * 0.1f;
Vector2 value2 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
value2.Normalize();
value2 *= (float)Main.rand.Next(81) * 0.1f;
}
}
else if (this.coldDash)
{
for (int l = 0; l < 2; l++)
{
int num9;
if (l == 0)
{
num9 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height + this.gfxOffY), this.width / 2, 6, 76, 0f, 0f, 0, default(Color), 1.35f);
}
else
{
num9 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2), this.position.Y + (float)this.height + this.gfxOffY), this.width / 2, 6, 76, 0f, 0f, 0, default(Color), 1.35f);
}
Main.dust[num9].scale *= 1f + (float)Main.rand.Next(20, 40) * 0.01f;
Main.dust[num9].noGravity = true;
Main.dust[num9].noLight = true;
Main.dust[num9].velocity *= 0.001f;
Dust expr_1596_cp_0 = Main.dust[num9];
expr_1596_cp_0.velocity.Y = expr_1596_cp_0.velocity.Y - 0.003f;
Main.dust[num9].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this);
}
}
else
{
int num10 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float)this.height + (float)num6), this.width + 8, 4, 16, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 50, default(Color), 1.5f);
Main.dust[num10].velocity.X = Main.dust[num10].velocity.X * 0.2f;
Main.dust[num10].velocity.Y = Main.dust[num10].velocity.Y * 0.2f;
Main.dust[num10].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this);
}
}
}
else if (this.mount.Active && this.mount.Cart && Math.Abs(this.velocity.X) >= 1f)
{
if (this.onWrongGround)
{
if (this.velocity.X > 0f)
{
if (this.velocity.X > this.runSlowdown)
{
this.velocity.X = this.velocity.X - this.runSlowdown;
}
else
{
this.velocity.X = 0f;
}
}
else if (this.velocity.X < 0f)
{
if (this.velocity.X < -this.runSlowdown)
{
this.velocity.X = this.velocity.X + this.runSlowdown;
}
else
{
this.velocity.X = 0f;
}
}
}
if (this.velocity.X > this.maxRunSpeed)
{
this.velocity.X = this.maxRunSpeed;
}
if (this.velocity.X < -this.maxRunSpeed)
{
this.velocity.X = -this.maxRunSpeed;
}
}
else if (this.velocity.Y == 0f)
{
if (this.velocity.X > this.runSlowdown)
{
this.velocity.X = this.velocity.X - this.runSlowdown;
}
else if (this.velocity.X < -this.runSlowdown)
{
this.velocity.X = this.velocity.X + this.runSlowdown;
}
else
{
this.velocity.X = 0f;
}
}
else if (!this.PortalPhysicsEnabled)
{
if ((double)this.velocity.X > (double)this.runSlowdown * 0.5)
{
this.velocity.X = this.velocity.X - this.runSlowdown * 0.5f;
}
else if ((double)this.velocity.X < (double)(-(double)this.runSlowdown) * 0.5)
{
this.velocity.X = this.velocity.X + this.runSlowdown * 0.5f;
}
else
{
this.velocity.X = 0f;
}
}
if (this.mount.Active && this.mount.Type == 10 && Math.Abs(this.velocity.X) > this.mount.DashSpeed - this.mount.RunSpeed / 2f)
{
Rectangle rect = this.getRect();
if (this.direction == 1)
{
rect.Offset(this.width - 1, 0);
}
rect.Width = 2;
rect.Inflate(6, 12);
for (int m = 0; m < 200; m++)
{
NPC nPC = Main.npc[m];
if (nPC.active && !nPC.dontTakeDamage && !nPC.friendly && nPC.immune[this.whoAmI] == 0)
{
Rectangle rect2 = nPC.getRect();
if (rect.Intersects(rect2) && (nPC.noTileCollide || Collision.CanHit(this.position, this.width, this.height, nPC.position, nPC.width, nPC.height)))
{
float num11 = 80f * this.minionDamage;
float knockBack = 10f;
int hitDirection = this.direction;
if (this.velocity.X < 0f)
{
hitDirection = -1;
}
if (this.velocity.X > 0f)
{
hitDirection = 1;
}
nPC.StrikeNPC((int)num11, knockBack, hitDirection, false, false, false);
nPC.immune[this.whoAmI] = 30;
this.immune = true;
this.immuneTime = 6;
return;
}
}
}
}
}
public void JumpMovement()
{
if (this.mount.Active && this.mount.Type == 3 && this.wetSlime == 0 && this.velocity.Y > 0f)
{
Rectangle rect = this.getRect();
rect.Offset(0, this.height - 1);
rect.Height = 2;
rect.Inflate(12, 6);
for (int i = 0; i < 200; i++)
{
NPC nPC = Main.npc[i];
if (nPC.active && !nPC.dontTakeDamage && !nPC.friendly)
{
Rectangle rect2 = nPC.getRect();
if (rect.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 hitDirection = this.direction;
if (this.velocity.X < 0f)
{
hitDirection = -1;
}
if (this.velocity.X > 0f)
{
hitDirection = 1;
}
nPC.StrikeNPC((int)num, knockBack, hitDirection, false, false, false);
nPC.immune[this.whoAmI] = 30;
this.velocity.Y = -10f;
this.immune = true;
this.immuneTime = 6;
break;
}
}
}
}
if (this.controlJump)
{
bool flag = false;
if (this.mount.Active && this.mount.Type == 3 && this.wetSlime > 0)
{
flag = true;
}
if (this.jump > 0)
{
if (this.velocity.Y == 0f)
{
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 || this.velocity.Y == 0f || flag || 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 && (this.velocity.Y == 0f || this.sliding))))
{
if (this.sliding || this.velocity.Y == 0f)
{
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 (!flag)
{
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 ((this.velocity.Y == 0f || this.sliding || (this.autoJump && this.justJumped)) && this.doubleJumpCloud)
{
this.jumpAgainCloud = true;
}
if ((this.velocity.Y == 0f || this.sliding || (this.autoJump && this.justJumped)) && this.doubleJumpSandstorm)
{
this.jumpAgainSandstorm = true;
}
if ((this.velocity.Y == 0f || this.sliding || (this.autoJump && this.justJumped)) && this.doubleJumpBlizzard)
{
this.jumpAgainBlizzard = true;
}
if ((this.velocity.Y == 0f || this.sliding || (this.autoJump && this.justJumped)) && this.doubleJumpFart)
{
this.jumpAgainFart = true;
}
if ((this.velocity.Y == 0f || this.sliding || (this.autoJump && this.justJumped)) && this.doubleJumpSail)
{
this.jumpAgainSail = true;
}
if ((this.velocity.Y == 0f || this.sliding || (this.autoJump && this.justJumped)) && this.doubleJumpUnicorn)
{
this.jumpAgainUnicorn = true;
}
if (this.velocity.Y == 0f || flag2 || this.sliding || flag)
{
this.velocity.Y = -Player.jumpSpeed * this.gravDir;
this.jump = Player.jumpHeight;
if (this.sliding)
{
this.velocity.X = (float)(3 * -(float)this.slideDir);
}
}
else if (flag3)
{
this.dJumpEffectSandstorm = true;
int arg_595_0 = this.height;
float arg_5A2_0 = this.gravDir;
Main.PlaySound(16, (int)this.position.X, (int)this.position.Y, 1);
this.velocity.Y = -Player.jumpSpeed * this.gravDir;
this.jump = Player.jumpHeight * 3;
}
else if (flag4)
{
this.dJumpEffectBlizzard = true;
int arg_5FE_0 = this.height;
float arg_60B_0 = this.gravDir;
Main.PlaySound(16, (int)this.position.X, (int)this.position.Y, 1);
this.velocity.Y = -Player.jumpSpeed * this.gravDir;
this.jump = (int)((double)Player.jumpHeight * 1.5);
}
else if (flag6)
{
this.dJumpEffectSail = true;
int num2 = this.height;
if (this.gravDir == -1f)
{
num2 = 0;
}
Main.PlaySound(16, (int)this.position.X, (int)this.position.Y, 1);
this.velocity.Y = -Player.jumpSpeed * this.gravDir;
this.jump = (int)((double)Player.jumpHeight * 1.25);
for (int j = 0; j < 30; j++)
{
int num3 = 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, default(Color), 1.5f);
if (j % 2 == 0)
{
Dust expr_756_cp_0 = Main.dust[num3];
expr_756_cp_0.velocity.X = expr_756_cp_0.velocity.X + (float)Main.rand.Next(30, 71) * 0.1f;
}
else
{
Dust expr_786_cp_0 = Main.dust[num3];
expr_786_cp_0.velocity.X = expr_786_cp_0.velocity.X - (float)Main.rand.Next(30, 71) * 0.1f;
}
Dust expr_7B4_cp_0 = Main.dust[num3];
expr_7B4_cp_0.velocity.Y = expr_7B4_cp_0.velocity.Y + (float)Main.rand.Next(-10, 31) * 0.1f;
Main.dust[num3].noGravity = true;
Main.dust[num3].scale += (float)Main.rand.Next(-10, 41) * 0.01f;
Main.dust[num3].velocity *= Main.dust[num3].scale * 0.7f;
Vector2 value = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
value.Normalize();
value *= (float)Main.rand.Next(81) * 0.1f;
}
}
else if (flag5)
{
this.dJumpEffectFart = true;
int num4 = this.height;
if (this.gravDir == -1f)
{
num4 = 0;
}
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 16);
this.velocity.Y = -Player.jumpSpeed * this.gravDir;
this.jump = Player.jumpHeight * 2;
for (int k = 0; k < 10; k++)
{
int num5 = Dust.NewDust(new Vector2(this.position.X - 34f, this.position.Y + (float)num4 - 16f), 102, 32, 188, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 100, default(Color), 1.5f);
Main.dust[num5].velocity.X = Main.dust[num5].velocity.X * 0.5f - this.velocity.X * 0.1f;
Main.dust[num5].velocity.Y = Main.dust[num5].velocity.Y * 0.5f - this.velocity.Y * 0.3f;
}
int num6 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 16f, this.position.Y + (float)num4 - 16f), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(435, 438), 1f);
Main.gore[num6].velocity.X = Main.gore[num6].velocity.X * 0.1f - this.velocity.X * 0.1f;
Main.gore[num6].velocity.Y = Main.gore[num6].velocity.Y * 0.1f - this.velocity.Y * 0.05f;
num6 = Gore.NewGore(new Vector2(this.position.X - 36f, this.position.Y + (float)num4 - 16f), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(435, 438), 1f);
Main.gore[num6].velocity.X = Main.gore[num6].velocity.X * 0.1f - this.velocity.X * 0.1f;
Main.gore[num6].velocity.Y = Main.gore[num6].velocity.Y * 0.1f - this.velocity.Y * 0.05f;
num6 = Gore.NewGore(new Vector2(this.position.X + (float)this.width + 4f, this.position.Y + (float)num4 - 16f), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(435, 438), 1f);
Main.gore[num6].velocity.X = Main.gore[num6].velocity.X * 0.1f - this.velocity.X * 0.1f;
Main.gore[num6].velocity.Y = Main.gore[num6].velocity.Y * 0.1f - this.velocity.Y * 0.05f;
}
else if (flag7)
{
this.dJumpEffectUnicorn = true;
int arg_CC7_0 = this.height;
float arg_CD4_0 = this.gravDir;
Main.PlaySound(16, (int)this.position.X, (int)this.position.Y, 1);
this.velocity.Y = -Player.jumpSpeed * this.gravDir;
this.jump = Player.jumpHeight * 2;
Vector2 center = base.Center;
Vector2 value2 = new Vector2(50f, 20f);
float num7 = 6.28318548f * Main.rand.NextFloat();
for (int l = 0; l < 5; l++)
{
for (float num8 = 0f; num8 < 14f; num8 += 1f)
{
Dust dust = Main.dust[Dust.NewDust(center, 0, 0, Utils.SelectRandom<int>(Main.rand, new int[]
{
176,
177,
179
}), 0f, 0f, 0, default(Color), 1f)];
Vector2 vector = Vector2.UnitY.RotatedBy((double)(num8 * 6.28318548f / 14f + num7), default(Vector2));
vector *= 0.2f * (float)l;
dust.position = center + vector * value2;
dust.velocity = vector + new Vector2(0f, this.gravDir * 4f);
dust.noGravity = true;
dust.scale = 1f + Main.rand.NextFloat() * 0.8f;
dust.fadeIn = Main.rand.NextFloat() * 2f;
dust.shader = GameShaders.Armor.GetSecondaryShader(this.cMount, this);
}
}
}
else
{
this.dJumpEffectCloud = true;
int num9 = this.height;
if (this.gravDir == -1f)
{
num9 = 0;
}
Main.PlaySound(16, (int)this.position.X, (int)this.position.Y, 1);
this.velocity.Y = -Player.jumpSpeed * this.gravDir;
this.jump = (int)((double)Player.jumpHeight * 0.75);
for (int m = 0; m < 10; m++)
{
int num10 = Dust.NewDust(new Vector2(this.position.X - 34f, this.position.Y + (float)num9 - 16f), 102, 32, 16, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 100, default(Color), 1.5f);
Main.dust[num10].velocity.X = Main.dust[num10].velocity.X * 0.5f - this.velocity.X * 0.1f;
Main.dust[num10].velocity.Y = Main.dust[num10].velocity.Y * 0.5f - this.velocity.Y * 0.3f;
}
int num11 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 16f, this.position.Y + (float)num9 - 16f), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(11, 14), 1f);
Main.gore[num11].velocity.X = Main.gore[num11].velocity.X * 0.1f - this.velocity.X * 0.1f;
Main.gore[num11].velocity.Y = Main.gore[num11].velocity.Y * 0.1f - this.velocity.Y * 0.05f;
num11 = Gore.NewGore(new Vector2(this.position.X - 36f, this.position.Y + (float)num9 - 16f), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(11, 14), 1f);
Main.gore[num11].velocity.X = Main.gore[num11].velocity.X * 0.1f - this.velocity.X * 0.1f;
Main.gore[num11].velocity.Y = Main.gore[num11].velocity.Y * 0.1f - this.velocity.Y * 0.05f;
num11 = Gore.NewGore(new Vector2(this.position.X + (float)this.width + 4f, this.position.Y + (float)num9 - 16f), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(11, 14), 1f);
Main.gore[num11].velocity.X = Main.gore[num11].velocity.X * 0.1f - this.velocity.X * 0.1f;
Main.gore[num11].velocity.Y = Main.gore[num11].velocity.Y * 0.1f - this.velocity.Y * 0.05f;
}
}
this.releaseJump = false;
return;
}
this.jump = 0;
this.releaseJump = true;
this.rocketRelease = true;
}
public void DashMovement()
{
if (this.dash == 2 && this.eocDash > 0)
{
if (this.eocHit < 0)
{
Rectangle rectangle = new 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 i = 0; i < 200; i++)
{
if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly)
{
NPC nPC = Main.npc[i];
Rectangle rect = nPC.getRect();
if (rectangle.Intersects(rect) && (nPC.noTileCollide || Collision.CanHit(this.position, this.width, this.height, nPC.position, nPC.width, nPC.height)))
{
float num = 30f * this.meleeDamage;
float num2 = 9f;
bool crit = false;
if (this.kbGlove)
{
num2 *= 2f;
}
if (this.kbBuff)
{
num2 *= 1.5f;
}
if (Main.rand.Next(100) < this.meleeCrit)
{
crit = true;
}
int num3 = this.direction;
if (this.velocity.X < 0f)
{
num3 = -1;
}
if (this.velocity.X > 0f)
{
num3 = 1;
}
nPC.StrikeNPC((int)num, num2, num3, crit, false, false);
this.eocDash = 10;
this.dashDelay = 30;
this.velocity.X = (float)(-(float)num3 * 9);
this.velocity.Y = -4f;
this.immune = true;
this.immuneTime = 4;
this.eocHit = i;
}
}
}
}
else if ((!this.controlLeft || this.velocity.X >= 0f) && (!this.controlRight || this.velocity.X <= 0f))
{
this.velocity.X = this.velocity.X * 0.95f;
}
}
if (this.dash == 3 && this.dashDelay < 0 && this.whoAmI == Main.myPlayer)
{
Rectangle rectangle2 = new 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 j = 0; j < 200; j++)
{
if (Main.npc[j].active && !Main.npc[j].dontTakeDamage && !Main.npc[j].friendly && Main.npc[j].immune[this.whoAmI] <= 0)
{
NPC nPC2 = Main.npc[j];
Rectangle rect2 = nPC2.getRect();
if (rectangle2.Intersects(rect2) && (nPC2.noTileCollide || Collision.CanHit(this.position, this.width, this.height, nPC2.position, nPC2.width, nPC2.height)))
{
float num4 = 150f * this.meleeDamage;
float num5 = 9f;
bool crit2 = false;
if (this.kbGlove)
{
num5 *= 2f;
}
if (this.kbBuff)
{
num5 *= 1.5f;
}
if (Main.rand.Next(100) < this.meleeCrit)
{
crit2 = true;
}
int hitDirection = this.direction;
if (this.velocity.X < 0f)
{
hitDirection = -1;
}
if (this.velocity.X > 0f)
{
hitDirection = 1;
}
nPC2.StrikeNPC((int)num4, num5, hitDirection, crit2, false, false);
nPC2.immune[this.whoAmI] = 6;
this.immune = true;
this.immuneTime = 4;
}
}
}
}
if (this.dashDelay > 0)
{
if (this.eocDash > 0)
{
this.eocDash--;
}
if (this.eocDash == 0)
{
this.eocHit = -1;
}
this.dashDelay--;
return;
}
if (this.dashDelay < 0)
{
float num6 = 12f;
float num7 = 0.992f;
float num8 = Math.Max(this.accRunSpeed, this.maxRunSpeed);
float num9 = 0.96f;
int num10 = 20;
if (this.dash == 1)
{
for (int k = 0; k < 2; k++)
{
int num11;
if (this.velocity.Y == 0f)
{
num11 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height - 4f), this.width, 8, 31, 0f, 0f, 100, default(Color), 1.4f);
}
else
{
num11 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2) - 8f), this.width, 16, 31, 0f, 0f, 100, default(Color), 1.4f);
}
Main.dust[num11].velocity *= 0.1f;
Main.dust[num11].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
Main.dust[num11].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this);
}
}
else if (this.dash == 2)
{
for (int l = 0; l < 0; l++)
{
int num12;
if (this.velocity.Y == 0f)
{
num12 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height - 4f), this.width, 8, 31, 0f, 0f, 100, default(Color), 1.4f);
}
else
{
num12 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2) - 8f), this.width, 16, 31, 0f, 0f, 100, default(Color), 1.4f);
}
Main.dust[num12].velocity *= 0.1f;
Main.dust[num12].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this);
}
num7 = 0.985f;
num9 = 0.94f;
num10 = 30;
}
else if (this.dash == 3)
{
for (int m = 0; m < 4; m++)
{
int num13 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 4f), this.width, this.height - 8, 6, 0f, 0f, 100, default(Color), 1.7f);
Main.dust[num13].velocity *= 0.1f;
Main.dust[num13].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
Main.dust[num13].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
Main.dust[num13].noGravity = true;
if (Main.rand.Next(2) == 0)
{
Main.dust[num13].fadeIn = 0.5f;
}
}
num6 = 14f;
num7 = 0.985f;
num9 = 0.94f;
num10 = 20;
}
else if (this.dash == 4)
{
for (int n = 0; n < 2; n++)
{
int num14 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 4f), this.width, this.height - 8, 229, 0f, 0f, 100, default(Color), 1.2f);
Main.dust[num14].velocity *= 0.1f;
Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
Main.dust[num14].noGravity = true;
if (Main.rand.Next(2) == 0)
{
Main.dust[num14].fadeIn = 0.3f;
}
}
num7 = 0.985f;
num9 = 0.94f;
num10 = 20;
}
if (this.dash > 0)
{
this.vortexStealthActive = false;
if (this.velocity.X > num6 || this.velocity.X < -num6)
{
this.velocity.X = this.velocity.X * num7;
return;
}
if (this.velocity.X > num8 || this.velocity.X < -num8)
{
this.velocity.X = this.velocity.X * num9;
return;
}
this.dashDelay = num10;
if (this.velocity.X < 0f)
{
this.velocity.X = -num8;
return;
}
if (this.velocity.X > 0f)
{
this.velocity.X = num8;
return;
}
}
}
else if (this.dash > 0 && !this.mount.Active)
{
if (this.dash == 1)
{
int num15 = 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)
{
num15 = 1;
flag = true;
this.dashTime = 0;
}
else
{
this.dashTime = 15;
}
}
else if (this.controlLeft && this.releaseLeft)
{
if (this.dashTime < 0)
{
num15 = -1;
flag = true;
this.dashTime = 0;
}
else
{
this.dashTime = -15;
}
}
if (flag)
{
this.velocity.X = 16.9f * (float)num15;
Point point = (base.Center + new Vector2((float)(num15 * this.width / 2 + 2), this.gravDir * (float)(-(float)this.height) / 2f + this.gravDir * 2f)).ToTileCoordinates();
Point point2 = (base.Center + new Vector2((float)(num15 * this.width / 2 + 2), 0f)).ToTileCoordinates();
if (WorldGen.SolidTile(point.X, point.Y) || WorldGen.SolidTile(point2.X, point2.Y))
{
this.velocity.X = this.velocity.X / 2f;
}
this.dashDelay = -1;
for (int num16 = 0; num16 < 20; num16++)
{
int num17 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 2f);
Dust expr_C95_cp_0 = Main.dust[num17];
expr_C95_cp_0.position.X = expr_C95_cp_0.position.X + (float)Main.rand.Next(-5, 6);
Dust expr_CBC_cp_0 = Main.dust[num17];
expr_CBC_cp_0.position.Y = expr_CBC_cp_0.position.Y + (float)Main.rand.Next(-5, 6);
Main.dust[num17].velocity *= 0.2f;
Main.dust[num17].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
Main.dust[num17].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this);
}
int num18 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 34f), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num18].velocity.X = (float)Main.rand.Next(-50, 51) * 0.01f;
Main.gore[num18].velocity.Y = (float)Main.rand.Next(-50, 51) * 0.01f;
Main.gore[num18].velocity *= 0.4f;
num18 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 14f), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num18].velocity.X = (float)Main.rand.Next(-50, 51) * 0.01f;
Main.gore[num18].velocity.Y = (float)Main.rand.Next(-50, 51) * 0.01f;
Main.gore[num18].velocity *= 0.4f;
return;
}
}
else if (this.dash == 2)
{
int num19 = 0;
bool flag2 = false;
if (this.dashTime > 0)
{
this.dashTime--;
}
if (this.dashTime < 0)
{
this.dashTime++;
}
if (this.controlRight && this.releaseRight)
{
if (this.dashTime > 0)
{
num19 = 1;
flag2 = true;
this.dashTime = 0;
}
else
{
this.dashTime = 15;
}
}
else if (this.controlLeft && this.releaseLeft)
{
if (this.dashTime < 0)
{
num19 = -1;
flag2 = true;
this.dashTime = 0;
}
else
{
this.dashTime = -15;
}
}
if (flag2)
{
this.velocity.X = 14.5f * (float)num19;
Point point3 = (base.Center + new Vector2((float)(num19 * this.width / 2 + 2), this.gravDir * (float)(-(float)this.height) / 2f + this.gravDir * 2f)).ToTileCoordinates();
Point point4 = (base.Center + new Vector2((float)(num19 * this.width / 2 + 2), 0f)).ToTileCoordinates();
if (WorldGen.SolidTile(point3.X, point3.Y) || WorldGen.SolidTile(point4.X, point4.Y))
{
this.velocity.X = this.velocity.X / 2f;
}
this.dashDelay = -1;
this.eocDash = 15;
for (int num20 = 0; num20 < 0; num20++)
{
int num21 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 2f);
Dust expr_10C0_cp_0 = Main.dust[num21];
expr_10C0_cp_0.position.X = expr_10C0_cp_0.position.X + (float)Main.rand.Next(-5, 6);
Dust expr_10E7_cp_0 = Main.dust[num21];
expr_10E7_cp_0.position.Y = expr_10E7_cp_0.position.Y + (float)Main.rand.Next(-5, 6);
Main.dust[num21].velocity *= 0.2f;
Main.dust[num21].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
Main.dust[num21].shader = GameShaders.Armor.GetSecondaryShader(this.cShield, this);
}
return;
}
}
else if (this.dash == 3)
{
int num22 = 0;
bool flag3 = false;
if (this.dashTime > 0)
{
this.dashTime--;
}
if (this.dashTime < 0)
{
this.dashTime++;
}
if (this.controlRight && this.releaseRight)
{
if (this.dashTime > 0)
{
num22 = 1;
flag3 = true;
this.dashTime = 0;
this.ConsumeSolarFlare();
this.solarDashing = true;
}
else
{
this.dashTime = 15;
}
}
else if (this.controlLeft && this.releaseLeft)
{
if (this.dashTime < 0)
{
num22 = -1;
flag3 = true;
this.dashTime = 0;
this.ConsumeSolarFlare();
this.solarDashing = true;
}
else
{
this.dashTime = -15;
}
}
if (flag3)
{
this.velocity.X = 21.9f * (float)num22;
Point point5 = (base.Center + new Vector2((float)(num22 * this.width / 2 + 2), this.gravDir * (float)(-(float)this.height) / 2f + this.gravDir * 2f)).ToTileCoordinates();
Point point6 = (base.Center + new Vector2((float)(num22 * this.width / 2 + 2), 0f)).ToTileCoordinates();
if (WorldGen.SolidTile(point5.X, point5.Y) || WorldGen.SolidTile(point6.X, point6.Y))
{
this.velocity.X = this.velocity.X / 2f;
}
this.dashDelay = -1;
for (int num23 = 0; num23 < 20; num23++)
{
int num24 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2f);
Dust expr_1369_cp_0 = Main.dust[num24];
expr_1369_cp_0.position.X = expr_1369_cp_0.position.X + (float)Main.rand.Next(-5, 6);
Dust expr_1390_cp_0 = Main.dust[num24];
expr_1390_cp_0.position.Y = expr_1390_cp_0.position.Y + (float)Main.rand.Next(-5, 6);
Main.dust[num24].velocity *= 0.2f;
Main.dust[num24].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
Main.dust[num24].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
Main.dust[num24].noGravity = true;
Main.dust[num24].fadeIn = 0.5f;
}
return;
}
}
else if (this.dash == 4)
{
int num25 = 0;
bool flag4 = false;
if (this.dashTime > 0)
{
this.dashTime--;
}
if (this.dashTime < 0)
{
this.dashTime++;
}
if (this.controlRight && this.releaseRight)
{
if (this.dashTime > 0)
{
num25 = 1;
flag4 = true;
this.dashTime = 0;
this.ConsumeSolarFlare();
this.solarDashing = true;
}
else
{
this.dashTime = 15;
}
}
else if (this.controlLeft && this.releaseLeft)
{
if (this.dashTime < 0)
{
num25 = -1;
flag4 = true;
this.dashTime = 0;
this.ConsumeSolarFlare();
this.solarDashing = true;
}
else
{
this.dashTime = -15;
}
}
if (flag4)
{
this.velocity.X = 21.9f * (float)num25;
this.dashDelay = -1;
Point point7 = (base.Center + new Vector2((float)(num25 * this.width / 2 + 2 * num25), this.gravDir * (float)(-(float)this.height) / 2f + this.gravDir * 2f)).ToTileCoordinates();
Point point8 = (base.Center + new Vector2((float)(num25 * this.width / 2 + 2), 0f)).ToTileCoordinates();
if (WorldGen.SolidTile(point7.X, point7.Y) || WorldGen.SolidTile(point8.X, point8.Y))
{
this.velocity.X = this.velocity.X / 2f;
}
for (int num26 = 0; num26 < 20; num26++)
{
int num27 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, 0f, 0f, 100, default(Color), 2f);
Dust expr_163A_cp_0 = Main.dust[num27];
expr_163A_cp_0.position.X = expr_163A_cp_0.position.X + (float)Main.rand.Next(-5, 6);
Dust expr_1661_cp_0 = Main.dust[num27];
expr_1661_cp_0.position.Y = expr_1661_cp_0.position.Y + (float)Main.rand.Next(-5, 6);
Main.dust[num27].velocity *= 0.2f;
Main.dust[num27].scale *= 1f + (float)Main.rand.Next(20) * 0.01f;
Main.dust[num27].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
Main.dust[num27].noGravity = true;
Main.dust[num27].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)))
{
bool flag = false;
float num = this.position.X;
if (this.slideDir == 1)
{
num += (float)this.width;
}
num += (float)this.slideDir;
float num2 = this.position.Y + (float)this.height + 1f;
if (this.gravDir < 0f)
{
num2 = this.position.Y - 1f;
}
num /= 16f;
num2 /= 16f;
if (WorldGen.SolidTile((int)num, (int)num2) && WorldGen.SolidTile((int)num, (int)num2 - 1))
{
flag = true;
}
if (this.spikedBoots >= 2)
{
if (flag && ((this.velocity.Y > 0f && this.gravDir == 1f) || (this.velocity.Y < this.gravity && this.gravDir == -1f)))
{
float num3 = this.gravity;
if (this.slowFall)
{
if (this.controlUp)
{
num3 = this.gravity / 10f * this.gravDir;
}
else
{
num3 = this.gravity / 3f * this.gravDir;
}
}
this.fallStart = (int)(this.position.Y / 16f);
if ((this.controlDown && this.gravDir == 1f) || (this.controlUp && this.gravDir == -1f))
{
this.velocity.Y = 4f * this.gravDir;
int num4 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)((this.width / 2 - 4) * this.slideDir), this.position.Y + (float)(this.height / 2) + (float)(this.height / 2 - 4) * this.gravDir), 8, 8, 31, 0f, 0f, 0, default(Color), 1f);
if (this.slideDir < 0)
{
Dust expr_26B_cp_0 = Main.dust[num4];
expr_26B_cp_0.position.X = expr_26B_cp_0.position.X - 10f;
}
if (this.gravDir < 0f)
{
Dust expr_296_cp_0 = Main.dust[num4];
expr_296_cp_0.position.Y = expr_296_cp_0.position.Y - 12f;
}
Main.dust[num4].velocity *= 0.1f;
Main.dust[num4].scale *= 1.2f;
Main.dust[num4].noGravity = true;
Main.dust[num4].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this);
}
else if (this.gravDir == -1f)
{
this.velocity.Y = (-num3 + 1E-05f) * this.gravDir;
}
else
{
this.velocity.Y = (-num3 + 1E-05f) * this.gravDir;
}
this.sliding = true;
return;
}
}
else if ((flag && (double)this.velocity.Y > 0.5 && this.gravDir == 1f) || ((double)this.velocity.Y < -0.5 && this.gravDir == -1f))
{
this.fallStart = (int)(this.position.Y / 16f);
if (this.controlDown)
{
this.velocity.Y = 4f * this.gravDir;
}
else
{
this.velocity.Y = 0.5f * this.gravDir;
}
this.sliding = true;
int num5 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)((this.width / 2 - 4) * this.slideDir), this.position.Y + (float)(this.height / 2) + (float)(this.height / 2 - 4) * this.gravDir), 8, 8, 31, 0f, 0f, 0, default(Color), 1f);
if (this.slideDir < 0)
{
Dust expr_48E_cp_0 = Main.dust[num5];
expr_48E_cp_0.position.X = expr_48E_cp_0.position.X - 10f;
}
if (this.gravDir < 0f)
{
Dust expr_4B9_cp_0 = Main.dust[num5];
expr_4B9_cp_0.position.Y = expr_4B9_cp_0.position.Y - 12f;
}
Main.dust[num5].velocity *= 0.1f;
Main.dust[num5].scale *= 1.2f;
Main.dust[num5].noGravity = true;
Main.dust[num5].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 && this.velocity.Y != 0f && this.rocketTime == 0 && this.wingTime == 0f && !this.mount.Active)
{
if (this.controlJump && this.canCarpet)
{
this.canCarpet = false;
this.carpetTime = 300;
}
if (this.carpetTime > 0 && this.controlJump)
{
this.fallStart = (int)(this.position.Y / 16f);
flag = true;
this.carpetTime--;
float num = this.gravity;
if (this.gravDir == 1f && this.velocity.Y > -num)
{
this.velocity.Y = -(num + 1E-06f);
}
else if (this.gravDir == -1f && this.velocity.Y < num)
{
this.velocity.Y = num + 1E-06f;
}
this.carpetFrameCounter += 1f + Math.Abs(this.velocity.X * 0.5f);
if (this.carpetFrameCounter > 8f)
{
this.carpetFrameCounter = 0f;
this.carpetFrame++;
}
if (this.carpetFrame < 0)
{
this.carpetFrame = 0;
}
if (this.carpetFrame > 5)
{
this.carpetFrame = 0;
}
}
}
if (!flag)
{
this.carpetFrame = -1;
return;
}
this.slowFall = false;
}
public void DoubleJumpVisuals()
{
if (this.dJumpEffectCloud && this.doubleJumpCloud && !this.jumpAgainCloud && (this.jumpAgainSandstorm || !this.doubleJumpSandstorm) && ((this.gravDir == 1f && this.velocity.Y < 0f) || (this.gravDir == -1f && this.velocity.Y > 0f)))
{
int num = this.height;
if (this.gravDir == -1f)
{
num = -6;
}
int num2 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float)num), this.width + 8, 4, 16, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 100, default(Color), 1.5f);
Main.dust[num2].velocity.X = Main.dust[num2].velocity.X * 0.5f - this.velocity.X * 0.1f;
Main.dust[num2].velocity.Y = Main.dust[num2].velocity.Y * 0.5f - this.velocity.Y * 0.3f;
}
if (this.dJumpEffectSandstorm && this.doubleJumpSandstorm && !this.jumpAgainSandstorm && ((this.gravDir == 1f && this.velocity.Y < 0f) || (this.gravDir == -1f && this.velocity.Y > 0f)))
{
int num3 = this.height;
if (this.gravDir == -1f)
{
num3 = -6;
}
float num4 = ((float)this.jump / 75f + 1f) / 2f;
for (int i = 0; i < 3; i++)
{
int num5 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)(num3 / 2)), this.width, 32, 124, this.velocity.X * 0.3f, this.velocity.Y * 0.3f, 150, default(Color), 1f * num4);
Main.dust[num5].velocity *= 0.5f * num4;
Main.dust[num5].fadeIn = 1.5f * num4;
}
this.sandStorm = true;
if (this.miscCounter % 3 == 0)
{
int num6 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 18f, this.position.Y + (float)(num3 / 2)), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(220, 223), num4);
Main.gore[num6].velocity = this.velocity * 0.3f * num4;
Main.gore[num6].alpha = 100;
}
}
if (this.dJumpEffectFart && this.doubleJumpFart && !this.jumpAgainFart && ((this.gravDir == 1f && this.velocity.Y < 0f) || (this.gravDir == -1f && this.velocity.Y > 0f)))
{
int num7 = this.height;
if (this.gravDir == -1f)
{
num7 = -6;
}
int num8 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float)num7), this.width + 8, 4, 188, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 100, default(Color), 1.5f);
Main.dust[num8].velocity.X = Main.dust[num8].velocity.X * 0.5f - this.velocity.X * 0.1f;
Main.dust[num8].velocity.Y = Main.dust[num8].velocity.Y * 0.5f - this.velocity.Y * 0.3f;
Main.dust[num8].velocity *= 0.5f;
}
if (this.dJumpEffectUnicorn && this.doubleJumpUnicorn && !this.jumpAgainUnicorn && ((this.gravDir == 1f && this.velocity.Y < 0f) || (this.gravDir == -1f && this.velocity.Y > 0f)))
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Utils.SelectRandom<int>(Main.rand, new int[]
{
176,
177,
179
}), 0f, 0f, 0, default(Color), 1f)];
dust.velocity = Vector2.Zero;
dust.noGravity = true;
dust.scale = 0.5f + Main.rand.NextFloat() * 0.8f;
dust.fadeIn = 1f + Main.rand.NextFloat() * 2f;
dust.shader = GameShaders.Armor.GetSecondaryShader(this.cMount, this);
}
if (this.dJumpEffectSail && this.doubleJumpSail && !this.jumpAgainSail && ((this.gravDir == 1f && this.velocity.Y < 1f) || (this.gravDir == -1f && this.velocity.Y > 1f)))
{
int num9 = 1;
if (this.jump > 0)
{
num9 = 2;
}
int num10 = this.height - 6;
if (this.gravDir == -1f)
{
num10 = 6;
}
for (int j = 0; j < num9; j++)
{
int num11 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)num10), this.width, 12, 253, this.velocity.X * 0.3f, this.velocity.Y * 0.3f, 100, default(Color), 1.5f);
Main.dust[num11].scale += (float)Main.rand.Next(-5, 3) * 0.1f;
if (this.jump <= 0)
{
Main.dust[num11].scale *= 0.8f;
}
else
{
Main.dust[num11].velocity -= this.velocity / 5f;
}
Main.dust[num11].noGravity = true;
Vector2 value = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
value.Normalize();
value *= (float)Main.rand.Next(81) * 0.1f;
}
}
if (this.dJumpEffectBlizzard && this.doubleJumpBlizzard && !this.jumpAgainBlizzard && ((this.gravDir == 1f && this.velocity.Y < 0f) || (this.gravDir == -1f && this.velocity.Y > 0f)))
{
int num12 = this.height - 6;
if (this.gravDir == -1f)
{
num12 = 6;
}
for (int k = 0; k < 2; k++)
{
int num13 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)num12), this.width, 12, 76, this.velocity.X * 0.3f, this.velocity.Y * 0.3f, 0, default(Color), 1f);
Main.dust[num13].velocity *= 0.1f;
if (k == 0)
{
Main.dust[num13].velocity += this.velocity * 0.03f;
}
else
{
Main.dust[num13].velocity -= this.velocity * 0.03f;
}
Main.dust[num13].noLight = true;
}
for (int l = 0; l < 3; l++)
{
int num14 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)num12), this.width, 12, 76, this.velocity.X * 0.3f, this.velocity.Y * 0.3f, 0, default(Color), 1f);
Main.dust[num14].fadeIn = 1.5f;
Main.dust[num14].velocity *= 0.6f;
Main.dust[num14].velocity += this.velocity * 0.8f;
Main.dust[num14].noGravity = true;
Main.dust[num14].noLight = true;
}
for (int m = 0; m < 3; m++)
{
int num15 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)num12), this.width, 12, 76, this.velocity.X * 0.3f, this.velocity.Y * 0.3f, 0, default(Color), 1f);
Main.dust[num15].fadeIn = 1.5f;
Main.dust[num15].velocity *= 0.6f;
Main.dust[num15].velocity -= this.velocity * 0.8f;
Main.dust[num15].noGravity = true;
Main.dust[num15].noLight = true;
}
}
}
public void WingMovement()
{
if (this.wingsLogic == 4 && this.controlUp)
{
this.velocity.Y = this.velocity.Y - 0.2f * this.gravDir;
if (this.gravDir == 1f)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y - 1f;
}
else if (this.velocity.Y > -Player.jumpSpeed)
{
this.velocity.Y = this.velocity.Y - 0.2f;
}
if (this.velocity.Y < -Player.jumpSpeed * 3f)
{
this.velocity.Y = -Player.jumpSpeed * 3f;
}
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y + 1f;
}
else if (this.velocity.Y < Player.jumpSpeed)
{
this.velocity.Y = this.velocity.Y + 0.2f;
}
if (this.velocity.Y > Player.jumpSpeed * 3f)
{
this.velocity.Y = Player.jumpSpeed * 3f;
}
}
this.wingTime -= 2f;
return;
}
float num = 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;
num = 0.125f;
}
if (this.wingsLogic == 29)
{
num2 = 0.85f;
num5 = 0.15f;
num4 = 1f;
num3 = 3f;
num = 0.135f;
}
if (this.wingsLogic == 30)
{
num4 = 1f;
num3 = 2f;
num = 0.15f;
}
if (this.wingsLogic == 31)
{
num2 = 0.75f;
num5 = 0.15f;
num4 = 1f;
num3 = 3f;
num = 0.125f;
}
if (this.wingsLogic == 32)
{
num4 = 0.6f;
num3 = 1.5f;
num = 0.125f;
}
this.velocity.Y = this.velocity.Y - num * this.gravDir;
if (this.gravDir == 1f)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y - num2;
}
else if (this.velocity.Y > -Player.jumpSpeed * num4)
{
this.velocity.Y = this.velocity.Y - num5;
}
if (this.velocity.Y < -Player.jumpSpeed * num3)
{
this.velocity.Y = -Player.jumpSpeed * num3;
}
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y + num2;
}
else if (this.velocity.Y < Player.jumpSpeed * num4)
{
this.velocity.Y = this.velocity.Y + num5;
}
if (this.velocity.Y > Player.jumpSpeed * num3)
{
this.velocity.Y = Player.jumpSpeed * num3;
}
}
if ((this.wingsLogic == 22 || this.wingsLogic == 28 || this.wingsLogic == 30 || this.wingsLogic == 32) && this.controlDown && !this.controlLeft && !this.controlRight)
{
this.wingTime -= 0.5f;
return;
}
this.wingTime -= 1f;
}
public void MoonLeechRope()
{
int num = -1;
for (int i = 0; i < 1000; i++)
{
if (Main.projectile[i].active && Main.projectile[i].type == 456 && Main.projectile[i].ai[1] == (float)this.whoAmI)
{
num = i;
break;
}
}
if (num == -1)
{
return;
}
if (Main.projectile[num].ai[0] < 0f)
{
return;
}
Projectile projectile = Main.projectile[num];
Vector2 value = new Vector2(0f, 216f);
Vector2 value2 = Main.npc[(int)Math.Abs(projectile.ai[0]) - 1].Center - base.Center + value;
if (value2.Length() > 200f)
{
Vector2 value3 = Vector2.Normalize(value2);
this.position += value3 * (value2.Length() - 200f);
}
}
public void WOFTongue()
{
if (Main.wof >= 0 && Main.npc[Main.wof].active)
{
float num = Main.npc[Main.wof].position.X + 40f;
if (Main.npc[Main.wof].direction > 0)
{
num -= 96f;
}
if (this.position.X + (float)this.width > num && this.position.X < num + 140f && this.gross)
{
this.noKnockback = false;
this.Hurt(50, Main.npc[Main.wof].direction, false, false, " was slain...", false);
}
if (!this.gross && this.position.Y > (float)((Main.maxTilesY - 250) * 16) && this.position.X > num - 1920f && this.position.X < num + 1920f)
{
this.AddBuff(37, 10, true);
Main.PlaySound(4, (int)Main.npc[Main.wof].position.X, (int)Main.npc[Main.wof].position.Y, 10);
}
if (this.gross)
{
if (this.position.Y < (float)((Main.maxTilesY - 200) * 16))
{
this.AddBuff(38, 10, true);
}
if (Main.npc[Main.wof].direction < 0)
{
if (this.position.X + (float)(this.width / 2) > Main.npc[Main.wof].position.X + (float)(Main.npc[Main.wof].width / 2) + 40f)
{
this.AddBuff(38, 10, true);
}
}
else if (this.position.X + (float)(this.width / 2) < Main.npc[Main.wof].position.X + (float)(Main.npc[Main.wof].width / 2) - 40f)
{
this.AddBuff(38, 10, true);
}
}
if (this.tongued)
{
this.controlHook = false;
this.controlUseItem = false;
for (int i = 0; i < 1000; i++)
{
if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].aiStyle == 7)
{
Main.projectile[i].Kill();
}
}
Vector2 vector = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num2 = Main.npc[Main.wof].position.X + (float)(Main.npc[Main.wof].width / 2) - vector.X;
float num3 = Main.npc[Main.wof].position.Y + (float)(Main.npc[Main.wof].height / 2) - vector.Y;
float num4 = (float)Math.Sqrt((double)(num2 * num2 + num3 * num3));
if (num4 > 3000f)
{
this.KillMe(1000.0, 0, false, " tried to escape.");
return;
}
if (Main.npc[Main.wof].position.X < 608f || Main.npc[Main.wof].position.X > (float)((Main.maxTilesX - 38) * 16))
{
this.KillMe(1000.0, 0, false, " was licked.");
}
}
}
}
public void StatusPlayer(NPC npc)
{
if (Main.expertMode && ((npc.type == 266 && Main.rand.Next(3) == 0) || npc.type == 267))
{
int num = Main.rand.Next(9);
if (num == 2 || num == 4)
{
num = Main.rand.Next(9);
}
float num2 = (float)Main.rand.Next(75, 150) * 0.01f;
if (num == 0)
{
this.AddBuff(20, (int)(60f * num2 * 3.5f), true);
}
else if (num == 1)
{
this.AddBuff(22, (int)(60f * num2 * 2f), true);
}
else if (num == 2)
{
this.AddBuff(23, (int)(60f * num2 * 0.5f), true);
}
else if (num == 3)
{
this.AddBuff(30, (int)(60f * num2 * 5f), true);
}
else if (num == 4)
{
this.AddBuff(31, (int)(60f * num2 * 1f), true);
}
else if (num == 5)
{
this.AddBuff(32, (int)(60f * num2 * 3.5f), true);
}
else if (num == 6)
{
this.AddBuff(33, (int)(60f * num2 * 7.5f), true);
}
else if (num == 7)
{
this.AddBuff(35, (int)(60f * num2 * 1f), true);
}
else if (num == 8)
{
this.AddBuff(36, (int)((double)(60f * num2) * 6.5), true);
}
}
if (npc.type == 159 || npc.type == 158)
{
this.AddBuff(30, Main.rand.Next(300, 600), true);
}
if (npc.type == 525)
{
this.AddBuff(39, 420, true);
}
if (npc.type == 526)
{
this.AddBuff(69, 420, true);
}
if (npc.type == 527)
{
this.AddBuff(31, 840, true);
}
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), true);
}
if (Main.expertMode && npc.type == 222)
{
this.AddBuff(20, Main.rand.Next(60, 240), true);
}
if (Main.expertMode && (npc.type == 210 || npc.type == 211))
{
this.AddBuff(20, Main.rand.Next(60, 180), true);
}
if (Main.expertMode && npc.type == 35)
{
this.AddBuff(30, Main.rand.Next(180, 300), true);
}
if (Main.expertMode && npc.type == 36 && Main.rand.Next(2) == 0)
{
this.AddBuff(32, Main.rand.Next(30, 60), true);
}
if (npc.type >= 269 && npc.type <= 272)
{
if (Main.rand.Next(3) == 0)
{
this.AddBuff(30, 600, true);
}
else if (Main.rand.Next(3) == 0)
{
this.AddBuff(32, 300, true);
}
}
if (npc.type >= 273 && npc.type <= 276 && Main.rand.Next(2) == 0)
{
this.AddBuff(36, 600, true);
}
if (npc.type >= 277 && npc.type <= 280)
{
this.AddBuff(24, 600, true);
}
if (npc.type == 371)
{
this.AddBuff(103, 60 * Main.rand.Next(3, 8), true);
}
if (npc.type == 370 && Main.expertMode)
{
int num3 = Utils.SelectRandom<int>(Main.rand, new int[]
{
0,
148,
30
});
if (num3 != 0)
{
this.AddBuff(num3, 60 * Main.rand.Next(3, 11), true);
}
}
if (((npc.type == 1 && npc.name == "Black Slime") || npc.type == 81 || npc.type == 79) && Main.rand.Next(4) == 0)
{
this.AddBuff(22, 900, true);
}
if ((npc.type == 23 || npc.type == 25) && Main.rand.Next(3) == 0)
{
this.AddBuff(24, 420, true);
}
if ((npc.type == 34 || npc.type == 83 || npc.type == 84) && Main.rand.Next(3) == 0)
{
this.AddBuff(23, 240, true);
}
if ((npc.type == 104 || npc.type == 102) && Main.rand.Next(8) == 0)
{
this.AddBuff(30, 2700, true);
}
if (npc.type == 75 && Main.rand.Next(10) == 0)
{
this.AddBuff(35, 420, true);
}
if ((npc.type == 163 || npc.type == 238) && Main.rand.Next(10) == 0)
{
this.AddBuff(70, 480, true);
}
if ((npc.type == 79 || npc.type == 103) && Main.rand.Next(5) == 0)
{
this.AddBuff(35, 420, true);
}
if ((npc.type == 75 || npc.type == 78 || npc.type == 82) && Main.rand.Next(8) == 0)
{
this.AddBuff(32, 900, true);
}
if ((npc.type == 93 || npc.type == 109 || npc.type == 80) && Main.rand.Next(14) == 0)
{
this.AddBuff(31, 300, true);
}
if (npc.type >= 305 && npc.type <= 314 && Main.rand.Next(10) == 0)
{
this.AddBuff(33, 3600, true);
}
if (npc.type == 77 && Main.rand.Next(6) == 0)
{
this.AddBuff(36, 7200, true);
}
if (npc.type == 112 && Main.rand.Next(20) == 0)
{
this.AddBuff(33, 18000, true);
}
if (npc.type == 182 && Main.rand.Next(25) == 0)
{
this.AddBuff(33, 7200, true);
}
if (npc.type == 141 && Main.rand.Next(2) == 0)
{
this.AddBuff(20, 600, true);
}
if (npc.type == 147 && !this.frozen && Main.rand.Next(12) == 0)
{
this.AddBuff(46, 600, true);
}
if (npc.type == 150)
{
if (Main.rand.Next(2) == 0)
{
this.AddBuff(46, 900, true);
}
if (!this.frozen && Main.rand.Next(35) == 0)
{
this.AddBuff(47, 60, true);
}
else if (!this.frozen && Main.expertMode && Main.rand.Next(35) == 0)
{
this.AddBuff(47, 60, true);
}
}
if (npc.type == 184)
{
this.AddBuff(46, 1200, true);
if (!this.frozen && Main.rand.Next(15) == 0)
{
this.AddBuff(47, 60, true);
return;
}
if (!this.frozen && Main.expertMode && Main.rand.Next(25) == 0)
{
this.AddBuff(47, 60, true);
}
}
}
public void GrappleMovement()
{
if (this.grappling[0] >= 0)
{
if (Main.myPlayer == this.whoAmI && this.mount.Active)
{
this.mount.Dismount(this);
}
this.canCarpet = true;
this.carpetFrame = -1;
this.wingFrame = 1;
if (this.velocity.Y == 0f || (this.wet && (double)this.velocity.Y > -0.02 && (double)this.velocity.Y < 0.02))
{
this.wingFrame = 0;
}
if (this.wings == 4)
{
this.wingFrame = 3;
}
this.wingTime = (float)this.wingTimeMax;
this.rocketTime = this.rocketTimeMax;
this.rocketDelay = 0;
this.rocketFrame = false;
this.canRocket = false;
this.rocketRelease = false;
this.fallStart = (int)(this.position.Y / 16f);
int num = -1;
float num2 = 0f;
float num3 = 0f;
for (int i = 0; i < this.grapCount; i++)
{
Projectile projectile = Main.projectile[this.grappling[i]];
num2 += projectile.position.X + (float)(projectile.width / 2);
num3 += projectile.position.Y + (float)(projectile.height / 2);
if (projectile.type == 403)
{
num = i;
}
else if (projectile.type == 446)
{
Vector2 vector = new Vector2((float)(this.controlRight.ToInt() - this.controlLeft.ToInt()), (float)(this.controlDown.ToInt() - this.controlUp.ToInt()));
if (vector != Vector2.Zero)
{
vector.Normalize();
}
vector *= 100f;
Vector2 vector2 = Vector2.Normalize(base.Center - projectile.Center + vector);
if (float.IsNaN(vector2.X) || float.IsNaN(vector2.Y))
{
vector2 = -Vector2.UnitY;
}
float num4 = 200f;
num2 += vector2.X * num4;
num3 += vector2.Y * num4;
}
}
num2 /= (float)this.grapCount;
num3 /= (float)this.grapCount;
Vector2 vector3 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num5 = num2 - vector3.X;
float num6 = num3 - vector3.Y;
float num7 = (float)Math.Sqrt((double)(num5 * num5 + num6 * num6));
float num8 = 11f;
if (Main.projectile[this.grappling[0]].type == 315)
{
num8 = 16f;
}
if (Main.projectile[this.grappling[0]].type >= 646 && Main.projectile[this.grappling[0]].type <= 649)
{
num8 = 13f;
}
float num9;
if (num7 > num8)
{
num9 = num8 / num7;
}
else
{
num9 = 1f;
}
num5 *= num9;
num6 *= num9;
if (num6 > 0f)
{
this.GoingDownWithGrapple = true;
}
this.velocity.X = num5;
this.velocity.Y = num6;
if (num != -1)
{
Projectile projectile2 = Main.projectile[this.grappling[num]];
if (projectile2.position.X < this.position.X + (float)this.width && projectile2.position.X + (float)projectile2.width >= this.position.X && projectile2.position.Y < this.position.Y + (float)this.height && projectile2.position.Y + (float)projectile2.height >= this.position.Y)
{
int num10 = (int)(projectile2.position.X + (float)(projectile2.width / 2)) / 16;
int num11 = (int)(projectile2.position.Y + (float)(projectile2.height / 2)) / 16;
this.velocity = Vector2.Zero;
if (Main.tile[num10, num11].type == 314)
{
Vector2 position;
position.X = projectile2.position.X + (float)(projectile2.width / 2) - (float)(this.width / 2);
position.Y = projectile2.position.Y + (float)(projectile2.height / 2) - (float)(this.height / 2);
this.grappling[0] = -1;
this.grapCount = 0;
for (int j = 0; j < 1000; j++)
{
if (Main.projectile[j].active && Main.projectile[j].owner == this.whoAmI && Main.projectile[j].aiStyle == 7)
{
Main.projectile[j].Kill();
}
}
int num12 = 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))
{
num12 = this.miscEquips[2].mountType;
}
int num13 = this.height + Mount.GetHeightBoost(num12);
if (Minecart.GetOnTrack(num10, num11, ref position, this.width, num13) && !Collision.SolidCollision(position, this.width, num13 - 20))
{
this.position = position;
DelegateMethods.Minecart.rotation = this.fullRotation;
DelegateMethods.Minecart.rotationOrigin = this.fullRotationOrigin;
this.mount.SetMount(num12, this, this.minecartLeft);
Minecart.WheelSparks(this.mount.MinecartDust, this.position, this.width, this.height, 25);
}
}
}
}
if (this.itemAnimation == 0)
{
if (this.velocity.X > 0f)
{
this.ChangeDir(1);
}
if (this.velocity.X < 0f)
{
this.ChangeDir(-1);
}
}
if (this.controlJump)
{
if (this.releaseJump)
{
if ((this.velocity.Y == 0f || (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 = 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 k = 0; k < 1000; k++)
{
if (Main.projectile[k].active && Main.projectile[k].owner == this.whoAmI && Main.projectile[k].aiStyle == 7)
{
Main.projectile[k].Kill();
}
}
return;
}
}
else
{
this.releaseJump = true;
}
}
}
public void StickyMovement()
{
bool flag = false;
if (this.mount.Type == 6 && Math.Abs(this.velocity.X) > 5f)
{
flag = true;
}
if (this.mount.Type == 13 && Math.Abs(this.velocity.X) > 5f)
{
flag = true;
}
if (this.mount.Type == 11 && Math.Abs(this.velocity.X) > 5f)
{
flag = true;
}
int num = this.width / 2;
int num2 = this.height / 2;
new Vector2(this.position.X + (float)(this.width / 2) - (float)(num / 2), this.position.Y + (float)(this.height / 2) - (float)(num2 / 2));
Vector2 vector = Collision.StickyTiles(this.position, this.velocity, this.width, this.height);
if (vector.Y != -1f && vector.X != -1f)
{
int num3 = (int)vector.X;
int num4 = (int)vector.Y;
int type = (int)Main.tile[num3, num4].type;
if (this.whoAmI == Main.myPlayer && type == 51 && (this.velocity.X != 0f || this.velocity.Y != 0f))
{
this.stickyBreak++;
if (this.stickyBreak > Main.rand.Next(20, 100) || flag)
{
this.stickyBreak = 0;
WorldGen.KillTile(num3, num4, false, false, false);
if (Main.netMode == 1 && !Main.tile[num3, num4].active() && Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 0, (float)num3, (float)num4, 0f, 0, 0, 0);
}
}
}
if (flag)
{
return;
}
this.fallStart = (int)(this.position.Y / 16f);
if (type != 229)
{
this.jump = 0;
}
if (this.velocity.X > 1f)
{
this.velocity.X = 1f;
}
if (this.velocity.X < -1f)
{
this.velocity.X = -1f;
}
if (this.velocity.Y > 1f)
{
this.velocity.Y = 1f;
}
if (this.velocity.Y < -5f)
{
this.velocity.Y = -5f;
}
if ((double)this.velocity.X > 0.75 || (double)this.velocity.X < -0.75)
{
this.velocity.X = this.velocity.X * 0.85f;
}
else
{
this.velocity.X = this.velocity.X * 0.6f;
}
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
else
{
this.velocity.Y = this.velocity.Y * 0.3f;
}
if (type == 229 && Main.rand.Next(5) == 0 && ((double)this.velocity.Y > 0.15 || this.velocity.Y < 0f))
{
if ((float)(num3 * 16) < this.position.X + (float)(this.width / 2))
{
int num5 = Dust.NewDust(new Vector2(this.position.X - 4f, (float)(num4 * 16)), 4, 16, 153, 0f, 0f, 50, default(Color), 1f);
Main.dust[num5].scale += (float)Main.rand.Next(0, 6) * 0.1f;
Main.dust[num5].velocity *= 0.1f;
Main.dust[num5].noGravity = true;
}
else
{
int num6 = Dust.NewDust(new Vector2(this.position.X + (float)this.width - 2f, (float)(num4 * 16)), 4, 16, 153, 0f, 0f, 50, default(Color), 1f);
Main.dust[num6].scale += (float)Main.rand.Next(0, 6) * 0.1f;
Main.dust[num6].velocity *= 0.1f;
Main.dust[num6].noGravity = true;
}
if (Main.tile[num3, num4 + 1] != null && Main.tile[num3, num4 + 1].type == 229 && this.position.Y + (float)this.height > (float)((num4 + 1) * 16))
{
if ((float)(num3 * 16) < this.position.X + (float)(this.width / 2))
{
int num7 = Dust.NewDust(new Vector2(this.position.X - 4f, (float)(num4 * 16 + 16)), 4, 16, 153, 0f, 0f, 50, default(Color), 1f);
Main.dust[num7].scale += (float)Main.rand.Next(0, 6) * 0.1f;
Main.dust[num7].velocity *= 0.1f;
Main.dust[num7].noGravity = true;
}
else
{
int num8 = Dust.NewDust(new Vector2(this.position.X + (float)this.width - 2f, (float)(num4 * 16 + 16)), 4, 16, 153, 0f, 0f, 50, default(Color), 1f);
Main.dust[num8].scale += (float)Main.rand.Next(0, 6) * 0.1f;
Main.dust[num8].velocity *= 0.1f;
Main.dust[num8].noGravity = true;
}
}
if (Main.tile[num3, num4 + 2] != null && Main.tile[num3, num4 + 2].type == 229 && this.position.Y + (float)this.height > (float)((num4 + 2) * 16))
{
if ((float)(num3 * 16) < this.position.X + (float)(this.width / 2))
{
int num9 = Dust.NewDust(new Vector2(this.position.X - 4f, (float)(num4 * 16 + 32)), 4, 16, 153, 0f, 0f, 50, default(Color), 1f);
Main.dust[num9].scale += (float)Main.rand.Next(0, 6) * 0.1f;
Main.dust[num9].velocity *= 0.1f;
Main.dust[num9].noGravity = true;
return;
}
int num10 = Dust.NewDust(new Vector2(this.position.X + (float)this.width - 2f, (float)(num4 * 16 + 32)), 4, 16, 153, 0f, 0f, 50, default(Color), 1f);
Main.dust[num10].scale += (float)Main.rand.Next(0, 6) * 0.1f;
Main.dust[num10].velocity *= 0.1f;
Main.dust[num10].noGravity = true;
return;
}
}
}
else
{
this.stickyBreak = 0;
}
}
public bool IsStackingItems()
{
for (int i = 0; i < this.inventoryChestStack.Length; i++)
{
if (this.inventoryChestStack[i])
{
if (this.inventory[i].type != 0 && this.inventory[i].stack != 0)
{
return true;
}
this.inventoryChestStack[i] = false;
}
}
return false;
}
public void QuickStackAllChests()
{
if (this.IsStackingItems())
{
return;
}
if (Main.netMode == 1)
{
for (int i = 10; i < 50; i++)
{
if (this.inventory[i].type > 0 && this.inventory[i].stack > 0 && !this.inventory[i].favorited)
{
NetMessage.SendData(5, -1, -1, "", this.whoAmI, (float)i, (float)this.inventory[i].prefix, 0f, 0, 0, 0);
NetMessage.SendData(85, -1, -1, "", i, 0f, 0f, 0f, 0, 0, 0);
this.inventoryChestStack[i] = true;
}
}
return;
}
bool flag = false;
for (int j = 10; j < 50; j++)
{
if (this.inventory[j].type > 0 && this.inventory[j].stack > 0 && !this.inventory[j].favorited)
{
int type = this.inventory[j].type;
int stack = this.inventory[j].stack;
this.inventory[j] = Chest.PutItemInNearbyChest(this.inventory[j], base.Center);
if (this.inventory[j].type != type || this.inventory[j].stack != stack)
{
flag = true;
}
}
}
if (flag)
{
Main.PlaySound(7, -1, -1, 1);
}
}
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 num = (int)((this.position.X + (float)(this.width / 2) + (float)(6 * this.direction)) / 16f);
int num2 = 0;
if (this.gravDir == -1f)
{
num2 = this.height;
}
int num3 = (int)((this.position.Y + (float)num2 - 44f * this.gravDir) / 16f);
if (Main.tile[num, num3].liquid < 128)
{
if (Main.tile[num, num3] == null)
{
Main.tile[num, num3] = new Tile();
}
if (!Main.tile[num, num3].active() || !Main.tileSolid[(int)Main.tile[num, num3].type] || Main.tileSolidTop[(int)Main.tile[num, num3].type])
{
flag = false;
}
}
}
catch
{
}
}
if (this.gills)
{
flag = false;
}
if (Main.myPlayer == this.whoAmI)
{
if (this.merman)
{
flag = false;
}
if (flag)
{
this.breathCD++;
int num4 = 7;
if (this.inventory[this.selectedItem].type == 186)
{
num4 *= 2;
}
if (this.accDivingHelm)
{
num4 *= 4;
}
if (this.breathCD >= num4)
{
this.breathCD = 0;
this.breath--;
if (this.breath == 0)
{
Main.PlaySound(23, -1, -1, 1);
}
if (this.breath <= 0)
{
this.lifeRegenTime = 0;
this.breath = 0;
this.statLife -= 2;
if (this.statLife <= 0)
{
this.statLife = 0;
this.KillMe(10.0, 0, false, Lang.deathMsg(-1, -1, -1, 1));
}
}
}
}
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)
{
int num5 = 0;
if (this.gravDir == -1f)
{
num5 += this.height - 12;
}
if (this.inventory[this.selectedItem].type == 186)
{
Dust.NewDust(new Vector2(this.position.X + (float)(10 * this.direction) + 4f, this.position.Y + (float)num5 - 54f * this.gravDir), this.width - 8, 8, 34, 0f, 0f, 0, default(Color), 1.2f);
return;
}
Dust.NewDust(new Vector2(this.position.X + (float)(12 * this.direction), this.position.Y + (float)num5 + 4f * this.gravDir), this.width - 8, 8, 34, 0f, 0f, 0, default(Color), 1.2f);
}
}
public void CheckIceBreak()
{
if (this.velocity.Y > 7f)
{
Vector2 vector = this.position + this.velocity;
int num = (int)(vector.X / 16f);
int num2 = (int)((vector.X + (float)this.width) / 16f);
int num3 = (int)((this.position.Y + (float)this.height + 1f) / 16f);
for (int i = num; i <= num2; i++)
{
for (int j = num3; j <= num3 + 1; j++)
{
if (Main.tile[i, j].nactive() && Main.tile[i, j].type == 162 && !WorldGen.SolidTile(i, j - 1))
{
WorldGen.KillTile(i, j, false, false, false);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 0, (float)i, (float)j, 0f, 0, 0, 0);
}
}
}
}
}
}
public void SlopeDownMovement()
{
this.sloping = false;
float y = this.velocity.Y;
Vector4 vector = Collision.WalkDownSlope(this.position, this.velocity, this.width, this.height, this.gravity * this.gravDir);
this.position.X = vector.X;
this.position.Y = vector.Y;
this.velocity.X = vector.Z;
this.velocity.Y = vector.W;
if (this.velocity.Y != y)
{
this.sloping = true;
}
}
public void HoneyCollision(bool fallThrough, bool ignorePlats)
{
int height;
if (this.onTrack)
{
height = this.height - 20;
}
else
{
height = this.height;
}
Vector2 velocity = this.velocity;
this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, height, fallThrough, ignorePlats, (int)this.gravDir);
Vector2 value = this.velocity * 0.25f;
if (this.velocity.X != velocity.X)
{
value.X = this.velocity.X;
}
if (this.velocity.Y != velocity.Y)
{
value.Y = this.velocity.Y;
}
this.position += value;
}
public void WaterCollision(bool fallThrough, bool ignorePlats)
{
int height;
if (this.onTrack)
{
height = this.height - 20;
}
else
{
height = this.height;
}
Vector2 velocity = this.velocity;
this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, height, fallThrough, ignorePlats, (int)this.gravDir);
Vector2 value = this.velocity * 0.5f;
if (this.velocity.X != velocity.X)
{
value.X = this.velocity.X;
}
if (this.velocity.Y != velocity.Y)
{
value.Y = this.velocity.Y;
}
this.position += value;
}
public void DryCollision(bool fallThrough, bool ignorePlats)
{
int height;
if (this.onTrack)
{
height = this.height - 10;
}
else
{
height = this.height;
}
this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, height, fallThrough, ignorePlats, (int)this.gravDir);
if (Collision.up && this.gravDir == 1f)
{
this.jump = 0;
}
if (this.waterWalk || this.waterWalk2)
{
Vector2 velocity = this.velocity;
this.velocity = Collision.WaterCollision(this.position, this.velocity, this.width, this.height, fallThrough, false, this.waterWalk);
if (velocity != this.velocity)
{
this.fallStart = (int)(this.position.Y / 16f);
}
}
this.position += this.velocity;
}
public void SlopingCollision(bool fallThrough)
{
if (this.controlDown || this.grappling[0] >= 0 || this.gravDir == -1f)
{
this.stairFall = true;
}
Vector4 vector = 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 && Math.Abs(vector.Y - this.position.Y) > 8f + Math.Abs(this.velocity.X))
{
this.gfxOffY -= vector.Y - this.position.Y;
this.stepSpeed = 4f;
}
float arg_D8_0 = this.velocity.Y;
this.position.X = vector.X;
this.position.Y = vector.Y;
this.velocity.X = vector.Z;
this.velocity.Y = vector.W;
if (this.gravDir == -1f && this.velocity.Y == 0.0101f)
{
this.velocity.Y = 0f;
}
}
public void FloorVisuals(bool Falling)
{
int num = (int)((this.position.X + (float)(this.width / 2)) / 16f);
int num2 = (int)((this.position.Y + (float)this.height) / 16f);
if (this.gravDir == -1f)
{
num2 = (int)(this.position.Y - 0.1f) / 16;
}
int num3 = -1;
if (Main.tile[num - 1, num2] == null)
{
Main.tile[num - 1, num2] = new Tile();
}
if (Main.tile[num + 1, num2] == null)
{
Main.tile[num + 1, num2] = new Tile();
}
if (Main.tile[num, num2] == null)
{
Main.tile[num, num2] = new Tile();
}
if (Main.tile[num, num2].nactive() && Main.tileSolid[(int)Main.tile[num, num2].type])
{
num3 = (int)Main.tile[num, num2].type;
}
else if (Main.tile[num - 1, num2].nactive() && Main.tileSolid[(int)Main.tile[num - 1, num2].type])
{
num3 = (int)Main.tile[num - 1, num2].type;
}
else if (Main.tile[num + 1, num2].nactive() && Main.tileSolid[(int)Main.tile[num + 1, num2].type])
{
num3 = (int)Main.tile[num + 1, num2].type;
}
if (num3 <= -1)
{
this.slippy = false;
this.slippy2 = false;
this.sticky = false;
this.powerrun = false;
return;
}
this.sticky = (num3 == 229);
this.slippy = (num3 == 161 || num3 == 162 || num3 == 163 || num3 == 164 || num3 == 200 || num3 == 127);
this.slippy2 = (num3 == 197);
this.powerrun = (num3 == 198);
if (Main.tile[num - 1, num2].slope() != 0 || Main.tile[num, num2].slope() != 0 || Main.tile[num + 1, num2].slope() != 0)
{
num3 = -1;
}
if (!this.wet && !this.mount.Cart && (num3 == 147 || num3 == 25 || num3 == 53 || num3 == 189 || num3 == 0 || num3 == 123 || num3 == 57 || num3 == 112 || num3 == 116 || num3 == 196 || num3 == 193 || num3 == 195 || num3 == 197 || num3 == 199 || num3 == 229 || num3 == 371))
{
int num4 = 1;
if (Falling)
{
num4 = 20;
}
for (int i = 0; i < num4; i++)
{
bool flag = true;
int num5 = 76;
if (num3 == 53)
{
num5 = 32;
}
if (num3 == 189)
{
num5 = 16;
}
if (num3 == 0)
{
num5 = 0;
}
if (num3 == 123)
{
num5 = 53;
}
if (num3 == 57)
{
num5 = 36;
}
if (num3 == 112)
{
num5 = 14;
}
if (num3 == 116)
{
num5 = 51;
}
if (num3 == 196)
{
num5 = 108;
}
if (num3 == 193)
{
num5 = 4;
}
if (num3 == 195 || num3 == 199)
{
num5 = 5;
}
if (num3 == 197)
{
num5 = 4;
}
if (num3 == 229)
{
num5 = 153;
}
if (num3 == 371)
{
num5 = 243;
}
if (num3 == 25)
{
num5 = 37;
}
if (num5 == 32 && Main.rand.Next(2) == 0)
{
flag = false;
}
if (num5 == 14 && Main.rand.Next(2) == 0)
{
flag = false;
}
if (num5 == 51 && Main.rand.Next(2) == 0)
{
flag = false;
}
if (num5 == 36 && Main.rand.Next(2) == 0)
{
flag = false;
}
if (num5 == 0 && Main.rand.Next(3) != 0)
{
flag = false;
}
if (num5 == 53 && Main.rand.Next(3) != 0)
{
flag = false;
}
Color newColor = default(Color);
if (num3 == 193)
{
newColor = new Color(30, 100, 255, 100);
}
if (num3 == 197)
{
newColor = new Color(97, 200, 255, 100);
}
if (!Falling)
{
float num6 = Math.Abs(this.velocity.X) / 3f;
if ((float)Main.rand.Next(100) > num6 * 100f)
{
flag = false;
}
}
if (flag)
{
float num7 = this.velocity.X;
if (num7 > 6f)
{
num7 = 6f;
}
if (num7 < -6f)
{
num7 = -6f;
}
if (this.velocity.X != 0f || Falling)
{
int num8 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height - 2f), this.width, 6, num5, 0f, 0f, 50, newColor, 1f);
if (this.gravDir == -1f)
{
Dust expr_530_cp_0 = Main.dust[num8];
expr_530_cp_0.position.Y = expr_530_cp_0.position.Y - (float)(this.height + 4);
}
if (num5 == 76)
{
Main.dust[num8].scale += (float)Main.rand.Next(3) * 0.1f;
Main.dust[num8].noLight = true;
}
if (num5 == 16 || num5 == 108 || num5 == 153)
{
Main.dust[num8].scale += (float)Main.rand.Next(6) * 0.1f;
}
if (num5 == 37)
{
Main.dust[num8].scale += 0.25f;
Main.dust[num8].alpha = 50;
}
if (num5 == 5)
{
Main.dust[num8].scale += (float)Main.rand.Next(2, 8) * 0.1f;
}
Main.dust[num8].noGravity = true;
if (num4 > 1)
{
Dust expr_636_cp_0 = Main.dust[num8];
expr_636_cp_0.velocity.X = expr_636_cp_0.velocity.X * 1.2f;
Dust expr_654_cp_0 = Main.dust[num8];
expr_654_cp_0.velocity.Y = expr_654_cp_0.velocity.Y * 0.8f;
Dust expr_672_cp_0 = Main.dust[num8];
expr_672_cp_0.velocity.Y = expr_672_cp_0.velocity.Y - 1f;
Main.dust[num8].velocity *= 0.8f;
Main.dust[num8].scale += (float)Main.rand.Next(3) * 0.1f;
Main.dust[num8].velocity.X = (Main.dust[num8].position.X - (this.position.X + (float)(this.width / 2))) * 0.2f;
if (Main.dust[num8].velocity.Y > 0f)
{
Dust expr_72C_cp_0 = Main.dust[num8];
expr_72C_cp_0.velocity.Y = expr_72C_cp_0.velocity.Y * -1f;
}
Dust expr_74A_cp_0 = Main.dust[num8];
expr_74A_cp_0.velocity.X = expr_74A_cp_0.velocity.X + num7 * 0.3f;
}
else
{
Main.dust[num8].velocity *= 0.2f;
}
Dust expr_78A_cp_0 = Main.dust[num8];
expr_78A_cp_0.position.X = expr_78A_cp_0.position.X - num7 * 1f;
if (this.gravDir == -1f)
{
Dust expr_7B8_cp_0 = Main.dust[num8];
expr_7B8_cp_0.velocity.Y = expr_7B8_cp_0.velocity.Y * -1f;
}
}
}
}
}
}
public void BordersMovement()
{
if (this.position.X < Main.leftWorld + 640f + 16f)
{
this.position.X = Main.leftWorld + 640f + 16f;
this.velocity.X = 0f;
}
if (this.position.X + (float)this.width > Main.rightWorld - 640f - 32f)
{
this.position.X = Main.rightWorld - 640f - 32f - (float)this.width;
this.velocity.X = 0f;
}
if (this.position.Y < Main.topWorld + 640f + 16f)
{
this.position.Y = Main.topWorld + 640f + 16f;
if ((double)this.velocity.Y < 0.11)
{
this.velocity.Y = 0.11f;
}
this.gravDir = 1f;
AchievementsHelper.HandleSpecialEvent(this, 11);
}
if (this.position.Y > Main.bottomWorld - 640f - 32f - (float)this.height)
{
this.position.Y = Main.bottomWorld - 640f - 32f - (float)this.height;
this.velocity.Y = 0f;
AchievementsHelper.HandleSpecialEvent(this, 10);
}
}
public void CollectTaxes()
{
int num = Item.buyPrice(0, 0, 0, 50);
int num2 = Item.buyPrice(0, 10, 0, 0);
if (!NPC.taxCollector)
{
return;
}
if (this.taxMoney >= num2)
{
return;
}
int num3 = 0;
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].active && !Main.npc[i].homeless && NPC.TypeToNum(Main.npc[i].type) > 0)
{
num3++;
}
}
this.taxMoney += num * num3;
if (this.taxMoney > num2)
{
this.taxMoney = num2;
}
}
public void Update(int i)
{
if (this.launcherWait > 0)
{
this.launcherWait--;
}
this.maxFallSpeed = 10f;
this.gravity = Player.defaultGravity;
Player.jumpHeight = 15;
Player.jumpSpeed = 5.01f;
this.maxRunSpeed = 3f;
this.runAcceleration = 0.08f;
this.runSlowdown = 0.2f;
this.accRunSpeed = this.maxRunSpeed;
if (!this.mount.Active || !this.mount.Cart)
{
this.onWrongGround = false;
}
this.heldProj = -1;
if (this.PortalPhysicsEnabled)
{
this.maxFallSpeed = 30f;
}
if (this.wet)
{
if (this.honeyWet)
{
this.gravity = 0.1f;
this.maxFallSpeed = 3f;
}
else if (this.merman)
{
this.gravity = 0.3f;
this.maxFallSpeed = 7f;
}
else
{
this.gravity = 0.2f;
this.maxFallSpeed = 5f;
Player.jumpHeight = 30;
Player.jumpSpeed = 6.01f;
}
}
if (this.vortexDebuff)
{
this.gravity = 0f;
}
this.maxFallSpeed += 0.01f;
bool flag = false;
if (Main.myPlayer == i)
{
TileObject.objectPreview.Reset();
}
if (this.active)
{
if (this.ghostDmg > 0f)
{
this.ghostDmg -= 2.5f;
}
if (this.ghostDmg < 0f)
{
this.ghostDmg = 0f;
}
if (Main.expertMode)
{
if (this.lifeSteal < 70f)
{
this.lifeSteal += 0.5f;
}
if (this.lifeSteal > 70f)
{
this.lifeSteal = 70f;
}
}
else
{
if (this.lifeSteal < 80f)
{
this.lifeSteal += 0.6f;
}
if (this.lifeSteal > 80f)
{
this.lifeSteal = 80f;
}
}
if (this.mount.Active)
{
this.position.Y = this.position.Y + (float)this.height;
this.height = 42 + this.mount.HeightBoost;
this.position.Y = this.position.Y - (float)this.height;
if (this.mount.Type == 0)
{
int num = (int)(this.position.X + (float)(this.width / 2)) / 16;
int j = (int)(this.position.Y + (float)(this.height / 2) - 14f) / 16;
Lighting.AddLight(num, j, 0.5f, 0.2f, 0.05f);
Lighting.AddLight(num + this.direction, j, 0.5f, 0.2f, 0.05f);
Lighting.AddLight(num + this.direction * 2, j, 0.5f, 0.2f, 0.05f);
}
}
else
{
this.position.Y = this.position.Y + (float)this.height;
this.height = 42;
this.position.Y = this.position.Y - (float)this.height;
}
Main.numPlayers++;
this.outOfRange = false;
if (this.whoAmI != Main.myPlayer)
{
int num2 = (int)(this.position.X + (float)(this.width / 2)) / 16;
int num3 = (int)(this.position.Y + (float)(this.height / 2)) / 16;
if (!WorldGen.InWorld(num2, num3, 4))
{
flag = true;
}
else if (Main.tile[num2, num3] == null)
{
flag = true;
}
else if (Main.tile[num2 - 3, num3] == null)
{
flag = true;
}
else if (Main.tile[num2 + 3, num3] == null)
{
flag = true;
}
else if (Main.tile[num2, num3 - 3] == null)
{
flag = true;
}
else if (Main.tile[num2, num3 + 3] == null)
{
flag = true;
}
if (flag)
{
this.outOfRange = true;
this.numMinions = 0;
this.slotsMinions = 0f;
this.itemAnimation = 0;
this.PlayerFrame();
}
}
if (this.tankPet >= 0)
{
if (!this.tankPetReset)
{
this.tankPetReset = true;
}
else
{
this.tankPet = -1;
}
}
}
if (this.chatOverhead.timeLeft > 0)
{
this.chatOverhead.timeLeft = this.chatOverhead.timeLeft - 1;
}
if (!this.active || flag)
{
return;
}
this.miscCounter++;
if (this.miscCounter >= 300)
{
this.miscCounter = 0;
}
this.infernoCounter++;
if (this.infernoCounter >= 180)
{
this.infernoCounter = 0;
}
float num4 = (float)(Main.maxTilesX / 4200);
num4 *= num4;
float num5 = (float)((double)(this.position.Y / 16f - (60f + 10f * num4)) / (Main.worldSurface / 6.0));
if ((double)num5 < 0.25)
{
num5 = 0.25f;
}
if (num5 > 1f)
{
num5 = 1f;
}
this.gravity *= num5;
this.maxRegenDelay = (1f - (float)this.statMana / (float)this.statManaMax2) * 60f * 4f + 45f;
this.maxRegenDelay *= 0.7f;
this.UpdateSocialShadow();
this.UpdateTeleportVisuals();
this.whoAmI = i;
if (this.whoAmI == Main.myPlayer)
{
this.TryPortalJumping();
}
if (this.runSoundDelay > 0)
{
this.runSoundDelay--;
}
if (this.attackCD > 0)
{
this.attackCD--;
}
if (this.itemAnimation == 0)
{
this.attackCD = 0;
}
if (this.potionDelay > 0)
{
this.potionDelay--;
}
if (i == Main.myPlayer)
{
if (Main.trashItem.type >= 1522 && Main.trashItem.type <= 1527)
{
Main.trashItem.SetDefaults(0, false);
}
this.UpdateBiomes();
this.UpdateMinionTarget();
}
if (this.ghost)
{
this.Ghost();
return;
}
if (this.dead)
{
this.UpdateDead();
return;
}
if (i == Main.myPlayer)
{
this.controlUp = false;
this.controlLeft = false;
this.controlDown = false;
this.controlRight = false;
this.controlJump = false;
this.controlUseItem = false;
this.controlUseTile = false;
this.controlThrow = false;
this.controlInv = false;
this.controlHook = false;
this.controlTorch = false;
this.controlSmart = false;
this.controlMount = false;
this.mapStyle = false;
this.mapAlphaDown = false;
this.mapAlphaUp = false;
this.mapFullScreen = false;
this.mapZoomIn = false;
this.mapZoomOut = false;
bool flag2 = false;
bool flag3 = false;
Keys[] pressedKeys = Main.keyState.GetPressedKeys();
for (int k = 0; k < pressedKeys.Length; k++)
{
if (pressedKeys[k] == Keys.LeftShift || pressedKeys[k] == Keys.RightShift)
{
flag2 = true;
}
else if (pressedKeys[k] == Keys.LeftAlt || pressedKeys[k] == Keys.RightAlt)
{
flag3 = true;
}
}
if (Main.hasFocus)
{
if (!Main.chatMode && !Main.editSign && !Main.editChest && !Main.blockInput)
{
if (Main.blockKey != Keys.None)
{
bool flag4 = false;
for (int l = 0; l < pressedKeys.Length; l++)
{
if (pressedKeys[l] == Main.blockKey)
{
pressedKeys[l] = Keys.None;
flag4 = true;
}
}
if (!flag4)
{
Main.blockKey = Keys.None;
}
}
bool flag5 = false;
bool flag6 = false;
for (int m = 0; m < pressedKeys.Length; m++)
{
string a = string.Concat(pressedKeys[m]);
if (pressedKeys[m] != Keys.Tab || ((!flag2 || SocialAPI.Mode != SocialMode.Steam) && !flag3))
{
if (a == Main.cUp)
{
this.controlUp = true;
}
if (a == Main.cLeft)
{
this.controlLeft = true;
}
if (a == Main.cDown)
{
this.controlDown = true;
}
if (a == Main.cRight)
{
this.controlRight = true;
}
if (a == Main.cJump)
{
this.controlJump = true;
}
if (a == Main.cThrowItem)
{
this.controlThrow = true;
}
if (a == Main.cInv)
{
this.controlInv = true;
}
if (a == Main.cBuff)
{
this.QuickBuff();
}
if (a == Main.cHeal)
{
flag6 = true;
}
if (a == Main.cMana)
{
flag5 = true;
}
if (a == Main.cHook)
{
this.controlHook = true;
}
if (a == Main.cTorch)
{
this.controlTorch = true;
}
if (a == Main.cSmart)
{
this.controlSmart = true;
}
if (a == Main.cMount)
{
this.controlMount = true;
}
if (Main.mapEnabled)
{
if (a == Main.cMapZoomIn)
{
this.mapZoomIn = true;
}
if (a == Main.cMapZoomOut)
{
this.mapZoomOut = true;
}
if (a == Main.cMapAlphaUp)
{
this.mapAlphaUp = true;
}
if (a == Main.cMapAlphaDown)
{
this.mapAlphaDown = true;
}
if (a == Main.cMapFull)
{
this.mapFullScreen = true;
}
if (a == Main.cMapStyle)
{
this.mapStyle = true;
}
}
}
}
if (Main.gamePad)
{
GamePadState state = GamePad.GetState(PlayerIndex.One);
if (state.DPad.Up == ButtonState.Pressed)
{
this.controlUp = true;
}
if (state.DPad.Down == ButtonState.Pressed)
{
this.controlDown = true;
}
if (state.DPad.Left == ButtonState.Pressed)
{
this.controlLeft = true;
}
if (state.DPad.Right == ButtonState.Pressed)
{
this.controlRight = true;
}
if (state.Triggers.Left > 0f)
{
this.controlJump = true;
}
if (state.Triggers.Right > 0f)
{
this.controlUseItem = true;
}
Main.mouseX = (int)((float)(Main.screenWidth / 2) + state.ThumbSticks.Right.X * (float)Player.tileRangeX * 16f);
Main.mouseY = (int)((float)(Main.screenHeight / 2) - state.ThumbSticks.Right.Y * (float)Player.tileRangeX * 16f);
if (state.ThumbSticks.Right.X == 0f)
{
Main.mouseX = Main.screenWidth / 2 + this.direction * 2;
}
}
if (Main.mapFullscreen)
{
if (this.controlUp)
{
Main.mapFullscreenPos.Y = Main.mapFullscreenPos.Y - 1f * (16f / Main.mapFullscreenScale);
}
if (this.controlDown)
{
Main.mapFullscreenPos.Y = Main.mapFullscreenPos.Y + 1f * (16f / Main.mapFullscreenScale);
}
if (this.controlLeft)
{
Main.mapFullscreenPos.X = Main.mapFullscreenPos.X - 1f * (16f / Main.mapFullscreenScale);
}
if (this.controlRight)
{
Main.mapFullscreenPos.X = Main.mapFullscreenPos.X + 1f * (16f / Main.mapFullscreenScale);
}
this.controlUp = false;
this.controlLeft = false;
this.controlDown = false;
this.controlRight = false;
this.controlJump = false;
this.controlUseItem = false;
this.controlUseTile = false;
this.controlThrow = false;
this.controlHook = false;
this.controlTorch = false;
this.controlSmart = false;
this.controlMount = false;
}
if (flag6)
{
if (this.releaseQuickHeal)
{
this.QuickHeal();
}
this.releaseQuickHeal = false;
}
else
{
this.releaseQuickHeal = true;
}
if (flag5)
{
if (this.releaseQuickMana)
{
this.QuickMana();
}
this.releaseQuickMana = false;
}
else
{
this.releaseQuickMana = true;
}
if (this.controlLeft && this.controlRight)
{
this.controlLeft = false;
this.controlRight = false;
}
if (Main.cSmartToggle)
{
if (this.controlSmart && this.releaseSmart)
{
Main.PlaySound(12, -1, -1, 1);
Main.smartDigEnabled = !Main.smartDigEnabled;
}
}
else
{
if (Main.smartDigEnabled != this.controlSmart)
{
Main.PlaySound(12, -1, -1, 1);
}
Main.smartDigEnabled = this.controlSmart;
}
if (this.controlSmart)
{
this.releaseSmart = false;
}
else
{
this.releaseSmart = true;
}
if (this.controlMount)
{
if (this.releaseMount)
{
this.QuickMount();
}
this.releaseMount = false;
}
else
{
this.releaseMount = true;
}
if (Main.mapFullscreen)
{
if (this.mapZoomIn)
{
Main.mapFullscreenScale *= 1.05f;
}
if (this.mapZoomOut)
{
Main.mapFullscreenScale *= 0.95f;
}
}
else
{
if (Main.mapStyle == 1)
{
if (this.mapZoomIn)
{
Main.mapMinimapScale *= 1.025f;
}
if (this.mapZoomOut)
{
Main.mapMinimapScale *= 0.975f;
}
if (this.mapAlphaUp)
{
Main.mapMinimapAlpha += 0.015f;
}
if (this.mapAlphaDown)
{
Main.mapMinimapAlpha -= 0.015f;
}
}
else if (Main.mapStyle == 2)
{
if (this.mapZoomIn)
{
Main.mapOverlayScale *= 1.05f;
}
if (this.mapZoomOut)
{
Main.mapOverlayScale *= 0.95f;
}
if (this.mapAlphaUp)
{
Main.mapOverlayAlpha += 0.015f;
}
if (this.mapAlphaDown)
{
Main.mapOverlayAlpha -= 0.015f;
}
}
if (this.mapStyle)
{
if (this.releaseMapStyle)
{
Main.PlaySound(12, -1, -1, 1);
Main.mapStyle++;
if (Main.mapStyle > 2)
{
Main.mapStyle = 0;
}
}
this.releaseMapStyle = false;
}
else
{
this.releaseMapStyle = true;
}
}
if (this.mapFullScreen)
{
if (this.releaseMapFullscreen)
{
if (Main.mapFullscreen)
{
Main.PlaySound(11, -1, -1, 1);
Main.mapFullscreen = false;
}
else
{
Main.playerInventory = false;
this.talkNPC = -1;
Main.npcChatCornerItem = 0;
Main.PlaySound(10, -1, -1, 1);
float mapFullscreenScale = 2.5f;
Main.mapFullscreenScale = mapFullscreenScale;
Main.mapFullscreen = true;
Main.resetMapFull = true;
Main.buffString = string.Empty;
}
}
this.releaseMapFullscreen = false;
}
else
{
this.releaseMapFullscreen = true;
}
}
if (this.confused)
{
bool flag7 = this.controlLeft;
bool flag8 = this.controlUp;
this.controlLeft = this.controlRight;
this.controlRight = flag7;
this.controlUp = this.controlRight;
this.controlDown = flag8;
}
else if (this.cartFlip)
{
if (this.controlRight || this.controlLeft)
{
bool flag9 = this.controlLeft;
this.controlLeft = this.controlRight;
this.controlRight = flag9;
}
else
{
this.cartFlip = false;
}
}
for (int n = 0; n < this.doubleTapCardinalTimer.Length; n++)
{
this.doubleTapCardinalTimer[n]--;
if (this.doubleTapCardinalTimer[n] < 0)
{
this.doubleTapCardinalTimer[n] = 0;
}
}
for (int num6 = 0; num6 < 4; num6++)
{
bool flag10 = false;
bool flag11 = false;
switch (num6)
{
case 0:
flag10 = (this.controlDown && this.releaseDown);
flag11 = this.controlDown;
break;
case 1:
flag10 = (this.controlUp && this.releaseUp);
flag11 = this.controlUp;
break;
case 2:
flag10 = (this.controlRight && this.releaseRight);
flag11 = this.controlRight;
break;
case 3:
flag10 = (this.controlLeft && this.releaseLeft);
flag11 = this.controlLeft;
break;
}
if (flag10)
{
if (this.doubleTapCardinalTimer[num6] > 0)
{
this.KeyDoubleTap(num6);
}
else
{
this.doubleTapCardinalTimer[num6] = 15;
}
}
if (flag11)
{
this.holdDownCardinalTimer[num6]++;
this.KeyHoldDown(num6, this.holdDownCardinalTimer[num6]);
}
else
{
this.holdDownCardinalTimer[num6] = 0;
}
}
if (Main.mouseLeft)
{
if (!Main.blockMouse && !this.mouseInterface)
{
this.controlUseItem = true;
}
}
else
{
Main.blockMouse = false;
}
if (Main.mouseRight && !this.mouseInterface && !Main.blockMouse)
{
this.controlUseTile = true;
}
if (this.controlInv)
{
if (this.releaseInventory)
{
if (Main.mapFullscreen)
{
Main.mapFullscreen = false;
this.releaseInventory = false;
Main.PlaySound(11, -1, -1, 1);
}
else
{
this.ToggleInv();
}
}
this.releaseInventory = false;
}
else
{
this.releaseInventory = true;
}
if (this.delayUseItem)
{
if (!this.controlUseItem)
{
this.delayUseItem = false;
}
this.controlUseItem = false;
}
if (this.itemAnimation == 0 && this.itemTime == 0)
{
this.dropItemCheck();
int num7 = this.selectedItem;
bool flag12 = false;
if (!Main.chatMode && this.selectedItem != 58 && !Main.editSign && !Main.editChest)
{
if (Main.keyState.IsKeyDown(Keys.D1))
{
this.selectedItem = 0;
flag12 = true;
}
if (Main.keyState.IsKeyDown(Keys.D2))
{
this.selectedItem = 1;
flag12 = true;
}
if (Main.keyState.IsKeyDown(Keys.D3))
{
this.selectedItem = 2;
flag12 = true;
}
if (Main.keyState.IsKeyDown(Keys.D4))
{
this.selectedItem = 3;
flag12 = true;
}
if (Main.keyState.IsKeyDown(Keys.D5))
{
this.selectedItem = 4;
flag12 = true;
}
if (Main.keyState.IsKeyDown(Keys.D6))
{
this.selectedItem = 5;
flag12 = true;
}
if (Main.keyState.IsKeyDown(Keys.D7))
{
this.selectedItem = 6;
flag12 = true;
}
if (Main.keyState.IsKeyDown(Keys.D8))
{
this.selectedItem = 7;
flag12 = true;
}
if (Main.keyState.IsKeyDown(Keys.D9))
{
this.selectedItem = 8;
flag12 = true;
}
if (Main.keyState.IsKeyDown(Keys.D0))
{
this.selectedItem = 9;
flag12 = true;
}
if (this.controlTorch && flag12)
{
if (this.selectedItem != this.nonTorch)
{
Main.PlaySound(12, -1, -1, 1);
}
this.nonTorch = this.selectedItem;
this.selectedItem = num7;
flag12 = false;
}
}
bool flag13 = Main.hairWindow;
if (flag13)
{
int y = Main.screenHeight / 2 + 60;
int x = Main.screenWidth / 2 - Main.hairStyleBackTexture.Width / 2;
flag13 = new Rectangle(x, y, Main.hairStyleBackTexture.Width, Main.hairStyleBackTexture.Height).Contains(Main.MouseScreen.ToPoint());
}
if (flag12 && CaptureManager.Instance.Active)
{
CaptureManager.Instance.Active = false;
}
if (num7 != this.selectedItem)
{
Main.PlaySound(12, -1, -1, 1);
}
if (Main.mapFullscreen)
{
int num8 = (Main.mouseState.ScrollWheelValue - Main.oldMouseWheel) / 120;
Main.mapFullscreenScale *= 1f + (float)num8 * 0.3f;
}
else if (CaptureManager.Instance.Active)
{
CaptureManager.Instance.Scrolling();
}
else if (!flag13)
{
if (!Main.playerInventory)
{
int num9;
for (num9 = (Main.mouseState.ScrollWheelValue - Main.oldMouseWheel) / 120; num9 > 9; num9 -= 10)
{
}
while (num9 < 0)
{
num9 += 10;
}
this.selectedItem -= num9;
if (num9 != 0)
{
Main.PlaySound(12, -1, -1, 1);
}
if (this.changeItem >= 0)
{
if (this.selectedItem != this.changeItem)
{
Main.PlaySound(12, -1, -1, 1);
}
this.selectedItem = this.changeItem;
this.changeItem = -1;
}
if (this.itemAnimation == 0)
{
while (this.selectedItem > 9)
{
this.selectedItem -= 10;
}
while (this.selectedItem < 0)
{
this.selectedItem += 10;
}
}
}
else
{
int num10 = (Main.mouseState.ScrollWheelValue - Main.oldMouseWheel) / 120;
bool flag14 = true;
if (Main.recBigList)
{
int num11 = 42;
int num12 = 340;
int num13 = 310;
int num14 = (Main.screenWidth - num13 - 280) / num11;
int num15 = (Main.screenHeight - num12 - 20) / num11;
if (new Rectangle(num13, num12, num14 * num11, num15 * num11).Contains(Main.MouseScreen.ToPoint()))
{
num10 *= -1;
int num16 = Math.Sign(num10);
while (num10 != 0)
{
if (num10 < 0)
{
Main.recStart -= num14;
if (Main.recStart < 0)
{
Main.recStart = 0;
}
}
else
{
Main.recStart += num14;
if (Main.recStart > Main.numAvailableRecipes - num14)
{
Main.recStart = Main.numAvailableRecipes - num14;
}
}
num10 -= num16;
}
}
}
if (flag14)
{
Main.focusRecipe += num10;
if (Main.focusRecipe > Main.numAvailableRecipes - 1)
{
Main.focusRecipe = Main.numAvailableRecipes - 1;
}
if (Main.focusRecipe < 0)
{
Main.focusRecipe = 0;
}
}
}
}
}
}
if (this.selectedItem == 58)
{
this.nonTorch = -1;
}
else
{
this.SmartitemLookup();
}
if (this.stoned != this.lastStoned)
{
if (this.whoAmI == Main.myPlayer && this.stoned)
{
int damage = (int)(20.0 * (double)Main.damageMultiplier);
this.Hurt(damage, 0, false, false, Lang.deathMsg(-1, -1, -1, 4), false);
}
Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1);
for (int num17 = 0; num17 < 20; num17++)
{
int num18 = Dust.NewDust(this.position, this.width, this.height, 1, 0f, 0f, 0, default(Color), 1f);
if (Main.rand.Next(2) == 0)
{
Main.dust[num18].noGravity = true;
}
}
}
this.lastStoned = this.stoned;
if (this.frozen || this.webbed || this.stoned)
{
this.controlJump = false;
this.controlDown = false;
this.controlLeft = false;
this.controlRight = false;
this.controlUp = false;
this.controlUseItem = false;
this.controlUseTile = false;
this.controlThrow = false;
this.gravDir = 1f;
}
if (!this.controlThrow)
{
this.releaseThrow = true;
}
else
{
this.releaseThrow = false;
}
if (Main.netMode == 1)
{
bool flag15 = false;
if (this.controlUp != Main.clientPlayer.controlUp)
{
flag15 = true;
}
if (this.controlDown != Main.clientPlayer.controlDown)
{
flag15 = true;
}
if (this.controlLeft != Main.clientPlayer.controlLeft)
{
flag15 = true;
}
if (this.controlRight != Main.clientPlayer.controlRight)
{
flag15 = true;
}
if (this.controlJump != Main.clientPlayer.controlJump)
{
flag15 = true;
}
if (this.controlUseItem != Main.clientPlayer.controlUseItem)
{
flag15 = true;
}
if (this.selectedItem != Main.clientPlayer.selectedItem)
{
flag15 = true;
}
if (flag15)
{
NetMessage.SendData(13, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0, 0, 0);
}
}
if (Main.playerInventory)
{
this.AdjTiles();
}
if (this.chest != -1)
{
if (this.chest != -2)
{
this.flyingPigChest = -1;
}
if (this.flyingPigChest >= 0)
{
if (!Main.projectile[this.flyingPigChest].active || Main.projectile[this.flyingPigChest].type != 525)
{
Main.PlaySound(2, -1, -1, 59);
this.chest = -1;
Recipe.FindRecipes();
}
else
{
int num19 = (int)(((double)this.position.X + (double)this.width * 0.5) / 16.0);
int num20 = (int)(((double)this.position.Y + (double)this.height * 0.5) / 16.0);
this.chestX = (int)Main.projectile[this.flyingPigChest].Center.X / 16;
this.chestY = (int)Main.projectile[this.flyingPigChest].Center.Y / 16;
if (num19 < this.chestX - Player.tileRangeX || num19 > this.chestX + Player.tileRangeX + 1 || num20 < this.chestY - Player.tileRangeY || num20 > this.chestY + Player.tileRangeY + 1)
{
if (this.chest != -1)
{
Main.PlaySound(2, -1, -1, 59);
}
this.chest = -1;
Recipe.FindRecipes();
}
}
}
else
{
int num21 = (int)(((double)this.position.X + (double)this.width * 0.5) / 16.0);
int num22 = (int)(((double)this.position.Y + (double)this.height * 0.5) / 16.0);
if (num21 < this.chestX - Player.tileRangeX || num21 > this.chestX + Player.tileRangeX + 1 || num22 < this.chestY - Player.tileRangeY || num22 > this.chestY + Player.tileRangeY + 1)
{
if (this.chest != -1)
{
Main.PlaySound(11, -1, -1, 1);
}
this.chest = -1;
Recipe.FindRecipes();
}
else if (!Main.tile[this.chestX, this.chestY].active())
{
Main.PlaySound(11, -1, -1, 1);
this.chest = -1;
Recipe.FindRecipes();
}
}
}
else
{
this.flyingPigChest = -1;
}
if (this.velocity.Y <= 0f)
{
this.fallStart2 = (int)(this.position.Y / 16f);
}
if (this.velocity.Y == 0f)
{
int num23 = 25;
num23 += this.extraFall;
int num24 = (int)(this.position.Y / 16f) - this.fallStart;
if (this.mount.CanFly)
{
num24 = 0;
}
if (this.mount.Cart && Minecart.OnTrack(this.position, this.width, this.height))
{
num24 = 0;
}
if (this.mount.Type == 1)
{
num24 = 0;
}
this.mount.FatigueRecovery();
bool flag16 = false;
for (int num25 = 3; num25 < 10; num25++)
{
if (this.armor[num25].stack > 0 && this.armor[num25].wingSlot > -1)
{
flag16 = true;
}
}
if (this.stoned)
{
int num26 = (int)(((float)num24 * this.gravDir - 2f) * 20f);
if (num26 > 0)
{
this.Hurt(num26, 0, false, false, Lang.deathMsg(-1, -1, -1, 4), false);
this.immune = false;
}
}
else if (((this.gravDir == 1f && num24 > num23) || (this.gravDir == -1f && num24 < -num23)) && !this.noFallDmg && !flag16)
{
this.immune = false;
int num27 = (int)((float)num24 * this.gravDir - (float)num23) * 10;
if (this.mount.Active)
{
num27 = (int)((float)num27 * this.mount.FallDamage);
}
this.Hurt(num27, 0, false, false, Lang.deathMsg(-1, -1, -1, 0), false);
if (!this.dead && this.statLife <= this.statLifeMax2 / 10)
{
AchievementsHelper.HandleSpecialEvent(this, 8);
}
}
this.fallStart = (int)(this.position.Y / 16f);
}
if (this.jump > 0 || this.rocketDelay > 0 || this.wet || this.slowFall || (double)num5 < 0.8 || this.tongued)
{
this.fallStart = (int)(this.position.Y / 16f);
}
}
if (Main.netMode != 1)
{
if (this.chest == -1 && this.lastChest >= 0 && Main.chest[this.lastChest] != null && Main.chest[this.lastChest] != null)
{
int x2 = Main.chest[this.lastChest].x;
int y2 = Main.chest[this.lastChest].y;
NPC.BigMimicSummonCheck(x2, y2);
}
this.lastChest = this.chest;
}
if (this.mouseInterface)
{
this.delayUseItem = true;
}
Player.tileTargetX = (int)(((float)Main.mouseX + Main.screenPosition.X) / 16f);
Player.tileTargetY = (int)(((float)Main.mouseY + Main.screenPosition.Y) / 16f);
if (this.gravDir == -1f)
{
Player.tileTargetY = (int)((Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16f);
}
if (Player.tileTargetX >= Main.maxTilesX - 5)
{
Player.tileTargetX = Main.maxTilesX - 5;
}
if (Player.tileTargetY >= Main.maxTilesY - 5)
{
Player.tileTargetY = Main.maxTilesY - 5;
}
if (Player.tileTargetX < 5)
{
Player.tileTargetX = 5;
}
if (Player.tileTargetY < 5)
{
Player.tileTargetY = 5;
}
if (Main.tile[Player.tileTargetX - 1, Player.tileTargetY] == null)
{
Main.tile[Player.tileTargetX - 1, Player.tileTargetY] = new Tile();
}
if (Main.tile[Player.tileTargetX + 1, Player.tileTargetY] == null)
{
Main.tile[Player.tileTargetX + 1, Player.tileTargetY] = new Tile();
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY] == null)
{
Main.tile[Player.tileTargetX, Player.tileTargetY] = new Tile();
}
if (!Main.tile[Player.tileTargetX, Player.tileTargetY].active())
{
if (Main.tile[Player.tileTargetX - 1, Player.tileTargetY].active() && Main.tile[Player.tileTargetX - 1, Player.tileTargetY].type == 323)
{
int frameY = (int)Main.tile[Player.tileTargetX - 1, Player.tileTargetY].frameY;
if (frameY < -4)
{
Player.tileTargetX++;
}
if (frameY > 4)
{
Player.tileTargetX--;
}
}
else if (Main.tile[Player.tileTargetX + 1, Player.tileTargetY].active() && Main.tile[Player.tileTargetX + 1, Player.tileTargetY].type == 323)
{
int frameY2 = (int)Main.tile[Player.tileTargetX + 1, Player.tileTargetY].frameY;
if (frameY2 < -4)
{
Player.tileTargetX++;
}
if (frameY2 > 4)
{
Player.tileTargetX--;
}
}
}
this.SmartCursorLookup();
this.UpdateImmunity();
if (this.petalTimer > 0)
{
this.petalTimer--;
}
if (this.shadowDodgeTimer > 0)
{
this.shadowDodgeTimer--;
}
if (this.jump > 0 || this.velocity.Y != 0f)
{
this.slippy = false;
this.slippy2 = false;
this.powerrun = false;
this.sticky = false;
}
this.potionDelayTime = Item.potionDelay;
this.restorationDelayTime = Item.restorationDelay;
if (this.pStone)
{
this.potionDelayTime = (int)((double)this.potionDelayTime * 0.75);
this.restorationDelayTime = (int)((double)this.restorationDelayTime * 0.75);
}
if (this.yoraiz0rEye > 0)
{
this.Yoraiz0rEye();
}
this.ResetEffects();
this.UpdateDyes(i);
this.meleeCrit += this.inventory[this.selectedItem].crit;
this.magicCrit += this.inventory[this.selectedItem].crit;
this.rangedCrit += this.inventory[this.selectedItem].crit;
this.thrownCrit += this.inventory[this.selectedItem].crit;
if (this.whoAmI == Main.myPlayer)
{
Main.musicBox2 = -1;
if (Main.waterCandles > 0)
{
this.AddBuff(86, 2, false);
}
if (Main.peaceCandles > 0)
{
this.AddBuff(157, 2, false);
}
if (Main.campfire)
{
this.AddBuff(87, 2, false);
}
if (Main.starInBottle)
{
this.AddBuff(158, 2, false);
}
if (Main.heartLantern)
{
this.AddBuff(89, 2, false);
}
if (Main.sunflower)
{
this.AddBuff(146, 2, false);
}
if (this.hasBanner)
{
this.AddBuff(147, 2, false);
}
}
for (int num28 = 0; num28 < 191; num28++)
{
this.buffImmune[num28] = false;
}
this.UpdateBuffs(i);
if (this.whoAmI == Main.myPlayer)
{
if (!this.onFire && !this.poisoned)
{
this.trapDebuffSource = false;
}
this.UpdatePet(i);
this.UpdatePetLight(i);
}
if (this.accMerman && this.wet && !this.lavaWet && (!this.mount.Active || this.mount.Type != 3))
{
this.releaseJump = true;
this.wings = 0;
this.merman = true;
this.accFlipper = true;
this.AddBuff(34, 2, true);
}
else
{
this.merman = false;
}
this.accMerman = false;
if (this.wolfAcc && !this.merman && !Main.dayTime && !this.wereWolf)
{
this.AddBuff(28, 60, true);
}
this.wolfAcc = false;
if (this.whoAmI == Main.myPlayer)
{
for (int num29 = 0; num29 < 22; num29++)
{
if (this.buffType[num29] > 0 && this.buffTime[num29] <= 0)
{
this.DelBuff(num29);
}
}
}
this.beetleDefense = false;
this.beetleOffense = false;
this.doubleJumpCloud = false;
this.setSolar = false;
this.head = this.armor[0].headSlot;
this.body = this.armor[1].bodySlot;
this.legs = this.armor[2].legSlot;
this.handon = -1;
this.handoff = -1;
this.back = -1;
this.front = -1;
this.shoe = -1;
this.waist = -1;
this.shield = -1;
this.neck = -1;
this.face = -1;
this.balloon = -1;
if (this.MountFishronSpecialCounter > 0f)
{
this.MountFishronSpecialCounter -= 1f;
}
if (this._portalPhysicsTime > 0)
{
this._portalPhysicsTime--;
}
this.UpdateEquips(i);
if (this.inventory[this.selectedItem].type == 3384)
{
this._portalPhysicsTime = 30;
}
if (this.mount.Active)
{
this.mount.UpdateEffects(this);
}
this.gemCount++;
if (this.gemCount >= 10)
{
this.gem = -1;
this.gemCount = 0;
for (int num30 = 0; num30 <= 58; num30++)
{
if (this.inventory[num30].type == 0 || this.inventory[num30].stack == 0)
{
this.inventory[num30].type = 0;
this.inventory[num30].stack = 0;
this.inventory[num30].name = "";
this.inventory[num30].netID = 0;
}
if (this.inventory[num30].type >= 1522 && this.inventory[num30].type <= 1527)
{
this.gem = this.inventory[num30].type - 1522;
}
}
}
if (!this.vortexStealthActive)
{
float num31 = 0f;
float num32 = 0f;
float num33 = 0f;
int num34 = this.head;
if (num34 <= 171)
{
if (num34 != 11)
{
switch (num34)
{
case 169:
num31 = 0f;
num32 = 0.36f;
num33 = 0.4f;
break;
case 170:
num31 = 0.4f;
num32 = 0.16f;
num33 = 0.36f;
break;
case 171:
num31 = 0.5f;
num32 = 0.25f;
num33 = 0.05f;
break;
}
}
else
{
num31 = 0.92f;
num32 = 0.8f;
num33 = 0.65f;
}
}
else if (num34 != 178)
{
if (num34 == 189)
{
num31 = 0.9f;
num32 = 0.9f;
num33 = 0.7f;
}
}
else
{
num31 = 0.1f;
num32 = 0.2f;
num33 = 0.3f;
}
float num35 = 0f;
float num36 = 0f;
float num37 = 0f;
num34 = this.body;
switch (num34)
{
case 175:
num35 = 0f;
num36 = 0.36f;
num37 = 0.4f;
break;
case 176:
num35 = 0.4f;
num36 = 0.16f;
num37 = 0.36f;
break;
case 177:
num35 = 0.5f;
num36 = 0.25f;
num37 = 0.05f;
break;
default:
if (num34 == 190)
{
num31 = 0.9f;
num32 = 0.9f;
num33 = 0.7f;
}
break;
}
float num38 = 0f;
float num39 = 0f;
float num40 = 0f;
num34 = this.legs;
switch (num34)
{
case 110:
num38 = 0f;
num39 = 0.36f;
num40 = 0.4f;
break;
case 111:
num38 = 0.4f;
num39 = 0.16f;
num40 = 0.36f;
break;
case 112:
num38 = 0.5f;
num39 = 0.25f;
num40 = 0.05f;
break;
default:
if (num34 == 130)
{
num31 = 0.9f;
num32 = 0.9f;
num33 = 0.7f;
}
break;
}
if (num31 != 0f || num32 != 0f || num33 != 0f)
{
float num41 = 1f;
if (num31 == num35 && num32 == num36 && num33 == num37)
{
num41 += 0.5f;
}
if (num31 == num38 && num32 == num39 && num33 == num40)
{
num41 += 0.5f;
}
Vector2 spinningpoint = new Vector2((float)(this.width / 2 + 8 * this.direction), 2f);
if (this.fullRotation != 0f)
{
spinningpoint = spinningpoint.RotatedBy((double)this.fullRotation, this.fullRotationOrigin);
}
int i2 = (int)(this.position.X + spinningpoint.X) / 16;
int j2 = (int)(this.position.Y + spinningpoint.Y) / 16;
Lighting.AddLight(i2, j2, num31 * num41, num32 * num41, num33 * num41);
}
if (num35 != 0f || num36 != 0f || num37 != 0f)
{
float num42 = 1f;
if (num35 == num31 && num36 == num32 && num37 == num33)
{
num42 += 0.5f;
}
if (num35 == num38 && num36 == num39 && num37 == num40)
{
num42 += 0.5f;
}
Vector2 spinningpoint2 = new Vector2((float)(this.width / 2 + 8), (float)(this.height / 2));
if (this.fullRotation != 0f)
{
spinningpoint2 = spinningpoint2.RotatedBy((double)this.fullRotation, this.fullRotationOrigin);
}
int i3 = (int)(this.position.X + spinningpoint2.X) / 16;
int j3 = (int)(this.position.Y + spinningpoint2.Y) / 16;
Lighting.AddLight(i3, j3, num35 * num42, num36 * num42, num37 * num42);
}
if (num38 != 0f || num39 != 0f || num40 != 0f)
{
float num43 = 1f;
if (num38 == num35 && num39 == num36 && num40 == num37)
{
num43 += 0.5f;
}
if (num38 == num31 && num39 == num32 && num40 == num33)
{
num43 += 0.5f;
}
Vector2 spinningpoint3 = new Vector2((float)(this.width / 2 + 8 * this.direction), (float)this.height * 0.75f);
if (this.fullRotation != 0f)
{
spinningpoint3 = spinningpoint3.RotatedBy((double)this.fullRotation, this.fullRotationOrigin);
}
int i4 = (int)(this.position.X + spinningpoint3.X) / 16;
int j4 = (int)(this.position.Y + spinningpoint3.Y) / 16;
Lighting.AddLight(i4, j4, num38 * num43, num39 * num43, num40 * num43);
}
}
this.UpdateArmorSets(i);
if (this.merman)
{
this.wings = 0;
}
if (this.invis)
{
if (this.itemAnimation == 0 && this.aggro > -750)
{
this.aggro = -750;
}
else if (this.aggro > -250)
{
this.aggro = -250;
}
}
if (this.inventory[this.selectedItem].type == 3106)
{
if (this.itemAnimation > 0)
{
this.stealthTimer = 15;
if (this.stealth > 0f)
{
this.stealth += 0.1f;
}
}
else if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1 && (double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1)
{
if (this.stealthTimer == 0 && this.stealth > 0f)
{
this.stealth -= 0.02f;
if ((double)this.stealth <= 0.0)
{
this.stealth = 0f;
if (Main.netMode == 1)
{
NetMessage.SendData(84, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0);
}
}
}
}
else if (this.stealth > 0f)
{
this.stealth += 0.1f;
}
if (this.stealth > 1f)
{
this.stealth = 1f;
}
this.meleeDamage += (1f - this.stealth) * 3f;
this.meleeCrit += (int)((1f - this.stealth) * 30f);
if (this.meleeCrit > 100)
{
this.meleeCrit = 100;
}
this.aggro -= (int)((1f - this.stealth) * 750f);
if (this.stealthTimer > 0)
{
this.stealthTimer--;
}
}
else if (this.shroomiteStealth)
{
if (this.itemAnimation > 0)
{
this.stealthTimer = 5;
}
if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1 && (double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1)
{
if (this.stealthTimer == 0 && this.stealth > 0f)
{
this.stealth -= 0.015f;
if ((double)this.stealth <= 0.0)
{
this.stealth = 0f;
if (Main.netMode == 1)
{
NetMessage.SendData(84, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0);
}
}
}
}
else
{
float num44 = Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y);
this.stealth += num44 * 0.0075f;
if (this.stealth > 1f)
{
this.stealth = 1f;
}
}
this.rangedDamage += (1f - this.stealth) * 0.6f;
this.rangedCrit += (int)((1f - this.stealth) * 10f);
this.aggro -= (int)((1f - this.stealth) * 750f);
if (this.stealthTimer > 0)
{
this.stealthTimer--;
}
}
else if (this.setVortex)
{
bool flag17 = false;
if (this.vortexStealthActive)
{
float num45 = this.stealth;
this.stealth -= 0.04f;
if (this.stealth < 0f)
{
this.stealth = 0f;
}
else
{
flag17 = true;
}
if (this.stealth == 0f && num45 != this.stealth && Main.netMode == 1)
{
NetMessage.SendData(84, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0);
}
this.rangedDamage += (1f - this.stealth) * 0.8f;
this.rangedCrit += (int)((1f - this.stealth) * 20f);
this.aggro -= (int)((1f - this.stealth) * 1200f);
this.moveSpeed *= 0.3f;
if (this.mount.Active)
{
this.vortexStealthActive = false;
}
}
else
{
float num46 = this.stealth;
this.stealth += 0.04f;
if (this.stealth > 1f)
{
this.stealth = 1f;
}
else
{
flag17 = true;
}
if (this.stealth == 1f && num46 != this.stealth && Main.netMode == 1)
{
NetMessage.SendData(84, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0);
}
}
if (flag17)
{
if (Main.rand.Next(2) == 0)
{
Vector2 vector = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
Dust dust = Main.dust[Dust.NewDust(base.Center - vector * 30f, 0, 0, 229, 0f, 0f, 0, default(Color), 1f)];
dust.noGravity = true;
dust.position = base.Center - vector * (float)Main.rand.Next(5, 11);
dust.velocity = vector.RotatedBy(1.5707963705062866, default(Vector2)) * 4f;
dust.scale = 0.5f + Main.rand.NextFloat();
dust.fadeIn = 0.5f;
}
if (Main.rand.Next(2) == 0)
{
Vector2 vector2 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
Dust dust2 = Main.dust[Dust.NewDust(base.Center - vector2 * 30f, 0, 0, 240, 0f, 0f, 0, default(Color), 1f)];
dust2.noGravity = true;
dust2.position = base.Center - vector2 * 12f;
dust2.velocity = vector2.RotatedBy(-1.5707963705062866, default(Vector2)) * 2f;
dust2.scale = 0.5f + Main.rand.NextFloat();
dust2.fadeIn = 0.5f;
}
}
}
else
{
this.stealth = 1f;
}
if (this.manaSick)
{
this.magicDamage *= 1f - this.manaSickReduction;
}
if (this.inventory[this.selectedItem].type == 1947)
{
this.meleeSpeed = (1f + this.meleeSpeed) / 2f;
}
if ((double)this.pickSpeed < 0.3)
{
this.pickSpeed = 0.3f;
}
if (this.meleeSpeed > 3f)
{
this.meleeSpeed = 3f;
}
if ((double)this.moveSpeed > 1.6)
{
this.moveSpeed = 1.6f;
}
if (this.tileSpeed > 3f)
{
this.tileSpeed = 3f;
}
this.tileSpeed = 1f / this.tileSpeed;
if (this.wallSpeed > 3f)
{
this.wallSpeed = 3f;
}
this.wallSpeed = 1f / this.wallSpeed;
if (this.statManaMax2 > 400)
{
this.statManaMax2 = 400;
}
if (this.statDefense < 0)
{
this.statDefense = 0;
}
if (this.dazed)
{
this.moveSpeed /= 3f;
}
else if (this.slow)
{
this.moveSpeed /= 2f;
}
else if (this.chilled)
{
this.moveSpeed *= 0.75f;
}
this.meleeSpeed = 1f / this.meleeSpeed;
this.UpdateLifeRegen();
this.soulDrain = 0;
this.UpdateManaRegen();
if (this.manaRegenCount < 0)
{
this.manaRegenCount = 0;
}
if (this.statMana > this.statManaMax2)
{
this.statMana = this.statManaMax2;
}
this.runAcceleration *= this.moveSpeed;
this.maxRunSpeed *= this.moveSpeed;
this.UpdateJumpHeight();
for (int num47 = 0; num47 < 22; num47++)
{
if (this.buffType[num47] > 0 && this.buffTime[num47] > 0 && this.buffImmune[this.buffType[num47]])
{
this.DelBuff(num47);
}
}
if (this.brokenArmor)
{
this.statDefense /= 2;
}
this.lastTileRangeX = Player.tileRangeX;
this.lastTileRangeY = Player.tileRangeY;
if (this.mount.Active && this.mount.BlockExtraJumps)
{
this.jumpAgainCloud = false;
this.jumpAgainSandstorm = false;
this.jumpAgainBlizzard = false;
this.jumpAgainFart = false;
this.jumpAgainSail = false;
this.jumpAgainUnicorn = false;
}
else
{
if (!this.doubleJumpCloud)
{
this.jumpAgainCloud = false;
}
else if (this.velocity.Y == 0f || this.sliding)
{
this.jumpAgainCloud = true;
}
if (!this.doubleJumpSandstorm)
{
this.jumpAgainSandstorm = false;
}
else if (this.velocity.Y == 0f || this.sliding)
{
this.jumpAgainSandstorm = true;
}
if (!this.doubleJumpBlizzard)
{
this.jumpAgainBlizzard = false;
}
else if (this.velocity.Y == 0f || this.sliding)
{
this.jumpAgainBlizzard = true;
}
if (!this.doubleJumpFart)
{
this.jumpAgainFart = false;
}
else if (this.velocity.Y == 0f || this.sliding)
{
this.jumpAgainFart = true;
}
if (!this.doubleJumpSail)
{
this.jumpAgainSail = false;
}
else if (this.velocity.Y == 0f || this.sliding)
{
this.jumpAgainSail = true;
}
if (!this.doubleJumpUnicorn)
{
this.jumpAgainUnicorn = false;
}
else if (this.velocity.Y == 0f || this.sliding)
{
this.jumpAgainUnicorn = true;
}
}
if (!this.carpet)
{
this.canCarpet = false;
this.carpetFrame = -1;
}
else if (this.velocity.Y == 0f || this.sliding)
{
this.canCarpet = true;
this.carpetTime = 0;
this.carpetFrame = -1;
this.carpetFrameCounter = 0f;
}
if (this.gravDir == -1f)
{
this.canCarpet = false;
}
if (this.ropeCount > 0)
{
this.ropeCount--;
}
if (!this.pulley && !this.frozen && !this.webbed && !this.stoned && !this.controlJump && this.gravDir == 1f && this.ropeCount == 0 && this.grappling[0] == -1 && !this.tongued && !this.mount.Active)
{
this.FindPulley();
}
if (this.pulley)
{
if (this.mount.Active)
{
this.pulley = false;
}
this.sandStorm = false;
this.dJumpEffectCloud = false;
this.dJumpEffectSandstorm = false;
this.dJumpEffectBlizzard = false;
this.dJumpEffectFart = false;
this.dJumpEffectSail = false;
this.dJumpEffectUnicorn = false;
int num48 = (int)(this.position.X + (float)(this.width / 2)) / 16;
int num49 = (int)(this.position.Y - 8f) / 16;
bool flag18 = false;
if (this.pulleyDir == 0)
{
this.pulleyDir = 1;
}
if (this.pulleyDir == 1)
{
if (this.direction == -1 && this.controlLeft && (this.releaseLeft || this.leftTimer == 0))
{
this.pulleyDir = 2;
flag18 = true;
}
else if ((this.direction == 1 && this.controlRight && this.releaseRight) || this.rightTimer == 0)
{
this.pulleyDir = 2;
flag18 = true;
}
else
{
if (this.direction == 1 && this.controlLeft)
{
this.direction = -1;
flag18 = true;
}
if (this.direction == -1 && this.controlRight)
{
this.direction = 1;
flag18 = true;
}
}
}
else if (this.pulleyDir == 2)
{
if (this.direction == 1 && this.controlLeft)
{
flag18 = true;
int num50 = num48 * 16 + 8 - this.width / 2;
if (!Collision.SolidCollision(new Vector2((float)num50, this.position.Y), this.width, this.height))
{
this.pulleyDir = 1;
this.direction = -1;
flag18 = true;
}
}
if (this.direction == -1 && this.controlRight)
{
flag18 = true;
int num51 = num48 * 16 + 8 - this.width / 2;
if (!Collision.SolidCollision(new Vector2((float)num51, this.position.Y), this.width, this.height))
{
this.pulleyDir = 1;
this.direction = 1;
flag18 = true;
}
}
}
bool flag19 = false;
if (!flag18 && ((this.controlLeft && (this.releaseLeft || this.leftTimer == 0)) || (this.controlRight && (this.releaseRight || this.rightTimer == 0))))
{
int num52 = 1;
if (this.controlLeft)
{
num52 = -1;
}
int num53 = num48 + num52;
if (Main.tile[num53, num49].active() && Main.tileRope[(int)Main.tile[num53, num49].type])
{
this.pulleyDir = 1;
this.direction = num52;
int num54 = num53 * 16 + 8 - this.width / 2;
float num55 = this.position.Y;
num55 = (float)(num49 * 16 + 22);
if ((!Main.tile[num53, num49 - 1].active() || !Main.tileRope[(int)Main.tile[num53, num49 - 1].type]) && (!Main.tile[num53, num49 + 1].active() || !Main.tileRope[(int)Main.tile[num53, num49 + 1].type]))
{
num55 = (float)(num49 * 16 + 22);
}
if (Collision.SolidCollision(new Vector2((float)num54, num55), this.width, this.height))
{
this.pulleyDir = 2;
this.direction = -num52;
if (this.direction == 1)
{
num54 = num53 * 16 + 8 - this.width / 2 + 6;
}
else
{
num54 = num53 * 16 + 8 - this.width / 2 + -6;
}
}
if (i == Main.myPlayer)
{
Main.cameraX = Main.cameraX + this.position.X - (float)num54;
}
this.position.X = (float)num54;
this.gfxOffY = this.position.Y - num55;
this.position.Y = num55;
flag19 = true;
}
}
if (!flag19 && !flag18 && !this.controlUp && ((this.controlLeft && this.releaseLeft) || (this.controlRight && this.releaseRight)))
{
this.pulley = false;
if (this.controlLeft && this.velocity.X == 0f)
{
this.velocity.X = -1f;
}
if (this.controlRight && this.velocity.X == 0f)
{
this.velocity.X = 1f;
}
}
if (this.velocity.X != 0f)
{
this.pulley = false;
}
if (Main.tile[num48, num49] == null)
{
Main.tile[num48, num49] = new Tile();
}
if (!Main.tile[num48, num49].active() || !Main.tileRope[(int)Main.tile[num48, num49].type])
{
this.pulley = false;
}
if (this.gravDir != 1f)
{
this.pulley = false;
}
if (this.frozen || this.webbed || this.stoned)
{
this.pulley = false;
}
if (!this.pulley)
{
this.velocity.Y = this.velocity.Y - this.gravity;
}
if (this.controlJump)
{
this.pulley = false;
this.jump = Player.jumpHeight;
this.velocity.Y = -Player.jumpSpeed;
}
}
if (this.pulley)
{
this.fallStart = (int)this.position.Y / 16;
this.wingFrame = 0;
if (this.wings == 4)
{
this.wingFrame = 3;
}
int num56 = (int)(this.position.X + (float)(this.width / 2)) / 16;
int num57 = (int)(this.position.Y - 16f) / 16;
int num58 = (int)(this.position.Y - 8f) / 16;
bool flag20 = true;
bool flag21 = false;
if ((Main.tile[num56, num58 - 1].active() && Main.tileRope[(int)Main.tile[num56, num58 - 1].type]) || (Main.tile[num56, num58 + 1].active() && Main.tileRope[(int)Main.tile[num56, num58 + 1].type]))
{
flag21 = true;
}
if (Main.tile[num56, num57] == null)
{
Main.tile[num56, num57] = new Tile();
}
if (!Main.tile[num56, num57].active() || !Main.tileRope[(int)Main.tile[num56, num57].type])
{
flag20 = false;
if (this.velocity.Y < 0f)
{
this.velocity.Y = 0f;
}
}
if (flag21)
{
if (this.controlUp && flag20)
{
float num59 = this.position.X;
float y3 = this.position.Y - Math.Abs(this.velocity.Y) - 2f;
if (Collision.SolidCollision(new Vector2(num59, y3), this.width, this.height))
{
num59 = (float)(num56 * 16 + 8 - this.width / 2 + 6);
if (!Collision.SolidCollision(new Vector2(num59, y3), this.width, (int)((float)this.height + Math.Abs(this.velocity.Y) + 2f)))
{
if (i == Main.myPlayer)
{
Main.cameraX = Main.cameraX + this.position.X - num59;
}
this.pulleyDir = 2;
this.direction = 1;
this.position.X = num59;
this.velocity.X = 0f;
}
else
{
num59 = (float)(num56 * 16 + 8 - this.width / 2 + -6);
if (!Collision.SolidCollision(new Vector2(num59, y3), this.width, (int)((float)this.height + Math.Abs(this.velocity.Y) + 2f)))
{
if (i == Main.myPlayer)
{
Main.cameraX = Main.cameraX + this.position.X - num59;
}
this.pulleyDir = 2;
this.direction = -1;
this.position.X = num59;
this.velocity.X = 0f;
}
}
}
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.7f;
}
if (this.velocity.Y > -3f)
{
this.velocity.Y = this.velocity.Y - 0.2f;
}
else
{
this.velocity.Y = this.velocity.Y - 0.02f;
}
if (this.velocity.Y < -8f)
{
this.velocity.Y = -8f;
}
}
else if (this.controlDown)
{
float num60 = this.position.X;
float y4 = this.position.Y;
if (Collision.SolidCollision(new Vector2(num60, y4), this.width, (int)((float)this.height + Math.Abs(this.velocity.Y) + 2f)))
{
num60 = (float)(num56 * 16 + 8 - this.width / 2 + 6);
if (!Collision.SolidCollision(new Vector2(num60, y4), this.width, (int)((float)this.height + Math.Abs(this.velocity.Y) + 2f)))
{
if (i == Main.myPlayer)
{
Main.cameraX = Main.cameraX + this.position.X - num60;
}
this.pulleyDir = 2;
this.direction = 1;
this.position.X = num60;
this.velocity.X = 0f;
}
else
{
num60 = (float)(num56 * 16 + 8 - this.width / 2 + -6);
if (!Collision.SolidCollision(new Vector2(num60, y4), this.width, (int)((float)this.height + Math.Abs(this.velocity.Y) + 2f)))
{
if (i == Main.myPlayer)
{
Main.cameraX = Main.cameraX + this.position.X - num60;
}
this.pulleyDir = 2;
this.direction = -1;
this.position.X = num60;
this.velocity.X = 0f;
}
}
}
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.7f;
}
if (this.velocity.Y < 3f)
{
this.velocity.Y = this.velocity.Y + 0.2f;
}
else
{
this.velocity.Y = this.velocity.Y + 0.1f;
}
if (this.velocity.Y > this.maxFallSpeed)
{
this.velocity.Y = this.maxFallSpeed;
}
}
else
{
this.velocity.Y = this.velocity.Y * 0.7f;
if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1)
{
this.velocity.Y = 0f;
}
}
}
else if (this.controlDown)
{
this.ropeCount = 10;
this.pulley = false;
this.velocity.Y = 1f;
}
else
{
this.velocity.Y = 0f;
this.position.Y = (float)(num57 * 16 + 22);
}
float num61 = (float)(num56 * 16 + 8 - this.width / 2);
if (this.pulleyDir == 1)
{
num61 = (float)(num56 * 16 + 8 - this.width / 2);
}
if (this.pulleyDir == 2)
{
num61 = (float)(num56 * 16 + 8 - this.width / 2 + 6 * this.direction);
}
if (i == Main.myPlayer)
{
Main.cameraX = Main.cameraX + this.position.X - num61;
}
this.position.X = num61;
this.pulleyFrameCounter += Math.Abs(this.velocity.Y * 0.75f);
if (this.velocity.Y != 0f)
{
this.pulleyFrameCounter += 0.75f;
}
if (this.pulleyFrameCounter > 10f)
{
this.pulleyFrame++;
this.pulleyFrameCounter = 0f;
}
if (this.pulleyFrame > 1)
{
this.pulleyFrame = 0;
}
this.canCarpet = true;
this.carpetFrame = -1;
this.wingTime = (float)this.wingTimeMax;
this.rocketTime = this.rocketTimeMax;
this.rocketDelay = 0;
this.rocketFrame = false;
this.canRocket = false;
this.rocketRelease = false;
}
else if (this.grappling[0] == -1 && !this.tongued)
{
if (this.wingsLogic > 0 && this.velocity.Y != 0f && !this.merman)
{
if (this.wingsLogic == 1 || this.wingsLogic == 2)
{
this.accRunSpeed = 6.25f;
}
if (this.wingsLogic == 4)
{
this.accRunSpeed = 6.5f;
}
if (this.wingsLogic == 5 || this.wingsLogic == 6 || this.wingsLogic == 13 || this.wingsLogic == 15)
{
this.accRunSpeed = 6.75f;
}
if (this.wingsLogic == 7 || this.wingsLogic == 8)
{
this.accRunSpeed = 7f;
}
if (this.wingsLogic == 9 || this.wingsLogic == 10 || this.wingsLogic == 11 || this.wingsLogic == 20 || this.wingsLogic == 21 || this.wingsLogic == 23 || this.wingsLogic == 24)
{
this.accRunSpeed = 7.5f;
}
if (this.wingsLogic == 22)
{
if (this.controlDown && this.controlJump && this.wingTime > 0f)
{
this.accRunSpeed = 10f;
this.runAcceleration *= 10f;
}
else
{
this.accRunSpeed = 6.25f;
}
}
if (this.wingsLogic == 30)
{
if (this.controlDown && this.controlJump && this.wingTime > 0f)
{
this.accRunSpeed = 12f;
this.runAcceleration *= 12f;
}
else
{
this.accRunSpeed = 6.5f;
this.runAcceleration *= 1.5f;
}
}
if (this.wingsLogic == 32)
{
if (this.controlDown && this.controlJump && this.wingTime > 0f)
{
this.accRunSpeed = 7.5f;
this.runAcceleration *= 5f;
}
else
{
this.accRunSpeed = 5.5f;
this.runAcceleration *= 1.1f;
}
}
if (this.wingsLogic == 26)
{
this.accRunSpeed = 8f;
this.runAcceleration *= 2f;
}
if (this.wingsLogic == 29)
{
this.accRunSpeed = 9f;
this.runAcceleration *= 2.5f;
}
if (this.wingsLogic == 12)
{
this.accRunSpeed = 7.75f;
}
if (this.wingsLogic == 16 || this.wingsLogic == 17 || this.wingsLogic == 18 || this.wingsLogic == 19 || this.wingsLogic == 34 || this.wingsLogic == 3 || this.wingsLogic == 28 || this.wingsLogic == 33 || this.wingsLogic == 34 || this.wingsLogic == 35 || this.wingsLogic == 36)
{
this.accRunSpeed = 7f;
}
}
if (this.sticky)
{
this.maxRunSpeed *= 0.25f;
this.runAcceleration *= 0.25f;
this.runSlowdown *= 2f;
if (this.velocity.X > this.maxRunSpeed)
{
this.velocity.X = this.maxRunSpeed;
}
if (this.velocity.X < -this.maxRunSpeed)
{
this.velocity.X = -this.maxRunSpeed;
}
}
else if (this.powerrun)
{
this.maxRunSpeed *= 3.5f;
this.runAcceleration *= 1f;
this.runSlowdown *= 2f;
}
else if (this.slippy2)
{
this.runAcceleration *= 0.6f;
this.runSlowdown = 0f;
if (this.iceSkate)
{
this.runAcceleration *= 3.5f;
this.maxRunSpeed *= 1.25f;
}
}
else if (this.slippy)
{
this.runAcceleration *= 0.7f;
if (this.iceSkate)
{
this.runAcceleration *= 3.5f;
this.maxRunSpeed *= 1.25f;
}
else
{
this.runSlowdown *= 0.1f;
}
}
if (this.sandStorm)
{
this.runAcceleration *= 1.5f;
this.maxRunSpeed *= 2f;
}
if (this.dJumpEffectBlizzard && this.doubleJumpBlizzard)
{
this.runAcceleration *= 3f;
this.maxRunSpeed *= 1.5f;
}
if (this.dJumpEffectFart && this.doubleJumpFart)
{
this.runAcceleration *= 3f;
this.maxRunSpeed *= 1.75f;
}
if (this.dJumpEffectUnicorn && this.doubleJumpUnicorn)
{
this.runAcceleration *= 3f;
this.maxRunSpeed *= 1.5f;
}
if (this.dJumpEffectSail && this.doubleJumpSail)
{
this.runAcceleration *= 1.5f;
this.maxRunSpeed *= 1.25f;
}
if (this.carpetFrame != -1)
{
this.runAcceleration *= 1.25f;
this.maxRunSpeed *= 1.5f;
}
if (this.inventory[this.selectedItem].type == 3106 && this.stealth < 1f)
{
float num62 = this.maxRunSpeed / 2f * (1f - this.stealth);
this.maxRunSpeed -= num62;
this.accRunSpeed = this.maxRunSpeed;
}
if (this.mount.Active)
{
this.rocketBoots = 0;
this.wings = 0;
this.wingsLogic = 0;
this.maxRunSpeed = this.mount.RunSpeed;
this.accRunSpeed = this.mount.DashSpeed;
this.runAcceleration = this.mount.Acceleration;
if (this.mount.Type == 12 && !this.MountFishronSpecial)
{
this.runAcceleration /= 2f;
this.maxRunSpeed /= 2f;
}
this.mount.AbilityRecovery();
if (this.mount.Cart && this.velocity.Y == 0f)
{
if (!Minecart.OnTrack(this.position, this.width, this.height))
{
this.fullRotation = 0f;
this.onWrongGround = true;
this.runSlowdown = 0.2f;
if ((this.controlLeft && this.releaseLeft) || (this.controlRight && this.releaseRight))
{
this.mount.Dismount(this);
}
}
else
{
this.runSlowdown = this.runAcceleration;
this.onWrongGround = false;
}
}
if (this.mount.Type == 8)
{
this.mount.UpdateDrill(this, this.controlUp, this.controlDown);
}
}
this.HorizontalMovement();
if (this.gravControl)
{
if (this.controlUp && this.releaseUp)
{
if (this.gravDir == 1f)
{
this.gravDir = -1f;
this.fallStart = (int)(this.position.Y / 16f);
this.jump = 0;
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8);
}
else
{
this.gravDir = 1f;
this.fallStart = (int)(this.position.Y / 16f);
this.jump = 0;
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8);
}
}
}
else if (this.gravControl2)
{
if (this.controlUp && this.releaseUp && this.velocity.Y == 0f)
{
if (this.gravDir == 1f)
{
this.gravDir = -1f;
this.fallStart = (int)(this.position.Y / 16f);
this.jump = 0;
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8);
}
else
{
this.gravDir = 1f;
this.fallStart = (int)(this.position.Y / 16f);
this.jump = 0;
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8);
}
}
}
else
{
this.gravDir = 1f;
}
if (this.velocity.Y == 0f && this.mount.Active && this.mount.CanHover && this.controlUp && this.releaseUp)
{
this.velocity.Y = -(this.mount.Acceleration + this.gravity + 0.001f);
}
if (this.controlUp)
{
this.releaseUp = false;
}
else
{
this.releaseUp = true;
}
this.sandStorm = false;
this.JumpMovement();
if (this.wingsLogic == 0)
{
this.wingTime = 0f;
}
if (this.rocketBoots == 0)
{
this.rocketTime = 0;
}
if (this.jump == 0)
{
this.dJumpEffectCloud = false;
this.dJumpEffectSandstorm = false;
this.dJumpEffectBlizzard = false;
this.dJumpEffectFart = false;
this.dJumpEffectSail = false;
this.dJumpEffectUnicorn = false;
}
this.DashMovement();
this.WallslideMovement();
this.CarpetMovement();
this.DoubleJumpVisuals();
if (this.wings > 0 || this.mount.Active)
{
this.sandStorm = false;
}
if (((this.gravDir == 1f && this.velocity.Y > -Player.jumpSpeed) || (this.gravDir == -1f && this.velocity.Y < Player.jumpSpeed)) && this.velocity.Y != 0f)
{
this.canRocket = true;
}
bool flag22 = false;
if (((this.velocity.Y == 0f || this.sliding) && this.releaseJump) || (this.autoJump && this.justJumped))
{
this.mount.ResetFlightTime(this.velocity.X);
this.wingTime = (float)this.wingTimeMax;
}
if (this.wingsLogic > 0 && this.controlJump && this.wingTime > 0f && !this.jumpAgainCloud && this.jump == 0 && this.velocity.Y != 0f)
{
flag22 = true;
}
if ((this.wingsLogic == 22 || this.wingsLogic == 28 || this.wingsLogic == 30 || this.wingsLogic == 32 || this.wingsLogic == 33 || this.wingsLogic == 35) && this.controlJump && this.controlDown && this.wingTime > 0f)
{
flag22 = true;
}
if (this.frozen || this.webbed || this.stoned)
{
if (this.mount.Active)
{
this.mount.Dismount(this);
}
this.velocity.Y = this.velocity.Y + this.gravity;
if (this.velocity.Y > this.maxFallSpeed)
{
this.velocity.Y = this.maxFallSpeed;
}
this.sandStorm = false;
this.dJumpEffectCloud = false;
this.dJumpEffectSandstorm = false;
this.dJumpEffectBlizzard = false;
this.dJumpEffectFart = false;
this.dJumpEffectSail = false;
this.dJumpEffectUnicorn = false;
}
else
{
if (flag22)
{
if (this.wings == 10 && Main.rand.Next(2) == 0)
{
int num63 = 4;
if (this.direction == 1)
{
num63 = -40;
}
int num64 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num63, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 76, 0f, 0f, 50, default(Color), 0.6f);
Main.dust[num64].fadeIn = 1.1f;
Main.dust[num64].noGravity = true;
Main.dust[num64].noLight = true;
Main.dust[num64].velocity *= 0.3f;
Main.dust[num64].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
if (this.wings == 34 && Main.rand.Next(2) == 0)
{
int num65 = 4;
if (this.direction == 1)
{
num65 = -40;
}
int num66 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num65, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 261, 0f, 0f, 50, default(Color), 0.6f);
Main.dust[num66].fadeIn = 1.1f;
Main.dust[num66].noGravity = true;
Main.dust[num66].noLight = true;
Main.dust[num66].velocity *= 0.3f;
Main.dust[num66].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
if (this.wings == 9 && Main.rand.Next(2) == 0)
{
int num67 = 4;
if (this.direction == 1)
{
num67 = -40;
}
int num68 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num67, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 6, 0f, 0f, 200, default(Color), 2f);
Main.dust[num68].noGravity = true;
Main.dust[num68].velocity *= 0.3f;
Main.dust[num68].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
if (this.wings == 6 && Main.rand.Next(4) == 0)
{
int num69 = 4;
if (this.direction == 1)
{
num69 = -40;
}
int num70 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num69, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 55, 0f, 0f, 200, default(Color), 1f);
Main.dust[num70].velocity *= 0.3f;
Main.dust[num70].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
if (this.wings == 5 && Main.rand.Next(3) == 0)
{
int num71 = 6;
if (this.direction == 1)
{
num71 = -30;
}
int num72 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num71, this.position.Y), 18, this.height, 58, 0f, 0f, 255, default(Color), 1.2f);
Main.dust[num72].velocity *= 0.3f;
Main.dust[num72].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
if (this.wings == 26)
{
int num73 = 6;
if (this.direction == 1)
{
num73 = -30;
}
int num74 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num73, this.position.Y), 18, this.height, 217, 0f, 0f, 100, default(Color), 1.4f);
Main.dust[num74].noGravity = true;
Main.dust[num74].noLight = true;
Main.dust[num74].velocity /= 4f;
Main.dust[num74].velocity -= this.velocity;
Main.dust[num74].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
if (Main.rand.Next(2) == 0)
{
num73 = -24;
if (this.direction == 1)
{
num73 = 12;
}
float num75 = this.position.Y;
if (this.gravDir == -1f)
{
num75 += (float)(this.height / 2);
}
num74 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num73, num75), 12, this.height / 2, 217, 0f, 0f, 100, default(Color), 1.4f);
Main.dust[num74].noGravity = true;
Main.dust[num74].noLight = true;
Main.dust[num74].velocity /= 4f;
Main.dust[num74].velocity -= this.velocity;
Main.dust[num74].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
}
if (this.wings == 29 && Main.rand.Next(3) == 0)
{
int num76 = 4;
if (this.direction == 1)
{
num76 = -40;
}
int num77 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num76, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default(Color), 2.4f);
Main.dust[num77].noGravity = true;
Main.dust[num77].velocity *= 0.3f;
if (Main.rand.Next(10) == 0)
{
Main.dust[num77].fadeIn = 2f;
}
Main.dust[num77].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
if (this.wings == 31)
{
if (Main.rand.Next(6) == 0)
{
int num78 = 4;
if (this.direction == 1)
{
num78 = -40;
}
Dust dust3 = Main.dust[Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num78, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 86, 0f, 0f, 0, default(Color), 1f)];
dust3.noGravity = true;
dust3.scale = 1f;
dust3.fadeIn = 1.2f;
dust3.velocity *= 0.2f;
dust3.noLight = true;
dust3.shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
if (Main.rand.Next(3) == 0)
{
int num79 = 4;
if (this.direction == 1)
{
num79 = -40;
}
Dust dust4 = Main.dust[Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num79, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 240, 0f, 0f, 0, default(Color), 1f)];
dust4.noGravity = true;
dust4.scale = 1.2f;
dust4.velocity *= 0.2f;
dust4.alpha = 200;
dust4.shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
if (Main.rand.Next(2) == 0)
{
if (Main.rand.Next(6) == 0)
{
int num80 = -24;
if (this.direction == 1)
{
num80 = 12;
}
float num81 = this.position.Y;
if (this.gravDir == -1f)
{
num81 += (float)(this.height / 2);
}
Dust dust5 = Main.dust[Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num80, num81), 12, this.height / 2, 86, 0f, 0f, 0, default(Color), 1f)];
dust5.noGravity = true;
dust5.scale = 1f;
dust5.fadeIn = 1.2f;
dust5.velocity *= 0.2f;
dust5.noLight = true;
dust5.shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
if (Main.rand.Next(3) == 0)
{
int num80 = -24;
if (this.direction == 1)
{
num80 = 12;
}
float num82 = this.position.Y;
if (this.gravDir == -1f)
{
num82 += (float)(this.height / 2);
}
Dust dust6 = Main.dust[Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num80, num82), 12, this.height / 2, 240, 0f, 0f, 0, default(Color), 1f)];
dust6.noGravity = true;
dust6.scale = 1.2f;
dust6.velocity *= 0.2f;
dust6.alpha = 200;
dust6.shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
}
}
this.WingMovement();
}
if (this.wings == 4)
{
if (flag22 || this.jump > 0)
{
this.rocketDelay2--;
if (this.rocketDelay2 <= 0)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 13);
this.rocketDelay2 = 60;
}
int num83 = 2;
if (this.controlUp)
{
num83 = 4;
}
for (int num84 = 0; num84 < num83; num84++)
{
int type = 6;
if (this.head == 41)
{
int arg_5AFE_0 = this.body;
}
float scale = 1.75f;
int alpha = 100;
float x3 = this.position.X + (float)(this.width / 2) + 16f;
if (this.direction > 0)
{
x3 = this.position.X + (float)(this.width / 2) - 26f;
}
float num85 = this.position.Y + (float)this.height - 18f;
if (num84 == 1 || num84 == 3)
{
x3 = this.position.X + (float)(this.width / 2) + 8f;
if (this.direction > 0)
{
x3 = this.position.X + (float)(this.width / 2) - 20f;
}
num85 += 6f;
}
if (num84 > 1)
{
num85 += this.velocity.Y;
}
int num86 = Dust.NewDust(new Vector2(x3, num85), 8, 8, type, 0f, 0f, alpha, default(Color), scale);
Dust expr_5C11_cp_0 = Main.dust[num86];
expr_5C11_cp_0.velocity.X = expr_5C11_cp_0.velocity.X * 0.1f;
Main.dust[num86].velocity.Y = Main.dust[num86].velocity.Y * 1f + 2f * this.gravDir - this.velocity.Y * 0.3f;
Main.dust[num86].noGravity = true;
Main.dust[num86].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
if (num83 == 4)
{
Dust expr_5CA9_cp_0 = Main.dust[num86];
expr_5CA9_cp_0.velocity.Y = expr_5CA9_cp_0.velocity.Y + 6f;
}
}
this.wingFrameCounter++;
if (this.wingFrameCounter > 4)
{
this.wingFrame++;
this.wingFrameCounter = 0;
if (this.wingFrame >= 3)
{
this.wingFrame = 0;
}
}
}
else if (!this.controlJump || this.velocity.Y == 0f)
{
this.wingFrame = 3;
}
}
else if (this.wings == 28)
{
if (this.velocity.Y != 0f)
{
Lighting.AddLight(base.Bottom, 0.3f, 0.1f, 0.4f);
}
}
else if (this.wings == 22)
{
if (!this.controlJump)
{
this.wingFrame = 0;
this.wingFrameCounter = 0;
}
else if (this.wingTime > 0f)
{
if (this.controlDown)
{
if (this.velocity.X != 0f)
{
this.wingFrameCounter++;
int num87 = 2;
if (this.wingFrameCounter < num87)
{
this.wingFrame = 1;
}
else if (this.wingFrameCounter < num87 * 2)
{
this.wingFrame = 2;
}
else if (this.wingFrameCounter < num87 * 3)
{
this.wingFrame = 3;
}
else if (this.wingFrameCounter < num87 * 4 - 1)
{
this.wingFrame = 2;
}
else
{
this.wingFrame = 2;
this.wingFrameCounter = 0;
}
}
else
{
this.wingFrameCounter++;
int num88 = 6;
if (this.wingFrameCounter < num88)
{
this.wingFrame = 4;
}
else if (this.wingFrameCounter < num88 * 2)
{
this.wingFrame = 5;
}
else if (this.wingFrameCounter < num88 * 3 - 1)
{
this.wingFrame = 4;
}
else
{
this.wingFrame = 4;
this.wingFrameCounter = 0;
}
}
}
else
{
this.wingFrameCounter++;
int num89 = 2;
if (this.wingFrameCounter < num89)
{
this.wingFrame = 4;
}
else if (this.wingFrameCounter < num89 * 2)
{
this.wingFrame = 5;
}
else if (this.wingFrameCounter < num89 * 3)
{
this.wingFrame = 6;
}
else if (this.wingFrameCounter < num89 * 4 - 1)
{
this.wingFrame = 5;
}
else
{
this.wingFrame = 5;
this.wingFrameCounter = 0;
}
}
}
else
{
this.wingFrameCounter++;
int num90 = 6;
if (this.wingFrameCounter < num90)
{
this.wingFrame = 4;
}
else if (this.wingFrameCounter < num90 * 2)
{
this.wingFrame = 5;
}
else if (this.wingFrameCounter < num90 * 3 - 1)
{
this.wingFrame = 4;
}
else
{
this.wingFrame = 4;
this.wingFrameCounter = 0;
}
}
}
else if (this.wings == 12)
{
if (flag22 || this.jump > 0)
{
this.wingFrameCounter++;
int num91 = 5;
if (this.wingFrameCounter < num91)
{
this.wingFrame = 1;
}
else if (this.wingFrameCounter < num91 * 2)
{
this.wingFrame = 2;
}
else if (this.wingFrameCounter < num91 * 3)
{
this.wingFrame = 3;
}
else if (this.wingFrameCounter < num91 * 4 - 1)
{
this.wingFrame = 2;
}
else
{
this.wingFrame = 2;
this.wingFrameCounter = 0;
}
}
else if (this.velocity.Y != 0f)
{
this.wingFrame = 2;
}
else
{
this.wingFrame = 0;
}
}
else if (this.wings == 24)
{
if (flag22 || this.jump > 0)
{
this.wingFrameCounter++;
int num92 = 1;
if (this.wingFrameCounter < num92)
{
this.wingFrame = 1;
}
else if (this.wingFrameCounter < num92 * 2)
{
this.wingFrame = 2;
}
else if (this.wingFrameCounter < num92 * 3)
{
this.wingFrame = 3;
}
else
{
this.wingFrame = 2;
if (this.wingFrameCounter >= num92 * 4 - 1)
{
this.wingFrameCounter = 0;
}
}
}
else if (this.velocity.Y != 0f)
{
if (this.controlJump)
{
this.wingFrameCounter++;
int num93 = 3;
if (this.wingFrameCounter < num93)
{
this.wingFrame = 1;
}
else if (this.wingFrameCounter < num93 * 2)
{
this.wingFrame = 2;
}
else if (this.wingFrameCounter < num93 * 3)
{
this.wingFrame = 3;
}
else
{
this.wingFrame = 2;
if (this.wingFrameCounter >= num93 * 4 - 1)
{
this.wingFrameCounter = 0;
}
}
}
else if (this.wingTime == 0f)
{
this.wingFrame = 0;
}
else
{
this.wingFrame = 1;
}
}
else
{
this.wingFrame = 0;
}
}
else if (this.wings == 30)
{
bool flag23 = false;
if (flag22 || this.jump > 0)
{
this.wingFrameCounter++;
int num94 = 2;
if (this.wingFrameCounter >= num94 * 3)
{
this.wingFrameCounter = 0;
}
this.wingFrame = 1 + this.wingFrameCounter / num94;
flag23 = true;
}
else if (this.velocity.Y != 0f)
{
if (this.controlJump)
{
this.wingFrameCounter++;
int num95 = 2;
if (this.wingFrameCounter >= num95 * 3)
{
this.wingFrameCounter = 0;
}
this.wingFrame = 1 + this.wingFrameCounter / num95;
flag23 = true;
}
else if (this.wingTime == 0f)
{
this.wingFrame = 0;
}
else
{
this.wingFrame = 0;
}
}
else
{
this.wingFrame = 0;
}
if (flag23)
{
for (int num96 = 0; num96 < 4; num96++)
{
if (Main.rand.Next(4) == 0)
{
Vector2 value = (-0.745398164f + 0.3926991f * (float)num96 + 0.03f * (float)num96).ToRotationVector2() * new Vector2((float)(-(float)this.direction * 20), 20f);
Dust dust7 = Main.dust[Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100, Color.White, 0.8f)];
dust7.noGravity = true;
dust7.position = base.Center + value;
dust7.velocity = base.DirectionTo(dust7.position) * 2f;
if (Main.rand.Next(10) != 0)
{
dust7.customData = this;
}
else
{
dust7.fadeIn = 0.5f;
}
dust7.shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
}
for (int num97 = 0; num97 < 4; num97++)
{
if (Main.rand.Next(8) == 0)
{
Vector2 value2 = (-0.7053982f + 0.3926991f * (float)num97 + 0.03f * (float)num97).ToRotationVector2() * new Vector2((float)(this.direction * 20), 24f) + new Vector2((float)(-(float)this.direction) * 16f, 0f);
Dust dust8 = Main.dust[Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100, Color.White, 0.5f)];
dust8.noGravity = true;
dust8.position = base.Center + value2;
dust8.velocity = Vector2.Normalize(dust8.position - base.Center - new Vector2((float)(-(float)this.direction) * 16f, 0f)) * 2f;
dust8.position += dust8.velocity * 5f;
if (Main.rand.Next(10) != 0)
{
dust8.customData = this;
}
else
{
dust8.fadeIn = 0.5f;
}
dust8.shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
}
}
}
else if (this.wings == 34)
{
if (flag22 || this.jump > 0)
{
this.wingFrameCounter++;
int num98 = 4;
if (this.wingFrameCounter >= num98 * 6)
{
this.wingFrameCounter = 0;
}
this.wingFrame = this.wingFrameCounter / num98;
}
else if (this.velocity.Y != 0f)
{
if (this.controlJump)
{
this.wingFrameCounter++;
int num99 = 9;
if (this.wingFrameCounter >= num99 * 6)
{
this.wingFrameCounter = 0;
}
this.wingFrame = this.wingFrameCounter / num99;
}
else
{
this.wingFrameCounter++;
int num100 = 6;
if (this.wingFrameCounter >= num100 * 6)
{
this.wingFrameCounter = 0;
}
this.wingFrame = this.wingFrameCounter / num100;
}
}
else
{
this.wingFrameCounter++;
int num101 = 4;
if (this.wingFrameCounter >= num101 * 6)
{
this.wingFrameCounter = 0;
}
this.wingFrame = this.wingFrameCounter / num101;
}
}
else if (this.wings == 33)
{
bool flag24 = false;
if (flag22 || this.jump > 0)
{
flag24 = true;
}
else if (this.velocity.Y != 0f && this.controlJump)
{
flag24 = true;
}
if (flag24)
{
Color newColor = Main.hslToRgb(Main.rgbToHsl(this.eyeColor).X, 1f, 0.5f);
int num102 = (this.direction == 1) ? 0 : -4;
for (int num103 = 0; num103 < 2; num103++)
{
Dust dust9 = Main.dust[Dust.NewDust(this.position, this.width, this.height, 182, this.velocity.X, this.velocity.Y, 127, newColor, 1f)];
dust9.noGravity = true;
dust9.fadeIn = 1f;
dust9.scale = 1f;
dust9.noLight = true;
if (num103 == 0)
{
dust9.position = new Vector2(this.position.X + (float)num102, this.position.Y + (float)this.height);
dust9.velocity.X = dust9.velocity.X * 1f - 2f - this.velocity.X * 0.3f;
dust9.velocity.Y = dust9.velocity.Y * 1f + 2f * this.gravDir - this.velocity.Y * 0.3f;
}
else if (num103 == 1)
{
dust9.position = new Vector2(this.position.X + (float)this.width + (float)num102, this.position.Y + (float)this.height);
dust9.velocity.X = dust9.velocity.X * 1f + 2f - this.velocity.X * 0.3f;
dust9.velocity.Y = dust9.velocity.Y * 1f + 2f * this.gravDir - this.velocity.Y * 0.3f;
}
Dust dust10 = Dust.CloneDust(dust9);
dust10.scale *= 0.65f;
dust10.fadeIn *= 0.65f;
dust10.color = new Color(255, 255, 255, 255);
dust9.noLight = true;
dust9.shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
}
}
else
{
int num104 = 4;
if (this.wings == 32)
{
num104 = 3;
}
if (flag22 || this.jump > 0)
{
this.wingFrameCounter++;
if (this.wingFrameCounter > num104)
{
this.wingFrame++;
this.wingFrameCounter = 0;
if (this.wingFrame >= 4)
{
this.wingFrame = 0;
}
}
}
else if (this.velocity.Y != 0f)
{
this.wingFrame = 1;
if (this.wings == 32)
{
this.wingFrame = 3;
}
if (this.wings == 29 && Main.rand.Next(5) == 0)
{
int num105 = 4;
if (this.direction == 1)
{
num105 = -40;
}
int num106 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num105, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default(Color), 2.4f);
Main.dust[num106].noGravity = true;
Main.dust[num106].velocity *= 0.3f;
if (Main.rand.Next(10) == 0)
{
Main.dust[num106].fadeIn = 2f;
}
Main.dust[num106].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
}
else
{
this.wingFrame = 0;
}
}
if (this.wingsLogic > 0 && this.rocketBoots > 0 && this.velocity.Y != 0f)
{
this.wingTime += (float)(this.rocketTime * 6);
this.rocketTime = 0;
}
if (flag22 && this.wings != 4 && this.wings != 22 && this.wings != 0 && this.wings != 24 && this.wings != 28 && this.wings != 30 && this.wings != 33)
{
if (this.wingFrame == 3)
{
if (!this.flapSound)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 32);
}
this.flapSound = true;
}
else
{
this.flapSound = false;
}
}
if (this.velocity.Y == 0f || this.sliding || (this.autoJump && this.justJumped))
{
this.rocketTime = this.rocketTimeMax;
}
if ((this.wingTime == 0f || this.wingsLogic == 0) && this.rocketBoots > 0 && this.controlJump && this.rocketDelay == 0 && this.canRocket && this.rocketRelease && !this.jumpAgainCloud)
{
if (this.rocketTime > 0)
{
this.rocketTime--;
this.rocketDelay = 10;
if (this.rocketDelay2 <= 0)
{
if (this.rocketBoots == 1)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 13);
this.rocketDelay2 = 30;
}
else if (this.rocketBoots == 2 || this.rocketBoots == 3)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 24);
this.rocketDelay2 = 15;
}
}
}
else
{
this.canRocket = false;
}
}
if (this.rocketDelay2 > 0)
{
this.rocketDelay2--;
}
if (this.rocketDelay == 0)
{
this.rocketFrame = false;
}
if (this.rocketDelay > 0)
{
int num107 = this.height;
if (this.gravDir == -1f)
{
num107 = 4;
}
this.rocketFrame = true;
for (int num108 = 0; num108 < 2; num108++)
{
int type2 = 6;
float scale2 = 2.5f;
int alpha2 = 100;
if (this.rocketBoots == 2)
{
type2 = 16;
scale2 = 1.5f;
alpha2 = 20;
}
else if (this.rocketBoots == 3)
{
type2 = 76;
scale2 = 1f;
alpha2 = 20;
}
else if (this.socialShadow)
{
type2 = 27;
scale2 = 1.5f;
}
if (num108 == 0)
{
int num109 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float)num107 - 10f), 8, 8, type2, 0f, 0f, alpha2, default(Color), scale2);
Main.dust[num109].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this);
if (this.rocketBoots == 1)
{
Main.dust[num109].noGravity = true;
}
Main.dust[num109].velocity.X = Main.dust[num109].velocity.X * 1f - 2f - this.velocity.X * 0.3f;
Main.dust[num109].velocity.Y = Main.dust[num109].velocity.Y * 1f + 2f * this.gravDir - this.velocity.Y * 0.3f;
if (this.rocketBoots == 2)
{
Main.dust[num109].velocity *= 0.1f;
}
if (this.rocketBoots == 3)
{
Main.dust[num109].velocity *= 0.05f;
Dust expr_6EBC_cp_0 = Main.dust[num109];
expr_6EBC_cp_0.velocity.Y = expr_6EBC_cp_0.velocity.Y + 0.15f;
Main.dust[num109].noLight = true;
if (Main.rand.Next(2) == 0)
{
Main.dust[num109].noGravity = true;
Main.dust[num109].scale = 1.75f;
}
}
}
else
{
int num110 = Dust.NewDust(new Vector2(this.position.X + (float)this.width - 4f, this.position.Y + (float)num107 - 10f), 8, 8, type2, 0f, 0f, alpha2, default(Color), scale2);
Main.dust[num110].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this);
if (this.rocketBoots == 1)
{
Main.dust[num110].noGravity = true;
}
Main.dust[num110].velocity.X = Main.dust[num110].velocity.X * 1f + 2f - this.velocity.X * 0.3f;
Main.dust[num110].velocity.Y = Main.dust[num110].velocity.Y * 1f + 2f * this.gravDir - this.velocity.Y * 0.3f;
if (this.rocketBoots == 2)
{
Main.dust[num110].velocity *= 0.1f;
}
if (this.rocketBoots == 3)
{
Main.dust[num110].velocity *= 0.05f;
Dust expr_7083_cp_0 = Main.dust[num110];
expr_7083_cp_0.velocity.Y = expr_7083_cp_0.velocity.Y + 0.15f;
Main.dust[num110].noLight = true;
if (Main.rand.Next(2) == 0)
{
Main.dust[num110].noGravity = true;
Main.dust[num110].scale = 1.75f;
}
}
}
}
if (this.rocketDelay == 0)
{
this.releaseJump = true;
}
this.rocketDelay--;
this.velocity.Y = this.velocity.Y - 0.1f * this.gravDir;
if (this.gravDir == 1f)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y - 0.5f;
}
else if ((double)this.velocity.Y > (double)(-(double)Player.jumpSpeed) * 0.5)
{
this.velocity.Y = this.velocity.Y - 0.1f;
}
if (this.velocity.Y < -Player.jumpSpeed * 1.5f)
{
this.velocity.Y = -Player.jumpSpeed * 1.5f;
}
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y + 0.5f;
}
else if ((double)this.velocity.Y < (double)Player.jumpSpeed * 0.5)
{
this.velocity.Y = this.velocity.Y + 0.1f;
}
if (this.velocity.Y > Player.jumpSpeed * 1.5f)
{
this.velocity.Y = Player.jumpSpeed * 1.5f;
}
}
}
else if (!flag22)
{
if (this.mount.CanHover)
{
this.mount.Hover(this);
}
else if (this.mount.CanFly && this.controlJump && this.jump == 0)
{
if (this.mount.Flight())
{
if (this.controlDown)
{
this.velocity.Y = this.velocity.Y * 0.9f;
if (this.velocity.Y > -1f && (double)this.velocity.Y < 0.5)
{
this.velocity.Y = 1E-05f;
}
}
else
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y - 0.5f;
}
else if ((double)this.velocity.Y > (double)(-(double)Player.jumpSpeed) * 1.5)
{
this.velocity.Y = this.velocity.Y - 0.1f;
}
if (this.velocity.Y < -Player.jumpSpeed * 1.5f)
{
this.velocity.Y = -Player.jumpSpeed * 1.5f;
}
}
}
else
{
this.velocity.Y = this.velocity.Y + this.gravity / 3f * this.gravDir;
if (this.gravDir == 1f)
{
if (this.velocity.Y > this.maxFallSpeed / 3f && !this.controlDown)
{
this.velocity.Y = this.maxFallSpeed / 3f;
}
}
else if (this.velocity.Y < -this.maxFallSpeed / 3f && !this.controlUp)
{
this.velocity.Y = -this.maxFallSpeed / 3f;
}
}
}
else if (this.slowFall && ((!this.controlDown && this.gravDir == 1f) || (!this.controlDown && this.gravDir == -1f)))
{
if ((this.controlUp && this.gravDir == 1f) || (this.controlUp && this.gravDir == -1f))
{
this.gravity = this.gravity / 10f * this.gravDir;
}
else
{
this.gravity = this.gravity / 3f * this.gravDir;
}
this.velocity.Y = this.velocity.Y + this.gravity;
}
else if (this.wingsLogic > 0 && this.controlJump && this.velocity.Y > 0f)
{
this.fallStart = (int)(this.position.Y / 16f);
if (this.velocity.Y > 0f)
{
if (this.wings == 10 && Main.rand.Next(3) == 0)
{
int num111 = 4;
if (this.direction == 1)
{
num111 = -40;
}
int num112 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num111, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 76, 0f, 0f, 50, default(Color), 0.6f);
Main.dust[num112].fadeIn = 1.1f;
Main.dust[num112].noGravity = true;
Main.dust[num112].noLight = true;
Main.dust[num112].velocity *= 0.3f;
Main.dust[num112].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
if (this.wings == 34 && Main.rand.Next(3) == 0)
{
int num113 = 4;
if (this.direction == 1)
{
num113 = -40;
}
int num114 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num113, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 261, 0f, 0f, 50, default(Color), 0.6f);
Main.dust[num114].fadeIn = 1.1f;
Main.dust[num114].noGravity = true;
Main.dust[num114].noLight = true;
Main.dust[num114].velocity *= 0.3f;
Main.dust[num114].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
if (this.wings == 9 && Main.rand.Next(3) == 0)
{
int num115 = 8;
if (this.direction == 1)
{
num115 = -40;
}
int num116 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num115, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 6, 0f, 0f, 200, default(Color), 2f);
Main.dust[num116].noGravity = true;
Main.dust[num116].velocity *= 0.3f;
Main.dust[num116].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
if (this.wings == 29 && Main.rand.Next(3) == 0)
{
int num117 = 8;
if (this.direction == 1)
{
num117 = -40;
}
int num118 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num117, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default(Color), 2.4f);
Main.dust[num118].noGravity = true;
Main.dust[num118].velocity *= 0.3f;
if (Main.rand.Next(10) == 0)
{
Main.dust[num118].fadeIn = 2f;
}
Main.dust[num118].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
if (this.wings == 6)
{
if (Main.rand.Next(10) == 0)
{
int num119 = 4;
if (this.direction == 1)
{
num119 = -40;
}
int num120 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num119, this.position.Y + (float)(this.height / 2) - 12f), 30, 20, 55, 0f, 0f, 200, default(Color), 1f);
Main.dust[num120].velocity *= 0.3f;
Main.dust[num120].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
}
else if (this.wings == 5 && Main.rand.Next(6) == 0)
{
int num121 = 6;
if (this.direction == 1)
{
num121 = -30;
}
int num122 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num121, this.position.Y), 18, this.height, 58, 0f, 0f, 255, default(Color), 1.2f);
Main.dust[num122].velocity *= 0.3f;
Main.dust[num122].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
if (this.wings == 4)
{
this.rocketDelay2--;
if (this.rocketDelay2 <= 0)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 13);
this.rocketDelay2 = 60;
}
int type3 = 6;
float scale3 = 1.5f;
int alpha3 = 100;
float x4 = this.position.X + (float)(this.width / 2) + 16f;
if (this.direction > 0)
{
x4 = this.position.X + (float)(this.width / 2) - 26f;
}
float num123 = this.position.Y + (float)this.height - 18f;
if (Main.rand.Next(2) == 1)
{
x4 = this.position.X + (float)(this.width / 2) + 8f;
if (this.direction > 0)
{
x4 = this.position.X + (float)(this.width / 2) - 20f;
}
num123 += 6f;
}
int num124 = Dust.NewDust(new Vector2(x4, num123), 8, 8, type3, 0f, 0f, alpha3, default(Color), scale3);
Dust expr_7C2C_cp_0 = Main.dust[num124];
expr_7C2C_cp_0.velocity.X = expr_7C2C_cp_0.velocity.X * 0.3f;
Dust expr_7C4A_cp_0 = Main.dust[num124];
expr_7C4A_cp_0.velocity.Y = expr_7C4A_cp_0.velocity.Y + 10f;
Main.dust[num124].noGravity = true;
Main.dust[num124].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
this.wingFrameCounter++;
if (this.wingFrameCounter > 4)
{
this.wingFrame++;
this.wingFrameCounter = 0;
if (this.wingFrame >= 3)
{
this.wingFrame = 0;
}
}
}
else if (this.wings != 22 && this.wings != 28)
{
if (this.wings == 30)
{
this.wingFrameCounter++;
int num125 = 5;
if (this.wingFrameCounter >= num125 * 3)
{
this.wingFrameCounter = 0;
}
this.wingFrame = 1 + this.wingFrameCounter / num125;
}
else if (this.wings == 34)
{
this.wingFrameCounter++;
int num126 = 7;
if (this.wingFrameCounter >= num126 * 6)
{
this.wingFrameCounter = 0;
}
this.wingFrame = this.wingFrameCounter / num126;
}
else if (this.wings == 26)
{
int num127 = 6;
if (this.direction == 1)
{
num127 = -30;
}
int num128 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num127, this.position.Y), 18, this.height, 217, 0f, 0f, 100, default(Color), 1.4f);
Main.dust[num128].noGravity = true;
Main.dust[num128].noLight = true;
Main.dust[num128].velocity /= 4f;
Main.dust[num128].velocity -= this.velocity;
Main.dust[num128].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
if (Main.rand.Next(2) == 0)
{
num127 = -24;
if (this.direction == 1)
{
num127 = 12;
}
float num129 = this.position.Y;
if (this.gravDir == -1f)
{
num129 += (float)(this.height / 2);
}
num128 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num127, num129), 12, this.height / 2, 217, 0f, 0f, 100, default(Color), 1.4f);
Main.dust[num128].noGravity = true;
Main.dust[num128].noLight = true;
Main.dust[num128].velocity /= 4f;
Main.dust[num128].velocity -= this.velocity;
Main.dust[num128].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this);
}
this.wingFrame = 2;
}
else if (this.wings != 24)
{
if (this.wings == 12)
{
this.wingFrame = 3;
}
else
{
this.wingFrame = 2;
}
}
}
}
this.velocity.Y = this.velocity.Y + this.gravity / 3f * this.gravDir;
if (this.gravDir == 1f)
{
if (this.velocity.Y > this.maxFallSpeed / 3f && !this.controlDown)
{
this.velocity.Y = this.maxFallSpeed / 3f;
}
}
else if (this.velocity.Y < -this.maxFallSpeed / 3f && !this.controlUp)
{
this.velocity.Y = -this.maxFallSpeed / 3f;
}
}
else if (this.cartRampTime <= 0)
{
this.velocity.Y = this.velocity.Y + this.gravity * this.gravDir;
}
else
{
this.cartRampTime--;
}
}
if (!this.mount.Active || this.mount.Type != 5)
{
if (this.gravDir == 1f)
{
if (this.velocity.Y > this.maxFallSpeed)
{
this.velocity.Y = this.maxFallSpeed;
}
if (this.slowFall && this.velocity.Y > this.maxFallSpeed / 3f && !this.controlDown)
{
this.velocity.Y = this.maxFallSpeed / 3f;
}
if (this.slowFall && this.velocity.Y > this.maxFallSpeed / 5f && this.controlUp)
{
this.velocity.Y = this.maxFallSpeed / 10f;
}
}
else
{
if (this.velocity.Y < -this.maxFallSpeed)
{
this.velocity.Y = -this.maxFallSpeed;
}
if (this.slowFall && this.velocity.Y < -this.maxFallSpeed / 3f && !this.controlDown)
{
this.velocity.Y = -this.maxFallSpeed / 3f;
}
if (this.slowFall && this.velocity.Y < -this.maxFallSpeed / 5f && this.controlUp)
{
this.velocity.Y = -this.maxFallSpeed / 10f;
}
}
}
}
}
if (this.mount.Active)
{
this.wingFrame = 0;
}
if ((this.wingsLogic == 22 || this.wingsLogic == 28 || this.wingsLogic == 30 || this.wingsLogic == 32 || this.wingsLogic == 33 || this.wingsLogic == 35) && this.controlDown && this.controlJump && this.wingTime > 0f && !this.merman)
{
this.velocity.Y = this.velocity.Y * 0.9f;
if (this.velocity.Y > -2f && this.velocity.Y < 1f)
{
this.velocity.Y = 1E-05f;
}
}
this.GrabItems(i);
if (!Main.mapFullscreen)
{
if (this.position.X / 16f - (float)Player.tileRangeX <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY - 2f >= (float)Player.tileTargetY)
{
if (Main.tile[Player.tileTargetX, Player.tileTargetY] == null)
{
Main.tile[Player.tileTargetX, Player.tileTargetY] = new Tile();
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].active())
{
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 79)
{
this.noThrow = 2;
this.showItemIcon = true;
int num130 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 36);
if (num130 == 0)
{
this.showItemIcon2 = 224;
}
else if (num130 == 1)
{
this.showItemIcon2 = 644;
}
else if (num130 == 2)
{
this.showItemIcon2 = 645;
}
else if (num130 == 3)
{
this.showItemIcon2 = 646;
}
else if (num130 == 4)
{
this.showItemIcon2 = 920;
}
else if (num130 == 5)
{
this.showItemIcon2 = 1470;
}
else if (num130 == 6)
{
this.showItemIcon2 = 1471;
}
else if (num130 == 7)
{
this.showItemIcon2 = 1472;
}
else if (num130 == 8)
{
this.showItemIcon2 = 1473;
}
else if (num130 == 9)
{
this.showItemIcon2 = 1719;
}
else if (num130 == 10)
{
this.showItemIcon2 = 1720;
}
else if (num130 == 11)
{
this.showItemIcon2 = 1721;
}
else if (num130 == 12)
{
this.showItemIcon2 = 1722;
}
else if (num130 >= 13 && num130 <= 18)
{
this.showItemIcon2 = 2066 + num130 - 13;
}
else if (num130 >= 19 && num130 <= 20)
{
this.showItemIcon2 = 2139 + num130 - 19;
}
else if (num130 == 21)
{
this.showItemIcon2 = 2231;
}
else if (num130 == 22)
{
this.showItemIcon2 = 2520;
}
else if (num130 == 23)
{
this.showItemIcon2 = 2538;
}
else if (num130 == 24)
{
this.showItemIcon2 = 2553;
}
else if (num130 == 25)
{
this.showItemIcon2 = 2568;
}
else if (num130 == 26)
{
this.showItemIcon2 = 2669;
}
else if (num130 == 27)
{
this.showItemIcon2 = 2811;
}
else if (num130 == 28)
{
this.showItemIcon2 = 3162;
}
else if (num130 == 29)
{
this.showItemIcon2 = 3164;
}
else if (num130 == 30)
{
this.showItemIcon2 = 3163;
}
else
{
this.showItemIcon2 = 646;
}
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 33)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 105;
int num131 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 22);
if (num131 == 1)
{
this.showItemIcon2 = 1405;
}
if (num131 == 2)
{
this.showItemIcon2 = 1406;
}
if (num131 == 3)
{
this.showItemIcon2 = 1407;
}
if (num131 >= 4 && num131 <= 13)
{
this.showItemIcon2 = 2045 + num131 - 4;
}
if (num131 >= 14 && num131 <= 16)
{
this.showItemIcon2 = 2153 + num131 - 14;
}
if (num131 == 17)
{
this.showItemIcon2 = 2236;
}
if (num131 == 18)
{
this.showItemIcon2 = 2523;
}
if (num131 == 19)
{
this.showItemIcon2 = 2542;
}
if (num131 == 20)
{
this.showItemIcon2 = 2556;
}
if (num131 == 21)
{
this.showItemIcon2 = 2571;
}
if (num131 == 22)
{
this.showItemIcon2 = 2648;
}
if (num131 == 23)
{
this.showItemIcon2 = 2649;
}
if (num131 == 24)
{
this.showItemIcon2 = 2650;
}
if (num131 == 25)
{
this.showItemIcon2 = 2651;
}
else if (num131 == 26)
{
this.showItemIcon2 = 2818;
}
else if (num131 == 27)
{
this.showItemIcon2 = 3171;
}
else if (num131 == 28)
{
this.showItemIcon2 = 3173;
}
else if (num131 == 29)
{
this.showItemIcon2 = 3172;
}
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 21)
{
Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY];
int num132 = Player.tileTargetX;
int num133 = Player.tileTargetY;
if (tile.frameX % 36 != 0)
{
num132--;
}
if (tile.frameY % 36 != 0)
{
num133--;
}
int num134 = Chest.FindChest(num132, num133);
this.showItemIcon2 = -1;
if (num134 < 0)
{
this.showItemIconText = Lang.chestType[0];
}
else
{
if (Main.chest[num134].name != "")
{
this.showItemIconText = Main.chest[num134].name;
}
else
{
this.showItemIconText = Lang.chestType[(int)(tile.frameX / 36)];
}
if (this.showItemIconText == Lang.chestType[(int)(tile.frameX / 36)])
{
this.showItemIcon2 = Chest.chestTypeToIcon[(int)(tile.frameX / 36)];
this.showItemIconText = "";
}
}
this.noThrow = 2;
this.showItemIcon = true;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 88)
{
Tile tile2 = Main.tile[Player.tileTargetX, Player.tileTargetY];
int num135 = Player.tileTargetX;
int num136 = Player.tileTargetY;
num135 -= (int)(tile2.frameX % 54 / 18);
if (tile2.frameY % 36 != 0)
{
num136--;
}
int num137 = Chest.FindChest(num135, num136);
this.showItemIcon2 = -1;
if (num137 < 0)
{
this.showItemIconText = Lang.dresserType[0];
}
else
{
if (Main.chest[num137].name != "")
{
this.showItemIconText = Main.chest[num137].name;
}
else
{
this.showItemIconText = Lang.dresserType[(int)(tile2.frameX / 54)];
}
if (this.showItemIconText == Lang.dresserType[(int)(tile2.frameX / 54)])
{
this.showItemIcon2 = Chest.dresserTypeToIcon[(int)(tile2.frameX / 54)];
this.showItemIconText = "";
}
}
this.noThrow = 2;
this.showItemIcon = true;
if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0)
{
this.showItemIcon2 = 269;
}
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 10 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 11)
{
this.noThrow = 2;
this.showItemIcon = true;
int num138 = (int)Main.tile[Player.tileTargetX, Player.tileTargetY].frameY;
int num139 = 0;
while (num138 >= 54)
{
num138 -= 54;
num139++;
}
if (num139 == 0)
{
this.showItemIcon2 = 25;
}
else if (num139 == 9)
{
this.showItemIcon2 = 837;
}
else if (num139 == 10)
{
this.showItemIcon2 = 912;
}
else if (num139 == 11)
{
this.showItemIcon2 = 1141;
}
else if (num139 == 12)
{
this.showItemIcon2 = 1137;
}
else if (num139 == 13)
{
this.showItemIcon2 = 1138;
}
else if (num139 == 14)
{
this.showItemIcon2 = 1139;
}
else if (num139 == 15)
{
this.showItemIcon2 = 1140;
}
else if (num139 == 16)
{
this.showItemIcon2 = 1411;
}
else if (num139 == 17)
{
this.showItemIcon2 = 1412;
}
else if (num139 == 18)
{
this.showItemIcon2 = 1413;
}
else if (num139 == 19)
{
this.showItemIcon2 = 1458;
}
else if (num139 >= 20 && num139 <= 23)
{
this.showItemIcon2 = 1709 + num139 - 20;
}
else if (num139 == 24)
{
this.showItemIcon2 = 1793;
}
else if (num139 == 25)
{
this.showItemIcon2 = 1815;
}
else if (num139 == 26)
{
this.showItemIcon2 = 1924;
}
else if (num139 == 27)
{
this.showItemIcon2 = 2044;
}
else if (num139 == 28)
{
this.showItemIcon2 = 2265;
}
else if (num139 == 29)
{
this.showItemIcon2 = 2528;
}
else if (num139 == 30)
{
this.showItemIcon2 = 2561;
}
else if (num139 == 31)
{
this.showItemIcon2 = 2576;
}
else if (num139 == 32)
{
this.showItemIcon2 = 2815;
}
else if (num139 == 33)
{
this.showItemIcon2 = 3129;
}
else if (num139 == 34)
{
this.showItemIcon2 = 3131;
}
else if (num139 == 35)
{
this.showItemIcon2 = 3130;
}
else if (num139 >= 4 && num139 <= 8)
{
this.showItemIcon2 = 812 + num139;
}
else
{
this.showItemIcon2 = 649 + num139;
}
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 104)
{
this.noThrow = 2;
this.showItemIcon = true;
switch (Main.tile[Player.tileTargetX, Player.tileTargetY].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;
}
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 356)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 3064;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 377)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 3198;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 209)
{
this.noThrow = 2;
this.showItemIcon = true;
if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 72)
{
this.showItemIcon2 = 928;
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 144)
{
this.showItemIcon2 = 1337;
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 216)
{
this.showItemIcon2 = 3369;
}
int num140;
for (num140 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); num140 >= 4; num140 -= 4)
{
}
if (num140 < 2)
{
this.showItemIconR = true;
}
else
{
this.showItemIconR = false;
}
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 216)
{
this.noThrow = 2;
this.showItemIcon = true;
int num141 = (int)Main.tile[Player.tileTargetX, Player.tileTargetY].frameY;
int num142 = 0;
while (num141 >= 40)
{
num141 -= 40;
num142++;
}
this.showItemIcon2 = 970 + num142;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 387 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 386)
{
this.noThrow = 2;
this.showItemIcon = true;
int num143 = 0;
int num144 = 0;
WorldGen.GetTopLeftAndStyles(ref num143, ref num144, 2, 1 + (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 386).ToInt(), 18, 18);
this.showItemIcon2 = 3239;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 389 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 388)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 3240;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 335)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 2700;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 410)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 3536 + Math.Min((int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 36), 3);
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 411 && Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 36)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 3545;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 338)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 2738;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 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[Player.tileTargetX, Player.tileTargetY].type == 212)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 949;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 314 && this.gravDir == 1f)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 2343;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 215)
{
this.noThrow = 2;
this.showItemIcon = true;
int num145 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 48);
if (num145 == 0)
{
this.showItemIcon2 = 966;
}
else if (num145 == 6)
{
this.showItemIcon2 = 3050;
}
else
{
this.showItemIcon2 = 3046 + num145 - 1;
}
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 4)
{
this.noThrow = 2;
this.showItemIcon = true;
int num146 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 22);
if (num146 == 0)
{
this.showItemIcon2 = 8;
}
else if (num146 == 8)
{
this.showItemIcon2 = 523;
}
else if (num146 == 9)
{
this.showItemIcon2 = 974;
}
else if (num146 == 10)
{
this.showItemIcon2 = 1245;
}
else if (num146 == 11)
{
this.showItemIcon2 = 1333;
}
else if (num146 == 12)
{
this.showItemIcon2 = 2274;
}
else if (num146 == 13)
{
this.showItemIcon2 = 3004;
}
else if (num146 == 14)
{
this.showItemIcon2 = 3045;
}
else if (num146 == 15)
{
this.showItemIcon2 = 3114;
}
else
{
this.showItemIcon2 = 426 + num146;
}
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 13)
{
this.noThrow = 2;
this.showItemIcon = true;
int num147 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18);
if (num147 == 1)
{
this.showItemIcon2 = 28;
}
else if (num147 == 2)
{
this.showItemIcon2 = 110;
}
else if (num147 == 3)
{
this.showItemIcon2 = 350;
}
else if (num147 == 4)
{
this.showItemIcon2 = 351;
}
else if (num147 == 5)
{
this.showItemIcon2 = 2234;
}
else if (num147 == 6)
{
this.showItemIcon2 = 2244;
}
else if (num147 == 7)
{
this.showItemIcon2 = 2257;
}
else if (num147 == 8)
{
this.showItemIcon2 = 2258;
}
else
{
this.showItemIcon2 = 31;
}
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 29)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 87;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 97)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 346;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 49)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 148;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 174)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 713;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 50)
{
this.noThrow = 2;
if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX == 90)
{
this.showItemIcon = true;
this.showItemIcon2 = 165;
}
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 139)
{
this.noThrow = 2;
int num148 = Player.tileTargetX;
int num149 = Player.tileTargetY;
int num150 = 0;
for (int num151 = (int)(Main.tile[num148, num149].frameY / 18); num151 >= 2; num151 -= 2)
{
num150++;
}
this.showItemIcon = true;
if (num150 == 28)
{
this.showItemIcon2 = 1963;
}
else if (num150 == 29)
{
this.showItemIcon2 = 1964;
}
else if (num150 == 30)
{
this.showItemIcon2 = 1965;
}
else if (num150 == 31)
{
this.showItemIcon2 = 2742;
}
else if (num150 == 32)
{
this.showItemIcon2 = 3044;
}
else if (num150 == 33)
{
this.showItemIcon2 = 3235;
}
else if (num150 == 34)
{
this.showItemIcon2 = 3236;
}
else if (num150 == 35)
{
this.showItemIcon2 = 3237;
}
else if (num150 == 36)
{
this.showItemIcon2 = 3370;
}
else if (num150 == 37)
{
this.showItemIcon2 = 3371;
}
else if (num150 >= 13)
{
this.showItemIcon2 = 1596 + num150 - 13;
}
else
{
this.showItemIcon2 = 562 + num150;
}
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 207)
{
this.noThrow = 2;
int num152 = Player.tileTargetX;
int num153 = Player.tileTargetY;
int num154 = 0;
for (int num155 = (int)(Main.tile[num152, num153].frameX / 18); num155 >= 2; num155 -= 2)
{
num154++;
}
this.showItemIcon = true;
if (num154 == 0)
{
this.showItemIcon2 = 909;
}
else if (num154 == 1)
{
this.showItemIcon2 = 910;
}
else if (num154 == 2)
{
this.showItemIcon2 = 940;
}
else if (num154 == 3)
{
this.showItemIcon2 = 941;
}
else if (num154 == 4)
{
this.showItemIcon2 = 942;
}
else if (num154 == 5)
{
this.showItemIcon2 = 943;
}
else if (num154 == 6)
{
this.showItemIcon2 = 944;
}
else if (num154 == 7)
{
this.showItemIcon2 = 945;
}
}
if (Main.tileSign[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type])
{
this.noThrow = 2;
int num156 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18);
int num157 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18);
num156 %= 2;
int num158 = Player.tileTargetX - num156;
int num159 = Player.tileTargetY - num157;
Main.signBubble = true;
Main.signX = num158 * 16 + 16;
Main.signY = num159 * 16;
int num160 = Sign.ReadSign(num158, num159, false);
if (num160 != -1)
{
Main.signHover = num160;
}
if (num160 != -1)
{
Main.signHover = num160;
this.showItemIcon = false;
this.showItemIcon2 = -1;
}
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 237)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 1293;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 125)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 487;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 354)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 2999;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 287)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 2177;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 132)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 513;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 136)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = 538;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 144)
{
this.noThrow = 2;
this.showItemIcon = true;
this.showItemIcon2 = (int)(583 + Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18);
}
if (this.controlUseTile)
{
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 212 && this.launcherWait <= 0)
{
int num161 = Player.tileTargetX;
int num162 = Player.tileTargetY;
bool flag25 = false;
for (int num163 = 0; num163 < 58; num163++)
{
if (this.inventory[num163].type == 949 && this.inventory[num163].stack > 0)
{
this.inventory[num163].stack--;
if (this.inventory[num163].stack <= 0)
{
this.inventory[num163].SetDefaults(0, false);
}
flag25 = true;
break;
}
}
if (flag25)
{
this.launcherWait = 10;
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 11);
int num164 = (int)(Main.tile[num161, num162].frameX / 18);
int num165 = 0;
while (num164 >= 3)
{
num165++;
num164 -= 3;
}
num164 = num161 - num164;
int num166;
for (num166 = (int)(Main.tile[num161, num162].frameY / 18); num166 >= 3; num166 -= 3)
{
}
num166 = num162 - num166;
float num167 = 12f + (float)Main.rand.Next(450) * 0.01f;
float num168 = (float)Main.rand.Next(85, 105);
float num169 = (float)Main.rand.Next(-35, 11);
int type4 = 166;
int damage2 = 35;
float knockBack = 3.5f;
Vector2 vector3 = new Vector2((float)((num164 + 2) * 16 - 8), (float)((num166 + 2) * 16 - 8));
if (num165 == 0)
{
num168 *= -1f;
vector3.X -= 12f;
}
else
{
vector3.X += 12f;
}
float num170 = num168;
float num171 = num169;
float num172 = (float)Math.Sqrt((double)(num170 * num170 + num171 * num171));
num172 = num167 / num172;
num170 *= num172;
num171 *= num172;
Projectile.NewProjectile(vector3.X, vector3.Y, num170, num171, type4, damage2, knockBack, Main.myPlayer, 0f, 0f);
}
}
if (this.releaseUseTile)
{
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 132 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 136 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 144)
{
Wiring.HitSwitch(Player.tileTargetX, Player.tileTargetY);
NetMessage.SendData(59, -1, -1, "", Player.tileTargetX, (float)Player.tileTargetY, 0f, 0f, 0, 0, 0);
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 139)
{
Main.PlaySound(28, Player.tileTargetX * 16, Player.tileTargetY * 16, 0);
WorldGen.SwitchMB(Player.tileTargetX, Player.tileTargetY);
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 215)
{
Main.PlaySound(28, Player.tileTargetX * 16, Player.tileTargetY * 16, 0);
int num173 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX % 54 / 18);
int num174 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY % 36 / 18);
int num175 = Player.tileTargetX - num173;
int num176 = Player.tileTargetY - num174;
int num177 = 36;
if (Main.tile[num175, num176].frameY >= 36)
{
num177 = -36;
}
for (int num178 = num175; num178 < num175 + 3; num178++)
{
for (int num179 = num176; num179 < num176 + 2; num179++)
{
Main.tile[num178, num179].frameY = (short)((int)Main.tile[num178, num179].frameY + num177);
}
}
NetMessage.SendTileSquare(-1, num175 + 1, num176 + 1, 3);
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 207)
{
Main.PlaySound(28, Player.tileTargetX * 16, Player.tileTargetY * 16, 0);
WorldGen.SwitchFountain(Player.tileTargetX, Player.tileTargetY);
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 410)
{
Main.PlaySound(28, Player.tileTargetX * 16, Player.tileTargetY * 16, 0);
WorldGen.SwitchMonolith(Player.tileTargetX, Player.tileTargetY);
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 216)
{
WorldGen.LaunchRocket(Player.tileTargetX, Player.tileTargetY);
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 386 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 387)
{
bool value3 = Main.tile[Player.tileTargetX, Player.tileTargetY].type == 387;
int num180 = WorldGen.ShiftTrapdoor(Player.tileTargetX, Player.tileTargetY, (float)(Player.tileTargetY * 16) > base.Center.Y, -1).ToInt();
if (num180 == 0)
{
num180 = -WorldGen.ShiftTrapdoor(Player.tileTargetX, Player.tileTargetY, (float)(Player.tileTargetY * 16) <= base.Center.Y, -1).ToInt();
}
if (num180 != 0)
{
NetMessage.SendData(19, -1, -1, "", 2 + value3.ToInt(), (float)Player.tileTargetX, (float)Player.tileTargetY, (float)(num180 * Math.Sign((float)(Player.tileTargetY * 16) - base.Center.Y)), 0, 0, 0);
}
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 388 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 389)
{
bool flag26 = Main.tile[Player.tileTargetX, Player.tileTargetY].type == 389;
WorldGen.ShiftTallGate(Player.tileTargetX, Player.tileTargetY, flag26);
NetMessage.SendData(19, -1, -1, "", 4 + flag26.ToInt(), (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 335)
{
WorldGen.LaunchRocketSmall(Player.tileTargetX, Player.tileTargetY);
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 411 && Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 36)
{
Wiring.HitSwitch(Player.tileTargetX, Player.tileTargetY);
NetMessage.SendData(59, -1, -1, "", Player.tileTargetX, (float)Player.tileTargetY, 0f, 0f, 0, 0, 0);
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 338)
{
int num181 = Player.tileTargetX;
int num182 = Player.tileTargetY;
if (Main.tile[num181, num182].frameY == 18)
{
num182--;
}
bool flag27 = false;
for (int num183 = 0; num183 < 1000; num183++)
{
if (Main.projectile[num183].active && Main.projectile[num183].aiStyle == 73 && Main.projectile[num183].ai[0] == (float)num181 && Main.projectile[num183].ai[1] == (float)num182)
{
flag27 = true;
break;
}
}
if (!flag27)
{
Projectile.NewProjectile((float)(num181 * 16 + 8), (float)(num182 * 16 + 2), 0f, 0f, 419 + Main.rand.Next(4), 0, 0f, this.whoAmI, (float)num181, (float)num182);
}
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 4 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 13 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 33 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 49 || (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 50 && Main.tile[Player.tileTargetX, Player.tileTargetY].frameX == 90) || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 174)
{
WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, false, false, false);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
}
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 334)
{
if (this.ItemFitsWeaponRack(this.inventory[this.selectedItem]))
{
this.PlaceWeapon(Player.tileTargetX, Player.tileTargetY);
}
else
{
int num184 = Player.tileTargetX;
int num185 = Player.tileTargetY;
if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0)
{
num185++;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 36)
{
num185--;
}
int frameX = (int)Main.tile[Player.tileTargetX, num185].frameX;
int num186 = (int)Main.tile[Player.tileTargetX, num185].frameX;
int num187 = 0;
while (num186 >= 5000)
{
num186 -= 5000;
num187++;
}
if (num187 != 0)
{
num186 = (num187 - 1) * 18;
}
num186 %= 54;
if (num186 == 18)
{
frameX = (int)Main.tile[Player.tileTargetX - 1, num185].frameX;
num184--;
}
if (num186 == 36)
{
frameX = (int)Main.tile[Player.tileTargetX - 2, num185].frameX;
num184 -= 2;
}
if (frameX >= 5000)
{
WorldGen.KillTile(Player.tileTargetX, num185, true, false, false);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)num185, 1f, 0, 0, 0);
}
}
}
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 395 && !this.inventory[this.selectedItem].favorited)
{
if (this.ItemFitsItemFrame(this.inventory[this.selectedItem]))
{
this.PlaceItemInFrame(Player.tileTargetX, Player.tileTargetY);
}
else
{
int num188 = Player.tileTargetX;
int num189 = Player.tileTargetY;
if (Main.tile[num188, num189].frameX % 36 != 0)
{
num188--;
}
if (Main.tile[num188, num189].frameY % 36 != 0)
{
num189--;
}
int num190 = TEItemFrame.Find(num188, num189);
if (num190 != -1 && ((TEItemFrame)TileEntity.ByID[num190]).item.stack > 0)
{
WorldGen.KillTile(Player.tileTargetX, num189, true, false, false);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)num189, 1f, 0, 0, 0);
}
}
}
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 125)
{
this.AddBuff(29, 36000, true);
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 4);
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 377)
{
this.AddBuff(159, 36000, true);
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 37);
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 354)
{
this.AddBuff(150, 36000, true);
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 4);
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 287)
{
this.AddBuff(93, 36000, true);
Main.PlaySound(7, (int)this.position.X, (int)this.position.Y, 1);
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 356)
{
if (!Main.fastForwardTime && (Main.netMode == 1 || Main.sundialCooldown == 0))
{
Main.Sundialing();
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 4);
}
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 79)
{
int num191 = Player.tileTargetX;
int num192 = Player.tileTargetY;
num191 += (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18 * -1);
if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX >= 72)
{
num191 += 4;
num191++;
}
else
{
num191 += 2;
}
int num193 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18);
int num194 = 0;
while (num193 > 1)
{
num193 -= 2;
num194++;
}
num192 -= num193;
num192 += 2;
this.FindSpawn();
if (this.SpawnX == num191 && this.SpawnY == num192)
{
this.RemoveSpawn();
Main.NewText("Spawn point removed!", 255, 240, 20, false);
}
else if (Player.CheckSpawn(num191, num192))
{
this.ChangeSpawn(num191, num192);
Main.NewText("Spawn point set!", 255, 240, 20, false);
}
}
else if (Main.tileSign[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type])
{
bool flag28 = true;
if (this.sign >= 0)
{
int num195 = Sign.ReadSign(Player.tileTargetX, Player.tileTargetY, true);
if (num195 == this.sign)
{
this.sign = -1;
Main.npcChatText = "";
Main.editSign = false;
Main.PlaySound(11, -1, -1, 1);
flag28 = false;
}
}
if (flag28)
{
if (Main.netMode == 0)
{
this.talkNPC = -1;
Main.npcChatCornerItem = 0;
Main.playerInventory = false;
Main.editSign = false;
Main.PlaySound(10, -1, -1, 1);
int num196 = Sign.ReadSign(Player.tileTargetX, Player.tileTargetY, true);
this.sign = num196;
Main.npcChatText = Main.sign[num196].text;
}
else
{
int num197 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18);
int num198 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18);
while (num197 > 1)
{
num197 -= 2;
}
int num199 = Player.tileTargetX - num197;
int num200 = Player.tileTargetY - num198;
if (Main.tileSign[(int)Main.tile[num199, num200].type])
{
NetMessage.SendData(46, -1, -1, "", num199, (float)num200, 0f, 0f, 0, 0, 0);
}
}
}
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 104)
{
string text = "AM";
double num201 = Main.time;
if (!Main.dayTime)
{
num201 += 54000.0;
}
num201 = num201 / 86400.0 * 24.0;
double num202 = 7.5;
num201 = num201 - num202 - 12.0;
if (num201 < 0.0)
{
num201 += 24.0;
}
if (num201 >= 12.0)
{
text = "PM";
}
int num203 = (int)num201;
double num204 = num201 - (double)num203;
num204 = (double)((int)(num204 * 60.0));
string text2 = string.Concat(num204);
if (num204 < 10.0)
{
text2 = "0" + text2;
}
if (num203 > 12)
{
num203 -= 12;
}
if (num203 == 0)
{
num203 = 12;
}
string newText = string.Concat(new object[]
{
"Time: ",
num203,
":",
text2,
" ",
text
});
Main.NewText(newText, 255, 240, 20, false);
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 237)
{
bool flag29 = false;
if (!NPC.AnyNPCs(245) && Main.hardMode && NPC.downedPlantBoss)
{
for (int num205 = 0; num205 < 58; num205++)
{
if (this.inventory[num205].type == 1293)
{
this.inventory[num205].stack--;
if (this.inventory[num205].stack <= 0)
{
this.inventory[num205].SetDefaults(0, false);
}
flag29 = true;
break;
}
}
}
if (flag29)
{
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
if (Main.netMode != 1)
{
NPC.SpawnOnPlayer(i, 245);
}
else
{
NetMessage.SendData(61, -1, -1, "", this.whoAmI, 245f, 0f, 0f, 0, 0, 0);
}
}
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 10)
{
int num206 = Player.tileTargetX;
int num207 = Player.tileTargetY;
if (Main.tile[num206, num207].frameY >= 594 && Main.tile[num206, num207].frameY <= 646)
{
int num208 = 1141;
for (int num209 = 0; num209 < 58; num209++)
{
if (this.inventory[num209].type == num208 && this.inventory[num209].stack > 0)
{
this.inventory[num209].stack--;
if (this.inventory[num209].stack <= 0)
{
this.inventory[num209] = new Item();
}
WorldGen.UnlockDoor(num206, num207);
if (Main.netMode == 1)
{
NetMessage.SendData(52, -1, -1, "", this.whoAmI, 2f, (float)num206, (float)num207, 0, 0, 0);
}
}
}
}
else
{
WorldGen.OpenDoor(Player.tileTargetX, Player.tileTargetY, this.direction);
NetMessage.SendData(19, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)this.direction, 0, 0, 0);
}
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 11 && WorldGen.CloseDoor(Player.tileTargetX, Player.tileTargetY, false))
{
NetMessage.SendData(19, -1, -1, "", 1, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)this.direction, 0, 0, 0);
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 88)
{
if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0)
{
Main.CancelClothesWindow(true);
Main.mouseRightRelease = false;
int num210 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18);
num210 %= 3;
num210 = Player.tileTargetX - num210;
int num211 = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18);
if (this.sign > -1)
{
Main.PlaySound(11, -1, -1, 1);
this.sign = -1;
Main.editSign = false;
Main.npcChatText = string.Empty;
}
if (Main.editChest)
{
Main.PlaySound(12, -1, -1, 1);
Main.editChest = false;
Main.npcChatText = string.Empty;
}
if (this.editedChestName)
{
NetMessage.SendData(33, -1, -1, Main.chest[this.chest].name, this.chest, 1f, 0f, 0f, 0, 0, 0);
this.editedChestName = false;
}
if (Main.netMode == 1)
{
if (num210 == this.chestX && num211 == this.chestY && this.chest != -1)
{
this.chest = -1;
Main.PlaySound(11, -1, -1, 1);
}
else
{
NetMessage.SendData(31, -1, -1, "", num210, (float)num211, 0f, 0f, 0, 0, 0);
Main.stackSplit = 600;
}
}
else
{
this.flyingPigChest = -1;
int num212 = Chest.FindChest(num210, num211);
if (num212 != -1)
{
Main.stackSplit = 600;
if (num212 == this.chest)
{
this.chest = -1;
Main.PlaySound(11, -1, -1, 1);
}
else if (num212 != this.chest && this.chest == -1)
{
this.chest = num212;
Main.playerInventory = true;
Main.recBigList = false;
Main.PlaySound(10, -1, -1, 1);
this.chestX = num210;
this.chestY = num211;
}
else
{
this.chest = num212;
Main.playerInventory = true;
Main.recBigList = false;
Main.PlaySound(12, -1, -1, 1);
this.chestX = num210;
this.chestY = num211;
}
Recipe.FindRecipes();
}
}
}
else
{
Main.playerInventory = false;
this.chest = -1;
Main.dresserX = Player.tileTargetX;
Main.dresserY = Player.tileTargetY;
Main.OpenClothesWindow();
}
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 209)
{
WorldGen.SwitchCannon(Player.tileTargetX, Player.tileTargetY);
}
else if ((Main.tile[Player.tileTargetX, Player.tileTargetY].type == 21 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 29 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 97) && this.talkNPC == -1)
{
Main.mouseRightRelease = false;
int num213 = 0;
int num214;
for (num214 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); num214 > 1; num214 -= 2)
{
}
num214 = Player.tileTargetX - num214;
int num215 = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18);
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 29)
{
num213 = 1;
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 97)
{
num213 = 2;
}
if (this.sign > -1)
{
Main.PlaySound(11, -1, -1, 1);
this.sign = -1;
Main.editSign = false;
Main.npcChatText = string.Empty;
}
if (Main.editChest)
{
Main.PlaySound(12, -1, -1, 1);
Main.editChest = false;
Main.npcChatText = string.Empty;
}
if (this.editedChestName)
{
NetMessage.SendData(33, -1, -1, Main.chest[this.chest].name, this.chest, 1f, 0f, 0f, 0, 0, 0);
this.editedChestName = false;
}
if (Main.netMode == 1 && num213 == 0 && (Main.tile[num214, num215].frameX < 72 || Main.tile[num214, num215].frameX > 106) && (Main.tile[num214, num215].frameX < 144 || Main.tile[num214, num215].frameX > 178) && (Main.tile[num214, num215].frameX < 828 || Main.tile[num214, num215].frameX > 1006) && (Main.tile[num214, num215].frameX < 1296 || Main.tile[num214, num215].frameX > 1330) && (Main.tile[num214, num215].frameX < 1368 || Main.tile[num214, num215].frameX > 1402) && (Main.tile[num214, num215].frameX < 1440 || Main.tile[num214, num215].frameX > 1474))
{
if (num214 == this.chestX && num215 == this.chestY && this.chest != -1)
{
this.chest = -1;
Main.PlaySound(11, -1, -1, 1);
}
else
{
NetMessage.SendData(31, -1, -1, "", num214, (float)num215, 0f, 0f, 0, 0, 0);
Main.stackSplit = 600;
}
}
else
{
int num216 = -1;
if (num213 == 1)
{
num216 = -2;
}
else if (num213 == 2)
{
num216 = -3;
}
else
{
bool flag30 = false;
if (Chest.isLocked(num214, num215))
{
int num217 = 327;
if (Main.tile[num214, num215].frameX >= 144 && Main.tile[num214, num215].frameX <= 178)
{
num217 = 329;
}
if (Main.tile[num214, num215].frameX >= 828 && Main.tile[num214, num215].frameX <= 1006)
{
int num218 = (int)(Main.tile[num214, num215].frameX / 18);
int num219 = 0;
while (num218 >= 2)
{
num218 -= 2;
num219++;
}
num219 -= 23;
num217 = 1533 + num219;
}
flag30 = true;
for (int num220 = 0; num220 < 58; num220++)
{
if (this.inventory[num220].type == num217 && this.inventory[num220].stack > 0 && Chest.Unlock(num214, num215))
{
if (num217 != 329)
{
this.inventory[num220].stack--;
if (this.inventory[num220].stack <= 0)
{
this.inventory[num220] = new Item();
}
}
if (Main.netMode == 1)
{
NetMessage.SendData(52, -1, -1, "", this.whoAmI, 1f, (float)num214, (float)num215, 0, 0, 0);
}
}
}
}
if (!flag30)
{
num216 = Chest.FindChest(num214, num215);
}
}
if (num216 != -1)
{
Main.stackSplit = 600;
if (num216 == this.chest)
{
this.chest = -1;
Main.PlaySound(11, -1, -1, 1);
}
else if (num216 != this.chest && this.chest == -1)
{
this.chest = num216;
Main.playerInventory = true;
Main.recBigList = false;
Main.PlaySound(10, -1, -1, 1);
this.chestX = num214;
this.chestY = num215;
if (Main.tile[num214, num215].frameX >= 36 && Main.tile[num214, num215].frameX < 72)
{
AchievementsHelper.HandleSpecialEvent(this, 16);
}
}
else
{
this.chest = num216;
Main.playerInventory = true;
Main.recBigList = false;
Main.PlaySound(12, -1, -1, 1);
this.chestX = num214;
this.chestY = num215;
}
Recipe.FindRecipes();
}
}
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 314 && this.gravDir == 1f)
{
bool flag31 = true;
if (this.mount.Active)
{
if (this.mount.Cart)
{
flag31 = false;
}
else
{
this.mount.Dismount(this);
}
}
if (flag31)
{
Vector2 vector4 = new Vector2((float)Main.mouseX + Main.screenPosition.X, (float)Main.mouseY + Main.screenPosition.Y);
if (this.direction > 0)
{
this.minecartLeft = false;
}
else
{
this.minecartLeft = true;
}
this.grappling[0] = -1;
this.grapCount = 0;
for (int num221 = 0; num221 < 1000; num221++)
{
if (Main.projectile[num221].active && Main.projectile[num221].owner == this.whoAmI && Main.projectile[num221].aiStyle == 7)
{
Main.projectile[num221].Kill();
}
}
Projectile.NewProjectile(vector4.X, vector4.Y, 0f, 0f, 403, 0, 0f, this.whoAmI, 0f, 0f);
}
}
}
this.releaseUseTile = false;
}
else
{
this.releaseUseTile = true;
}
}
}
else
{
if (Main.tile[Player.tileTargetX, Player.tileTargetY] == null)
{
Main.tile[Player.tileTargetX, Player.tileTargetY] = new Tile();
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 21)
{
Tile tile3 = Main.tile[Player.tileTargetX, Player.tileTargetY];
int num222 = Player.tileTargetX;
int num223 = Player.tileTargetY;
if (tile3.frameX % 36 != 0)
{
num222--;
}
if (tile3.frameY % 36 != 0)
{
num223--;
}
int num224 = Chest.FindChest(num222, num223);
this.showItemIcon2 = -1;
if (num224 < 0)
{
this.showItemIconText = Lang.chestType[0];
}
else
{
if (Main.chest[num224].name != "")
{
this.showItemIconText = Main.chest[num224].name;
}
else
{
this.showItemIconText = Lang.chestType[(int)(tile3.frameX / 36)];
}
if (this.showItemIconText == Lang.chestType[(int)(tile3.frameX / 36)])
{
this.showItemIcon2 = Chest.chestTypeToIcon[(int)(tile3.frameX / 36)];
this.showItemIconText = "";
}
}
this.noThrow = 2;
this.showItemIcon = true;
if (this.showItemIconText == "")
{
this.showItemIcon = false;
this.showItemIcon2 = 0;
}
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 88)
{
Tile tile4 = Main.tile[Player.tileTargetX, Player.tileTargetY];
int num225 = Player.tileTargetX;
int num226 = Player.tileTargetY;
num225 -= (int)(tile4.frameX % 54 / 18);
if (tile4.frameY % 36 != 0)
{
num226--;
}
int num227 = Chest.FindChest(num225, num226);
this.showItemIcon2 = -1;
if (num227 < 0)
{
this.showItemIconText = Lang.dresserType[0];
}
else
{
if (Main.chest[num227].name != "")
{
this.showItemIconText = Main.chest[num227].name;
}
else
{
this.showItemIconText = Lang.dresserType[(int)(tile4.frameX / 54)];
}
if (this.showItemIconText == Lang.dresserType[(int)(tile4.frameX / 54)])
{
this.showItemIcon2 = Chest.dresserTypeToIcon[(int)(tile4.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[Player.tileTargetX, Player.tileTargetY].type])
{
this.noThrow = 2;
int num228 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18);
int num229 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18);
num228 %= 2;
int num230 = Player.tileTargetX - num228;
int num231 = Player.tileTargetY - num229;
Main.signBubble = true;
Main.signX = num230 * 16 + 16;
Main.signY = num231 * 16;
int num232 = Sign.ReadSign(num230, num231, true);
if (num232 != -1)
{
Main.signHover = num232;
this.showItemIcon = false;
this.showItemIcon2 = -1;
}
}
}
}
if (this.tongued)
{
bool flag32 = false;
if (Main.wof >= 0)
{
float num233 = Main.npc[Main.wof].position.X + (float)(Main.npc[Main.wof].width / 2);
num233 += (float)(Main.npc[Main.wof].direction * 200);
float num234 = Main.npc[Main.wof].position.Y + (float)(Main.npc[Main.wof].height / 2);
Vector2 vector5 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num235 = num233 - vector5.X;
float num236 = num234 - vector5.Y;
float num237 = (float)Math.Sqrt((double)(num235 * num235 + num236 * num236));
float num238 = 11f;
float num239;
if (num237 > num238)
{
num239 = num238 / num237;
}
else
{
num239 = 1f;
flag32 = true;
}
num235 *= num239;
num236 *= num239;
this.velocity.X = num235;
this.velocity.Y = num236;
}
else
{
flag32 = true;
}
if (flag32 && Main.myPlayer == this.whoAmI)
{
for (int num240 = 0; num240 < 22; num240++)
{
if (this.buffType[num240] == 38)
{
this.DelBuff(num240);
}
}
}
}
if (Main.myPlayer == this.whoAmI)
{
this.WOFTongue();
if (this.controlHook)
{
if (this.releaseHook)
{
this.QuickGrapple();
}
this.releaseHook = false;
}
else
{
this.releaseHook = true;
}
if (this.talkNPC >= 0)
{
Rectangle rectangle = new Rectangle((int)(this.position.X + (float)(this.width / 2) - (float)(Player.tileRangeX * 16)), (int)(this.position.Y + (float)(this.height / 2) - (float)(Player.tileRangeY * 16)), Player.tileRangeX * 16 * 2, Player.tileRangeY * 16 * 2);
Rectangle value4 = new Rectangle((int)Main.npc[this.talkNPC].position.X, (int)Main.npc[this.talkNPC].position.Y, Main.npc[this.talkNPC].width, Main.npc[this.talkNPC].height);
if (!rectangle.Intersects(value4) || this.chest != -1 || !Main.npc[this.talkNPC].active)
{
if (this.chest == -1)
{
Main.PlaySound(11, -1, -1, 1);
}
this.talkNPC = -1;
Main.npcChatCornerItem = 0;
Main.npcChatText = "";
}
}
if (this.sign >= 0)
{
Rectangle value5 = new Rectangle((int)(this.position.X + (float)(this.width / 2) - (float)(Player.tileRangeX * 16)), (int)(this.position.Y + (float)(this.height / 2) - (float)(Player.tileRangeY * 16)), Player.tileRangeX * 16 * 2, Player.tileRangeY * 16 * 2);
try
{
bool flag33 = false;
if (Main.sign[this.sign] == null)
{
flag33 = true;
}
if (!flag33 && !new Rectangle(Main.sign[this.sign].x * 16, Main.sign[this.sign].y * 16, 32, 32).Intersects(value5))
{
flag33 = true;
}
if (flag33)
{
Main.PlaySound(11, -1, -1, 1);
this.sign = -1;
Main.editSign = false;
Main.npcChatText = "";
}
}
catch
{
Main.PlaySound(11, -1, -1, 1);
this.sign = -1;
Main.editSign = false;
Main.npcChatText = "";
}
}
if (Main.editSign)
{
if (this.sign == -1)
{
Main.editSign = false;
}
else
{
Main.npcChatText = Main.GetInputText(Main.npcChatText);
if (Main.inputTextEnter)
{
byte[] bytes = new byte[]
{
10
};
Main.npcChatText += Encoding.ASCII.GetString(bytes);
}
else if (Main.inputTextEscape)
{
Main.PlaySound(12, -1, -1, 1);
Main.editSign = false;
Main.blockKey = Keys.Escape;
Main.npcChatText = Main.sign[this.sign].text;
}
}
}
else if (Main.editChest)
{
string inputText = Main.GetInputText(Main.npcChatText);
if (Main.inputTextEnter)
{
Main.PlaySound(12, -1, -1, 1);
Main.editChest = false;
int num241 = Main.player[Main.myPlayer].chest;
if (Main.npcChatText == Main.defaultChestName)
{
Main.npcChatText = "";
}
if (Main.chest[num241].name != Main.npcChatText)
{
Main.chest[num241].name = Main.npcChatText;
if (Main.netMode == 1)
{
this.editedChestName = true;
}
}
}
else if (Main.inputTextEscape)
{
Main.PlaySound(12, -1, -1, 1);
Main.editChest = false;
Main.npcChatText = string.Empty;
Main.blockKey = Keys.Escape;
}
else if (inputText.Length <= 20)
{
Main.npcChatText = inputText;
}
}
if (this.mount.Active && this.mount.Cart && Math.Abs(this.velocity.X) > 4f)
{
Rectangle rectangle2 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height);
for (int num242 = 0; num242 < 200; num242++)
{
if (Main.npc[num242].active && !Main.npc[num242].friendly && Main.npc[num242].damage > 0 && Main.npc[num242].immune[i] == 0 && rectangle2.Intersects(new Rectangle((int)Main.npc[num242].position.X, (int)Main.npc[num242].position.Y, Main.npc[num242].width, Main.npc[num242].height)))
{
float num243 = (float)this.meleeCrit;
if (num243 < (float)this.rangedCrit)
{
num243 = (float)this.rangedCrit;
}
if (num243 < (float)this.magicCrit)
{
num243 = (float)this.magicCrit;
}
bool crit = false;
if ((float)Main.rand.Next(1, 101) <= num243)
{
crit = true;
}
float num244 = Math.Abs(this.velocity.X) / this.maxRunSpeed;
int num245 = Main.DamageVar(25f + 55f * num244);
if (this.mount.Type == 11)
{
num245 = Main.DamageVar(50f + 100f * num244);
}
if (this.mount.Type == 13)
{
num245 = Main.DamageVar(15f + 30f * num244);
}
float num246 = 5f + 25f * num244;
int num247 = 1;
if (this.velocity.X < 0f)
{
num247 = -1;
}
Main.npc[num242].StrikeNPC(num245, num246, num247, crit, false, false);
if (Main.netMode != 0)
{
NetMessage.SendData(28, -1, -1, "", num242, (float)num245, num246, (float)(-(float)num247), 0, 0, 0);
}
Main.npc[num242].immune[i] = 30;
if (!Main.npc[num242].active)
{
AchievementsHelper.HandleSpecialEvent(this, 9);
}
}
}
}
if (!this.immune)
{
Rectangle rectangle3 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height);
for (int num248 = 0; num248 < 200; num248++)
{
if (Main.npc[num248].active && !Main.npc[num248].friendly && Main.npc[num248].damage > 0 && (this.dash != 2 || num248 != this.eocHit || this.eocDash <= 0) && !this.npcTypeNoAggro[Main.npc[num248].type])
{
float num249 = 1f;
Rectangle value6 = new Rectangle((int)Main.npc[num248].position.X, (int)Main.npc[num248].position.Y, Main.npc[num248].width, Main.npc[num248].height);
if (Main.npc[num248].type >= 430 && Main.npc[num248].type <= 436 && Main.npc[num248].ai[2] > 5f)
{
int num250 = 34;
if (Main.npc[num248].spriteDirection < 0)
{
value6.X -= num250;
value6.Width += num250;
}
else
{
value6.Width += num250;
}
num249 *= 1.25f;
}
else if (Main.npc[num248].type >= 494 && Main.npc[num248].type <= 495 && Main.npc[num248].ai[2] > 5f)
{
int num251 = 18;
if (Main.npc[num248].spriteDirection < 0)
{
value6.X -= num251;
value6.Width += num251;
}
else
{
value6.Width += num251;
}
num249 *= 1.25f;
}
else if (Main.npc[num248].type == 460)
{
Rectangle rectangle4 = new Rectangle(0, 0, 30, 14);
rectangle4.X = (int)Main.npc[num248].Center.X;
if (Main.npc[num248].direction < 0)
{
rectangle4.X -= rectangle4.Width;
}
rectangle4.Y = (int)Main.npc[num248].position.Y + Main.npc[num248].height - 20;
if (rectangle3.Intersects(rectangle4))
{
value6 = rectangle4;
num249 *= 1.35f;
}
}
else if (Main.npc[num248].type == 417 && Main.npc[num248].ai[0] == 6f && Main.npc[num248].ai[3] > 0f && Main.npc[num248].ai[3] < 4f)
{
Rectangle rectangle5 = Utils.CenteredRectangle(Main.npc[num248].Center, new Vector2(100f));
if (rectangle3.Intersects(rectangle5))
{
value6 = rectangle5;
num249 *= 1.35f;
}
}
else if (Main.npc[num248].type == 466)
{
Rectangle rectangle6 = new Rectangle(0, 0, 30, 8);
rectangle6.X = (int)Main.npc[num248].Center.X;
if (Main.npc[num248].direction < 0)
{
rectangle6.X -= rectangle6.Width;
}
rectangle6.Y = (int)Main.npc[num248].position.Y + Main.npc[num248].height - 32;
if (rectangle3.Intersects(rectangle6))
{
value6 = rectangle6;
num249 *= 1.75f;
}
}
if (rectangle3.Intersects(value6) && !this.npcTypeNoAggro[Main.npc[num248].type])
{
int num252 = -1;
if (Main.npc[num248].position.X + (float)(Main.npc[num248].width / 2) < this.position.X + (float)(this.width / 2))
{
num252 = 1;
}
int num253 = Main.DamageVar((float)Main.npc[num248].damage * num249);
int num254 = Item.NPCtoBanner(Main.npc[num248].BannerID());
if (num254 > 0 && this.NPCBannerBuff[num254])
{
if (Main.expertMode)
{
num253 = (int)((double)num253 * 0.5);
}
else
{
num253 = (int)((double)num253 * 0.75);
}
}
if (this.whoAmI == Main.myPlayer && this.thorns > 0f && !this.immune && !Main.npc[num248].dontTakeDamage)
{
int num255 = (int)((float)num253 * this.thorns);
int num256 = 10;
if (this.turtleThorns)
{
num255 = num253;
}
Main.npc[num248].StrikeNPC(num255, (float)num256, -num252, false, false, false);
if (Main.netMode != 0)
{
NetMessage.SendData(28, -1, -1, "", num248, (float)num255, (float)num256, (float)(-(float)num252), 0, 0, 0);
}
}
if (this.resistCold && Main.npc[num248].coldDamage)
{
num253 = (int)((float)num253 * 0.7f);
}
if (!this.immune)
{
this.StatusPlayer(Main.npc[num248]);
}
this.Hurt(num253, num252, false, false, Lang.deathMsg(-1, num248, -1, -1), false);
}
}
}
}
Vector2 vector6;
if (!this.mount.Active || !this.mount.Cart)
{
vector6 = Collision.HurtTiles(this.position, this.velocity, this.width, this.height, this.fireWalk);
}
else
{
vector6 = Collision.HurtTiles(this.position, this.velocity, this.width, this.height - 16, this.fireWalk);
}
if (vector6.Y == 0f && !this.fireWalk)
{
foreach (Point current in this.TouchedTiles)
{
Tile tile5 = Main.tile[current.X, current.Y];
if (tile5 != null && tile5.active() && tile5.nactive() && !this.fireWalk && TileID.Sets.TouchDamageHot[(int)tile5.type] != 0)
{
vector6.Y = (float)TileID.Sets.TouchDamageHot[(int)tile5.type];
vector6.X = (float)((base.Center.X / 16f < (float)current.X + 0.5f) ? -1 : 1);
break;
}
}
}
if (vector6.Y == 20f)
{
this.AddBuff(67, 20, true);
}
else if (vector6.Y == 15f)
{
if (this.suffocateDelay < 5)
{
this.suffocateDelay += 1;
}
else
{
this.AddBuff(68, 1, true);
}
}
else if (vector6.Y != 0f)
{
int damage3 = Main.DamageVar(vector6.Y);
this.Hurt(damage3, 0, false, false, Lang.deathMsg(-1, -1, -1, 3), false);
}
else
{
this.suffocateDelay = 0;
}
}
if (this.controlRight)
{
this.releaseRight = false;
}
else
{
this.releaseRight = true;
this.rightTimer = 7;
}
if (this.controlLeft)
{
this.releaseLeft = false;
}
else
{
this.releaseLeft = true;
this.leftTimer = 7;
}
this.releaseDown = !this.controlDown;
if (this.rightTimer > 0)
{
this.rightTimer--;
}
else if (this.controlRight)
{
this.rightTimer = 7;
}
if (this.leftTimer > 0)
{
this.leftTimer--;
}
else if (this.controlLeft)
{
this.leftTimer = 7;
}
this.GrappleMovement();
this.StickyMovement();
this.CheckDrowning();
if (this.gravDir == -1f)
{
this.waterWalk = false;
this.waterWalk2 = false;
}
int num257 = this.height;
if (this.waterWalk)
{
num257 -= 6;
}
bool flag34 = Collision.LavaCollision(this.position, this.width, num257);
if (flag34)
{
if (!this.lavaImmune && Main.myPlayer == i && !this.immune)
{
if (this.lavaTime > 0)
{
this.lavaTime--;
}
else if (this.lavaRose)
{
this.Hurt(50, 0, false, false, Lang.deathMsg(-1, -1, -1, 2), false);
this.AddBuff(24, 210, true);
}
else
{
this.Hurt(80, 0, false, false, Lang.deathMsg(-1, -1, -1, 2), false);
this.AddBuff(24, 420, true);
}
}
this.lavaWet = true;
}
else
{
this.lavaWet = false;
if (this.lavaTime < this.lavaMax)
{
this.lavaTime++;
}
}
if (this.lavaTime > this.lavaMax)
{
this.lavaTime = this.lavaMax;
}
if (this.waterWalk2 && !this.waterWalk)
{
num257 -= 6;
}
bool flag35 = Collision.WetCollision(this.position, this.width, this.height);
bool flag36 = Collision.honey;
if (flag36)
{
this.AddBuff(48, 1800, true);
this.honeyWet = true;
}
if (flag35)
{
if (this.onFire && !this.lavaWet)
{
for (int num258 = 0; num258 < 22; num258++)
{
if (this.buffType[num258] == 24)
{
this.DelBuff(num258);
}
}
}
if (!this.wet)
{
if (this.wetCount == 0)
{
this.wetCount = 10;
if (!flag34)
{
if (this.honeyWet)
{
for (int num259 = 0; num259 < 20; num259++)
{
int num260 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 152, 0f, 0f, 0, default(Color), 1f);
Dust expr_D6C1_cp_0 = Main.dust[num260];
expr_D6C1_cp_0.velocity.Y = expr_D6C1_cp_0.velocity.Y - 1f;
Dust expr_D6E1_cp_0 = Main.dust[num260];
expr_D6E1_cp_0.velocity.X = expr_D6E1_cp_0.velocity.X * 2.5f;
Main.dust[num260].scale = 1.3f;
Main.dust[num260].alpha = 100;
Main.dust[num260].noGravity = true;
}
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1);
}
else
{
for (int num261 = 0; num261 < 50; num261++)
{
int num262 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, Dust.dustWater(), 0f, 0f, 0, default(Color), 1f);
Dust expr_D7E2_cp_0 = Main.dust[num262];
expr_D7E2_cp_0.velocity.Y = expr_D7E2_cp_0.velocity.Y - 3f;
Dust expr_D802_cp_0 = Main.dust[num262];
expr_D802_cp_0.velocity.X = expr_D802_cp_0.velocity.X * 2.5f;
Main.dust[num262].scale = 0.8f;
Main.dust[num262].alpha = 100;
Main.dust[num262].noGravity = true;
}
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 0);
}
}
else
{
for (int num263 = 0; num263 < 20; num263++)
{
int num264 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 35, 0f, 0f, 0, default(Color), 1f);
Dust expr_D900_cp_0 = Main.dust[num264];
expr_D900_cp_0.velocity.Y = expr_D900_cp_0.velocity.Y - 1.5f;
Dust expr_D920_cp_0 = Main.dust[num264];
expr_D920_cp_0.velocity.X = expr_D920_cp_0.velocity.X * 2.5f;
Main.dust[num264].scale = 1.3f;
Main.dust[num264].alpha = 100;
Main.dust[num264].noGravity = true;
}
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1);
}
}
this.wet = true;
}
}
else if (this.wet)
{
this.wet = false;
if (this.jump > Player.jumpHeight / 5 && this.wetSlime == 0)
{
this.jump = Player.jumpHeight / 5;
}
if (this.wetCount == 0)
{
this.wetCount = 10;
if (!this.lavaWet)
{
if (this.honeyWet)
{
for (int num265 = 0; num265 < 20; num265++)
{
int num266 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 152, 0f, 0f, 0, default(Color), 1f);
Dust expr_DA87_cp_0 = Main.dust[num266];
expr_DA87_cp_0.velocity.Y = expr_DA87_cp_0.velocity.Y - 1f;
Dust expr_DAA7_cp_0 = Main.dust[num266];
expr_DAA7_cp_0.velocity.X = expr_DAA7_cp_0.velocity.X * 2.5f;
Main.dust[num266].scale = 1.3f;
Main.dust[num266].alpha = 100;
Main.dust[num266].noGravity = true;
}
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1);
}
else
{
for (int num267 = 0; num267 < 50; num267++)
{
int num268 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2)), this.width + 12, 24, Dust.dustWater(), 0f, 0f, 0, default(Color), 1f);
Dust expr_DBA2_cp_0 = Main.dust[num268];
expr_DBA2_cp_0.velocity.Y = expr_DBA2_cp_0.velocity.Y - 4f;
Dust expr_DBC2_cp_0 = Main.dust[num268];
expr_DBC2_cp_0.velocity.X = expr_DBC2_cp_0.velocity.X * 2.5f;
Main.dust[num268].scale = 0.8f;
Main.dust[num268].alpha = 100;
Main.dust[num268].noGravity = true;
}
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 0);
}
}
else
{
for (int num269 = 0; num269 < 20; num269++)
{
int num270 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 35, 0f, 0f, 0, default(Color), 1f);
Dust expr_DCC0_cp_0 = Main.dust[num270];
expr_DCC0_cp_0.velocity.Y = expr_DCC0_cp_0.velocity.Y - 1.5f;
Dust expr_DCE0_cp_0 = Main.dust[num270];
expr_DCE0_cp_0.velocity.X = expr_DCE0_cp_0.velocity.X * 2.5f;
Main.dust[num270].scale = 1.3f;
Main.dust[num270].alpha = 100;
Main.dust[num270].noGravity = true;
}
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1);
}
}
}
if (!flag36)
{
this.honeyWet = false;
}
if (!this.wet)
{
this.lavaWet = false;
this.honeyWet = false;
}
if (this.wetCount > 0)
{
this.wetCount -= 1;
}
if (this.wetSlime > 0)
{
this.wetSlime -= 1;
}
if (this.wet && this.mount.Active)
{
switch (this.mount.Type)
{
case 3:
this.wetSlime = 30;
if (this.velocity.Y > 2f)
{
this.velocity.Y = this.velocity.Y * 0.9f;
}
this.velocity.Y = this.velocity.Y - 0.5f;
if (this.velocity.Y < -4f)
{
this.velocity.Y = -4f;
}
break;
case 5:
case 7:
if (this.whoAmI == Main.myPlayer)
{
this.mount.Dismount(this);
}
break;
}
}
if (Main.expertMode && this.ZoneSnow && this.wet && !this.lavaWet && !this.honeyWet && !this.arcticDivingGear)
{
this.AddBuff(46, 150, true);
}
float num271 = 1f + Math.Abs(this.velocity.X) / 3f;
if (this.gfxOffY > 0f)
{
this.gfxOffY -= num271 * this.stepSpeed;
if (this.gfxOffY < 0f)
{
this.gfxOffY = 0f;
}
}
else if (this.gfxOffY < 0f)
{
this.gfxOffY += num271 * this.stepSpeed;
if (this.gfxOffY > 0f)
{
this.gfxOffY = 0f;
}
}
if (this.gfxOffY > 32f)
{
this.gfxOffY = 32f;
}
if (this.gfxOffY < -32f)
{
this.gfxOffY = -32f;
}
if (Main.myPlayer == i && !this.iceSkate)
{
this.CheckIceBreak();
}
this.SlopeDownMovement();
bool flag37 = this.mount.Type == 7 || this.mount.Type == 8 || this.mount.Type == 12;
if (this.velocity.Y == this.gravity && (!this.mount.Active || (!this.mount.Cart && !flag37)))
{
Collision.StepDown(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, (int)this.gravDir, this.waterWalk || this.waterWalk2);
}
if (this.gravDir == -1f)
{
if ((this.carpetFrame != -1 || this.velocity.Y <= this.gravity) && !this.controlUp)
{
Collision.StepUp(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, (int)this.gravDir, this.controlUp, 0);
}
}
else if (flag37 || ((this.carpetFrame != -1 || this.velocity.Y >= this.gravity) && !this.controlDown && !this.mount.Cart))
{
Collision.StepUp(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, (int)this.gravDir, this.controlUp, 0);
}
this.oldPosition = this.position;
this.oldDirection = this.direction;
bool falling = false;
if (this.velocity.Y > this.gravity)
{
falling = true;
}
if (this.velocity.Y < -this.gravity)
{
falling = true;
}
Vector2 velocity = this.velocity;
this.slideDir = 0;
bool ignorePlats = false;
bool fallThrough = this.controlDown;
if (this.gravDir == -1f || (this.mount.Active && this.mount.Cart) || this.GoingDownWithGrapple)
{
ignorePlats = true;
fallThrough = true;
}
this.onTrack = false;
bool flag38 = false;
if (this.mount.Active && this.mount.Cart)
{
float num272;
if (!this.ignoreWater && !this.merman)
{
if (this.honeyWet)
{
num272 = 0.25f;
}
else if (this.wet)
{
num272 = 0.5f;
}
else
{
num272 = 1f;
}
}
else
{
num272 = 1f;
}
this.velocity *= num272;
DelegateMethods.Minecart.rotation = this.fullRotation;
DelegateMethods.Minecart.rotationOrigin = this.fullRotationOrigin;
BitsByte bitsByte = Minecart.TrackCollision(ref this.position, ref this.velocity, ref this.lastBoost, this.width, this.height, this.controlDown, this.controlUp, this.fallStart2, false, this.mount.MinecartDust);
if (bitsByte[0])
{
this.onTrack = true;
this.gfxOffY = Minecart.TrackRotation(ref this.fullRotation, this.position + this.velocity, this.width, this.height, this.controlDown, this.controlUp, this.mount.MinecartDust);
this.fullRotationOrigin = new Vector2((float)(this.width / 2), (float)this.height);
}
if (bitsByte[1])
{
if (this.controlLeft || this.controlRight)
{
if (this.cartFlip)
{
this.cartFlip = false;
}
else
{
this.cartFlip = true;
}
}
if (this.velocity.X > 0f)
{
this.direction = 1;
}
else if (this.velocity.X < 0f)
{
this.direction = -1;
}
Main.PlaySound(2, (int)this.position.X + this.width / 2, (int)this.position.Y + this.height / 2, 56);
}
this.velocity /= num272;
if (bitsByte[3] && this.whoAmI == Main.myPlayer)
{
flag38 = true;
}
if (bitsByte[2])
{
this.cartRampTime = (int)(Math.Abs(this.velocity.X) / this.mount.RunSpeed * 20f);
}
if (bitsByte[4])
{
this.trackBoost -= 4f;
}
if (bitsByte[5])
{
this.trackBoost += 4f;
}
}
bool flag39 = this.whoAmI == Main.myPlayer && !this.mount.Active;
Vector2 position = this.position;
if (this.vortexDebuff)
{
this.velocity.Y = this.velocity.Y * 0.8f + (float)Math.Cos((double)(base.Center.X % 120f / 120f * 6.28318548f)) * 5f * 0.2f;
}
if (this.wingsLogic == 3 && this.controlUp && this.controlDown)
{
this.position += this.velocity;
}
else if (this.tongued)
{
this.position += this.velocity;
flag39 = false;
}
else if (this.honeyWet && !this.ignoreWater)
{
this.HoneyCollision(fallThrough, ignorePlats);
}
else if (this.wet && !this.merman && !this.ignoreWater)
{
this.WaterCollision(fallThrough, ignorePlats);
}
else
{
this.DryCollision(fallThrough, ignorePlats);
if (this.mount.Active && this.mount.Type == 3 && this.velocity.Y != 0f && !this.SlimeDontHyperJump)
{
Vector2 velocity2 = this.velocity;
this.velocity.X = 0f;
this.DryCollision(fallThrough, ignorePlats);
this.velocity.X = velocity2.X;
}
}
this.UpdateTouchingTiles();
this.TryBouncingBlocks(falling);
this.TryLandingOnDetonator();
if (this.wingsLogic != 3 || !this.controlUp || !this.controlDown)
{
this.SlopingCollision(fallThrough);
}
if (flag39 && this.velocity.Y == 0f)
{
AchievementsHelper.HandleRunning(Math.Abs(this.position.X - position.X));
}
if (flag38)
{
NetMessage.SendData(13, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0);
Minecart.HitTrackSwitch(new Vector2(this.position.X, this.position.Y), this.width, this.height);
}
if (velocity.X != this.velocity.X)
{
if (velocity.X < 0f)
{
this.slideDir = -1;
}
else if (velocity.X > 0f)
{
this.slideDir = 1;
}
}
if (this.gravDir == 1f && Collision.up)
{
this.velocity.Y = 0.01f;
if (!this.merman)
{
this.jump = 0;
}
}
else if (this.gravDir == -1f && Collision.down)
{
this.velocity.Y = -0.01f;
if (!this.merman)
{
this.jump = 0;
}
}
if (this.velocity.Y == 0f && this.grappling[0] == -1)
{
this.FloorVisuals(falling);
}
if (this.whoAmI == Main.myPlayer)
{
Collision.SwitchTiles(this.position, this.width, this.height, this.oldPosition, 1);
}
this.BordersMovement();
this.numMinions = 0;
this.slotsMinions = 0f;
if (this.altFunctionUse == 0 && this.selectedItem != 58 && this.controlUseTile && this.releaseUseItem && !this.controlUseItem && !this.mouseInterface && this.inventory[this.selectedItem].type == 3384)
{
this.altFunctionUse = 1;
this.controlUseItem = true;
}
if (!this.controlUseItem && this.altFunctionUse == 1)
{
this.altFunctionUse = 0;
}
if (Main.ignoreErrors)
{
try
{
this.ItemCheck(i);
goto IL_E880;
}
catch
{
goto IL_E880;
}
}
this.ItemCheck(i);
IL_E880:
this.PlayerFrame();
if (this.mount.Type == 8)
{
this.mount.UseDrill(this);
}
if (this.statLife > this.statLifeMax2)
{
this.statLife = this.statLifeMax2;
}
if (this.statMana > this.statManaMax2)
{
this.statMana = this.statManaMax2;
}
this.grappling[0] = -1;
this.grapCount = 0;
}
private void TryLandingOnDetonator()
{
if (this.whoAmI != Main.myPlayer)
{
return;
}
if (this.velocity.Y >= 3f)
{
Point point = (base.Bottom + new Vector2(0f, 0.01f)).ToTileCoordinates();
Tile tileSafely = Framing.GetTileSafely(point.X, point.Y);
if (tileSafely.active() && tileSafely.type == 411 && tileSafely.frameY == 0 && tileSafely.frameX < 36)
{
Wiring.HitSwitch(point.X, point.Y);
NetMessage.SendData(59, -1, -1, "", point.X, (float)point.Y, 0f, 0f, 0, 0, 0);
}
}
}
private void TryBouncingBlocks(bool Falling)
{
if ((this.velocity.Y >= 5f || this.velocity.Y <= -5f) && !this.wet)
{
int num = 0;
bool flag = false;
foreach (Point current in this.TouchedTiles)
{
Tile tile = Main.tile[current.X, current.Y];
if (tile != null && tile.active() && tile.nactive() && Main.tileBouncy[(int)tile.type])
{
flag = true;
num = current.Y;
break;
}
}
if (flag)
{
this.velocity.Y = this.velocity.Y * -0.8f;
if (this.controlJump)
{
this.velocity.Y = MathHelper.Clamp(this.velocity.Y, -13f, 13f);
}
this.position.Y = (float)(num * 16 - ((this.velocity.Y < 0f) ? this.height : -16));
this.FloorVisuals(Falling);
this.velocity.Y = MathHelper.Clamp(this.velocity.Y, -20f, 20f);
if (this.velocity.Y * this.gravDir < 0f)
{
this.fallStart = (int)this.position.Y / 16;
}
}
}
}
private void GrabItems(int i)
{
for (int j = 0; j < 400; j++)
{
if (Main.item[j].active && Main.item[j].noGrabDelay == 0 && Main.item[j].owner == i)
{
int num = Player.defaultItemGrabRange;
if (this.goldRing && Main.item[j].type >= 71 && Main.item[j].type <= 74)
{
num += Item.coinGrabRange;
}
if (this.manaMagnet && (Main.item[j].type == 184 || Main.item[j].type == 1735 || Main.item[j].type == 1868))
{
num += Item.manaGrabRange;
}
if (this.lifeMagnet && (Main.item[j].type == 58 || Main.item[j].type == 1734 || Main.item[j].type == 1867))
{
num += Item.lifeGrabRange;
}
if (ItemID.Sets.NebulaPickup[Main.item[j].type])
{
num += 100;
}
if (new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height).Intersects(new Rectangle((int)Main.item[j].position.X, (int)Main.item[j].position.Y, Main.item[j].width, Main.item[j].height)))
{
if (i == Main.myPlayer && (this.inventory[this.selectedItem].type != 0 || this.itemAnimation <= 0))
{
if (ItemID.Sets.NebulaPickup[Main.item[j].type])
{
Main.PlaySound(7, (int)this.position.X, (int)this.position.Y, 1);
int num2 = Main.item[j].buffType;
Main.item[j] = new Item();
if (Main.netMode == 1)
{
NetMessage.SendData(102, -1, -1, "", i, (float)num2, base.Center.X, base.Center.Y, 0, 0, 0);
NetMessage.SendData(21, -1, -1, "", j, 0f, 0f, 0f, 0, 0, 0);
}
else
{
this.NebulaLevelup(num2);
}
}
if (Main.item[j].type == 58 || Main.item[j].type == 1734 || Main.item[j].type == 1867)
{
Main.PlaySound(7, (int)this.position.X, (int)this.position.Y, 1);
this.statLife += 20;
if (Main.myPlayer == this.whoAmI)
{
this.HealEffect(20, true);
}
if (this.statLife > this.statLifeMax2)
{
this.statLife = this.statLifeMax2;
}
Main.item[j] = new Item();
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", j, 0f, 0f, 0f, 0, 0, 0);
}
}
else if (Main.item[j].type == 184 || Main.item[j].type == 1735 || Main.item[j].type == 1868)
{
Main.PlaySound(7, (int)this.position.X, (int)this.position.Y, 1);
this.statMana += 100;
if (Main.myPlayer == this.whoAmI)
{
this.ManaEffect(100);
}
if (this.statMana > this.statManaMax2)
{
this.statMana = this.statManaMax2;
}
Main.item[j] = new Item();
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", j, 0f, 0f, 0f, 0, 0, 0);
}
}
else
{
Main.item[j] = this.GetItem(i, Main.item[j], false, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", j, 0f, 0f, 0f, 0, 0, 0);
}
}
}
}
else if (new Rectangle((int)this.position.X - num, (int)this.position.Y - num, this.width + num * 2, this.height + num * 2).Intersects(new Rectangle((int)Main.item[j].position.X, (int)Main.item[j].position.Y, Main.item[j].width, Main.item[j].height)) && this.ItemSpace(Main.item[j]))
{
Main.item[j].beingGrabbed = true;
if (this.manaMagnet && (Main.item[j].type == 184 || Main.item[j].type == 1735 || Main.item[j].type == 1868))
{
float num3 = 12f;
Vector2 vector = new Vector2(Main.item[j].position.X + (float)(Main.item[j].width / 2), Main.item[j].position.Y + (float)(Main.item[j].height / 2));
float num4 = base.Center.X - vector.X;
float num5 = base.Center.Y - vector.Y;
float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5));
num6 = num3 / num6;
num4 *= num6;
num5 *= num6;
int num7 = 5;
Main.item[j].velocity.X = (Main.item[j].velocity.X * (float)(num7 - 1) + num4) / (float)num7;
Main.item[j].velocity.Y = (Main.item[j].velocity.Y * (float)(num7 - 1) + num5) / (float)num7;
}
else if (this.lifeMagnet && (Main.item[j].type == 58 || Main.item[j].type == 1734 || Main.item[j].type == 1867))
{
float num8 = 15f;
Vector2 vector2 = new Vector2(Main.item[j].position.X + (float)(Main.item[j].width / 2), Main.item[j].position.Y + (float)(Main.item[j].height / 2));
float num9 = base.Center.X - vector2.X;
float num10 = base.Center.Y - vector2.Y;
float num11 = (float)Math.Sqrt((double)(num9 * num9 + num10 * num10));
num11 = num8 / num11;
num9 *= num11;
num10 *= num11;
int num12 = 5;
Main.item[j].velocity.X = (Main.item[j].velocity.X * (float)(num12 - 1) + num9) / (float)num12;
Main.item[j].velocity.Y = (Main.item[j].velocity.Y * (float)(num12 - 1) + num10) / (float)num12;
}
else if (this.goldRing && Main.item[j].type >= 71 && Main.item[j].type <= 74)
{
float num13 = 12f;
Vector2 vector3 = new Vector2(Main.item[j].position.X + (float)(Main.item[j].width / 2), Main.item[j].position.Y + (float)(Main.item[j].height / 2));
float num14 = base.Center.X - vector3.X;
float num15 = base.Center.Y - vector3.Y;
float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15));
num16 = num13 / num16;
num14 *= num16;
num15 *= num16;
int num17 = 5;
Main.item[j].velocity.X = (Main.item[j].velocity.X * (float)(num17 - 1) + num14) / (float)num17;
Main.item[j].velocity.Y = (Main.item[j].velocity.Y * (float)(num17 - 1) + num15) / (float)num17;
}
else if (ItemID.Sets.NebulaPickup[Main.item[j].type])
{
float num18 = 12f;
Vector2 vector4 = new Vector2(Main.item[j].position.X + (float)(Main.item[j].width / 2), Main.item[j].position.Y + (float)(Main.item[j].height / 2));
float num19 = base.Center.X - vector4.X;
float num20 = base.Center.Y - vector4.Y;
float num21 = (float)Math.Sqrt((double)(num19 * num19 + num20 * num20));
num21 = num18 / num21;
num19 *= num21;
num20 *= num21;
int num22 = 5;
Main.item[j].velocity.X = (Main.item[j].velocity.X * (float)(num22 - 1) + num19) / (float)num22;
Main.item[j].velocity.Y = (Main.item[j].velocity.Y * (float)(num22 - 1) + num20) / (float)num22;
}
else
{
if ((double)this.position.X + (double)this.width * 0.5 > (double)Main.item[j].position.X + (double)Main.item[j].width * 0.5)
{
if (Main.item[j].velocity.X < Player.itemGrabSpeedMax + this.velocity.X)
{
Item expr_A6E_cp_0 = Main.item[j];
expr_A6E_cp_0.velocity.X = expr_A6E_cp_0.velocity.X + Player.itemGrabSpeed;
}
if (Main.item[j].velocity.X < 0f)
{
Item expr_AA6_cp_0 = Main.item[j];
expr_AA6_cp_0.velocity.X = expr_AA6_cp_0.velocity.X + Player.itemGrabSpeed * 0.75f;
}
}
else
{
if (Main.item[j].velocity.X > -Player.itemGrabSpeedMax + this.velocity.X)
{
Item expr_AF0_cp_0 = Main.item[j];
expr_AF0_cp_0.velocity.X = expr_AF0_cp_0.velocity.X - Player.itemGrabSpeed;
}
if (Main.item[j].velocity.X > 0f)
{
Item expr_B25_cp_0 = Main.item[j];
expr_B25_cp_0.velocity.X = expr_B25_cp_0.velocity.X - Player.itemGrabSpeed * 0.75f;
}
}
if ((double)this.position.Y + (double)this.height * 0.5 > (double)Main.item[j].position.Y + (double)Main.item[j].height * 0.5)
{
if (Main.item[j].velocity.Y < Player.itemGrabSpeedMax)
{
Item expr_BAA_cp_0 = Main.item[j];
expr_BAA_cp_0.velocity.Y = expr_BAA_cp_0.velocity.Y + Player.itemGrabSpeed;
}
if (Main.item[j].velocity.Y < 0f)
{
Item expr_BE2_cp_0 = Main.item[j];
expr_BE2_cp_0.velocity.Y = expr_BE2_cp_0.velocity.Y + Player.itemGrabSpeed * 0.75f;
}
}
else
{
if (Main.item[j].velocity.Y > -Player.itemGrabSpeedMax)
{
Item expr_C20_cp_0 = Main.item[j];
expr_C20_cp_0.velocity.Y = expr_C20_cp_0.velocity.Y - Player.itemGrabSpeed;
}
if (Main.item[j].velocity.Y > 0f)
{
Item expr_C55_cp_0 = Main.item[j];
expr_C55_cp_0.velocity.Y = expr_C55_cp_0.velocity.Y - Player.itemGrabSpeed * 0.75f;
}
}
}
}
}
}
}
public bool SellItem(int price, int stack)
{
if (price <= 0)
{
return false;
}
Item[] array = new Item[58];
for (int i = 0; i < 58; i++)
{
array[i] = new Item();
array[i] = this.inventory[i].Clone();
}
int j = price / 5;
j *= stack;
if (j < 1)
{
j = 1;
}
bool flag = false;
while (j >= 1000000)
{
if (flag)
{
break;
}
int num = -1;
for (int k = 53; k >= 0; k--)
{
if (num == -1 && (this.inventory[k].type == 0 || this.inventory[k].stack == 0))
{
num = k;
}
while (this.inventory[k].type == 74 && this.inventory[k].stack < this.inventory[k].maxStack && j >= 1000000)
{
this.inventory[k].stack++;
j -= 1000000;
this.DoCoins(k);
if (this.inventory[k].stack == 0 && num == -1)
{
num = k;
}
}
}
if (j >= 1000000)
{
if (num == -1)
{
flag = true;
}
else
{
this.inventory[num].SetDefaults(74, false);
j -= 1000000;
}
}
}
while (j >= 10000)
{
if (flag)
{
break;
}
int num2 = -1;
for (int l = 53; l >= 0; l--)
{
if (num2 == -1 && (this.inventory[l].type == 0 || this.inventory[l].stack == 0))
{
num2 = l;
}
while (this.inventory[l].type == 73 && this.inventory[l].stack < this.inventory[l].maxStack && j >= 10000)
{
this.inventory[l].stack++;
j -= 10000;
this.DoCoins(l);
if (this.inventory[l].stack == 0 && num2 == -1)
{
num2 = l;
}
}
}
if (j >= 10000)
{
if (num2 == -1)
{
flag = true;
}
else
{
this.inventory[num2].SetDefaults(73, false);
j -= 10000;
}
}
}
while (j >= 100)
{
if (flag)
{
break;
}
int num3 = -1;
for (int m = 53; m >= 0; m--)
{
if (num3 == -1 && (this.inventory[m].type == 0 || this.inventory[m].stack == 0))
{
num3 = m;
}
while (this.inventory[m].type == 72 && this.inventory[m].stack < this.inventory[m].maxStack && j >= 100)
{
this.inventory[m].stack++;
j -= 100;
this.DoCoins(m);
if (this.inventory[m].stack == 0 && num3 == -1)
{
num3 = m;
}
}
}
if (j >= 100)
{
if (num3 == -1)
{
flag = true;
}
else
{
this.inventory[num3].SetDefaults(72, false);
j -= 100;
}
}
}
while (j >= 1 && !flag)
{
int num4 = -1;
for (int n = 53; n >= 0; n--)
{
if (num4 == -1 && (this.inventory[n].type == 0 || this.inventory[n].stack == 0))
{
num4 = n;
}
while (this.inventory[n].type == 71 && this.inventory[n].stack < this.inventory[n].maxStack && j >= 1)
{
this.inventory[n].stack++;
j--;
this.DoCoins(n);
if (this.inventory[n].stack == 0 && num4 == -1)
{
num4 = n;
}
}
}
if (j >= 1)
{
if (num4 == -1)
{
flag = true;
}
else
{
this.inventory[num4].SetDefaults(71, false);
j--;
}
}
}
if (flag)
{
for (int num5 = 0; num5 < 58; num5++)
{
this.inventory[num5] = array[num5].Clone();
}
return false;
}
return true;
}
public bool BuyItem(int price)
{
bool flag;
long num = Utils.CoinsCount(out flag, this.inventory, new int[]
{
58,
57,
56,
55,
54
});
long num2 = Utils.CoinsCount(out flag, this.bank.item, new int[0]);
long num3 = Utils.CoinsCount(out flag, this.bank2.item, new int[0]);
long num4 = Utils.CoinsCombineStacks(out flag, new long[]
{
num,
num2,
num3
});
if (num4 < (long)price)
{
return false;
}
List<Item[]> list = new List<Item[]>();
Dictionary<int, List<int>> dictionary = new Dictionary<int, List<int>>();
List<Point> list2 = new List<Point>();
List<Point> list3 = new List<Point>();
List<Point> list4 = new List<Point>();
List<Point> list5 = new List<Point>();
list.Add(this.inventory);
list.Add(this.bank.item);
list.Add(this.bank2.item);
for (int i = 0; i < list.Count; i++)
{
dictionary[i] = new List<int>();
}
dictionary[0] = new List<int>
{
58,
57,
56,
55,
54
};
for (int j = 0; j < list.Count; j++)
{
for (int k = 0; k < list[j].Length; k++)
{
if (!dictionary[j].Contains(k) && list[j][k].type >= 71 && list[j][k].type <= 74)
{
list3.Add(new Point(j, k));
}
}
}
int num5 = 0;
for (int l = list[num5].Length - 1; l >= 0; l--)
{
if (!dictionary[num5].Contains(l) && (list[num5][l].type == 0 || list[num5][l].stack == 0))
{
list2.Add(new Point(num5, l));
}
}
num5 = 1;
for (int m = list[num5].Length - 1; m >= 0; m--)
{
if (!dictionary[num5].Contains(m) && (list[num5][m].type == 0 || list[num5][m].stack == 0))
{
list4.Add(new Point(num5, m));
}
}
num5 = 2;
for (int n = list[num5].Length - 1; n >= 0; n--)
{
if (!dictionary[num5].Contains(n) && (list[num5][n].type == 0 || list[num5][n].stack == 0))
{
list5.Add(new Point(num5, n));
}
}
long num6 = (long)price;
Dictionary<Point, Item> dictionary2 = new Dictionary<Point, Item>();
while (num6 > 0L)
{
long num7 = 1000000L;
for (int num8 = 0; num8 < 4; num8++)
{
if (num6 >= num7)
{
foreach (Point current in list3)
{
if (list[current.X][current.Y].type == 74 - num8)
{
long num9 = num6 / num7;
dictionary2[current] = list[current.X][current.Y].Clone();
if (num9 < (long)list[current.X][current.Y].stack)
{
list[current.X][current.Y].stack -= (int)num9;
}
else
{
list[current.X][current.Y].SetDefaults(0, false);
list2.Add(current);
}
num6 -= num7 * (long)(dictionary2[current].stack - list[current.X][current.Y].stack);
}
}
}
num7 /= 100L;
}
if (num6 > 0L)
{
if (list2.Count <= 0)
{
foreach (KeyValuePair<Point, Item> current2 in dictionary2)
{
list[current2.Key.X][current2.Key.Y] = current2.Value.Clone();
}
return false;
}
list2.Sort(new Comparison<Point>(DelegateMethods.CompareYReverse));
Point item = new Point(-1, -1);
for (int num10 = 0; num10 < list.Count; num10++)
{
num7 = 10000L;
for (int num11 = 0; num11 < 3; num11++)
{
if (num6 >= num7)
{
foreach (Point current3 in list3)
{
if (current3.X == num10 && list[current3.X][current3.Y].type == 74 - num11 && list[current3.X][current3.Y].stack >= 1)
{
List<Point> list6 = list2;
if (num10 == 1 && list4.Count > 0)
{
list6 = list4;
}
if (num10 == 2 && list5.Count > 0)
{
list6 = list5;
}
if (--list[current3.X][current3.Y].stack <= 0)
{
list[current3.X][current3.Y].SetDefaults(0, false);
list6.Add(current3);
}
dictionary2[list6[0]] = list[list6[0].X][list6[0].Y].Clone();
list[list6[0].X][list6[0].Y].SetDefaults(73 - num11, false);
list[list6[0].X][list6[0].Y].stack = 100;
item = list6[0];
list6.RemoveAt(0);
break;
}
}
}
if (item.X != -1 || item.Y != -1)
{
break;
}
num7 /= 100L;
}
for (int num12 = 0; num12 < 2; num12++)
{
if (item.X == -1 && item.Y == -1)
{
foreach (Point current4 in list3)
{
if (current4.X == num10 && list[current4.X][current4.Y].type == 73 + num12 && list[current4.X][current4.Y].stack >= 1)
{
List<Point> list7 = list2;
if (num10 == 1 && list4.Count > 0)
{
list7 = list4;
}
if (num10 == 2 && list5.Count > 0)
{
list7 = list5;
}
if (--list[current4.X][current4.Y].stack <= 0)
{
list[current4.X][current4.Y].SetDefaults(0, false);
list7.Add(current4);
}
dictionary2[list7[0]] = list[list7[0].X][list7[0].Y].Clone();
list[list7[0].X][list7[0].Y].SetDefaults(72 + num12, false);
list[list7[0].X][list7[0].Y].stack = 100;
item = list7[0];
list7.RemoveAt(0);
break;
}
}
}
}
if (item.X != -1 && item.Y != -1)
{
list3.Add(item);
break;
}
}
list2.Sort(new Comparison<Point>(DelegateMethods.CompareYReverse));
list4.Sort(new Comparison<Point>(DelegateMethods.CompareYReverse));
list5.Sort(new Comparison<Point>(DelegateMethods.CompareYReverse));
}
}
return true;
}
public bool BuyItemOld(int price)
{
if (price == 0)
{
return true;
}
long num = 0L;
Item[] array = new Item[54];
for (int i = 0; i < 54; i++)
{
array[i] = new Item();
array[i] = this.inventory[i].Clone();
if (this.inventory[i].type == 71)
{
num += (long)this.inventory[i].stack;
}
if (this.inventory[i].type == 72)
{
num += (long)(this.inventory[i].stack * 100);
}
if (this.inventory[i].type == 73)
{
num += (long)(this.inventory[i].stack * 10000);
}
if (this.inventory[i].type == 74)
{
num += (long)(this.inventory[i].stack * 1000000);
}
}
if (num >= (long)price)
{
int j = price;
while (j > 0)
{
if (j >= 1000000)
{
for (int k = 0; k < 54; k++)
{
if (this.inventory[k].type == 74)
{
while (this.inventory[k].stack > 0 && j >= 1000000)
{
j -= 1000000;
this.inventory[k].stack--;
if (this.inventory[k].stack == 0)
{
this.inventory[k].type = 0;
}
}
}
}
}
if (j >= 10000)
{
for (int l = 0; l < 54; l++)
{
if (this.inventory[l].type == 73)
{
while (this.inventory[l].stack > 0 && j >= 10000)
{
j -= 10000;
this.inventory[l].stack--;
if (this.inventory[l].stack == 0)
{
this.inventory[l].type = 0;
}
}
}
}
}
if (j >= 100)
{
for (int m = 0; m < 54; m++)
{
if (this.inventory[m].type == 72)
{
while (this.inventory[m].stack > 0 && j >= 100)
{
j -= 100;
this.inventory[m].stack--;
if (this.inventory[m].stack == 0)
{
this.inventory[m].type = 0;
}
}
}
}
}
if (j >= 1)
{
for (int n = 0; n < 54; n++)
{
if (this.inventory[n].type == 71)
{
while (this.inventory[n].stack > 0 && j >= 1)
{
j--;
this.inventory[n].stack--;
if (this.inventory[n].stack == 0)
{
this.inventory[n].type = 0;
}
}
}
}
}
if (j > 0)
{
int num2 = -1;
for (int num3 = 53; num3 >= 0; num3--)
{
if (this.inventory[num3].type == 0 || this.inventory[num3].stack == 0)
{
num2 = num3;
break;
}
}
if (num2 < 0)
{
for (int num4 = 0; num4 < 54; num4++)
{
this.inventory[num4] = array[num4].Clone();
}
return false;
}
bool flag = true;
if (j >= 10000)
{
for (int num5 = 0; num5 < 58; num5++)
{
if (this.inventory[num5].type == 74 && this.inventory[num5].stack >= 1)
{
this.inventory[num5].stack--;
if (this.inventory[num5].stack == 0)
{
this.inventory[num5].type = 0;
}
this.inventory[num2].SetDefaults(73, false);
this.inventory[num2].stack = 100;
flag = false;
break;
}
}
}
else if (j >= 100)
{
for (int num6 = 0; num6 < 54; num6++)
{
if (this.inventory[num6].type == 73 && this.inventory[num6].stack >= 1)
{
this.inventory[num6].stack--;
if (this.inventory[num6].stack == 0)
{
this.inventory[num6].type = 0;
}
this.inventory[num2].SetDefaults(72, false);
this.inventory[num2].stack = 100;
flag = false;
break;
}
}
}
else if (j >= 1)
{
for (int num7 = 0; num7 < 54; num7++)
{
if (this.inventory[num7].type == 72 && this.inventory[num7].stack >= 1)
{
this.inventory[num7].stack--;
if (this.inventory[num7].stack == 0)
{
this.inventory[num7].type = 0;
}
this.inventory[num2].SetDefaults(71, false);
this.inventory[num2].stack = 100;
flag = false;
break;
}
}
}
if (flag)
{
if (j < 10000)
{
for (int num8 = 0; num8 < 54; num8++)
{
if (this.inventory[num8].type == 73 && this.inventory[num8].stack >= 1)
{
this.inventory[num8].stack--;
if (this.inventory[num8].stack == 0)
{
this.inventory[num8].type = 0;
}
this.inventory[num2].SetDefaults(72, false);
this.inventory[num2].stack = 100;
flag = false;
break;
}
}
}
if (flag && j < 1000000)
{
for (int num9 = 0; num9 < 54; num9++)
{
if (this.inventory[num9].type == 74 && this.inventory[num9].stack >= 1)
{
this.inventory[num9].stack--;
if (this.inventory[num9].stack == 0)
{
this.inventory[num9].type = 0;
}
this.inventory[num2].SetDefaults(73, false);
this.inventory[num2].stack = 100;
break;
}
}
}
}
}
}
return true;
}
return false;
}
public void AdjTiles()
{
int num = 4;
int num2 = 3;
for (int i = 0; i < 419; i++)
{
this.oldAdjTile[i] = this.adjTile[i];
this.adjTile[i] = 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)((this.position.X + (float)(this.width / 2)) / 16f);
int num4 = (int)((this.position.Y + (float)this.height) / 16f);
for (int j = num3 - num; j <= num3 + num; j++)
{
for (int k = num4 - num2; k < num4 + num2; k++)
{
if (Main.tile[j, k].active())
{
this.adjTile[(int)Main.tile[j, k].type] = true;
if (Main.tile[j, k].type == 302)
{
this.adjTile[17] = true;
}
if (Main.tile[j, k].type == 77)
{
this.adjTile[17] = true;
}
if (Main.tile[j, k].type == 133)
{
this.adjTile[17] = true;
this.adjTile[77] = true;
}
if (Main.tile[j, k].type == 134)
{
this.adjTile[16] = true;
}
if (Main.tile[j, k].type == 354)
{
this.adjTile[14] = true;
}
if (Main.tile[j, k].type == 355)
{
this.adjTile[13] = true;
this.adjTile[14] = true;
this.alchemyTable = true;
}
}
if (Main.tile[j, k].liquid > 200 && Main.tile[j, k].liquidType() == 0)
{
this.adjWater = true;
}
if (Main.tile[j, k].liquid > 200 && Main.tile[j, k].liquidType() == 2)
{
this.adjHoney = true;
}
if (Main.tile[j, k].liquid > 200 && Main.tile[j, k].liquidType() == 1)
{
this.adjLava = true;
}
}
}
if (Main.playerInventory)
{
bool flag = false;
for (int l = 0; l < 419; l++)
{
if (this.oldAdjTile[l] != this.adjTile[l])
{
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)
{
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 i = 3; i < 8 + this.extraAccessorySlots; i++)
{
if (this.armor[i].shieldSlot == 5 && this.eocDash > 0)
{
this.shield = this.armor[i].shieldSlot;
}
if ((this.shield <= 0 || this.armor[i].frontSlot < 1 || this.armor[i].frontSlot > 4) && (this.front < 1 || this.front > 4 || this.armor[i].shieldSlot <= 0))
{
if (this.armor[i].wingSlot > 0)
{
if (this.hideVisual[i] && (this.velocity.Y == 0f || this.mount.Active))
{
goto IL_302;
}
this.wings = (int)this.armor[i].wingSlot;
}
if (!this.hideVisual[i])
{
if (this.armor[i].stringColor > 0)
{
this.stringColor = this.armor[i].stringColor;
}
if (this.armor[i].handOnSlot > 0)
{
this.handon = this.armor[i].handOnSlot;
}
if (this.armor[i].handOffSlot > 0)
{
this.handoff = this.armor[i].handOffSlot;
}
if (this.armor[i].backSlot > 0)
{
this.back = this.armor[i].backSlot;
this.front = -1;
}
if (this.armor[i].frontSlot > 0)
{
this.front = this.armor[i].frontSlot;
}
if (this.armor[i].shoeSlot > 0)
{
this.shoe = this.armor[i].shoeSlot;
}
if (this.armor[i].waistSlot > 0)
{
this.waist = this.armor[i].waistSlot;
}
if (this.armor[i].shieldSlot > 0)
{
this.shield = this.armor[i].shieldSlot;
}
if (this.armor[i].neckSlot > 0)
{
this.neck = this.armor[i].neckSlot;
}
if (this.armor[i].faceSlot > 0)
{
this.face = this.armor[i].faceSlot;
}
if (this.armor[i].balloonSlot > 0)
{
this.balloon = this.armor[i].balloonSlot;
}
if (this.armor[i].type == 3580)
{
this.yoraiz0rEye = i - 2;
}
if (this.armor[i].type == 3581)
{
this.yoraiz0rDarkness = true;
}
}
}
IL_302:;
}
for (int j = 13; j < 18 + this.extraAccessorySlots; j++)
{
if (this.armor[j].stringColor > 0)
{
this.stringColor = this.armor[j].stringColor;
}
if (this.armor[j].handOnSlot > 0)
{
this.handon = this.armor[j].handOnSlot;
}
if (this.armor[j].handOffSlot > 0)
{
this.handoff = this.armor[j].handOffSlot;
}
if (this.armor[j].backSlot > 0)
{
this.back = this.armor[j].backSlot;
this.front = -1;
}
if (this.armor[j].frontSlot > 0)
{
this.front = this.armor[j].frontSlot;
}
if (this.armor[j].shoeSlot > 0)
{
this.shoe = this.armor[j].shoeSlot;
}
if (this.armor[j].waistSlot > 0)
{
this.waist = this.armor[j].waistSlot;
}
if (this.armor[j].shieldSlot > 0)
{
this.shield = this.armor[j].shieldSlot;
}
if (this.armor[j].neckSlot > 0)
{
this.neck = this.armor[j].neckSlot;
}
if (this.armor[j].faceSlot > 0)
{
this.face = this.armor[j].faceSlot;
}
if (this.armor[j].balloonSlot > 0)
{
this.balloon = this.armor[j].balloonSlot;
}
if (this.armor[j].wingSlot > 0)
{
this.wings = (int)this.armor[j].wingSlot;
}
if (this.armor[j].type == 3580)
{
this.yoraiz0rEye = j - 2;
}
if (this.armor[j].type == 3581)
{
this.yoraiz0rDarkness = 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;
int num = Player.SetMatch(1, this.body, this.Male, ref this.wearsRobe);
if (num != -1)
{
this.legs = num;
}
bool flag = false;
num = Player.SetMatch(2, this.legs, this.Male, ref flag);
if (num != -1)
{
this.legs = num;
}
if (this.body == 93)
{
this.shield = 0;
this.handoff = 0;
}
if (this.legs == 67)
{
this.shoe = 0;
}
if (this.wereWolf)
{
this.legs = 20;
this.body = 21;
this.head = 38;
}
if (this.merman)
{
this.head = 39;
this.legs = 21;
this.body = 22;
this.wings = 0;
}
this.socialShadow = false;
this.socialGhost = 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;
}
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.wings > 0)
{
this.back = -1;
this.front = -1;
}
if (this.head > 0 && this.face != 7)
{
this.face = -1;
}
if (this.webbed || this.frozen || this.stoned)
{
return;
}
if (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 num2 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 2f, this.position.Y - 2f - this.velocity.Y * 2f), this.width, this.height, 43, 0f, 0f, 100, new Color(255, 0, 255), 0.3f);
Main.dust[num2].fadeIn = 0.8f;
Main.dust[num2].noGravity = true;
Main.dust[num2].velocity *= 2f;
Main.dust[num2].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
}
if (this.wings == 27)
{
float num3 = 0.4f * this.stealth;
Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, num3, num3 * 0.9f, num3 * 0.2f);
}
if (this.head == 5 && this.body == 5 && this.legs == 5)
{
this.socialShadow = true;
}
if (this.head == 5 && this.body == 5 && this.legs == 5 && Main.rand.Next(10) == 0)
{
int num4 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 14, 0f, 0f, 200, default(Color), 1.2f);
Main.dust[num4].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
}
if (this.head == 76 && this.body == 49 && this.legs == 45)
{
this.socialShadow = true;
}
if (this.head == 74 && this.body == 48 && this.legs == 44)
{
this.socialShadow = true;
}
if (this.head == 74 && this.body == 48 && this.legs == 44 && Main.rand.Next(10) == 0)
{
int num5 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 14, 0f, 0f, 200, default(Color), 1.2f);
Main.dust[num5].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
}
if (this.head == 57 && this.body == 37 && this.legs == 35)
{
int maxValue = 10;
if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) > 1f)
{
maxValue = 2;
}
if (Main.rand.Next(maxValue) == 0)
{
int num6 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 115, 0f, 0f, 140, default(Color), 0.75f);
Main.dust[num6].noGravity = true;
Main.dust[num6].fadeIn = 1.5f;
Main.dust[num6].velocity *= 0.3f;
Main.dust[num6].velocity += this.velocity * 0.2f;
Main.dust[num6].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
}
}
if (this.head == 6 && this.body == 6 && this.legs == 6 && Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) > 1f && !this.rocketFrame)
{
for (int k = 0; k < 2; k++)
{
int num7 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 2f, this.position.Y - 2f - this.velocity.Y * 2f), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2f);
Main.dust[num7].noGravity = true;
Main.dust[num7].noLight = true;
Dust expr_CC2_cp_0 = Main.dust[num7];
expr_CC2_cp_0.velocity.X = expr_CC2_cp_0.velocity.X - this.velocity.X * 0.5f;
Dust expr_CEC_cp_0 = Main.dust[num7];
expr_CEC_cp_0.velocity.Y = expr_CEC_cp_0.velocity.Y - this.velocity.Y * 0.5f;
Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
}
}
if (this.head == 8 && this.body == 8 && this.legs == 8 && Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) > 1f)
{
int num8 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 2f, this.position.Y - 2f - this.velocity.Y * 2f), this.width, this.height, 40, 0f, 0f, 50, default(Color), 1.4f);
Main.dust[num8].noGravity = true;
Main.dust[num8].velocity.X = this.velocity.X * 0.25f;
Main.dust[num8].velocity.Y = this.velocity.Y * 0.25f;
Main.dust[num8].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
}
if (this.head == 9 && this.body == 9 && this.legs == 9 && Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) > 1f && !this.rocketFrame)
{
for (int l = 0; l < 2; l++)
{
int num9 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 2f, this.position.Y - 2f - this.velocity.Y * 2f), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2f);
Main.dust[num9].noGravity = true;
Main.dust[num9].noLight = true;
Dust expr_F6D_cp_0 = Main.dust[num9];
expr_F6D_cp_0.velocity.X = expr_F6D_cp_0.velocity.X - this.velocity.X * 0.5f;
Dust expr_F97_cp_0 = Main.dust[num9];
expr_F97_cp_0.velocity.Y = expr_F97_cp_0.velocity.Y - this.velocity.Y * 0.5f;
Main.dust[num9].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 num10 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 2f, this.position.Y - 2f - this.velocity.Y * 2f), this.width, this.height, 43, 0f, 0f, 100, default(Color), 0.3f);
Main.dust[num10].fadeIn = 0.8f;
Main.dust[num10].velocity *= 0f;
Main.dust[num10].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
}
if (this.body == 24 && this.legs == 23 && (this.head == 42 || this.head == 43 || this.head == 41) && this.velocity.X != 0f && this.velocity.Y != 0f && Main.rand.Next(10) == 0)
{
int num11 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 2f, this.position.Y - 2f - this.velocity.Y * 2f), this.width, this.height, 43, 0f, 0f, 100, default(Color), 0.3f);
Main.dust[num11].fadeIn = 0.8f;
Main.dust[num11].velocity *= 0f;
Main.dust[num11].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
}
if (this.body == 36 && this.head == 56 && this.velocity.X != 0f && this.velocity.Y == 0f)
{
for (int m = 0; m < 2; m++)
{
int num12 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)((this.gravDir == 1f) ? (this.height - 2) : -4)), this.width, 6, 106, 0f, 0f, 100, default(Color), 0.1f);
Main.dust[num12].fadeIn = 1f;
Main.dust[num12].noGravity = true;
Main.dust[num12].velocity *= 0.2f;
Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
}
}
if (this.body == 27 && this.head == 46 && this.legs == 26)
{
this.frostArmor = true;
if (this.velocity.X != 0f && this.velocity.Y == 0f && this.miscCounter % 2 == 0)
{
for (int n = 0; n < 2; n++)
{
int num13;
if (n == 0)
{
num13 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height + this.gfxOffY), this.width / 2, 6, 76, 0f, 0f, 0, default(Color), 1.35f);
}
else
{
num13 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2), this.position.Y + (float)this.height + this.gfxOffY), this.width / 2, 6, 76, 0f, 0f, 0, default(Color), 1.35f);
}
Main.dust[num13].scale *= 1f + (float)Main.rand.Next(20, 40) * 0.01f;
Main.dust[num13].noGravity = true;
Main.dust[num13].noLight = true;
Main.dust[num13].velocity *= 0.001f;
Dust expr_14DA_cp_0 = Main.dust[num13];
expr_14DA_cp_0.velocity.Y = expr_14DA_cp_0.velocity.Y - 0.003f;
Main.dust[num13].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
}
}
}
this.bodyFrame.Width = 40;
this.bodyFrame.Height = 56;
this.legFrame.Width = 40;
this.legFrame.Height = 56;
this.bodyFrame.X = 0;
this.legFrame.X = 0;
if (this.mount.Active)
{
this.legFrameCounter = 0.0;
this.legFrame.Y = this.legFrame.Height * 6;
if (this.velocity.Y != 0f)
{
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 num14 = Dust.NewDust(new Vector2(base.Center.X - 22f, this.position.Y + (float)this.height - 6f), 20, 10, 64, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 255, default(Color), 1f);
Main.dust[num14].velocity *= 0.1f;
Main.dust[num14].noLight = true;
}
if (Main.rand.Next(4) == 0)
{
int num15 = Dust.NewDust(new Vector2(base.Center.X + 12f, this.position.Y + (float)this.height - 6f), 20, 10, 64, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 255, default(Color), 1f);
Main.dust[num15].velocity *= 0.1f;
Main.dust[num15].noLight = true;
}
}
else
{
if (Main.rand.Next(4) == 0)
{
int num16 = Dust.NewDust(new Vector2(base.Center.X - 32f, this.position.Y + (float)this.height - 6f), 20, 10, 64, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 255, default(Color), 1f);
Main.dust[num16].velocity *= 0.1f;
Main.dust[num16].noLight = true;
}
if (Main.rand.Next(4) == 0)
{
int num17 = Dust.NewDust(new Vector2(base.Center.X + 2f, this.position.Y + (float)this.height - 6f), 20, 10, 64, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 255, default(Color), 1f);
Main.dust[num17].velocity *= 0.1f;
Main.dust[num17].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 (this.velocity.X == 0f)
{
this.mount.UpdateFrame(this, 0, this.velocity);
}
else
{
this.mount.UpdateFrame(this, 1, this.velocity);
}
}
else if (this.swimTime > 0)
{
this.legFrameCounter += 2.0;
while (this.legFrameCounter > 8.0)
{
this.legFrameCounter -= 8.0;
this.legFrame.Y = 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 (this.velocity.Y != 0f || 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 (this.velocity.X != 0f)
{
if ((this.slippy || this.slippy2) && !this.controlLeft && !this.controlRight)
{
this.legFrameCounter = 0.0;
this.legFrame.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.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;
this.legFrame.Y = 0;
}
if (this.carpetFrame >= 0)
{
this.legFrameCounter = 0.0;
this.legFrame.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)(-(float)this.direction);
}
}
}
this.legFrameCounter = 0.0;
this.legFrame.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;
return;
}
if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.666)
{
this.bodyFrame.Y = this.bodyFrame.Height * 2;
return;
}
this.bodyFrame.Y = this.bodyFrame.Height;
return;
}
else if (this.inventory[this.selectedItem].useStyle == 2)
{
if ((double)this.itemAnimation > (double)this.itemAnimationMax * 0.5)
{
this.bodyFrame.Y = this.bodyFrame.Height * 3;
return;
}
this.bodyFrame.Y = this.bodyFrame.Height * 2;
return;
}
else if (this.inventory[this.selectedItem].useStyle == 3)
{
if ((double)this.itemAnimation > (double)this.itemAnimationMax * 0.666)
{
this.bodyFrame.Y = this.bodyFrame.Height * 3;
return;
}
this.bodyFrame.Y = this.bodyFrame.Height * 3;
return;
}
else
{
if (this.inventory[this.selectedItem].useStyle == 4)
{
this.bodyFrame.Y = this.bodyFrame.Height * 2;
return;
}
if (this.inventory[this.selectedItem].useStyle == 5)
{
if (this.inventory[this.selectedItem].type == 281 || this.inventory[this.selectedItem].type == 986)
{
this.bodyFrame.Y = this.bodyFrame.Height * 2;
return;
}
float num18 = this.itemRotation * (float)this.direction;
this.bodyFrame.Y = this.bodyFrame.Height * 3;
if ((double)num18 < -0.75)
{
this.bodyFrame.Y = this.bodyFrame.Height * 2;
if (this.gravDir == -1f)
{
this.bodyFrame.Y = this.bodyFrame.Height * 4;
}
}
if ((double)num18 > 0.6)
{
this.bodyFrame.Y = this.bodyFrame.Height * 4;
if (this.gravDir == -1f)
{
this.bodyFrame.Y = this.bodyFrame.Height * 2;
return;
}
}
}
}
}
else
{
if (this.mount.Active)
{
this.bodyFrameCounter = 0.0;
this.bodyFrame.Y = this.bodyFrame.Height * this.mount.BodyFrame;
return;
}
if (this.pulley)
{
if (this.pulleyDir == 2)
{
this.bodyFrame.Y = this.bodyFrame.Height;
return;
}
this.bodyFrame.Y = this.bodyFrame.Height * 2;
return;
}
else
{
if (this.inventory[this.selectedItem].holdStyle == 1 && (!this.wet || !this.inventory[this.selectedItem].noWet))
{
this.bodyFrame.Y = this.bodyFrame.Height * 3;
return;
}
if (this.inventory[this.selectedItem].holdStyle == 2 && (!this.wet || !this.inventory[this.selectedItem].noWet))
{
this.bodyFrame.Y = this.bodyFrame.Height * 2;
return;
}
if (this.inventory[this.selectedItem].holdStyle == 3)
{
this.bodyFrame.Y = this.bodyFrame.Height * 3;
return;
}
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 vector = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num19 = 0f;
float num20 = 0f;
for (int num21 = 0; num21 < this.grapCount; num21++)
{
num19 += Main.projectile[this.grappling[num21]].position.X + (float)(Main.projectile[this.grappling[num21]].width / 2);
num20 += Main.projectile[this.grappling[num21]].position.Y + (float)(Main.projectile[this.grappling[num21]].height / 2);
}
num19 /= (float)this.grapCount;
num20 /= (float)this.grapCount;
num19 -= vector.X;
num20 -= vector.Y;
if (num20 < 0f && Math.Abs(num20) > Math.Abs(num19))
{
this.bodyFrame.Y = this.bodyFrame.Height * 2;
if (this.gravDir == -1f)
{
this.bodyFrame.Y = this.bodyFrame.Height * 4;
return;
}
}
else
{
if (num20 <= 0f || Math.Abs(num20) <= Math.Abs(num19))
{
this.bodyFrame.Y = this.bodyFrame.Height * 3;
return;
}
this.bodyFrame.Y = this.bodyFrame.Height * 4;
if (this.gravDir == -1f)
{
this.bodyFrame.Y = this.bodyFrame.Height * 2;
return;
}
}
}
else if (this.swimTime > 0)
{
if (this.swimTime > 20)
{
this.bodyFrame.Y = 0;
return;
}
if (this.swimTime > 10)
{
this.bodyFrame.Y = this.bodyFrame.Height * 5;
return;
}
this.bodyFrame.Y = 0;
return;
}
else
{
if (this.velocity.Y != 0f)
{
if (this.sliding)
{
this.bodyFrame.Y = this.bodyFrame.Height * 3;
}
else if (this.sandStorm || this.carpetFrame >= 0)
{
this.bodyFrame.Y = this.bodyFrame.Height * 6;
}
else if (this.eocDash > 0)
{
this.bodyFrame.Y = this.bodyFrame.Height * 6;
}
else if (this.wings > 0)
{
if (this.wings == 22 || this.wings == 28)
{
this.bodyFrame.Y = 0;
}
else if (this.velocity.Y > 0f)
{
if (this.controlJump)
{
this.bodyFrame.Y = this.bodyFrame.Height * 6;
}
else
{
this.bodyFrame.Y = this.bodyFrame.Height * 5;
}
}
else
{
this.bodyFrame.Y = this.bodyFrame.Height * 6;
}
}
else
{
this.bodyFrame.Y = this.bodyFrame.Height * 5;
}
this.bodyFrameCounter = 0.0;
return;
}
if (this.velocity.X != 0f)
{
this.bodyFrameCounter += (double)Math.Abs(this.velocity.X) * 1.5;
this.bodyFrame.Y = this.legFrame.Y;
return;
}
this.bodyFrameCounter = 0.0;
this.bodyFrame.Y = 0;
}
}
}
}
public static int SetMatch(int armorslot, int type, bool male, ref bool somethingSpecial)
{
int num = -1;
if (armorslot == 1)
{
if (type <= 63)
{
if (type <= 36)
{
if (type != 15)
{
if (type == 36)
{
num = 89;
}
}
else
{
num = 88;
}
}
else
{
switch (type)
{
case 41:
num = 97;
break;
case 42:
num = 90;
break;
default:
switch (type)
{
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;
}
break;
}
}
}
else if (type <= 167)
{
if (type != 77)
{
switch (type)
{
case 165:
if (!male)
{
num = 118;
}
else
{
num = 99;
}
break;
case 166:
if (!male)
{
num = 119;
}
else
{
num = 100;
}
break;
case 167:
if (!male)
{
num = 101;
}
else
{
num = 102;
}
break;
}
}
else
{
num = 121;
}
}
else
{
switch (type)
{
case 180:
num = 115;
break;
case 181:
num = 116;
break;
case 182:
break;
case 183:
num = 123;
break;
default:
if (type == 191)
{
num = 131;
}
break;
}
}
if (num != -1)
{
somethingSpecial = true;
}
}
if (armorslot == 2)
{
switch (type)
{
case 83:
if (male)
{
num = 117;
}
break;
case 84:
if (male)
{
num = 120;
}
break;
}
}
return num;
}
public void Teleport(Vector2 newPos, int Style = 0, int extraInfo = 0)
{
try
{
this.grappling[0] = -1;
this.grapCount = 0;
for (int i = 0; i < 1000; i++)
{
if (Main.projectile[i].active && Main.projectile[i].owner == this.whoAmI && Main.projectile[i].aiStyle == 7)
{
Main.projectile[i].Kill();
}
}
int extraInfo2 = 0;
if (Style == 4)
{
extraInfo2 = this.lastPortalColorIndex;
}
Main.TeleportEffect(this.getRect(), Style, extraInfo2);
this.position = newPos;
this.fallStart = (int)(this.position.Y / 16f);
if (this.whoAmI == Main.myPlayer)
{
Main.BlackFadeIn = 255;
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);
if (Main.mapTime < 5)
{
Main.mapTime = 5;
}
Main.quickBG = 10;
Main.maxQ = true;
Main.renderNow = true;
}
if (Style == 4)
{
this.lastPortalColorIndex = extraInfo;
extraInfo2 = this.lastPortalColorIndex;
this.justGotOutOfPortal = true;
this.gravity = 0f;
}
for (int j = 0; j < 3; j++)
{
this.UpdateSocialShadow();
}
this.oldPosition = this.position;
Main.TeleportEffect(this.getRect(), Style, extraInfo2);
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, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0, 0, 0);
Main.gameMenu = false;
}
this.headPosition = Vector2.Zero;
this.bodyPosition = Vector2.Zero;
this.legPosition = Vector2.Zero;
this.headRotation = 0f;
this.bodyRotation = 0f;
this.legRotation = 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.tileSolid[(int)Main.tile[i, j].type] && !Main.tileSolidTop[(int)Main.tile[i, j].type])
{
WorldGen.KillTile(i, j, false, false, false);
}
if (Main.tile[i, j].liquid > 0)
{
Main.tile[i, j].lava(false);
Main.tile[i, j].liquid = 0;
WorldGen.SquareTileFrame(i, j, true);
}
}
}
}
this.wet = false;
this.wetCount = 0;
this.lavaWet = false;
this.fallStart = (int)(this.position.Y / 16f);
this.fallStart2 = this.fallStart;
this.velocity.X = 0f;
this.velocity.Y = 0f;
for (int k = 0; k < 3; k++)
{
this.UpdateSocialShadow();
}
this.oldPosition = this.position;
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)
{
Main.BlackFadeIn = 255;
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;
}
if (this.whoAmI == Main.myPlayer)
{
for (int i = 0; i < 22; i++)
{
if (this.buffTime[i] > 0 && this.buffType[i] == 59)
{
this.DelBuff(i);
}
}
NetMessage.SendData(62, -1, -1, "", this.whoAmI, 2f, 0f, 0f, 0, 0, 0);
}
}
public void NinjaDodge()
{
this.immune = true;
this.immuneTime = 80;
if (this.longInvince)
{
this.immuneTime += 40;
}
for (int i = 0; i < 100; i++)
{
int num = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 2f);
Dust expr_82_cp_0 = Main.dust[num];
expr_82_cp_0.position.X = expr_82_cp_0.position.X + (float)Main.rand.Next(-20, 21);
Dust expr_A9_cp_0 = Main.dust[num];
expr_A9_cp_0.position.Y = expr_A9_cp_0.position.Y + (float)Main.rand.Next(-20, 21);
Main.dust[num].velocity *= 0.4f;
Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f;
Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(this.cWaist, this);
if (Main.rand.Next(2) == 0)
{
Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f;
Main.dust[num].noGravity = true;
}
}
int num2 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num2].scale = 1.5f;
Main.gore[num2].velocity.X = (float)Main.rand.Next(-50, 51) * 0.01f;
Main.gore[num2].velocity.Y = (float)Main.rand.Next(-50, 51) * 0.01f;
Main.gore[num2].velocity *= 0.4f;
num2 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num2].scale = 1.5f;
Main.gore[num2].velocity.X = 1.5f + (float)Main.rand.Next(-50, 51) * 0.01f;
Main.gore[num2].velocity.Y = 1.5f + (float)Main.rand.Next(-50, 51) * 0.01f;
Main.gore[num2].velocity *= 0.4f;
num2 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num2].scale = 1.5f;
Main.gore[num2].velocity.X = -1.5f - (float)Main.rand.Next(-50, 51) * 0.01f;
Main.gore[num2].velocity.Y = 1.5f + (float)Main.rand.Next(-50, 51) * 0.01f;
Main.gore[num2].velocity *= 0.4f;
num2 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num2].scale = 1.5f;
Main.gore[num2].velocity.X = 1.5f + (float)Main.rand.Next(-50, 51) * 0.01f;
Main.gore[num2].velocity.Y = -1.5f - (float)Main.rand.Next(-50, 51) * 0.01f;
Main.gore[num2].velocity *= 0.4f;
num2 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num2].scale = 1.5f;
Main.gore[num2].velocity.X = -1.5f - (float)Main.rand.Next(-50, 51) * 0.01f;
Main.gore[num2].velocity.Y = -1.5f - (float)Main.rand.Next(-50, 51) * 0.01f;
Main.gore[num2].velocity *= 0.4f;
if (this.whoAmI == Main.myPlayer)
{
NetMessage.SendData(62, -1, -1, "", this.whoAmI, 1f, 0f, 0f, 0, 0, 0);
}
}
public double Hurt(int Damage, int hitDirection, bool pvp = false, bool quiet = false, string deathText = " was slain...", bool Crit = false)
{
if (this.immune)
{
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, true);
}
this.stealth = 1f;
if (Main.netMode == 1)
{
NetMessage.SendData(84, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0);
}
int num = Damage;
double num2 = Main.CalculatePlayerDamage(num, this.statDefense);
if (Crit)
{
num *= 2;
}
if (num2 >= 1.0)
{
if (this.invis)
{
for (int i = 0; i < 22; i++)
{
if (this.buffType[i] == 10)
{
this.DelBuff(i);
}
}
}
num2 = (double)((int)((double)(1f - this.endurance) * num2));
if (num2 < 1.0)
{
num2 = 1.0;
}
if (this.ConsumeSolarFlare())
{
float num3 = 0.3f;
num2 = (double)((int)((double)(1f - num3) * num2));
if (num2 < 1.0)
{
num2 = 1.0;
}
if (this.whoAmI == Main.myPlayer)
{
int num4 = Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 608, 150, 15f, Main.myPlayer, 0f, 0f);
Main.projectile[num4].Kill();
}
}
if (this.beetleDefense && this.beetleOrbs > 0)
{
float num5 = 0.15f * (float)this.beetleOrbs;
num2 = (double)((int)((double)(1f - num5) * num2));
this.beetleOrbs--;
for (int j = 0; j < 22; j++)
{
if (this.buffType[j] >= 95 && this.buffType[j] <= 97)
{
this.DelBuff(j);
}
}
if (this.beetleOrbs > 0)
{
this.AddBuff(95 + this.beetleOrbs - 1, 5, false);
}
this.beetleCounter = 0f;
if (num2 < 1.0)
{
num2 = 1.0;
}
}
if (this.magicCuffs)
{
int num6 = num;
this.statMana += num6;
if (this.statMana > this.statManaMax2)
{
this.statMana = this.statManaMax2;
}
this.ManaEffect(num6);
}
if (this.paladinBuff && this.whoAmI != Main.myPlayer)
{
int damage = (int)(num2 * 0.25);
num2 = (double)((int)(num2 * 0.75));
if (Main.player[Main.myPlayer].paladinGive)
{
int myPlayer = Main.myPlayer;
if (Main.player[myPlayer].team == this.team && this.team != 0)
{
float num7 = this.position.X - Main.player[myPlayer].position.X;
float num8 = this.position.Y - Main.player[myPlayer].position.Y;
float num9 = (float)Math.Sqrt((double)(num7 * num7 + num8 * num8));
if (num9 < 800f)
{
Main.player[myPlayer].Hurt(damage, 0, false, false, "", false);
}
}
}
}
if (this.brainOfConfusion && Main.myPlayer == this.whoAmI)
{
for (int k = 0; k < 200; k++)
{
if (Main.npc[k].active && !Main.npc[k].friendly)
{
int num10 = 300;
num10 += (int)num2 * 2;
if (Main.rand.Next(500) < num10)
{
float num11 = (Main.npc[k].Center - base.Center).Length();
float num12 = (float)Main.rand.Next(200 + (int)num2 / 2, 301 + (int)num2 * 2);
if (num12 > 500f)
{
num12 = 500f + (num12 - 500f) * 0.75f;
}
if (num12 > 700f)
{
num12 = 700f + (num12 - 700f) * 0.5f;
}
if (num12 > 900f)
{
num12 = 900f + (num12 - 900f) * 0.25f;
}
if (num11 < num12)
{
float num13 = (float)Main.rand.Next(90 + (int)num2 / 3, 300 + (int)num2 / 2);
Main.npc[k].AddBuff(31, (int)num13, false);
}
}
}
}
Projectile.NewProjectile(base.Center.X + (float)Main.rand.Next(-40, 40), base.Center.Y - (float)Main.rand.Next(20, 60), this.velocity.X * 0.3f, this.velocity.Y * 0.3f, 565, 0, 0f, this.whoAmI, 0f, 0f);
}
if (Main.netMode == 1 && this.whoAmI == Main.myPlayer && !quiet)
{
int number = 0;
if (Crit)
{
number = 1;
}
int num14 = 0;
if (pvp)
{
num14 = 1;
}
NetMessage.SendData(13, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0);
NetMessage.SendData(16, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0);
NetMessage.SendData(26, -1, -1, "", this.whoAmI, (float)hitDirection, (float)Damage, (float)num14, number, 0, 0);
}
Color color = Crit ? CombatText.DamagedFriendlyCrit : CombatText.DamagedFriendly;
CombatText.NewText(new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height), color, string.Concat((int)num2), Crit, false);
this.statLife -= (int)num2;
this.immune = true;
if (num2 == 1.0)
{
this.immuneTime = 20;
if (this.longInvince)
{
this.immuneTime += 20;
}
}
else
{
this.immuneTime = 40;
if (this.longInvince)
{
this.immuneTime += 40;
}
}
this.lifeRegenTime = 0;
if (pvp)
{
this.immuneTime = 8;
}
if (this.whoAmI == Main.myPlayer)
{
if (this.starCloak)
{
for (int l = 0; l < 3; l++)
{
float x = this.position.X + (float)Main.rand.Next(-400, 400);
float y = this.position.Y - (float)Main.rand.Next(500, 800);
Vector2 vector = new Vector2(x, y);
float num15 = this.position.X + (float)(this.width / 2) - vector.X;
float num16 = this.position.Y + (float)(this.height / 2) - vector.Y;
num15 += (float)Main.rand.Next(-100, 101);
int num17 = 23;
float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16));
num18 = (float)num17 / num18;
num15 *= num18;
num16 *= num18;
int num19 = Projectile.NewProjectile(x, y, num15, num16, 92, 30, 5f, this.whoAmI, 0f, 0f);
Main.projectile[num19].ai[1] = this.position.Y;
}
}
if (this.bee)
{
int num20 = 1;
if (Main.rand.Next(3) == 0)
{
num20++;
}
if (Main.rand.Next(3) == 0)
{
num20++;
}
if (this.strongBees && Main.rand.Next(3) == 0)
{
num20++;
}
for (int m = 0; m < num20; m++)
{
float speedX = (float)Main.rand.Next(-35, 36) * 0.02f;
float speedY = (float)Main.rand.Next(-35, 36) * 0.02f;
Projectile.NewProjectile(this.position.X, this.position.Y, speedX, speedY, this.beeType(), this.beeDamage(7), this.beeKB(0f), Main.myPlayer, 0f, 0f);
}
}
}
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, 1);
}
else if (this.frostArmor)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 27);
}
else if (this.wereWolf)
{
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, 1);
}
else
{
Main.PlaySound(1, (int)this.position.X, (int)this.position.Y, 1);
}
if (this.statLife > 0)
{
int num21 = 0;
while ((double)num21 < num2 / (double)this.statLifeMax2 * 100.0)
{
if (this.stoned)
{
Dust.NewDust(this.position, this.width, this.height, 1, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
else if (this.frostArmor)
{
int num22 = Dust.NewDust(this.position, this.width, this.height, 135, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
Main.dust[num22].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
}
else if (this.boneArmor)
{
int num23 = Dust.NewDust(this.position, this.width, this.height, 26, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
Main.dust[num23].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
}
else
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
num21++;
}
}
else
{
this.statLife = 0;
if (this.whoAmI == Main.myPlayer)
{
this.KillMe(num2, hitDirection, pvp, deathText);
}
}
}
if (pvp)
{
num2 = Main.CalculateDamage(num, this.statDefense);
}
return num2;
}
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 KillMe(double dmg, int hitDirection, bool pvp = false, string deathText = " was slain...")
{
if (this.dead)
{
return;
}
if (pvp)
{
this.pvpDeath = true;
}
if (this.trapDebuffSource)
{
AchievementsHelper.HandleSpecialEvent(this, 4);
}
this.lastDeathPostion = base.Center;
this.lastDeathTime = DateTime.Now;
this.showLastDeath = true;
bool flag;
int coinsOwned = (int)Utils.CoinsCount(out flag, this.inventory, new int[0]);
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)
{
if (this.difficulty == 0)
{
for (int i = 0; i < 59; i++)
{
if (this.inventory[i].stack > 0 && this.inventory[i].type >= 1522 && this.inventory[i].type <= 1527)
{
int num = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, this.inventory[i].type, 1, false, 0, false);
Main.item[num].netDefaults(this.inventory[i].netID);
Main.item[num].Prefix((int)this.inventory[i].prefix);
Main.item[num].stack = this.inventory[i].stack;
Main.item[num].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f;
Main.item[num].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f;
Main.item[num].noGrabDelay = 100;
Main.item[num].favorited = false;
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", num, 0f, 0f, 0f, 0, 0, 0);
}
this.inventory[i].SetDefaults(0, false);
}
}
}
else
{
Main.trashItem.SetDefaults(0, false);
if (this.difficulty == 1)
{
this.DropItems();
}
else if (this.difficulty == 2)
{
this.DropItems();
this.KillMeForGood();
}
}
}
Main.PlaySound(5, (int)this.position.X, (int)this.position.Y, 1);
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 j = 0; j < 100; j++)
{
if (this.stoned)
{
Dust.NewDust(this.position, this.width, this.height, 1, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
else if (this.frostArmor)
{
int num2 = Dust.NewDust(this.position, this.width, this.height, 135, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
Main.dust[num2].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
}
else if (this.boneArmor)
{
int num3 = Dust.NewDust(this.position, this.width, this.height, 26, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
Main.dust[num3].shader = GameShaders.Armor.GetSecondaryShader(this.ArmorSetDye(), this);
}
else
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
}
this.mount.Dismount(this);
this.dead = true;
this.respawnTimer = 600;
bool flag2 = false;
if (Main.netMode != 0 && !pvp)
{
for (int k = 0; k < 200; k++)
{
if (Main.npc[k].active && (Main.npc[k].boss || Main.npc[k].type == 13 || Main.npc[k].type == 14 || Main.npc[k].type == 15) && Math.Abs(base.Center.X - Main.npc[k].Center.X) + Math.Abs(base.Center.Y - Main.npc[k].Center.Y) < 4000f)
{
flag2 = true;
break;
}
}
}
if (flag2)
{
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;
if (Main.netMode == 2)
{
NetMessage.SendData(25, -1, -1, this.name + deathText, 255, 225f, 25f, 25f, 0, 0, 0);
}
else if (Main.netMode == 0)
{
Main.NewText(this.name + deathText, 225, 25, 25, false);
}
if (Main.netMode == 1 && this.whoAmI == Main.myPlayer)
{
int num4 = 0;
if (pvp)
{
num4 = 1;
}
NetMessage.SendData(44, -1, -1, deathText, this.whoAmI, (float)hitDirection, (float)((int)dmg), (float)num4, 0, 0, 0);
}
if (this.whoAmI == Main.myPlayer && this.difficulty == 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)
{
try
{
WorldGen.saveToonWhilePlaying();
}
catch
{
}
}
}
public void DropTombstone(int coinsOwned, string deathText, int hitDirection)
{
if (Main.netMode != 1)
{
float num = (float)Main.rand.Next(-35, 36) * 0.1f;
while (num < 2f && num > -2f)
{
num += (float)Main.rand.Next(-30, 31) * 0.1f;
}
int num2 = Main.rand.Next(6);
if (coinsOwned > 100000)
{
num2 = Main.rand.Next(5);
num2 += 527;
}
else if (num2 == 0)
{
num2 = 43;
}
else
{
num2 = 200 + num2;
}
int num3 = 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 + num, (float)Main.rand.Next(-40, -20) * 0.1f, num2, 0, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num3].miscText = this.name + deathText;
}
}
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)
{
return true;
}
if (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 i = 0; i < num; i++)
{
if (this.inventory[i].type == 0)
{
return true;
}
}
for (int j = 0; j < num; j++)
{
if (this.inventory[j].type > 0 && this.inventory[j].stack < this.inventory[j].maxStack && newItem.IsTheSameAs(this.inventory[j]))
{
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 k = 54; k < 58; k++)
{
if (this.inventory[k].type == 0)
{
return true;
}
}
}
for (int l = 54; l < 58; l++)
{
if (this.inventory[l].type > 0 && this.inventory[l].stack < this.inventory[l].maxStack && newItem.IsTheSameAs(this.inventory[l]))
{
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))
{
this.inventory[i].SetDefaults(this.inventory[i].type + 1, false);
for (int j = 0; j < 54; j++)
{
if (this.inventory[j].IsTheSameAs(this.inventory[i]) && j != i && this.inventory[j].type == this.inventory[i].type && this.inventory[j].stack < this.inventory[j].maxStack)
{
this.inventory[j].stack++;
this.inventory[i].SetDefaults(0, false);
this.inventory[i].active = false;
this.inventory[i].name = "";
this.inventory[i].type = 0;
this.inventory[i].stack = 0;
this.DoCoins(j);
}
}
}
}
public Item FillAmmo(int plr, Item newItem, bool noText = false)
{
for (int i = 54; i < 58; i++)
{
if (this.inventory[i].type > 0 && this.inventory[i].stack < this.inventory[i].maxStack && newItem.IsTheSameAs(this.inventory[i]))
{
Main.PlaySound(7, (int)this.position.X, (int)this.position.Y, 1);
if (newItem.stack + this.inventory[i].stack <= this.inventory[i].maxStack)
{
this.inventory[i].stack += newItem.stack;
if (!noText)
{
ItemText.NewText(newItem, newItem.stack, false, false);
}
this.DoCoins(i);
if (plr == Main.myPlayer)
{
Recipe.FindRecipes();
}
return new Item();
}
newItem.stack -= this.inventory[i].maxStack - this.inventory[i].stack;
if (!noText)
{
ItemText.NewText(newItem, this.inventory[i].maxStack - this.inventory[i].stack, false, false);
}
this.inventory[i].stack = this.inventory[i].maxStack;
this.DoCoins(i);
if (plr == Main.myPlayer)
{
Recipe.FindRecipes();
}
}
}
if (newItem.type != 169 && newItem.type != 75 && newItem.type != 23 && newItem.type != 408 && newItem.type != 370 && newItem.type != 1246 && newItem.type != 154 && !newItem.notAmmo)
{
for (int j = 54; j < 58; j++)
{
if (this.inventory[j].type == 0)
{
this.inventory[j] = newItem;
if (!noText)
{
ItemText.NewText(newItem, newItem.stack, false, false);
}
this.DoCoins(j);
Main.PlaySound(7, (int)this.position.X, (int)this.position.Y, 1);
if (plr == Main.myPlayer)
{
Recipe.FindRecipes();
}
return new Item();
}
}
}
return newItem;
}
public Item GetItem(int plr, Item newItem, bool longText = false, bool noText = false)
{
bool flag = newItem.type >= 71 && newItem.type <= 74;
Item item = newItem;
int num = 50;
if (newItem.noGrabDelay > 0)
{
return item;
}
int num2 = 0;
if (newItem.uniqueStack && this.HasItem(newItem.type))
{
return item;
}
if (newItem.type == 71 || newItem.type == 72 || newItem.type == 73 || newItem.type == 74)
{
num2 = -4;
num = 54;
}
if (item.ammo > 0 && !item.notAmmo)
{
item = this.FillAmmo(plr, item, noText);
if (item.type == 0 || item.stack == 0)
{
return new Item();
}
}
for (int i = num2; i < 50; i++)
{
int num3 = i;
if (num3 < 0)
{
num3 = 54 + i;
}
if (this.inventory[num3].type > 0 && this.inventory[num3].stack < this.inventory[num3].maxStack && item.IsTheSameAs(this.inventory[num3]))
{
if (flag)
{
Main.PlaySound(38, (int)this.position.X, (int)this.position.Y, 1);
}
else
{
Main.PlaySound(7, (int)this.position.X, (int)this.position.Y, 1);
}
if (item.stack + this.inventory[num3].stack <= this.inventory[num3].maxStack)
{
this.inventory[num3].stack += item.stack;
if (!noText)
{
ItemText.NewText(newItem, item.stack, false, longText);
}
this.DoCoins(num3);
if (plr == Main.myPlayer)
{
Recipe.FindRecipes();
}
AchievementsHelper.NotifyItemPickup(this, item);
return new Item();
}
AchievementsHelper.NotifyItemPickup(this, item, this.inventory[num3].maxStack - this.inventory[num3].stack);
item.stack -= this.inventory[num3].maxStack - this.inventory[num3].stack;
if (!noText)
{
ItemText.NewText(newItem, this.inventory[num3].maxStack - this.inventory[num3].stack, false, longText);
}
this.inventory[num3].stack = this.inventory[num3].maxStack;
this.DoCoins(num3);
if (plr == Main.myPlayer)
{
Recipe.FindRecipes();
}
}
}
if (newItem.type != 71 && newItem.type != 72 && newItem.type != 73 && newItem.type != 74 && newItem.useStyle > 0)
{
for (int j = 0; j < 10; j++)
{
if (this.inventory[j].type == 0)
{
this.inventory[j] = item;
if (!noText)
{
ItemText.NewText(newItem, newItem.stack, false, longText);
}
this.DoCoins(j);
if (flag)
{
Main.PlaySound(38, (int)this.position.X, (int)this.position.Y, 1);
}
else
{
Main.PlaySound(7, (int)this.position.X, (int)this.position.Y, 1);
}
if (plr == Main.myPlayer)
{
Recipe.FindRecipes();
}
AchievementsHelper.NotifyItemPickup(this, item);
return new Item();
}
}
}
if (newItem.favorited)
{
for (int k = 0; k < num; k++)
{
if (this.inventory[k].type == 0)
{
this.inventory[k] = item;
if (!noText)
{
ItemText.NewText(newItem, newItem.stack, false, longText);
}
this.DoCoins(k);
if (flag)
{
Main.PlaySound(38, (int)this.position.X, (int)this.position.Y, 1);
}
else
{
Main.PlaySound(7, (int)this.position.X, (int)this.position.Y, 1);
}
if (plr == Main.myPlayer)
{
Recipe.FindRecipes();
}
AchievementsHelper.NotifyItemPickup(this, item);
return new Item();
}
}
}
else
{
for (int l = num - 1; l >= 0; l--)
{
if (this.inventory[l].type == 0)
{
this.inventory[l] = item;
if (!noText)
{
ItemText.NewText(newItem, newItem.stack, false, longText);
}
this.DoCoins(l);
if (flag)
{
Main.PlaySound(38, (int)this.position.X, (int)this.position.Y, 1);
}
else
{
Main.PlaySound(7, (int)this.position.X, (int)this.position.Y, 1);
}
if (plr == Main.myPlayer)
{
Recipe.FindRecipes();
}
AchievementsHelper.NotifyItemPickup(this, item);
return new Item();
}
}
}
return item;
}
public void PlaceThing()
{
if ((this.inventory[this.selectedItem].type == 1071 || this.inventory[this.selectedItem].type == 1543) && this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY)
{
int num = Player.tileTargetX;
int num2 = Player.tileTargetY;
if (Main.tile[num, num2] != null && Main.tile[num, num2].active())
{
this.showItemIcon = true;
if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem)
{
int num3 = -1;
int num4 = -1;
for (int i = 0; i < 58; i++)
{
if (this.inventory[i].stack > 0 && this.inventory[i].paint > 0)
{
num3 = (int)this.inventory[i].paint;
num4 = i;
break;
}
}
if (num3 > 0 && (int)Main.tile[num, num2].color() != num3 && WorldGen.paintTile(num, num2, (byte)num3, true))
{
int num5 = num4;
this.inventory[num5].stack--;
if (this.inventory[num5].stack <= 0)
{
this.inventory[num5].SetDefaults(0, false);
}
this.itemTime = this.inventory[this.selectedItem].useTime;
}
}
}
}
if ((this.inventory[this.selectedItem].type == 1072 || this.inventory[this.selectedItem].type == 1544) && this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY)
{
int num6 = Player.tileTargetX;
int num7 = Player.tileTargetY;
if (Main.tile[num6, num7] != null && Main.tile[num6, num7].wall > 0)
{
this.showItemIcon = true;
if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem)
{
int num8 = -1;
int num9 = -1;
for (int j = 0; j < 58; j++)
{
if (this.inventory[j].stack > 0 && this.inventory[j].paint > 0)
{
num8 = (int)this.inventory[j].paint;
num9 = j;
break;
}
}
if (num8 > 0 && (int)Main.tile[num6, num7].wallColor() != num8 && WorldGen.paintWall(num6, num7, (byte)num8, true))
{
int num10 = num9;
this.inventory[num10].stack--;
if (this.inventory[num10].stack <= 0)
{
this.inventory[num10].SetDefaults(0, false);
}
this.itemTime = this.inventory[this.selectedItem].useTime;
}
}
}
}
if ((this.inventory[this.selectedItem].type == 1100 || this.inventory[this.selectedItem].type == 1545) && this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY)
{
int num11 = Player.tileTargetX;
int num12 = Player.tileTargetY;
if (Main.tile[num11, num12] != null && ((Main.tile[num11, num12].wallColor() > 0 && Main.tile[num11, num12].wall > 0) || (Main.tile[num11, num12].color() > 0 && Main.tile[num11, num12].active())))
{
this.showItemIcon = true;
if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem)
{
if (Main.tile[num11, num12].color() > 0 && Main.tile[num11, num12].active() && WorldGen.paintTile(num11, num12, 0, true))
{
this.itemTime = this.inventory[this.selectedItem].useTime;
}
else if (Main.tile[num11, num12].wallColor() > 0 && Main.tile[num11, num12].wall > 0 && WorldGen.paintWall(num11, num12, 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) && this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY)
{
int num13 = Player.tileTargetX;
int num14 = Player.tileTargetY;
if (Main.tile[num13, num14].active() && Main.tile[num13, num14].type == 209)
{
int num15 = 0;
if (Main.tile[num13, num14].frameX < 72)
{
if (this.inventory[this.selectedItem].type == 929)
{
num15 = 1;
}
}
else if (Main.tile[num13, num14].frameX < 144)
{
if (this.inventory[this.selectedItem].type == 1338)
{
num15 = 2;
}
}
else if (Main.tile[num13, num14].frameX < 288 && this.inventory[this.selectedItem].type == 1345)
{
num15 = 3;
}
if (num15 > 0)
{
this.showItemIcon = true;
if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem)
{
int k = (int)(Main.tile[num13, num14].frameX / 18);
int num16 = 0;
int num17 = 0;
while (k >= 4)
{
num16++;
k -= 4;
}
k = num13 - k;
int l;
for (l = (int)(Main.tile[num13, num14].frameY / 18); l >= 3; l -= 3)
{
num17++;
}
l = num14 - l;
this.itemTime = this.inventory[this.selectedItem].useTime;
float num18 = 14f;
float num19 = 0f;
float num20 = 0f;
int type = 162;
if (num15 == 2)
{
type = 281;
}
if (num15 == 3)
{
type = 178;
}
int damage = this.inventory[this.selectedItem].damage;
int num21 = 8;
if (num17 == 0)
{
num19 = 10f;
num20 = 0f;
}
if (num17 == 1)
{
num19 = 7.5f;
num20 = -2.5f;
}
if (num17 == 2)
{
num19 = 5f;
num20 = -5f;
}
if (num17 == 3)
{
num19 = 2.75f;
num20 = -6f;
}
if (num17 == 4)
{
num19 = 0f;
num20 = -10f;
}
if (num17 == 5)
{
num19 = -2.75f;
num20 = -6f;
}
if (num17 == 6)
{
num19 = -5f;
num20 = -5f;
}
if (num17 == 7)
{
num19 = -7.5f;
num20 = -2.5f;
}
if (num17 == 8)
{
num19 = -10f;
num20 = 0f;
}
Vector2 vector = new Vector2((float)((k + 2) * 16), (float)((l + 2) * 16));
float num22 = num19;
float num23 = num20;
float num24 = (float)Math.Sqrt((double)(num22 * num22 + num23 * num23));
num24 = num18 / num24;
num22 *= num24;
num23 *= num24;
Projectile.NewProjectile(vector.X, vector.Y, num22, num23, type, damage, (float)num21, Main.myPlayer, 0f, 0f);
}
}
}
}
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 == 171 && this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY && this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem)
{
int num25 = this.inventory[this.selectedItem].type;
if (num25 >= 1874 && num25 <= 1877)
{
num25 -= 1873;
if (WorldGen.checkXmasTreeDrop(Player.tileTargetX, Player.tileTargetY, 0) != num25)
{
this.itemTime = this.inventory[this.selectedItem].useTime;
WorldGen.dropXmasTree(Player.tileTargetX, Player.tileTargetY, 0);
WorldGen.setXmasTree(Player.tileTargetX, Player.tileTargetY, 0, num25);
int num26 = Player.tileTargetX;
int num27 = Player.tileTargetY;
if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 10)
{
num26 -= (int)Main.tile[Player.tileTargetX, Player.tileTargetY].frameX;
num27 -= (int)Main.tile[Player.tileTargetX, Player.tileTargetY].frameY;
}
NetMessage.SendTileSquare(-1, num26, num27, 1);
}
}
else if (num25 >= 1878 && num25 <= 1883)
{
num25 -= 1877;
if (WorldGen.checkXmasTreeDrop(Player.tileTargetX, Player.tileTargetY, 1) != num25)
{
this.itemTime = this.inventory[this.selectedItem].useTime;
WorldGen.dropXmasTree(Player.tileTargetX, Player.tileTargetY, 1);
WorldGen.setXmasTree(Player.tileTargetX, Player.tileTargetY, 1, num25);
int num28 = Player.tileTargetX;
int num29 = Player.tileTargetY;
if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 10)
{
num28 -= (int)Main.tile[Player.tileTargetX, Player.tileTargetY].frameX;
num29 -= (int)Main.tile[Player.tileTargetX, Player.tileTargetY].frameY;
}
NetMessage.SendTileSquare(-1, num28, num29, 1);
}
}
else if (num25 >= 1884 && num25 <= 1894)
{
num25 -= 1883;
if (WorldGen.checkXmasTreeDrop(Player.tileTargetX, Player.tileTargetY, 2) != num25)
{
this.itemTime = this.inventory[this.selectedItem].useTime;
WorldGen.dropXmasTree(Player.tileTargetX, Player.tileTargetY, 2);
WorldGen.setXmasTree(Player.tileTargetX, Player.tileTargetY, 2, num25);
int num30 = Player.tileTargetX;
int num31 = Player.tileTargetY;
if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 10)
{
num30 -= (int)Main.tile[Player.tileTargetX, Player.tileTargetY].frameX;
num31 -= (int)Main.tile[Player.tileTargetX, Player.tileTargetY].frameY;
}
NetMessage.SendTileSquare(-1, num30, num31, 1);
}
}
else if (num25 >= 1895 && num25 <= 1905)
{
num25 -= 1894;
if (WorldGen.checkXmasTreeDrop(Player.tileTargetX, Player.tileTargetY, 3) != num25)
{
this.itemTime = this.inventory[this.selectedItem].useTime;
WorldGen.dropXmasTree(Player.tileTargetX, Player.tileTargetY, 3);
WorldGen.setXmasTree(Player.tileTargetX, Player.tileTargetY, 3, num25);
int num32 = Player.tileTargetX;
int num33 = Player.tileTargetY;
if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 10)
{
num32 -= (int)Main.tile[Player.tileTargetX, Player.tileTargetY].frameX;
num33 -= (int)Main.tile[Player.tileTargetX, Player.tileTargetY].frameY;
}
NetMessage.SendTileSquare(-1, num32, num33, 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 == 219)
{
if (this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY && this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem)
{
this.itemTime = this.inventory[this.selectedItem].useTime;
Main.PlaySound(7, -1, -1, 1);
int extractType = ItemID.Sets.ExtractinatorMode[this.inventory[this.selectedItem].type];
Player.ExtractinatorUse(extractType);
}
}
else if (this.inventory[this.selectedItem].createTile >= 0 && this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY)
{
this.showItemIcon = true;
bool flag = false;
if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid > 0 && Main.tile[Player.tileTargetX, Player.tileTargetY].lava())
{
if (Main.tileSolid[this.inventory[this.selectedItem].createTile])
{
flag = true;
}
else if (!TileObjectData.CheckLiquidPlacement(this.inventory[this.selectedItem].createTile, this.inventory[this.selectedItem].placeStyle, Main.tile[Player.tileTargetX, Player.tileTargetY]))
{
flag = true;
}
}
bool flag2 = true;
if (this.inventory[this.selectedItem].tileWand > 0)
{
int tileWand = this.inventory[this.selectedItem].tileWand;
flag2 = false;
for (int m = 0; m < 58; m++)
{
if (tileWand == this.inventory[m].type && this.inventory[m].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 num34 = Player.tileTargetY;
int num35 = Player.tileTargetX;
int arg_15F5_0 = this.inventory[this.selectedItem].createTile;
while (Main.tile[num35, num34].active() && Main.tileRope[(int)Main.tile[num35, num34].type] && num34 < Main.maxTilesX - 5 && Main.tile[num35, num34 + 2] != null && !Main.tile[num35, num34 + 1].lava())
{
num34++;
if (Main.tile[num35, num34] == null)
{
flag2 = false;
num34 = Player.tileTargetY;
}
}
if (!Main.tile[num35, num34].active())
{
Player.tileTargetY = num34;
}
}
if (flag2 && ((!Main.tile[Player.tileTargetX, Player.tileTargetY].active() && !flag) || (Main.tileCut[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type] || (Main.tile[Player.tileTargetX, Player.tileTargetY].type >= 373 && Main.tile[Player.tileTargetX, Player.tileTargetY].type <= 375)) || 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 tileObject = default(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 tileObject, false);
}
else
{
if (this.inventory[this.selectedItem].type == 213)
{
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 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 == 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 num36 = Player.tileTargetX;
int num37 = Player.tileTargetY - 1;
if (Main.tile[num36, num37].nactive() && Main.tileSolid[(int)Main.tile[num36, num37].type] && !Main.tileSolidTop[(int)Main.tile[num36, num37].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 == 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 > 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() != 0))
{
if (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type != 19)
{
WorldGen.SlopeTile(Player.tileTargetX, Player.tileTargetY + 1, 0);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 14, (float)Player.tileTargetX, (float)(Player.tileTargetY + 1), 0f, 0, 0, 0);
}
}
}
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() != 0))
{
if (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type != 19)
{
WorldGen.SlopeTile(Player.tileTargetX - 1, Player.tileTargetY, 0);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 14, (float)(Player.tileTargetX - 1), (float)Player.tileTargetY, 0f, 0, 0, 0);
}
}
}
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() != 0) && Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type != 19)
{
WorldGen.SlopeTile(Player.tileTargetX + 1, Player.tileTargetY, 0);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 14, (float)(Player.tileTargetX + 1), (float)Player.tileTargetY, 0f, 0, 0, 0);
}
}
}
int num38 = (int)Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type;
if (Main.tile[Player.tileTargetX, Player.tileTargetY].halfBrick())
{
num38 = -1;
}
int num39 = (int)Main.tile[Player.tileTargetX - 1, Player.tileTargetY].type;
int num40 = (int)Main.tile[Player.tileTargetX + 1, Player.tileTargetY].type;
int num41 = (int)Main.tile[Player.tileTargetX - 1, Player.tileTargetY - 1].type;
int num42 = (int)Main.tile[Player.tileTargetX + 1, Player.tileTargetY - 1].type;
int num43 = (int)Main.tile[Player.tileTargetX - 1, Player.tileTargetY - 1].type;
int num44 = (int)Main.tile[Player.tileTargetX + 1, Player.tileTargetY + 1].type;
if (!Main.tile[Player.tileTargetX, Player.tileTargetY + 1].nactive())
{
num38 = -1;
}
if (!Main.tile[Player.tileTargetX - 1, Player.tileTargetY].nactive())
{
num39 = -1;
}
if (!Main.tile[Player.tileTargetX + 1, Player.tileTargetY].nactive())
{
num40 = -1;
}
if (!Main.tile[Player.tileTargetX - 1, Player.tileTargetY - 1].nactive())
{
num41 = -1;
}
if (!Main.tile[Player.tileTargetX + 1, Player.tileTargetY - 1].nactive())
{
num42 = -1;
}
if (!Main.tile[Player.tileTargetX - 1, Player.tileTargetY + 1].nactive())
{
num43 = -1;
}
if (!Main.tile[Player.tileTargetX + 1, Player.tileTargetY + 1].nactive())
{
num44 = -1;
}
if (num38 >= 0 && Main.tileSolid[num38] && (!Main.tileNoAttach[num38] || num38 == 19))
{
flag3 = true;
}
else if ((num39 >= 0 && Main.tileSolid[num39] && !Main.tileNoAttach[num39]) || (num39 == 5 && num41 == 5 && num43 == 5) || num39 == 124)
{
flag3 = true;
}
else if ((num40 >= 0 && Main.tileSolid[num40] && !Main.tileNoAttach[num40]) || (num40 == 5 && num42 == 5 && num44 == 5) || num40 == 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 == 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 > 0 || Main.tile[Player.tileTargetX - 1, Player.tileTargetY].active() || Main.tile[Player.tileTargetX - 1, Player.tileTargetY].wall > 0 || Main.tile[Player.tileTargetX, Player.tileTargetY + 1].active() || Main.tile[Player.tileTargetX, Player.tileTargetY + 1].wall > 0 || Main.tile[Player.tileTargetX, Player.tileTargetY - 1].active() || Main.tile[Player.tileTargetX, Player.tileTargetY - 1].wall > 0)
{
flag3 = true;
}
}
else if (this.inventory[this.selectedItem].createTile == 314)
{
for (int n = Player.tileTargetX - 1; n <= Player.tileTargetX + 1; n++)
{
for (int num45 = Player.tileTargetY - 1; num45 <= Player.tileTargetY + 1; num45++)
{
Tile tile = Main.tile[n, num45];
if (tile.active() || tile.wall > 0)
{
flag3 = true;
break;
}
}
}
}
else
{
Tile tile2 = Main.tile[Player.tileTargetX - 1, Player.tileTargetY];
Tile tile3 = Main.tile[Player.tileTargetX + 1, Player.tileTargetY];
Tile tile4 = Main.tile[Player.tileTargetX, Player.tileTargetY - 1];
Tile tile5 = Main.tile[Player.tileTargetX, Player.tileTargetY + 1];
if ((tile3.active() && (Main.tileSolid[(int)tile3.type] || Main.tileRope[(int)tile3.type] || tile3.type == 314)) || (tile3.wall > 0 || (tile2.active() && (Main.tileSolid[(int)tile2.type] || Main.tileRope[(int)tile2.type] || tile2.type == 314))) || (tile2.wall > 0 || (tile5.active() && (Main.tileSolid[(int)tile5.type] || tile5.type == 124 || Main.tileRope[(int)tile5.type] || tile5.type == 314))) || (tile5.wall > 0 || (tile4.active() && (Main.tileSolid[(int)tile4.type] || tile4.type == 124 || Main.tileRope[(int)tile4.type] || tile4.type == 314))) || tile4.wall > 0)
{
flag3 = true;
}
}
if (this.inventory[this.selectedItem].type == 213 && Main.tile[Player.tileTargetX, Player.tileTargetY].active())
{
int num46 = Player.tileTargetX;
int num47 = Player.tileTargetY;
if (Main.tile[num46, num47].type == 3 || Main.tile[num46, num47].type == 73 || Main.tile[num46, num47].type == 84)
{
WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, false, false, false);
if (!Main.tile[Player.tileTargetX, Player.tileTargetY].active() && Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
}
}
else if (Main.tile[num46, num47].type == 83)
{
bool flag5 = false;
int num48 = (int)(Main.tile[num46, num47].frameX / 18);
if (num48 == 0 && Main.dayTime)
{
flag5 = true;
}
if (num48 == 1 && !Main.dayTime)
{
flag5 = true;
}
if (num48 == 3 && !Main.dayTime && (Main.bloodMoon || Main.moonPhase == 0))
{
flag5 = true;
}
if (num48 == 4 && (Main.raining || Main.cloudAlpha > 0f))
{
flag5 = true;
}
if (num48 == 5 && !Main.raining && Main.dayTime && Main.time > 40500.0)
{
flag5 = true;
}
if (flag5)
{
WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, false, false, false);
NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
}
}
}
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 >= 373 && Main.tile[Player.tileTargetX, Player.tileTargetY].type <= 375)))
{
if ((int)Main.tile[Player.tileTargetX, Player.tileTargetY].type != this.inventory[this.selectedItem].createTile)
{
if ((Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type != 78 && Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type != 380) || ((Main.tile[Player.tileTargetX, Player.tileTargetY].type == 3 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 73) && Main.tileAlch[this.inventory[this.selectedItem].createTile]))
{
WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, false, false, false);
if (!Main.tile[Player.tileTargetX, Player.tileTargetY].active() && Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 4, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
}
}
else
{
flag3 = false;
}
}
else
{
flag3 = false;
}
}
if (!flag3 && this.inventory[this.selectedItem].createTile == 19)
{
for (int num49 = Player.tileTargetX - 1; num49 <= Player.tileTargetX + 1; num49++)
{
for (int num50 = Player.tileTargetY - 1; num50 <= Player.tileTargetY + 1; num50++)
{
if (Main.tile[num49, num50].active())
{
flag3 = true;
break;
}
}
}
}
}
if (flag3)
{
int num51 = this.inventory[this.selectedItem].placeStyle;
if (!flag4)
{
if (this.inventory[this.selectedItem].createTile == 36)
{
num51 = Main.rand.Next(7);
}
if (this.inventory[this.selectedItem].createTile == 212 && this.direction > 0)
{
num51 = 1;
}
if (this.inventory[this.selectedItem].createTile == 141)
{
num51 = Main.rand.Next(2);
}
if (this.inventory[this.selectedItem].createTile == 128 || this.inventory[this.selectedItem].createTile == 269 || this.inventory[this.selectedItem].createTile == 334)
{
if (this.direction < 0)
{
num51 = -1;
}
else
{
num51 = 1;
}
}
if (this.inventory[this.selectedItem].createTile == 241 && this.inventory[this.selectedItem].placeStyle == 0)
{
num51 = Main.rand.Next(0, 9);
}
if (this.inventory[this.selectedItem].createTile == 35 && this.inventory[this.selectedItem].placeStyle == 0)
{
num51 = Main.rand.Next(9);
}
}
if (this.inventory[this.selectedItem].createTile == 314 && num51 == 2 && this.direction == 1)
{
num51++;
}
int[,] array = new int[11, 11];
if (this.autoPaint)
{
for (int num52 = 0; num52 < 11; num52++)
{
for (int num53 = 0; num53 < 11; num53++)
{
int num54 = Player.tileTargetX - 5 + num52;
int num55 = Player.tileTargetY - 5 + num53;
if (Main.tile[num54, num55].active())
{
array[num52, num53] = (int)Main.tile[num54, num55].type;
}
else
{
array[num52, num53] = -1;
}
}
}
}
bool forced = false;
bool flag6;
if (flag4)
{
flag6 = TileObject.Place(tileObject);
WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true);
Main.PlaySound(0, Player.tileTargetX * 16, Player.tileTargetY * 16, 1);
}
else
{
flag6 = WorldGen.PlaceTile(Player.tileTargetX, Player.tileTargetY, this.inventory[this.selectedItem].createTile, false, forced, this.whoAmI, num51);
}
if (this.inventory[this.selectedItem].type == 213 && !flag6 && Main.tile[Player.tileTargetX, Player.tileTargetY].type == 1 && Main.tile[Player.tileTargetX, Player.tileTargetY].active())
{
int num56 = 0;
int num57 = 0;
Point point = base.Center.ToTileCoordinates();
Dictionary<ushort, int> dictionary = new Dictionary<ushort, int>();
WorldUtils.Gen(new Point(point.X - 25, point.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(new ushort[]
{
182,
180,
179,
183,
181,
381
}).Output(dictionary));
foreach (KeyValuePair<ushort, int> current in dictionary)
{
if (current.Value > num57)
{
num57 = current.Value;
num56 = (int)current.Key;
}
}
if (num57 == 0)
{
num56 = Utils.SelectRandom<int>(Main.rand, new int[]
{
182,
180,
179,
183,
181
});
}
if (num56 != 0)
{
Main.tile[Player.tileTargetX, Player.tileTargetY].type = (ushort)num56;
WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true);
flag6 = true;
}
}
if (flag6)
{
this.itemTime = (int)((float)this.inventory[this.selectedItem].useTime * this.tileSpeed);
if (flag4)
{
TileObjectData.CallPostPlacementPlayerHook(Player.tileTargetX, Player.tileTargetY, this.inventory[this.selectedItem].createTile, num51, this.direction, tileObject);
if (Main.netMode == 1 && !Main.tileContainer[this.inventory[this.selectedItem].createTile])
{
NetMessage.SendObjectPlacment(-1, Player.tileTargetX, Player.tileTargetY, tileObject.type, tileObject.style, tileObject.alternate, tileObject.random, this.direction);
}
}
else
{
NetMessage.SendData(17, -1, -1, "", 1, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)this.inventory[this.selectedItem].createTile, num51, 0, 0);
if (this.inventory[this.selectedItem].createTile == 15)
{
if (this.direction == 1)
{
Tile expr_3036 = Main.tile[Player.tileTargetX, Player.tileTargetY];
expr_3036.frameX += 18;
Tile expr_305B = Main.tile[Player.tileTargetX, Player.tileTargetY - 1];
expr_305B.frameX += 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)
{
Tile expr_3104 = Main.tile[Player.tileTargetX, Player.tileTargetY];
expr_3104.frameX += 18;
}
if (Main.netMode == 1)
{
NetMessage.SendTileSquare(-1, Player.tileTargetX, Player.tileTargetY, 1);
}
}
if (this.inventory[this.selectedItem].createTile == 19 && Main.smartDigEnabled)
{
int num58 = Player.tileTargetX;
int num59 = Player.tileTargetY;
int num60 = -1;
int num61 = 0;
int num62 = 0;
bool flag7 = true;
for (int num63 = -1; num63 < 2; num63++)
{
for (int num64 = -1; num64 < 2; num64++)
{
if ((num63 != 0 || num64 != 0) && Main.tile[num58 + num63, num59 + num64].type == 19)
{
flag7 = false;
}
}
}
if (!flag7)
{
Tile tile6 = Main.tile[num58 - 1, num59 - 1];
if (tile6.active() && tile6.type == 19 && tile6.slope() != 2)
{
num61++;
}
tile6 = Main.tile[num58 - 1, num59 + 1];
if (tile6.active() && tile6.type == 19 && tile6.slope() != 1)
{
num62++;
}
tile6 = Main.tile[num58 + 1, num59 - 1];
if (tile6.active() && tile6.type == 19 && tile6.slope() != 1)
{
num62++;
}
tile6 = Main.tile[num58 + 1, num59 + 1];
if (tile6.active() && tile6.type == 19 && tile6.slope() != 2)
{
num61++;
}
tile6 = Main.tile[num58 - 1, num59];
if (WorldGen.SolidTile(tile6))
{
num61++;
if (tile6.type == 19 && tile6.slope() == 0)
{
num61++;
}
}
tile6 = Main.tile[num58 + 1, num59];
if (WorldGen.SolidTile(tile6))
{
num62++;
if (tile6.type == 19 && tile6.slope() == 0)
{
num62++;
}
}
if (num61 > num62)
{
num60 = 1;
}
else if (num62 > num61)
{
num60 = 2;
}
tile6 = Main.tile[num58 - 1, num59];
if (tile6.active() && tile6.type == 19)
{
num60 = 0;
}
tile6 = Main.tile[num58 + 1, num59];
if (tile6.active() && tile6.type == 19)
{
num60 = 0;
}
if (num60 != -1)
{
WorldGen.SlopeTile(num58, num59, num60);
int num65 = (int)Main.tile[num58, num59].slope();
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num65, 0, 0, 0);
}
int num66;
int num67;
if (num60 == 1)
{
num66 = -1;
num67 = -1;
}
else
{
num66 = 1;
num67 = -1;
}
tile6 = Main.tile[num58 + num66, num59 + num67];
if (tile6.active() && tile6.type == 19 && tile6.slope() == 0 && (!Main.tile[num58 + num66 + num66, num59 + num67].active() || Main.tile[num58 + num66 + num66, num59 + num67].type != 19 || !Main.tile[num58 + num66 + num66, num59 + num67].halfBrick()))
{
WorldGen.SlopeTile(num58 + num66, num59 + num67, num60);
num65 = (int)tile6.slope();
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 14, (float)(num58 + num66), (float)(num59 + num67), (float)num65, 0, 0, 0);
}
}
if (num60 == 1)
{
num66 = 1;
num67 = 1;
}
else
{
num66 = -1;
num67 = 1;
}
tile6 = Main.tile[num58 + num66, num59 + num67];
if (tile6.active() && tile6.type == 19 && tile6.slope() == 0 && WorldGen.PlatformProperSides(num58 + num66, num59 + num67, true) <= 0)
{
WorldGen.SlopeTile(num58 + num66, num59 + num67, num60);
num65 = (int)tile6.slope();
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 14, (float)(num58 + num66), (float)(num59 + num67), (float)num65, 0, 0, 0);
}
}
}
else
{
int num66 = -1;
tile6 = Main.tile[num58 + num66, num59];
if (tile6.active() && tile6.type == 19 && tile6.slope() != 0)
{
int num68 = (tile6.slope() == 1).ToDirectionInt() * num66;
num60 = (int)((num68 == -1) ? 0 : tile6.slope());
bool flag8 = true;
if (Main.tile[num58 + num66 * 2, num59 + num68].active() && Main.tile[num58 + num66 * 2, num59].type == 19 && num60 == (int)Main.tile[num58 + num66 * 2, num59 + num68].slope())
{
flag8 = false;
}
if (Main.tile[num58, num59 - num68].active() && Main.tile[num58, num59 - num68].type == 19 && tile6.slope() == Main.tile[num58, num59 - num68].slope())
{
flag8 = false;
}
if (flag8)
{
WorldGen.SlopeTile(num58 + num66, num59, num60);
int num69 = (int)tile6.slope();
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 14, (float)(num58 + num66), (float)num59, (float)num69, 0, 0, 0);
}
}
}
num66 = 1;
int num67 = 0;
tile6 = Main.tile[num58 + num66, num59 + num67];
if (tile6.active() && tile6.type == 19 && tile6.slope() != 0)
{
int num70 = (tile6.slope() == 1).ToDirectionInt() * num66;
num60 = (int)((num70 == -1) ? 0 : tile6.slope());
bool flag9 = true;
if (Main.tile[num58 + num66 * 2, num59 + num70].active() && Main.tile[num58 + num66 * 2, num59].type == 19 && num60 == (int)Main.tile[num58 + num66 * 2, num59 + num70].slope())
{
flag9 = false;
}
if (Main.tile[num58, num59 - num70].active() && Main.tile[num58, num59 - num70].type == 19 && tile6.slope() == Main.tile[num58, num59 - num70].slope())
{
flag9 = false;
}
if (flag9)
{
WorldGen.SlopeTile(num58 + num66, num59, num60);
int num69 = (int)tile6.slope();
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 14, (float)(num58 + num66), (float)num59, (float)num69, 0, 0, 0);
}
}
}
if (num61 == num62 && WorldGen.PlatformProperSides(num58, num59, false) == 0)
{
tile6 = Main.tile[num58, num59 + 1];
if (tile6.active() && !tile6.halfBrick() && tile6.slope() == 0 && Main.tileSolid[(int)tile6.type])
{
num60 = ((this.direction == 1) ? 2 : 1);
WorldGen.SlopeTile(num58, num59, num60);
int num69 = (int)Main.tile[num58, num59].slope();
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num69, 0, 0, 0);
}
}
}
}
}
}
if (Main.tileSolid[this.inventory[this.selectedItem].createTile] && this.inventory[this.selectedItem].createTile != 19)
{
int num71 = Player.tileTargetX;
int num72 = Player.tileTargetY + 1;
if (Main.tile[num71, num72] != null && Main.tile[num71, num72].type != 19 && (Main.tile[num71, num72].topSlope() || Main.tile[num71, num72].halfBrick()))
{
WorldGen.SlopeTile(num71, num72, 0);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 14, (float)num71, (float)num72, 0f, 0, 0, 0);
}
}
num71 = Player.tileTargetX;
num72 = Player.tileTargetY - 1;
if (Main.tile[num71, num72] != null && Main.tile[num71, num72].type != 19 && Main.tile[num71, num72].bottomSlope())
{
WorldGen.SlopeTile(num71, num72, 0);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 14, (float)num71, (float)num72, 0f, 0, 0, 0);
}
}
}
if (Main.tileSolid[this.inventory[this.selectedItem].createTile])
{
for (int num73 = Player.tileTargetX - 1; num73 <= Player.tileTargetX + 1; num73++)
{
for (int num74 = Player.tileTargetY - 1; num74 <= Player.tileTargetY + 1; num74++)
{
if (Main.tile[num73, num74].active() && this.inventory[this.selectedItem].createTile != (int)Main.tile[num73, num74].type && (Main.tile[num73, num74].type == 2 || Main.tile[num73, num74].type == 23 || Main.tile[num73, num74].type == 60 || Main.tile[num73, num74].type == 70 || Main.tile[num73, num74].type == 109 || Main.tile[num73, num74].type == 199))
{
bool flag10 = true;
for (int num75 = num73 - 1; num75 <= num73 + 1; num75++)
{
for (int num76 = num74 - 1; num76 <= num74 + 1; num76++)
{
if (!WorldGen.SolidTile(num75, num76))
{
flag10 = false;
}
}
}
if (flag10)
{
WorldGen.KillTile(num73, num74, true, false, false);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 0, (float)num73, (float)num74, 1f, 0, 0, 0);
}
}
}
}
}
}
if (this.autoPaint)
{
for (int num77 = 0; num77 < 11; num77++)
{
for (int num78 = 0; num78 < 11; num78++)
{
int num79 = Player.tileTargetX - 5 + num77;
int num80 = Player.tileTargetY - 5 + num78;
if ((Main.tile[num79, num80].active() || array[num77, num78] != -1) && (!Main.tile[num79, num80].active() || array[num77, num78] != (int)Main.tile[num79, num80].type))
{
int num81 = -1;
int num82 = -1;
for (int num83 = 0; num83 < 58; num83++)
{
if (this.inventory[num83].stack > 0 && this.inventory[num83].paint > 0)
{
num81 = (int)this.inventory[num83].paint;
num82 = num83;
break;
}
}
if (num81 > 0 && (int)Main.tile[num79, num80].color() != num81 && WorldGen.paintTile(num79, num80, (byte)num81, true))
{
int num84 = num82;
this.inventory[num84].stack--;
if (this.inventory[num84].stack <= 0)
{
this.inventory[num84].SetDefaults(0, false);
}
this.itemTime = (int)((float)this.inventory[this.selectedItem].useTime * this.tileSpeed);
}
}
}
}
}
}
}
}
}
if (this.inventory[this.selectedItem].createWall >= 0 && this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f >= (float)Player.tileTargetY)
{
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 > 0 || Main.tile[Player.tileTargetX - 1, Player.tileTargetY].active() || Main.tile[Player.tileTargetX - 1, Player.tileTargetY].wall > 0 || Main.tile[Player.tileTargetX, Player.tileTargetY + 1].active() || Main.tile[Player.tileTargetX, Player.tileTargetY + 1].wall > 0 || Main.tile[Player.tileTargetX, Player.tileTargetY - 1].active() || Main.tile[Player.tileTargetX, Player.tileTargetY - 1].wall > 0) && (int)Main.tile[Player.tileTargetX, Player.tileTargetY].wall != this.inventory[this.selectedItem].createWall)
{
if (Main.tile[Player.tileTargetX, Player.tileTargetY].wall != 0 && WorldGen.NearFriendlyWall(Player.tileTargetX, Player.tileTargetY))
{
WorldGen.KillWall(Player.tileTargetX, Player.tileTargetY, false);
if (Main.tile[Player.tileTargetX, Player.tileTargetY].wall == 0 && Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 2, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
}
if (this.inventory[this.selectedItem].consumable)
{
this.inventory[this.selectedItem].stack++;
}
this.itemTime = (int)((float)this.inventory[this.selectedItem].useTime * this.wallSpeed);
return;
}
WorldGen.PlaceWall(Player.tileTargetX, Player.tileTargetY, this.inventory[this.selectedItem].createWall, false);
if ((int)Main.tile[Player.tileTargetX, Player.tileTargetY].wall == this.inventory[this.selectedItem].createWall)
{
this.itemTime = (int)((float)this.inventory[this.selectedItem].useTime * this.wallSpeed);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 3, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)this.inventory[this.selectedItem].createWall, 0, 0, 0);
}
if (this.inventory[this.selectedItem].stack > 1)
{
int createWall = this.inventory[this.selectedItem].createWall;
for (int num85 = 0; num85 < 4; num85++)
{
int num86 = Player.tileTargetX;
int num87 = Player.tileTargetY;
if (num85 == 0)
{
num86--;
}
if (num85 == 1)
{
num86++;
}
if (num85 == 2)
{
num87--;
}
if (num85 == 3)
{
num87++;
}
if (Main.tile[num86, num87].wall == 0)
{
int num88 = 0;
for (int num89 = 0; num89 < 4; num89++)
{
int num90 = num86;
int num91 = num87;
if (num89 == 0)
{
num90--;
}
if (num89 == 1)
{
num90++;
}
if (num89 == 2)
{
num91--;
}
if (num89 == 3)
{
num91++;
}
if ((int)Main.tile[num90, num91].wall == createWall)
{
num88++;
}
}
if (num88 == 4)
{
WorldGen.PlaceWall(num86, num87, createWall, false);
if ((int)Main.tile[num86, num87].wall == createWall)
{
this.inventory[this.selectedItem].stack--;
if (this.inventory[this.selectedItem].stack == 0)
{
this.inventory[this.selectedItem].SetDefaults(0, false);
}
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 3, (float)num86, (float)num87, (float)createWall, 0, 0, 0);
}
if (this.autoPaint)
{
int num92 = num86;
int num93 = num87;
int num94 = -1;
int num95 = -1;
for (int num96 = 0; num96 < 58; num96++)
{
if (this.inventory[num96].stack > 0 && this.inventory[num96].paint > 0)
{
num94 = (int)this.inventory[num96].paint;
num95 = num96;
break;
}
}
if (num94 > 0 && (int)Main.tile[num92, num93].wallColor() != num94 && WorldGen.paintWall(num92, num93, (byte)num94, true))
{
int num97 = num95;
this.inventory[num97].stack--;
if (this.inventory[num97].stack <= 0)
{
this.inventory[num97].SetDefaults(0, false);
}
this.itemTime = (int)((float)this.inventory[this.selectedItem].useTime * this.wallSpeed);
}
}
}
}
}
}
}
if (this.autoPaint)
{
int num98 = Player.tileTargetX;
int num99 = Player.tileTargetY;
int num100 = -1;
int num101 = -1;
for (int num102 = 0; num102 < 58; num102++)
{
if (this.inventory[num102].stack > 0 && this.inventory[num102].paint > 0)
{
num100 = (int)this.inventory[num102].paint;
num101 = num102;
break;
}
}
if (num100 > 0 && (int)Main.tile[num98, num99].wallColor() != num100 && WorldGen.paintWall(num98, num99, (byte)num100, true))
{
int num103 = num101;
this.inventory[num103].stack--;
if (this.inventory[num103].stack <= 0)
{
this.inventory[num103].SetDefaults(0, false);
}
this.itemTime = (int)((float)this.inventory[this.selectedItem].useTime * this.wallSpeed);
}
}
}
}
}
}
private static void ExtractinatorUse(int extractType)
{
int num = 5000;
int num2 = 25;
int num3 = 50;
int num4 = -1;
if (extractType == 1)
{
num /= 3;
num2 *= 2;
num3 /= 2;
num4 = 10;
}
int num5 = 1;
int num6;
if (num4 != -1 && Main.rand.Next(num4) == 0)
{
num6 = 3380;
if (Main.rand.Next(5) == 0)
{
num5 += Main.rand.Next(2);
}
if (Main.rand.Next(10) == 0)
{
num5 += Main.rand.Next(3);
}
if (Main.rand.Next(15) == 0)
{
num5 += Main.rand.Next(4);
}
}
else if (Main.rand.Next(2) == 0)
{
if (Main.rand.Next(12000) == 0)
{
num6 = 74;
if (Main.rand.Next(14) == 0)
{
num5 += Main.rand.Next(0, 2);
}
if (Main.rand.Next(14) == 0)
{
num5 += Main.rand.Next(0, 2);
}
if (Main.rand.Next(14) == 0)
{
num5 += Main.rand.Next(0, 2);
}
}
else if (Main.rand.Next(800) == 0)
{
num6 = 73;
if (Main.rand.Next(6) == 0)
{
num5 += Main.rand.Next(1, 21);
}
if (Main.rand.Next(6) == 0)
{
num5 += Main.rand.Next(1, 21);
}
if (Main.rand.Next(6) == 0)
{
num5 += Main.rand.Next(1, 21);
}
if (Main.rand.Next(6) == 0)
{
num5 += Main.rand.Next(1, 21);
}
if (Main.rand.Next(6) == 0)
{
num5 += Main.rand.Next(1, 20);
}
}
else if (Main.rand.Next(60) == 0)
{
num6 = 72;
if (Main.rand.Next(4) == 0)
{
num5 += Main.rand.Next(5, 26);
}
if (Main.rand.Next(4) == 0)
{
num5 += Main.rand.Next(5, 26);
}
if (Main.rand.Next(4) == 0)
{
num5 += Main.rand.Next(5, 26);
}
if (Main.rand.Next(4) == 0)
{
num5 += Main.rand.Next(5, 25);
}
}
else
{
num6 = 71;
if (Main.rand.Next(3) == 0)
{
num5 += Main.rand.Next(10, 26);
}
if (Main.rand.Next(3) == 0)
{
num5 += Main.rand.Next(10, 26);
}
if (Main.rand.Next(3) == 0)
{
num5 += Main.rand.Next(10, 26);
}
if (Main.rand.Next(3) == 0)
{
num5 += Main.rand.Next(10, 25);
}
}
}
else if (num != -1 && Main.rand.Next(num) == 0)
{
num6 = 1242;
}
else if (num2 != -1 && Main.rand.Next(num2) == 0)
{
num6 = Main.rand.Next(6);
if (num6 == 0)
{
num6 = 181;
}
else if (num6 == 1)
{
num6 = 180;
}
else if (num6 == 2)
{
num6 = 177;
}
else if (num6 == 3)
{
num6 = 179;
}
else if (num6 == 4)
{
num6 = 178;
}
else
{
num6 = 182;
}
if (Main.rand.Next(20) == 0)
{
num5 += Main.rand.Next(0, 2);
}
if (Main.rand.Next(30) == 0)
{
num5 += Main.rand.Next(0, 3);
}
if (Main.rand.Next(40) == 0)
{
num5 += Main.rand.Next(0, 4);
}
if (Main.rand.Next(50) == 0)
{
num5 += Main.rand.Next(0, 5);
}
if (Main.rand.Next(60) == 0)
{
num5 += Main.rand.Next(0, 6);
}
}
else if (num3 != -1 && Main.rand.Next(num3) == 0)
{
num6 = 999;
if (Main.rand.Next(20) == 0)
{
num5 += Main.rand.Next(0, 2);
}
if (Main.rand.Next(30) == 0)
{
num5 += Main.rand.Next(0, 3);
}
if (Main.rand.Next(40) == 0)
{
num5 += Main.rand.Next(0, 4);
}
if (Main.rand.Next(50) == 0)
{
num5 += Main.rand.Next(0, 5);
}
if (Main.rand.Next(60) == 0)
{
num5 += Main.rand.Next(0, 6);
}
}
else if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(5000) == 0)
{
num6 = 74;
if (Main.rand.Next(10) == 0)
{
num5 += Main.rand.Next(0, 3);
}
if (Main.rand.Next(10) == 0)
{
num5 += Main.rand.Next(0, 3);
}
if (Main.rand.Next(10) == 0)
{
num5 += Main.rand.Next(0, 3);
}
if (Main.rand.Next(10) == 0)
{
num5 += Main.rand.Next(0, 3);
}
if (Main.rand.Next(10) == 0)
{
num5 += Main.rand.Next(0, 3);
}
}
else if (Main.rand.Next(400) == 0)
{
num6 = 73;
if (Main.rand.Next(5) == 0)
{
num5 += Main.rand.Next(1, 21);
}
if (Main.rand.Next(5) == 0)
{
num5 += Main.rand.Next(1, 21);
}
if (Main.rand.Next(5) == 0)
{
num5 += Main.rand.Next(1, 21);
}
if (Main.rand.Next(5) == 0)
{
num5 += Main.rand.Next(1, 21);
}
if (Main.rand.Next(5) == 0)
{
num5 += Main.rand.Next(1, 20);
}
}
else if (Main.rand.Next(30) == 0)
{
num6 = 72;
if (Main.rand.Next(3) == 0)
{
num5 += Main.rand.Next(5, 26);
}
if (Main.rand.Next(3) == 0)
{
num5 += Main.rand.Next(5, 26);
}
if (Main.rand.Next(3) == 0)
{
num5 += Main.rand.Next(5, 26);
}
if (Main.rand.Next(3) == 0)
{
num5 += Main.rand.Next(5, 25);
}
}
else
{
num6 = 71;
if (Main.rand.Next(2) == 0)
{
num5 += Main.rand.Next(10, 26);
}
if (Main.rand.Next(2) == 0)
{
num5 += Main.rand.Next(10, 26);
}
if (Main.rand.Next(2) == 0)
{
num5 += Main.rand.Next(10, 26);
}
if (Main.rand.Next(2) == 0)
{
num5 += Main.rand.Next(10, 25);
}
}
}
else
{
num6 = Main.rand.Next(8);
if (num6 == 0)
{
num6 = 12;
}
else if (num6 == 1)
{
num6 = 11;
}
else if (num6 == 2)
{
num6 = 14;
}
else if (num6 == 3)
{
num6 = 13;
}
else if (num6 == 4)
{
num6 = 699;
}
else if (num6 == 5)
{
num6 = 700;
}
else if (num6 == 6)
{
num6 = 701;
}
else
{
num6 = 702;
}
if (Main.rand.Next(20) == 0)
{
num5 += Main.rand.Next(0, 2);
}
if (Main.rand.Next(30) == 0)
{
num5 += Main.rand.Next(0, 3);
}
if (Main.rand.Next(40) == 0)
{
num5 += Main.rand.Next(0, 4);
}
if (Main.rand.Next(50) == 0)
{
num5 += Main.rand.Next(0, 5);
}
if (Main.rand.Next(60) == 0)
{
num5 += Main.rand.Next(0, 6);
}
}
if (num6 > 0)
{
int number = Item.NewItem((int)Main.screenPosition.X + Main.mouseX, (int)Main.screenPosition.Y + Main.mouseY, 1, 1, num6, num5, false, -1, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number, 1f, 0f, 0f, 0, 0, 0);
}
}
}
public void ChangeDir(int dir)
{
if (!this.pulley || this.pulleyDir != 2)
{
this.direction = dir;
return;
}
if (this.pulleyDir == 2 && dir == this.direction)
{
return;
}
int num = (int)(this.position.X + (float)(this.width / 2)) / 16;
int num2 = num * 16 + 8 - this.width / 2;
if (!Collision.SolidCollision(new Vector2((float)num2, this.position.Y), this.width, this.height))
{
if (this.whoAmI == Main.myPlayer)
{
Main.cameraX = Main.cameraX + this.position.X - (float)num2;
}
this.pulleyDir = 1;
this.position.X = (float)num2;
this.direction = dir;
}
}
public Rectangle getRect()
{
return new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height);
}
private void pumpkinSword(int i, int dmg, float kb)
{
int num = Main.rand.Next(100, 300);
int num2 = Main.rand.Next(100, 300);
if (Main.rand.Next(2) == 0)
{
num -= Main.maxScreenW / 2 + num;
}
else
{
num += Main.maxScreenW / 2 - num;
}
if (Main.rand.Next(2) == 0)
{
num2 -= Main.maxScreenH / 2 + num2;
}
else
{
num2 += Main.maxScreenH / 2 - num2;
}
num += (int)this.position.X;
num2 += (int)this.position.Y;
float num3 = 8f;
Vector2 vector = new Vector2((float)num, (float)num2);
float num4 = Main.npc[i].position.X - vector.X;
float num5 = Main.npc[i].position.Y - vector.Y;
float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5));
num6 = num3 / num6;
num4 *= num6;
num5 *= num6;
Projectile.NewProjectile((float)num, (float)num2, num4, num5, 321, dmg, kb, this.whoAmI, (float)i, 0f);
}
public void PutItemInInventory(int type, int selItem = -1)
{
for (int i = 0; i < 58; i++)
{
Item item = this.inventory[i];
if (item.stack > 0 && item.type == type && item.stack < item.maxStack)
{
item.stack++;
return;
}
}
if (selItem >= 0 && (this.inventory[selItem].type == 0 || this.inventory[selItem].stack <= 0))
{
this.inventory[selItem].SetDefaults(type, false);
return;
}
Item item2 = new Item();
item2.SetDefaults(type, false);
Item item3 = this.GetItem(this.whoAmI, item2, false, false);
if (item3.stack > 0)
{
int number = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, type, 1, false, 0, true);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number, 1f, 0f, 0f, 0, 0, 0);
return;
}
}
else
{
item2.position.X = base.Center.X - (float)(item2.width / 2);
item2.position.Y = base.Center.Y - (float)(item2.height / 2);
item2.active = true;
ItemText.NewText(item2, 0, false, false);
}
}
public bool SummonItemCheck()
{
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].active && ((this.inventory[this.selectedItem].type == 43 && Main.npc[i].type == 4) || (this.inventory[this.selectedItem].type == 70 && Main.npc[i].type == 13) || ((this.inventory[this.selectedItem].type == 560 & Main.npc[i].type == 50) || (this.inventory[this.selectedItem].type == 544 && Main.npc[i].type == 125)) || (this.inventory[this.selectedItem].type == 544 && Main.npc[i].type == 126) || (this.inventory[this.selectedItem].type == 556 && Main.npc[i].type == 134) || (this.inventory[this.selectedItem].type == 557 && Main.npc[i].type == 127) || (this.inventory[this.selectedItem].type == 1133 && Main.npc[i].type == 222) || (this.inventory[this.selectedItem].type == 1331 && Main.npc[i].type == 266)))
{
return false;
}
}
return true;
}
public int FishingLevel()
{
int num = 0;
int fishingPole = this.inventory[this.selectedItem].fishingPole;
if (fishingPole == 0)
{
for (int i = 0; i < 58; i++)
{
if (this.inventory[i].fishingPole > fishingPole)
{
fishingPole = this.inventory[i].fishingPole;
}
}
}
int j = 0;
while (j < 58)
{
if (this.inventory[j].stack > 0 && this.inventory[j].bait > 0)
{
if (this.inventory[j].type == 2673)
{
return -1;
}
num = this.inventory[j].bait;
break;
}
else
{
j++;
}
}
if (num == 0 || fishingPole == 0)
{
return 0;
}
int num2 = num + fishingPole + this.fishingSkill;
if (Main.raining)
{
num2 = (int)((float)num2 * 1.2f);
}
if (Main.cloudBGAlpha > 0f)
{
num2 = (int)((float)num2 * 1.1f);
}
if (Main.dayTime && (Main.time < 5400.0 || Main.time > 48600.0))
{
num2 = (int)((float)num2 * 1.3f);
}
if (Main.dayTime && Main.time > 16200.0 && Main.time < 37800.0)
{
num2 = (int)((float)num2 * 0.8f);
}
if (!Main.dayTime && Main.time > 6480.0 && Main.time < 25920.0)
{
num2 = (int)((float)num2 * 0.8f);
}
if (Main.moonPhase == 0)
{
num2 = (int)((float)num2 * 1.1f);
}
if (Main.moonPhase == 1 || Main.moonPhase == 7)
{
num2 = (int)((float)num2 * 1.05f);
}
if (Main.moonPhase == 3 || Main.moonPhase == 5)
{
num2 = (int)((float)num2 * 0.95f);
}
if (Main.moonPhase == 4)
{
num2 = (int)((float)num2 * 0.9f);
}
return num2;
}
public bool HasUnityPotion()
{
for (int i = 0; i < 58; i++)
{
if (this.inventory[i].type == 2997 && this.inventory[i].stack > 0)
{
return true;
}
}
return false;
}
public void TakeUnityPotion()
{
for (int i = 0; i < 400; i++)
{
if (this.inventory[i].type == 2997 && this.inventory[i].stack > 0)
{
this.inventory[i].stack--;
if (this.inventory[i].stack <= 0)
{
this.inventory[i].SetDefaults(0, false);
}
return;
}
}
}
public void UnityTeleport(Vector2 telePos)
{
int num = 3;
if (Main.netMode == 0)
{
this.Teleport(telePos, num, 0);
return;
}
NetMessage.SendData(65, -1, -1, "", 2, (float)this.whoAmI, telePos.X, telePos.Y, num, 0, 0);
}
private void SporeSac()
{
int damage = 70;
float knockBack = 1.5f;
if (Main.rand.Next(15) == 0)
{
int num = 0;
for (int i = 0; i < 1000; i++)
{
if (Main.projectile[i].active && Main.projectile[i].owner == this.whoAmI && (Main.projectile[i].type == 567 || Main.projectile[i].type == 568))
{
num++;
}
}
if (Main.rand.Next(15) >= num && num < 10)
{
int num2 = 50;
int num3 = 24;
int num4 = 90;
for (int j = 0; j < num2; j++)
{
int num5 = Main.rand.Next(200 - j * 2, 400 + j * 2);
Vector2 center = base.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(base.Center.X, this.position.Y), 1, 1, center, 1, 1) || Collision.CanHit(new Vector2(base.Center.X, this.position.Y - 50f), 1, 1, center, 1, 1))
{
int num6 = (int)center.X / 16;
int num7 = (int)center.Y / 16;
bool flag = false;
if (Main.rand.Next(3) == 0 && Main.tile[num6, num7] != null && Main.tile[num6, num7].wall > 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 k = 0; k < 1000; k++)
{
if (Main.projectile[k].active && Main.projectile[k].owner == this.whoAmI && Main.projectile[k].aiStyle == 105 && (center - Main.projectile[k].Center).Length() < 48f)
{
flag = false;
break;
}
}
if (flag)
{
Projectile.NewProjectile(center.X, center.Y, 0f, 0f, 567 + Main.rand.Next(2), damage, knockBack, this.whoAmI, 0f, 0f);
return;
}
}
}
}
}
}
}
}
public void ItemCheck(int i)
{
if (this.webbed || this.frozen || this.stoned)
{
return;
}
bool flag = false;
float num = 5E-06f;
float num2 = (float)this.mount.PlayerOffsetHitbox;
Item item = 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 && this.gravDir == -1f)
{
this.mount.Dismount(this);
}
}
int num3 = item.damage;
if (num3 > 0)
{
if (item.melee)
{
num3 = (int)((float)num3 * this.meleeDamage + num);
}
else if (item.ranged)
{
num3 = (int)((float)num3 * this.rangedDamage + num);
if (item.useAmmo == 1 || item.useAmmo == 323)
{
num3 = (int)((float)num3 * this.arrowDamage + num);
}
if (item.useAmmo == 14 || item.useAmmo == 311)
{
num3 = (int)((float)num3 * this.bulletDamage + num);
}
if (item.useAmmo == 771 || item.useAmmo == 246 || item.useAmmo == 312 || item.useAmmo == 514)
{
num3 = (int)((float)num3 * this.rocketDamage + num);
}
}
else if (item.thrown)
{
num3 = (int)((float)num3 * this.thrownDamage + num);
}
else if (item.magic)
{
num3 = (int)((float)num3 * this.magicDamage + num);
}
}
if (item.autoReuse && !this.noItems)
{
this.releaseUseItem = true;
if (this.itemAnimation == 1 && item.stack > 0)
{
if (item.shoot > 0 && this.whoAmI != Main.myPlayer && this.controlUseItem && item.useStyle == 5)
{
this.ApplyAnimation(item);
if (item.useSound > 0)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, item.useSound);
}
}
else
{
this.itemAnimation = 0;
}
}
}
if (item.fishingPole > 0)
{
item.holdStyle = 0;
if (this.itemTime == 0 && this.itemAnimation == 0)
{
for (int j = 0; j < 1000; j++)
{
if (Main.projectile[j].active && Main.projectile[j].owner == this.whoAmI && Main.projectile[j].bobber)
{
item.holdStyle = 1;
}
}
}
}
if (this.itemAnimation == 0 && this.altFunctionUse == 2)
{
this.altFunctionUse = 0;
}
if (this.itemAnimation == 0 && this.reuseDelay > 0)
{
this.itemAnimation = this.reuseDelay;
this.itemTime = this.reuseDelay;
this.reuseDelay = 0;
}
if (this.controlUseItem && this.releaseUseItem && (item.headSlot > 0 || item.bodySlot > 0 || item.legSlot > 0))
{
if (item.useStyle == 0)
{
this.releaseUseItem = false;
}
if (this.position.X / 16f - (float)Player.tileRangeX - (float)item.tileBoost <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)item.tileBoost - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)item.tileBoost <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)item.tileBoost - 2f >= (float)Player.tileTargetY)
{
int num4 = Player.tileTargetX;
int num5 = Player.tileTargetY;
if (Main.tile[num4, num5].active() && (Main.tile[num4, num5].type == 128 || Main.tile[num4, num5].type == 269))
{
int num6 = (int)Main.tile[num4, num5].frameY;
int k = 0;
if (item.bodySlot >= 0)
{
k = 1;
}
if (item.legSlot >= 0)
{
k = 2;
}
num6 /= 18;
while (k > num6)
{
num5++;
num6 = (int)Main.tile[num4, num5].frameY;
num6 /= 18;
}
while (k < num6)
{
num5--;
num6 = (int)Main.tile[num4, num5].frameY;
num6 /= 18;
}
int l;
for (l = (int)Main.tile[num4, num5].frameX; l >= 100; l -= 100)
{
}
if (l >= 36)
{
l -= 36;
}
num4 -= l / 18;
int m = (int)Main.tile[num4, num5].frameX;
WorldGen.KillTile(num4, num5, true, false, false);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 0, (float)num4, (float)num5, 1f, 0, 0, 0);
}
while (m >= 100)
{
m -= 100;
}
if (num6 == 0 && item.headSlot >= 0)
{
Main.blockMouse = true;
Main.tile[num4, num5].frameX = (short)(m + item.headSlot * 100);
if (Main.netMode == 1)
{
NetMessage.SendTileSquare(-1, num4, num5, 1);
}
item.stack--;
if (item.stack <= 0)
{
item.SetDefaults(0, false);
Main.mouseItem.SetDefaults(0, false);
}
if (this.selectedItem == 58)
{
Main.mouseItem = item.Clone();
}
this.releaseUseItem = false;
this.mouseInterface = true;
}
else if (num6 == 1 && item.bodySlot >= 0)
{
Main.blockMouse = true;
Main.tile[num4, num5].frameX = (short)(m + item.bodySlot * 100);
if (Main.netMode == 1)
{
NetMessage.SendTileSquare(-1, num4, num5, 1);
}
item.stack--;
if (item.stack <= 0)
{
item.SetDefaults(0, false);
Main.mouseItem.SetDefaults(0, false);
}
if (this.selectedItem == 58)
{
Main.mouseItem = item.Clone();
}
this.releaseUseItem = false;
this.mouseInterface = true;
}
else if (num6 == 2 && item.legSlot >= 0)
{
Main.blockMouse = true;
Main.tile[num4, num5].frameX = (short)(m + item.legSlot * 100);
if (Main.netMode == 1)
{
NetMessage.SendTileSquare(-1, num4, num5, 1);
}
item.stack--;
if (item.stack <= 0)
{
item.SetDefaults(0, false);
Main.mouseItem.SetDefaults(0, false);
}
if (this.selectedItem == 58)
{
Main.mouseItem = item.Clone();
}
this.releaseUseItem = false;
this.mouseInterface = true;
}
}
}
}
if (Main.myPlayer == i && this.itemAnimation == 0 && TileObjectData.CustomPlace(item.createTile, item.placeStyle))
{
TileObject tileObject;
TileObject.CanPlace(Player.tileTargetX, Player.tileTargetY, item.createTile, item.placeStyle, this.direction, out tileObject, true);
}
if (this.controlUseItem && this.itemAnimation == 0 && this.releaseUseItem && item.useStyle > 0)
{
if (this.altFunctionUse == 1)
{
this.altFunctionUse = 2;
}
bool flag2 = true;
if (item.shoot == 0)
{
this.itemRotation = 0f;
}
if (item.type == 3335 && (this.extraAccessory || !Main.expertMode))
{
flag2 = false;
}
if (this.pulley && item.fishingPole > 0)
{
flag2 = false;
}
if (this.wet && (item.shoot == 85 || item.shoot == 15 || item.shoot == 34))
{
flag2 = false;
}
if (item.makeNPC > 0 && !NPC.CanReleaseNPCs(this.whoAmI))
{
flag2 = false;
}
if (this.whoAmI == Main.myPlayer && item.type == 603 && !Main.cEd)
{
flag2 = false;
}
if (item.type == 1071 || item.type == 1072)
{
bool flag3 = false;
for (int n = 0; n < 58; n++)
{
if (this.inventory[n].paint > 0)
{
flag3 = true;
break;
}
}
if (!flag3)
{
flag2 = false;
}
}
if (this.noItems)
{
flag2 = false;
}
if (item.tileWand > 0)
{
int tileWand = item.tileWand;
flag2 = false;
for (int num7 = 0; num7 < 58; num7++)
{
if (tileWand == this.inventory[num7].type && this.inventory[num7].stack > 0)
{
flag2 = true;
break;
}
}
}
if (item.fishingPole > 0)
{
for (int num8 = 0; num8 < 1000; num8++)
{
if (Main.projectile[num8].active && Main.projectile[num8].owner == this.whoAmI && Main.projectile[num8].bobber)
{
flag2 = false;
if (this.whoAmI == Main.myPlayer && Main.projectile[num8].ai[0] == 0f)
{
Main.projectile[num8].ai[0] = 1f;
float num9 = -10f;
if (Main.projectile[num8].wet && Main.projectile[num8].velocity.Y > num9)
{
Main.projectile[num8].velocity.Y = num9;
}
Main.projectile[num8].netUpdate2 = true;
if (Main.projectile[num8].ai[1] < 0f && Main.projectile[num8].localAI[1] != 0f)
{
bool flag4 = false;
int num10 = 0;
for (int num11 = 0; num11 < 58; num11++)
{
if (this.inventory[num11].stack > 0 && this.inventory[num11].bait > 0)
{
bool flag5 = false;
int num12 = 1 + this.inventory[num11].bait / 5;
if (num12 < 1)
{
num12 = 1;
}
if (this.accTackleBox)
{
num12++;
}
if (Main.rand.Next(num12) == 0)
{
flag5 = true;
}
if (Main.projectile[num8].localAI[1] < 0f)
{
flag5 = true;
}
if (Main.projectile[num8].localAI[1] > 0f)
{
Item item2 = new Item();
item2.SetDefaults((int)Main.projectile[num8].localAI[1], false);
if (item2.rare < 0)
{
flag5 = false;
}
}
if (flag5)
{
num10 = this.inventory[num11].type;
this.inventory[num11].stack--;
if (this.inventory[num11].stack <= 0)
{
this.inventory[num11].SetDefaults(0, false);
}
}
flag4 = true;
break;
}
}
if (flag4)
{
if (num10 == 2673)
{
if (Main.netMode != 1)
{
NPC.SpawnOnPlayer(this.whoAmI, 370);
}
else
{
NetMessage.SendData(61, -1, -1, "", this.whoAmI, 370f, 0f, 0f, 0, 0, 0);
}
Main.projectile[num8].ai[0] = 2f;
}
else if (Main.rand.Next(7) == 0 && !this.accFishingLine)
{
Main.projectile[num8].ai[0] = 2f;
}
else
{
Main.projectile[num8].ai[1] = Main.projectile[num8].localAI[1];
}
Main.projectile[num8].netUpdate = true;
}
}
}
}
}
}
if (item.shoot == 6 || item.shoot == 19 || item.shoot == 33 || item.shoot == 52 || item.shoot == 113 || item.shoot == 320 || item.shoot == 333 || item.shoot == 383 || item.shoot == 491)
{
for (int num13 = 0; num13 < 1000; num13++)
{
if (Main.projectile[num13].active && Main.projectile[num13].owner == Main.myPlayer && Main.projectile[num13].type == item.shoot)
{
flag2 = false;
}
}
}
if (item.shoot == 106)
{
int num14 = 0;
for (int num15 = 0; num15 < 1000; num15++)
{
if (Main.projectile[num15].active && Main.projectile[num15].owner == Main.myPlayer && Main.projectile[num15].type == item.shoot)
{
num14++;
}
}
if (num14 >= item.stack)
{
flag2 = false;
}
}
if (item.shoot == 272)
{
int num16 = 0;
for (int num17 = 0; num17 < 1000; num17++)
{
if (Main.projectile[num17].active && Main.projectile[num17].owner == Main.myPlayer && Main.projectile[num17].type == item.shoot)
{
num16++;
}
}
if (num16 >= item.stack)
{
flag2 = false;
}
}
if (item.shoot == 13 || item.shoot == 32 || (item.shoot >= 230 && item.shoot <= 235) || item.shoot == 315 || item.shoot == 331 || item.shoot == 372)
{
for (int num18 = 0; num18 < 1000; num18++)
{
if (Main.projectile[num18].active && Main.projectile[num18].owner == Main.myPlayer && Main.projectile[num18].type == item.shoot && Main.projectile[num18].ai[0] != 2f)
{
flag2 = false;
}
}
}
if (item.shoot == 332)
{
int num19 = 0;
for (int num20 = 0; num20 < 1000; num20++)
{
if (Main.projectile[num20].active && Main.projectile[num20].owner == Main.myPlayer && Main.projectile[num20].type == item.shoot && Main.projectile[num20].ai[0] != 2f)
{
num19++;
}
}
if (num19 >= 3)
{
flag2 = false;
}
}
if (item.potion && flag2)
{
if (this.potionDelay <= 0)
{
if (item.type == 227)
{
this.potionDelay = this.restorationDelayTime;
this.AddBuff(21, this.potionDelay, true);
}
else
{
this.potionDelay = this.potionDelayTime;
this.AddBuff(21, this.potionDelay, true);
}
}
else
{
flag2 = false;
}
}
if (item.mana > 0 && this.silence)
{
flag2 = false;
}
if (item.mana > 0 && flag2)
{
bool flag6 = false;
if (item.type == 2795)
{
flag6 = true;
}
if (item.type != 127 || !this.spaceGun)
{
if (this.statMana >= (int)((float)item.mana * this.manaCost))
{
if (!flag6)
{
this.statMana -= (int)((float)item.mana * this.manaCost);
}
}
else if (this.manaFlower)
{
this.QuickMana();
if (this.statMana >= (int)((float)item.mana * this.manaCost))
{
if (!flag6)
{
this.statMana -= (int)((float)item.mana * this.manaCost);
}
}
else
{
flag2 = false;
}
}
else
{
flag2 = false;
}
}
if (this.whoAmI == Main.myPlayer && item.buffType != 0 && flag2)
{
this.AddBuff(item.buffType, item.buffTime, true);
}
}
if (this.whoAmI == Main.myPlayer && item.type == 603 && Main.cEd)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 669)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 115)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 3060)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 3062)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 3577)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 425)
{
int num21 = Main.rand.Next(3);
if (num21 == 0)
{
num21 = 27;
}
if (num21 == 1)
{
num21 = 101;
}
if (num21 == 2)
{
num21 = 102;
}
for (int num22 = 0; num22 < 22; num22++)
{
if (this.buffType[num22] == 27 || this.buffType[num22] == 101 || this.buffType[num22] == 102)
{
this.DelBuff(num22);
num22--;
}
}
this.AddBuff(num21, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 753)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 994)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1169)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1170)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1171)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1172)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1180)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1181)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1182)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1183)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1242)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1157)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1309)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1311)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1837)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1312)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1798)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1799)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1802)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1810)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1927)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 1959)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 2364)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 2365)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 3043)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 2420)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 2535)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 2551)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 2584)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 2587)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 2621)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 2749)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 3249)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 3474)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && item.type == 3531)
{
this.AddBuff(item.buffType, 3600, true);
}
if (this.whoAmI == Main.myPlayer && this.gravDir == 1f && item.mountType != -1 && this.mount.CanMount(item.mountType, this))
{
this.mount.SetMount(item.mountType, this, false);
}
if (item.type == 43 && Main.dayTime)
{
flag2 = false;
}
if (item.type == 544 && Main.dayTime)
{
flag2 = false;
}
if (item.type == 556 && Main.dayTime)
{
flag2 = false;
}
if (item.type == 557 && Main.dayTime)
{
flag2 = false;
}
if (item.type == 70 && !this.ZoneCorrupt)
{
flag2 = false;
}
if (item.type == 1133 && !this.ZoneJungle)
{
flag2 = false;
}
if (item.type == 1844 && (Main.dayTime || Main.pumpkinMoon || Main.snowMoon))
{
flag2 = false;
}
if (item.type == 1958 && (Main.dayTime || Main.pumpkinMoon || Main.snowMoon))
{
flag2 = false;
}
if (!this.SummonItemCheck())
{
flag2 = false;
}
if (item.shoot == 17 && flag2 && i == Main.myPlayer)
{
int num23 = (int)((float)Main.mouseX + Main.screenPosition.X) / 16;
int num24 = (int)((float)Main.mouseY + Main.screenPosition.Y) / 16;
if (this.gravDir == -1f)
{
num24 = (int)(Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16;
}
Tile tile = Main.tile[num23, num24];
if (tile.active() && (tile.type == 0 || tile.type == 2 || tile.type == 23 || tile.type == 109 || tile.type == 199))
{
WorldGen.KillTile(num23, num24, false, false, true);
if (!Main.tile[num23, num24].active())
{
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 4, (float)num23, (float)num24, 0f, 0, 0, 0);
}
}
else
{
flag2 = false;
}
}
else
{
flag2 = false;
}
}
if (flag2)
{
flag2 = this.HasAmmo(item, flag2);
}
if (flag2)
{
if (item.pick > 0 || item.axe > 0 || item.hammer > 0)
{
this.toolTime = 1;
}
if (this.grappling[0] > -1)
{
this.pulley = false;
this.pulleyDir = 1;
if (this.controlRight)
{
this.direction = 1;
}
else if (this.controlLeft)
{
this.direction = -1;
}
}
this.channel = item.channel;
this.attackCD = 0;
this.ApplyAnimation(item);
if (item.useSound > 0)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, item.useSound);
}
}
if (flag2 && this.whoAmI == Main.myPlayer && item.shoot >= 0 && item.shoot < 651 && (ProjectileID.Sets.LightPet[item.shoot] || Main.projPet[item.shoot]))
{
if (ProjectileID.Sets.MinionSacrificable[item.shoot])
{
List<int> list = new List<int>();
float num25 = 0f;
for (int num26 = 0; num26 < 1000; num26++)
{
if (Main.projectile[num26].active && Main.projectile[num26].owner == i && Main.projectile[num26].minion)
{
int num27;
for (num27 = 0; num27 < list.Count; num27++)
{
if (Main.projectile[list[num27]].minionSlots > Main.projectile[num26].minionSlots)
{
list.Insert(num27, num26);
break;
}
}
if (num27 == list.Count)
{
list.Add(num26);
}
num25 += Main.projectile[num26].minionSlots;
}
}
float num28 = (float)ItemID.Sets.StaffMinionSlotsRequired[item.type];
float num29 = 0f;
int num30 = 388;
int num31 = -1;
for (int num32 = 0; num32 < list.Count; num32++)
{
int type = Main.projectile[list[num32]].type;
if (type == 626)
{
list.RemoveAt(num32);
num32--;
}
if (type == 627)
{
if (Main.projectile[(int)Main.projectile[list[num32]].localAI[1]].type == 628)
{
num31 = list[num32];
}
list.RemoveAt(num32);
num32--;
}
}
if (num31 != -1)
{
list.Add(num31);
list.Add((int)Main.projectile[num31].ai[0]);
}
int num33 = 0;
while (num33 < list.Count && num25 - num29 > (float)this.maxMinions - num28)
{
int type2 = Main.projectile[list[num33]].type;
if (type2 != num30 && type2 != 625 && type2 != 628)
{
if (type2 == 388 && num30 == 387)
{
num30 = 388;
}
if (type2 == 387 && num30 == 388)
{
num30 = 387;
}
num29 += Main.projectile[list[num33]].minionSlots;
if (type2 == 626 || type2 == 627)
{
Projectile projectile = Main.projectile[(int)Main.projectile[list[num33]].ai[0]];
if (projectile.type != 625)
{
projectile.localAI[1] = Main.projectile[list[num33]].localAI[1];
}
projectile = Main.projectile[(int)Main.projectile[list[num33]].localAI[1]];
projectile.ai[0] = Main.projectile[list[num33]].ai[0];
projectile.ai[1] = 1f;
projectile.netUpdate = true;
}
Main.projectile[list[num33]].Kill();
}
num33++;
}
list.Clear();
if (num25 + num28 >= 9f)
{
AchievementsHelper.HandleSpecialEvent(this, 6);
}
}
else
{
for (int num34 = 0; num34 < 1000; num34++)
{
if (Main.projectile[num34].active && Main.projectile[num34].owner == i && Main.projectile[num34].type == item.shoot)
{
Main.projectile[num34].Kill();
}
if (item.shoot == 72)
{
if (Main.projectile[num34].active && Main.projectile[num34].owner == i && Main.projectile[num34].type == 86)
{
Main.projectile[num34].Kill();
}
if (Main.projectile[num34].active && Main.projectile[num34].owner == i && Main.projectile[num34].type == 87)
{
Main.projectile[num34].Kill();
}
}
}
}
}
}
if (!this.controlUseItem)
{
bool arg_1F96_0 = this.channel;
this.channel = false;
}
if (this.itemAnimation > 0)
{
if (item.melee)
{
this.itemAnimationMax = (int)((float)item.useAnimation * this.meleeSpeed);
}
else
{
this.itemAnimationMax = item.useAnimation;
}
if (item.mana > 0 && !flag && (item.type != 127 || !this.spaceGun))
{
this.manaRegenDelay = (int)this.maxRegenDelay;
}
if (Main.dedServ)
{
this.itemHeight = item.height;
this.itemWidth = item.width;
}
else
{
this.itemHeight = Main.itemTexture[item.type].Height;
this.itemWidth = Main.itemTexture[item.type].Width;
}
this.itemAnimation--;
if (!Main.dedServ)
{
if (item.useStyle == 1)
{
if (item.type > -1 && Item.claw[item.type])
{
if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.333)
{
float num35 = 10f;
this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - num35) * (float)this.direction;
this.itemLocation.Y = this.position.Y + 26f + num2;
}
else if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.666)
{
float num36 = 8f;
this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - num36) * (float)this.direction;
num36 = 24f;
this.itemLocation.Y = this.position.Y + num36 + num2;
}
else
{
float num37 = 6f;
this.itemLocation.X = this.position.X + (float)this.width * 0.5f - ((float)Main.itemTexture[item.type].Width * 0.5f - num37) * (float)this.direction;
num37 = 20f;
this.itemLocation.Y = this.position.Y + num37 + num2;
}
this.itemRotation = ((float)this.itemAnimation / (float)this.itemAnimationMax - 0.5f) * (float)(-(float)this.direction) * 3.5f - (float)this.direction * 0.3f;
}
else
{
if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.333)
{
float num38 = 10f;
if (Main.itemTexture[item.type].Width > 32)
{
num38 = 14f;
}
if (Main.itemTexture[item.type].Width >= 52)
{
num38 = 24f;
}
if (Main.itemTexture[item.type].Width >= 64)
{
num38 = 28f;
}
if (Main.itemTexture[item.type].Width >= 92)
{
num38 = 38f;
}
if (item.type == 2330 || item.type == 2320 || item.type == 2341)
{
num38 += 8f;
}
this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - num38) * (float)this.direction;
this.itemLocation.Y = this.position.Y + 24f + num2;
}
else if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.666)
{
float num39 = 10f;
if (Main.itemTexture[item.type].Width > 32)
{
num39 = 18f;
}
if (Main.itemTexture[item.type].Width >= 52)
{
num39 = 24f;
}
if (Main.itemTexture[item.type].Width >= 64)
{
num39 = 28f;
}
if (Main.itemTexture[item.type].Width >= 92)
{
num39 = 38f;
}
if (item.type == 2330 || item.type == 2320 || item.type == 2341)
{
num39 += 4f;
}
this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - num39) * (float)this.direction;
num39 = 10f;
if (Main.itemTexture[item.type].Height > 32)
{
num39 = 8f;
}
if (Main.itemTexture[item.type].Height > 52)
{
num39 = 12f;
}
if (Main.itemTexture[item.type].Height > 64)
{
num39 = 14f;
}
if (item.type == 2330 || item.type == 2320 || item.type == 2341)
{
num39 += 4f;
}
this.itemLocation.Y = this.position.Y + num39 + num2;
}
else
{
float num40 = 6f;
if (Main.itemTexture[item.type].Width > 32)
{
num40 = 14f;
}
if (Main.itemTexture[item.type].Width >= 48)
{
num40 = 18f;
}
if (Main.itemTexture[item.type].Width >= 52)
{
num40 = 24f;
}
if (Main.itemTexture[item.type].Width >= 64)
{
num40 = 28f;
}
if (Main.itemTexture[item.type].Width >= 92)
{
num40 = 38f;
}
if (item.type == 2330 || item.type == 2320 || item.type == 2341)
{
num40 += 4f;
}
this.itemLocation.X = this.position.X + (float)this.width * 0.5f - ((float)Main.itemTexture[item.type].Width * 0.5f - num40) * (float)this.direction;
num40 = 10f;
if (Main.itemTexture[item.type].Height > 32)
{
num40 = 10f;
}
if (Main.itemTexture[item.type].Height > 52)
{
num40 = 12f;
}
if (Main.itemTexture[item.type].Height > 64)
{
num40 = 14f;
}
if (item.type == 2330 || item.type == 2320 || item.type == 2341)
{
num40 += 4f;
}
this.itemLocation.Y = this.position.Y + num40 + num2;
}
this.itemRotation = ((float)this.itemAnimation / (float)this.itemAnimationMax - 0.5f) * (float)(-(float)this.direction) * 3.5f - (float)this.direction * 0.3f;
}
if (this.gravDir == -1f)
{
this.itemRotation = -this.itemRotation;
this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y);
}
}
else if (item.useStyle == 2)
{
this.itemRotation = (float)this.itemAnimation / (float)this.itemAnimationMax * (float)this.direction * 2f + -1.4f * (float)this.direction;
if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.5)
{
this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - 9f - this.itemRotation * 12f * (float)this.direction) * (float)this.direction;
this.itemLocation.Y = this.position.Y + 38f + this.itemRotation * (float)this.direction * 4f + num2;
}
else
{
this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - 9f - this.itemRotation * 16f * (float)this.direction) * (float)this.direction;
this.itemLocation.Y = this.position.Y + 38f + this.itemRotation * (float)this.direction + num2;
}
if (this.gravDir == -1f)
{
this.itemRotation = -this.itemRotation;
this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y);
}
}
else if (item.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 = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - 4f) * (float)this.direction;
this.itemLocation.Y = this.position.Y + 24f + num2;
float num41 = (float)this.itemAnimation / (float)this.itemAnimationMax * (float)Main.itemTexture[item.type].Width * (float)this.direction * item.scale * 1.2f - (float)(10 * this.direction);
if (num41 > -4f && this.direction == -1)
{
num41 = -8f;
}
if (num41 < 4f && this.direction == 1)
{
num41 = 8f;
}
this.itemLocation.X = this.itemLocation.X - num41;
this.itemRotation = 0.8f * (float)this.direction;
}
if (this.gravDir == -1f)
{
this.itemRotation = -this.itemRotation;
this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y);
}
}
else if (item.useStyle == 4)
{
this.itemRotation = 0f;
this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - 9f - this.itemRotation * 14f * (float)this.direction - 4f) * (float)this.direction;
this.itemLocation.Y = this.position.Y + (float)Main.itemTexture[item.type].Height * 0.5f + 4f + num2;
if (this.gravDir == -1f)
{
this.itemRotation = -this.itemRotation;
this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y);
}
}
else if (item.useStyle == 5)
{
if (Item.staff[item.type])
{
float scaleFactor = 6f;
if (item.type == 3476)
{
scaleFactor = 14f;
}
this.itemLocation = this.MountedCenter;
this.itemLocation += this.itemRotation.ToRotationVector2() * scaleFactor * (float)this.direction;
}
else
{
this.itemLocation.X = this.position.X + (float)this.width * 0.5f - (float)Main.itemTexture[item.type].Width * 0.5f - (float)(this.direction * 2);
this.itemLocation.Y = this.MountedCenter.Y - (float)Main.itemTexture[item.type].Height * 0.5f;
}
}
}
}
else if (item.holdStyle == 1 && !this.pulley)
{
if (Main.dedServ)
{
this.itemLocation.X = this.position.X + (float)this.width * 0.5f + 20f * (float)this.direction;
}
else if (item.type == 930)
{
this.itemLocation.X = this.position.X + (float)(this.width / 2) * 0.5f - 12f - (float)(2 * this.direction);
float num42 = this.position.X + (float)(this.width / 2) + (float)(38 * this.direction);
if (this.direction == 1)
{
num42 -= 10f;
}
float num43 = this.MountedCenter.Y - 4f * this.gravDir;
if (this.gravDir == -1f)
{
num43 -= 8f;
}
this.RotateRelativePoint(ref num42, ref num43);
int num44 = 0;
for (int num45 = 54; num45 < 58; num45++)
{
if (this.inventory[num45].stack > 0 && this.inventory[num45].ammo == 931)
{
num44 = this.inventory[num45].type;
break;
}
}
if (num44 == 0)
{
for (int num46 = 0; num46 < 54; num46++)
{
if (this.inventory[num46].stack > 0 && this.inventory[num46].ammo == 931)
{
num44 = this.inventory[num46].type;
break;
}
}
}
if (num44 == 931)
{
num44 = 127;
}
else if (num44 == 1614)
{
num44 = 187;
}
if (num44 > 0)
{
int num47 = Dust.NewDust(new Vector2(num42, num43 + this.gfxOffY), 6, 6, num44, 0f, 0f, 100, default(Color), 1.6f);
Main.dust[num47].noGravity = true;
Dust expr_2F33_cp_0 = Main.dust[num47];
expr_2F33_cp_0.velocity.Y = expr_2F33_cp_0.velocity.Y - 4f * this.gravDir;
}
}
else if (item.type == 968)
{
this.itemLocation.X = this.position.X + (float)this.width * 0.5f + (float)(8 * this.direction);
if (this.whoAmI == Main.myPlayer)
{
int num48 = (int)(this.itemLocation.X + (float)Main.itemTexture[item.type].Width * 0.8f * (float)this.direction) / 16;
int num49 = (int)(this.itemLocation.Y + num2 + (float)(Main.itemTexture[item.type].Height / 2)) / 16;
if (Main.tile[num48, num49] == null)
{
Main.tile[num48, num49] = new Tile();
}
if (Main.tile[num48, num49].active() && Main.tile[num48, num49].type == 215 && Main.tile[num48, num49].frameY < 54)
{
this.miscTimer++;
if (Main.rand.Next(5) == 0)
{
this.miscTimer++;
}
if (this.miscTimer > 900)
{
this.miscTimer = 0;
item.SetDefaults(969, false);
if (this.selectedItem == 58)
{
Main.mouseItem.SetDefaults(969, false);
}
for (int num50 = 0; num50 < 58; num50++)
{
if (this.inventory[num50].type == item.type && num50 != this.selectedItem && this.inventory[num50].stack < this.inventory[num50].maxStack)
{
Main.PlaySound(7, -1, -1, 1);
this.inventory[num50].stack++;
item.SetDefaults(0, false);
if (this.selectedItem == 58)
{
Main.mouseItem.SetDefaults(0, false);
}
}
}
}
}
else
{
this.miscTimer = 0;
}
}
}
else if (item.type == 856)
{
this.itemLocation.X = this.position.X + (float)this.width * 0.5f + (float)(4 * this.direction);
}
else if (item.fishingPole > 0)
{
this.itemLocation.X = this.position.X + (float)this.width * 0.5f + (float)Main.itemTexture[item.type].Width * 0.18f * (float)this.direction;
}
else
{
this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f + 2f) * (float)this.direction;
if (item.type == 282 || item.type == 286 || item.type == 3112)
{
this.itemLocation.X = this.itemLocation.X - (float)(this.direction * 2);
this.itemLocation.Y = this.itemLocation.Y + 4f;
}
else if (item.type == 3002)
{
this.itemLocation.X = this.itemLocation.X - (float)(4 * this.direction);
this.itemLocation.Y = this.itemLocation.Y + 2f;
}
}
this.itemLocation.Y = this.position.Y + 24f + num2;
if (item.type == 856)
{
this.itemLocation.Y = this.position.Y + 34f + num2;
}
if (item.type == 930)
{
this.itemLocation.Y = this.position.Y + 9f + num2;
}
if (item.fishingPole > 0)
{
this.itemLocation.Y = this.itemLocation.Y + 4f;
}
else if (item.type == 3476)
{
this.itemLocation.X = base.Center.X + (float)(14 * this.direction);
this.itemLocation.Y = this.MountedCenter.Y;
}
this.itemRotation = 0f;
if (this.gravDir == -1f)
{
this.itemRotation = -this.itemRotation;
this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y) + num2;
if (item.type == 930)
{
this.itemLocation.Y = this.itemLocation.Y - 24f;
}
}
}
else if (item.holdStyle == 2 && !this.pulley)
{
if (item.type == 946)
{
this.itemRotation = 0f;
this.itemLocation.X = this.position.X + (float)this.width * 0.5f - (float)(16 * this.direction);
this.itemLocation.Y = this.position.Y + 22f + num2;
this.fallStart = (int)(this.position.Y / 16f);
if (this.gravDir == -1f)
{
this.itemRotation = -this.itemRotation;
this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y);
if (this.velocity.Y < -2f)
{
this.velocity.Y = -2f;
}
}
else if (this.velocity.Y > 2f)
{
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 + num2;
this.itemRotation = 0.79f * (float)(-(float)this.direction);
if (this.gravDir == -1f)
{
this.itemRotation = -this.itemRotation;
this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y);
}
}
}
else if (item.holdStyle == 3 && !this.pulley && !Main.dedServ)
{
this.itemLocation.X = this.position.X + (float)this.width * 0.5f - (float)Main.itemTexture[item.type].Width * 0.5f - (float)(this.direction * 2);
this.itemLocation.Y = this.MountedCenter.Y - (float)Main.itemTexture[item.type].Height * 0.5f;
this.itemRotation = 0f;
}
if ((((item.type == 974 || item.type == 8 || item.type == 1245 || item.type == 2274 || item.type == 3004 || item.type == 3045 || item.type == 3114 || (item.type >= 427 && item.type <= 433)) && !this.wet) || item.type == 523 || item.type == 1333) && !this.pulley)
{
float num51 = 1f;
float num52 = 0.95f;
float num53 = 0.8f;
int num54 = 0;
if (item.type == 523)
{
num54 = 8;
}
else if (item.type == 974)
{
num54 = 9;
}
else if (item.type == 1245)
{
num54 = 10;
}
else if (item.type == 1333)
{
num54 = 11;
}
else if (item.type == 2274)
{
num54 = 12;
}
else if (item.type == 3004)
{
num54 = 13;
}
else if (item.type == 3045)
{
num54 = 14;
}
else if (item.type == 3114)
{
num54 = 15;
}
else if (item.type >= 427)
{
num54 = item.type - 426;
}
if (num54 == 1)
{
num51 = 0f;
num52 = 0.1f;
num53 = 1.3f;
}
else if (num54 == 2)
{
num51 = 1f;
num52 = 0.1f;
num53 = 0.1f;
}
else if (num54 == 3)
{
num51 = 0f;
num52 = 1f;
num53 = 0.1f;
}
else if (num54 == 4)
{
num51 = 0.9f;
num52 = 0f;
num53 = 0.9f;
}
else if (num54 == 5)
{
num51 = 1.3f;
num52 = 1.3f;
num53 = 1.3f;
}
else if (num54 == 6)
{
num51 = 0.9f;
num52 = 0.9f;
num53 = 0f;
}
else if (num54 == 7)
{
num51 = 0.5f * Main.demonTorch + 1f * (1f - Main.demonTorch);
num52 = 0.3f;
num53 = 1f * Main.demonTorch + 0.5f * (1f - Main.demonTorch);
}
else if (num54 == 8)
{
num53 = 0.7f;
num51 = 0.85f;
num52 = 1f;
}
else if (num54 == 9)
{
num53 = 1f;
num51 = 0.7f;
num52 = 0.85f;
}
else if (num54 == 10)
{
num53 = 0f;
num51 = 1f;
num52 = 0.5f;
}
else if (num54 == 11)
{
num53 = 0.8f;
num51 = 1.25f;
num52 = 1.25f;
}
else if (num54 == 12)
{
num51 *= 0.75f;
num52 *= 1.3499999f;
num53 *= 1.5f;
}
else if (num54 == 13)
{
num51 = 0.95f;
num52 = 0.65f;
num53 = 1.3f;
}
else if (num54 == 14)
{
num51 = (float)Main.DiscoR / 255f;
num52 = (float)Main.DiscoG / 255f;
num53 = (float)Main.DiscoB / 255f;
}
else if (num54 == 15)
{
num51 = 1f;
num52 = 0f;
num53 = 1f;
}
int num55 = num54;
if (num55 == 0)
{
num55 = 6;
}
else if (num55 == 8)
{
num55 = 75;
}
else if (num55 == 9)
{
num55 = 135;
}
else if (num55 == 10)
{
num55 = 158;
}
else if (num55 == 11)
{
num55 = 169;
}
else if (num55 == 12)
{
num55 = 156;
}
else if (num55 == 13)
{
num55 = 234;
}
else if (num55 == 14)
{
num55 = 66;
}
else if (num55 == 15)
{
num55 = 242;
}
else
{
num55 = 58 + num55;
}
int maxValue = 30;
if (this.itemAnimation > 0)
{
maxValue = 7;
}
if (this.direction == -1)
{
if (Main.rand.Next(maxValue) == 0)
{
int num56 = Dust.NewDust(new Vector2(this.itemLocation.X - 16f, this.itemLocation.Y - 14f * this.gravDir), 4, 4, num55, 0f, 0f, 100, default(Color), 1f);
if (Main.rand.Next(3) != 0)
{
Main.dust[num56].noGravity = true;
}
Main.dust[num56].velocity *= 0.3f;
Dust expr_3BBE_cp_0 = Main.dust[num56];
expr_3BBE_cp_0.velocity.Y = expr_3BBE_cp_0.velocity.Y - 1.5f;
Main.dust[num56].position = this.RotatedRelativePoint(Main.dust[num56].position, true);
if (num55 == 66)
{
Main.dust[num56].color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB);
Main.dust[num56].noGravity = true;
}
}
Vector2 position = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 12f + this.velocity.X, this.itemLocation.Y - 14f + this.velocity.Y), true);
Lighting.AddLight(position, num51, num52, num53);
}
else
{
if (Main.rand.Next(maxValue) == 0)
{
int num57 = Dust.NewDust(new Vector2(this.itemLocation.X + 6f, this.itemLocation.Y - 14f * this.gravDir), 4, 4, num55, 0f, 0f, 100, default(Color), 1f);
if (Main.rand.Next(3) != 0)
{
Main.dust[num57].noGravity = true;
}
Main.dust[num57].velocity *= 0.3f;
Dust expr_3D2D_cp_0 = Main.dust[num57];
expr_3D2D_cp_0.velocity.Y = expr_3D2D_cp_0.velocity.Y - 1.5f;
Main.dust[num57].position = this.RotatedRelativePoint(Main.dust[num57].position, true);
if (num55 == 66)
{
Main.dust[num57].color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB);
Main.dust[num57].noGravity = true;
}
}
Vector2 position2 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 12f + this.velocity.X, this.itemLocation.Y - 14f + this.velocity.Y), true);
Lighting.AddLight(position2, num51, num52, num53);
}
}
if ((item.type == 105 || item.type == 713) && !this.wet && !this.pulley)
{
int maxValue2 = 20;
if (this.itemAnimation > 0)
{
maxValue2 = 7;
}
if (this.direction == -1)
{
if (Main.rand.Next(maxValue2) == 0)
{
int num58 = Dust.NewDust(new Vector2(this.itemLocation.X - 12f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 6, 0f, 0f, 100, default(Color), 1f);
if (Main.rand.Next(3) != 0)
{
Main.dust[num58].noGravity = true;
}
Main.dust[num58].velocity *= 0.3f;
Dust expr_3EE2_cp_0 = Main.dust[num58];
expr_3EE2_cp_0.velocity.Y = expr_3EE2_cp_0.velocity.Y - 1.5f;
Main.dust[num58].position = this.RotatedRelativePoint(Main.dust[num58].position, true);
}
Vector2 position3 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true);
Lighting.AddLight(position3, 1f, 0.95f, 0.8f);
}
else
{
if (Main.rand.Next(maxValue2) == 0)
{
int num59 = Dust.NewDust(new Vector2(this.itemLocation.X + 4f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 6, 0f, 0f, 100, default(Color), 1f);
if (Main.rand.Next(3) != 0)
{
Main.dust[num59].noGravity = true;
}
Main.dust[num59].velocity *= 0.3f;
Dust expr_4018_cp_0 = Main.dust[num59];
expr_4018_cp_0.velocity.Y = expr_4018_cp_0.velocity.Y - 1.5f;
Main.dust[num59].position = this.RotatedRelativePoint(Main.dust[num59].position, true);
}
Vector2 position4 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true);
Lighting.AddLight(position4, 1f, 0.95f, 0.8f);
}
}
else if (item.type == 148 && !this.wet)
{
int maxValue3 = 10;
if (this.itemAnimation > 0)
{
maxValue3 = 7;
}
if (this.direction == -1)
{
if (Main.rand.Next(maxValue3) == 0)
{
int num60 = Dust.NewDust(new Vector2(this.itemLocation.X - 12f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 172, 0f, 0f, 100, default(Color), 1f);
if (Main.rand.Next(3) != 0)
{
Main.dust[num60].noGravity = true;
}
Main.dust[num60].velocity *= 0.3f;
Dust expr_4189_cp_0 = Main.dust[num60];
expr_4189_cp_0.velocity.Y = expr_4189_cp_0.velocity.Y - 1.5f;
Main.dust[num60].position = this.RotatedRelativePoint(Main.dust[num60].position, true);
}
Vector2 position5 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true);
Lighting.AddLight(position5, 0f, 0.5f, 1f);
}
else
{
if (Main.rand.Next(maxValue3) == 0)
{
int num61 = Dust.NewDust(new Vector2(this.itemLocation.X + 4f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 172, 0f, 0f, 100, default(Color), 1f);
if (Main.rand.Next(3) != 0)
{
Main.dust[num61].noGravity = true;
}
Main.dust[num61].velocity *= 0.3f;
Dust expr_42C3_cp_0 = Main.dust[num61];
expr_42C3_cp_0.velocity.Y = expr_42C3_cp_0.velocity.Y - 1.5f;
Main.dust[num61].position = this.RotatedRelativePoint(Main.dust[num61].position, true);
}
Vector2 position6 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true);
Lighting.AddLight(position6, 0f, 0.5f, 1f);
}
}
else if (item.type == 3117 && !this.wet)
{
this.itemLocation.X = this.itemLocation.X - (float)(this.direction * 4);
int maxValue4 = 10;
if (this.itemAnimation > 0)
{
maxValue4 = 7;
}
if (this.direction == -1)
{
if (Main.rand.Next(maxValue4) == 0)
{
int num62 = Dust.NewDust(new Vector2(this.itemLocation.X - 10f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 242, 0f, 0f, 100, default(Color), 1f);
if (Main.rand.Next(3) != 0)
{
Main.dust[num62].noGravity = true;
}
Main.dust[num62].velocity *= 0.3f;
Dust expr_444F_cp_0 = Main.dust[num62];
expr_444F_cp_0.velocity.Y = expr_444F_cp_0.velocity.Y - 1.5f;
Main.dust[num62].position = this.RotatedRelativePoint(Main.dust[num62].position, true);
}
Vector2 position7 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true);
Lighting.AddLight(position7, 0.9f, 0.1f, 0.75f);
}
else
{
if (Main.rand.Next(maxValue4) == 0)
{
int num63 = Dust.NewDust(new Vector2(this.itemLocation.X + 6f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 242, 0f, 0f, 100, default(Color), 1f);
if (Main.rand.Next(3) != 0)
{
Main.dust[num63].noGravity = true;
}
Main.dust[num63].velocity *= 0.3f;
Dust expr_4589_cp_0 = Main.dust[num63];
expr_4589_cp_0.velocity.Y = expr_4589_cp_0.velocity.Y - 1.5f;
Main.dust[num63].position = this.RotatedRelativePoint(Main.dust[num63].position, true);
}
Vector2 position8 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true);
Lighting.AddLight(position8, 0.9f, 0.1f, 0.75f);
}
}
if (item.type == 282 && !this.pulley)
{
if (this.direction == -1)
{
Vector2 position9 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true);
Lighting.AddLight(position9, 0.7f, 1f, 0.8f);
}
else
{
Vector2 position10 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true);
Lighting.AddLight(position10, 0.7f, 1f, 0.8f);
}
}
if (item.type == 3002 && !this.pulley)
{
float r = 1.05f;
float g = 0.95f;
float b = 0.55f;
if (this.direction == -1)
{
Vector2 position11 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true);
Lighting.AddLight(position11, r, g, b);
}
else
{
Vector2 position12 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true);
Lighting.AddLight(position12, r, g, b);
}
this.spelunkerTimer += 1;
if (this.spelunkerTimer >= 10)
{
this.spelunkerTimer = 0;
int num64 = 30;
int num65 = (int)base.Center.X / 16;
int num66 = (int)base.Center.Y / 16;
for (int num67 = num65 - num64; num67 <= num65 + num64; num67++)
{
for (int num68 = num66 - num64; num68 <= num66 + num64; num68++)
{
if (Main.rand.Next(4) == 0)
{
Vector2 vector = new Vector2((float)(num65 - num67), (float)(num66 - num68));
if (vector.Length() < (float)num64 && num67 > 0 && num67 < Main.maxTilesX - 1 && num68 > 0 && num68 < Main.maxTilesY - 1 && Main.tile[num67, num68] != null && Main.tile[num67, num68].active())
{
bool flag7 = false;
if (Main.tile[num67, num68].type == 185 && Main.tile[num67, num68].frameY == 18)
{
if (Main.tile[num67, num68].frameX >= 576 && Main.tile[num67, num68].frameX <= 882)
{
flag7 = true;
}
}
else if (Main.tile[num67, num68].type == 186 && Main.tile[num67, num68].frameX >= 864 && Main.tile[num67, num68].frameX <= 1170)
{
flag7 = true;
}
if (flag7 || Main.tileSpelunker[(int)Main.tile[num67, num68].type] || (Main.tileAlch[(int)Main.tile[num67, num68].type] && Main.tile[num67, num68].type != 82))
{
int num69 = Dust.NewDust(new Vector2((float)(num67 * 16), (float)(num68 * 16)), 16, 16, 204, 0f, 0f, 150, default(Color), 0.3f);
Main.dust[num69].fadeIn = 0.75f;
Main.dust[num69].velocity *= 0.1f;
Main.dust[num69].noLight = true;
}
}
}
}
}
}
}
if (item.type == 286 && !this.pulley)
{
if (this.direction == -1)
{
Vector2 position13 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true);
Lighting.AddLight(position13, 0.7f, 0.8f, 1f);
}
else
{
Vector2 position14 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true);
Lighting.AddLight(position14, 0.7f, 0.8f, 1f);
}
}
if (item.type == 3112 && !this.pulley)
{
if (this.direction == -1)
{
Vector2 position15 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true);
Lighting.AddLight(position15, 1f, 0.6f, 0.85f);
}
else
{
Vector2 position16 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true);
Lighting.AddLight(position16, 1f, 0.6f, 0.85f);
}
}
if (this.controlUseItem)
{
this.releaseUseItem = false;
}
else
{
this.releaseUseItem = true;
}
if (this.itemTime > 0)
{
this.itemTime--;
if (this.itemTime == 0 && this.whoAmI == Main.myPlayer)
{
int type3 = item.type;
if (type3 == 65 || type3 == 676 || type3 == 723 || type3 == 724 || type3 == 989 || type3 == 1226 || type3 == 1227)
{
Main.PlaySound(25, -1, -1, 1);
for (int num70 = 0; num70 < 5; num70++)
{
int num71 = Dust.NewDust(this.position, this.width, this.height, 45, 0f, 0f, 255, default(Color), (float)Main.rand.Next(20, 26) * 0.1f);
Main.dust[num71].noLight = true;
Main.dust[num71].noGravity = true;
Main.dust[num71].velocity *= 0.5f;
}
}
}
}
if (i == Main.myPlayer)
{
bool flag8 = true;
int type4 = item.type;
if ((type4 == 65 || type4 == 676 || type4 == 723 || type4 == 724 || type4 == 757 || type4 == 674 || type4 == 675 || type4 == 989 || type4 == 1226 || type4 == 1227) && this.itemAnimation != this.itemAnimationMax - 1)
{
flag8 = false;
}
if (item.shoot > 0 && this.itemAnimation > 0 && this.itemTime == 0 && flag8)
{
int num72 = item.shoot;
float num73 = item.shootSpeed;
if (this.inventory[this.selectedItem].thrown && num73 < 16f)
{
num73 *= this.thrownVelocity;
if (num73 > 16f)
{
num73 = 16f;
}
}
if (item.melee && num72 != 25 && num72 != 26 && num72 != 35)
{
num73 /= this.meleeSpeed;
}
bool flag9 = false;
int num74 = num3;
float num75 = item.knockBack;
if (num72 == 13 || num72 == 32 || num72 == 315 || (num72 >= 230 && num72 <= 235) || num72 == 331)
{
this.grappling[0] = -1;
this.grapCount = 0;
for (int num76 = 0; num76 < 1000; num76++)
{
if (Main.projectile[num76].active && Main.projectile[num76].owner == i)
{
if (Main.projectile[num76].type == 13)
{
Main.projectile[num76].Kill();
}
if (Main.projectile[num76].type == 331)
{
Main.projectile[num76].Kill();
}
if (Main.projectile[num76].type == 315)
{
Main.projectile[num76].Kill();
}
if (Main.projectile[num76].type >= 230 && Main.projectile[num76].type <= 235)
{
Main.projectile[num76].Kill();
}
}
}
}
if (item.useAmmo > 0)
{
this.PickAmmo(item, ref num72, ref num73, ref flag9, ref num74, ref num75, ItemID.Sets.gunProj[item.type]);
}
else
{
flag9 = true;
}
if (item.type == 3475 || item.type == 3540)
{
num75 = item.knockBack;
num74 = num3;
num73 = item.shootSpeed;
}
if (item.type == 71)
{
flag9 = false;
}
if (item.type == 72)
{
flag9 = false;
}
if (item.type == 73)
{
flag9 = false;
}
if (item.type == 74)
{
flag9 = false;
}
if (item.type == 1254 && num72 == 14)
{
num72 = 242;
}
if (item.type == 1255 && num72 == 14)
{
num72 = 242;
}
if (item.type == 1265 && num72 == 14)
{
num72 = 242;
}
if (item.type == 3542)
{
bool flag10 = Main.rand.Next(100) < 20;
if (flag10)
{
num72++;
num74 *= 3;
}
else
{
num73 -= 1f;
}
}
if (num72 == 73)
{
for (int num77 = 0; num77 < 1000; num77++)
{
if (Main.projectile[num77].active && Main.projectile[num77].owner == i)
{
if (Main.projectile[num77].type == 73)
{
num72 = 74;
}
if (num72 == 74 && Main.projectile[num77].type == 74)
{
flag9 = false;
}
}
}
}
if (flag9)
{
if (item.summon)
{
num75 += this.minionKB;
num74 = (int)((float)num74 * this.minionDamage);
}
if (num72 == 228)
{
num75 = 0f;
}
if (item.melee && this.kbGlove)
{
num75 *= 2f;
}
if (this.kbBuff)
{
num75 *= 1.5f;
}
if (item.ranged && this.shroomiteStealth)
{
num75 *= 1f + (1f - this.stealth) * 0.5f;
}
if (item.ranged && this.setVortex)
{
num75 *= 1f + (1f - this.stealth) * 0.5f;
}
if (num72 == 1 && item.type == 120)
{
num72 = 2;
}
if (item.type == 682)
{
num72 = 117;
}
if (item.type == 725)
{
num72 = 120;
}
if (item.type == 2796)
{
num72 = 442;
}
if (item.type == 2223)
{
num72 = 357;
}
this.itemTime = item.useTime;
Vector2 vector2 = this.RotatedRelativePoint(this.MountedCenter, true);
Vector2 value = Vector2.UnitX.RotatedBy((double)this.fullRotation, default(Vector2));
Vector2 vector3 = Main.MouseWorld - vector2;
if (vector3 != Vector2.Zero)
{
vector3.Normalize();
}
float num78 = Vector2.Dot(value, vector3);
if (num78 > 0f)
{
this.ChangeDir(1);
}
else
{
this.ChangeDir(-1);
}
if (item.type == 3094 || item.type == 3378 || item.type == 3543)
{
vector2.Y = this.position.Y + (float)(this.height / 3);
}
if (num72 == 9)
{
vector2 = new Vector2(this.position.X + (float)this.width * 0.5f + (float)(Main.rand.Next(201) * -(float)this.direction) + ((float)Main.mouseX + Main.screenPosition.X - this.position.X), this.MountedCenter.Y - 600f);
num75 = 0f;
num74 *= 2;
}
if (item.type == 986 || item.type == 281)
{
vector2.X += (float)(6 * this.direction);
vector2.Y -= 6f * this.gravDir;
}
if (item.type == 3007)
{
vector2.X -= (float)(4 * this.direction);
vector2.Y -= 1f * this.gravDir;
}
float num79 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
float num80 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
if (this.gravDir == -1f)
{
num80 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y;
}
float num81 = (float)Math.Sqrt((double)(num79 * num79 + num80 * num80));
float num82 = num81;
if ((float.IsNaN(num79) && float.IsNaN(num80)) || (num79 == 0f && num80 == 0f))
{
num79 = (float)this.direction;
num80 = 0f;
num81 = num73;
}
else
{
num81 = num73 / num81;
}
if (item.type == 1929 || item.type == 2270)
{
num79 += (float)Main.rand.Next(-50, 51) * 0.03f / num81;
num80 += (float)Main.rand.Next(-50, 51) * 0.03f / num81;
}
num79 *= num81;
num80 *= num81;
if (item.type == 757)
{
num74 = (int)((float)num74 * 1.25f);
}
if (num72 == 250)
{
for (int num83 = 0; num83 < 1000; num83++)
{
if (Main.projectile[num83].active && Main.projectile[num83].owner == this.whoAmI && (Main.projectile[num83].type == 250 || Main.projectile[num83].type == 251))
{
Main.projectile[num83].Kill();
}
}
}
if (num72 == 12)
{
vector2.X += num79 * 3f;
vector2.Y += num80 * 3f;
}
if (item.useStyle == 5)
{
if (item.type == 3029)
{
Vector2 vector4 = new Vector2(num79, num80);
vector4.X = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
vector4.Y = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y - 1000f;
this.itemRotation = (float)Math.Atan2((double)(vector4.Y * (float)this.direction), (double)(vector4.X * (float)this.direction));
NetMessage.SendData(13, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0);
NetMessage.SendData(41, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0);
}
else
{
this.itemRotation = (float)Math.Atan2((double)(num80 * (float)this.direction), (double)(num79 * (float)this.direction)) - this.fullRotation;
NetMessage.SendData(13, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0);
NetMessage.SendData(41, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0);
}
}
if (num72 == 17)
{
vector2.X = (float)Main.mouseX + Main.screenPosition.X;
vector2.Y = (float)Main.mouseY + Main.screenPosition.Y;
if (this.gravDir == -1f)
{
vector2.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
}
}
if (num72 == 76)
{
num72 += Main.rand.Next(3);
num82 /= (float)(Main.screenHeight / 2);
if (num82 > 1f)
{
num82 = 1f;
}
float num84 = num79 + (float)Main.rand.Next(-40, 41) * 0.01f;
float num85 = num80 + (float)Main.rand.Next(-40, 41) * 0.01f;
num84 *= num82 + 0.25f;
num85 *= num82 + 0.25f;
int num86 = Projectile.NewProjectile(vector2.X, vector2.Y, num84, num85, num72, num74, num75, i, 0f, 0f);
Main.projectile[num86].ai[1] = 1f;
num82 = num82 * 2f - 1f;
if (num82 < -1f)
{
num82 = -1f;
}
if (num82 > 1f)
{
num82 = 1f;
}
Main.projectile[num86].ai[0] = num82;
NetMessage.SendData(27, -1, -1, "", num86, 0f, 0f, 0f, 0, 0, 0);
}
else if (item.type == 3029)
{
int num87 = 3;
if (Main.rand.Next(3) == 0)
{
num87++;
}
for (int num88 = 0; num88 < num87; num88++)
{
vector2 = new Vector2(this.position.X + (float)this.width * 0.5f + (float)(Main.rand.Next(201) * -(float)this.direction) + ((float)Main.mouseX + Main.screenPosition.X - this.position.X), this.MountedCenter.Y - 600f);
vector2.X = (vector2.X * 10f + base.Center.X) / 11f + (float)Main.rand.Next(-100, 101);
vector2.Y -= (float)(150 * num88);
num79 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
num80 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
if (num80 < 0f)
{
num80 *= -1f;
}
if (num80 < 20f)
{
num80 = 20f;
}
num81 = (float)Math.Sqrt((double)(num79 * num79 + num80 * num80));
num81 = num73 / num81;
num79 *= num81;
num80 *= num81;
float num89 = num79 + (float)Main.rand.Next(-40, 41) * 0.03f;
float speedY = num80 + (float)Main.rand.Next(-40, 41) * 0.03f;
num89 *= (float)Main.rand.Next(75, 150) * 0.01f;
vector2.X += (float)Main.rand.Next(-50, 51);
int num90 = Projectile.NewProjectile(vector2.X, vector2.Y, num89, speedY, num72, num74, num75, i, 0f, 0f);
Main.projectile[num90].noDropItem = true;
}
}
else if (item.type == 98 || item.type == 533)
{
float speedX = num79 + (float)Main.rand.Next(-40, 41) * 0.01f;
float speedY2 = num80 + (float)Main.rand.Next(-40, 41) * 0.01f;
Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY2, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 1319)
{
float speedX2 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f;
float speedY3 = num80 + (float)Main.rand.Next(-40, 41) * 0.02f;
int num91 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX2, speedY3, num72, num74, num75, i, 0f, 0f);
Main.projectile[num91].ranged = true;
Main.projectile[num91].thrown = false;
}
else if (item.type == 3107)
{
float speedX3 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f;
float speedY4 = num80 + (float)Main.rand.Next(-40, 41) * 0.02f;
Projectile.NewProjectile(vector2.X, vector2.Y, speedX3, speedY4, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 3053)
{
Vector2 value2 = new Vector2(num79, num80);
value2.Normalize();
Vector2 value3 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
value3.Normalize();
value2 = value2 * 4f + value3;
value2.Normalize();
value2 *= item.shootSpeed;
float num92 = (float)Main.rand.Next(10, 80) * 0.001f;
if (Main.rand.Next(2) == 0)
{
num92 *= -1f;
}
float num93 = (float)Main.rand.Next(10, 80) * 0.001f;
if (Main.rand.Next(2) == 0)
{
num93 *= -1f;
}
Projectile.NewProjectile(vector2.X, vector2.Y, value2.X, value2.Y, num72, num74, num75, i, num93, num92);
}
else if (item.type == 3019)
{
Vector2 value4 = new Vector2(num79, num80);
float num94 = value4.Length();
value4.X += (float)Main.rand.Next(-100, 101) * 0.01f * num94 * 0.15f;
value4.Y += (float)Main.rand.Next(-100, 101) * 0.01f * num94 * 0.15f;
float num95 = num79 + (float)Main.rand.Next(-40, 41) * 0.03f;
float num96 = num80 + (float)Main.rand.Next(-40, 41) * 0.03f;
value4.Normalize();
value4 *= num94;
num95 *= (float)Main.rand.Next(50, 150) * 0.01f;
num96 *= (float)Main.rand.Next(50, 150) * 0.01f;
Vector2 value5 = new Vector2(num95, num96);
value5.X += (float)Main.rand.Next(-100, 101) * 0.025f;
value5.Y += (float)Main.rand.Next(-100, 101) * 0.025f;
value5.Normalize();
value5 *= num94;
num95 = value5.X;
num96 = value5.Y;
Projectile.NewProjectile(vector2.X, vector2.Y, num95, num96, num72, num74, num75, i, value4.X, value4.Y);
}
else if (item.type == 2797)
{
Vector2 value6 = Vector2.Normalize(new Vector2(num79, num80)) * 40f * item.scale;
if (Collision.CanHit(vector2, 0, 0, vector2 + value6, 0, 0))
{
vector2 += value6;
}
float ai = new Vector2(num79, num80).ToRotation();
float num97 = 2.09439516f;
int num98 = Main.rand.Next(4, 5);
if (Main.rand.Next(4) == 0)
{
num98++;
}
for (int num99 = 0; num99 < num98; num99++)
{
float scaleFactor2 = (float)Main.rand.NextDouble() * 0.2f + 0.05f;
Vector2 vector5 = new Vector2(num79, num80).RotatedBy((double)(num97 * (float)Main.rand.NextDouble() - num97 / 2f), default(Vector2)) * scaleFactor2;
int num100 = Projectile.NewProjectile(vector2.X, vector2.Y, vector5.X, vector5.Y, 444, num74, num75, i, ai, 0f);
Main.projectile[num100].localAI[0] = (float)num72;
Main.projectile[num100].localAI[1] = num73;
}
}
else if (item.type == 2270)
{
float num101 = num79 + (float)Main.rand.Next(-40, 41) * 0.05f;
float num102 = num80 + (float)Main.rand.Next(-40, 41) * 0.05f;
if (Main.rand.Next(3) == 0)
{
num101 *= 1f + (float)Main.rand.Next(-30, 31) * 0.02f;
num102 *= 1f + (float)Main.rand.Next(-30, 31) * 0.02f;
}
Projectile.NewProjectile(vector2.X, vector2.Y, num101, num102, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 1930)
{
int num103 = 2 + Main.rand.Next(3);
for (int num104 = 0; num104 < num103; num104++)
{
float num105 = num79;
float num106 = num80;
float num107 = 0.025f * (float)num104;
num105 += (float)Main.rand.Next(-35, 36) * num107;
num106 += (float)Main.rand.Next(-35, 36) * num107;
num81 = (float)Math.Sqrt((double)(num105 * num105 + num106 * num106));
num81 = num73 / num81;
num105 *= num81;
num106 *= num81;
float x = vector2.X + num79 * (float)(num103 - num104) * 1.75f;
float y = vector2.Y + num80 * (float)(num103 - num104) * 1.75f;
Projectile.NewProjectile(x, y, num105, num106, num72, num74, num75, i, (float)Main.rand.Next(0, 10 * (num104 + 1)), 0f);
}
}
else if (item.type == 1931)
{
int num108 = 2;
for (int num109 = 0; num109 < num108; num109++)
{
vector2 = new Vector2(this.position.X + (float)this.width * 0.5f + (float)(Main.rand.Next(201) * -(float)this.direction) + ((float)Main.mouseX + Main.screenPosition.X - this.position.X), this.MountedCenter.Y - 600f);
vector2.X = (vector2.X + base.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
vector2.Y -= (float)(100 * num109);
num79 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
num80 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
if (num80 < 0f)
{
num80 *= -1f;
}
if (num80 < 20f)
{
num80 = 20f;
}
num81 = (float)Math.Sqrt((double)(num79 * num79 + num80 * num80));
num81 = num73 / num81;
num79 *= num81;
num80 *= num81;
float speedX4 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f;
float speedY5 = num80 + (float)Main.rand.Next(-40, 41) * 0.02f;
Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, num72, num74, num75, i, 0f, (float)Main.rand.Next(5));
}
}
else if (item.type == 2750)
{
int num110 = 1;
for (int num111 = 0; num111 < num110; num111++)
{
vector2 = new Vector2(this.position.X + (float)this.width * 0.5f + (float)(Main.rand.Next(201) * -(float)this.direction) + ((float)Main.mouseX + Main.screenPosition.X - this.position.X), this.MountedCenter.Y - 600f);
vector2.X = (vector2.X + base.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
vector2.Y -= (float)(100 * num111);
num79 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f;
num80 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
if (num80 < 0f)
{
num80 *= -1f;
}
if (num80 < 20f)
{
num80 = 20f;
}
num81 = (float)Math.Sqrt((double)(num79 * num79 + num80 * num80));
num81 = num73 / num81;
num79 *= num81;
num80 *= num81;
float num112 = num79;
float num113 = num80 + (float)Main.rand.Next(-40, 41) * 0.02f;
Projectile.NewProjectile(vector2.X, vector2.Y, num112 * 0.75f, num113 * 0.75f, num72 + Main.rand.Next(3), num74, num75, i, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f);
}
}
else if (item.type == 3570)
{
int num114 = 3;
for (int num115 = 0; num115 < num114; num115++)
{
vector2 = new Vector2(this.position.X + (float)this.width * 0.5f + (float)(Main.rand.Next(201) * -(float)this.direction) + ((float)Main.mouseX + Main.screenPosition.X - this.position.X), this.MountedCenter.Y - 600f);
vector2.X = (vector2.X + base.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
vector2.Y -= (float)(100 * num115);
num79 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
num80 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
float ai2 = num80 + vector2.Y;
if (num80 < 0f)
{
num80 *= -1f;
}
if (num80 < 20f)
{
num80 = 20f;
}
num81 = (float)Math.Sqrt((double)(num79 * num79 + num80 * num80));
num81 = num73 / num81;
num79 *= num81;
num80 *= num81;
Vector2 vector6 = new Vector2(num79, num80) / 2f;
Projectile.NewProjectile(vector2.X, vector2.Y, vector6.X, vector6.Y, num72, num74, num75, i, 0f, ai2);
}
}
else if (item.type == 3065)
{
Vector2 value7 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY);
float num116 = value7.Y;
if (num116 > base.Center.Y - 200f)
{
num116 = base.Center.Y - 200f;
}
for (int num117 = 0; num117 < 3; num117++)
{
vector2 = base.Center + new Vector2((float)(-(float)Main.rand.Next(0, 401) * this.direction), -600f);
vector2.Y -= (float)(100 * num117);
Vector2 value8 = value7 - vector2;
if (value8.Y < 0f)
{
value8.Y *= -1f;
}
if (value8.Y < 20f)
{
value8.Y = 20f;
}
value8.Normalize();
value8 *= num73;
num79 = value8.X;
num80 = value8.Y;
float speedX5 = num79;
float speedY6 = num80 + (float)Main.rand.Next(-40, 41) * 0.02f;
Projectile.NewProjectile(vector2.X, vector2.Y, speedX5, speedY6, num72, num74 * 2, num75, i, 0f, num116);
}
}
else if (item.type == 2624)
{
float num118 = 0.314159274f;
int num119 = 5;
Vector2 vector7 = new Vector2(num79, num80);
vector7.Normalize();
vector7 *= 40f;
bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0);
for (int num120 = 0; num120 < num119; num120++)
{
float num121 = (float)num120 - ((float)num119 - 1f) / 2f;
Vector2 value9 = vector7.RotatedBy((double)(num118 * num121), default(Vector2));
if (!flag11)
{
value9 -= vector7;
}
int num122 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, num79, num80, num72, num74, num75, i, 0f, 0f);
Main.projectile[num122].noDropItem = true;
}
}
else if (item.type == 1929)
{
float speedX6 = num79 + (float)Main.rand.Next(-40, 41) * 0.03f;
float speedY7 = num80 + (float)Main.rand.Next(-40, 41) * 0.03f;
Projectile.NewProjectile(vector2.X, vector2.Y, speedX6, speedY7, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 1553)
{
float speedX7 = num79 + (float)Main.rand.Next(-40, 41) * 0.005f;
float speedY8 = num80 + (float)Main.rand.Next(-40, 41) * 0.005f;
Projectile.NewProjectile(vector2.X, vector2.Y, speedX7, speedY8, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 518)
{
float num123 = num79;
float num124 = num80;
num123 += (float)Main.rand.Next(-40, 41) * 0.04f;
num124 += (float)Main.rand.Next(-40, 41) * 0.04f;
Projectile.NewProjectile(vector2.X, vector2.Y, num123, num124, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 1265)
{
float num125 = num79;
float num126 = num80;
num125 += (float)Main.rand.Next(-30, 31) * 0.03f;
num126 += (float)Main.rand.Next(-30, 31) * 0.03f;
Projectile.NewProjectile(vector2.X, vector2.Y, num125, num126, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 534)
{
int num127 = Main.rand.Next(4, 6);
for (int num128 = 0; num128 < num127; num128++)
{
float num129 = num79;
float num130 = num80;
num129 += (float)Main.rand.Next(-40, 41) * 0.05f;
num130 += (float)Main.rand.Next(-40, 41) * 0.05f;
Projectile.NewProjectile(vector2.X, vector2.Y, num129, num130, num72, num74, num75, i, 0f, 0f);
}
}
else if (item.type == 2188)
{
int num131 = 4;
if (Main.rand.Next(3) == 0)
{
num131++;
}
if (Main.rand.Next(4) == 0)
{
num131++;
}
if (Main.rand.Next(5) == 0)
{
num131++;
}
for (int num132 = 0; num132 < num131; num132++)
{
float num133 = num79;
float num134 = num80;
float num135 = 0.05f * (float)num132;
num133 += (float)Main.rand.Next(-35, 36) * num135;
num134 += (float)Main.rand.Next(-35, 36) * num135;
num81 = (float)Math.Sqrt((double)(num133 * num133 + num134 * num134));
num81 = num73 / num81;
num133 *= num81;
num134 *= num81;
float x2 = vector2.X;
float y2 = vector2.Y;
Projectile.NewProjectile(x2, y2, num133, num134, num72, num74, num75, i, 0f, 0f);
}
}
else if (item.type == 1308)
{
int num136 = 3;
if (Main.rand.Next(3) == 0)
{
num136++;
}
for (int num137 = 0; num137 < num136; num137++)
{
float num138 = num79;
float num139 = num80;
float num140 = 0.05f * (float)num137;
num138 += (float)Main.rand.Next(-35, 36) * num140;
num139 += (float)Main.rand.Next(-35, 36) * num140;
num81 = (float)Math.Sqrt((double)(num138 * num138 + num139 * num139));
num81 = num73 / num81;
num138 *= num81;
num139 *= num81;
float x3 = vector2.X;
float y3 = vector2.Y;
Projectile.NewProjectile(x3, y3, num138, num139, num72, num74, num75, i, 0f, 0f);
}
}
else if (item.type == 1258)
{
float num141 = num79;
float num142 = num80;
num141 += (float)Main.rand.Next(-40, 41) * 0.01f;
num142 += (float)Main.rand.Next(-40, 41) * 0.01f;
vector2.X += (float)Main.rand.Next(-40, 41) * 0.05f;
vector2.Y += (float)Main.rand.Next(-45, 36) * 0.05f;
Projectile.NewProjectile(vector2.X, vector2.Y, num141, num142, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 964)
{
int num143 = Main.rand.Next(3, 5);
for (int num144 = 0; num144 < num143; num144++)
{
float num145 = num79;
float num146 = num80;
num145 += (float)Main.rand.Next(-35, 36) * 0.04f;
num146 += (float)Main.rand.Next(-35, 36) * 0.04f;
Projectile.NewProjectile(vector2.X, vector2.Y, num145, num146, num72, num74, num75, i, 0f, 0f);
}
}
else if (item.type == 1569)
{
int num147 = 4;
if (Main.rand.Next(2) == 0)
{
num147++;
}
if (Main.rand.Next(4) == 0)
{
num147++;
}
if (Main.rand.Next(8) == 0)
{
num147++;
}
if (Main.rand.Next(16) == 0)
{
num147++;
}
for (int num148 = 0; num148 < num147; num148++)
{
float num149 = num79;
float num150 = num80;
float num151 = 0.05f * (float)num148;
num149 += (float)Main.rand.Next(-35, 36) * num151;
num150 += (float)Main.rand.Next(-35, 36) * num151;
num81 = (float)Math.Sqrt((double)(num149 * num149 + num150 * num150));
num81 = num73 / num81;
num149 *= num81;
num150 *= num81;
float x4 = vector2.X;
float y4 = vector2.Y;
Projectile.NewProjectile(x4, y4, num149, num150, num72, num74, num75, i, 0f, 0f);
}
}
else if (item.type == 1572 || item.type == 2366 || item.type == 3571 || item.type == 3569)
{
int shoot = item.shoot;
for (int num152 = 0; num152 < 1000; num152++)
{
if (Main.projectile[num152].owner == this.whoAmI && Main.projectile[num152].type == shoot)
{
Main.projectile[num152].Kill();
}
}
bool flag12 = item.type == 3571 || item.type == 3569;
int num153 = (int)((float)Main.mouseX + Main.screenPosition.X) / 16;
int num154 = (int)((float)Main.mouseY + Main.screenPosition.Y) / 16;
if (this.gravDir == -1f)
{
num154 = (int)(Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16;
}
if (!flag12)
{
while (num154 < Main.maxTilesY - 10 && Main.tile[num153, num154] != null && !WorldGen.SolidTile2(num153, num154) && Main.tile[num153 - 1, num154] != null && !WorldGen.SolidTile2(num153 - 1, num154) && Main.tile[num153 + 1, num154] != null && !WorldGen.SolidTile2(num153 + 1, num154))
{
num154++;
}
num154--;
}
Projectile.NewProjectile((float)Main.mouseX + Main.screenPosition.X, (float)(num154 * 16 - 24), 0f, 15f, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 1244 || item.type == 1256)
{
int num155 = Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72, num74, num75, i, 0f, 0f);
Main.projectile[num155].ai[0] = (float)Main.mouseX + Main.screenPosition.X;
Main.projectile[num155].ai[1] = (float)Main.mouseY + Main.screenPosition.Y;
}
else if (item.type == 1229)
{
int num156 = Main.rand.Next(2, 4);
if (Main.rand.Next(5) == 0)
{
num156++;
}
for (int num157 = 0; num157 < num156; num157++)
{
float num158 = num79;
float num159 = num80;
if (num157 > 0)
{
num158 += (float)Main.rand.Next(-35, 36) * 0.04f;
num159 += (float)Main.rand.Next(-35, 36) * 0.04f;
}
if (num157 > 1)
{
num158 += (float)Main.rand.Next(-35, 36) * 0.04f;
num159 += (float)Main.rand.Next(-35, 36) * 0.04f;
}
if (num157 > 2)
{
num158 += (float)Main.rand.Next(-35, 36) * 0.04f;
num159 += (float)Main.rand.Next(-35, 36) * 0.04f;
}
int num160 = Projectile.NewProjectile(vector2.X, vector2.Y, num158, num159, num72, num74, num75, i, 0f, 0f);
Main.projectile[num160].noDropItem = true;
}
}
else if (item.type == 1121)
{
int num161 = Main.rand.Next(1, 4);
if (Main.rand.Next(6) == 0)
{
num161++;
}
if (Main.rand.Next(6) == 0)
{
num161++;
}
if (this.strongBees && Main.rand.Next(3) == 0)
{
num161++;
}
for (int num162 = 0; num162 < num161; num162++)
{
float num163 = num79;
float num164 = num80;
num163 += (float)Main.rand.Next(-35, 36) * 0.02f;
num164 += (float)Main.rand.Next(-35, 36) * 0.02f;
Projectile.NewProjectile(vector2.X, vector2.Y, num163, num164, this.beeType(), this.beeDamage(num74), this.beeKB(num75), i, 0f, 0f);
}
}
else if (item.type == 1155)
{
int num165 = Main.rand.Next(2, 5);
if (Main.rand.Next(5) == 0)
{
num165++;
}
if (Main.rand.Next(5) == 0)
{
num165++;
}
for (int num166 = 0; num166 < num165; num166++)
{
float num167 = num79;
float num168 = num80;
num167 += (float)Main.rand.Next(-35, 36) * 0.02f;
num168 += (float)Main.rand.Next(-35, 36) * 0.02f;
Projectile.NewProjectile(vector2.X, vector2.Y, num167, num168, num72, num74, num75, i, 0f, 0f);
}
}
else if (item.type == 1801)
{
int num169 = Main.rand.Next(1, 4);
for (int num170 = 0; num170 < num169; num170++)
{
float num171 = num79;
float num172 = num80;
num171 += (float)Main.rand.Next(-35, 36) * 0.05f;
num172 += (float)Main.rand.Next(-35, 36) * 0.05f;
Projectile.NewProjectile(vector2.X, vector2.Y, num171, num172, num72, num74, num75, i, 0f, 0f);
}
}
else if (item.type == 679)
{
for (int num173 = 0; num173 < 6; num173++)
{
float num174 = num79;
float num175 = num80;
num174 += (float)Main.rand.Next(-40, 41) * 0.05f;
num175 += (float)Main.rand.Next(-40, 41) * 0.05f;
Projectile.NewProjectile(vector2.X, vector2.Y, num174, num175, num72, num74, num75, i, 0f, 0f);
}
}
else if (item.type == 2623)
{
for (int num176 = 0; num176 < 3; num176++)
{
float num177 = num79;
float num178 = num80;
num177 += (float)Main.rand.Next(-40, 41) * 0.1f;
num178 += (float)Main.rand.Next(-40, 41) * 0.1f;
Projectile.NewProjectile(vector2.X, vector2.Y, num177, num178, num72, num74, num75, i, 0f, 0f);
}
}
else if (item.type == 3210)
{
Vector2 value10 = new Vector2(num79, num80);
value10.X += (float)Main.rand.Next(-30, 31) * 0.04f;
value10.Y += (float)Main.rand.Next(-30, 31) * 0.03f;
value10.Normalize();
value10 *= (float)Main.rand.Next(70, 91) * 0.1f;
value10.X += (float)Main.rand.Next(-30, 31) * 0.04f;
value10.Y += (float)Main.rand.Next(-30, 31) * 0.03f;
Projectile.NewProjectile(vector2.X, vector2.Y, value10.X, value10.Y, num72, num74, num75, i, (float)Main.rand.Next(20), 0f);
}
else if (item.type == 434)
{
float num179 = num79;
float num180 = num80;
if (this.itemAnimation < 5)
{
num179 += (float)Main.rand.Next(-40, 41) * 0.01f;
num180 += (float)Main.rand.Next(-40, 41) * 0.01f;
num179 *= 1.1f;
num180 *= 1.1f;
}
else if (this.itemAnimation < 10)
{
num179 += (float)Main.rand.Next(-20, 21) * 0.01f;
num180 += (float)Main.rand.Next(-20, 21) * 0.01f;
num179 *= 1.05f;
num180 *= 1.05f;
}
Projectile.NewProjectile(vector2.X, vector2.Y, num179, num180, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 1157)
{
num72 = Main.rand.Next(191, 195);
num79 = 0f;
num80 = 0f;
vector2.X = (float)Main.mouseX + Main.screenPosition.X;
vector2.Y = (float)Main.mouseY + Main.screenPosition.Y;
int num181 = Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72, num74, num75, i, 0f, 0f);
Main.projectile[num181].localAI[0] = 30f;
}
else if (item.type == 1802)
{
num79 = 0f;
num80 = 0f;
vector2.X = (float)Main.mouseX + Main.screenPosition.X;
vector2.Y = (float)Main.mouseY + Main.screenPosition.Y;
Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 2364 || item.type == 2365)
{
num79 = 0f;
num80 = 0f;
vector2.X = (float)Main.mouseX + Main.screenPosition.X;
vector2.Y = (float)Main.mouseY + Main.screenPosition.Y;
Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 2535)
{
num79 = 0f;
num80 = 0f;
vector2.X = (float)Main.mouseX + Main.screenPosition.X;
vector2.Y = (float)Main.mouseY + Main.screenPosition.Y;
Vector2 spinningpoint = new Vector2(num79, num80);
spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default(Vector2));
Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, num72, num74, num75, i, 0f, 0f);
spinningpoint = spinningpoint.RotatedBy(-3.1415927410125732, default(Vector2));
Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, num72 + 1, num74, num75, i, 0f, 0f);
}
else if (item.type == 2551)
{
num79 = 0f;
num80 = 0f;
vector2.X = (float)Main.mouseX + Main.screenPosition.X;
vector2.Y = (float)Main.mouseY + Main.screenPosition.Y;
Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72 + Main.rand.Next(3), num74, num75, i, 0f, 0f);
}
else if (item.type == 2584)
{
num79 = 0f;
num80 = 0f;
vector2.X = (float)Main.mouseX + Main.screenPosition.X;
vector2.Y = (float)Main.mouseY + Main.screenPosition.Y;
Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72 + Main.rand.Next(3), num74, num75, i, 0f, 0f);
}
else if (item.type == 2621)
{
num79 = 0f;
num80 = 0f;
vector2.X = (float)Main.mouseX + Main.screenPosition.X;
vector2.Y = (float)Main.mouseY + Main.screenPosition.Y;
Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 2749 || item.type == 3249 || item.type == 3474)
{
num79 = 0f;
num80 = 0f;
vector2.X = (float)Main.mouseX + Main.screenPosition.X;
vector2.Y = (float)Main.mouseY + Main.screenPosition.Y;
Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 3531)
{
int num182 = -1;
int num183 = -1;
for (int num184 = 0; num184 < 1000; num184++)
{
if (Main.projectile[num184].active && Main.projectile[num184].owner == Main.myPlayer)
{
if (num182 == -1 && Main.projectile[num184].type == 625)
{
num182 = num184;
}
if (num183 == -1 && Main.projectile[num184].type == 628)
{
num183 = num184;
}
if (num182 != -1 && num183 != -1)
{
break;
}
}
}
if (num182 == -1 && num183 == -1)
{
num79 = 0f;
num80 = 0f;
vector2.X = (float)Main.mouseX + Main.screenPosition.X;
vector2.Y = (float)Main.mouseY + Main.screenPosition.Y;
int num185 = Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72, num74, num75, i, 0f, 0f);
num185 = Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72 + 1, num74, num75, i, (float)num185, 0f);
int num186 = num185;
num185 = Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72 + 2, num74, num75, i, (float)num185, 0f);
Main.projectile[num186].localAI[1] = (float)num185;
num186 = num185;
num185 = Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72 + 3, num74, num75, i, (float)num185, 0f);
Main.projectile[num186].localAI[1] = (float)num185;
}
else if (num182 != -1 && num183 != -1)
{
int num187 = Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72 + 1, num74, num75, i, Main.projectile[num183].ai[0], 0f);
int num188 = num187;
num187 = Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72 + 2, num74, num75, i, (float)num187, 0f);
Main.projectile[num188].localAI[1] = (float)num187;
Main.projectile[num187].localAI[1] = (float)num183;
Main.projectile[num183].ai[0] = (float)num187;
Main.projectile[num183].netUpdate = true;
Main.projectile[num183].ai[1] = 1f;
}
}
else if (item.type == 1309)
{
num79 = 0f;
num80 = 0f;
vector2.X = (float)Main.mouseX + Main.screenPosition.X;
vector2.Y = (float)Main.mouseY + Main.screenPosition.Y;
Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72, num74, num75, i, 0f, 0f);
}
else if (item.shoot > 0 && (Main.projPet[item.shoot] || item.shoot == 72 || item.shoot == 18 || item.shoot == 500 || item.shoot == 650) && !item.summon)
{
for (int num189 = 0; num189 < 1000; num189++)
{
if (Main.projectile[num189].active && Main.projectile[num189].owner == this.whoAmI)
{
if (item.shoot == 72)
{
if (Main.projectile[num189].type == 72 || Main.projectile[num189].type == 86 || Main.projectile[num189].type == 87)
{
Main.projectile[num189].Kill();
}
}
else if (item.shoot == Main.projectile[num189].type)
{
Main.projectile[num189].Kill();
}
}
}
Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 3006)
{
Vector2 vector8;
vector8.X = (float)Main.mouseX + Main.screenPosition.X;
vector8.Y = (float)Main.mouseY + Main.screenPosition.Y;
while (Collision.CanHitLine(this.position, this.width, this.height, vector2, 1, 1))
{
vector2.X += num79;
vector2.Y += num80;
if ((vector2 - vector8).Length() < 20f + Math.Abs(num79) + Math.Abs(num80))
{
vector2 = vector8;
break;
}
}
Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 3014)
{
Vector2 vector9;
vector9.X = (float)Main.mouseX + Main.screenPosition.X;
vector9.Y = (float)Main.mouseY + Main.screenPosition.Y;
while (Collision.CanHitLine(this.position, this.width, this.height, vector2, 1, 1))
{
vector2.X += num79;
vector2.Y += num80;
if ((vector2 - vector9).Length() < 20f + Math.Abs(num79) + Math.Abs(num80))
{
vector2 = vector9;
break;
}
}
bool flag13 = false;
int num190 = (int)vector2.Y / 16;
int i2 = (int)vector2.X / 16;
int num191 = num190;
while (num190 < Main.maxTilesY - 10 && num190 - num191 < 30 && !WorldGen.SolidTile(i2, num190))
{
num190++;
}
if (!WorldGen.SolidTile(i2, num190))
{
flag13 = true;
}
float num192 = (float)(num190 * 16);
num190 = num191;
while (num190 > 10 && num191 - num190 < 30 && !WorldGen.SolidTile(i2, num190))
{
num190--;
}
float num193 = (float)(num190 * 16 + 16);
float num194 = num192 - num193;
int num195 = 10;
if (num194 > (float)(16 * num195))
{
num194 = (float)(16 * num195);
}
num193 = num192 - num194;
vector2.X = (float)((int)(vector2.X / 16f) * 16);
if (!flag13)
{
Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, num72, num74, num75, i, num193, num194);
}
}
else if (item.type == 3384)
{
int num196 = (this.altFunctionUse == 2) ? 1 : 0;
Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72, num74, num75, i, 0f, (float)num196);
}
else if (item.type == 3473)
{
float ai3 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f;
Vector2 vector10 = new Vector2(num79, num80);
Projectile.NewProjectile(vector2.X, vector2.Y, vector10.X, vector10.Y, num72, num74, num75, i, 0f, ai3);
}
else if (item.type == 3542)
{
float num197 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f;
int num198 = 0;
while (num198 < 10 && !Collision.CanHit(vector2, 0, 0, vector2 + new Vector2(num79, num80).RotatedBy((double)num197, default(Vector2)) * 100f, 0, 0))
{
num197 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f;
num198++;
}
Vector2 vector11 = new Vector2(num79, num80).RotatedBy((double)num197, default(Vector2)) * (0.85f + Main.rand.NextFloat() * 0.3f);
Projectile.NewProjectile(vector2.X, vector2.Y, vector11.X, vector11.Y, num72, num74, num75, i, 0f, 0f);
}
else if (item.type == 3475)
{
Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, 615, num74, num75, i, (float)(5 * Main.rand.Next(0, 20)), 0f);
}
else if (item.type == 3540)
{
Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, 630, num74, num75, i, 0f, 0f);
}
else if (item.type == 3546)
{
for (int num199 = 0; num199 < 2; num199++)
{
float num200 = num79;
float num201 = num80;
num200 += (float)Main.rand.Next(-40, 41) * 0.05f;
num201 += (float)Main.rand.Next(-40, 41) * 0.05f;
Vector2 vector12 = vector2 + Vector2.Normalize(new Vector2(num200, num201).RotatedBy((double)(-1.57079637f * (float)this.direction), default(Vector2))) * 6f;
Projectile.NewProjectile(vector12.X, vector12.Y, num200, num201, 167 + Main.rand.Next(4), num74, num75, i, 0f, 1f);
}
}
else if (item.type == 3350)
{
float num202 = num79;
float num203 = num80;
num202 += (float)Main.rand.Next(-1, 2) * 0.5f;
num203 += (float)Main.rand.Next(-1, 2) * 0.5f;
if (Collision.CanHitLine(base.Center, 0, 0, vector2 + new Vector2(num202, num203) * 2f, 0, 0))
{
vector2 += new Vector2(num202, num203);
}
Projectile.NewProjectile(vector2.X, vector2.Y - this.gravDir * 4f, num202, num203, num72, num74, num75, i, 0f, (float)Main.rand.Next(12) / 6f);
}
else
{
int num204 = Projectile.NewProjectile(vector2.X, vector2.Y, num79, num80, num72, num74, num75, i, 0f, 0f);
if (item.type == 726)
{
Main.projectile[num204].magic = true;
}
if (item.type == 724 || item.type == 676)
{
Main.projectile[num204].melee = true;
}
if (num72 == 80)
{
Main.projectile[num204].ai[0] = (float)Player.tileTargetX;
Main.projectile[num204].ai[1] = (float)Player.tileTargetY;
}
if (num72 == 442)
{
Main.projectile[num204].ai[0] = (float)Player.tileTargetX;
Main.projectile[num204].ai[1] = (float)Player.tileTargetY;
}
if ((this.thrownCost50 || this.thrownCost33) && this.inventory[this.selectedItem].thrown)
{
Main.projectile[num204].noDropItem = true;
}
if (Main.projectile[num204].aiStyle == 99)
{
AchievementsHelper.HandleSpecialEvent(this, 7);
}
}
}
else if (item.useStyle == 5)
{
this.itemRotation = 0f;
NetMessage.SendData(41, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0);
}
}
if (this.whoAmI == Main.myPlayer && (item.type == 509 || item.type == 510 || item.type == 849 || item.type == 850 || item.type == 851) && this.position.X / 16f - (float)Player.tileRangeX - (float)item.tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)item.tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)item.tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)item.tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY)
{
this.showItemIcon = true;
if (this.itemAnimation > 0 && this.itemTime == 0 && this.controlUseItem)
{
int i3 = Player.tileTargetX;
int j2 = Player.tileTargetY;
if (item.type == 509)
{
int num205 = -1;
for (int num206 = 0; num206 < 58; num206++)
{
if (this.inventory[num206].stack > 0 && this.inventory[num206].type == 530)
{
num205 = num206;
break;
}
}
if (num205 >= 0 && WorldGen.PlaceWire(i3, j2))
{
this.inventory[num205].stack--;
if (this.inventory[num205].stack <= 0)
{
this.inventory[num205].SetDefaults(0, false);
}
this.itemTime = item.useTime;
NetMessage.SendData(17, -1, -1, "", 5, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
}
}
else if (item.type == 850)
{
int num207 = -1;
for (int num208 = 0; num208 < 58; num208++)
{
if (this.inventory[num208].stack > 0 && this.inventory[num208].type == 530)
{
num207 = num208;
break;
}
}
if (num207 >= 0 && WorldGen.PlaceWire2(i3, j2))
{
this.inventory[num207].stack--;
if (this.inventory[num207].stack <= 0)
{
this.inventory[num207].SetDefaults(0, false);
}
this.itemTime = item.useTime;
NetMessage.SendData(17, -1, -1, "", 10, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
}
}
if (item.type == 851)
{
int num209 = -1;
for (int num210 = 0; num210 < 58; num210++)
{
if (this.inventory[num210].stack > 0 && this.inventory[num210].type == 530)
{
num209 = num210;
break;
}
}
if (num209 >= 0 && WorldGen.PlaceWire3(i3, j2))
{
this.inventory[num209].stack--;
if (this.inventory[num209].stack <= 0)
{
this.inventory[num209].SetDefaults(0, false);
}
this.itemTime = item.useTime;
NetMessage.SendData(17, -1, -1, "", 12, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
}
}
else if (item.type == 510)
{
if (WorldGen.KillActuator(i3, j2))
{
this.itemTime = item.useTime;
NetMessage.SendData(17, -1, -1, "", 9, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
}
else if (WorldGen.KillWire3(i3, j2))
{
this.itemTime = item.useTime;
NetMessage.SendData(17, -1, -1, "", 13, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
}
else if (WorldGen.KillWire2(i3, j2))
{
this.itemTime = item.useTime;
NetMessage.SendData(17, -1, -1, "", 11, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
}
else if (WorldGen.KillWire(i3, j2))
{
this.itemTime = item.useTime;
NetMessage.SendData(17, -1, -1, "", 6, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
}
}
else if (item.type == 849 && item.stack > 0 && WorldGen.PlaceActuator(i3, j2))
{
this.itemTime = item.useTime;
NetMessage.SendData(17, -1, -1, "", 8, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
item.stack--;
if (item.stack <= 0)
{
item.SetDefaults(0, false);
}
}
}
}
if (this.itemAnimation > 0 && this.itemTime == 0 && (item.type == 507 || item.type == 508))
{
this.itemTime = item.useTime;
Vector2 vector13 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num211 = (float)Main.mouseX + Main.screenPosition.X - vector13.X;
float num212 = (float)Main.mouseY + Main.screenPosition.Y - vector13.Y;
float num213 = (float)Math.Sqrt((double)(num211 * num211 + num212 * num212));
num213 /= (float)(Main.screenHeight / 2);
if (num213 > 1f)
{
num213 = 1f;
}
num213 = num213 * 2f - 1f;
if (num213 < -1f)
{
num213 = -1f;
}
if (num213 > 1f)
{
num213 = 1f;
}
Main.harpNote = num213;
int style = 26;
if (item.type == 507)
{
style = 35;
}
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, style);
NetMessage.SendData(58, -1, -1, "", this.whoAmI, num213, 0f, 0f, 0, 0, 0);
}
if (((item.type >= 205 && item.type <= 207) || item.type == 1128 || item.type == 3031 || item.type == 3032) && this.position.X / 16f - (float)Player.tileRangeX - (float)item.tileBoost <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)item.tileBoost - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)item.tileBoost <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)item.tileBoost - 2f >= (float)Player.tileTargetY)
{
this.showItemIcon = true;
if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem)
{
if (item.type == 205 || (item.type == 3032 && Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == 0))
{
int num214 = (int)Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType();
int num215 = 0;
for (int num216 = Player.tileTargetX - 1; num216 <= Player.tileTargetX + 1; num216++)
{
for (int num217 = Player.tileTargetY - 1; num217 <= Player.tileTargetY + 1; num217++)
{
if ((int)Main.tile[num216, num217].liquidType() == num214)
{
num215 += (int)Main.tile[num216, num217].liquid;
}
}
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid > 0 && (num215 > 100 || item.type == 3032))
{
int liquidType = (int)Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType();
if (item.type != 3032)
{
if (!Main.tile[Player.tileTargetX, Player.tileTargetY].lava())
{
if (Main.tile[Player.tileTargetX, Player.tileTargetY].honey())
{
item.stack--;
this.PutItemInInventory(1128, this.selectedItem);
}
else
{
item.stack--;
this.PutItemInInventory(206, this.selectedItem);
}
}
else
{
item.stack--;
this.PutItemInInventory(207, this.selectedItem);
}
}
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1);
this.itemTime = item.useTime;
int num218 = (int)Main.tile[Player.tileTargetX, Player.tileTargetY].liquid;
Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = 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 num219 = Player.tileTargetX - 1; num219 <= Player.tileTargetX + 1; num219++)
{
for (int num220 = Player.tileTargetY - 1; num220 <= Player.tileTargetY + 1; num220++)
{
if (num218 < 256 && (int)Main.tile[num219, num220].liquidType() == num214)
{
int num221 = (int)Main.tile[num219, num220].liquid;
if (num221 + num218 > 255)
{
num221 = 255 - num218;
}
num218 += num221;
Tile expr_983F = Main.tile[num219, num220];
expr_983F.liquid -= (byte)num221;
Main.tile[num219, num220].liquidType(liquidType);
if (Main.tile[num219, num220].liquid == 0)
{
Main.tile[num219, num220].lava(false);
Main.tile[num219, num220].honey(false);
}
WorldGen.SquareTileFrame(num219, num220, false);
if (Main.netMode == 1)
{
NetMessage.sendWater(num219, num220);
}
else
{
Liquid.AddWater(num219, num220);
}
}
}
}
}
}
else if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid < 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 (item.type == 207)
{
if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid == 0 || Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == 1)
{
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1);
Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(1);
Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = 255;
WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true);
item.stack--;
this.PutItemInInventory(205, this.selectedItem);
this.itemTime = item.useTime;
if (Main.netMode == 1)
{
NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY);
}
}
}
else if (item.type == 206 || item.type == 3031)
{
if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid == 0 || Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == 0)
{
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1);
Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(0);
Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = 255;
WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true);
if (item.type != 3031)
{
item.stack--;
this.PutItemInInventory(205, this.selectedItem);
}
this.itemTime = item.useTime;
if (Main.netMode == 1)
{
NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY);
}
}
}
else if (item.type == 1128 && (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid == 0 || Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == 2))
{
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1);
Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(2);
Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = 255;
WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true);
item.stack--;
this.PutItemInInventory(205, this.selectedItem);
this.itemTime = item.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)
{
if (item.pick > 0)
{
this.toolTime = item.useTime;
}
else
{
this.toolTime = (int)((float)item.useTime * this.pickSpeed);
}
}
}
if ((item.pick > 0 || item.axe > 0 || item.hammer > 0) && this.position.X / 16f - (float)Player.tileRangeX - (float)item.tileBoost <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)item.tileBoost - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)item.tileBoost <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)item.tileBoost - 2f >= (float)Player.tileTargetY)
{
int num222 = 0;
bool flag14 = true;
this.showItemIcon = true;
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 != 314 && Main.tile[Player.tileTargetX, Player.tileTargetY].type != 351)))
{
this.poundRelease = false;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].active())
{
if ((item.pick > 0 && !Main.tileAxe[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type] && !Main.tileHammer[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]) || (item.axe > 0 && Main.tileAxe[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]) || (item.hammer > 0 && Main.tileHammer[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]))
{
flag14 = 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])
{
num222 = 100;
}
if (Main.tileHammer[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type])
{
flag14 = false;
if (item.hammer > 0)
{
num222 += item.hammer;
if (!WorldGen.CanKillTile(Player.tileTargetX, Player.tileTargetY))
{
num222 = 0;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 26 && (item.hammer < 80 || !Main.hardMode))
{
num222 = 0;
this.Hurt(this.statLife / 2, -this.direction, false, false, Lang.deathMsg(-1, -1, -1, 4), false);
}
AchievementsHelper.CurrentlyMining = true;
if (this.hitTile.AddDamage(tileId, num222, true) >= 100)
{
this.hitTile.Clear(tileId);
WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, false, false, false);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
}
}
else
{
WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, true, false, false);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0);
}
}
if (num222 != 0)
{
this.hitTile.Prune();
}
this.itemTime = item.useTime;
AchievementsHelper.CurrentlyMining = false;
}
}
else if (Main.tileAxe[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type])
{
if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 80)
{
num222 += item.axe * 3;
}
else
{
num222 += item.axe;
}
if (item.axe > 0)
{
AchievementsHelper.CurrentlyMining = true;
if (!WorldGen.CanKillTile(Player.tileTargetX, Player.tileTargetY))
{
num222 = 0;
}
if (this.hitTile.AddDamage(tileId, num222, true) >= 100)
{
this.hitTile.Clear(tileId);
WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, false, false, false);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0);
}
}
else
{
WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, true, false, false);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0);
}
}
if (num222 != 0)
{
this.hitTile.Prune();
}
this.itemTime = item.useTime;
AchievementsHelper.CurrentlyMining = false;
}
}
else if (item.pick > 0)
{
this.PickTile(Player.tileTargetX, Player.tileTargetY, item.pick);
this.itemTime = (int)((float)item.useTime * this.pickSpeed);
}
if (item.pick > 0)
{
this.itemTime = (int)((float)item.useTime * this.pickSpeed);
}
if (item.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 != 10) || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 314 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 351) && this.poundRelease)
{
flag14 = false;
this.itemTime = item.useTime;
num222 += (int)((double)item.hammer * 1.25);
num222 = 100;
if (Main.tile[Player.tileTargetX, Player.tileTargetY - 1].active() && Main.tile[Player.tileTargetX, Player.tileTargetY - 1].type == 10)
{
num222 = 0;
}
if (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].active() && Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type == 10)
{
num222 = 0;
}
if (this.hitTile.AddDamage(tileId, num222, true) >= 100)
{
this.hitTile.Clear(tileId);
if (this.poundRelease)
{
int num223 = Player.tileTargetX;
int num224 = Player.tileTargetY;
if (Main.tile[num223, num224].type == 19)
{
if (Main.tile[num223, num224].halfBrick())
{
WorldGen.PoundTile(num223, num224);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 7, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0);
}
}
else
{
int num225 = 1;
int slope = 2;
if (Main.tile[num223 + 1, num224 - 1].type == 19 || Main.tile[num223 - 1, num224 + 1].type == 19 || (WorldGen.SolidTile(num223 + 1, num224) && !WorldGen.SolidTile(num223 - 1, num224)))
{
num225 = 2;
slope = 1;
}
if (Main.tile[num223, num224].slope() == 0)
{
WorldGen.SlopeTile(num223, num224, num225);
int num226 = (int)Main.tile[num223, num224].slope();
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num226, 0, 0, 0);
}
}
else if ((int)Main.tile[num223, num224].slope() == num225)
{
WorldGen.SlopeTile(num223, num224, slope);
int num227 = (int)Main.tile[num223, num224].slope();
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num227, 0, 0, 0);
}
}
else
{
WorldGen.SlopeTile(num223, num224, 0);
int num228 = (int)Main.tile[num223, num224].slope();
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num228, 0, 0, 0);
}
WorldGen.PoundTile(num223, num224);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 7, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0);
}
}
}
}
else if (Main.tile[num223, num224].type == 314)
{
if (Minecart.FrameTrack(num223, num224, true, false) && Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 15, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0);
}
}
else if (Main.tile[num223, num224].type == 137)
{
if (Main.tile[num223, num224].frameX == 18)
{
Main.tile[num223, num224].frameX = 0;
}
else
{
Main.tile[num223, num224].frameX = 18;
}
if (Main.netMode == 1)
{
NetMessage.SendTileSquare(-1, Player.tileTargetX, Player.tileTargetY, 1);
}
}
else if ((Main.tile[num223, num224].halfBrick() || Main.tile[num223, num224].slope() != 0) && !Main.tileSolidTop[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type])
{
int num229 = 1;
int num230 = 1;
int num231 = 2;
if ((WorldGen.SolidTile(num223 + 1, num224) || Main.tile[num223 + 1, num224].slope() == 1 || Main.tile[num223 + 1, num224].slope() == 3) && !WorldGen.SolidTile(num223 - 1, num224))
{
num230 = 2;
num231 = 1;
}
if (WorldGen.SolidTile(num223, num224 - 1) && !WorldGen.SolidTile(num223, num224 + 1))
{
num229 = -1;
}
if (num229 == 1)
{
if (Main.tile[num223, num224].slope() == 0)
{
WorldGen.SlopeTile(num223, num224, num230);
}
else if ((int)Main.tile[num223, num224].slope() == num230)
{
WorldGen.SlopeTile(num223, num224, num231);
}
else if ((int)Main.tile[num223, num224].slope() == num231)
{
WorldGen.SlopeTile(num223, num224, num230 + 2);
}
else if ((int)Main.tile[num223, num224].slope() == num230 + 2)
{
WorldGen.SlopeTile(num223, num224, num231 + 2);
}
else
{
WorldGen.SlopeTile(num223, num224, 0);
}
}
else if (Main.tile[num223, num224].slope() == 0)
{
WorldGen.SlopeTile(num223, num224, num230 + 2);
}
else if ((int)Main.tile[num223, num224].slope() == num230 + 2)
{
WorldGen.SlopeTile(num223, num224, num231 + 2);
}
else if ((int)Main.tile[num223, num224].slope() == num231 + 2)
{
WorldGen.SlopeTile(num223, num224, num230);
}
else if ((int)Main.tile[num223, num224].slope() == num230)
{
WorldGen.SlopeTile(num223, num224, num231);
}
else
{
WorldGen.SlopeTile(num223, num224, 0);
}
int num232 = (int)Main.tile[num223, num224].slope();
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num232, 0, 0, 0);
}
}
else
{
WorldGen.PoundTile(num223, num224);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 7, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0);
}
}
this.poundRelease = false;
}
}
else
{
WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, true, true, false);
Main.PlaySound(0, Player.tileTargetX * 16, Player.tileTargetY * 16, 1);
}
}
else
{
this.poundRelease = false;
}
}
}
if (this.releaseUseItem)
{
this.poundRelease = true;
}
int num233 = Player.tileTargetX;
int num234 = Player.tileTargetY;
bool flag15 = true;
if (Main.tile[num233, num234].wall > 0)
{
if (!Main.wallHouse[(int)Main.tile[num233, num234].wall])
{
for (int num235 = num233 - 1; num235 < num233 + 2; num235++)
{
for (int num236 = num234 - 1; num236 < num234 + 2; num236++)
{
if (Main.tile[num235, num236].wall != Main.tile[num233, num234].wall)
{
flag15 = false;
break;
}
}
}
}
else
{
flag15 = false;
}
}
if (flag15 && !Main.tile[num233, num234].active())
{
int num237 = -1;
if ((double)(((float)Main.mouseX + Main.screenPosition.X) / 16f) < Math.Round((double)(((float)Main.mouseX + Main.screenPosition.X) / 16f)))
{
num237 = 0;
}
int num238 = -1;
if ((double)(((float)Main.mouseY + Main.screenPosition.Y) / 16f) < Math.Round((double)(((float)Main.mouseY + Main.screenPosition.Y) / 16f)))
{
num238 = 0;
}
for (int num239 = Player.tileTargetX + num237; num239 <= Player.tileTargetX + num237 + 1; num239++)
{
for (int num240 = Player.tileTargetY + num238; num240 <= Player.tileTargetY + num238 + 1; num240++)
{
if (flag15)
{
num233 = num239;
num234 = num240;
if (Main.tile[num233, num234].wall > 0)
{
if (!Main.wallHouse[(int)Main.tile[num233, num234].wall])
{
for (int num241 = num233 - 1; num241 < num233 + 2; num241++)
{
for (int num242 = num234 - 1; num242 < num234 + 2; num242++)
{
if (Main.tile[num241, num242].wall != Main.tile[num233, num234].wall)
{
flag15 = false;
break;
}
}
}
}
else
{
flag15 = false;
}
}
}
}
}
}
if (flag14 && Main.tile[num233, num234].wall > 0 && (!Main.tile[num233, num234].active() || num233 != Player.tileTargetX || num234 != Player.tileTargetY || (!Main.tileHammer[(int)Main.tile[num233, num234].type] && !this.poundRelease)) && this.toolTime == 0 && this.itemAnimation > 0 && this.controlUseItem && item.hammer > 0)
{
bool flag16 = true;
if (!Main.wallHouse[(int)Main.tile[num233, num234].wall])
{
flag16 = false;
for (int num243 = num233 - 1; num243 < num233 + 2; num243++)
{
for (int num244 = num234 - 1; num244 < num234 + 2; num244++)
{
if (Main.tile[num243, num244].wall == 0 || Main.wallHouse[(int)Main.tile[num243, num244].wall])
{
flag16 = true;
break;
}
}
}
}
if (flag16)
{
int tileId = this.hitTile.HitObject(num233, num234, 2);
num222 += (int)((float)item.hammer * 1.5f);
if (this.hitTile.AddDamage(tileId, num222, true) >= 100)
{
this.hitTile.Clear(tileId);
WorldGen.KillWall(num233, num234, false);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 2, (float)num233, (float)num234, 0f, 0, 0, 0);
}
}
else
{
WorldGen.KillWall(num233, num234, true);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 2, (float)num233, (float)num234, 1f, 0, 0, 0);
}
}
if (num222 != 0)
{
this.hitTile.Prune();
}
this.itemTime = item.useTime / 2;
}
}
}
if (Main.myPlayer == this.whoAmI && item.type == 1326 && this.itemAnimation > 0 && this.itemTime == 0)
{
this.itemTime = item.useTime;
Vector2 vector14;
vector14.X = (float)Main.mouseX + Main.screenPosition.X;
if (this.gravDir == 1f)
{
vector14.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)this.height;
}
else
{
vector14.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
}
vector14.X -= (float)(this.width / 2);
if (vector14.X > 50f && vector14.X < (float)(Main.maxTilesX * 16 - 50) && vector14.Y > 50f && vector14.Y < (float)(Main.maxTilesY * 16 - 50))
{
int num245 = (int)(vector14.X / 16f);
int num246 = (int)(vector14.Y / 16f);
if ((Main.tile[num245, num246].wall != 87 || (double)num246 <= Main.worldSurface || NPC.downedPlantBoss) && !Collision.SolidCollision(vector14, this.width, this.height))
{
this.Teleport(vector14, 1, 0);
NetMessage.SendData(65, -1, -1, "", 0, (float)this.whoAmI, vector14.X, vector14.Y, 1, 0, 0);
if (this.chaosState)
{
this.statLife -= this.statLifeMax2 / 7;
if (Lang.lang <= 1)
{
string deathText = " didn't materialize";
if (Main.rand.Next(2) == 0)
{
if (this.Male)
{
deathText = "'s legs appeared where his head should be";
}
else
{
deathText = "'s legs appeared where her head should be";
}
}
if (this.statLife <= 0)
{
this.KillMe(1.0, 0, false, deathText);
}
}
else if (this.statLife <= 0)
{
this.KillMe(1.0, 0, false, "");
}
this.lifeRegenCount = 0;
this.lifeRegenTime = 0;
}
this.AddBuff(88, 360, true);
}
}
}
if (item.type == 29 && this.itemAnimation > 0 && this.statLifeMax < 400 && this.itemTime == 0)
{
this.itemTime = item.useTime;
this.statLifeMax += 20;
this.statLifeMax2 += 20;
this.statLife += 20;
if (Main.myPlayer == this.whoAmI)
{
this.HealEffect(20, true);
}
AchievementsHelper.HandleSpecialEvent(this, 0);
}
if (item.type == 1291 && this.itemAnimation > 0 && this.statLifeMax >= 400 && this.statLifeMax < 500 && this.itemTime == 0)
{
this.itemTime = item.useTime;
this.statLifeMax += 5;
this.statLifeMax2 += 5;
this.statLife += 5;
if (Main.myPlayer == this.whoAmI)
{
this.HealEffect(5, true);
}
AchievementsHelper.HandleSpecialEvent(this, 2);
}
if (item.type == 109 && this.itemAnimation > 0 && this.statManaMax < 200 && this.itemTime == 0)
{
this.itemTime = item.useTime;
this.statManaMax += 20;
this.statManaMax2 += 20;
this.statMana += 20;
if (Main.myPlayer == this.whoAmI)
{
this.ManaEffect(20);
}
AchievementsHelper.HandleSpecialEvent(this, 1);
}
if (item.type == 3335 && this.itemAnimation > 0 && !this.extraAccessory && Main.expertMode && this.itemTime == 0)
{
this.itemTime = item.useTime;
this.extraAccessory = true;
NetMessage.SendData(4, -1, -1, Main.player[this.whoAmI].name, this.whoAmI, 0f, 0f, 0f, 0, 0, 0);
}
this.PlaceThing();
}
if (item.type == 3542)
{
Vector2 vector15 = Main.OffsetsPlayerOnhand[this.bodyFrame.Y / 56] * 2f;
if (this.direction != 1)
{
vector15.X = (float)this.bodyFrame.Width - vector15.X;
}
if (this.gravDir != 1f)
{
vector15.Y = (float)this.bodyFrame.Height - vector15.Y;
}
vector15 -= new Vector2((float)(this.bodyFrame.Width - this.width), (float)(this.bodyFrame.Height - 42)) / 2f;
Vector2 position17 = this.RotatedRelativePoint(this.position + vector15, true) - this.velocity;
for (int num247 = 0; num247 < 4; num247++)
{
Dust dust = Main.dust[Dust.NewDust(base.Center, 0, 0, 242, (float)(this.direction * 2), 0f, 150, default(Color), 1.3f)];
dust.position = position17;
dust.velocity *= 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 = this;
}
}
}
}
if (((item.damage >= 0 && item.type > 0 && !item.noMelee) || item.type == 1450 || item.type == 1991 || item.type == 3183 || item.type == 3542) && this.itemAnimation > 0)
{
bool flag17 = false;
Rectangle r2 = new Rectangle((int)this.itemLocation.X, (int)this.itemLocation.Y, 32, 32);
if (!Main.dedServ)
{
r2 = new Rectangle((int)this.itemLocation.X, (int)this.itemLocation.Y, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height);
}
r2.Width = (int)((float)r2.Width * item.scale);
r2.Height = (int)((float)r2.Height * item.scale);
if (this.direction == -1)
{
r2.X -= r2.Width;
}
if (this.gravDir == 1f)
{
r2.Y -= r2.Height;
}
if (item.useStyle == 1)
{
if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.333)
{
if (this.direction == -1)
{
r2.X -= (int)((double)r2.Width * 1.4 - (double)r2.Width);
}
r2.Width = (int)((double)r2.Width * 1.4);
r2.Y += (int)((double)r2.Height * 0.5 * (double)this.gravDir);
r2.Height = (int)((double)r2.Height * 1.1);
}
else if ((double)this.itemAnimation >= (double)this.itemAnimationMax * 0.666)
{
if (this.direction == 1)
{
r2.X -= (int)((double)r2.Width * 1.2);
}
r2.Width *= 2;
r2.Y -= (int)(((double)r2.Height * 1.4 - (double)r2.Height) * (double)this.gravDir);
r2.Height = (int)((double)r2.Height * 1.4);
}
}
else if (item.useStyle == 3)
{
if ((double)this.itemAnimation > (double)this.itemAnimationMax * 0.666)
{
flag17 = true;
}
else
{
if (this.direction == -1)
{
r2.X -= (int)((double)r2.Width * 1.4 - (double)r2.Width);
}
r2.Width = (int)((double)r2.Width * 1.4);
r2.Y += (int)((double)r2.Height * 0.6);
r2.Height = (int)((double)r2.Height * 0.6);
}
}
float arg_BAF8_0 = this.gravDir;
if (item.type == 1450 && Main.rand.Next(3) == 0)
{
int num248 = -1;
float x5 = (float)(r2.X + Main.rand.Next(r2.Width));
float y5 = (float)(r2.Y + Main.rand.Next(r2.Height));
if (Main.rand.Next(500) == 0)
{
num248 = Gore.NewGore(new Vector2(x5, y5), default(Vector2), 415, (float)Main.rand.Next(51, 101) * 0.01f);
}
else if (Main.rand.Next(250) == 0)
{
num248 = Gore.NewGore(new Vector2(x5, y5), default(Vector2), 414, (float)Main.rand.Next(51, 101) * 0.01f);
}
else if (Main.rand.Next(80) == 0)
{
num248 = Gore.NewGore(new Vector2(x5, y5), default(Vector2), 413, (float)Main.rand.Next(51, 101) * 0.01f);
}
else if (Main.rand.Next(10) == 0)
{
num248 = Gore.NewGore(new Vector2(x5, y5), default(Vector2), 412, (float)Main.rand.Next(51, 101) * 0.01f);
}
else if (Main.rand.Next(3) == 0)
{
num248 = Gore.NewGore(new Vector2(x5, y5), default(Vector2), 411, (float)Main.rand.Next(51, 101) * 0.01f);
}
if (num248 >= 0)
{
Gore expr_BD0A_cp_0 = Main.gore[num248];
expr_BD0A_cp_0.velocity.X = expr_BD0A_cp_0.velocity.X + (float)(this.direction * 2);
Gore expr_BD2E_cp_0 = Main.gore[num248];
expr_BD2E_cp_0.velocity.Y = expr_BD2E_cp_0.velocity.Y * 0.3f;
}
}
if (item.type == 3542)
{
flag17 = true;
}
if (!flag17)
{
if (item.type == 989 && Main.rand.Next(5) == 0)
{
int num249 = Main.rand.Next(3);
if (num249 == 0)
{
num249 = 15;
}
else if (num249 == 1)
{
num249 = 57;
}
else
{
num249 = 58;
}
int num250 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, num249, (float)(this.direction * 2), 0f, 150, default(Color), 1.3f);
Main.dust[num250].velocity *= 0.2f;
}
if (item.type == 2880 && Main.rand.Next(2) == 0)
{
int type5 = Utils.SelectRandom<int>(Main.rand, new int[]
{
226,
229
});
int num251 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, type5, (float)(this.direction * 2), 0f, 150, default(Color), 1f);
Main.dust[num251].velocity *= 0.2f;
Main.dust[num251].noGravity = true;
}
if ((item.type == 44 || item.type == 45 || item.type == 46 || item.type == 103 || item.type == 104) && Main.rand.Next(15) == 0)
{
Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 14, (float)(this.direction * 2), 0f, 150, default(Color), 1.3f);
}
if (item.type == 273 || item.type == 675)
{
if (Main.rand.Next(5) == 0)
{
Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 14, (float)(this.direction * 2), 0f, 150, default(Color), 1.4f);
}
int num252 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 27, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 1.2f);
Main.dust[num252].noGravity = true;
Dust expr_C0BA_cp_0 = Main.dust[num252];
expr_C0BA_cp_0.velocity.X = expr_C0BA_cp_0.velocity.X / 2f;
Dust expr_C0DA_cp_0 = Main.dust[num252];
expr_C0DA_cp_0.velocity.Y = expr_C0DA_cp_0.velocity.Y / 2f;
}
if (item.type == 723 && Main.rand.Next(2) == 0)
{
int num253 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 64, 0f, 0f, 150, default(Color), 1.2f);
Main.dust[num253].noGravity = true;
}
if (item.type == 65)
{
if (Main.rand.Next(5) == 0)
{
Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 58, 0f, 0f, 150, default(Color), 1.2f);
}
if (Main.rand.Next(10) == 0)
{
Gore.NewGore(new Vector2((float)r2.X, (float)r2.Y), default(Vector2), Main.rand.Next(16, 18), 1f);
}
}
if (item.type == 3065)
{
int num254 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 58, 0f, 0f, 150, default(Color), 1.2f);
Main.dust[num254].velocity *= 0.5f;
if (Main.rand.Next(8) == 0)
{
int num255 = Gore.NewGore(new Vector2((float)r2.Center.X, (float)r2.Center.Y), default(Vector2), 16, 1f);
Main.gore[num255].velocity *= 0.5f;
Main.gore[num255].velocity += new Vector2((float)this.direction, 0f);
}
}
if (item.type == 190)
{
int num256 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 40, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 0, default(Color), 1.2f);
Main.dust[num256].noGravity = true;
}
else if (item.type == 213)
{
int num257 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 3, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 0, default(Color), 1.2f);
Main.dust[num257].noGravity = true;
}
if (item.type == 121)
{
for (int num258 = 0; num258 < 2; num258++)
{
int num259 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f);
Main.dust[num259].noGravity = true;
Dust expr_C528_cp_0 = Main.dust[num259];
expr_C528_cp_0.velocity.X = expr_C528_cp_0.velocity.X * 2f;
Dust expr_C548_cp_0 = Main.dust[num259];
expr_C548_cp_0.velocity.Y = expr_C548_cp_0.velocity.Y * 2f;
}
}
if (item.type == 122 || item.type == 217)
{
int num260 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 1.9f);
Main.dust[num260].noGravity = true;
}
if (item.type == 155)
{
int num261 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 172, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 0.9f);
Main.dust[num261].noGravity = true;
Main.dust[num261].velocity *= 0.1f;
}
if (item.type == 676 && Main.rand.Next(3) == 0)
{
int num262 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 67, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 90, default(Color), 1.5f);
Main.dust[num262].noGravity = true;
Main.dust[num262].velocity *= 0.2f;
}
if (item.type == 3063)
{
int num263 = Dust.NewDust(r2.TopLeft(), r2.Width, r2.Height, 66, 0f, 0f, 150, Color.Transparent, 0.85f);
Main.dust[num263].color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f);
Main.dust[num263].noGravity = true;
Main.dust[num263].velocity /= 2f;
}
if (item.type == 724 && Main.rand.Next(5) == 0)
{
int num264 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 67, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 90, default(Color), 1.5f);
Main.dust[num264].noGravity = true;
Main.dust[num264].velocity *= 0.2f;
}
if (item.type >= 795 && item.type <= 802 && Main.rand.Next(3) == 0)
{
int num265 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 115, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 140, default(Color), 1.5f);
Main.dust[num265].noGravity = true;
Main.dust[num265].velocity *= 0.25f;
}
if (item.type == 367 || item.type == 368 || item.type == 674)
{
if (Main.rand.Next(3) == 0)
{
int num266 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 57, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 1.1f);
Main.dust[num266].noGravity = true;
Dust expr_CAA6_cp_0 = Main.dust[num266];
expr_CAA6_cp_0.velocity.X = expr_CAA6_cp_0.velocity.X / 2f;
Dust expr_CAC6_cp_0 = Main.dust[num266];
expr_CAC6_cp_0.velocity.Y = expr_CAC6_cp_0.velocity.Y / 2f;
Dust expr_CAE6_cp_0 = Main.dust[num266];
expr_CAE6_cp_0.velocity.X = expr_CAE6_cp_0.velocity.X + (float)(this.direction * 2);
}
if (Main.rand.Next(4) == 0)
{
int num266 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 43, 0f, 0f, 254, default(Color), 0.3f);
Main.dust[num266].velocity *= 0f;
}
}
if (item.type >= 198 && item.type <= 203)
{
float num267 = 0.5f;
float num268 = 0.5f;
float num269 = 0.5f;
if (item.type == 198)
{
num267 *= 0.1f;
num268 *= 0.5f;
num269 *= 1.2f;
}
else if (item.type == 199)
{
num267 *= 1f;
num268 *= 0.2f;
num269 *= 0.1f;
}
else if (item.type == 200)
{
num267 *= 0.1f;
num268 *= 1f;
num269 *= 0.2f;
}
else if (item.type == 201)
{
num267 *= 0.8f;
num268 *= 0.1f;
num269 *= 1f;
}
else if (item.type == 202)
{
num267 *= 0.8f;
num268 *= 0.9f;
num269 *= 1f;
}
else if (item.type == 203)
{
num267 *= 0.9f;
num268 *= 0.9f;
num269 *= 0.1f;
}
Lighting.AddLight((int)((this.itemLocation.X + 6f + this.velocity.X) / 16f), (int)((this.itemLocation.Y - 14f) / 16f), num267, num268, num269);
}
if (this.frostBurn && item.melee && !item.noMelee && !item.noUseGraphic && Main.rand.Next(2) == 0)
{
int num270 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 135, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f);
Main.dust[num270].noGravity = true;
Main.dust[num270].velocity *= 0.7f;
Dust expr_CE58_cp_0 = Main.dust[num270];
expr_CE58_cp_0.velocity.Y = expr_CE58_cp_0.velocity.Y - 0.5f;
}
if (item.melee && !item.noMelee && !item.noUseGraphic && this.meleeEnchant > 0)
{
if (this.meleeEnchant == 1)
{
if (Main.rand.Next(3) == 0)
{
int num271 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 171, 0f, 0f, 100, default(Color), 1f);
Main.dust[num271].noGravity = true;
Main.dust[num271].fadeIn = 1.5f;
Main.dust[num271].velocity *= 0.25f;
}
}
else if (this.meleeEnchant == 2)
{
if (Main.rand.Next(2) == 0)
{
int num272 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 75, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f);
Main.dust[num272].noGravity = true;
Main.dust[num272].velocity *= 0.7f;
Dust expr_D023_cp_0 = Main.dust[num272];
expr_D023_cp_0.velocity.Y = expr_D023_cp_0.velocity.Y - 0.5f;
}
}
else if (this.meleeEnchant == 3)
{
if (Main.rand.Next(2) == 0)
{
int num273 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f);
Main.dust[num273].noGravity = true;
Main.dust[num273].velocity *= 0.7f;
Dust expr_D109_cp_0 = Main.dust[num273];
expr_D109_cp_0.velocity.Y = expr_D109_cp_0.velocity.Y - 0.5f;
}
}
else if (this.meleeEnchant == 4)
{
if (Main.rand.Next(2) == 0)
{
int num274 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 57, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 1.1f);
Main.dust[num274].noGravity = true;
Dust expr_D1D6_cp_0 = Main.dust[num274];
expr_D1D6_cp_0.velocity.X = expr_D1D6_cp_0.velocity.X / 2f;
Dust expr_D1F6_cp_0 = Main.dust[num274];
expr_D1F6_cp_0.velocity.Y = expr_D1F6_cp_0.velocity.Y / 2f;
}
}
else if (this.meleeEnchant == 5)
{
if (Main.rand.Next(2) == 0)
{
int num275 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 169, 0f, 0f, 100, default(Color), 1f);
Dust expr_D28F_cp_0 = Main.dust[num275];
expr_D28F_cp_0.velocity.X = expr_D28F_cp_0.velocity.X + (float)this.direction;
Dust expr_D2B1_cp_0 = Main.dust[num275];
expr_D2B1_cp_0.velocity.Y = expr_D2B1_cp_0.velocity.Y + 0.2f;
Main.dust[num275].noGravity = true;
}
}
else if (this.meleeEnchant == 6)
{
if (Main.rand.Next(2) == 0)
{
int num276 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 135, 0f, 0f, 100, default(Color), 1f);
Dust expr_D35A_cp_0 = Main.dust[num276];
expr_D35A_cp_0.velocity.X = expr_D35A_cp_0.velocity.X + (float)this.direction;
Dust expr_D37C_cp_0 = Main.dust[num276];
expr_D37C_cp_0.velocity.Y = expr_D37C_cp_0.velocity.Y + 0.2f;
Main.dust[num276].noGravity = true;
}
}
else if (this.meleeEnchant == 7)
{
if (Main.rand.Next(20) == 0)
{
int type6 = Main.rand.Next(139, 143);
int num277 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, type6, this.velocity.X, this.velocity.Y, 0, default(Color), 1.2f);
Dust expr_D448_cp_0 = Main.dust[num277];
expr_D448_cp_0.velocity.X = expr_D448_cp_0.velocity.X * (1f + (float)Main.rand.Next(-50, 51) * 0.01f);
Dust expr_D47E_cp_0 = Main.dust[num277];
expr_D47E_cp_0.velocity.Y = expr_D47E_cp_0.velocity.Y * (1f + (float)Main.rand.Next(-50, 51) * 0.01f);
Dust expr_D4B4_cp_0 = Main.dust[num277];
expr_D4B4_cp_0.velocity.X = expr_D4B4_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f;
Dust expr_D4E4_cp_0 = Main.dust[num277];
expr_D4E4_cp_0.velocity.Y = expr_D4E4_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f;
Main.dust[num277].scale *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
}
if (Main.rand.Next(40) == 0)
{
int type7 = Main.rand.Next(276, 283);
int num278 = Gore.NewGore(new Vector2((float)r2.X, (float)r2.Y), this.velocity, type7, 1f);
Gore expr_D59F_cp_0 = Main.gore[num278];
expr_D59F_cp_0.velocity.X = expr_D59F_cp_0.velocity.X * (1f + (float)Main.rand.Next(-50, 51) * 0.01f);
Gore expr_D5D5_cp_0 = Main.gore[num278];
expr_D5D5_cp_0.velocity.Y = expr_D5D5_cp_0.velocity.Y * (1f + (float)Main.rand.Next(-50, 51) * 0.01f);
Main.gore[num278].scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
Gore expr_D63C_cp_0 = Main.gore[num278];
expr_D63C_cp_0.velocity.X = expr_D63C_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f;
Gore expr_D66C_cp_0 = Main.gore[num278];
expr_D66C_cp_0.velocity.Y = expr_D66C_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f;
}
}
else if (this.meleeEnchant == 8 && Main.rand.Next(4) == 0)
{
int num279 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 46, 0f, 0f, 100, default(Color), 1f);
Main.dust[num279].noGravity = true;
Main.dust[num279].fadeIn = 1.5f;
Main.dust[num279].velocity *= 0.25f;
}
}
if (this.magmaStone && item.melee && !item.noMelee && !item.noUseGraphic && Main.rand.Next(3) != 0)
{
int num280 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f);
Main.dust[num280].noGravity = true;
Dust expr_D817_cp_0 = Main.dust[num280];
expr_D817_cp_0.velocity.X = expr_D817_cp_0.velocity.X * 2f;
Dust expr_D837_cp_0 = Main.dust[num280];
expr_D837_cp_0.velocity.Y = expr_D837_cp_0.velocity.Y * 2f;
}
if (Main.myPlayer == i && (item.type == 1991 || item.type == 3183))
{
for (int num281 = 0; num281 < 200; num281++)
{
if (Main.npc[num281].active && Main.npc[num281].catchItem > 0)
{
Rectangle value11 = new Rectangle((int)Main.npc[num281].position.X, (int)Main.npc[num281].position.Y, Main.npc[num281].width, Main.npc[num281].height);
if (r2.Intersects(value11) && (item.type == 3183 || Main.npc[num281].noTileCollide || Collision.CanHit(this.position, this.width, this.height, Main.npc[num281].position, Main.npc[num281].width, Main.npc[num281].height)))
{
NPC.CatchNPC(num281, i);
}
}
}
}
if (Main.myPlayer == i && (item.damage > 0 || item.type == 3183))
{
int num282 = (int)((float)item.damage * this.meleeDamage);
float num283 = item.knockBack;
float num284 = 1f;
if (this.kbGlove)
{
num284 += 1f;
}
if (this.kbBuff)
{
num284 += 0.5f;
}
num283 *= num284;
if (this.inventory[this.selectedItem].type == 3106)
{
num283 += num283 * (1f - this.stealth);
}
List<ushort> list2 = null;
int type8 = item.type;
if (type8 == 213)
{
list2 = new List<ushort>(new ushort[]
{
3,
24,
52,
61,
62,
71,
73,
74,
82,
83,
84,
110,
113,
115,
184,
205,
201
});
}
int num285 = r2.X / 16;
int num286 = (r2.X + r2.Width) / 16 + 1;
int num287 = r2.Y / 16;
int num288 = (r2.Y + r2.Height) / 16 + 1;
for (int num289 = num285; num289 < num286; num289++)
{
for (int num290 = num287; num290 < num288; num290++)
{
if (Main.tile[num289, num290] != null && Main.tileCut[(int)Main.tile[num289, num290].type] && (list2 == null || !list2.Contains(Main.tile[num289, num290].type)) && Main.tile[num289, num290 + 1] != null && Main.tile[num289, num290 + 1].type != 78 && Main.tile[num289, num290 + 1].type != 380)
{
if (item.type == 1786)
{
int type9 = (int)Main.tile[num289, num290].type;
WorldGen.KillTile(num289, num290, false, false, false);
if (!Main.tile[num289, num290].active())
{
int num291 = 0;
if (type9 == 3 || type9 == 24 || type9 == 61 || type9 == 110 || type9 == 201)
{
num291 = Main.rand.Next(1, 3);
}
if (type9 == 73 || type9 == 74 || type9 == 113)
{
num291 = Main.rand.Next(2, 5);
}
if (num291 > 0)
{
int number = Item.NewItem(num289 * 16, num290 * 16, 16, 16, 1727, num291, false, 0, false);
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", number, 1f, 0f, 0f, 0, 0, 0);
}
}
}
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 0, (float)num289, (float)num290, 0f, 0, 0, 0);
}
}
else
{
WorldGen.KillTile(num289, num290, false, false, false);
if (Main.netMode == 1)
{
NetMessage.SendData(17, -1, -1, "", 0, (float)num289, (float)num290, 0f, 0, 0, 0);
}
}
}
}
}
if (item.type != 3183)
{
for (int num292 = 0; num292 < 200; num292++)
{
if (Main.npc[num292].active && Main.npc[num292].immune[i] == 0 && this.attackCD == 0)
{
if (!Main.npc[num292].dontTakeDamage)
{
if (!Main.npc[num292].friendly || (Main.npc[num292].type == 22 && this.killGuide) || (Main.npc[num292].type == 54 && this.killClothier))
{
Rectangle value12 = new Rectangle((int)Main.npc[num292].position.X, (int)Main.npc[num292].position.Y, Main.npc[num292].width, Main.npc[num292].height);
if (r2.Intersects(value12) && (Main.npc[num292].noTileCollide || Collision.CanHit(this.position, this.width, this.height, Main.npc[num292].position, Main.npc[num292].width, Main.npc[num292].height)))
{
bool flag18 = false;
if (Main.rand.Next(1, 101) <= this.meleeCrit)
{
flag18 = true;
}
int num293 = Main.DamageVar((float)num282);
int num294 = Item.NPCtoBanner(Main.npc[num292].BannerID());
if (num294 > 0 && this.NPCBannerBuff[num294])
{
if (Main.expertMode)
{
num282 *= 2;
}
else
{
num282 = (int)((double)num282 * 1.5);
}
}
this.StatusNPC(item.type, num292);
this.OnHit(Main.npc[num292].Center.X, Main.npc[num292].Center.Y, Main.npc[num292]);
if (this.armorPenetration > 0)
{
num293 += Main.npc[num292].checkArmorPenetration(this.armorPenetration);
}
int num295 = (int)Main.npc[num292].StrikeNPC(num293, num283, this.direction, flag18, false, false);
if (this.inventory[this.selectedItem].type == 3211)
{
Vector2 value13 = new Vector2((float)(this.direction * 100 + Main.rand.Next(-25, 26)), (float)Main.rand.Next(-75, 76));
value13.Normalize();
value13 *= (float)Main.rand.Next(30, 41) * 0.1f;
Vector2 value14 = new Vector2((float)(r2.X + Main.rand.Next(r2.Width)), (float)(r2.Y + Main.rand.Next(r2.Height)));
value14 = (value14 + Main.npc[num292].Center * 2f) / 3f;
Projectile.NewProjectile(value14.X, value14.Y, value13.X, value13.Y, 524, (int)((double)num282 * 0.7), num283 * 0.7f, this.whoAmI, 0f, 0f);
}
if (this.beetleOffense)
{
this.beetleCounter += (float)num295;
this.beetleCountdown = 0;
}
if (item.type == 1826 && Main.npc[num292].value > 0f)
{
this.pumpkinSword(num292, (int)((double)num282 * 1.5), num283);
}
if (this.meleeEnchant == 7)
{
Projectile.NewProjectile(Main.npc[num292].Center.X, Main.npc[num292].Center.Y, Main.npc[num292].velocity.X, Main.npc[num292].velocity.Y, 289, 0, 0f, this.whoAmI, 0f, 0f);
}
if (this.inventory[this.selectedItem].type == 3106)
{
this.stealth = 1f;
if (Main.netMode == 1)
{
NetMessage.SendData(84, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0);
}
}
if (item.type == 1123)
{
int num296 = Main.rand.Next(1, 4);
if (this.strongBees && Main.rand.Next(3) == 0)
{
num296++;
}
for (int num297 = 0; num297 < num296; num297++)
{
float num298 = (float)(this.direction * 2) + (float)Main.rand.Next(-35, 36) * 0.02f;
float num299 = (float)Main.rand.Next(-35, 36) * 0.02f;
num298 *= 0.2f;
num299 *= 0.2f;
Projectile.NewProjectile((float)(r2.X + r2.Width / 2), (float)(r2.Y + r2.Height / 2), num298, num299, this.beeType(), this.beeDamage(num293 / 3), this.beeKB(0f), i, 0f, 0f);
}
}
if (Main.npc[num292].value > 0f && this.coins && Main.rand.Next(5) == 0)
{
int type10 = 71;
if (Main.rand.Next(10) == 0)
{
type10 = 72;
}
if (Main.rand.Next(100) == 0)
{
type10 = 73;
}
int num300 = Item.NewItem((int)Main.npc[num292].position.X, (int)Main.npc[num292].position.Y, Main.npc[num292].width, Main.npc[num292].height, type10, 1, false, 0, false);
Main.item[num300].stack = Main.rand.Next(1, 11);
Main.item[num300].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f;
Main.item[num300].velocity.X = (float)Main.rand.Next(10, 31) * 0.2f * (float)this.direction;
if (Main.netMode == 1)
{
NetMessage.SendData(21, -1, -1, "", num300, 0f, 0f, 0f, 0, 0, 0);
}
}
int num301 = Item.NPCtoBanner(Main.npc[num292].BannerID());
if (num301 >= 0)
{
this.lastCreatureHit = num301;
}
if (Main.netMode != 0)
{
if (flag18)
{
NetMessage.SendData(28, -1, -1, "", num292, (float)num293, num283, (float)this.direction, 1, 0, 0);
}
else
{
NetMessage.SendData(28, -1, -1, "", num292, (float)num293, num283, (float)this.direction, 0, 0, 0);
}
}
if (this.accDreamCatcher)
{
this.addDPS(num293);
}
Main.npc[num292].immune[i] = this.itemAnimation;
this.attackCD = (int)((double)this.itemAnimationMax * 0.33);
}
}
}
else if (Main.npc[num292].type == 63 || Main.npc[num292].type == 64 || Main.npc[num292].type == 103 || Main.npc[num292].type == 242)
{
Rectangle value15 = new Rectangle((int)Main.npc[num292].position.X, (int)Main.npc[num292].position.Y, Main.npc[num292].width, Main.npc[num292].height);
if (r2.Intersects(value15))
{
this.Hurt((int)((double)Main.npc[num292].damage * 1.3), -this.direction, false, false, " was slain...", false);
Main.npc[num292].immune[i] = this.itemAnimation;
this.attackCD = (int)((double)this.itemAnimationMax * 0.33);
}
}
}
}
if (this.hostile)
{
for (int num302 = 0; num302 < 255; num302++)
{
if (num302 != i && Main.player[num302].active && Main.player[num302].hostile && !Main.player[num302].immune && !Main.player[num302].dead && (Main.player[i].team == 0 || Main.player[i].team != Main.player[num302].team))
{
Rectangle value16 = new Rectangle((int)Main.player[num302].position.X, (int)Main.player[num302].position.Y, Main.player[num302].width, Main.player[num302].height);
if (r2.Intersects(value16) && Collision.CanHit(this.position, this.width, this.height, Main.player[num302].position, Main.player[num302].width, Main.player[num302].height))
{
bool flag19 = false;
if (Main.rand.Next(1, 101) <= 10)
{
flag19 = true;
}
int num303 = Main.DamageVar((float)num282);
this.StatusPvP(item.type, num302);
this.OnHit(Main.player[num302].Center.X, Main.player[num302].Center.Y, Main.player[num302]);
int num304 = (int)Main.player[num302].Hurt(num303, this.direction, true, false, "", flag19);
if (this.inventory[this.selectedItem].type == 3211)
{
Vector2 value17 = new Vector2((float)(this.direction * 100 + Main.rand.Next(-25, 26)), (float)Main.rand.Next(-75, 76));
value17.Normalize();
value17 *= (float)Main.rand.Next(30, 41) * 0.1f;
Vector2 value18 = new Vector2((float)(r2.X + Main.rand.Next(r2.Width)), (float)(r2.Y + Main.rand.Next(r2.Height)));
value18 = (value18 + Main.player[num302].Center * 2f) / 3f;
Projectile.NewProjectile(value18.X, value18.Y, value17.X, value17.Y, 524, (int)((double)num282 * 0.7), num283 * 0.7f, this.whoAmI, 0f, 0f);
}
if (this.beetleOffense)
{
this.beetleCounter += (float)num304;
this.beetleCountdown = 0;
}
if (this.meleeEnchant == 7)
{
Projectile.NewProjectile(Main.player[num302].Center.X, Main.player[num302].Center.Y, Main.player[num302].velocity.X, Main.player[num302].velocity.Y, 289, 0, 0f, this.whoAmI, 0f, 0f);
}
if (item.type == 1123)
{
int num305 = Main.rand.Next(1, 4);
if (this.strongBees && Main.rand.Next(3) == 0)
{
num305++;
}
for (int num306 = 0; num306 < num305; num306++)
{
floa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment