Example #1
0
        public static AuctionTradeData LoadFromSavedVars(LsonValue luaObject, string CharName)
        {
            LsonValue items = luaObject;

            if (items.ContainsKey("$AccountWide"))
            {
                LsonValue acctdata = items["$AccountWide"];

                LsonValue           item = (acctdata)["data"]["Listings"];
                List <AuctionEntry> CurAuctionEntries = new List <AuctionEntry>();
                foreach (int key in item.Keys)
                {
                    LsonValue tmpdict = item[key];
                    if (tmpdict.ContainsKey("attributes") && tmpdict.ContainsKey("Listing"))
                    {
                        AuctionEntry CurAuctionEntry = new AuctionEntry(tmpdict, CharName);
                        if (!CurAuctionEntry.ItemData.Item.ID.HasValue)
                        {
                            continue;
                        }
                        CurAuctionEntries.Add(CurAuctionEntry);
                    }
                }
                return(new AuctionTradeData(CharName)
                {
                    AuctionEntries = CurAuctionEntries
                });
            }

            return(new AuctionTradeData(CharName)
            {
            });
        }
Example #2
0
        public AuctionBidEntry(LsonValue luaObject, string CharName)
        {
            luaObject = luaObject["Bid"];

            this.Buyer  = CharName;
            this.Seller = (string)luaObject["seller"];
            if (luaObject.ContainsKey("Player"))
            {
                this.Player = (string)luaObject["Player"];
            }
            else
            {
                this.Player = "";
            }
            int i;

            if (!int.TryParse((string)luaObject["TradeID"], out i))
            {
                i = 0;
            }
            this.TradeID    = i;
            this.ItemID     = (int)luaObject["ItemID"];
            this.ItemLink   = (string)luaObject["ItemLink"];
            this.stackCount = (int)luaObject["stackCount"];
            this.Price      = (int)luaObject["Price"];
        }
Example #3
0
        public AuctionItem(LsonValue luaObject)
        {
            LsonValue curAttributes = (luaObject["attributes"]);
            LsonValue curListing    = (luaObject["Listing"]);

            LsonValue curType      = (curAttributes["Type"]);
            LsonValue curCondition = (curAttributes["Condition"]);
            LsonValue curTrait     = (curAttributes["Trait"]);
            LsonValue curEnchant   = (curAttributes["Enchant"]);

            this.ItemType       = (int)curType["ItemType"];
            this.ItemWeaponType = (int)curType["ItemWeaponType"];
            this.ItemArmorType  = (int)curType["ItemArmorType"];
            this.ItemLink       = ToUTF8((string)curAttributes["ItemLink"]);
            this.Name           = ToUTF8((string)curAttributes["itemName"]);
            int?nullable = null;

            this.ID = nullable;
            if (curAttributes.ContainsKey("itemId"))
            {
                this.ID = new int?(int.Parse((string)curAttributes["itemId"]));
            }
            this.Quality = (int)curAttributes["itemQuality"];

            this.Condition  = (int)curCondition["ItemCondition"];
            this.RepairCost = (int)curCondition["ItemRepairCost"];


            this.ArmorRating = (int)curAttributes["ItemArmorRating"];
            this.WeaponPower = (int)curAttributes["ItemWeaponPower"];
            this.StatVal     = (int)curAttributes["itemStatVal"];


            this.ItemCharge         = (int)curEnchant["ItemCharge"];
            this.ItemChargeMax      = (int)curEnchant["ItemChargeMax"];
            this.ItemChargePercent  = (int)curEnchant["ItemChargePercent"];
            this.enchantHeader      = (string)curEnchant["enchantHeader"];
            this.enchantDescription = (string)curEnchant["enchantDescription"];



            this.traitDescription = (string)curTrait["traitDescription"];
            this.traitType        = (string)curTrait["traitType"];
            if (curTrait.ContainsKey("traitSubtypeDescription"))
            {
                this.traitSubtypeDescription = (string)curTrait["traitSubtypeDescription"];
            }
            else
            {
                this.traitSubtypeDescription = "";
            }
            this.traitSubtype = (string)curTrait["traitSubtype"];

            this.setName = (string)curAttributes["setName"];


            this.sellValue = (int)curCondition["ItemSellValueWithBonuses"];



            this.RequiredLevel          = (int)curAttributes["ItemRequiredLevel"];
            this.RequiredChampionPoints = (int)curAttributes["ItemRequiredChampionPoints"];
            this.LevelTotal             = this.RequiredLevel + this.RequiredChampionPoints;
        }
Example #4
0
        public AuctionItemData(LsonValue luaObject)
        {
            int i;

            if (luaObject.ContainsKey("attributes") && luaObject.ContainsKey("Listing"))
            {
                LsonValue curAttributes = (luaObject["attributes"]);
                LsonValue curListing    = (luaObject["Listing"]);

                if (curAttributes.ContainsKey("itemId") && curAttributes.ContainsKey("stackCount") && curListing.ContainsKey("Price"))
                {
                    this.Item          = new AuctionItem(luaObject);
                    this.StartingPrice = 0;
                    this.BuyoutPrice   = 0;


                    this.stackCount = (int)curAttributes["stackCount"];

                    if (!int.TryParse((string)curAttributes["itemId"], out i))
                    {
                        i = 0;
                    }
                    this.itemId = i;
                    // this.itemId = (int)curAttributes["itemId"];

                    if (curListing.ContainsKey("Player"))
                    {
                        this.CharName = (string)curListing["Player"];
                    }


                    if (curListing.ContainsKey("BuyoutPrice"))
                    {
                        //this.BuyoutPrice = (int)curListing["BuyoutPrice"];
                        string tmpbuyout = (string)curListing["BuyoutPrice"];
                        if (tmpbuyout != "" && tmpbuyout != "\"\"")
                        {
                            if (!int.TryParse(tmpbuyout, out i))
                            {
                                i = 0;
                            }
                            this.BuyoutPrice = i;
                        }
                    }


                    if (curListing.ContainsKey("StartingPrice"))
                    {
                        string tmpprice = (string)curListing["StartingPrice"];
                        if (tmpprice != "" && tmpprice != "\"\"")
                        {
                            if (!int.TryParse(tmpprice, out i))
                            {
                                i = 0;
                            }
                            this.StartingPrice = i;
                        }
                    }
                    else
                    {
                        this.StartingPrice = this.BuyoutPrice;
                    }


                    if (curListing.ContainsKey("IsBuyout"))
                    {
                        this.IsBuyout = (int)curListing["IsBuyout"];
                    }
                }
            }
        }