コード例 #1
0
 public void SetItems(List <MarketplaceItem> items)
 {
     byte[] tmp;
     this.PutByte((byte)items.Count, 5);
     tmp = new byte[6 + items.Count * 75];
     this.data.CopyTo(tmp, 0);
     this.data = tmp;
     for (int i = 0; i < items.Count; i++)
     {
         MarketplaceItem item = items[i];
         this.PutInt(item.item.id, (ushort)(6 + i * 75));
         this.PutString(Global.SetStringLength(item.item.creatorName, 21), (ushort)(10 + i * 75));
         this.PutUShort((ushort)item.item.req_clvl, (ushort)(55 + i * 75));
         this.PutUShort((ushort)item.item.durability, (ushort)(57 + i * 75));
         this.PutByte(item.item.stack, (ushort)(59 + i * 75));//unknown
         //unknown 12 bytes
         this.PutUInt(item.price, (ushort)(72 + i * 75));
         TimeSpan span = item.expire - DateTime.Now;
         if (span.TotalHours > 0)
         {
             this.PutByte((byte)span.TotalHours, (ushort)(76 + i * 75));
         }
         else
         {
             this.PutByte(0, (ushort)(76 + i * 75));
         }
         this.PutUInt(item.id, (ushort)(77 + i * 75));
     }
 }
コード例 #2
0
ファイル: MapClient.Market.cs プロジェクト: x3sphiorx/SagaRO2
        public void OnMarketBuyItem(Packets.Client.MarketBuyItem p)
        {
            uint            id   = p.GetItemId();
            MarketplaceItem item = MapServer.charDB.GetMarketItem(id);

            Packets.Server.MarketBuyItem p1 = new SagaMap.Packets.Server.MarketBuyItem();
            if (item == null)
            {
                p1.SetResult(1);
                this.netIO.SendPacket(p1, this.SessionID);
                return;
            }
            if (this.Char.zeny < item.price)
            {
                p1.SetResult(1);
                this.netIO.SendPacket(p1, this.SessionID);
                return;
            }
            Mail mail = new Mail();

            mail.content = "We are glad to inform you that your registered item at <Regenbogen> Market Place was bought by another Player" +
                           ".\n  Here is the money for the sold item.\n We are looking forward to see you at <Regenbogen> again!";
            mail.date     = DateTime.Now;
            mail.read     = 0;
            mail.receiver = item.owner;
            mail.sender   = "<Regenbogen>";
            mail.topic    = "Your item at <Regenbogen> was sold";
            mail.zeny     = item.price;
            mail.valid    = 30;
            MapServer.charDB.NewMail(mail);
            MapServer.charDB.DeleteMarketItem(item);
            MapClient receiver = MapClientManager.Instance.GetClient(item.owner);

            if (receiver != null)
            {
                receiver.CheckNewMail();
            }
            this.Char.zeny -= item.price;
            this.SendZeny();
            mail         = new Mail();
            mail.content = "We are glad to inform you that you've successfully bought an item at <Regenbogen> Market Place from another Player" +
                           ".\n  Here is the bought item.\n We are looking forward to see you at <Regenbogen> again!";
            mail.date       = DateTime.Now;
            mail.read       = 0;
            mail.receiver   = this.Char.Name;
            mail.sender     = "<Regenbogen>";
            mail.topic      = "You've bought an item at <Regenbogen>";
            mail.valid      = 30;
            mail.creator    = "";
            mail.durability = item.item.durability;
            mail.item       = (uint)item.item.id;
            mail.stack      = item.item.stack;
            MapServer.charDB.NewMail(mail);
            this.CheckNewMail();
            p1.SetResult(0);
            this.netIO.SendPacket(p1, this.SessionID);
        }
コード例 #3
0
    public int CompareTo(object obj)
    {
        MarketplaceItem marketplaceItem = (MarketplaceItem)obj;
        int             num             = RequiredLevel.CompareTo(marketplaceItem.RequiredLevel);

        if (num == 0 && marketplaceItem != this && IsSpecialItem)
        {
            num = -1;
        }
        return(num);
    }
