SetInventoryLocation() 공개 메소드

public SetInventoryLocation ( int equipmentSlot, int column, int row ) : void
equipmentSlot int
column int
row int
리턴 void
예제 #1
0
파일: Equipment.cs 프로젝트: ncoop23/mooege
 /// <summary>
 /// Equips an item in an equipment slot
 /// </summary>
 public void EquipItem(Item item, int slot)
 {
     _equipment[slot] = item.DynamicID;
     if (!Items.ContainsKey(item.DynamicID))
         Items.Add(item.DynamicID, item);
     item.Owner = _owner;
     item.Attributes[GameAttribute.Item_Equipped] = true; // Probaly should be handled by Equipable class /fasbat
     item.Attributes.SendChangedMessage(_owner.InGameClient, item.DynamicID);
     item.SetInventoryLocation(slot, 0, 0);            
 }
예제 #2
0
파일: Equipment.cs 프로젝트: Jonsevc/mooege
        /// <summary>
        /// Removes an item from the equipment slot it uses
        /// returns the used equipmentSlot
        /// </summary>
        public int UnequipItem(Item item)
        {
            for (int i = 0; i < EquipmentSlots; i++)
            {
                if (_equipment[i] == item.DynamicID)
                {
                    _equipment[i] = 0;
                    item.SetInventoryLocation(-1, -1, -1);
                    item.Owner = null;
                    return i;
                }
            }

            return 0;
        }     
예제 #3
0
파일: Equipment.cs 프로젝트: rosebud/mooege
        /// <summary>
        /// Equips an item in an equipment slot
        /// </summary>
        public void EquipItem(Item item, int slot)
        {
            _equipment[slot] = item.DynamicID;
            item.Owner = _owner;
            item.SetInventoryLocation(slot, 0, 0);
            if (slot == 4)
            {
                _owner.Attributes[GameAttribute.Damage_Weapon_Min_Total_MainHand, 0] = item.Attributes[GameAttribute.Damage_Weapon_Min_Total, 0];
                _owner.Attributes[GameAttribute.Damage_Weapon_Delta_Total_MainHand, 0] = item.Attributes[GameAttribute.Damage_Weapon_Delta_Total, 0];
                _owner.Attributes[GameAttribute.Attacks_Per_Second_Item_MainHand] = item.Attributes[GameAttribute.Attacks_Per_Second_Item_Total];
                _owner.Attributes[GameAttribute.Attacks_Per_Second_Item_Bonus] = item.Attributes[GameAttribute.Attacks_Per_Second_Item_Bonus];
                _owner.RefreshStatistic();

            }
        }
