Exemplo n.º 1
0
        /// <summary>
        /// Changes the commander's weapon to the specified type
        /// </summary>
        /// <param name="slot"></param>
        /// <param name="aSlot"></param>
        /// <param name="weaponType"></param>
        protected void CommanderSwitchWeapon(eInventorySlot slot, eActiveWeaponSlot aSlot, string weaponType)
        {
            if (Inventory == null)
            {
                return;
            }

            string itemId = string.Format("BD_Commander_{0}_{1}", slot.ToString(), weaponType);

            // all weapons removed before
            InventoryItem item = Inventory.GetItem(eInventorySlot.RightHandWeapon);

            if (item != null)
            {
                Inventory.RemoveItem(item);
            }

            item = Inventory.GetItem(eInventorySlot.TwoHandWeapon);
            if (item != null)
            {
                Inventory.RemoveItem(item);
            }

            ItemTemplate temp = GameServer.Database.FindObjectByKey <ItemTemplate>(itemId);

            if (temp == null)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error(string.Format("Unable to find Bonedancer item: {0}", itemId));
                }

                return;
            }

            Inventory.AddItem(slot, GameInventoryItem.Create(temp));
            SwitchWeapon(aSlot);
            AddStatsToWeapon();
            BroadcastLivingEquipmentUpdate();
        }
Exemplo n.º 2
0
		/// <summary>
		/// Switches the active weapon to another one
		/// </summary>
		/// <param name="slot">the new eActiveWeaponSlot</param>
		public override void SwitchWeapon(eActiveWeaponSlot slot)
		{
			base.SwitchWeapon(slot);
			if (ObjectState == eObjectState.Active)
			{
				// Update active weapon appearence
				BroadcastLivingEquipmentUpdate();
			}
		}
Exemplo n.º 3
0
		/// <summary>
		/// Changes the commander's weapon to the specified type
		/// </summary>
		/// <param name="slot"></param>
		/// <param name="aSlot"></param>
		/// <param name="weaponType"></param>
		protected void CommanderSwitchWeapon(eInventorySlot slot, eActiveWeaponSlot aSlot, string weaponType)
		{
			if (Inventory == null)
				return;

			string itemId = string.Format("BD_Commander_{0}_{1}", slot.ToString(), weaponType);
			//all weapons removed before
			InventoryItem item = Inventory.GetItem(eInventorySlot.RightHandWeapon);
			if (item != null) Inventory.RemoveItem(item);
			item = Inventory.GetItem(eInventorySlot.TwoHandWeapon);
			if (item != null) Inventory.RemoveItem(item);

			ItemTemplate temp = GameServer.Database.FindObjectByKey<ItemTemplate>(itemId);

			if (temp == null)
			{
				if (log.IsErrorEnabled)
					log.Error(string.Format("Unable to find Bonedancer item: {0}", itemId));
				return;
			}

			Inventory.AddItem(slot, GameInventoryItem.Create<ItemTemplate>(temp));
			SwitchWeapon(aSlot);
			AddStatsToWeapon();
			BroadcastLivingEquipmentUpdate();
		}
Exemplo n.º 4
0
		/// <summary>
		/// Switches the active weapon to another one
		/// </summary>
		/// <param name="slot">the new eActiveWeaponSlot</param>
		public override void SwitchWeapon(eActiveWeaponSlot slot)
		{
			base.SwitchWeapon(slot);
			if (ObjectState == eObjectState.Active)
			{
				// Update active weapon appearence
				UpdateNPCEquipmentAppearance();
			}
		}
Exemplo n.º 5
0
		/// <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();
		}