private void Constructor(Tile copy = null) { if (copy == null) { type = (ushort)0; wall = (byte)0; liquid = (byte)0; sTileHeader = (short)0; bTileHeader = (byte)0; bTileHeader2 = (byte)0; bTileHeader3 = (byte)0; frameX = (short)0; frameY = (short)0; k_wireFlags = k_WireFlags.WIRE_NONE; } else { type = copy.type; wall = copy.wall; liquid = copy.liquid; sTileHeader = copy.sTileHeader; bTileHeader = copy.bTileHeader; bTileHeader2 = copy.bTileHeader2; bTileHeader3 = copy.bTileHeader3; frameX = copy.frameX; frameY = copy.frameY; k_wireFlags = copy.k_wireFlags; } }
public void k_SetWireFlags(k_WireFlags flags, bool state) { if (state) { k_wireFlags |= flags; } else { k_wireFlags &= ~flags; } }
public static int k_HACK_GetNetworkWirePlaceType(k_WireFlags flag) { switch (flag) { case k_WireFlags.WIRE_RED: return(5); case k_WireFlags.WIRE_ACTUATOR: return(8); case k_WireFlags.WIRE_GREEN: return(10); case k_WireFlags.WIRE_BLUE: return(12); } return(-1); }
public static int k_HACK_GetNetworkWireKillType(k_WireFlags flag) { switch (flag) { case k_WireFlags.WIRE_RED: return(6); case k_WireFlags.WIRE_ACTUATOR: return(9); case k_WireFlags.WIRE_GREEN: return(11); case k_WireFlags.WIRE_BLUE: return(13); } return(-1); }
public void k_Constructor(Tile copy) { if (copy == null) { k_block = null; k_wall_protoID = 0; k_wall_variant = 0; k_wall_colourID = 0; k_liquid_protoID = 0; k_liquid_amount = 0; k_wireFlags = 0; } else { k_block = copy.k_block.Copy(); k_wall_protoID = copy.k_wall_protoID; k_wall_variant = copy.k_wall_variant; k_wall_colourID = copy.k_wall_colourID; k_liquid_protoID = copy.k_liquid_protoID; k_liquid_amount = copy.k_liquid_amount; k_wireFlags = copy.k_wireFlags; } }
public static int k_HACK_GetNetworkWireKillType(k_WireFlags flag) { switch (flag) { case k_WireFlags.WIRE_RED: return 6; case k_WireFlags.WIRE_ACTUATOR: return 9; case k_WireFlags.WIRE_GREEN: return 11; case k_WireFlags.WIRE_BLUE: return 13; } return -1; }
public static int k_HACK_GetNetworkWirePlaceType(k_WireFlags flag) { switch (flag) { case k_WireFlags.WIRE_RED: return 5; case k_WireFlags.WIRE_ACTUATOR: return 8; case k_WireFlags.WIRE_GREEN: return 10; case k_WireFlags.WIRE_BLUE: return 12; } return -1; }
public void k_KillWireFlags() { k_wireFlags = k_WireFlags.WIRE_NONE; }
public bool k_HasWireFlagsAny(k_WireFlags flags) { return (k_wireFlags & flags) != 0; }
public bool k_HasWireFlags(k_WireFlags flags) { return (k_wireFlags & flags) == flags; }
public void k_SetWireFlags(k_WireFlags flags, bool state) { if (state) k_wireFlags |= flags; else k_wireFlags &= ~flags; }
public bool k_HasWireFlagsAny(k_WireFlags flags) { return((k_wireFlags & flags) != 0); }
public bool k_HasWireFlags(k_WireFlags flags) { return((k_wireFlags & flags) == flags); }
public void ItemCheck(int i) { if (this.webbed || this.frozen || this.stoned) return; bool flag1 = false; float num1 = 5E-06f; float num2 = (float)this.mount.PlayerOffsetHitbox; Item sItem = this.inventory[this.selectedItem]; if (this.mount.Active) { if (this.mount.Type == 8) { this.noItems = true; if (this.controlUseItem) { this.channel = true; if (this.releaseUseItem) this.mount.UseAbility(this, Vector2.Zero, true); this.releaseUseItem = false; } } if (this.whoAmI == Main.myPlayer && (double)this.gravDir == -1.0) this.mount.Dismount(this); } int num3 = sItem.damage; if (num3 > 0) { if (sItem.melee) num3 = (int)((double)num3 * (double)this.meleeDamage + (double)num1); else if (sItem.ranged) { num3 = (int)((double)num3 * (double)this.rangedDamage + (double)num1); if (sItem.useAmmo == 1 || sItem.useAmmo == 323) num3 = (int)((double)num3 * (double)this.arrowDamage + (double)num1); if (sItem.useAmmo == 14 || sItem.useAmmo == 311) num3 = (int)((double)num3 * (double)this.bulletDamage + (double)num1); if (sItem.useAmmo == 771 || sItem.useAmmo == 246 || (sItem.useAmmo == 312 || sItem.useAmmo == 514)) num3 = (int)((double)num3 * (double)this.rocketDamage + (double)num1); } else if (sItem.thrown) num3 = (int)((double)num3 * (double)this.thrownDamage + (double)num1); else if (sItem.magic) num3 = (int)((double)num3 * (double)this.magicDamage + (double)num1); } if (sItem.autoReuse && !this.noItems) { this.releaseUseItem = true; if (this.itemAnimation == 1 && sItem.stack > 0) { if (sItem.shoot > 0 && this.whoAmI != Main.myPlayer && (this.controlUseItem && sItem.useStyle == 5)) { this.ApplyAnimation(sItem); if (sItem.useSound > 0) Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, sItem.useSound); } else this.itemAnimation = 0; } } if (sItem.fishingPole > 0) { sItem.holdStyle = 0; if (this.itemTime == 0 && this.itemAnimation == 0) { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == this.whoAmI && Main.projectile[index].bobber) sItem.holdStyle = 1; } } } if (this.itemAnimation == 0 && this.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 && (sItem.headSlot > 0 || sItem.bodySlot > 0 || sItem.legSlot > 0)) { if (sItem.useStyle == 0) this.releaseUseItem = false; if ((double)this.position.X / 16.0 - (double)Player.tileRangeX - (double)sItem.tileBoost <= (double)Player.tileTargetX && ((double)this.position.X + (double)this.width) / 16.0 + (double)Player.tileRangeX + (double)sItem.tileBoost - 1.0 >= (double)Player.tileTargetX && ((double)this.position.Y / 16.0 - (double)Player.tileRangeY - (double)sItem.tileBoost <= (double)Player.tileTargetY && ((double)this.position.Y + (double)this.height) / 16.0 + (double)Player.tileRangeY + (double)sItem.tileBoost - 2.0 >= (double)Player.tileTargetY)) { int index1 = Player.tileTargetX; int index2 = Player.tileTargetY; if (Main.tile[index1, index2].active() && ((int)Main.tile[index1, index2].type == 128 || (int)Main.tile[index1, index2].type == 269)) { int num4 = (int)Main.tile[index1, index2].frameY; int num5 = 0; if (sItem.bodySlot >= 0) num5 = 1; if (sItem.legSlot >= 0) num5 = 2; int num6; for (num6 = num4 / 18; num5 > num6; num6 = (int)Main.tile[index1, index2].frameY / 18) ++index2; for (; num5 < num6; num6 = (int)Main.tile[index1, index2].frameY / 18) --index2; int num7 = (int)Main.tile[index1, index2].frameX; while (num7 >= 100) num7 -= 100; if (num7 >= 36) num7 -= 36; int index3 = index1 - num7 / 18; int num8 = (int)Main.tile[index3, index2].frameX; WorldGen.KillTile(index3, index2, true, false, false); if (Main.netMode == 1) NetMessage.SendData(17, -1, -1, "", 0, (float)index3, (float)index2, 1f, 0, 0, 0); while (num8 >= 100) num8 -= 100; if (num6 == 0 && sItem.headSlot >= 0) { Main.blockMouse = true; Main.tile[index3, index2].frameX = (short)(num8 + sItem.headSlot * 100); if (Main.netMode == 1) NetMessage.SendTileSquare(-1, index3, index2, 1); --sItem.stack; if (sItem.stack <= 0) { sItem.SetDefaults(0, false); Main.mouseItem.SetDefaults(0, false); } if (this.selectedItem == 58) Main.mouseItem = sItem.Clone(); this.releaseUseItem = false; this.mouseInterface = true; } else if (num6 == 1 && sItem.bodySlot >= 0) { Main.blockMouse = true; Main.tile[index3, index2].frameX = (short)(num8 + sItem.bodySlot * 100); if (Main.netMode == 1) NetMessage.SendTileSquare(-1, index3, index2, 1); --sItem.stack; if (sItem.stack <= 0) { sItem.SetDefaults(0, false); Main.mouseItem.SetDefaults(0, false); } if (this.selectedItem == 58) Main.mouseItem = sItem.Clone(); this.releaseUseItem = false; this.mouseInterface = true; } else if (num6 == 2 && sItem.legSlot >= 0) { Main.blockMouse = true; Main.tile[index3, index2].frameX = (short)(num8 + sItem.legSlot * 100); if (Main.netMode == 1) NetMessage.SendTileSquare(-1, index3, index2, 1); --sItem.stack; if (sItem.stack <= 0) { sItem.SetDefaults(0, false); Main.mouseItem.SetDefaults(0, false); } if (this.selectedItem == 58) Main.mouseItem = sItem.Clone(); this.releaseUseItem = false; this.mouseInterface = true; } } } } if (Main.myPlayer == i && this.itemAnimation == 0 && TileObjectData.CustomPlace(sItem.createTile, sItem.placeStyle)) { TileObject objectData; TileObject.CanPlace(Player.tileTargetX, Player.tileTargetY, sItem.createTile, sItem.placeStyle, this.direction, out objectData, true); } if (this.controlUseItem && this.itemAnimation == 0 && (this.releaseUseItem && sItem.useStyle > 0)) { if (this.altFunctionUse == 1) this.altFunctionUse = 2; bool canUse = true; if (sItem.shoot == 0) this.itemRotation = 0.0f; if (sItem.itemId == 3335 && (this.extraAccessory || !Main.expertMode)) canUse = false; if (this.pulley && sItem.fishingPole > 0) canUse = false; if (this.wet && (sItem.shoot == 85 || sItem.shoot == 15 || sItem.shoot == 34)) canUse = false; if ((int)sItem.makeNPC > 0 && !NPC.CanReleaseNPCs(this.whoAmI)) canUse = false; if (this.whoAmI == Main.myPlayer && sItem.itemId == 603 && !Main.cEd) canUse = false; if (sItem.itemId == 1071 || sItem.itemId == 1072) { bool flag2 = false; for (int index = 0; index < 58; ++index) { if ((int)this.inventory[index].paint > 0) { flag2 = true; break; } } if (!flag2) canUse = false; } if (this.noItems) canUse = false; if (sItem.tileWand > 0) { int num4 = sItem.tileWand; canUse = false; for (int index = 0; index < 58; ++index) { if (num4 == this.inventory[index].itemId && this.inventory[index].stack > 0) { canUse = true; break; } } } if (sItem.fishingPole > 0) { for (int index1 = 0; index1 < 1000; ++index1) { if (Main.projectile[index1].active && Main.projectile[index1].owner == this.whoAmI && Main.projectile[index1].bobber) { canUse = false; if (this.whoAmI == Main.myPlayer && (double)Main.projectile[index1].ai[0] == 0.0) { Main.projectile[index1].ai[0] = 1f; float num4 = -10f; if (Main.projectile[index1].wet && (double)Main.projectile[index1].velocity.Y > (double)num4) Main.projectile[index1].velocity.Y = num4; Main.projectile[index1].netUpdate2 = true; if ((double)Main.projectile[index1].ai[1] < 0.0 && (double)Main.projectile[index1].localAI[1] != 0.0) { bool flag2 = false; int num5 = 0; for (int index2 = 0; index2 < 58; ++index2) { if (this.inventory[index2].stack > 0 && this.inventory[index2].bait > 0) { bool flag3 = false; int maxValue = 1 + this.inventory[index2].bait / 5; if (maxValue < 1) maxValue = 1; if (this.accTackleBox) ++maxValue; if (Main.rand.Next(maxValue) == 0) flag3 = true; if ((double)Main.projectile[index1].localAI[1] < 0.0) flag3 = true; if ((double)Main.projectile[index1].localAI[1] > 0.0) { Item obj = new Item(); obj.SetDefaults((int)Main.projectile[index1].localAI[1], false); if (obj.rare < 0) flag3 = false; } if (flag3) { num5 = this.inventory[index2].itemId; --this.inventory[index2].stack; if (this.inventory[index2].stack <= 0) this.inventory[index2].SetDefaults(0, false); } flag2 = true; break; } } if (flag2) { if (num5 == 2673) { if (Main.netMode != 1) NPC.SpawnOnPlayer(this.whoAmI, 370); else NetMessage.SendData(61, -1, -1, "", this.whoAmI, 370f, 0.0f, 0.0f, 0, 0, 0); Main.projectile[index1].ai[0] = 2f; } else if (Main.rand.Next(7) == 0 && !this.accFishingLine) Main.projectile[index1].ai[0] = 2f; else Main.projectile[index1].ai[1] = Main.projectile[index1].localAI[1]; Main.projectile[index1].netUpdate = true; } } } } } } if (sItem.shoot == 6 || sItem.shoot == 19 || (sItem.shoot == 33 || sItem.shoot == 52) || (sItem.shoot == 113 || sItem.shoot == 320 || (sItem.shoot == 333 || sItem.shoot == 383)) || sItem.shoot == 491) { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && Main.projectile[index].type == sItem.shoot) canUse = false; } } if (sItem.shoot == 106) { int num4 = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && Main.projectile[index].type == sItem.shoot) ++num4; } if (num4 >= sItem.stack) canUse = false; } if (sItem.shoot == 272) { int num4 = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && Main.projectile[index].type == sItem.shoot) ++num4; } if (num4 >= sItem.stack) canUse = false; } if (sItem.shoot == 13 || sItem.shoot == 32 || sItem.shoot >= 230 && sItem.shoot <= 235 || (sItem.shoot == 315 || sItem.shoot == 331 || sItem.shoot == 372)) { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && (Main.projectile[index].type == sItem.shoot && (double)Main.projectile[index].ai[0] != 2.0)) canUse = false; } } if (sItem.shoot == 332) { int num4 = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == Main.myPlayer && (Main.projectile[index].type == sItem.shoot && (double)Main.projectile[index].ai[0] != 2.0)) ++num4; } if (num4 >= 3) canUse = false; } if (sItem.potion && canUse) { if (this.potionDelay <= 0) { if (sItem.itemId == 227) { this.potionDelay = this.restorationDelayTime; this.AddBuff(21, this.potionDelay, true); } else { this.potionDelay = this.potionDelayTime; this.AddBuff(21, this.potionDelay, true); } } else canUse = false; } if (sItem.mana > 0 && this.silence) canUse = false; if (sItem.mana > 0 && canUse) { bool flag2 = false; if (sItem.itemId == 2795) flag2 = true; if (sItem.itemId != (int)sbyte.MaxValue || !this.spaceGun) { if (this.statMana >= (int)((double)sItem.mana * (double)this.manaCost)) { if (!flag2) this.statMana -= (int)((double)sItem.mana * (double)this.manaCost); } else if (this.manaFlower) { this.QuickMana(); if (this.statMana >= (int)((double)sItem.mana * (double)this.manaCost)) { if (!flag2) this.statMana -= (int)((double)sItem.mana * (double)this.manaCost); } else canUse = false; } else canUse = false; } if (this.whoAmI == Main.myPlayer && sItem.buffType != 0 && canUse) this.AddBuff(sItem.buffType, sItem.buffTime, true); } if (this.whoAmI == Main.myPlayer && sItem.itemId == 603 && Main.cEd) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 669) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 115) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 3060) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 3062) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 3577) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 425) { int type = Main.rand.Next(3); if (type == 0) type = 27; if (type == 1) type = 101; if (type == 2) type = 102; for (int b = 0; b < 22; ++b) { if (this.buffType[b] == 27 || this.buffType[b] == 101 || this.buffType[b] == 102) { this.DelBuff(b); --b; } } this.AddBuff(type, 3600, true); } if (this.whoAmI == Main.myPlayer && sItem.itemId == 753) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 994) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1169) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1170) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1171) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1172) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1180) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1181) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1182) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1183) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1242) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1157) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1309) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1311) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1837) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1312) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1798) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1799) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1802) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1810) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1927) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 1959) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 2364) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 2365) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 3043) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 2420) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 2535) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 2551) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 2584) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 2587) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 2621) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 2749) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 3249) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 3474) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && sItem.itemId == 3531) this.AddBuff(sItem.buffType, 3600, true); if (this.whoAmI == Main.myPlayer && (double)this.gravDir == 1.0 && (sItem.mountType != -1 && this.mount.CanMount(sItem.mountType, this))) this.mount.SetMount(sItem.mountType, this, false); if (sItem.itemId == 43 && Main.dayTime) canUse = false; if (sItem.itemId == 544 && Main.dayTime) canUse = false; if (sItem.itemId == 556 && Main.dayTime) canUse = false; if (sItem.itemId == 557 && Main.dayTime) canUse = false; if (sItem.itemId == 70 && !this.ZoneCorrupt) canUse = false; if (sItem.itemId == 1133 && !this.ZoneJungle) canUse = false; if (sItem.itemId == 1844 && (Main.dayTime || Main.pumpkinMoon || Main.snowMoon)) canUse = false; if (sItem.itemId == 1958 && (Main.dayTime || Main.pumpkinMoon || Main.snowMoon)) canUse = false; if (!this.SummonItemCheck()) canUse = false; if (sItem.shoot == 17 && canUse && i == Main.myPlayer) { int i1 = (int)((double)Main.mouseX + (double)Main.screenPosition.X) / 16; int j = (int)((double)Main.mouseY + (double)Main.screenPosition.Y) / 16; if ((double)this.gravDir == -1.0) j = (int)((double)Main.screenPosition.Y + (double)Main.screenHeight - (double)Main.mouseY) / 16; Tile tile = Main.tile[i1, j]; if (tile.active() && ((int)tile.type == 0 || (int)tile.type == 2 || ((int)tile.type == 23 || (int)tile.type == 109) || (int)tile.type == 199)) { WorldGen.KillTile(i1, j, false, false, true); if (!Main.tile[i1, j].active()) { if (Main.netMode == 1) NetMessage.SendData(17, -1, -1, "", 4, (float)i1, (float)j, 0.0f, 0, 0, 0); } else canUse = false; } else canUse = false; } if (canUse) canUse = this.HasAmmo(sItem, canUse); if (canUse) { if (sItem.pick > 0 || sItem.axe > 0 || sItem.hammer > 0) this.toolTime = 1; if (this.grappling[0] > -1) { this.pulley = false; this.pulleyDir = (byte)1; if (this.controlRight) this.direction = 1; else if (this.controlLeft) this.direction = -1; } this.channel = sItem.channel; this.attackCD = 0; this.ApplyAnimation(sItem); if (sItem.useSound > 0) Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, sItem.useSound); } if (canUse && this.whoAmI == Main.myPlayer && (sItem.shoot >= 0 && sItem.shoot < 651) && (ProjectileID.Sets.LightPet[sItem.shoot] || Main.projPet[sItem.shoot])) { if (ProjectileID.Sets.MinionSacrificable[sItem.shoot]) { List<int> list = new List<int>(); float num4 = 0.0f; for (int index1 = 0; index1 < 1000; ++index1) { if (Main.projectile[index1].active && Main.projectile[index1].owner == i && Main.projectile[index1].minion) { int index2; for (index2 = 0; index2 < list.Count; ++index2) { if ((double)Main.projectile[list[index2]].minionSlots > (double)Main.projectile[index1].minionSlots) { list.Insert(index2, index1); break; } } if (index2 == list.Count) list.Add(index1); num4 += Main.projectile[index1].minionSlots; } } float num5 = (float)ItemID.Sets.StaffMinionSlotsRequired[sItem.itemId]; float num6 = 0.0f; int num7 = 388; int index3 = -1; for (int index1 = 0; index1 < list.Count; ++index1) { int num8 = Main.projectile[list[index1]].type; if (num8 == 626) { list.RemoveAt(index1); --index1; } if (num8 == 627) { if (Main.projectile[(int)Main.projectile[list[index1]].localAI[1]].type == 628) index3 = list[index1]; list.RemoveAt(index1); --index1; } } if (index3 != -1) { list.Add(index3); list.Add((int)Main.projectile[index3].ai[0]); } for (int index1 = 0; index1 < list.Count && (double)num4 - (double)num6 > (double)this.maxMinions - (double)num5; ++index1) { int num8 = Main.projectile[list[index1]].type; if (num8 != num7 && num8 != 625 && num8 != 628) { if (num8 == 388 && num7 == 387) num7 = 388; if (num8 == 387 && num7 == 388) num7 = 387; num6 += Main.projectile[list[index1]].minionSlots; if (num8 == 626 || num8 == 627) { Projectile projectile1 = Main.projectile[(int)Main.projectile[list[index1]].ai[0]]; if (projectile1.type != 625) projectile1.localAI[1] = Main.projectile[list[index1]].localAI[1]; Projectile projectile2 = Main.projectile[(int)Main.projectile[list[index1]].localAI[1]]; projectile2.ai[0] = Main.projectile[list[index1]].ai[0]; projectile2.ai[1] = 1f; projectile2.netUpdate = true; } Main.projectile[list[index1]].Kill(); } } list.Clear(); if ((double)num4 + (double)num5 >= 9.0) AchievementsHelper.HandleSpecialEvent(this, 6); } else { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == i && Main.projectile[index].type == sItem.shoot) Main.projectile[index].Kill(); if (sItem.shoot == 72) { if (Main.projectile[index].active && Main.projectile[index].owner == i && Main.projectile[index].type == 86) Main.projectile[index].Kill(); if (Main.projectile[index].active && Main.projectile[index].owner == i && Main.projectile[index].type == 87) Main.projectile[index].Kill(); } } } } } if (!this.controlUseItem) { int num4 = this.channel ? 1 : 0; this.channel = false; } if (this.itemAnimation > 0) { this.itemAnimationMax = !sItem.melee ? sItem.useAnimation : (int)((double)sItem.useAnimation * (double)this.meleeSpeed); if (sItem.mana > 0 && !flag1 && (sItem.itemId != (int)sbyte.MaxValue || !this.spaceGun)) this.manaRegenDelay = (int)this.maxRegenDelay; if (Main.dedServ) { this.itemHeight = sItem.height; this.itemWidth = sItem.width; } else { this.itemHeight = Main.itemTexture[sItem.itemId].Height; this.itemWidth = Main.itemTexture[sItem.itemId].Width; } --this.itemAnimation; if (!Main.dedServ) { if (sItem.useStyle == 1) { if (sItem.itemId > -1 && Item.claw[sItem.itemId]) { if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.333) { float num4 = 10f; this.itemLocation.X = (float)((double)this.position.X + (double)this.width * 0.5 + ((double)Main.itemTexture[sItem.itemId].Width * 0.5 - (double)num4) * (double)this.direction); this.itemLocation.Y = this.position.Y + 26f + num2; } else if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.666) { float num4 = 8f; this.itemLocation.X = (float)((double)this.position.X + (double)this.width * 0.5 + ((double)Main.itemTexture[sItem.itemId].Width * 0.5 - (double)num4) * (double)this.direction); this.itemLocation.Y = this.position.Y + 24f + num2; } else { float num4 = 6f; this.itemLocation.X = (float)((double)this.position.X + (double)this.width * 0.5 - ((double)Main.itemTexture[sItem.itemId].Width * 0.5 - (double)num4) * (double)this.direction); this.itemLocation.Y = this.position.Y + 20f + num2; } this.itemRotation = (float)(((double)this.itemAnimation / (double)this.itemAnimationMax - 0.5) * (double)-this.direction * 3.5 - (double)this.direction * 0.300000011920929); } else { if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.333) { float num4 = 10f; if (Main.itemTexture[sItem.itemId].Width > 32) num4 = 14f; if (Main.itemTexture[sItem.itemId].Width >= 52) num4 = 24f; if (Main.itemTexture[sItem.itemId].Width >= 64) num4 = 28f; if (Main.itemTexture[sItem.itemId].Width >= 92) num4 = 38f; if (sItem.itemId == 2330 || sItem.itemId == 2320 || sItem.itemId == 2341) num4 += 8f; this.itemLocation.X = (float)((double)this.position.X + (double)this.width * 0.5 + ((double)Main.itemTexture[sItem.itemId].Width * 0.5 - (double)num4) * (double)this.direction); this.itemLocation.Y = this.position.Y + 24f + num2; } else if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.666) { float num4 = 10f; if (Main.itemTexture[sItem.itemId].Width > 32) num4 = 18f; if (Main.itemTexture[sItem.itemId].Width >= 52) num4 = 24f; if (Main.itemTexture[sItem.itemId].Width >= 64) num4 = 28f; if (Main.itemTexture[sItem.itemId].Width >= 92) num4 = 38f; if (sItem.itemId == 2330 || sItem.itemId == 2320 || sItem.itemId == 2341) num4 += 4f; this.itemLocation.X = (float)((double)this.position.X + (double)this.width * 0.5 + ((double)Main.itemTexture[sItem.itemId].Width * 0.5 - (double)num4) * (double)this.direction); float num5 = 10f; if (Main.itemTexture[sItem.itemId].Height > 32) num5 = 8f; if (Main.itemTexture[sItem.itemId].Height > 52) num5 = 12f; if (Main.itemTexture[sItem.itemId].Height > 64) num5 = 14f; if (sItem.itemId == 2330 || sItem.itemId == 2320 || sItem.itemId == 2341) num5 += 4f; this.itemLocation.Y = this.position.Y + num5 + num2; } else { float num4 = 6f; if (Main.itemTexture[sItem.itemId].Width > 32) num4 = 14f; if (Main.itemTexture[sItem.itemId].Width >= 48) num4 = 18f; if (Main.itemTexture[sItem.itemId].Width >= 52) num4 = 24f; if (Main.itemTexture[sItem.itemId].Width >= 64) num4 = 28f; if (Main.itemTexture[sItem.itemId].Width >= 92) num4 = 38f; if (sItem.itemId == 2330 || sItem.itemId == 2320 || sItem.itemId == 2341) num4 += 4f; this.itemLocation.X = (float)((double)this.position.X + (double)this.width * 0.5 - ((double)Main.itemTexture[sItem.itemId].Width * 0.5 - (double)num4) * (double)this.direction); float num5 = 10f; if (Main.itemTexture[sItem.itemId].Height > 32) num5 = 10f; if (Main.itemTexture[sItem.itemId].Height > 52) num5 = 12f; if (Main.itemTexture[sItem.itemId].Height > 64) num5 = 14f; if (sItem.itemId == 2330 || sItem.itemId == 2320 || sItem.itemId == 2341) num5 += 4f; this.itemLocation.Y = this.position.Y + num5 + num2; } this.itemRotation = (float)(((double)this.itemAnimation / (double)this.itemAnimationMax - 0.5) * (double)-this.direction * 3.5 - (double)this.direction * 0.300000011920929); } if ((double)this.gravDir == -1.0) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = (float)((double)this.position.Y + (double)this.height + ((double)this.position.Y - (double)this.itemLocation.Y)); } } else if (sItem.useStyle == 2) { this.itemRotation = (float)((double)this.itemAnimation / (double)this.itemAnimationMax * (double)this.direction * 2.0 + -1.39999997615814 * (double)this.direction); if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.5) { this.itemLocation.X = (float)((double)this.position.X + (double)this.width * 0.5 + ((double)Main.itemTexture[sItem.itemId].Width * 0.5 - 9.0 - (double)this.itemRotation * 12.0 * (double)this.direction) * (double)this.direction); this.itemLocation.Y = (float)((double)this.position.Y + 38.0 + (double)this.itemRotation * (double)this.direction * 4.0) + num2; } else { this.itemLocation.X = (float)((double)this.position.X + (double)this.width * 0.5 + ((double)Main.itemTexture[sItem.itemId].Width * 0.5 - 9.0 - (double)this.itemRotation * 16.0 * (double)this.direction) * (double)this.direction); this.itemLocation.Y = (float)((double)this.position.Y + 38.0 + (double)this.itemRotation * (double)this.direction) + num2; } if ((double)this.gravDir == -1.0) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = (float)((double)this.position.Y + (double)this.height + ((double)this.position.Y - (double)this.itemLocation.Y)); } } else if (sItem.useStyle == 3) { if ((double)this.itemAnimation > (double)this.itemAnimationMax * 0.666) { this.itemLocation.X = -1000f; this.itemLocation.Y = -1000f; this.itemRotation = -1.3f * (float)this.direction; } else { this.itemLocation.X = (float)((double)this.position.X + (double)this.width * 0.5 + ((double)Main.itemTexture[sItem.itemId].Width * 0.5 - 4.0) * (double)this.direction); this.itemLocation.Y = this.position.Y + 24f + num2; float num4 = (float)((double)this.itemAnimation / (double)this.itemAnimationMax * (double)Main.itemTexture[sItem.itemId].Width * (double)this.direction * (double)sItem.scale * 1.20000004768372) - (float)(10 * this.direction); if ((double)num4 > -4.0 && this.direction == -1) num4 = -8f; if ((double)num4 < 4.0 && this.direction == 1) num4 = 8f; this.itemLocation.X -= num4; this.itemRotation = 0.8f * (float)this.direction; } if ((double)this.gravDir == -1.0) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = (float)((double)this.position.Y + (double)this.height + ((double)this.position.Y - (double)this.itemLocation.Y)); } } else if (sItem.useStyle == 4) { this.itemRotation = 0.0f; this.itemLocation.X = (float)((double)this.position.X + (double)this.width * 0.5 + ((double)Main.itemTexture[sItem.itemId].Width * 0.5 - 9.0 - (double)this.itemRotation * 14.0 * (double)this.direction - 4.0) * (double)this.direction); this.itemLocation.Y = (float)((double)this.position.Y + (double)Main.itemTexture[sItem.itemId].Height * 0.5 + 4.0) + num2; if ((double)this.gravDir == -1.0) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = (float)((double)this.position.Y + (double)this.height + ((double)this.position.Y - (double)this.itemLocation.Y)); } } else if (sItem.useStyle == 5) { if (Item.staff[sItem.itemId]) { float num4 = 6f; if (sItem.itemId == 3476) num4 = 14f; this.itemLocation = this.MountedCenter; this.itemLocation += Utils.ToRotationVector2(this.itemRotation) * num4 * (float)this.direction; } else { this.itemLocation.X = (float)((double)this.position.X + (double)this.width * 0.5 - (double)Main.itemTexture[sItem.itemId].Width * 0.5) - (float)(this.direction * 2); this.itemLocation.Y = this.MountedCenter.Y - (float)Main.itemTexture[sItem.itemId].Height * 0.5f; } } } } else if (sItem.holdStyle == 1 && !this.pulley) { if (Main.dedServ) this.itemLocation.X = (float)((double)this.position.X + (double)this.width * 0.5 + 20.0 * (double)this.direction); else if (sItem.itemId == 930) { this.itemLocation.X = (float)((double)this.position.X + (double)(this.width / 2) * 0.5 - 12.0) - (float)(2 * this.direction); float x = this.position.X + (float)(this.width / 2) + (float)(38 * this.direction); if (this.direction == 1) x -= 10f; float y = this.MountedCenter.Y - 4f * this.gravDir; if ((double)this.gravDir == -1.0) y -= 8f; this.RotateRelativePoint(ref x, ref y); int Type = 0; for (int index = 54; index < 58; ++index) { if (this.inventory[index].stack > 0 && this.inventory[index].ammo == 931) { Type = this.inventory[index].itemId; break; } } if (Type == 0) { for (int index = 0; index < 54; ++index) { if (this.inventory[index].stack > 0 && this.inventory[index].ammo == 931) { Type = this.inventory[index].itemId; break; } } } if (Type == 931) Type = (int)sbyte.MaxValue; else if (Type == 1614) Type = 187; if (Type > 0) { int index = Dust.NewDust(new Vector2(x, y + this.gfxOffY), 6, 6, Type, 0.0f, 0.0f, 100, new Color(), 1.6f); Main.dust[index].noGravity = true; Main.dust[index].velocity.Y -= 4f * this.gravDir; } } else if (sItem.itemId == 968) { this.itemLocation.X = this.position.X + (float)this.width * 0.5f + (float)(8 * this.direction); if (this.whoAmI == Main.myPlayer) { int index1 = (int)((double)this.itemLocation.X + (double)Main.itemTexture[sItem.itemId].Width * 0.800000011920929 * (double)this.direction) / 16; int index2 = (int)((double)this.itemLocation.Y + (double)num2 + (double)(Main.itemTexture[sItem.itemId].Height / 2)) / 16; if (Main.tile[index1, index2] == null) Main.tile[index1, index2] = new Tile(); if (Main.tile[index1, index2].active() && (int)Main.tile[index1, index2].type == 215 && (int)Main.tile[index1, index2].frameY < 54) { ++this.miscTimer; if (Main.rand.Next(5) == 0) ++this.miscTimer; if (this.miscTimer > 900) { this.miscTimer = 0; sItem.SetDefaults(969, false); if (this.selectedItem == 58) Main.mouseItem.SetDefaults(969, false); for (int index3 = 0; index3 < 58; ++index3) { if (this.inventory[index3].itemId == sItem.itemId && index3 != this.selectedItem && this.inventory[index3].stack < this.inventory[index3].maxStack) { Main.PlaySound(7, -1, -1, 1); ++this.inventory[index3].stack; sItem.SetDefaults(0, false); if (this.selectedItem == 58) Main.mouseItem.SetDefaults(0, false); } } } } else this.miscTimer = 0; } } else if (sItem.itemId == 856) this.itemLocation.X = this.position.X + (float)this.width * 0.5f + (float)(4 * this.direction); else if (sItem.fishingPole > 0) { this.itemLocation.X = (float)((double)this.position.X + (double)this.width * 0.5 + (double)Main.itemTexture[sItem.itemId].Width * 0.180000007152557 * (double)this.direction); } else { this.itemLocation.X = (float)((double)this.position.X + (double)this.width * 0.5 + ((double)Main.itemTexture[sItem.itemId].Width * 0.5 + 2.0) * (double)this.direction); if (sItem.itemId == 282 || sItem.itemId == 286 || sItem.itemId == 3112) { this.itemLocation.X -= (float)(this.direction * 2); this.itemLocation.Y += 4f; } else if (sItem.itemId == 3002) { this.itemLocation.X -= (float)(4 * this.direction); this.itemLocation.Y += 2f; } } this.itemLocation.Y = this.position.Y + 24f + num2; if (sItem.itemId == 856) this.itemLocation.Y = this.position.Y + 34f + num2; if (sItem.itemId == 930) this.itemLocation.Y = this.position.Y + 9f + num2; if (sItem.fishingPole > 0) this.itemLocation.Y += 4f; else if (sItem.itemId == 3476) { this.itemLocation.X = this.Center.X + (float)(14 * this.direction); this.itemLocation.Y = this.MountedCenter.Y; } this.itemRotation = 0.0f; if ((double)this.gravDir == -1.0) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = (float)((double)this.position.Y + (double)this.height + ((double)this.position.Y - (double)this.itemLocation.Y)) + num2; if (sItem.itemId == 930) this.itemLocation.Y -= 24f; } } else if (sItem.holdStyle == 2 && !this.pulley) { if (sItem.itemId == 946) { this.itemRotation = 0.0f; this.itemLocation.X = this.position.X + (float)this.width * 0.5f - (float)(16 * this.direction); this.itemLocation.Y = this.position.Y + 22f + num2; this.fallStart = (int)((double)this.position.Y / 16.0); if ((double)this.gravDir == -1.0) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = (float)((double)this.position.Y + (double)this.height + ((double)this.position.Y - (double)this.itemLocation.Y)); if ((double)this.velocity.Y < -2.0) this.velocity.Y = -2f; } else if ((double)this.velocity.Y > 2.0) this.velocity.Y = 2f; } else { this.itemLocation.X = this.position.X + (float)this.width * 0.5f + (float)(6 * this.direction); this.itemLocation.Y = this.position.Y + 16f + num2; this.itemRotation = 0.79f * (float)-this.direction; if ((double)this.gravDir == -1.0) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = (float)((double)this.position.Y + (double)this.height + ((double)this.position.Y - (double)this.itemLocation.Y)); } } } else if (sItem.holdStyle == 3 && !this.pulley && !Main.dedServ) { this.itemLocation.X = (float)((double)this.position.X + (double)this.width * 0.5 - (double)Main.itemTexture[sItem.itemId].Width * 0.5) - (float)(this.direction * 2); this.itemLocation.Y = this.MountedCenter.Y - (float)Main.itemTexture[sItem.itemId].Height * 0.5f; this.itemRotation = 0.0f; } if (((sItem.itemId == 974 || sItem.itemId == 8 || (sItem.itemId == 1245 || sItem.itemId == 2274) || (sItem.itemId == 3004 || sItem.itemId == 3045 || sItem.itemId == 3114) || sItem.itemId >= 427 && sItem.itemId <= 433) && !this.wet || (sItem.itemId == 523 || sItem.itemId == 1333)) && !this.pulley) { float R = 1f; float G = 0.95f; float B = 0.8f; int num4 = 0; if (sItem.itemId == 523) num4 = 8; else if (sItem.itemId == 974) num4 = 9; else if (sItem.itemId == 1245) num4 = 10; else if (sItem.itemId == 1333) num4 = 11; else if (sItem.itemId == 2274) num4 = 12; else if (sItem.itemId == 3004) num4 = 13; else if (sItem.itemId == 3045) num4 = 14; else if (sItem.itemId == 3114) num4 = 15; else if (sItem.itemId >= 427) num4 = sItem.itemId - 426; if (num4 == 1) { R = 0.0f; G = 0.1f; B = 1.3f; } else if (num4 == 2) { R = 1f; G = 0.1f; B = 0.1f; } else if (num4 == 3) { R = 0.0f; G = 1f; B = 0.1f; } else if (num4 == 4) { R = 0.9f; G = 0.0f; B = 0.9f; } else if (num4 == 5) { R = 1.3f; G = 1.3f; B = 1.3f; } else if (num4 == 6) { R = 0.9f; G = 0.9f; B = 0.0f; } else if (num4 == 7) { R = (float)(0.5 * (double)Main.demonTorch + 1.0 * (1.0 - (double)Main.demonTorch)); G = 0.3f; B = (float)(1.0 * (double)Main.demonTorch + 0.5 * (1.0 - (double)Main.demonTorch)); } else if (num4 == 8) { B = 0.7f; R = 0.85f; G = 1f; } else if (num4 == 9) { B = 1f; R = 0.7f; G = 0.85f; } else if (num4 == 10) { B = 0.0f; R = 1f; G = 0.5f; } else if (num4 == 11) { B = 0.8f; R = 1.25f; G = 1.25f; } else if (num4 == 12) { R *= 0.75f; G *= 1.35f; B *= 1.5f; } else if (num4 == 13) { R = 0.95f; G = 0.65f; B = 1.3f; } else if (num4 == 14) { R = (float)Main.DiscoR / (float)byte.MaxValue; G = (float)Main.DiscoG / (float)byte.MaxValue; B = (float)Main.DiscoB / (float)byte.MaxValue; } else if (num4 == 15) { R = 1f; G = 0.0f; B = 1f; } int num5 = num4; int Type; switch (num5) { case 0: Type = 6; break; case 8: Type = 75; break; case 9: Type = 135; break; case 10: Type = 158; break; case 11: Type = 169; break; case 12: Type = 156; break; case 13: Type = 234; break; case 14: Type = 66; break; case 15: Type = 242; break; default: Type = 58 + num5; break; } int maxValue = 30; if (this.itemAnimation > 0) maxValue = 7; if (this.direction == -1) { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X - 16f, this.itemLocation.Y - 14f * this.gravDir), 4, 4, Type, 0.0f, 0.0f, 100, new Color(), 1f); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position, true); if (Type == 66) { Main.dust[index].color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); Main.dust[index].noGravity = true; } } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 12f + this.velocity.X, this.itemLocation.Y - 14f + this.velocity.Y), true), R, G, B); } else { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X + 6f, this.itemLocation.Y - 14f * this.gravDir), 4, 4, Type, 0.0f, 0.0f, 100, new Color(), 1f); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position, true); if (Type == 66) { Main.dust[index].color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); Main.dust[index].noGravity = true; } } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 12f + this.velocity.X, this.itemLocation.Y - 14f + this.velocity.Y), true), R, G, B); } } if ((sItem.itemId == 105 || sItem.itemId == 713) && (!this.wet && !this.pulley)) { int maxValue = 20; if (this.itemAnimation > 0) maxValue = 7; if (this.direction == -1) { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X - 12f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 6, 0.0f, 0.0f, 100, new Color(), 1f); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position, true); } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true), 1f, 0.95f, 0.8f); } else { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X + 4f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 6, 0.0f, 0.0f, 100, new Color(), 1f); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position, true); } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true), 1f, 0.95f, 0.8f); } } else if (sItem.itemId == 148 && !this.wet) { int maxValue = 10; if (this.itemAnimation > 0) maxValue = 7; if (this.direction == -1) { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X - 12f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 172, 0.0f, 0.0f, 100, new Color(), 1f); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position, true); } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true), 0.0f, 0.5f, 1f); } else { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X + 4f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 172, 0.0f, 0.0f, 100, new Color(), 1f); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position, true); } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true), 0.0f, 0.5f, 1f); } } else if (sItem.itemId == 3117 && !this.wet) { this.itemLocation.X -= (float)(this.direction * 4); int maxValue = 10; if (this.itemAnimation > 0) maxValue = 7; if (this.direction == -1) { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X - 10f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 242, 0.0f, 0.0f, 100, new Color(), 1f); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position, true); } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true), 0.9f, 0.1f, 0.75f); } else { if (Main.rand.Next(maxValue) == 0) { int index = Dust.NewDust(new Vector2(this.itemLocation.X + 6f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 242, 0.0f, 0.0f, 100, new Color(), 1f); if (Main.rand.Next(3) != 0) Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.3f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].position = this.RotatedRelativePoint(Main.dust[index].position, true); } Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true), 0.9f, 0.1f, 0.75f); } } if (sItem.itemId == 282 && !this.pulley) { if (this.direction == -1) Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true), 0.7f, 1f, 0.8f); else Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true), 0.7f, 1f, 0.8f); } if (sItem.itemId == 3002 && !this.pulley) { float R = 1.05f; float G = 0.95f; float B = 0.55f; if (this.direction == -1) Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true), R, G, B); else Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true), R, G, B); ++this.spelunkerTimer; if ((int)this.spelunkerTimer >= 10) { this.spelunkerTimer = (byte)0; int num4 = 30; int num5 = (int)this.Center.X / 16; int num6 = (int)this.Center.Y / 16; for (int index1 = num5 - num4; index1 <= num5 + num4; ++index1) { for (int index2 = num6 - num4; index2 <= num6 + num4; ++index2) { if (Main.rand.Next(4) == 0 && ((double)new Vector2((float)(num5 - index1), (float)(num6 - index2)).Length() < (double)num4 && index1 > 0 && (index1 < Main.maxTilesX - 1 && index2 > 0) && (index2 < Main.maxTilesY - 1 && Main.tile[index1, index2] != null && Main.tile[index1, index2].active()))) { bool flag2 = false; if ((int)Main.tile[index1, index2].type == 185 && (int)Main.tile[index1, index2].frameY == 18) { if ((int)Main.tile[index1, index2].frameX >= 576 && (int)Main.tile[index1, index2].frameX <= 882) flag2 = true; } else if ((int)Main.tile[index1, index2].type == 186 && (int)Main.tile[index1, index2].frameX >= 864 && (int)Main.tile[index1, index2].frameX <= 1170) flag2 = true; if (flag2 || Main.tileSpelunker[(int)Main.tile[index1, index2].type] || Main.tileAlch[(int)Main.tile[index1, index2].type] && (int)Main.tile[index1, index2].type != 82) { int index3 = Dust.NewDust(new Vector2((float)(index1 * 16), (float)(index2 * 16)), 16, 16, 204, 0.0f, 0.0f, 150, new Color(), 0.3f); Main.dust[index3].fadeIn = 0.75f; Main.dust[index3].velocity *= 0.1f; Main.dust[index3].noLight = true; } } } } } } if (sItem.itemId == 286 && !this.pulley) { if (this.direction == -1) Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true), 0.7f, 0.8f, 1f); else Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true), 0.7f, 0.8f, 1f); } if (sItem.itemId == 3112 && !this.pulley) { if (this.direction == -1) Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true), 1f, 0.6f, 0.85f); else Lighting.AddLight(this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true), 1f, 0.6f, 0.85f); } this.releaseUseItem = !this.controlUseItem; if (this.itemTime > 0) { --this.itemTime; if (this.itemTime == 0 && this.whoAmI == Main.myPlayer) { switch (sItem.itemId) { case 65: case 676: case 723: case 724: case 989: case 1226: case 1227: Main.PlaySound(25, -1, -1, 1); for (int index1 = 0; index1 < 5; ++index1) { int index2 = Dust.NewDust(this.position, this.width, this.height, 45, 0.0f, 0.0f, (int)byte.MaxValue, new Color(), (float)Main.rand.Next(20, 26) * 0.1f); Main.dust[index2].noLight = true; Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 0.5f; } break; } } } if (i == Main.myPlayer) { bool flag2 = true; switch (sItem.itemId) { case 65: case 676: case 723: case 724: case 757: case 674: case 675: case 989: case 1226: case 1227: if (this.itemAnimation != this.itemAnimationMax - 1) { flag2 = false; break; } break; } if (sItem.shoot > 0 && this.itemAnimation > 0 && (this.itemTime == 0 && flag2)) { int shoot = sItem.shoot; float speed = sItem.shootSpeed; if (this.inventory[this.selectedItem].thrown && (double)speed < 16.0) { speed *= this.thrownVelocity; if ((double)speed > 16.0) speed = 16f; } if (sItem.melee && shoot != 25 && (shoot != 26 && shoot != 35)) speed /= this.meleeSpeed; bool canShoot = false; int Damage = num3; float KnockBack = sItem.knockBack; if (shoot == 13 || shoot == 32 || shoot == 315 || (shoot >= 230 && shoot <= 235 || shoot == 331)) { this.grappling[0] = -1; this.grapCount = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == i) { if (Main.projectile[index].type == 13) Main.projectile[index].Kill(); if (Main.projectile[index].type == 331) Main.projectile[index].Kill(); if (Main.projectile[index].type == 315) Main.projectile[index].Kill(); if (Main.projectile[index].type >= 230 && Main.projectile[index].type <= 235) Main.projectile[index].Kill(); } } } if (sItem.useAmmo > 0) this.PickAmmo(sItem, ref shoot, ref speed, ref canShoot, ref Damage, ref KnockBack, ItemID.Sets.gunProj[sItem.itemId]); else canShoot = true; if (sItem.itemId == 3475 || sItem.itemId == 3540) { KnockBack = sItem.knockBack; Damage = num3; speed = sItem.shootSpeed; } if (sItem.itemId == 71) canShoot = false; if (sItem.itemId == 72) canShoot = false; if (sItem.itemId == 73) canShoot = false; if (sItem.itemId == 74) canShoot = false; if (sItem.itemId == 1254 && shoot == 14) shoot = 242; if (sItem.itemId == 1255 && shoot == 14) shoot = 242; if (sItem.itemId == 1265 && shoot == 14) shoot = 242; if (sItem.itemId == 3542) { if (Main.rand.Next(100) < 20) { ++shoot; Damage *= 3; } else --speed; } if (shoot == 73) { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == i) { if (Main.projectile[index].type == 73) shoot = 74; if (shoot == 74 && Main.projectile[index].type == 74) canShoot = false; } } } if (canShoot) { if (sItem.summon) { KnockBack += this.minionKB; Damage = (int)((double)Damage * (double)this.minionDamage); } if (shoot == 228) KnockBack = 0.0f; if (sItem.melee && this.kbGlove) KnockBack *= 2f; if (this.kbBuff) KnockBack *= 1.5f; if (sItem.ranged && this.shroomiteStealth) KnockBack *= (float)(1.0 + (1.0 - (double)this.stealth) * 0.5); if (sItem.ranged && this.setVortex) KnockBack *= (float)(1.0 + (1.0 - (double)this.stealth) * 0.5); if (shoot == 1 && sItem.itemId == 120) shoot = 2; if (sItem.itemId == 682) shoot = 117; if (sItem.itemId == 725) shoot = 120; if (sItem.itemId == 2796) shoot = 442; if (sItem.itemId == 2223) shoot = 357; this.itemTime = sItem.useTime; Vector2 vector2_1 = this.RotatedRelativePoint(this.MountedCenter, true); Vector2 vector2_2 = Utils.RotatedBy(Vector2.UnitX, (double)this.fullRotation, new Vector2()); Vector2 vector2_3 = Main.MouseWorld - vector2_1; if (vector2_3 != Vector2.Zero) vector2_3.Normalize(); if ((double)Vector2.Dot(vector2_2, vector2_3) > 0.0) this.ChangeDir(1); else this.ChangeDir(-1); if (sItem.itemId == 3094 || sItem.itemId == 3378 || sItem.itemId == 3543) vector2_1.Y = this.position.Y + (float)(this.height / 3); if (shoot == 9) { vector2_1 = new Vector2((float)((double)this.position.X + (double)this.width * 0.5 + (double)(Main.rand.Next(201) * -this.direction) + ((double)Main.mouseX + (double)Main.screenPosition.X - (double)this.position.X)), this.MountedCenter.Y - 600f); KnockBack = 0.0f; Damage *= 2; } if (sItem.itemId == 986 || sItem.itemId == 281) { vector2_1.X += (float)(6 * this.direction); vector2_1.Y -= 6f * this.gravDir; } if (sItem.itemId == 3007) { vector2_1.X -= (float)(4 * this.direction); vector2_1.Y -= 1f * this.gravDir; } float f1 = (float)Main.mouseX + Main.screenPosition.X - vector2_1.X; float f2 = (float)Main.mouseY + Main.screenPosition.Y - vector2_1.Y; if ((double)this.gravDir == -1.0) f2 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2_1.Y; float num4 = (float)Math.Sqrt((double)f1 * (double)f1 + (double)f2 * (double)f2); float num5 = num4; float num6; if (float.IsNaN(f1) && float.IsNaN(f2) || (double)f1 == 0.0 && (double)f2 == 0.0) { f1 = (float)this.direction; f2 = 0.0f; num6 = speed; } else num6 = speed / num4; if (sItem.itemId == 1929 || sItem.itemId == 2270) { f1 += (float)Main.rand.Next(-50, 51) * 0.03f / num6; f2 += (float)Main.rand.Next(-50, 51) * 0.03f / num6; } float num7 = f1 * num6; float num8 = f2 * num6; if (sItem.itemId == 757) Damage = (int)((double)Damage * 1.25); if (shoot == 250) { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == this.whoAmI && (Main.projectile[index].type == 250 || Main.projectile[index].type == 251)) Main.projectile[index].Kill(); } } if (shoot == 12) { vector2_1.X += num7 * 3f; vector2_1.Y += num8 * 3f; } if (sItem.useStyle == 5) { if (sItem.itemId == 3029) { Vector2 vector2_4 = new Vector2(num7, num8); vector2_4.X = (float)Main.mouseX + Main.screenPosition.X - vector2_1.X; vector2_4.Y = (float)((double)Main.mouseY + (double)Main.screenPosition.Y - (double)vector2_1.Y - 1000.0); this.itemRotation = (float)Math.Atan2((double)vector2_4.Y * (double)this.direction, (double)vector2_4.X * (double)this.direction); NetMessage.SendData(13, -1, -1, "", this.whoAmI, 0.0f, 0.0f, 0.0f, 0, 0, 0); NetMessage.SendData(41, -1, -1, "", this.whoAmI, 0.0f, 0.0f, 0.0f, 0, 0, 0); } else { this.itemRotation = (float)Math.Atan2((double)num8 * (double)this.direction, (double)num7 * (double)this.direction) - this.fullRotation; NetMessage.SendData(13, -1, -1, "", this.whoAmI, 0.0f, 0.0f, 0.0f, 0, 0, 0); NetMessage.SendData(41, -1, -1, "", this.whoAmI, 0.0f, 0.0f, 0.0f, 0, 0, 0); } } if (shoot == 17) { vector2_1.X = (float)Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float)Main.mouseY + Main.screenPosition.Y; if ((double)this.gravDir == -1.0) vector2_1.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; } if (shoot == 76) { shoot += Main.rand.Next(3); float num9 = num5 / (float)(Main.screenHeight / 2); if ((double)num9 > 1.0) num9 = 1f; float num10 = num7 + (float)Main.rand.Next(-40, 41) * 0.01f; float num11 = num8 + (float)Main.rand.Next(-40, 41) * 0.01f; float SpeedX = num10 * (num9 + 0.25f); float SpeedY = num11 * (num9 + 0.25f); int number = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); Main.projectile[number].ai[1] = 1f; float num12 = (float)((double)num9 * 2.0 - 1.0); if ((double)num12 < -1.0) num12 = -1f; if ((double)num12 > 1.0) num12 = 1f; Main.projectile[number].ai[0] = num12; NetMessage.SendData(27, -1, -1, "", number, 0.0f, 0.0f, 0.0f, 0, 0, 0); } else if (sItem.itemId == 3029) { int num9 = 3; if (Main.rand.Next(3) == 0) ++num9; for (int index1 = 0; index1 < num9; ++index1) { vector2_1 = new Vector2((float)((double)this.position.X + (double)this.width * 0.5 + (double)(Main.rand.Next(201) * -this.direction) + ((double)Main.mouseX + (double)Main.screenPosition.X - (double)this.position.X)), this.MountedCenter.Y - 600f); vector2_1.X = (float)(((double)vector2_1.X * 10.0 + (double)this.Center.X) / 11.0) + (float)Main.rand.Next(-100, 101); vector2_1.Y -= (float)(150 * index1); float num10 = (float)Main.mouseX + Main.screenPosition.X - vector2_1.X; float num11 = (float)Main.mouseY + Main.screenPosition.Y - vector2_1.Y; if ((double)num11 < 0.0) num11 *= -1f; if ((double)num11 < 20.0) num11 = 20f; float num12 = (float)Math.Sqrt((double)num10 * (double)num10 + (double)num11 * (double)num11); float num13 = speed / num12; float num14 = num10 * num13; float num15 = num11 * num13; float num16 = num14 + (float)Main.rand.Next(-40, 41) * 0.03f; float SpeedY = num15 + (float)Main.rand.Next(-40, 41) * 0.03f; float SpeedX = num16 * ((float)Main.rand.Next(75, 150) * 0.01f); vector2_1.X += (float)Main.rand.Next(-50, 51); int index2 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); Main.projectile[index2].noDropItem = true; } } else if (sItem.itemId == 98 || sItem.itemId == 533) { float SpeedX = num7 + (float)Main.rand.Next(-40, 41) * 0.01f; float SpeedY = num8 + (float)Main.rand.Next(-40, 41) * 0.01f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 1319) { float SpeedX = num7 + (float)Main.rand.Next(-40, 41) * 0.02f; float SpeedY = num8 + (float)Main.rand.Next(-40, 41) * 0.02f; int index = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); Main.projectile[index].ranged = true; Main.projectile[index].thrown = false; } else if (sItem.itemId == 3107) { float SpeedX = num7 + (float)Main.rand.Next(-40, 41) * 0.02f; float SpeedY = num8 + (float)Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 3053) { Vector2 vector2_4 = new Vector2(num7, num8); vector2_4.Normalize(); Vector2 vector2_5 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); vector2_5.Normalize(); Vector2 vector2_6 = vector2_4 * 4f + vector2_5; vector2_6.Normalize(); Vector2 vector2_7 = vector2_6 * sItem.shootSpeed; float ai1 = (float)Main.rand.Next(10, 80) * (1.0f / 1000.0f); if (Main.rand.Next(2) == 0) ai1 *= -1f; float ai0 = (float)Main.rand.Next(10, 80) * (1.0f / 1000.0f); if (Main.rand.Next(2) == 0) ai0 *= -1f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, vector2_7.X, vector2_7.Y, shoot, Damage, KnockBack, i, ai0, ai1); } else if (sItem.itemId == 3019) { Vector2 vector2_4 = new Vector2(num7, num8); float num9 = vector2_4.Length(); vector2_4.X += (float)((double)Main.rand.Next(-100, 101) * 0.00999999977648258 * (double)num9 * 0.150000005960464); vector2_4.Y += (float)((double)Main.rand.Next(-100, 101) * 0.00999999977648258 * (double)num9 * 0.150000005960464); float num10 = num7 + (float)Main.rand.Next(-40, 41) * 0.03f; float num11 = num8 + (float)Main.rand.Next(-40, 41) * 0.03f; vector2_4.Normalize(); Vector2 vector2_5 = vector2_4 * num9; Vector2 vector2_6 = new Vector2(num10 * ((float)Main.rand.Next(50, 150) * 0.01f), num11 * ((float)Main.rand.Next(50, 150) * 0.01f)); vector2_6.X += (float)Main.rand.Next(-100, 101) * 0.025f; vector2_6.Y += (float)Main.rand.Next(-100, 101) * 0.025f; vector2_6.Normalize(); vector2_6 *= num9; float SpeedX = vector2_6.X; float SpeedY = vector2_6.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, vector2_5.X, vector2_5.Y); } else if (sItem.itemId == 2797) { Vector2 vector2_4 = Vector2.Normalize(new Vector2(num7, num8)) * 40f * sItem.scale; if (Collision.CanHit(vector2_1, 0, 0, vector2_1 + vector2_4, 0, 0)) vector2_1 += vector2_4; float ai0 = Utils.ToRotation(new Vector2(num7, num8)); float num9 = 2.094395f; int num10 = Main.rand.Next(4, 5); if (Main.rand.Next(4) == 0) ++num10; for (int index1 = 0; index1 < num10; ++index1) { float num11 = (float)(Main.rand.NextDouble() * 0.200000002980232 + 0.0500000007450581); Vector2 vector2_5 = Utils.RotatedBy(new Vector2(num7, num8), (double)num9 * Main.rand.NextDouble() - (double)num9 / 2.0, new Vector2()) * num11; int index2 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, vector2_5.X, vector2_5.Y, 444, Damage, KnockBack, i, ai0, 0.0f); Main.projectile[index2].localAI[0] = (float)shoot; Main.projectile[index2].localAI[1] = speed; } } else if (sItem.itemId == 2270) { float SpeedX = num7 + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = num8 + (float)Main.rand.Next(-40, 41) * 0.05f; if (Main.rand.Next(3) == 0) { SpeedX *= (float)(1.0 + (double)Main.rand.Next(-30, 31) * 0.0199999995529652); SpeedY *= (float)(1.0 + (double)Main.rand.Next(-30, 31) * 0.0199999995529652); } Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 1930) { int num9 = 2 + Main.rand.Next(3); for (int index = 0; index < num9; ++index) { float num10 = num7; float num11 = num8; float num12 = 0.025f * (float)index; float num13 = num10 + (float)Main.rand.Next(-35, 36) * num12; float num14 = num11 + (float)Main.rand.Next(-35, 36) * num12; float num15 = (float)Math.Sqrt((double)num13 * (double)num13 + (double)num14 * (double)num14); float num16 = speed / num15; float SpeedX = num13 * num16; float SpeedY = num14 * num16; Projectile.NewProjectile(vector2_1.X + (float)((double)num7 * (double)(num9 - index) * 1.75), vector2_1.Y + (float)((double)num8 * (double)(num9 - index) * 1.75), SpeedX, SpeedY, shoot, Damage, KnockBack, i, (float)Main.rand.Next(0, 10 * (index + 1)), 0.0f); } } else if (sItem.itemId == 1931) { int num9 = 2; for (int index = 0; index < num9; ++index) { vector2_1 = new Vector2((float)((double)this.position.X + (double)this.width * 0.5 + (double)(Main.rand.Next(201) * -this.direction) + ((double)Main.mouseX + (double)Main.screenPosition.X - (double)this.position.X)), this.MountedCenter.Y - 600f); vector2_1.X = (float)(((double)vector2_1.X + (double)this.Center.X) / 2.0) + (float)Main.rand.Next(-200, 201); vector2_1.Y -= (float)(100 * index); float num10 = (float)Main.mouseX + Main.screenPosition.X - vector2_1.X; float num11 = (float)Main.mouseY + Main.screenPosition.Y - vector2_1.Y; if ((double)num11 < 0.0) num11 *= -1f; if ((double)num11 < 20.0) num11 = 20f; float num12 = (float)Math.Sqrt((double)num10 * (double)num10 + (double)num11 * (double)num11); float num13 = speed / num12; float num14 = num10 * num13; float num15 = num11 * num13; float SpeedX = num14 + (float)Main.rand.Next(-40, 41) * 0.02f; float SpeedY = num15 + (float)Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, (float)Main.rand.Next(5)); } } else if (sItem.itemId == 2750) { int num9 = 1; for (int index = 0; index < num9; ++index) { vector2_1 = new Vector2((float)((double)this.position.X + (double)this.width * 0.5 + (double)(Main.rand.Next(201) * -this.direction) + ((double)Main.mouseX + (double)Main.screenPosition.X - (double)this.position.X)), this.MountedCenter.Y - 600f); vector2_1.X = (float)(((double)vector2_1.X + (double)this.Center.X) / 2.0) + (float)Main.rand.Next(-200, 201); vector2_1.Y -= (float)(100 * index); float num10 = (float)((double)Main.mouseX + (double)Main.screenPosition.X - (double)vector2_1.X + (double)Main.rand.Next(-40, 41) * 0.0299999993294477); float num11 = (float)Main.mouseY + Main.screenPosition.Y - vector2_1.Y; if ((double)num11 < 0.0) num11 *= -1f; if ((double)num11 < 20.0) num11 = 20f; float num12 = (float)Math.Sqrt((double)num10 * (double)num10 + (double)num11 * (double)num11); float num13 = speed / num12; float num14 = num10 * num13; float num15 = num11 * num13; float num16 = num14; float num17 = num15 + (float)Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num16 * 0.75f, num17 * 0.75f, shoot + Main.rand.Next(3), Damage, KnockBack, i, 0.0f, (float)(0.5 + Main.rand.NextDouble() * 0.300000011920929)); } } else if (sItem.itemId == 3570) { int num9 = 3; for (int index = 0; index < num9; ++index) { vector2_1 = new Vector2((float)((double)this.position.X + (double)this.width * 0.5 + (double)(Main.rand.Next(201) * -this.direction) + ((double)Main.mouseX + (double)Main.screenPosition.X - (double)this.position.X)), this.MountedCenter.Y - 600f); vector2_1.X = (float)(((double)vector2_1.X + (double)this.Center.X) / 2.0) + (float)Main.rand.Next(-200, 201); vector2_1.Y -= (float)(100 * index); float num10 = (float)Main.mouseX + Main.screenPosition.X - vector2_1.X; float num11 = (float)Main.mouseY + Main.screenPosition.Y - vector2_1.Y; float ai1 = num11 + vector2_1.Y; if ((double)num11 < 0.0) num11 *= -1f; if ((double)num11 < 20.0) num11 = 20f; float num12 = (float)Math.Sqrt((double)num10 * (double)num10 + (double)num11 * (double)num11); float num13 = speed / num12; Vector2 vector2_4 = new Vector2(num10 * num13, num11 * num13) / 2f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, vector2_4.X, vector2_4.Y, shoot, Damage, KnockBack, i, 0.0f, ai1); } } else if (sItem.itemId == 3065) { Vector2 vector2_4 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY); float ai1 = vector2_4.Y; if ((double)ai1 > (double)this.Center.Y - 200.0) ai1 = this.Center.Y - 200f; for (int index = 0; index < 3; ++index) { vector2_1 = this.Center + new Vector2((float)(-Main.rand.Next(0, 401) * this.direction), -600f); vector2_1.Y -= (float)(100 * index); Vector2 vector2_5 = vector2_4 - vector2_1; if ((double)vector2_5.Y < 0.0) vector2_5.Y *= -1f; if ((double)vector2_5.Y < 20.0) vector2_5.Y = 20f; vector2_5.Normalize(); vector2_5 *= speed; float num9 = vector2_5.X; float num10 = vector2_5.Y; float SpeedX = num9; float SpeedY = num10 + (float)Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage * 2, KnockBack, i, 0.0f, ai1); } } else if (sItem.itemId == 2624) { float num9 = 0.3141593f; int num10 = 5; Vector2 spinningpoint = new Vector2(num7, num8); spinningpoint.Normalize(); spinningpoint *= 40f; bool flag3 = Collision.CanHit(vector2_1, 0, 0, vector2_1 + spinningpoint, 0, 0); for (int index1 = 0; index1 < num10; ++index1) { float num11 = (float)index1 - (float)(((double)num10 - 1.0) / 2.0); Vector2 vector2_4 = Utils.RotatedBy(spinningpoint, (double)num9 * (double)num11, new Vector2()); if (!flag3) vector2_4 -= spinningpoint; int index2 = Projectile.NewProjectile(vector2_1.X + vector2_4.X, vector2_1.Y + vector2_4.Y, num7, num8, shoot, Damage, KnockBack, i, 0.0f, 0.0f); Main.projectile[index2].noDropItem = true; } } else if (sItem.itemId == 1929) { float SpeedX = num7 + (float)Main.rand.Next(-40, 41) * 0.03f; float SpeedY = num8 + (float)Main.rand.Next(-40, 41) * 0.03f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 1553) { float SpeedX = num7 + (float)Main.rand.Next(-40, 41) * 0.005f; float SpeedY = num8 + (float)Main.rand.Next(-40, 41) * 0.005f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 518) { float num9 = num7; float num10 = num8; float SpeedX = num9 + (float)Main.rand.Next(-40, 41) * 0.04f; float SpeedY = num10 + (float)Main.rand.Next(-40, 41) * 0.04f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 1265) { float num9 = num7; float num10 = num8; float SpeedX = num9 + (float)Main.rand.Next(-30, 31) * 0.03f; float SpeedY = num10 + (float)Main.rand.Next(-30, 31) * 0.03f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 534) { int num9 = Main.rand.Next(4, 6); for (int index = 0; index < num9; ++index) { float num10 = num7; float num11 = num8; float SpeedX = num10 + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = num11 + (float)Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } } else if (sItem.itemId == 2188) { int num9 = 4; if (Main.rand.Next(3) == 0) ++num9; if (Main.rand.Next(4) == 0) ++num9; if (Main.rand.Next(5) == 0) ++num9; for (int index = 0; index < num9; ++index) { float num10 = num7; float num11 = num8; float num12 = 0.05f * (float)index; float num13 = num10 + (float)Main.rand.Next(-35, 36) * num12; float num14 = num11 + (float)Main.rand.Next(-35, 36) * num12; float num15 = (float)Math.Sqrt((double)num13 * (double)num13 + (double)num14 * (double)num14); float num16 = speed / num15; float SpeedX = num13 * num16; float SpeedY = num14 * num16; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } } else if (sItem.itemId == 1308) { int num9 = 3; if (Main.rand.Next(3) == 0) ++num9; for (int index = 0; index < num9; ++index) { float num10 = num7; float num11 = num8; float num12 = 0.05f * (float)index; float num13 = num10 + (float)Main.rand.Next(-35, 36) * num12; float num14 = num11 + (float)Main.rand.Next(-35, 36) * num12; float num15 = (float)Math.Sqrt((double)num13 * (double)num13 + (double)num14 * (double)num14); float num16 = speed / num15; float SpeedX = num13 * num16; float SpeedY = num14 * num16; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } } else if (sItem.itemId == 1258) { float num9 = num7; float num10 = num8; float SpeedX = num9 + (float)Main.rand.Next(-40, 41) * 0.01f; float SpeedY = num10 + (float)Main.rand.Next(-40, 41) * 0.01f; vector2_1.X += (float)Main.rand.Next(-40, 41) * 0.05f; vector2_1.Y += (float)Main.rand.Next(-45, 36) * 0.05f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 964) { int num9 = Main.rand.Next(3, 5); for (int index = 0; index < num9; ++index) { float num10 = num7; float num11 = num8; float SpeedX = num10 + (float)Main.rand.Next(-35, 36) * 0.04f; float SpeedY = num11 + (float)Main.rand.Next(-35, 36) * 0.04f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } } else if (sItem.itemId == 1569) { int num9 = 4; if (Main.rand.Next(2) == 0) ++num9; if (Main.rand.Next(4) == 0) ++num9; if (Main.rand.Next(8) == 0) ++num9; if (Main.rand.Next(16) == 0) ++num9; for (int index = 0; index < num9; ++index) { float num10 = num7; float num11 = num8; float num12 = 0.05f * (float)index; float num13 = num10 + (float)Main.rand.Next(-35, 36) * num12; float num14 = num11 + (float)Main.rand.Next(-35, 36) * num12; float num15 = (float)Math.Sqrt((double)num13 * (double)num13 + (double)num14 * (double)num14); float num16 = speed / num15; float SpeedX = num13 * num16; float SpeedY = num14 * num16; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } } else if (sItem.itemId == 1572 || sItem.itemId == 2366 || (sItem.itemId == 3571 || sItem.itemId == 3569)) { int num9 = sItem.shoot; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].owner == this.whoAmI && Main.projectile[index].type == num9) Main.projectile[index].Kill(); } bool flag3 = sItem.itemId == 3571 || sItem.itemId == 3569; int i1 = (int)((double)Main.mouseX + (double)Main.screenPosition.X) / 16; int j = (int)((double)Main.mouseY + (double)Main.screenPosition.Y) / 16; if ((double)this.gravDir == -1.0) j = (int)((double)Main.screenPosition.Y + (double)Main.screenHeight - (double)Main.mouseY) / 16; if (!flag3) { while (j < Main.maxTilesY - 10 && Main.tile[i1, j] != null && (!WorldGen.SolidTile2(i1, j) && Main.tile[i1 - 1, j] != null) && (!WorldGen.SolidTile2(i1 - 1, j) && Main.tile[i1 + 1, j] != null && !WorldGen.SolidTile2(i1 + 1, j))) ++j; --j; } Projectile.NewProjectile((float)Main.mouseX + Main.screenPosition.X, (float)(j * 16 - 24), 0.0f, 15f, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 1244 || sItem.itemId == 1256) { int index = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num7, num8, shoot, Damage, KnockBack, i, 0.0f, 0.0f); Main.projectile[index].ai[0] = (float)Main.mouseX + Main.screenPosition.X; Main.projectile[index].ai[1] = (float)Main.mouseY + Main.screenPosition.Y; } else if (sItem.itemId == 1229) { int num9 = Main.rand.Next(2, 4); if (Main.rand.Next(5) == 0) ++num9; for (int index1 = 0; index1 < num9; ++index1) { float SpeedX = num7; float SpeedY = num8; if (index1 > 0) { SpeedX += (float)Main.rand.Next(-35, 36) * 0.04f; SpeedY += (float)Main.rand.Next(-35, 36) * 0.04f; } if (index1 > 1) { SpeedX += (float)Main.rand.Next(-35, 36) * 0.04f; SpeedY += (float)Main.rand.Next(-35, 36) * 0.04f; } if (index1 > 2) { SpeedX += (float)Main.rand.Next(-35, 36) * 0.04f; SpeedY += (float)Main.rand.Next(-35, 36) * 0.04f; } int index2 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); Main.projectile[index2].noDropItem = true; } } else if (sItem.itemId == 1121) { int num9 = Main.rand.Next(1, 4); if (Main.rand.Next(6) == 0) ++num9; if (Main.rand.Next(6) == 0) ++num9; if (this.strongBees && Main.rand.Next(3) == 0) ++num9; for (int index1 = 0; index1 < num9; ++index1) { float num10 = num7; float num11 = num8; float SpeedX = num10 + (float)Main.rand.Next(-35, 36) * 0.02f; float SpeedY = num11 + (float)Main.rand.Next(-35, 36) * 0.02f; int index2 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, this.beeType(), this.beeDamage(Damage), this.beeKB(KnockBack), i, 0.0f, 0.0f); Main.projectile[index2].magic = true; } } else if (sItem.itemId == 1155) { int num9 = Main.rand.Next(2, 5); if (Main.rand.Next(5) == 0) ++num9; if (Main.rand.Next(5) == 0) ++num9; for (int index = 0; index < num9; ++index) { float num10 = num7; float num11 = num8; float SpeedX = num10 + (float)Main.rand.Next(-35, 36) * 0.02f; float SpeedY = num11 + (float)Main.rand.Next(-35, 36) * 0.02f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } } else if (sItem.itemId == 1801) { int num9 = Main.rand.Next(1, 4); for (int index = 0; index < num9; ++index) { float num10 = num7; float num11 = num8; float SpeedX = num10 + (float)Main.rand.Next(-35, 36) * 0.05f; float SpeedY = num11 + (float)Main.rand.Next(-35, 36) * 0.05f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } } else if (sItem.itemId == 679) { for (int index = 0; index < 6; ++index) { float num9 = num7; float num10 = num8; float SpeedX = num9 + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = num10 + (float)Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } } else if (sItem.itemId == 2623) { for (int index = 0; index < 3; ++index) { float num9 = num7; float num10 = num8; float SpeedX = num9 + (float)Main.rand.Next(-40, 41) * 0.1f; float SpeedY = num10 + (float)Main.rand.Next(-40, 41) * 0.1f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } } else if (sItem.itemId == 3210) { Vector2 vector2_4 = new Vector2(num7, num8); vector2_4.X += (float)Main.rand.Next(-30, 31) * 0.04f; vector2_4.Y += (float)Main.rand.Next(-30, 31) * 0.03f; vector2_4.Normalize(); vector2_4 *= (float)Main.rand.Next(70, 91) * 0.1f; vector2_4.X += (float)Main.rand.Next(-30, 31) * 0.04f; vector2_4.Y += (float)Main.rand.Next(-30, 31) * 0.03f; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, vector2_4.X, vector2_4.Y, shoot, Damage, KnockBack, i, (float)Main.rand.Next(20), 0.0f); } else if (sItem.itemId == 434) { float SpeedX = num7; float SpeedY = num8; if (this.itemAnimation < 5) { float num9 = SpeedX + (float)Main.rand.Next(-40, 41) * 0.01f; float num10 = SpeedY + (float)Main.rand.Next(-40, 41) * 0.01f; SpeedX = num9 * 1.1f; SpeedY = num10 * 1.1f; } else if (this.itemAnimation < 10) { float num9 = SpeedX + (float)Main.rand.Next(-20, 21) * 0.01f; float num10 = SpeedY + (float)Main.rand.Next(-20, 21) * 0.01f; SpeedX = num9 * 1.05f; SpeedY = num10 * 1.05f; } Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 1157) { shoot = Main.rand.Next(191, 195); float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float)Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float)Main.mouseY + Main.screenPosition.Y; int index = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); Main.projectile[index].localAI[0] = 30f; } else if (sItem.itemId == 1802) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float)Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 2364 || sItem.itemId == 2365) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float)Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 2535) { float x = 0.0f; float y = 0.0f; vector2_1.X = (float)Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float)Main.mouseY + Main.screenPosition.Y; Vector2 spinningpoint = new Vector2(x, y); spinningpoint = Utils.RotatedBy(spinningpoint, 1.57079637050629, new Vector2()); Projectile.NewProjectile(vector2_1.X + spinningpoint.X, vector2_1.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, shoot, Damage, KnockBack, i, 0.0f, 0.0f); spinningpoint = Utils.RotatedBy(spinningpoint, -3.14159274101257, new Vector2()); Projectile.NewProjectile(vector2_1.X + spinningpoint.X, vector2_1.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, shoot + 1, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 2551) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float)Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot + Main.rand.Next(3), Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 2584) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float)Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot + Main.rand.Next(3), Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 2621) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float)Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 2749 || sItem.itemId == 3249 || sItem.itemId == 3474) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float)Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 3531) { int num9 = -1; int index1 = -1; for (int index2 = 0; index2 < 1000; ++index2) { if (Main.projectile[index2].active && Main.projectile[index2].owner == Main.myPlayer) { if (num9 == -1 && Main.projectile[index2].type == 625) num9 = index2; if (index1 == -1 && Main.projectile[index2].type == 628) index1 = index2; if (num9 != -1 && index1 != -1) break; } } if (num9 == -1 && index1 == -1) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float)Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float)Main.mouseY + Main.screenPosition.Y; int num10 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); int num11 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot + 1, Damage, KnockBack, i, (float)num10, 0.0f); int index2 = num11; int num12 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot + 2, Damage, KnockBack, i, (float)num11, 0.0f); Main.projectile[index2].localAI[1] = (float)num12; int index3 = num12; int num13 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot + 3, Damage, KnockBack, i, (float)num12, 0.0f); Main.projectile[index3].localAI[1] = (float)num13; } else if (num9 != -1 && index1 != -1) { int num10 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num7, num8, shoot + 1, Damage, KnockBack, i, Main.projectile[index1].ai[0], 0.0f); int index2 = num10; int index3 = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num7, num8, shoot + 2, Damage, KnockBack, i, (float)num10, 0.0f); Main.projectile[index2].localAI[1] = (float)index3; Main.projectile[index3].localAI[1] = (float)index1; Main.projectile[index1].ai[0] = (float)index3; Main.projectile[index1].netUpdate = true; Main.projectile[index1].ai[1] = 1f; } } else if (sItem.itemId == 1309) { float SpeedX = 0.0f; float SpeedY = 0.0f; vector2_1.X = (float)Main.mouseX + Main.screenPosition.X; vector2_1.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.shoot > 0 && (Main.projPet[sItem.shoot] || sItem.shoot == 72 || (sItem.shoot == 18 || sItem.shoot == 500) || sItem.shoot == 650) && !sItem.summon) { for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == this.whoAmI) { if (sItem.shoot == 72) { if (Main.projectile[index].type == 72 || Main.projectile[index].type == 86 || Main.projectile[index].type == 87) Main.projectile[index].Kill(); } else if (sItem.shoot == Main.projectile[index].type) Main.projectile[index].Kill(); } } Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num7, num8, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 3006) { Vector2 vector2_4; vector2_4.X = (float)Main.mouseX + Main.screenPosition.X; vector2_4.Y = (float)Main.mouseY + Main.screenPosition.Y; while (Collision.CanHitLine(this.position, this.width, this.height, vector2_1, 1, 1)) { vector2_1.X += num7; vector2_1.Y += num8; if ((double)(vector2_1 - vector2_4).Length() < 20.0 + (double)Math.Abs(num7) + (double)Math.Abs(num8)) { vector2_1 = vector2_4; break; } } Projectile.NewProjectile(vector2_1.X, vector2_1.Y, 0.0f, 0.0f, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 3014) { Vector2 vector2_4; vector2_4.X = (float)Main.mouseX + Main.screenPosition.X; vector2_4.Y = (float)Main.mouseY + Main.screenPosition.Y; while (Collision.CanHitLine(this.position, this.width, this.height, vector2_1, 1, 1)) { vector2_1.X += num7; vector2_1.Y += num8; if ((double)(vector2_1 - vector2_4).Length() < 20.0 + (double)Math.Abs(num7) + (double)Math.Abs(num8)) { vector2_1 = vector2_4; break; } } bool flag3 = false; int j1 = (int)vector2_1.Y / 16; int i1 = (int)vector2_1.X / 16; int num9 = j1; while (j1 < Main.maxTilesY - 10 && j1 - num9 < 30 && !WorldGen.SolidTile(i1, j1)) ++j1; if (!WorldGen.SolidTile(i1, j1)) flag3 = true; float num10 = (float)(j1 * 16); int j2 = num9; while (j2 > 10 && num9 - j2 < 30 && !WorldGen.SolidTile(i1, j2)) --j2; float num11 = (float)(j2 * 16 + 16); float ai1 = num10 - num11; int num12 = 10; if ((double)ai1 > (double)(16 * num12)) ai1 = (float)(16 * num12); float ai0 = num10 - ai1; vector2_1.X = (float)((int)((double)vector2_1.X / 16.0) * 16); if (!flag3) Projectile.NewProjectile(vector2_1.X, vector2_1.Y, 0.0f, 0.0f, shoot, Damage, KnockBack, i, ai0, ai1); } else if (sItem.itemId == 3384) { int num9 = this.altFunctionUse == 2 ? 1 : 0; Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num7, num8, shoot, Damage, KnockBack, i, 0.0f, (float)num9); } else if (sItem.itemId == 3473) { float ai1 = (float)(((double)Utils.NextFloat(Main.rand) - 0.5) * 0.785398185253143); Vector2 vector2_4 = new Vector2(num7, num8); Projectile.NewProjectile(vector2_1.X, vector2_1.Y, vector2_4.X, vector2_4.Y, shoot, Damage, KnockBack, i, 0.0f, ai1); } else if (sItem.itemId == 3542) { float num9 = (float)(((double)Utils.NextFloat(Main.rand) - 0.5) * 0.785398185253143); for (int index = 0; index < 10 && !Collision.CanHit(vector2_1, 0, 0, vector2_1 + Utils.RotatedBy(new Vector2(num7, num8), (double)num9, new Vector2()) * 100f, 0, 0); ++index) num9 = (float)(((double)Utils.NextFloat(Main.rand) - 0.5) * 0.785398185253143); Vector2 vector2_4 = Utils.RotatedBy(new Vector2(num7, num8), (double)num9, new Vector2()) * (float)(0.850000023841858 + (double)Utils.NextFloat(Main.rand) * 0.300000011920929); Projectile.NewProjectile(vector2_1.X, vector2_1.Y, vector2_4.X, vector2_4.Y, shoot, Damage, KnockBack, i, 0.0f, 0.0f); } else if (sItem.itemId == 3475) Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num7, num8, 615, Damage, KnockBack, i, (float)(5 * Main.rand.Next(0, 20)), 0.0f); else if (sItem.itemId == 3540) Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num7, num8, 630, Damage, KnockBack, i, 0.0f, 0.0f); else if (sItem.itemId == 3546) { for (int index = 0; index < 2; ++index) { float num9 = num7; float num10 = num8; float num11 = num9 + (float)Main.rand.Next(-40, 41) * 0.05f; float num12 = num10 + (float)Main.rand.Next(-40, 41) * 0.05f; Vector2 vector2_4 = vector2_1 + Vector2.Normalize(Utils.RotatedBy(new Vector2(num11, num12), -1.57079637050629 * (double)this.direction, new Vector2())) * 6f; Projectile.NewProjectile(vector2_4.X, vector2_4.Y, num11, num12, 167 + Main.rand.Next(4), Damage, KnockBack, i, 0.0f, 1f); } } else if (sItem.itemId == 3350) { float num9 = num7; float num10 = num8; float num11 = num9 + (float)Main.rand.Next(-1, 2) * 0.5f; float num12 = num10 + (float)Main.rand.Next(-1, 2) * 0.5f; if (Collision.CanHitLine(this.Center, 0, 0, vector2_1 + new Vector2(num11, num12) * 2f, 0, 0)) vector2_1 += new Vector2(num11, num12); Projectile.NewProjectile(vector2_1.X, vector2_1.Y - this.gravDir * 4f, num11, num12, shoot, Damage, KnockBack, i, 0.0f, (float)Main.rand.Next(12) / 6f); } else { int index = Projectile.NewProjectile(vector2_1.X, vector2_1.Y, num7, num8, shoot, Damage, KnockBack, i, 0.0f, 0.0f); if (sItem.itemId == 726) Main.projectile[index].magic = true; if (sItem.itemId == 724 || sItem.itemId == 676) Main.projectile[index].melee = true; if (shoot == 80) { Main.projectile[index].ai[0] = (float)Player.tileTargetX; Main.projectile[index].ai[1] = (float)Player.tileTargetY; } if (shoot == 442) { Main.projectile[index].ai[0] = (float)Player.tileTargetX; Main.projectile[index].ai[1] = (float)Player.tileTargetY; } if ((this.thrownCost50 || this.thrownCost33) && this.inventory[this.selectedItem].thrown) Main.projectile[index].noDropItem = true; if (Main.projectile[index].aiStyle == 99) AchievementsHelper.HandleSpecialEvent(this, 7); } } else if (sItem.useStyle == 5) { this.itemRotation = 0.0f; NetMessage.SendData(41, -1, -1, "", this.whoAmI, 0.0f, 0.0f, 0.0f, 0, 0, 0); } } if (this.whoAmI == Main.myPlayer && (sItem.itemId == 509 || sItem.itemId == 510 || (sItem.itemId == 849 || sItem.itemId == 850) || sItem.itemId == 851) && ((double)this.position.X / 16.0 - (double)Player.tileRangeX - (double)sItem.tileBoost - (double)this.blockRange <= (double)Player.tileTargetX && ((double)this.position.X + (double)this.width) / 16.0 + (double)Player.tileRangeX + (double)sItem.tileBoost - 1.0 + (double)this.blockRange >= (double)Player.tileTargetX && ((double)this.position.Y / 16.0 - (double)Player.tileRangeY - (double)sItem.tileBoost - (double)this.blockRange <= (double)Player.tileTargetY && ((double)this.position.Y + (double)this.height) / 16.0 + (double)Player.tileRangeY + (double)sItem.tileBoost - 2.0 + (double)this.blockRange >= (double)Player.tileTargetY))) { this.showItemIcon = true; if (this.itemAnimation > 0 && this.itemTime == 0 && this.controlUseItem) { int i1 = Player.tileTargetX; int j = Player.tileTargetY; var wireType = k_WireFlags.WIRE_NONE; if (sItem.itemId == 509) wireType = k_WireFlags.WIRE_RED; else if (sItem.itemId == 850) wireType = k_WireFlags.WIRE_GREEN; else if (sItem.itemId == 851) wireType = k_WireFlags.WIRE_BLUE; if (wireType != k_WireFlags.WIRE_NONE) { int index1 = -1; for (int index2 = 0; index2 < 58; ++index2) { if (this.inventory[index2].stack > 0 && this.inventory[index2].itemId == 530) { index1 = index2; break; } } if (index1 >= 0 && WorldGen.PlaceWire(i1, j, wireType)) { --this.inventory[index1].stack; if (this.inventory[index1].stack <= 0) this.inventory[index1].SetDefaults(0, false); this.itemTime = sItem.useTime; NetMessage.SendData(17, -1, -1, "", Tile.k_HACK_GetNetworkWirePlaceType(wireType), (float)Player.tileTargetX, (float)Player.tileTargetY, 0.0f, 0, 0, 0); } } else if (sItem.itemId == 510) { var flags = new k_WireFlags[] { k_WireFlags.WIRE_ACTUATOR, k_WireFlags.WIRE_BLUE, k_WireFlags.WIRE_GREEN, k_WireFlags.WIRE_RED }; for (int flag = 0; flag < 4; ++flag) { if (WorldGen.KillWire(i1, j, flags[flag])) { this.itemTime = sItem.useTime; NetMessage.SendData(17, -1, -1, "", Tile.k_HACK_GetNetworkWireKillType(flags[flag]), (float)Player.tileTargetX, (float)Player.tileTargetY, 0.0f, 0, 0, 0); break; } } } else if (sItem.itemId == 849 && sItem.stack > 0 && WorldGen.PlaceWire(i1, j, k_WireFlags.WIRE_ACTUATOR)) { this.itemTime = sItem.useTime; NetMessage.SendData(17, -1, -1, "", 8, (float)Player.tileTargetX, (float)Player.tileTargetY, 0.0f, 0, 0, 0); --sItem.stack; if (sItem.stack <= 0) sItem.SetDefaults(0, false); } } } if (this.itemAnimation > 0 && this.itemTime == 0 && (sItem.itemId == 507 || sItem.itemId == 508)) { this.itemTime = sItem.useTime; Vector2 vector2 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num4 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num5 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; float num6 = (float)Math.Sqrt((double)num4 * (double)num4 + (double)num5 * (double)num5) / (float)(Main.screenHeight / 2); if ((double)num6 > 1.0) num6 = 1f; float number2 = (float)((double)num6 * 2.0 - 1.0); if ((double)number2 < -1.0) number2 = -1f; if ((double)number2 > 1.0) number2 = 1f; Main.harpNote = number2; int Style = 26; if (sItem.itemId == 507) Style = 35; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, Style); NetMessage.SendData(58, -1, -1, "", this.whoAmI, number2, 0.0f, 0.0f, 0, 0, 0); } if ((sItem.itemId >= 205 && sItem.itemId <= 207 || (sItem.itemId == 1128 || sItem.itemId == 3031) || sItem.itemId == 3032) && ((double)this.position.X / 16.0 - (double)Player.tileRangeX - (double)sItem.tileBoost <= (double)Player.tileTargetX && ((double)this.position.X + (double)this.width) / 16.0 + (double)Player.tileRangeX + (double)sItem.tileBoost - 1.0 >= (double)Player.tileTargetX && ((double)this.position.Y / 16.0 - (double)Player.tileRangeY - (double)sItem.tileBoost <= (double)Player.tileTargetY && ((double)this.position.Y + (double)this.height) / 16.0 + (double)Player.tileRangeY + (double)sItem.tileBoost - 2.0 >= (double)Player.tileTargetY))) { this.showItemIcon = true; if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem) { if (sItem.itemId == 205 || sItem.itemId == 3032 && (int)Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == 0) { int num4 = (int)Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(); int num5 = 0; for (int index1 = Player.tileTargetX - 1; index1 <= Player.tileTargetX + 1; ++index1) { for (int index2 = Player.tileTargetY - 1; index2 <= Player.tileTargetY + 1; ++index2) { if ((int)Main.tile[index1, index2].liquidType() == num4) num5 += (int)Main.tile[index1, index2].liquid; } } if ((int)Main.tile[Player.tileTargetX, Player.tileTargetY].liquid > 0 && (num5 > 100 || sItem.itemId == 3032)) { int liquidType = (int)Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(); if (sItem.itemId != 3032) { if (!Main.tile[Player.tileTargetX, Player.tileTargetY].lava()) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].honey()) { --sItem.stack; this.PutItemInInventory(1128, this.selectedItem); } else { --sItem.stack; this.PutItemInInventory(206, this.selectedItem); } } else { --sItem.stack; this.PutItemInInventory(207, this.selectedItem); } } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1); this.itemTime = sItem.useTime; int num6 = (int)Main.tile[Player.tileTargetX, Player.tileTargetY].liquid; Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = (byte)0; Main.tile[Player.tileTargetX, Player.tileTargetY].lava(false); Main.tile[Player.tileTargetX, Player.tileTargetY].honey(false); WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, false); if (Main.netMode == 1) NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); else Liquid.AddWater(Player.tileTargetX, Player.tileTargetY); for (int index1 = Player.tileTargetX - 1; index1 <= Player.tileTargetX + 1; ++index1) { for (int index2 = Player.tileTargetY - 1; index2 <= Player.tileTargetY + 1; ++index2) { if (num6 < 256 && (int)Main.tile[index1, index2].liquidType() == num4) { int num7 = (int)Main.tile[index1, index2].liquid; if (num7 + num6 > (int)byte.MaxValue) num7 = (int)byte.MaxValue - num6; num6 += num7; Main.tile[index1, index2].liquid -= (byte)num7; Main.tile[index1, index2].liquidType(liquidType); if ((int)Main.tile[index1, index2].liquid == 0) { Main.tile[index1, index2].lava(false); Main.tile[index1, index2].honey(false); } WorldGen.SquareTileFrame(index1, index2, false); if (Main.netMode == 1) NetMessage.sendWater(index1, index2); else Liquid.AddWater(index1, index2); } } } } } else if ((int)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 (sItem.itemId == 207) { if ((int)Main.tile[Player.tileTargetX, Player.tileTargetY].liquid == 0 || (int)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 = byte.MaxValue; WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true); --sItem.stack; this.PutItemInInventory(205, this.selectedItem); this.itemTime = sItem.useTime; if (Main.netMode == 1) NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); } } else if (sItem.itemId == 206 || sItem.itemId == 3031) { if ((int)Main.tile[Player.tileTargetX, Player.tileTargetY].liquid == 0 || (int)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 = byte.MaxValue; WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true); if (sItem.itemId != 3031) { --sItem.stack; this.PutItemInInventory(205, this.selectedItem); } this.itemTime = sItem.useTime; if (Main.netMode == 1) NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); } } else if (sItem.itemId == 1128 && ((int)Main.tile[Player.tileTargetX, Player.tileTargetY].liquid == 0 || (int)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 = byte.MaxValue; WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true); --sItem.stack; this.PutItemInInventory(205, this.selectedItem); this.itemTime = sItem.useTime; if (Main.netMode == 1) NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); } } } } if (!this.channel) { this.toolTime = this.itemTime; } else { --this.toolTime; if (this.toolTime < 0) this.toolTime = sItem.pick <= 0 ? (int)((double)sItem.useTime * (double)this.pickSpeed) : sItem.useTime; } if ((sItem.pick > 0 || sItem.axe > 0 || sItem.hammer > 0) && ((double)this.position.X / 16.0 - (double)Player.tileRangeX - (double)sItem.tileBoost <= (double)Player.tileTargetX && ((double)this.position.X + (double)this.width) / 16.0 + (double)Player.tileRangeX + (double)sItem.tileBoost - 1.0 >= (double)Player.tileTargetX && ((double)this.position.Y / 16.0 - (double)Player.tileRangeY - (double)sItem.tileBoost <= (double)Player.tileTargetY && ((double)this.position.Y + (double)this.height) / 16.0 + (double)Player.tileRangeY + (double)sItem.tileBoost - 2.0 >= (double)Player.tileTargetY))) { int damageAmount1 = 0; bool flag3 = 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] && ((int)Main.tile[Player.tileTargetX, Player.tileTargetY].type != 314 && (int)Main.tile[Player.tileTargetX, Player.tileTargetY].type != 351))) this.poundRelease = false; if (Main.tile[Player.tileTargetX, Player.tileTargetY].active()) { if (sItem.pick > 0 && !Main.tileAxe[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type] && !Main.tileHammer[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type] || (sItem.axe > 0 && Main.tileAxe[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type] || sItem.hammer > 0 && Main.tileHammer[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type])) flag3 = false; if (this.toolTime == 0 && this.itemAnimation > 0 && this.controlUseItem) { int tileId = this.hitTile.HitObject(Player.tileTargetX, Player.tileTargetY, 1); if (Main.tileNoFail[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]) damageAmount1 = 100; if (Main.tileHammer[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { flag3 = false; if (sItem.hammer > 0) { damageAmount1 += sItem.hammer; if (!WorldGen.CanKillTile(Player.tileTargetX, Player.tileTargetY)) damageAmount1 = 0; if ((int)Main.tile[Player.tileTargetX, Player.tileTargetY].type == 26 && (sItem.hammer < 80 || !Main.hardMode)) { damageAmount1 = 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, damageAmount1, 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, 0.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 (damageAmount1 != 0) this.hitTile.Prune(); this.itemTime = sItem.useTime; AchievementsHelper.CurrentlyMining = false; } } else if (Main.tileAxe[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { if ((int)Main.tile[Player.tileTargetX, Player.tileTargetY].type == 80) damageAmount1 += sItem.axe * 3; else damageAmount1 += sItem.axe; if (sItem.axe > 0) { AchievementsHelper.CurrentlyMining = true; if (!WorldGen.CanKillTile(Player.tileTargetX, Player.tileTargetY)) damageAmount1 = 0; if (this.hitTile.AddDamage(tileId, damageAmount1, 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, 0.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 (damageAmount1 != 0) this.hitTile.Prune(); this.itemTime = sItem.useTime; AchievementsHelper.CurrentlyMining = false; } } else if (sItem.pick > 0) { this.PickTile(Player.tileTargetX, Player.tileTargetY, sItem.pick); this.itemTime = (int)((double)sItem.useTime * (double)this.pickSpeed); } if (sItem.pick > 0) this.itemTime = (int)((double)sItem.useTime * (double)this.pickSpeed); if (sItem.hammer > 0 && Main.tile[Player.tileTargetX, Player.tileTargetY].active() && (Main.tileSolid[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type] && (int)Main.tile[Player.tileTargetX, Player.tileTargetY].type != 10 || ((int)Main.tile[Player.tileTargetX, Player.tileTargetY].type == 314 || (int)Main.tile[Player.tileTargetX, Player.tileTargetY].type == 351)) && this.poundRelease) { flag3 = false; this.itemTime = sItem.useTime; int num4 = damageAmount1 + (int)((double)sItem.hammer * 1.25); damageAmount1 = 100; if (Main.tile[Player.tileTargetX, Player.tileTargetY - 1].active() && (int)Main.tile[Player.tileTargetX, Player.tileTargetY - 1].type == 10) damageAmount1 = 0; if (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].active() && (int)Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type == 10) damageAmount1 = 0; if (this.hitTile.AddDamage(tileId, damageAmount1, true) >= 100) { this.hitTile.Clear(tileId); if (this.poundRelease) { int i1 = Player.tileTargetX; int j = Player.tileTargetY; if ((int)Main.tile[i1, j].type == 19) { if (Main.tile[i1, j].halfBrick()) { WorldGen.PoundTile(i1, j); if (Main.netMode == 1) NetMessage.SendData(17, -1, -1, "", 7, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0); } else { int slope1 = 1; int slope2 = 2; if ((int)Main.tile[i1 + 1, j - 1].type == 19 || (int)Main.tile[i1 - 1, j + 1].type == 19 || WorldGen.SolidTile(i1 + 1, j) && !WorldGen.SolidTile(i1 - 1, j)) { slope1 = 2; slope2 = 1; } if ((int)Main.tile[i1, j].slope() == 0) { WorldGen.SlopeTile(i1, j, slope1); int num5 = (int)Main.tile[i1, j].slope(); if (Main.netMode == 1) NetMessage.SendData(17, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num5, 0, 0, 0); } else if ((int)Main.tile[i1, j].slope() == slope1) { WorldGen.SlopeTile(i1, j, slope2); int num5 = (int)Main.tile[i1, j].slope(); if (Main.netMode == 1) NetMessage.SendData(17, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num5, 0, 0, 0); } else { WorldGen.SlopeTile(i1, j, 0); int num5 = (int)Main.tile[i1, j].slope(); if (Main.netMode == 1) NetMessage.SendData(17, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num5, 0, 0, 0); WorldGen.PoundTile(i1, j); if (Main.netMode == 1) NetMessage.SendData(17, -1, -1, "", 7, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0); } } } else if ((int)Main.tile[i1, j].type == 314) { if (Minecart.FrameTrack(i1, j, true, false) && Main.netMode == 1) NetMessage.SendData(17, -1, -1, "", 15, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0); } else if ((int)Main.tile[i1, j].type == 137) { Main.tile[i1, j].frameX = (int)Main.tile[i1, j].frameX != 18 ? (short)18 : (short)0; if (Main.netMode == 1) NetMessage.SendTileSquare(-1, Player.tileTargetX, Player.tileTargetY, 1); } else if ((Main.tile[i1, j].halfBrick() || (int)Main.tile[i1, j].slope() != 0) && !Main.tileSolidTop[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { int num5 = 1; int slope1 = 1; int slope2 = 2; if ((WorldGen.SolidTile(i1 + 1, j) || (int)Main.tile[i1 + 1, j].slope() == 1 || (int)Main.tile[i1 + 1, j].slope() == 3) && !WorldGen.SolidTile(i1 - 1, j)) { slope1 = 2; slope2 = 1; } if (WorldGen.SolidTile(i1, j - 1) && !WorldGen.SolidTile(i1, j + 1)) num5 = -1; if (num5 == 1) { if ((int)Main.tile[i1, j].slope() == 0) WorldGen.SlopeTile(i1, j, slope1); else if ((int)Main.tile[i1, j].slope() == slope1) WorldGen.SlopeTile(i1, j, slope2); else if ((int)Main.tile[i1, j].slope() == slope2) WorldGen.SlopeTile(i1, j, slope1 + 2); else if ((int)Main.tile[i1, j].slope() == slope1 + 2) WorldGen.SlopeTile(i1, j, slope2 + 2); else WorldGen.SlopeTile(i1, j, 0); } else if ((int)Main.tile[i1, j].slope() == 0) WorldGen.SlopeTile(i1, j, slope1 + 2); else if ((int)Main.tile[i1, j].slope() == slope1 + 2) WorldGen.SlopeTile(i1, j, slope2 + 2); else if ((int)Main.tile[i1, j].slope() == slope2 + 2) WorldGen.SlopeTile(i1, j, slope1); else if ((int)Main.tile[i1, j].slope() == slope1) WorldGen.SlopeTile(i1, j, slope2); else WorldGen.SlopeTile(i1, j, 0); int num6 = (int)Main.tile[i1, j].slope(); if (Main.netMode == 1) NetMessage.SendData(17, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num6, 0, 0, 0); } else { WorldGen.PoundTile(i1, j); 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 index1 = Player.tileTargetX; int index2 = Player.tileTargetY; bool flag4 = true; if ((int)Main.tile[index1, index2].wall > 0) { if (!Main.wallHouse[(int)Main.tile[index1, index2].wall]) { for (int index3 = index1 - 1; index3 < index1 + 2; ++index3) { for (int index4 = index2 - 1; index4 < index2 + 2; ++index4) { if ((int)Main.tile[index3, index4].wall != (int)Main.tile[index1, index2].wall) { flag4 = false; break; } } } } else flag4 = false; } if (flag4 && !Main.tile[index1, index2].active()) { int num4 = -1; if (((double)Main.mouseX + (double)Main.screenPosition.X) / 16.0 < Math.Round(((double)Main.mouseX + (double)Main.screenPosition.X) / 16.0)) num4 = 0; int num5 = -1; if (((double)Main.mouseY + (double)Main.screenPosition.Y) / 16.0 < Math.Round(((double)Main.mouseY + (double)Main.screenPosition.Y) / 16.0)) num5 = 0; for (int index3 = Player.tileTargetX + num4; index3 <= Player.tileTargetX + num4 + 1; ++index3) { for (int index4 = Player.tileTargetY + num5; index4 <= Player.tileTargetY + num5 + 1; ++index4) { if (flag4) { index1 = index3; index2 = index4; if ((int)Main.tile[index1, index2].wall > 0) { if (!Main.wallHouse[(int)Main.tile[index1, index2].wall]) { for (int index5 = index1 - 1; index5 < index1 + 2; ++index5) { for (int index6 = index2 - 1; index6 < index2 + 2; ++index6) { if ((int)Main.tile[index5, index6].wall != (int)Main.tile[index1, index2].wall) { flag4 = false; break; } } } } else flag4 = false; } } } } } if (flag3 && (int)Main.tile[index1, index2].wall > 0 && (!Main.tile[index1, index2].active() || index1 != Player.tileTargetX || index2 != Player.tileTargetY || !Main.tileHammer[(int)Main.tile[index1, index2].type] && !this.poundRelease) && (this.toolTime == 0 && this.itemAnimation > 0 && (this.controlUseItem && sItem.hammer > 0))) { bool flag5 = true; if (!Main.wallHouse[(int)Main.tile[index1, index2].wall]) { flag5 = false; for (int index3 = index1 - 1; index3 < index1 + 2; ++index3) { for (int index4 = index2 - 1; index4 < index2 + 2; ++index4) { if ((int)Main.tile[index3, index4].wall == 0 || Main.wallHouse[(int)Main.tile[index3, index4].wall]) { flag5 = true; break; } } } } if (flag5) { int tileId = this.hitTile.HitObject(index1, index2, 2); int damageAmount2 = damageAmount1 + (int)((double)sItem.hammer * 1.5); if (this.hitTile.AddDamage(tileId, damageAmount2, true) >= 100) { this.hitTile.Clear(tileId); WorldGen.KillWall(index1, index2, false); if (Main.netMode == 1) NetMessage.SendData(17, -1, -1, "", 2, (float)index1, (float)index2, 0.0f, 0, 0, 0); } else { WorldGen.KillWall(index1, index2, true); if (Main.netMode == 1) NetMessage.SendData(17, -1, -1, "", 2, (float)index1, (float)index2, 1f, 0, 0, 0); } if (damageAmount2 != 0) this.hitTile.Prune(); this.itemTime = sItem.useTime / 2; } } } if (Main.myPlayer == this.whoAmI && sItem.itemId == 1326 && (this.itemAnimation > 0 && this.itemTime == 0)) { this.itemTime = sItem.useTime; Vector2 vector2; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (double)this.gravDir != 1.0 ? Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY : (float)Main.mouseY + Main.screenPosition.Y - (float)this.height; vector2.X -= (float)(this.width / 2); if ((double)vector2.X > 50.0 && (double)vector2.X < (double)(Main.maxTilesX * 16 - 50) && ((double)vector2.Y > 50.0 && (double)vector2.Y < (double)(Main.maxTilesY * 16 - 50))) { int index1 = (int)((double)vector2.X / 16.0); int index2 = (int)((double)vector2.Y / 16.0); if (((int)Main.tile[index1, index2].wall != 87 || (double)index2 <= Main.worldSurface || NPC.downedPlantBoss) && !Collision.SolidCollision(vector2, this.width, this.height)) { this.Teleport(vector2, 1, 0); NetMessage.SendData(65, -1, -1, "", 0, (float)this.whoAmI, vector2.X, vector2.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) deathText = !this.Male ? "'s legs appeared where her head should be" : "'s legs appeared where his 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 (sItem.itemId == 29 && this.itemAnimation > 0 && (this.statLifeMax < 400 && this.itemTime == 0)) { this.itemTime = sItem.useTime; this.statLifeMax += 20; this.statLifeMax2 += 20; this.statLife += 20; if (Main.myPlayer == this.whoAmI) this.HealEffect(20, true); AchievementsHelper.HandleSpecialEvent(this, 0); } if (sItem.itemId == 1291 && this.itemAnimation > 0 && (this.statLifeMax >= 400 && this.statLifeMax < 500) && this.itemTime == 0) { this.itemTime = sItem.useTime; this.statLifeMax += 5; this.statLifeMax2 += 5; this.statLife += 5; if (Main.myPlayer == this.whoAmI) this.HealEffect(5, true); AchievementsHelper.HandleSpecialEvent(this, 2); } if (sItem.itemId == 109 && this.itemAnimation > 0 && (this.statManaMax < 200 && this.itemTime == 0)) { this.itemTime = sItem.useTime; this.statManaMax += 20; this.statManaMax2 += 20; this.statMana += 20; if (Main.myPlayer == this.whoAmI) this.ManaEffect(20); AchievementsHelper.HandleSpecialEvent(this, 1); } if (sItem.itemId == 3335 && this.itemAnimation > 0 && (!this.extraAccessory && Main.expertMode) && this.itemTime == 0) { this.itemTime = sItem.useTime; this.extraAccessory = true; NetMessage.SendData(4, -1, -1, Main.player[this.whoAmI].name, this.whoAmI, 0.0f, 0.0f, 0.0f, 0, 0, 0); } this.PlaceThing(); } if (sItem.itemId == 3542) { Vector2 vector2_1 = Main.OffsetsPlayerOnhand[this.bodyFrame.Y / 56] * 2f; if (this.direction != 1) vector2_1.X = (float)this.bodyFrame.Width - vector2_1.X; if ((double)this.gravDir != 1.0) vector2_1.Y = (float)this.bodyFrame.Height - vector2_1.Y; vector2_1 -= new Vector2((float)(this.bodyFrame.Width - this.width), (float)(this.bodyFrame.Height - 42)) / 2f; Vector2 vector2_2 = this.RotatedRelativePoint(this.position + vector2_1, true) - this.velocity; for (int index = 0; index < 4; ++index) { Dust dust = Main.dust[Dust.NewDust(this.Center, 0, 0, 242, (float)(this.direction * 2), 0.0f, 150, new Color(), 1.3f)]; dust.position = vector2_2; dust.velocity *= 0.0f; dust.noGravity = true; dust.fadeIn = 1f; dust.velocity += this.velocity; if (Main.rand.Next(2) == 0) { dust.position += Utils.RandomVector2(Main.rand, -4f, 4f); dust.scale += Utils.NextFloat(Main.rand); if (Main.rand.Next(2) == 0) dust.customData = (object)this; } } } if ((sItem.damage >= 0 && sItem.itemId > 0 && !sItem.noMelee || (sItem.itemId == 1450 || sItem.itemId == 1991 || (sItem.itemId == 3183 || sItem.itemId == 3542))) && this.itemAnimation > 0) { bool flag2 = false; Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle((int)this.itemLocation.X, (int)this.itemLocation.Y, 32, 32); if (!Main.dedServ) r = new Microsoft.Xna.Framework.Rectangle((int)this.itemLocation.X, (int)this.itemLocation.Y, Main.itemTexture[sItem.itemId].Width, Main.itemTexture[sItem.itemId].Height); r.Width = (int)((double)r.Width * (double)sItem.scale); r.Height = (int)((double)r.Height * (double)sItem.scale); if (this.direction == -1) r.X -= r.Width; if ((double)this.gravDir == 1.0) r.Y -= r.Height; if (sItem.useStyle == 1) { if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.333) { if (this.direction == -1) r.X -= (int)((double)r.Width * 1.4 - (double)r.Width); r.Width = (int)((double)r.Width * 1.4); r.Y += (int)((double)r.Height * 0.5 * (double)this.gravDir); r.Height = (int)((double)r.Height * 1.1); } else if ((double)this.itemAnimation >= (double)this.itemAnimationMax * 0.666) { if (this.direction == 1) r.X -= (int)((double)r.Width * 1.2); r.Width = r.Width * 2; r.Y -= (int)(((double)r.Height * 1.4 - (double)r.Height) * (double)this.gravDir); r.Height = (int)((double)r.Height * 1.4); } } else if (sItem.useStyle == 3) { if ((double)this.itemAnimation > (double)this.itemAnimationMax * 0.666) { flag2 = true; } else { if (this.direction == -1) r.X -= (int)((double)r.Width * 1.4 - (double)r.Width); r.Width = (int)((double)r.Width * 1.4); r.Y += (int)((double)r.Height * 0.6); r.Height = (int)((double)r.Height * 0.6); } } double num4 = (double)this.gravDir; if (sItem.itemId == 1450 && Main.rand.Next(3) == 0) { int index = -1; float x = (float)(r.X + Main.rand.Next(r.Width)); float y = (float)(r.Y + Main.rand.Next(r.Height)); if (Main.rand.Next(500) == 0) index = Gore.NewGore(new Vector2(x, y), new Vector2(), 415, (float)Main.rand.Next(51, 101) * 0.01f); else if (Main.rand.Next(250) == 0) index = Gore.NewGore(new Vector2(x, y), new Vector2(), 414, (float)Main.rand.Next(51, 101) * 0.01f); else if (Main.rand.Next(80) == 0) index = Gore.NewGore(new Vector2(x, y), new Vector2(), 413, (float)Main.rand.Next(51, 101) * 0.01f); else if (Main.rand.Next(10) == 0) index = Gore.NewGore(new Vector2(x, y), new Vector2(), 412, (float)Main.rand.Next(51, 101) * 0.01f); else if (Main.rand.Next(3) == 0) index = Gore.NewGore(new Vector2(x, y), new Vector2(), 411, (float)Main.rand.Next(51, 101) * 0.01f); if (index >= 0) { Main.gore[index].velocity.X += (float)(this.direction * 2); Main.gore[index].velocity.Y *= 0.3f; } } if (sItem.itemId == 3542) flag2 = true; if (!flag2) { if (sItem.itemId == 989 && Main.rand.Next(5) == 0) { int Type; switch (Main.rand.Next(3)) { case 0: Type = 15; break; case 1: Type = 57; break; default: Type = 58; break; } int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, Type, (float)(this.direction * 2), 0.0f, 150, new Color(), 1.3f); Main.dust[index].velocity *= 0.2f; } if (sItem.itemId == 2880 && Main.rand.Next(2) == 0) { int Type = Utils.SelectRandom<int>(Main.rand, 226, 229); int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, Type, (float)(this.direction * 2), 0.0f, 150, new Color(), 1f); Main.dust[index].velocity *= 0.2f; Main.dust[index].noGravity = true; } if ((sItem.itemId == 44 || sItem.itemId == 45 || (sItem.itemId == 46 || sItem.itemId == 103) || sItem.itemId == 104) && Main.rand.Next(15) == 0) Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 14, (float)(this.direction * 2), 0.0f, 150, new Color(), 1.3f); if (sItem.itemId == 273 || sItem.itemId == 675) { if (Main.rand.Next(5) == 0) Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 14, (float)(this.direction * 2), 0.0f, 150, new Color(), 1.4f); int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 27, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, new Color(), 1.2f); Main.dust[index].noGravity = true; Main.dust[index].velocity.X /= 2f; Main.dust[index].velocity.Y /= 2f; } if (sItem.itemId == 723 && Main.rand.Next(2) == 0) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 64, 0.0f, 0.0f, 150, new Color(), 1.2f); Main.dust[index].noGravity = true; } if (sItem.itemId == 65) { if (Main.rand.Next(5) == 0) Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 58, 0.0f, 0.0f, 150, new Color(), 1.2f); if (Main.rand.Next(10) == 0) Gore.NewGore(new Vector2((float)r.X, (float)r.Y), new Vector2(), Main.rand.Next(16, 18), 1f); } if (sItem.itemId == 3065) { int index1 = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 58, 0.0f, 0.0f, 150, new Color(), 1.2f); Main.dust[index1].velocity *= 0.5f; if (Main.rand.Next(8) == 0) { int index2 = Gore.NewGore(new Vector2((float)r.Center.X, (float)r.Center.Y), new Vector2(), 16, 1f); Main.gore[index2].velocity *= 0.5f; Main.gore[index2].velocity += new Vector2((float)this.direction, 0.0f); } } if (sItem.itemId == 190) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 40, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 0, new Color(), 1.2f); Main.dust[index].noGravity = true; } else if (sItem.itemId == 213) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 3, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 0, new Color(), 1.2f); Main.dust[index].noGravity = true; } if (sItem.itemId == 121) { for (int index1 = 0; index1 < 2; ++index1) { int index2 = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, new Color(), 2.5f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity.X *= 2f; Main.dust[index2].velocity.Y *= 2f; } } if (sItem.itemId == 122 || sItem.itemId == 217) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, new Color(), 1.9f); Main.dust[index].noGravity = true; } if (sItem.itemId == 155) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 172, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, new Color(), 0.9f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.1f; } if (sItem.itemId == 676 && Main.rand.Next(3) == 0) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 67, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 90, new Color(), 1.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.2f; } if (sItem.itemId == 3063) { int index = Dust.NewDust(Utils.TopLeft(r), r.Width, r.Height, 66, 0.0f, 0.0f, 150, Color.Transparent, 0.85f); Main.dust[index].color = Main.hslToRgb(Utils.NextFloat(Main.rand), 1f, 0.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity /= 2f; } if (sItem.itemId == 724 && Main.rand.Next(5) == 0) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 67, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 90, new Color(), 1.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.2f; } if (sItem.itemId >= 795 && sItem.itemId <= 802 && Main.rand.Next(3) == 0) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 115, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 140, new Color(), 1.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.25f; } if (sItem.itemId == 367 || sItem.itemId == 368 || sItem.itemId == 674) { if (Main.rand.Next(3) == 0) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 57, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, new Color(), 1.1f); Main.dust[index].noGravity = true; Main.dust[index].velocity.X /= 2f; Main.dust[index].velocity.Y /= 2f; Main.dust[index].velocity.X += (float)(this.direction * 2); } if (Main.rand.Next(4) == 0) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 43, 0.0f, 0.0f, 254, new Color(), 0.3f); Main.dust[index].velocity *= 0.0f; } } if (sItem.itemId >= 198 && sItem.itemId <= 203) { float R = 0.5f; float G = 0.5f; float B = 0.5f; if (sItem.itemId == 198) { R *= 0.1f; G *= 0.5f; B *= 1.2f; } else if (sItem.itemId == 199) { R *= 1f; G *= 0.2f; B *= 0.1f; } else if (sItem.itemId == 200) { R *= 0.1f; G *= 1f; B *= 0.2f; } else if (sItem.itemId == 201) { R *= 0.8f; G *= 0.1f; B *= 1f; } else if (sItem.itemId == 202) { R *= 0.8f; G *= 0.9f; B *= 1f; } else if (sItem.itemId == 203) { R *= 0.9f; G *= 0.9f; B *= 0.1f; } Lighting.AddLight((int)(((double)this.itemLocation.X + 6.0 + (double)this.velocity.X) / 16.0), (int)(((double)this.itemLocation.Y - 14.0) / 16.0), R, G, B); } if (this.frostBurn && sItem.melee && (!sItem.noMelee && !sItem.noUseGraphic) && Main.rand.Next(2) == 0) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 135, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, new Color(), 2.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.7f; Main.dust[index].velocity.Y -= 0.5f; } if (sItem.melee && !sItem.noMelee && (!sItem.noUseGraphic && (int)this.meleeEnchant > 0)) { if ((int)this.meleeEnchant == 1) { if (Main.rand.Next(3) == 0) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 171, 0.0f, 0.0f, 100, new Color(), 1f); Main.dust[index].noGravity = true; Main.dust[index].fadeIn = 1.5f; Main.dust[index].velocity *= 0.25f; } } else if ((int)this.meleeEnchant == 2) { if (Main.rand.Next(2) == 0) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 75, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, new Color(), 2.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.7f; Main.dust[index].velocity.Y -= 0.5f; } } else if ((int)this.meleeEnchant == 3) { if (Main.rand.Next(2) == 0) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, new Color(), 2.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.7f; Main.dust[index].velocity.Y -= 0.5f; } } else if ((int)this.meleeEnchant == 4) { if (Main.rand.Next(2) == 0) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 57, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, new Color(), 1.1f); Main.dust[index].noGravity = true; Main.dust[index].velocity.X /= 2f; Main.dust[index].velocity.Y /= 2f; } } else if ((int)this.meleeEnchant == 5) { if (Main.rand.Next(2) == 0) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 169, 0.0f, 0.0f, 100, new Color(), 1f); Main.dust[index].velocity.X += (float)this.direction; Main.dust[index].velocity.Y += 0.2f; Main.dust[index].noGravity = true; } } else if ((int)this.meleeEnchant == 6) { if (Main.rand.Next(2) == 0) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 135, 0.0f, 0.0f, 100, new Color(), 1f); Main.dust[index].velocity.X += (float)this.direction; Main.dust[index].velocity.Y += 0.2f; Main.dust[index].noGravity = true; } } else if ((int)this.meleeEnchant == 7) { if (Main.rand.Next(20) == 0) { int Type = Main.rand.Next(139, 143); int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, Type, this.velocity.X, this.velocity.Y, 0, new Color(), 1.2f); Main.dust[index].velocity.X *= (float)(1.0 + (double)Main.rand.Next(-50, 51) * 0.00999999977648258); Main.dust[index].velocity.Y *= (float)(1.0 + (double)Main.rand.Next(-50, 51) * 0.00999999977648258); Main.dust[index].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f; Main.dust[index].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f; Main.dust[index].scale *= (float)(1.0 + (double)Main.rand.Next(-30, 31) * 0.00999999977648258); } if (Main.rand.Next(40) == 0) { int Type = Main.rand.Next(276, 283); int index = Gore.NewGore(new Vector2((float)r.X, (float)r.Y), this.velocity, Type, 1f); Main.gore[index].velocity.X *= (float)(1.0 + (double)Main.rand.Next(-50, 51) * 0.00999999977648258); Main.gore[index].velocity.Y *= (float)(1.0 + (double)Main.rand.Next(-50, 51) * 0.00999999977648258); Main.gore[index].scale *= (float)(1.0 + (double)Main.rand.Next(-20, 21) * 0.00999999977648258); Main.gore[index].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f; Main.gore[index].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f; } } else if ((int)this.meleeEnchant == 8 && Main.rand.Next(4) == 0) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 46, 0.0f, 0.0f, 100, new Color(), 1f); Main.dust[index].noGravity = true; Main.dust[index].fadeIn = 1.5f; Main.dust[index].velocity *= 0.25f; } } if (this.magmaStone && sItem.melee && (!sItem.noMelee && !sItem.noUseGraphic) && Main.rand.Next(3) != 0) { int index = Dust.NewDust(new Vector2((float)r.X, (float)r.Y), r.Width, r.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, new Color(), 2.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity.X *= 2f; Main.dust[index].velocity.Y *= 2f; } if (Main.myPlayer == i && (sItem.itemId == 1991 || sItem.itemId == 3183)) { for (int i1 = 0; i1 < 200; ++i1) { if (Main.npc[i1].active && (int)Main.npc[i1].catchItem > 0) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int)Main.npc[i1].position.X, (int)Main.npc[i1].position.Y, Main.npc[i1].width, Main.npc[i1].height); if (r.Intersects(rectangle) && (sItem.itemId == 3183 || Main.npc[i1].noTileCollide || Collision.CanHit(this.position, this.width, this.height, Main.npc[i1].position, Main.npc[i1].width, Main.npc[i1].height))) NPC.CatchNPC(i1, i); } } } if (Main.myPlayer == i && (sItem.damage > 0 || sItem.itemId == 3183)) { int num5 = (int)((double)sItem.damage * (double)this.meleeDamage); float num6 = sItem.knockBack; float num7 = 1f; if (this.kbGlove) ++num7; if (this.kbBuff) num7 += 0.5f; float num8 = num6 * num7; if (this.inventory[this.selectedItem].itemId == 3106) num8 += num8 * (1f - this.stealth); List<ushort> list = (List<ushort>)null; if (sItem.itemId == 213) list = new List<ushort>((IEnumerable<ushort>)new ushort[17] { (ushort) 3, (ushort) 24, (ushort) 52, (ushort) 61, (ushort) 62, (ushort) 71, (ushort) 73, (ushort) 74, (ushort) 82, (ushort) 83, (ushort) 84, (ushort) 110, (ushort) 113, (ushort) 115, (ushort) 184, (ushort) 205, (ushort) 201 }); int num9 = r.X / 16; int num10 = (r.X + r.Width) / 16 + 1; int num11 = r.Y / 16; int num12 = (r.Y + r.Height) / 16 + 1; for (int i1 = num9; i1 < num10; ++i1) { for (int j = num11; j < num12; ++j) { if (Main.tile[i1, j] != null && Main.tileCut[(int)Main.tile[i1, j].type] && (list == null || !list.Contains(Main.tile[i1, j].type)) && (Main.tile[i1, j + 1] != null && (int)Main.tile[i1, j + 1].type != 78 && (int)Main.tile[i1, j + 1].type != 380)) { if (sItem.itemId == 1786) { int num13 = (int)Main.tile[i1, j].type; WorldGen.KillTile(i1, j, false, false, false); if (!Main.tile[i1, j].active()) { int Stack = 0; if (num13 == 3 || num13 == 24 || (num13 == 61 || num13 == 110) || num13 == 201) Stack = Main.rand.Next(1, 3); if (num13 == 73 || num13 == 74 || num13 == 113) Stack = Main.rand.Next(2, 5); if (Stack > 0) { int number = Item.NewItem(i1 * 16, j * 16, 16, 16, 1727, Stack, false, 0, false); if (Main.netMode == 1) NetMessage.SendData(21, -1, -1, "", number, 1f, 0.0f, 0.0f, 0, 0, 0); } } if (Main.netMode == 1) NetMessage.SendData(17, -1, -1, "", 0, (float)i1, (float)j, 0.0f, 0, 0, 0); } else { WorldGen.KillTile(i1, j, false, false, false); if (Main.netMode == 1) NetMessage.SendData(17, -1, -1, "", 0, (float)i1, (float)j, 0.0f, 0, 0, 0); } } } } if (sItem.itemId != 3183) { for (int index1 = 0; index1 < 200; ++index1) { if (Main.npc[index1].active && Main.npc[index1].immune[i] == 0 && this.attackCD == 0) { if (!Main.npc[index1].dontTakeDamage) { if (!Main.npc[index1].friendly || Main.npc[index1].type == 22 && this.killGuide || Main.npc[index1].type == 54 && this.killClothier) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int)Main.npc[index1].position.X, (int)Main.npc[index1].position.Y, Main.npc[index1].width, Main.npc[index1].height); if (r.Intersects(rectangle) && (Main.npc[index1].noTileCollide || Collision.CanHit(this.position, this.width, this.height, Main.npc[index1].position, Main.npc[index1].width, Main.npc[index1].height))) { bool crit = false; if (Main.rand.Next(1, 101) <= this.meleeCrit) crit = true; int num13 = Main.DamageVar((float)num5); int index2 = Item.NPCtoBanner(Main.npc[index1].BannerID()); if (index2 > 0 && this.NPCBannerBuff[index2]) { if (Main.expertMode) num5 *= 2; else num5 = (int)((double)num5 * 1.5); } this.StatusNPC(sItem.itemId, index1); this.OnHit(Main.npc[index1].Center.X, Main.npc[index1].Center.Y, (Entity)Main.npc[index1]); if (this.armorPenetration > 0) num13 += Main.npc[index1].checkArmorPenetration(this.armorPenetration); int num14 = (int)Main.npc[index1].StrikeNPC(num13, num8, this.direction, crit, false, false); if (this.inventory[this.selectedItem].itemId == 3211) { Vector2 vector2_1 = new Vector2((float)(this.direction * 100 + Main.rand.Next(-25, 26)), (float)Main.rand.Next(-75, 76)); vector2_1.Normalize(); vector2_1 *= (float)Main.rand.Next(30, 41) * 0.1f; Vector2 vector2_2 = new Vector2((float)(r.X + Main.rand.Next(r.Width)), (float)(r.Y + Main.rand.Next(r.Height))); vector2_2 = (vector2_2 + Main.npc[index1].Center * 2f) / 3f; Projectile.NewProjectile(vector2_2.X, vector2_2.Y, vector2_1.X, vector2_1.Y, 524, (int)((double)num5 * 0.7), num8 * 0.7f, this.whoAmI, 0.0f, 0.0f); } if (this.beetleOffense) { this.beetleCounter += (float)num14; this.beetleCountdown = 0; } if (sItem.itemId == 1826 && ((double)Main.npc[index1].value > 0.0 || Main.npc[index1].damage > 0 && !Main.npc[index1].friendly)) this.pumpkinSword(index1, (int)((double)num5 * 1.5), num8); if ((int)this.meleeEnchant == 7) Projectile.NewProjectile(Main.npc[index1].Center.X, Main.npc[index1].Center.Y, Main.npc[index1].velocity.X, Main.npc[index1].velocity.Y, 289, 0, 0.0f, this.whoAmI, 0.0f, 0.0f); if (this.inventory[this.selectedItem].itemId == 3106) { this.stealth = 1f; if (Main.netMode == 1) NetMessage.SendData(84, -1, -1, "", this.whoAmI, 0.0f, 0.0f, 0.0f, 0, 0, 0); } if (sItem.itemId == 1123) { int num15 = Main.rand.Next(1, 4); if (this.strongBees && Main.rand.Next(3) == 0) ++num15; for (int index3 = 0; index3 < num15; ++index3) { float num16 = (float)(this.direction * 2) + (float)Main.rand.Next(-35, 36) * 0.02f; float num17 = (float)Main.rand.Next(-35, 36) * 0.02f; float SpeedX = num16 * 0.2f; float SpeedY = num17 * 0.2f; Projectile.NewProjectile((float)(r.X + r.Width / 2), (float)(r.Y + r.Height / 2), SpeedX, SpeedY, this.beeType(), this.beeDamage(num13 / 3), this.beeKB(0.0f), i, 0.0f, 0.0f); } } if ((double)Main.npc[index1].value > 0.0 && this.coins && Main.rand.Next(5) == 0) { int Type = 71; if (Main.rand.Next(10) == 0) Type = 72; if (Main.rand.Next(100) == 0) Type = 73; int number = Item.NewItem((int)Main.npc[index1].position.X, (int)Main.npc[index1].position.Y, Main.npc[index1].width, Main.npc[index1].height, Type, 1, false, 0, false); Main.item[number].stack = Main.rand.Next(1, 11); Main.item[number].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; Main.item[number].velocity.X = (float)Main.rand.Next(10, 31) * 0.2f * (float)this.direction; if (Main.netMode == 1) NetMessage.SendData(21, -1, -1, "", number, 0.0f, 0.0f, 0.0f, 0, 0, 0); } int num18 = Item.NPCtoBanner(Main.npc[index1].BannerID()); if (num18 >= 0) this.lastCreatureHit = num18; if (Main.netMode != 0) { if (crit) NetMessage.SendData(28, -1, -1, "", index1, (float)num13, num8, (float)this.direction, 1, 0, 0); else NetMessage.SendData(28, -1, -1, "", index1, (float)num13, num8, (float)this.direction, 0, 0, 0); } if (this.accDreamCatcher) this.addDPS(num13); Main.npc[index1].immune[i] = this.itemAnimation; this.attackCD = (int)((double)this.itemAnimationMax * 0.33); } } } else if (Main.npc[index1].type == 63 || Main.npc[index1].type == 64 || (Main.npc[index1].type == 103 || Main.npc[index1].type == 242)) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int)Main.npc[index1].position.X, (int)Main.npc[index1].position.Y, Main.npc[index1].width, Main.npc[index1].height); if (r.Intersects(rectangle)) { this.Hurt((int)((double)Main.npc[index1].damage * 1.3), -this.direction, false, false, " was slain...", false); Main.npc[index1].immune[i] = this.itemAnimation; this.attackCD = (int)((double)this.itemAnimationMax * 0.33); } } } } if (this.hostile) { for (int index1 = 0; index1 < (int)byte.MaxValue; ++index1) { if (index1 != i && Main.player[index1].active && (Main.player[index1].hostile && !Main.player[index1].immune) && (!Main.player[index1].dead && (Main.player[i].team == 0 || Main.player[i].team != Main.player[index1].team))) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int)Main.player[index1].position.X, (int)Main.player[index1].position.Y, Main.player[index1].width, Main.player[index1].height); if (r.Intersects(rectangle) && Collision.CanHit(this.position, this.width, this.height, Main.player[index1].position, Main.player[index1].width, Main.player[index1].height)) { bool Crit = false; if (Main.rand.Next(1, 101) <= 10) Crit = true; int Damage = Main.DamageVar((float)num5); this.StatusPvP(sItem.itemId, index1); this.OnHit(Main.player[index1].Center.X, Main.player[index1].Center.Y, (Entity)Main.player[index1]); int num13 = (int)Main.player[index1].Hurt(Damage, this.direction, true, false, "", Crit); if (this.inventory[this.selectedItem].itemId == 3211) { Vector2 vector2_1 = new Vector2((float)(this.direction * 100 + Main.rand.Next(-25, 26)), (float)Main.rand.Next(-75, 76)); vector2_1.Normalize(); vector2_1 *= (float)Main.rand.Next(30, 41) * 0.1f; Vector2 vector2_2 = new Vector2((float)(r.X + Main.rand.Next(r.Width)), (float)(r.Y + Main.rand.Next(r.Height))); vector2_2 = (vector2_2 + Main.player[index1].Center * 2f) / 3f; Projectile.NewProjectile(vector2_2.X, vector2_2.Y, vector2_1.X, vector2_1.Y, 524, (int)((double)num5 * 0.7), num8 * 0.7f, this.whoAmI, 0.0f, 0.0f); } if (this.beetleOffense) { this.beetleCounter += (float)num13; this.beetleCountdown = 0; } if ((int)this.meleeEnchant == 7) Projectile.NewProjectile(Main.player[index1].Center.X, Main.player[index1].Center.Y, Main.player[index1].velocity.X, Main.player[index1].velocity.Y, 289, 0, 0.0f, this.whoAmI, 0.0f, 0.0f); if (sItem.itemId == 1123) { int num14 = Main.rand.Next(1, 4); if (this.strongBees && Main.rand.Next(3) == 0) ++num14; for (int index2 = 0; index2 < num14; ++index2) { float num15 = (float)(this.direction * 2) + (float)Main.rand.Next(-35, 36) * 0.02f; float num16 = (float)Main.rand.Next(-35, 36) * 0.02f; float SpeedX = num15 * 0.2f; float SpeedY = num16 * 0.2f; Projectile.NewProjectile((float)(r.X + r.Width / 2), (float)(r.Y + r.Height / 2), SpeedX, SpeedY, this.beeType(), this.beeDamage(Damage / 3), this.beeKB(0.0f), i, 0.0f, 0.0f); } } if (this.inventory[this.selectedItem].itemId == 3106) { this.stealth = 1f; if (Main.netMode == 1) NetMessage.SendData(84, -1, -1, "", this.whoAmI, 0.0f, 0.0f, 0.0f, 0, 0, 0); } if (sItem.itemId == 1826 && (double)Main.npc[index1].value > 0.0) this.pumpkinSword(index1, (int)((double)num5 * 1.5), num8); if (Main.netMode != 0) { if (Crit) NetMessage.SendData(26, -1, -1, Lang.deathMsg(this.whoAmI, -1, -1, -1), index1, (float)this.direction, (float)Damage, 1f, 1, 0, 0); else NetMessage.SendData(26, -1, -1, Lang.deathMsg(this.whoAmI, -1, -1, -1), index1, (float)this.direction, (float)Damage, 1f, 0, 0, 0); } this.attackCD = (int)((double)this.itemAnimationMax * 0.33); } } } } if (sItem.itemId == 787 && (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.1) || this.itemAnimation == (int)((double)this.itemAnimationMax * 0.3) || (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.5) || this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7)) || this.itemAnimation == (int)((double)this.itemAnimationMax * 0.9))) { float num13 = 0.0f; float num14 = 0.0f; float num15 = 0.0f; float num16 = 0.0f; if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.9)) num13 = -7f; if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7)) { num13 = -6f; num14 = 2f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.5)) { num13 = -4f; num14 = 4f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.3)) { num13 = -2f; num14 = 6f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.1)) num14 = 7f; if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7)) num16 = 26f; if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.3)) { num16 -= 4f; num15 -= 20f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.1)) num15 += 6f; if (this.direction == -1) { if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.9)) num16 -= 8f; if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7)) num16 -= 6f; } float num17 = num13 * 1.5f; float num18 = num14 * 1.5f; float num19 = num16 * (float)this.direction; float num20 = num15 * this.gravDir; Projectile.NewProjectile((float)(r.X + r.Width / 2) + num19, (float)(r.Y + r.Height / 2) + num20, (float)this.direction * num18, num17 * this.gravDir, 131, num5 / 2, 0.0f, i, 0.0f, 0.0f); } } } } } if (this.itemTime == 0 && this.itemAnimation > 0) { if ((int)sItem.hairDye >= 0) { this.itemTime = sItem.useTime; if (this.whoAmI == Main.myPlayer) { this.hairDye = (byte)sItem.hairDye; NetMessage.SendData(4, -1, -1, Main.player[this.whoAmI].name, this.whoAmI, 0.0f, 0.0f, 0.0f, 0, 0, 0); } } if (sItem.healLife > 0) { this.statLife += sItem.healLife; this.itemTime = sItem.useTime; if (Main.myPlayer == this.whoAmI) this.HealEffect(sItem.healLife, true); } if (sItem.healMana > 0) { this.statMana += sItem.healMana; this.itemTime = sItem.useTime; if (Main.myPlayer == this.whoAmI) { this.AddBuff(94, Player.manaSickTime, true); this.ManaEffect(sItem.healMana); } } if (sItem.buffType > 0) { if (this.whoAmI == Main.myPlayer && sItem.buffType != 90 && sItem.buffType != 27) this.AddBuff(sItem.buffType, sItem.buffTime, true); this.itemTime = sItem.useTime; } if (sItem.itemId == 678) { this.itemTime = sItem.useTime; if (this.whoAmI == Main.myPlayer) { this.AddBuff(20, 216000, true); this.AddBuff(22, 216000, true); this.AddBuff(23, 216000, true); this.AddBuff(24, 216000, true); this.AddBuff(30, 216000, true); this.AddBuff(31, 216000, true); this.AddBuff(32, 216000, true); this.AddBuff(33, 216000, true); this.AddBuff(35, 216000, true); this.AddBuff(36, 216000, true); this.AddBuff(68, 216000, true); } } } if (this.whoAmI == Main.myPlayer) { if (this.itemTime == 0 && this.itemAnimation > 0 && (sItem.itemId == 361 && Main.CanStartInvasion(1, true))) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { if (Main.invasionType == 0) { Main.invasionDelay = 0; Main.StartInvasion(1); } } else NetMessage.SendData(61, -1, -1, "", this.whoAmI, -1f, 0.0f, 0.0f, 0, 0, 0); } if (this.itemTime == 0 && this.itemAnimation > 0 && (sItem.itemId == 602 && Main.CanStartInvasion(2, true))) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { if (Main.invasionType == 0) { Main.invasionDelay = 0; Main.StartInvasion(2); } } else NetMessage.SendData(61, -1, -1, "", this.whoAmI, -2f, 0.0f, 0.0f, 0, 0, 0); } if (this.itemTime == 0 && this.itemAnimation > 0 && (sItem.itemId == 1315 && Main.CanStartInvasion(3, true))) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { if (Main.invasionType == 0) { Main.invasionDelay = 0; Main.StartInvasion(3); } } else NetMessage.SendData(61, -1, -1, "", this.whoAmI, -3f, 0.0f, 0.0f, 0, 0, 0); } if (this.itemTime == 0 && this.itemAnimation > 0 && (sItem.itemId == 1844 && !Main.dayTime) && (!Main.pumpkinMoon && !Main.snowMoon)) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { Main.NewText(Lang.misc[31], (byte)50, byte.MaxValue, (byte)130, false); Main.startPumpkinMoon(); } else NetMessage.SendData(61, -1, -1, "", this.whoAmI, -4f, 0.0f, 0.0f, 0, 0, 0); } if (this.itemTime == 0 && this.itemAnimation > 0 && (sItem.itemId == 2767 && Main.dayTime) && !Main.eclipse) { Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode == 0) { this.itemTime = sItem.useTime; Main.eclipse = true; Main.NewText(Lang.misc[20], (byte)50, byte.MaxValue, (byte)130, false); } else NetMessage.SendData(61, -1, -1, "", this.whoAmI, -6f, 0.0f, 0.0f, 0, 0, 0); } if (this.itemTime == 0 && this.itemAnimation > 0 && (sItem.itemId == 1958 && !Main.dayTime) && (!Main.pumpkinMoon && !Main.snowMoon)) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { Main.NewText(Lang.misc[34], (byte)50, byte.MaxValue, (byte)130, false); Main.startSnowMoon(); } else NetMessage.SendData(61, -1, -1, "", this.whoAmI, -5f, 0.0f, 0.0f, 0, 0, 0); } if (this.itemTime == 0 && this.itemAnimation > 0 && ((int)sItem.makeNPC > 0 && this.controlUseItem) && ((double)this.position.X / 16.0 - (double)Player.tileRangeX - (double)sItem.tileBoost <= (double)Player.tileTargetX && ((double)this.position.X + (double)this.width) / 16.0 + (double)Player.tileRangeX + (double)sItem.tileBoost - 1.0 >= (double)Player.tileTargetX && ((double)this.position.Y / 16.0 - (double)Player.tileRangeY - (double)sItem.tileBoost <= (double)Player.tileTargetY && ((double)this.position.Y + (double)this.height) / 16.0 + (double)Player.tileRangeY + (double)sItem.tileBoost - 2.0 >= (double)Player.tileTargetY))) { int x = Main.mouseX + (int)Main.screenPosition.X; int y = Main.mouseY + (int)Main.screenPosition.Y; this.itemTime = sItem.useTime; if (!WorldGen.SolidTile(x / 16, y / 16)) NPC.ReleaseNPC(x, y, (int)sItem.makeNPC, sItem.placeStyle, this.whoAmI); } if (this.itemTime == 0 && this.itemAnimation > 0 && (sItem.itemId == 43 || sItem.itemId == 70 || (sItem.itemId == 544 || sItem.itemId == 556) || (sItem.itemId == 557 || sItem.itemId == 560 || (sItem.itemId == 1133 || sItem.itemId == 1331))) && this.SummonItemCheck()) { if (sItem.itemId == 560) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) NPC.SpawnOnPlayer(i, 50); else NetMessage.SendData(61, -1, -1, "", this.whoAmI, 50f, 0.0f, 0.0f, 0, 0, 0); } else if (sItem.itemId == 43) { if (!Main.dayTime) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) NPC.SpawnOnPlayer(i, 4); else NetMessage.SendData(61, -1, -1, "", this.whoAmI, 4f, 0.0f, 0.0f, 0, 0, 0); } } else if (sItem.itemId == 70) { if (this.ZoneCorrupt) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) NPC.SpawnOnPlayer(i, 13); else NetMessage.SendData(61, -1, -1, "", this.whoAmI, 13f, 0.0f, 0.0f, 0, 0, 0); } } else if (sItem.itemId == 544) { if (!Main.dayTime) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { NPC.SpawnOnPlayer(i, 125); NPC.SpawnOnPlayer(i, 126); } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, 125f, 0.0f, 0.0f, 0, 0, 0); NetMessage.SendData(61, -1, -1, "", this.whoAmI, 126f, 0.0f, 0.0f, 0, 0, 0); } } } else if (sItem.itemId == 556) { if (!Main.dayTime) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) NPC.SpawnOnPlayer(i, 134); else NetMessage.SendData(61, -1, -1, "", this.whoAmI, 134f, 0.0f, 0.0f, 0, 0, 0); } } else if (sItem.itemId == 557) { if (!Main.dayTime) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) NPC.SpawnOnPlayer(i, (int)sbyte.MaxValue); else NetMessage.SendData(61, -1, -1, "", this.whoAmI, (float)sbyte.MaxValue, 0.0f, 0.0f, 0, 0, 0); } } else if (sItem.itemId == 1133) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) NPC.SpawnOnPlayer(i, 222); else NetMessage.SendData(61, -1, -1, "", this.whoAmI, 222f, 0.0f, 0.0f, 0, 0, 0); } else if (sItem.itemId == 1331 && this.ZoneCrimson) { this.itemTime = sItem.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) NPC.SpawnOnPlayer(i, 266); else NetMessage.SendData(61, -1, -1, "", this.whoAmI, 266f, 0.0f, 0.0f, 0, 0, 0); } } } if ((sItem.itemId == 50 || sItem.itemId == 3124 || sItem.itemId == 3199) && this.itemAnimation > 0) { if (Main.rand.Next(2) == 0) Dust.NewDust(this.position, this.width, this.height, 15, 0.0f, 0.0f, 150, new Color(), 1.1f); if (this.itemTime == 0) this.itemTime = sItem.useTime; else if (this.itemTime == sItem.useTime / 2) { for (int index = 0; index < 70; ++index) Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, new Color(), 1.5f); this.grappling[0] = -1; this.grapCount = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == i && Main.projectile[index].aiStyle == 7) Main.projectile[index].Kill(); } this.Spawn(); for (int index = 0; index < 70; ++index) Dust.NewDust(this.position, this.width, this.height, 15, 0.0f, 0.0f, 150, new Color(), 1.5f); } } if (sItem.itemId == 2350 && this.itemAnimation > 0) { if (this.itemTime == 0) this.itemTime = sItem.useTime; else if (this.itemTime == 2) { for (int index = 0; index < 70; ++index) Main.dust[Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f; this.grappling[0] = -1; this.grapCount = 0; for (int index = 0; index < 1000; ++index) { if (Main.projectile[index].active && Main.projectile[index].owner == i && Main.projectile[index].aiStyle == 7) Main.projectile[index].Kill(); } bool flag2 = this.immune; int num4 = this.immuneTime; this.Spawn(); this.immune = flag2; this.immuneTime = num4; for (int index = 0; index < 70; ++index) Main.dust[Dust.NewDust(this.position, this.width, this.height, 15, 0.0f, 0.0f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f; if (sItem.stack > 0) --sItem.stack; } } if (sItem.itemId == 2351 && this.itemAnimation > 0) { if (this.itemTime == 0) this.itemTime = sItem.useTime; else if (this.itemTime == 2) { if (Main.netMode == 0) this.TeleportationPotion(); else if (Main.netMode == 1 && this.whoAmI == Main.myPlayer) NetMessage.SendData(73, -1, -1, "", 0, 0.0f, 0.0f, 0.0f, 0, 0, 0); if (sItem.stack > 0) --sItem.stack; } } if (sItem.itemId == 2756 && this.itemAnimation > 0) { if (this.itemTime == 0) this.itemTime = sItem.useTime; else if (this.itemTime == 2) { if (this.whoAmI == Main.myPlayer) { this.Male = !this.Male; if (Main.netMode == 1) NetMessage.SendData(4, -1, -1, this.name, this.whoAmI, 0.0f, 0.0f, 0.0f, 0, 0, 0); } if (sItem.stack > 0) --sItem.stack; } else { float num4 = (float)sItem.useTime; float num5 = (num4 - (float)this.itemTime) / num4; float x = 15f; float num6 = 44f; float num7 = 9.424778f; Vector2 vector2 = Utils.RotatedBy(new Vector2(x, 0.0f), (double)num7 * (double)num5, new Vector2()); vector2.X *= (float)this.direction; for (int index1 = 0; index1 < 2; ++index1) { int Type = 221; if (index1 == 1) { vector2.X *= -1f; Type = 219; } Vector2 Position = new Vector2(vector2.X, num6 * (1f - num5) - num6 + (float)(this.height / 2)); Position += this.Center; int index2 = Dust.NewDust(Position, 0, 0, Type, 0.0f, 0.0f, 100, new Color(), 1f); Main.dust[index2].position = Position; Main.dust[index2].noGravity = true; Main.dust[index2].velocity = Vector2.Zero; Main.dust[index2].scale = 1.3f; Main.dust[index2].customData = (object)this; } } } if (i != Main.myPlayer) return; if (this.itemTime == (int)((double)sItem.useTime * (double)this.tileSpeed) && sItem.tileWand > 0) { int num4 = sItem.tileWand; for (int index = 0; index < 58; ++index) { if (num4 == this.inventory[index].itemId && this.inventory[index].stack > 0) { --this.inventory[index].stack; if (this.inventory[index].stack <= 0) { this.inventory[index] = new Item(); break; } break; } } } if (this.itemTime == (sItem.createTile < 0 ? (sItem.createWall <= 0 ? sItem.useTime : (int)((double)sItem.useTime * (double)this.wallSpeed)) : (int)((double)sItem.useTime * (double)this.tileSpeed)) && sItem.consumable) { bool flag2 = true; if (sItem.itemId == 2350 || sItem.itemId == 2351) flag2 = false; if (sItem.itemId == 2756) flag2 = false; if (sItem.ranged) { if (this.ammoCost80 && Main.rand.Next(5) == 0) flag2 = false; if (this.ammoCost75 && Main.rand.Next(4) == 0) flag2 = false; } if (sItem.thrown) { if (this.thrownCost50 && Main.rand.Next(100) < 50) flag2 = false; if (this.thrownCost33 && Main.rand.Next(100) < 33) flag2 = false; } if (sItem.itemId >= 71 && sItem.itemId <= 74) flag2 = true; if (flag2) { if (sItem.stack > 0) --sItem.stack; if (sItem.stack <= 0) { this.itemTime = this.itemAnimation; Main.blockMouse = true; } } } if (sItem.stack <= 0 && this.itemAnimation == 0) this.inventory[this.selectedItem] = new Item(); if (this.selectedItem != 58 || this.itemAnimation == 0) return; Main.mouseItem = sItem.Clone(); }