예제 #4
0
파일: Equipment.cs 프로젝트: xsochor/mooege
 /// <summary>
 /// Equips an item in an equipment slot
 /// </summary>
 public void EquipItem(Item item, int slot)
 {
     _equipment[slot] = item.DynamicID;
     item.Owner = _owner;
     item.SetInventoryLocation(slot, 0, 0);
     item.Attributes[GameAttributeB.Item_Equipped] = true;
     if (slot == (int)EquipmentSlotId.Off_Hand)
     {
         if (_equipment[(int)EquipmentSlotId.Main_Hand] != 0)
         {
             Item mainWeapon = GetEquipment(EquipmentSlotId.Main_Hand);
             GameAttributeMap other = new GameAttributeMap();
             mainWeapon.Attributes[GameAttribute.Damage_Weapon_Delta_Total_MainHand] = mainWeapon.Attributes[GameAttribute.Damage_Weapon_Delta_Total];
             mainWeapon.Attributes[GameAttribute.Damage_Weapon_Delta_Total_OffHand] = 0;
             item.Attributes[GameAttribute.Damage_Weapon_Delta_Total_OffHand] = item.Attributes[GameAttribute.Damage_Weapon_Delta_Total];
             item.Attributes[GameAttribute.Damage_Weapon_Delta_Total_MainHand] = 0;
             mainWeapon.Attributes[GameAttribute.Damage_Weapon_Min_Total_MainHand] = mainWeapon.Attributes[GameAttribute.Damage_Weapon_Min_Total];
             mainWeapon.Attributes[GameAttribute.Damage_Weapon_Min_Total_OffHand] = 0;
             item.Attributes[GameAttribute.Damage_Weapon_Min_Total_OffHand] = item.Attributes[GameAttribute.Damage_Weapon_Min_Total];
             item.Attributes[GameAttribute.Damage_Weapon_Min_Total_MainHand] = 0;
             other.SendChangedMessage((mainWeapon.Owner as Player).InGameClient, mainWeapon.DynamicID);
         }
     }
     else if (slot == (int)EquipmentSlotId.Main_Hand)
     {
         if (_equipment[(int)EquipmentSlotId.Off_Hand] != 0)
         {
             Item offHandWeapon = GetEquipment(EquipmentSlotId.Off_Hand);
             item.Attributes[GameAttribute.Damage_Weapon_Delta_Total_MainHand] = item.Attributes[GameAttribute.Damage_Weapon_Delta_Total];
             offHandWeapon.Attributes[GameAttribute.Damage_Weapon_Delta_Total_OffHand] = offHandWeapon.Attributes[GameAttribute.Damage_Weapon_Delta_Total];
             item.Attributes[GameAttribute.Damage_Weapon_Min_Total_MainHand] = item.Attributes[GameAttribute.Damage_Weapon_Min_Total];
             offHandWeapon.Attributes[GameAttribute.Damage_Weapon_Min_Total_OffHand] = offHandWeapon.Attributes[GameAttribute.Damage_Weapon_Min_Total];
             offHandWeapon.Attributes[GameAttribute.Held_In_OffHand] = true;
             item.Attributes[GameAttribute.Damage_Weapon_Min_Total_OffHand] = 0;
             item.Attributes[GameAttribute.Damage_Weapon_Delta_Total_OffHand] = 0;
             offHandWeapon.Attributes[GameAttribute.Damage_Weapon_Delta_Total_MainHand] = 0;
             offHandWeapon.Attributes[GameAttribute.Damage_Weapon_Min_Total_MainHand] = 0;
             offHandWeapon.Attributes.SendChangedMessage((offHandWeapon.Owner as Player).InGameClient, offHandWeapon.DynamicID);
         }
     }
     if (item.Owner is Player)
     {
         item.Attributes.SendChangedMessage((item.Owner as Player).InGameClient, item.DynamicID); // flag item as equipped, so as not to shown in red color
     }
     _equippedMap = null;
     // compute stats (depends on items)
     AttributeMath.ComputeStats(_owner, GetEquippedMap());
 }
예제 #5
0
파일: Equipment.cs 프로젝트: rosebud/mooege
        /// <summary>
        /// Removes an item from the equipment slot it uses
        /// returns the used equipmentSlot
        /// </summary>
        public int UnequipItem(Item item)
        {
            for (int i = 0; i < EquipmentSlots; i++)
            {
                if (_equipment[i] == item.DynamicID)
                {
                    _equipment[i] = 0;
                    item.SetInventoryLocation(-1, -1, -1);
                    item.Owner = null;
                    if (i == 4)
                    {
                        _owner.Attributes[GameAttribute.Damage_Weapon_Min_Total_MainHand, 0] = 0;
                        _owner.Attributes[GameAttribute.Damage_Weapon_Delta_Total_MainHand, 0] = 0;
                        _owner.Attributes[GameAttribute.Attacks_Per_Second_Item_MainHand] = 0;
                        _owner.Attributes[GameAttribute.Attacks_Per_Second_Item_Bonus] = 0;
                        _owner.RefreshStatistic();
                    }
                    return i;
                }
            }

            return 0;
        }     
예제 #6
0
파일: Equipment.cs 프로젝트: Jonsevc/mooege
 /// <summary>
 /// Equips an item in an equipment slot
 /// </summary>
 public void EquipItem(Item item, int slot)
 {
     _equipment[slot] = item.DynamicID;
     item.Owner = _owner;
     item.SetInventoryLocation(slot, 0, 0);            
 }
