public static void HandleExchangeObjectTransfertAllFromInv(ExchangeObjectTransfertAllFromInvMessage message, WorldClient client) { AbstractTradeExchange dialog = client.Character.GetDialog <AbstractTradeExchange>(); foreach (CharacterItemRecord item in client.Character.Inventory.GetItems()) { dialog.MoveItem(item.UId, (int)item.Quantity); } }
public static void HandleExchangeObjectTransfertListToInv(ExchangeObjectTransfertListToInvMessage message, WorldClient client) { AbstractTradeExchange dialog = client.Character.GetDialog <AbstractTradeExchange>(); IEnumerable <ItemStack> allPresentItems = dialog.GetAllPresentItems().Where(x => message.ids.Contains(x.ItemUId)); foreach (ItemStack itemStack in allPresentItems) { dialog.MoveItem(itemStack.ItemUId, -1 * (int)itemStack.Quantity); } }
public static void HandleExchangeObjectTransfertListFromInv(ExchangeObjectTransfertListFromInvMessage message, WorldClient client) { AbstractTradeExchange dialog = client.Character.GetDialog <AbstractTradeExchange>(); foreach (uint itemId in message.ids) { uint quantity = client.Character.Inventory.GetItem(itemId).Quantity; dialog.MoveItem(itemId, (int)quantity); } }
public static void HandleExchangeObjectTransfertExistingToInv(ExchangeObjectTransfertExistingToInvMessage message, WorldClient client) { AbstractTradeExchange dialog = client.Character.GetDialog <AbstractTradeExchange>(); IEnumerable <ItemStack> allPresentItems = dialog.GetAllPresentItems(); List <uint> characterItems = client.Character.Inventory.GetItems().ToList().ConvertAll(x => x.UId); foreach (ItemStack itemStack in allPresentItems) { if (characterItems.Contains(itemStack.ItemUId)) { dialog.MoveItem(itemStack.ItemUId, -1 * (int)itemStack.Quantity); } } }
public static void HandleExchangeObjectTransfertExistingFromInv(ExchangeObjectTransfertExistingFromInvMessage message, WorldClient client) { AbstractTradeExchange dialog = client.Character.GetDialog <AbstractTradeExchange>(); Models.Entities.Inventory characterInventory = client.Character.Inventory; IEnumerable <ItemStack> transferableItems = from item in dialog.GetAllPresentItems() let characterItemRecord = characterInventory.GetItem(item.ItemUId) where characterItemRecord != null && item.Quantity > 0 select item; foreach (ItemStack item in transferableItems) { dialog.MoveItem(item.ItemUId, (int)item.Quantity); } }