Exemplo n.º 1
0
        public static IEnumerable <Item> GetChildItems(int uniqueItemId)
        {
            parentUniqueIdParam.Value = uniqueItemId;
            SQLiteDataReader reader = ((SQLiteCommand)selectChildItemsCommand.Clone()).ExecuteReader();

            try
            {
                while (reader.Read())
                {
                    int    uniqueId = reader.GetInt32(0);
                    ushort itemId   = (ushort)reader.GetInt32(1);
                    byte   extra    = reader.GetByte(2);
                    Item   item     = Item.Create(itemId);
                    item.Extra = extra;

                    if (item is Container)
                    {
                        foreach (var i in GetChildItems(uniqueId))
                        {
                            ((Container)item).AddItem(i);
                        }
                    }

                    yield return(item);
                }
            }
            finally
            {
                reader.Close();
            }
        }
Exemplo n.º 2
0
        public static IEnumerable <KeyValuePair <SlotType, Item> > GetPlayerInventory(uint playerId)
        {
            playerIdParam.Value = playerId;

            SQLiteDataReader reader = selectInventoryCommand.ExecuteReader();

            try
            {
                while (reader.Read())
                {
                    SlotType slot     = (SlotType)reader.GetInt32(0);
                    int      uniqueId = reader.GetInt32(1);
                    ushort   itemId   = (ushort)reader.GetInt32(2);
                    byte     extra    = reader.GetByte(3);
                    Item     item     = Item.Create(itemId);
                    item.Extra = extra;

                    if (item is Container)
                    {
                        foreach (var i in GetChildItems(uniqueId))
                        {
                            ((Container)item).AddItem(i);
                        }
                    }

                    yield return(new KeyValuePair <SlotType, Item>(slot, item));
                }
            }
            finally
            {
                reader.Close();
            }
        }
Exemplo n.º 3
0
 public override Item GetCorpse()
 {
     if (Gender == Gender.Female)
     {
         return(Item.Create(Constants.Items.CorpseFemale));
     }
     else
     {
         return(Item.Create(Constants.Items.CorpseMale));
     }
 }