Exemplo n.º 1
0
 public static void HandleExchangeObjectMovePriced(ExchangeObjectMovePricedMessage message, WorldClient client)
 {
     if (client.Character.IsInExchange(ExchangeTypeEnum.BIDHOUSE_SELL))
     {
         client.Character.GetDialog <SellExchange>().MoveItemPriced(message.objectUID, message.quantity, message.price);
     }
 }
 public static void HandleExchangeObjectMovePricedMessage(WorldClient client, ExchangeObjectMovePricedMessage message)
 {
     if (message.quantity > 0 && message.price > 0)
     {
         BasePlayerItem basePlayerItem = client.Character.Inventory.TryGetItem((int)message.objectUID);
         if (basePlayerItem != null && !client.Character.IsBusy())
         {
             client.Character.Inventory.MoveToMerchantBag(basePlayerItem, (uint)message.quantity, (uint)message.price);
         }
     }
 }
Exemplo n.º 3
0
 public void SendItemToShop(int uid, int quantity, int price)
 {
     if (ItemExists(uid) && ItemQuantity(uid) > 0)
     {
         ExchangeRequestOnShopStockMessage packetshop = new ExchangeRequestOnShopStockMessage();
         Account.SocketManager.Send(packetshop);
         ExchangeObjectMovePricedMessage msg = new ExchangeObjectMovePricedMessage(uid, quantity, price);
         Account.SocketManager.Send(msg);
         Account.Log(new ActionTextInformation("Ajout de " + Account.Inventory.GetItemFromUID(uid).Name + "(x " + quantity + ") dans le magasin magasin au prix de : " + price + " Kamas"), 2);
         LeaveDialogRequestMessage packetleave = new LeaveDialogRequestMessage();
         Account.SocketManager.Send(packetleave);
     }
 }
Exemplo n.º 4
0
        public async Task <bool> SellItem(uint itemUId, int quantity, ulong price)
        {
            /* Check if BidHouse Dialog is open */
            if (!_bidHouseSellDialogIsLoaded)
            {
                throw new Exception("La fenêtre HDV n'est pas ouverte.");
            }

            /* Check quantity */
            /* We can use log10(|quantity|)%1 */
            if ((quantity != 1) & (quantity != 10) & (quantity != 100))
            {
                throw new Exception("La quantité doit être l'une des suivantes : 1, 10, 100.");
            }

            /* Check if item exists in inventory */
            var item_exists =
                _account.Character.Inventory.Objects.Any(
                    item => (item.ObjectUID == itemUId) &
                    (item.Position == (sbyte)CharacterInventoryPositionEnum.INVENTORY_POSITION_NOT_EQUIPED) &
                    (item.Quantity >= quantity));

            if (!item_exists)
            {
                throw new Exception("Aucun item n'a été trouvé.");
            }

            /* Sell item */
            var SellItemMessage = new ExchangeObjectMovePricedMessage
            {
                Price     = price,
                ObjectUID = itemUId,
                Quantity  = quantity
            };

            /* Check if item was successfully put in bid house */
            if (await SendAndWait(SellItemMessage, 3000))
            {
                return(true);
            }

            throw new Exception("L'item n'a pas pu être mis en vente.");
        }
Exemplo n.º 5
0
        public static void HandleExchangeObjectMovePricedMessage(WorldClient client, ExchangeObjectMovePricedMessage message)
        {
            if (message.price <= 0)
            {
                return;
            }

            if (!client.Character.IsInExchange())
            {
                return;
            }

            if (client.Character.Exchanger is CharacterMerchant)
            {
                ((CharacterMerchant)client.Character.Exchanger).MovePricedItem(message.objectUID, message.quantity, (uint)message.price);
            }
            else if (client.Character.Exchanger is BidHouseExchanger)
            {
                ((BidHouseExchanger)client.Character.Exchanger).MovePricedItem(message.objectUID, message.quantity, (uint)message.price);
            }
        }
Exemplo n.º 6
0
 public static void HandleAddItemInBid(ExchangeObjectMovePricedMessage message, WorldClient client)
 {
     client.Character.BidShopInstance.AddItem(message.objectUID, message.quantity, message.price);
 }