public void AddItem(uint uid, int quantity, uint price)
        {
            var item = Client.Character.Inventory.GetItem(uid);

            if (item == null)
            {
                Client.Character.ReplyError("Impossible, cet item n'éxiste pas");
                return;
            }
            if (item.Quantity < quantity)
            {
                return;
            }
            if (CharacterBidItems.Count == BidShopRecord.GetBidShop(BidShopId).MaxItemPerAccount)
            {
                return;
            }
            Client.Character.Inventory.RemoveItem(item.UID, (uint)quantity);
            var existing = CharacterBidItems.Find(x => x.objectUID == item.UID);

            if (existing == null)
            {
                SaveTask.AddElement(new BidShopItemRecord(BidShopId, price, quantity, item));
            }
            else
            {
                SaveTask.AddElement(new BidShopItemRecord(BidShopId, price, quantity, item.CloneAndGetNewUID()));
            }
            OpenSellPanel();
        }
示例#2
0
        static void Sell(WorldClient client, NpcSpawnRecord npc, NpcActionsRecord action)
        {
            if (client.Character.BidShopInstance != null)
            {
                client.Character.BidShopInstance.OpenSellPanel();

                return;
            }
            var bidshop = BidShopRecord.GetBidShop(int.Parse(action.OptionalValue1));

            if (bidshop != null)
            {
                client.Character.BidShopInstance = new BidShopExchange(client, bidshop.GetDescriptor(npc.Id), bidshop.Id);
                client.Character.BidShopInstance.OpenSellPanel();
            }
            else
            {
                client.Character.Reply("Cet hotel de vente n'est pas encore disponible!");
            }
        }
 public SellExchange(Character character, Npc npc, BidShopRecord bidShop)
     : base(character)
 {
     this.BidShop = bidShop;
     this.Npc     = npc;
 }
 public static void Sell(Character character, Npc npc, NpcActionRecord action)
 {
     character.OpenBidhouseSell(npc, BidShopRecord.GetBidShop(int.Parse(action.Value1)),
                                character.IsInExchange(ExchangeTypeEnum.BIDHOUSE_BUY));
 }