예제 #7
0
파일: Equipment.cs 프로젝트: Jonsevc/mooege
        internal Item AddGoldItem(Item collectedItem)
        {
            if (_inventoryGold == null)
            {
                _inventoryGold = ItemGenerator.CreateGold(_owner, collectedItem.Attributes[GameAttribute.Gold]);
                _inventoryGold.Attributes[GameAttribute.ItemStackQuantityLo] = collectedItem.Attributes[GameAttribute.Gold];
                _inventoryGold.Owner = _owner;
                _inventoryGold.SetInventoryLocation(18, 0, 0); // Equipment slot 18 ==> Gold
                _inventoryGold.Reveal(_owner);
            }
            else
            {
                _inventoryGold.Attributes[GameAttribute.ItemStackQuantityLo] += collectedItem.Attributes[GameAttribute.Gold];
            }

            return _inventoryGold;
        }
예제 #8
0
        /// <summary>
        /// Adds an item to the backpack
        /// </summary>
        public void AddItem(Item item, int row, int column)
        {
            InventorySize size = GetItemInventorySize(item);

            //check backpack boundaries
            if (row + size.Width > Rows || column + size.Width > Columns) return;

            for (int r = row; r < Math.Min(row + size.Height, Rows); r++)
                for (int c = column; c < Math.Min(column + size.Width, Columns); c++)
                {
                    System.Diagnostics.Debug.Assert(_backpack[r, c] == 0, "You need to remove an item from the backpack before placing another item there");
                    _backpack[r, c] = item.DynamicID;
                }

            item.Owner = _owner;
            item.SetInventoryLocation(EquipmentSlot, column, row);
        }
예제 #9
0
 /// <summary>
 /// Removes an item from the backpack
 /// </summary>
 public void RemoveItem(Item item)
 {
     for (int r = 0; r < Rows; r++)
     {
         for (int c = 0; c < Columns; c++)
         {
             if (_backpack[r, c] == item.DynamicID)
             {
                 _backpack[r, c] = 0;
                 item.SetInventoryLocation(-1, -1, -1);
                 item.Owner = null;
             }
         }
     }
 }
예제 #10
0
파일: Inventory.cs 프로젝트: xsochor/mooege
 /// <summary>
 /// Visually adds rune to skill
 /// </summary>
 /// <param name="rune"></param>
 /// <param name="PowerSNOId"></param>
 /// <param name="skillIndex"></param>
 public void SetRune(Item rune, int PowerSNOId, int skillIndex)
 {
     if ((skillIndex < 0) || (skillIndex > 5))
     {
         return;
     }
     if (rune == null)
     {
         _skillSocketRunes[skillIndex] = 0;
         return;
     }
     _inventoryGrid.RemoveItem(rune);
     rune.Owner = _owner;
     _skillSocketRunes[skillIndex] = rune.DynamicID;
     // position of rune is read from mpq as INDEX of skill in skill kit /xsochor
     var y = MPQStorage.Data.Assets[SNOGroup.SkillKit].FirstOrDefault(x => x.Value.SNOId == _owner.SkillKit);
     for (int i = 0; i < (y.Value.Data as SkillKit).ActiveSkillEntries.Count; i++)
     {
         if ((y.Value.Data as SkillKit).ActiveSkillEntries[i].SNOPower == PowerSNOId)
         {
             rune.SetInventoryLocation(16, i, 0);
             break;
         }
     }
 }
