Skip to content

Commit

Permalink
Implement item junk from inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed Mar 29, 2022
1 parent 3f6ee12 commit 1c51aed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
8 changes: 4 additions & 4 deletions EOLib/Domain/Item/ItemActions.cs
Expand Up @@ -55,11 +55,11 @@ public void DropItem(short itemId, int amount, MapCoordinate dropPoint)
_packetSendService.SendPacket(packet);
}

public void JunkItem(IItem item)
public void JunkItem(short itemId, int amount)
{
var packet = new PacketBuilder(PacketFamily.Item, PacketAction.Junk)
.AddShort(item.ItemID)
.AddInt(item.Amount)
.AddShort(itemId)
.AddInt(amount)
.Build();

_packetSendService.SendPacket(packet);
Expand All @@ -76,6 +76,6 @@ public interface IItemActions

void DropItem(short itemId, int amount, MapCoordinate dropPoint);

void JunkItem(IItem item);
void JunkItem(short itemId, int amount);
}
}
29 changes: 16 additions & 13 deletions EndlessClient/Controllers/InventoryController.cs
Expand Up @@ -277,23 +277,26 @@ public void DropItem(EIFRecord itemData, IInventoryItem inventoryItem)

public void JunkItem(EIFRecord itemData, IInventoryItem inventoryItem)
{
/*
if (((OldEOInventory)parent).IsOverJunk())
if (inventoryItem.Amount > 1)
{
if (m_inventory.Amount > 1)
var transferDialog = _itemTransferDialogFactory.CreateItemTransferDialog(
itemData.Name,
ItemTransferDialog.TransferType.JunkItems,
inventoryItem.Amount,
EOResourceID.DIALOG_TRANSFER_JUNK);
transferDialog.DialogClosing += (sender, e) =>
{
ItemTransferDialog dlg = new ItemTransferDialog(m_itemData.Name, ItemTransferDialog.TransferType.JunkItems,
m_inventory.Amount, EOResourceID.DIALOG_TRANSFER_JUNK);
dlg.DialogClosing += (sender, args) =>
if (e.Result == XNADialogResult.OK)
{
if (args.Result == XNADialogResult.OK && !m_api.JunkItem(m_inventory.ItemID, dlg.SelectedAmount))
((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
};
}
else if (!m_api.JunkItem(m_inventory.ItemID, 1))
((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
_itemActions.JunkItem(inventoryItem.ItemID, transferDialog.SelectedAmount);
}
};
transferDialog.ShowDialog();
}
else
{
_itemActions.JunkItem(inventoryItem.ItemID, 1);
}
*/
}
}

Expand Down

0 comments on commit 1c51aed

Please sign in to comment.