示例#1
0
        public void AddBindTool(BindTool NewBT, bool Database)
        {
            List <BindTool> Removed = new List <BindTool>();

            foreach (BindTool PT in bindTools)
            {
                if ((PT.item == NewBT.item) &&
                    ((PT.slot == NewBT.slot) ||
                     ((PT.slot != -1) && (NewBT.slot == -1)) ||
                     ((PT.slot == -1) && (NewBT.slot != -1))) &&
                    ((PT.prefix == NewBT.prefix) ||
                     ((PT.prefix != -1) && (NewBT.prefix == -1)) ||
                     ((PT.prefix == -1) && (NewBT.prefix != -1))))
                {
                    Removed.Add(PT);
                    if (Database && tsPlayer.IsLoggedIn)
                    {
                        BTDatabase.BTDelete(tsPlayer.Account.ID, PT.item, PT.slot, PT.prefix);
                    }
                }
            }
            bindTools = (from BindTool b in bindTools
                         where !Removed.Contains(b)
                         select b).ToList();
            bindTools.Add(NewBT);
            if (Database && tsPlayer.IsLoggedIn)
            {
                BTDatabase.BTAdd(tsPlayer.Account.ID, NewBT);
            }
        }
示例#2
0
 public void RemoveBindTool(int item, int slot, int prefix)
 {
     if ((slot == -1) && (prefix == -1))
     {
         if (tsPlayer.IsLoggedIn)
         {
             BTDatabase.BTDelete(tsPlayer.Account.ID, item);
         }
         bindTools = (from BindTool b in bindTools
                      where (b.item != item)
                      select b).ToList();
     }
     else if (slot == -1)
     {
         if (tsPlayer.IsLoggedIn)
         {
             BTDatabase.BTDelete(tsPlayer.Account.ID, item, slot);
         }
         bindTools = (from BindTool b in bindTools
                      where !((b.item == item) &&
                              (b.prefix == prefix))
                      select b).ToList();
     }
     else if (prefix == -1)
     {
         if (tsPlayer.IsLoggedIn)
         {
             BTDatabase.BTDelete(tsPlayer.Account.ID, item, prefix, false);
         }
         bindTools = (from BindTool b in bindTools
                      where !((b.item == item) &&
                              (b.prefix == prefix))
                      select b).ToList();
     }
     else
     {
         if (tsPlayer.IsLoggedIn)
         {
             BTDatabase.BTDelete(tsPlayer.Account.ID, item, slot, prefix);
         }
         bindTools = (from BindTool b in bindTools
                      where !((b.item == item) &&
                              (b.slot == slot) &&
                              (b.prefix == prefix))
                      select b).ToList();
     }
 }