public InventoryComponent(uint mUserId, GameClient Session, HabboData Data) { this.mClient = Session; this.UserId = mUserId; this.InventoryItems = new List<UserItem>(); this.InventoryPets = new Hashtable(); this.mAddedItems = new Hashtable(); this.discs = new Hashtable(); this.mRemovedItems = new List<uint>(); this.InventoryItems.Clear(); DataTable Table = Data.GetUserInventory; foreach (DataRow Row in Table.Rows) { this.InventoryItems.Add(new UserItem((uint)Row["Id"], (uint)Row["base_item"], (string)Row["extra_data"])); } this.InventoryPets.Clear(); DataTable dataTable_2 = Data.GetUserPets; foreach (DataRow dataRow in Table.Rows) { string str; uint id = Convert.ToUInt32(dataRow["Id"]); uint baseItem = Convert.ToUInt32(dataRow["base_item"]); if (!DBNull.Value.Equals(dataRow["extra_data"])) { str = (string)dataRow["extra_data"]; } else { str = string.Empty; } InventoryItems.Add(new UserItem(id, baseItem, str)); UserItem item = new UserItem(id, baseItem, str); if (item.GetBaseItem().InteractionType == "musicdisc") { this.discs.Add(item.Id, item); } } }
public void AddItem(uint uint_1, uint uint_2, string string_0, bool bool_0) { UserItem item = new UserItem(uint_1, uint_2, string_0); this.InventoryItems.Add(item); if (this.mRemovedItems.Contains(uint_1)) { this.mRemovedItems.Remove(uint_1); } if (!this.mAddedItems.ContainsKey(uint_1)) { if (bool_0) { using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.AddParamWithValue("extra_data", string_0); adapter.ExecuteQuery(string.Concat(new object[] { "INSERT INTO items (Id,user_id,base_item,extra_data,wall_pos) VALUES ('", uint_1, "','", this.UserId, "','", uint_2, "',@extra_data, '')" })); return; } } if (item.GetBaseItem().InteractionType == "musicdisc") { if (this.discs.ContainsKey(item.Id)) { this.discs.Add(item.Id, item); } } using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.ExecuteQuery(string.Concat(new object[] { "UPDATE items SET room_id = 0, user_id = '", this.UserId, "' WHERE Id = '", uint_1, "'" })); } } }
public SongItem(UserItem item) { this.itemID = (int)item.Id; this.songID = Convert.ToInt32(item.ExtraData); this.baseItem = item.GetBaseItem(); }
public void OfferItem(uint UserId, UserItem Item) { TradeUser User = GetTradeUser(UserId); if (User == null || Item == null || !Item.GetBaseItem().AllowTrade || User.HasAccepted || TradeStage != 1) { return; } ClearAccepted(); User.OfferedItems.Add(Item); UpdateTradeWindow(); }
public void TakeBackItem(uint UserId, UserItem Item) { TradeUser User = GetTradeUser(UserId); if (User == null || Item == null || User.HasAccepted || TradeStage != 1) { return; } ClearAccepted(); User.OfferedItems.Remove(Item); UpdateTradeWindow(); }
public bool CanSellItem(UserItem Item) { return Item.GetBaseItem().AllowTrade && Item.GetBaseItem().AllowMarketplaceSell; }