Example #1
0
        public static void F_AUCTION_POST_ITEM(BaseClient client, PacketIn packet)
        {
            GameClient cclient = (GameClient)client;

            if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld())
            {
                return;
            }

            Player plr = cclient.Plr;

            if (AuctionHouse.PlayerAuctionCount(plr.CharacterId) >= AuctionHouse.MAX_AUCTIONS_PER_CHAR)
            {
                plr.SendMessage("You have reached the maximum of " + AuctionHouse.MAX_AUCTIONS_PER_CHAR + " auctions.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR);
                return;
            }

            ushort slot = packet.GetUint16();

            packet.Skip(2);
            uint price = packet.GetUint32();

            if (plr.ItmInterface.GetItemInSlot(slot) == null)
            {
                return;
            }

            if (plr.ItmInterface.GetItemInSlot(slot).BoundtoPlayer || plr.ItmInterface.GetItemInSlot(slot).Info.Bind == 1)
            {
                plr.SendLocalizeString(plr.ItmInterface.GetItemInSlot(slot).Info.Name, ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_AUCTION_ITEM_IS_BOUND);
                return;
            }

            Auction auction = new Auction
            {
                Item         = plr.ItmInterface.GetItemInSlot(slot).Info,
                ItemId       = plr.ItmInterface.GetItemInSlot(slot).Info.Entry,
                _Talismans   = plr.ItmInterface.GetItemInSlot(slot).GetTalismans(),
                PrimaryDye   = plr.ItmInterface.GetItemInSlot(slot).GetPrimaryDye(),
                SecondaryDye = plr.ItmInterface.GetItemInSlot(slot).GetSecondaryDye(),
                Count        = plr.ItmInterface.GetItemInSlot(slot).Count,
                Seller       = plr.Info,
                SellerId     = plr.CharacterId,
                SellPrice    = price,
                StartTime    = (uint)TCPManager.GetTimeStamp(),
                Realm        = plr.Info.Realm,
                AuctionId    = (uint)AuctionHouse.GenerateAuctionGUID()
            };

            AuctionHouse.AddAuction(auction);
            plr.ItmInterface.DeleteItem(slot);
        }