예제 #11
0
파일: Equipment.cs 프로젝트: xsochor/mooege
        /// <summary>
        /// Removes an item from the equipment slot it uses
        /// returns the used equipmentSlot
        /// </summary>
        public int UnequipItem(Item item)
        {
            for (int i = 0; i < EquipmentSlots; i++)
            {
                if (_equipment[i] == item.DynamicID)
                {
                    _equipment[i] = 0;
                    item.SetInventoryLocation(-1, -1, -1);
                    item.Attributes[GameAttributeB.Item_Equipped] = false;
                    if (item.Attributes[GameAttribute.Held_In_OffHand])
                    {
                        item.Attributes[GameAttribute.Held_In_OffHand] = false;
                        if (_equipment[(int)EquipmentSlotId.Main_Hand] != 0)
                        {
                            Item mainWeapon = GetEquipment(EquipmentSlotId.Main_Hand);
                            mainWeapon.Attributes[GameAttribute.Damage_Weapon_Min_Total_MainHand] = 0;
                            mainWeapon.Attributes[GameAttribute.Damage_Weapon_Delta_Total_MainHand] = 0;
                            mainWeapon.Attributes.SendChangedMessage((mainWeapon.Owner as Player).InGameClient, mainWeapon.DynamicID);
                        }
                    }
                    else if (i == (int)EquipmentSlotId.Main_Hand)
                    {
                        if (_equipment[(int)EquipmentSlotId.Off_Hand] != 0)
                        {
                            Item offHandWeapon = GetEquipment(EquipmentSlotId.Off_Hand);
                            offHandWeapon.Attributes[GameAttribute.Damage_Weapon_Min_Total_OffHand] = 0;
                            offHandWeapon.Attributes[GameAttribute.Damage_Weapon_Delta_Total_OffHand] = 0;
                            offHandWeapon.Attributes[GameAttribute.Held_In_OffHand] = false;
                            offHandWeapon.Attributes.SendChangedMessage((offHandWeapon.Owner as Player).InGameClient, offHandWeapon.DynamicID);
                        }
                    }
                    // compute stats (depends on items)
                    item.Attributes.SendChangedMessage((item.Owner as Player).InGameClient, item.DynamicID); // unflag item
                    item.Owner = null;
                    _equippedMap = null;
                    AttributeMath.ComputeStats(_owner, GetEquippedMap());
                    return i;
                }
            }

            return 0;
        }     
예제 #12
0
파일: Equipment.cs 프로젝트: xsochor/mooege
        public Item AddGoldItem(Item collectedItem)
        {
            // the logic is flawed, we shouldn't be creating new gold when it's collected! /raist.

            if (_inventoryGold == null)
            {
                _inventoryGold = ItemGenerator.CreateGold(_owner, collectedItem.Attributes[GameAttribute.Gold]);
                _inventoryGold.Attributes[GameAttribute.ItemStackQuantityLo] = collectedItem.Attributes[GameAttribute.Gold];
                _inventoryGold.Owner = _owner;
                _inventoryGold.SetInventoryLocation(18, 0, 0); // Equipment slot 18 ==> Gold
                _inventoryGold.Reveal(_owner);
            }
            else
            {
                _inventoryGold.Attributes[GameAttribute.ItemStackQuantityLo] += collectedItem.Attributes[GameAttribute.Gold];
                //_inventoryGold.Attributes.SendChangedMessage(_owner.InGameClient, _inventoryGold.DynamicID); // causes: !!!ERROR!!! Setting attribute for unknown ACD [ANN:1253] [Attribute:ItemStackQuantityLo-1048575:	8669] and client crash /raist.
            }

            return _inventoryGold;
        }
예제 #13
0
파일: Inventory.cs 프로젝트: Sanchen/mooege
        // TODO: The inventory's gold item should not be created here. /komiga
        public void PickUpGold(uint itemID)
        {
            Item collectedItem = _owner.GroundItems[itemID];
            if (_goldItem == null)
            {
                ItemTypeGenerator itemGenerator = new ItemTypeGenerator(_owner.InGameClient);
                _goldItem = itemGenerator.CreateItem("Gold1", 0x00000178, ItemType.Gold);
                _goldItem.Count = collectedItem.Count;
                _goldItem.Owner = _owner;
                _goldItem.SetInventoryLocation(18, 0, 0); // Equipment slot 18 ==> Gold
                _goldItem.Reveal(_owner);
            }
            else
            {
                _goldItem.Count += collectedItem.Count;
            }

            GameAttributeMap attributes = new GameAttributeMap();
            attributes[GameAttribute.ItemStackQuantityLo] = _goldItem.Count;
            attributes.SendMessage(_owner.InGameClient, _goldItem.DynamicID);
        }