Example #1
0
        public void GetItemsMessage(LKCamelot.LoginProto msg, LKCamelot.model.Player play)
        {
            LoginProto curResp = new LoginProto();

            curResp.GetItemsResponseP = new GetItemsResponse();
            var templ = new List <TraderItem>();

            foreach (var item in play.Inventory)
            {
                var ti = new TraderItem();
                ti.Name = item.Name;
                if (item.Stage > 0)
                {
                    ti.Name += "<br>" + item.NPrefix() + "(" + item.Stage + ")";
                }

                ti.Quantity = item.Quantity.ToString();
                ti.Serial   = ((int)(item.m_Serial)).ToString();
                ti.Sprite   = item.m_ItemID.ToString();
                ti.Stage    = item.Stage.ToString();
                templ.Add(ti);
            }

            curResp.GetItemsResponseP.traderItem = templ;
            iweb.Send(CreateBuffer(curResp));
        }
Example #2
0
        public void GetItemsMessage(LKCamelot.LoginProto msg, LKCamelot.model.Player play)
        {
            LoginProto curResp = new LoginProto();
            curResp.GetItemsResponseP = new GetItemsResponse();
            var templ = new List<TraderItem>();
            foreach (var item in play.Inventory)
            {
                var ti = new TraderItem();
                ti.Name = item.Name;
                if (item.Stage > 0)
                    ti.Name += "<br>" + item.NPrefix() + "(" + item.Stage + ")";

                ti.Quantity = item.Quantity.ToString();
                ti.Serial = ((int)(item.m_Serial)).ToString();
                ti.Sprite = item.m_ItemID.ToString();
                ti.Stage = item.Stage.ToString();
                templ.Add(ti);
            }

            curResp.GetItemsResponseP.traderItem = templ;
            iweb.Send(CreateBuffer(curResp));
        }
Example #3
0
        public void GetAuctions(LKCamelot.model.Player play)
        {
            var aucs = LKCamelot.model.World.NewAuctions.Values.OrderBy(xe => xe.item.Name).ThenBy(xe => xe.item.Stage).ThenBy(xe => xe.goldprice).ToList();
            LoginProto curResp = new LoginProto();
            curResp.GetAuctionsResponseP = new GetAuctionsResponse();

            var templ = new List<AuctionTraderItem>();
            foreach (var item in aucs)
            {
                if (item.state == script.item.aucState.sold
                    && item.buyerSerial != play.Serial)
                    continue;

                var tt = new AuctionTraderItem();
                var ti = new TraderItem();
                ti.Name = item.item.Name;
                if (item.item.Stage > 0)
                    ti.Name += "<br>" + item.item.NPrefix() + "("+ item.item.Stage +")";
                ti.Quantity = item.item.Quantity.ToString();
                ti.Serial = ((int)item.item.m_Serial).ToString();
                ti.Sprite = item.item.m_ItemID.ToString();
                ti.Stage = item.item.Stage.ToString();
                tt.Gold = item.goldprice.ToString();
                tt.AGold = item.agoldprice.ToString();
                tt.flags = item.flags.ToString();
                tt.BItem = ti;
                tt.count = 1;
                if (item.sellerSerial == play.Serial && item.state == script.item.aucState.forsale)
                    tt.flags = "3";
                if (item.buyerSerial == play.Serial && item.state == script.item.aucState.sold)
                    tt.flags = "2";

                templ.Add(tt);
            }
            var templ2 = templ.ToList();
            AuctionTraderItem lastitem = new AuctionTraderItem();
            lastitem.BItem = new TraderItem();

            foreach (var temp in templ2)
            {
                if (temp.BItem.Name == lastitem.BItem.Name
                    && temp.flags == "1")
                {
                    templ.Remove(temp);
                    templ[templ.IndexOf(lastitem)].count++;

                    continue;
                }
                lastitem = temp;
            }
            curResp.GetAuctionsResponseP.auctiontraderItem = templ;
            iweb.Send(CreateBuffer(curResp));
        }
Example #4
0
        public void GetAuctions(LKCamelot.model.Player play)
        {
            var        aucs    = LKCamelot.model.World.NewAuctions.Values.OrderBy(xe => xe.item.Name).ThenBy(xe => xe.item.Stage).ThenBy(xe => xe.goldprice).ToList();
            LoginProto curResp = new LoginProto();

            curResp.GetAuctionsResponseP = new GetAuctionsResponse();

            var templ = new List <AuctionTraderItem>();

            foreach (var item in aucs)
            {
                if (item.state == script.item.aucState.sold &&
                    item.buyerSerial != play.Serial)
                {
                    continue;
                }

                var tt = new AuctionTraderItem();
                var ti = new TraderItem();
                ti.Name = item.item.Name;
                if (item.item.Stage > 0)
                {
                    ti.Name += "<br>" + item.item.NPrefix() + "(" + item.item.Stage + ")";
                }
                ti.Quantity = item.item.Quantity.ToString();
                ti.Serial   = ((int)item.item.m_Serial).ToString();
                ti.Sprite   = item.item.m_ItemID.ToString();
                ti.Stage    = item.item.Stage.ToString();
                tt.Gold     = item.goldprice.ToString();
                tt.AGold    = item.agoldprice.ToString();
                tt.flags    = item.flags.ToString();
                tt.BItem    = ti;
                tt.count    = 1;
                if (item.sellerSerial == play.Serial && item.state == script.item.aucState.forsale)
                {
                    tt.flags = "3";
                }
                if (item.buyerSerial == play.Serial && item.state == script.item.aucState.sold)
                {
                    tt.flags = "2";
                }

                templ.Add(tt);
            }
            var templ2 = templ.ToList();
            AuctionTraderItem lastitem = new AuctionTraderItem();

            lastitem.BItem = new TraderItem();

            foreach (var temp in templ2)
            {
                if (temp.BItem.Name == lastitem.BItem.Name &&
                    temp.flags == "1")
                {
                    templ.Remove(temp);
                    templ[templ.IndexOf(lastitem)].count++;

                    continue;
                }
                lastitem = temp;
            }
            curResp.GetAuctionsResponseP.auctiontraderItem = templ;
            iweb.Send(CreateBuffer(curResp));
        }