public static RewardItem LoadFromDatabase(System.Data.DataRow row) { RewardItem ppItem = new RewardItem { Slot = GetDataTypes.GetSByte(row["Slot"]), ID = GetDataTypes.GetUshort(row["ItemID"]), CharID = GetDataTypes.GetInt(row["CharID"]), PageID = GetDataTypes.GetByte(row["PageID"]) }; return ppItem; }
public void AddRewardItem(RewardItem pItem) { try { locker.WaitOne(); if (!this.RewardItems.ContainsKey(pItem.PageID)) { this.RewardItems[pItem.PageID] = new List<RewardItem>(); } pItem.AddToDatabase(); this.RewardItems[pItem.PageID].Add(pItem); } finally { locker.ReleaseMutex(); } }
public void RemoveRewardItem(RewardItem pItem) { try { locker.WaitOne(); pItem.RemoveFromDatabase(); this.RewardItems[pItem.PageID].Remove(pItem); } finally { locker.ReleaseMutex(); } }
public bool GiveMasterRewardItem(ushort ItemID,byte count) { MasterRewardState States; ushort PageID; byte pSlot; if (this.RewardInventory.GetEmptySlot(out pSlot, out PageID)) { if (!Data.DataProvider.Instance.MasterRewardStates.TryGetValue(ItemID, out States)) return false; RewardItem Reward = new RewardItem { ID = ItemID, Slot = (sbyte)pSlot, PageID = PageID, Ammount = count, }; Reward.UpgradeStats = new UpgradeStats { Str = States.Str, Int = States.Int, Spr = States.Spr, Dex = States.Dex, End = States.End, }; this.RewardInventory.AddRewardItem(Reward); return true; } else { //Todo Send FULL return false; } }