public override void Unload() { Main.inventoryBackTexture = InvSlot[0]; Main.inventoryBack2Texture = InvSlot[1]; Main.inventoryBack3Texture = InvSlot[2]; Main.inventoryBack4Texture = InvSlot[3]; Main.inventoryBack5Texture = InvSlot[4]; Main.inventoryBack6Texture = InvSlot[5]; Main.inventoryBack7Texture = InvSlot[6]; Main.inventoryBack8Texture = InvSlot[7]; Main.inventoryBack9Texture = InvSlot[8]; Main.inventoryBack10Texture = InvSlot[9]; Main.inventoryBack11Texture = InvSlot[10]; Main.inventoryBack12Texture = InvSlot[11]; Main.inventoryBack13Texture = InvSlot[12]; Main.inventoryBack14Texture = InvSlot[13]; Main.inventoryBack15Texture = InvSlot[14]; Main.inventoryBack16Texture = InvSlot[15]; GFX.UnloadGfx(); SwordBlade.Unload(); SwordHilt.Unload(); SwordAccent.Unload(); StaffGem.Unload(); Staff.Unload(); StaffOrnament.Unload(); Main.instance.invBottom = 210; }
public static ProceduralSword NewSword(Mod mod, Vector2 position, SwordHilt hilt, SwordBlade blade, SwordAccent accent, float dps, int enemyDef) { int id = Item.NewItem(position, mod.GetItem("ProceduralSword").item.type); ProceduralSword sword = (ProceduralSword)Main.item[id].modItem; sword.hilt = hilt; sword.blade = blade; sword.accent = accent; sword.dps = dps; sword.enemyDef = enemyDef; sword.Initialize(); if (Main.netMode == 2) { ModPacket packet = mod.GetPacket(); packet.Write((byte)Message.SwordInit); packet.Write(id); packet.Write(blade.type); packet.Write(hilt.type); packet.Write(accent.type); packet.Write(dps); packet.Write(enemyDef); packet.Send(); } return(sword); }
public static Item GenerateSword(Mod mod, Vector2 position, SWORDTHEME theme, float dps, int enemyDef) { ProceduralSword sword; sword = NewSword(mod, position, SwordHilt.RandomHilt(theme), SwordBlade.RandomBlade(theme), Main.rand.Next(5) < 3 ? SwordAccent.RandomAccent() : SwordAccent.none, dps, enemyDef); return(sword.item); }
public override void Load() { //Overhaul = ModLoader.GetMod("TerrariaOverhaul"); kConfig.Initialize(); if (Main.netMode != NetmodeID.Server) { GFX.LoadGfx(); InvSlot[0] = Main.inventoryBackTexture; InvSlot[1] = Main.inventoryBack2Texture; InvSlot[2] = Main.inventoryBack3Texture; InvSlot[3] = Main.inventoryBack4Texture; InvSlot[4] = Main.inventoryBack5Texture; InvSlot[5] = Main.inventoryBack6Texture; InvSlot[6] = Main.inventoryBack7Texture; InvSlot[7] = Main.inventoryBack8Texture; InvSlot[8] = Main.inventoryBack9Texture; InvSlot[9] = Main.inventoryBack10Texture; InvSlot[10] = Main.inventoryBack11Texture; InvSlot[11] = Main.inventoryBack12Texture; InvSlot[12] = Main.inventoryBack13Texture; InvSlot[13] = Main.inventoryBack14Texture; InvSlot[14] = Main.inventoryBack15Texture; InvSlot[15] = Main.inventoryBack16Texture; Main.inventoryBackTexture = GFX.ItemSlot; Main.inventoryBack2Texture = GFX.ItemSlot; Main.inventoryBack3Texture = GFX.ItemSlot; Main.inventoryBack4Texture = GFX.ItemSlot; Main.inventoryBack5Texture = GFX.ItemSlot; Main.inventoryBack6Texture = GFX.ItemSlot; Main.inventoryBack7Texture = GFX.ItemSlot; Main.inventoryBack8Texture = GFX.ItemSlot; Main.inventoryBack9Texture = GFX.ItemSlot; Main.inventoryBack10Texture = GFX.FavouritedSlot; Main.inventoryBack11Texture = GFX.ItemSlot; Main.inventoryBack12Texture = GFX.ItemSlot; Main.inventoryBack13Texture = GFX.ItemSlot; Main.inventoryBack14Texture = GFX.SelectedSlot; Main.inventoryBack15Texture = GFX.ItemSlot; Main.inventoryBack16Texture = GFX.ItemSlot; } Main.player[Main.myPlayer].hbLocked = false; SwordHilt.Initialize(); SwordBlade.Initialize(); SwordAccent.Initialize(); Staff.Initialize(); StaffGem.Initialize(); StaffOrnament.Initialize(); GlyphModifier.Initialize(); }
public override void NetRecieve(BinaryReader reader) { if (!reader.ReadBoolean()) { return; } blade = SwordBlade.blades[reader.ReadInt32()]; hilt = SwordHilt.hilts[reader.ReadInt32()]; accent = SwordAccent.accents[reader.ReadInt32()]; dps = reader.ReadSingle(); enemyDef = reader.ReadInt32(); Initialize(); }
public override void Load() { overhaul = ModLoader.GetMod("TerrariaOverhaul"); kConfig.Initialize(); if (Main.netMode != 2) { GFX.LoadGFX(ModLoader.GetMod("kRPG")); invslot[0] = Main.inventoryBackTexture; invslot[1] = Main.inventoryBack2Texture; invslot[2] = Main.inventoryBack3Texture; invslot[3] = Main.inventoryBack4Texture; invslot[4] = Main.inventoryBack5Texture; invslot[5] = Main.inventoryBack6Texture; invslot[6] = Main.inventoryBack7Texture; invslot[7] = Main.inventoryBack8Texture; invslot[8] = Main.inventoryBack9Texture; invslot[9] = Main.inventoryBack10Texture; invslot[10] = Main.inventoryBack11Texture; invslot[11] = Main.inventoryBack12Texture; invslot[12] = Main.inventoryBack13Texture; invslot[13] = Main.inventoryBack14Texture; invslot[14] = Main.inventoryBack15Texture; invslot[15] = Main.inventoryBack16Texture; Main.inventoryBackTexture = GFX.itemSlot; Main.inventoryBack2Texture = GFX.itemSlot; Main.inventoryBack3Texture = GFX.itemSlot; Main.inventoryBack4Texture = GFX.itemSlot; Main.inventoryBack5Texture = GFX.itemSlot; Main.inventoryBack6Texture = GFX.itemSlot; Main.inventoryBack7Texture = GFX.itemSlot; Main.inventoryBack8Texture = GFX.itemSlot; Main.inventoryBack9Texture = GFX.itemSlot; Main.inventoryBack10Texture = GFX.favouritedSlot; Main.inventoryBack11Texture = GFX.itemSlot; Main.inventoryBack12Texture = GFX.itemSlot; Main.inventoryBack13Texture = GFX.itemSlot; Main.inventoryBack14Texture = GFX.selectedSlot; Main.inventoryBack15Texture = GFX.itemSlot; Main.inventoryBack16Texture = GFX.itemSlot; } SwordHilt.Initialize(); SwordBlade.Initialize(); SwordAccent.Initialize(); Staff.Initialize(); StaffGem.Initialize(); StaffOrnament.Initialize(); GlyphModifier.Initialize(this); }
public override void Load(TagCompound tag) { try { hilt = SwordHilt.hilts[tag.GetInt("hilt_id")]; blade = SwordBlade.blades[tag.GetInt("blade_id")]; accent = SwordAccent.accents[tag.GetInt("accent_id")]; dps = tag.GetFloat("dps"); enemyDef = tag.GetInt("enemy_defence"); } catch (SystemException e) { ErrorLogger.Log("@Loading :: " + e.ToString()); } try { Initialize(); } catch (SystemException e) { ErrorLogger.Log("@Initialize :: " + e.ToString()); } }
public override void NPCLoot(NPC npc) { for (var i = 0; i < modifiers.Count; i++) { modifiers[i].NPCLoot(npc); } if (npc.lifeMax < 10) { return; } if (npc.friendly) { return; } if (npc.townNPC) { return; } if (Main.rand.Next(2500) < GetLevel(npc.type)) { if (Main.rand.Next(8) == 0) { Item.NewItem(npc.position, mod.ItemType <BlacksmithCrown>()); } else { Item.NewItem(npc.position, mod.ItemType <PermanenceCrown>()); } } int level = GetLevel(npc.netID); Player player = Array.Find(Main.player, p => p.active); if (Main.netMode == 0) { player = Main.LocalPlayer; } else if (Main.player[npc.target].active) { player = Main.player[npc.target]; } else { PlayerCharacter c = player.GetModPlayer <PlayerCharacter>(); foreach (Player p in Main.player) { if (p != null) { if (p.active) { if (p.GetModPlayer <PlayerCharacter>() != null) { if (p.GetModPlayer <PlayerCharacter>().level > c.level) { player = p; } } } } } } PlayerCharacter character = player.GetModPlayer <PlayerCharacter>(); int life = npc.type == NPCID.SolarCrawltipedeTail || npc.type == NPCID.SolarCrawltipedeBody || npc.type == NPCID.SolarCrawltipedeHead ? npc.lifeMax / 8 : npc.lifeMax; int defFactor = (npc.defense < 0) ? 1 : npc.defense * life / (character.level + 10); int baseExp = Main.rand.Next((life + defFactor) / 5) + (life + defFactor) / 6; int scaled = Main.expertMode ? (int)(baseExp * 0.5) : baseExp; if (Main.netMode == 2) { ModPacket packet = mod.GetPacket(); packet.Write((byte)Message.AddXP); packet.Write(scaled); packet.Write(npc.target); packet.Send(); } else { character.AddXP(scaled); } if (level < Math.Min(character.level - 17, 70)) { return; } float dps = Math.Min((float)(Math.Pow(1.04, Math.Min(130, character.level)) * 9f), (float)(Math.Pow(1.023, level) * 15) + 14); int assumedDef = !Main.hardMode ? 5 : character.level / 3; if (npc.FullName.Contains("Green Slime")) { if (Main.rand.Next(22) == 0) { ProceduralSword.NewSword(mod, npc.position, SwordHilt.RandomHilt(SWORDTHEME.GENERIC), SwordBlade.slimeGreen, Main.rand.Next(3) < 1 ? SwordAccent.RandomAccent() : SwordAccent.none, dps, assumedDef); } } else if (npc.FullName.Contains("Blue Slime")) { if (Main.rand.Next(30) == 0) { ProceduralSword.NewSword(mod, npc.position, SwordHilt.RandomHilt(SWORDTHEME.GENERIC), SwordBlade.slimeBlue, Main.rand.Next(2) < 1 ? SwordAccent.RandomAccent() : SwordAccent.none, dps, assumedDef); } } else if (Main.rand.Next((character.level < 5 ? 5 : (character.level < 10 ? 8 : 20))) == 0) { if (Main.rand.Next(5) == 0) { Item.NewItem(npc.position, RangedWeapon.NewRangedWeapon(mod, npc.position, level, character.level, dps, assumedDef), Main.rand.Next(30, 90)); } else if (Main.rand.Next(9) < 5) { ProceduralSword.GenerateSword(mod, npc.position, GetTheme(player), dps, assumedDef); } else { ProceduralStaff.GenerateStaff(mod, npc.position, GetStaffTheme(player), dps * 1.2f, assumedDef); } } else if (Main.rand.Next(40) == 0) { Item item = Main.item[Item.NewItem(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), mod.ItemType(Glyph.GetRandom()))]; if (item.modItem is Glyph && Main.netMode == 0) { ((Glyph)item.modItem).Randomize(); } } else if (npc.FullName.EndsWith(" Eye") && level < 20) { if (Main.rand.Next(20) == 0) { ProceduralSword.NewSword(mod, npc.position, SwordHilt.RandomHilt(SWORDTHEME.MONSTROUS), SwordBlade.demonEye, Main.rand.Next(5) < 2 ? SwordAccent.RandomAccent() : SwordAccent.none, dps, assumedDef); } else if (Main.rand.Next(15) == 0) { ProceduralSword.NewSword(mod, npc.position, SwordHilt.RandomHilt(SWORDTHEME.GENERIC), SwordBlade.demonEye, SwordAccent.none, dps, assumedDef); } } }