示例#1
0
 public void RemovePremiumItem(PremiumItem pItem)
 {
     try
     {
         locker.WaitOne();
         this.PremiumItems[pItem.PageID].Remove(pItem);
     }
     finally
     {
         locker.ReleaseMutex();
     }
 }
示例#2
0
        public static PremiumItem LoadFromDatabase(DataRow row)
        {
            var ppItem = new PremiumItem
            {
                UniqueID = GetDataTypes.GetInt(row["UniqueID"]),
                Slot     = GetDataTypes.GetByte(row["PageID"]),
                ShopID   = GetDataTypes.GetInt(row["ShopID"]),
                CharID   = GetDataTypes.GetInt(row["CharID"]),
                PageID   = GetDataTypes.GetByte(row["PageID"])
            };

            return(ppItem);
        }
示例#3
0
 public bool GetEmptySlot(out byte pSlot, out ushort PageID) //cpu intensive?
 {
     pSlot  = 0;
     PageID = 0;
     for (byte i = 0; i < this.Count; ++i)
     {
         if (!this.PremiumItems.ContainsKey(i))
         {
             for (byte i2 = 0; i2 < (this.PremiumItems[i].Count * 24); ++i2)
             {
                 PremiumItem Item = this.PremiumItems[i].Find(ss => ss.Slot == i2);
                 if (Item == null)
                 {
                     pSlot  = i2;
                     PageID = i;
                     return(true);
                 }
             }
         }
     }
     return(false); //no more empty slots found
 }
示例#4
0
 public void LoadPremiumItems(int pChar)
 {
     try
     {
         this.locker.WaitOne();
         DataTable Premiumdata = null;
         using (DatabaseClient dbClient = Program.CharDBManager.GetClient())
         {
             Premiumdata = dbClient.ReadDataTable("SELECT *FROM PremiumItem WHERE CharID='" + pChar + "'");
         }
         if (Premiumdata != null)
         {
             foreach (DataRow row in Premiumdata.Rows)
             {
                 PremiumItem pItem = PremiumItem.LoadFromDatabase(row);
                 this.PremiumItems[pItem.PageID].Add(pItem);
             }
         }
     }
     finally
     {
         this.locker.ReleaseMutex();
     }
 }
示例#5
0
 public void AddPremiumItem(PremiumItem pItem)
 {
     pItem.AddToDatabase();
     this.PremiumItems[pItem.PageID].Add(pItem);
 }