コード例 #4
0
ファイル: MapClient.Market.cs プロジェクト: x3sphiorx/SagaRO2
        public void OnMarketRegister(Packets.Client.MarketRegister p)
        {
            /*
             * Expexted packets:
             * SMSG_MARKETREGISTER
             * SMSG_UPDATEZENY
             * SMSG_DELETEITEM | SMSG_UPDATEITEM
             *
             * This packet registers a new item on the market
             * Costs for registering is 50 rufi per day, the expression days
             * are expressed in real-time days not gametime.
             *
             * Index - describes the slot index.
             *
             * Note: This packet isn't completly reversed, still searching for the number of days
             * some kind of reason. To indicate it failed registering, durabillity
             *
             */
            byte index = p.ItemIndex();
            byte stack = p.StackCount();
            uint price = p.Zeny();
            byte days  = p.NumberOfDays();

            if (this.Char.zeny < (50 * days))
            {
                return;
            }
            MarketplaceItem item    = new MarketplaceItem();
            Item            olditem = this.Char.inv.GetItem(CONTAINER_TYPE.INVENTORY, index);

            if (stack > olditem.stack)
            {
                stack = olditem.stack;
            }
            Item newitem = new Item(olditem.id, "", olditem.durability, stack);

            item.item   = newitem;
            item.expire = (DateTime.Now + new TimeSpan(days, 0, 0, 0));
            item.owner  = this.Char.Name;
            item.price  = price;
            MapServer.charDB.RegisterMarketItem(item);
            this.map.RemoveItemFromActorPC(this.Char, index, olditem.id, stack, ITEM_UPDATE_REASON.OTHER);
            Packets.Server.MarketRegister p1 = new SagaMap.Packets.Server.MarketRegister();
            p1.SetAuctionID(item.id);
            p1.SetItemID((uint)item.item.id);
            p1.SetCount(stack);
            p1.SetReqClvl((byte)newitem.req_clvl);
            p1.SetZeny(price);
            this.netIO.SendPacket(p1, this.SessionID);
            this.Char.zeny -= (uint)(50 * days);
            this.SendZeny();
        }
コード例 #5
0
ファイル: MapClient.Market.cs プロジェクト: x3sphiorx/SagaRO2
        public void OnMarketDeleteItem(Packets.Client.MarketDeleteItem p)
        {
            /*
             * Expected packets:
             * SMSG_MarketDelete
             *
             * Additional expected packet:
             * SMSG_NewMailRecieved
             *
             * Approach: check if the selected itemid still exists in the database
             * if so send marketdelete packet with a 0 reason (successfull) and a new mail message
             *
             * If it fails you'ld need to send it with a failure reason, no clue which id's it are
             */
            uint            id   = p.GetItemId();
            MarketplaceItem item = MapServer.charDB.GetMarketItem(id);

            Packets.Server.MarketDeleteIem p1 = new SagaMap.Packets.Server.MarketDeleteIem();
            if (item == null)
            {
                p1.SetReason(1);
                this.netIO.SendPacket(p1, this.SessionID);
                return;
            }
            MapServer.charDB.DeleteMarketItem(item);
            Mail mail = new Mail();

            mail.content = "You've canceled a registered Auction at <Regenbogen> Market Place" +
                           ".\n  Here is the item you've handed to us.\n We are looking forward to see you at <Regenbogen> again!";
            mail.date       = DateTime.Now;
            mail.read       = 0;
            mail.receiver   = this.Char.Name;
            mail.sender     = "<Regenbogen>";
            mail.topic      = "You've canceled an auction at <Regenbogen>";
            mail.valid      = 30;
            mail.creator    = "";
            mail.durability = item.item.durability;
            mail.item       = (uint)item.item.id;
            mail.stack      = item.item.stack;
            MapServer.charDB.NewMail(mail);
            this.CheckNewMail();
            p1.SetReason(0);
            this.netIO.SendPacket(p1, this.SessionID);
        }
コード例 #6
0
ファイル: MarketSearchResult.cs プロジェクト: xxlio109/Saga
 public void SetItems(List <MarketplaceItem> items)
 {
     byte[] tmp;
     this.PutByte((byte)items.Count, 5);
     tmp = new byte[6 + items.Count * 112];
     this.data.CopyTo(tmp, 0);
     this.data = tmp;
     for (int i = 0; i < items.Count; i++)
     {
         MarketplaceItem item = items[i];
         this.PutInt(item.item.id, (ushort)(6 + i * 112));
         this.PutString(Global.SetStringLength(item.item.creatorName, 21), (ushort)(10 + i * 112));
         this.PutUShort((ushort)item.item.req_clvl, (ushort)(55 + i * 112));
         this.PutUShort((ushort)item.item.durability, (ushort)(57 + i * 112));
         this.PutByte(item.item.stack, (ushort)(59 + i * 112));//unknown
         //unknown 12 bytes
         this.PutUInt(item.id, (ushort)(72 + i * 112));
         this.PutString(Global.SetStringLength(item.owner, 16), (ushort)(76 + i * 112));
         this.PutUInt(item.price, (ushort)(110 + i * 112));
         this.PutUInt(item.id, (ushort)(114 + i * 112));
     }
 }
コード例 #7
0
ファイル: db40ActorDB.cs プロジェクト: x3sphiorx/SagaRO2
 public void DeleteMarketItem(MarketplaceItem item)
 {
 }
コード例 #8
0
ファイル: db40ActorDB.cs プロジェクト: x3sphiorx/SagaRO2
 public void RegisterMarketItem(MarketplaceItem item)
 {
 }