/// <summary> /// Changes the commander's weapon to the specified weapon template /// </summary> public void MinionGetWeapon(CommanderPet.eWeaponType weaponType) { ItemTemplate itemTemp = CommanderPet.GetWeaponTemplate(weaponType); if (itemTemp == null) { return; } InventoryItem weapon; weapon = GameInventoryItem.Create(itemTemp); if (weapon != null) { if (Inventory == null) { Inventory = new GameNPCInventory(new GameNpcInventoryTemplate()); } else { Inventory.RemoveItem(Inventory.GetItem((eInventorySlot)weapon.Item_Type)); } Inventory.AddItem((eInventorySlot)weapon.Item_Type, weapon); SwitchWeapon((eActiveWeaponSlot)weapon.Hand); } }
/// <summary> /// Load equipment for the pet. /// </summary> /// <param name="templateID">Equipment Template ID.</param> /// <returns>True on success, else false.</returns> private bool LoadEquipmentTemplate(String templateID) { if (templateID.Length > 0) { GameNpcInventoryTemplate inventoryTemplate = new GameNpcInventoryTemplate(); if (inventoryTemplate.LoadFromDatabase(templateID)) { Inventory = new GameNPCInventory(inventoryTemplate); InventoryItem item; if ((item = Inventory.GetItem(eInventorySlot.TwoHandWeapon)) != null) { item.DPS_AF = (int)(Level * 3.3); item.SPD_ABS = 50; switch (templateID) { case "abomination_fiery_sword": case "abomination_flaming_mace": item.ProcSpellID = (int)Procs.Heat; break; case "abomination_icy_sword": case "abomination_frozen_mace": item.ProcSpellID = (int)Procs.Cold; break; case "abomination_poisonous_sword": case "abomination_venomous_mace": item.ProcSpellID = (int)Procs.Poison; break; } SwitchWeapon(eActiveWeaponSlot.TwoHanded); } else { if ((item = Inventory.GetItem(eInventorySlot.RightHandWeapon)) != null) { item.DPS_AF = (int)(Level * 3.3); item.SPD_ABS = 37; } if ((item = Inventory.GetItem(eInventorySlot.LeftHandWeapon)) != null) { item.DPS_AF = (int)(Level * 3.3); item.SPD_ABS = 37; } SwitchWeapon(eActiveWeaponSlot.Standard); } } foreach (GamePlayer player in GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE)) { if (player == null) { continue; } player.Out.SendLivingEquipmentUpdate(this); } return(true); } return(false); }
/// <summary> /// Load equipment for the pet. /// </summary> /// <param name="templateID">Equipment Template ID.</param> /// <returns>True on success, else false.</returns> private bool LoadEquipmentTemplate(String templateID) { if (templateID.Length > 0) { GameNpcInventoryTemplate inventoryTemplate = new GameNpcInventoryTemplate(); if (inventoryTemplate.LoadFromDatabase(templateID)) { Inventory = new GameNPCInventory(inventoryTemplate); InventoryItem item; if ((item = Inventory.GetItem(eInventorySlot.TwoHandWeapon)) != null) { item.DPS_AF = (int)(Level * 3.3); item.SPD_ABS = 50; switch (templateID) { case "abomination_fiery_sword": case "abomination_flaming_mace": item.ProcSpellID = (int)Procs.Heat; break; case "abomination_icy_sword": case "abomination_frozen_mace": item.ProcSpellID = (int)Procs.Cold; break; case "abomination_poisonous_sword": case "abomination_venomous_mace": item.ProcSpellID = (int)Procs.Poison; break; } SwitchWeapon(eActiveWeaponSlot.TwoHanded); } else { if ((item = Inventory.GetItem(eInventorySlot.RightHandWeapon)) != null) { item.DPS_AF = (int)(Level * 3.3); item.SPD_ABS = 37; } if ((item = Inventory.GetItem(eInventorySlot.LeftHandWeapon)) != null) { item.DPS_AF = (int)(Level * 3.3); item.SPD_ABS = 37; } SwitchWeapon(eActiveWeaponSlot.Standard); } } foreach (GamePlayer player in GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE)) { if (player == null) continue; player.Out.SendLivingEquipmentUpdate(this); } return true; } return false; }
/// <summary> /// Changes the commander's weapon to the specified type /// by WHRIA /// </summary> /// <param name="slot"></param> /// <param name="aSlot"></param> /// <param name="weaponType"></param> protected void CommanderSwitchWeapon(eInventorySlot slot, eActiveWeaponSlot aSlot, string weaponType) { string templateID = string.Format("BD_Commander_{0}_{1}", slot.ToString(), weaponType); GameNpcInventoryTemplate inventoryTemplate = new GameNpcInventoryTemplate(); if (inventoryTemplate.LoadFromDatabase(templateID)) { Inventory = new GameNPCInventory(inventoryTemplate); if (Inventory.AllItems.Count == 0) { if (log.IsErrorEnabled) log.Error(string.Format("Unable to find Bonedancer item: {0}", templateID)); return; } } else { if (log.IsErrorEnabled) log.Error(string.Format("Unable to find Bonedancer item: {0}", templateID)); return; } SwitchWeapon(aSlot); AddStatsToWeapon(); InventoryItem item_left; InventoryItem item_right; InventoryItem item_two; if (Inventory != null) { item_left = Inventory.GetItem(eInventorySlot.LeftHandWeapon); item_right = Inventory.GetItem(eInventorySlot.RightHandWeapon); item_two = Inventory.GetItem(eInventorySlot.TwoHandWeapon); switch (weaponType) { case "one_handed_sword": if (item_right != null) item_right.Type_Damage = (int)eDamageType.Slash; break; case "two_handed_sword": if (item_two != null) item_right.Type_Damage = (int)eDamageType.Slash; break; case "one_handed_hammer": if (item_right != null) item_right.Type_Damage = (int)eDamageType.Crush; break; case "two_handed_hammer": if (item_two != null) item_right.Type_Damage = (int)eDamageType.Crush; break; case "one_handed_axe": if (item_right != null) item_right.Type_Damage = (int)eDamageType.Thrust; break; case "two_handed_axe": if (item_two != null) item_right.Type_Damage = (int)eDamageType.Thrust; break; } } BroadcastLivingEquipmentUpdate(); }