SetInventoryLocation() public method

public SetInventoryLocation ( int equipmentSlot, int column, int row ) : void
equipmentSlot int
column int
row int
return void
Ejemplo n.º 1
0
 /// <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.SetInventoryLocation(slot, 0, 0);            
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Visually adds rune to skill (move from backpack to runes' slot)
 /// </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;
     }
     if (_inventoryGrid.Items.ContainsKey(rune.DynamicID))
     {
         _inventoryGrid.RemoveItem(rune);
     }
     else
     {
         // unattuned rune changes to attuned w/o getting into inventory
         rune.World.Leave(rune);
         rune.Reveal(_owner);
     }
     _equipment.Items.Add(rune.DynamicID, rune);
     _skillSocketRunes[skillIndex] = rune.DynamicID;
     // will set only one of these to rank
     _owner.Attributes[GameAttribute.Rune_A, powerSNOId] = rune.Attributes[GameAttribute.Rune_A];
     _owner.Attributes[GameAttribute.Rune_B, powerSNOId] = rune.Attributes[GameAttribute.Rune_B];
     _owner.Attributes[GameAttribute.Rune_C, powerSNOId] = rune.Attributes[GameAttribute.Rune_C];
     _owner.Attributes[GameAttribute.Rune_D, powerSNOId] = rune.Attributes[GameAttribute.Rune_D];
     _owner.Attributes[GameAttribute.Rune_E, powerSNOId] = rune.Attributes[GameAttribute.Rune_E];
     // position of rune is read from mpq as INDEX of skill in skill kit - loaded in helper /xsochor
     rune.SetInventoryLocation(15, RuneHelper.GetRuneIndexForPower(powerSNOId), 0);
 }
Ejemplo n.º 3
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;

            Items.Add(item.DynamicID, item);

            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);
        }
Ejemplo n.º 4
0
        public void CreateItems(){
            if (_owner.Toon.ItemsTable != null)
             {
                 foreach (KeyValuePair<uint, KeyValuePair<ItemTable, Vector2D>> i in _owner.Toon.ItemsTable)
                 {
                     Item item = new Item(_owner.World, i.Value.Key);
                     item.SetInventoryLocation(0, i.Value.Value.X, i.Value.Value.Y);
                     item.Owner = _owner;
                     item.World.Leave(item);
                     this._inventoryGrid.AddItem(item, i.Value.Value.Y, i.Value.Value.X);
                 }

             }
        }