Esempio n. 1
0
        public static void InitMerchatLists(XmlData data)
        {
            if (CheckConfig.IsDebugOn())
            {
                Console.WriteLine("Loading merchant lists...");
            }
            zyList     = new List <int>();
            PublicData = data;
            foreach (var item in data.Items.Where(_ => NoShopItems.All(i => i != _.Value.ObjectId)))
            {
                if (Merchant.checkItem(item.Value))
                {
                    using (var db = new Database())
                    {
                        var _price = db.GetMarketPrice(item.Value);
                        if (_price > 0)
                        {
                            zyList.Add(item.Value.ObjectType);
                            price.Add(item.Value.ObjectType, _price);
                        }
                    }
                }
            }
            foreach (var item in data.Items.Where(_ => noShopStatic.All(i => i != _.Value.ObjectId)))
            {
                if (item.Value.Texture1 != 0 && item.Value.ObjectId.Contains("Clothing") && item.Value.Class == "Dye")
                {
                    clothingDyeList.Add(item.Value.ObjectType);
                }
                if (item.Value.Texture2 != 0 && item.Value.ObjectId.Contains("Accessory") && item.Value.Class == "Dye")
                {
                    accessoryDyeList.Add(item.Value.ObjectType);
                }
                if (item.Value.Texture1 != 0 && item.Value.ObjectId.Contains("Cloth") &&
                    item.Value.ObjectId.Contains("Large"))
                {
                    clothingClothList.Add(item.Value.ObjectType);
                }
                if (item.Value.Texture2 != 0 && item.Value.ObjectId.Contains("Cloth") &&
                    item.Value.ObjectId.Contains("Small"))
                {
                    accessoryClothList.Add(item.Value.ObjectType);
                }
                if (item.Value.ObjectId.Contains("Key") && item.Value.Class == "Equipment" && !item.Value.DisplayId.Contains("Fragment") && !item.Value.ObjectId.Contains("Mystery"))
                {
                    keyList.Add(item.Value.ObjectType);
                }
            }

            ClothingDyeList    = clothingDyeList.ToArray();
            ClothingClothList  = clothingClothList.ToArray();
            AccessoryClothList = accessoryClothList.ToArray();
            AccessoryDyeList   = accessoryDyeList.ToArray();
            KeyList            = keyList.ToArray();
            ZyList             = zyList.ToArray();
            if (CheckConfig.IsDebugOn())
            {
                Console.WriteLine("Merchat lists added.");
            }
        }
Esempio n. 2
0
        public static void AddItem(Item Item, int Price)
        {
            var _oldPrice = 0;

            if (CheckConfig.IsDebugOn())
            {
                Console.WriteLine("Adding Item " + Item.ObjectId + " to List");
            }

            if (price.ContainsKey(Item.ObjectType))
            {
                _oldPrice = price[Item.ObjectType];
            }

            var _newPrice = Price;

            if (_oldPrice > _newPrice || _oldPrice == 0)
            {
                Merchant.updatePrice(Item.ObjectType, _newPrice);
            }

            if (!zyList.Contains(Item.ObjectType))
            {
                zyList.Add(Item.ObjectType);
                ZyList = zyList.ToArray();
            }
        }
Esempio n. 3
0
 public static void InitMerchatLists(XmlData data)
 {
     if (CheckConfig.IsDebugOn())
     {
         Console.WriteLine("Loading merchant lists...");
     }
     zyList     = new List <int>();
     PublicData = data;
     foreach (var item in data.Items.Where(_ => NoShopItems.All(i => i != _.Value.ObjectId)))
     {
         if (Merchant.checkItem(item.Value))
         {
             using (var db = new Database())
             {
                 var _price = db.GetMarketPrice(item.Value);
                 if (_price > 0)
                 {
                     if (CheckConfig.IsDebugOn())
                     {
                         Console.WriteLine("Loading " + item.Value.ObjectId);
                     }
                     zyList.Add(item.Value.ObjectType);
                     price.Add(item.Value.ObjectType, _price);
                 }
             }
         }
     }
     ZyList = zyList.ToArray();
     if (CheckConfig.IsDebugOn())
     {
         Console.WriteLine("Merchat lists added.");
     }
 }
Esempio n. 4
0
        public static void RemoveItem(int Item)
        {
            if (CheckConfig.IsDebugOn())
            {
                Console.WriteLine("Removing " + Item + " from List");
            }

            zyList.Remove(Item);
            ZyList = zyList.ToArray();
        }