public void Disable() { enabled = false; if (this.Address != 0) { Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, this.Address); hNpc.blockSendUnEquip = true; if (this.Armor != null) { npc.UnequipItem(new oCItem(process, this.Armor.Address)); } npc.Disable(); } }
public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client) { int playerID = 0; stream.Read(out playerID); if (playerID == 0 || !sWorld.VobDict.ContainsKey(playerID)) { throw new Exception("Vob not found! " + playerID); } Vob vob = sWorld.VobDict[playerID]; if (!(vob is NPCProto)) { throw new Exception("Vob is not an NPCProto! " + playerID); } NPCProto npc = (NPCProto)vob; if (npc.Address != 0) { foreach (Item item in npc.ItemList) { Process process = Process.ThisProcess(); oCItem gI = new oCItem(process, item.Address); oCNpc n = new oCNpc(process, npc.Address); hNpc.blockSendUnEquip = true; n.UnequipItem(gI); n.RemoveFromInv(gI, gI.Amount); gI.Amount = 0; } } foreach (Item item in npc.ItemList) { sWorld.removeVob(item); } npc.ItemList.Clear(); }
public void setRangeWeapon(Item rangeWeapon) { RangeWeapon = rangeWeapon; if (this.Address != 0) { Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, this.Address); if (RangeWeapon == null) { hNpc.blockSendUnEquip = true; npc.UnequipItem(npc.GetEquippedRangedWeapon()); } else { if (RangeWeapon.Address == 0) { throw new Exception("RangeWeapon Adress can't be null if player using it is spawned!"); } hNpc.blockSendEquip = true; npc.EquipFarWeapon(new oCItem(process, RangeWeapon.Address)); } } }
public void setArmor(Item armor) { Armor = armor; if (this.Address != 0) { Process process = Process.ThisProcess(); oCNpc npc = new oCNpc(process, this.Address); if (Armor == null) { hNpc.blockSendUnEquip = true; npc.UnequipItem(npc.GetEquippedArmor()); } else { if (Armor.Address == 0) { throw new Exception("Armor Adress can't be null if player using it is spawned!"); } hNpc.blockSendEquip = true; npc.EquipArmor(new oCItem(process, Armor.Address)); } } }