Skip to content

Commit

Permalink
Add support for equip/unequip item packets and responses. Unequip ite…
Browse files Browse the repository at this point in the history
…ms from paperdoll when right-clicked in the dialog.
  • Loading branch information
ethanmoffat committed Mar 24, 2022
1 parent d93c57c commit f2bb8a6
Show file tree
Hide file tree
Showing 13 changed files with 235 additions and 299 deletions.
2 changes: 1 addition & 1 deletion EOBot/TrainerBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ private async Task UseHealItem(IEnumerable<IInventoryItem> healItems)

ConsoleHelper.WriteMessage(ConsoleHelper.Type.UseItem, $"{itemToUse.Name} - {itemToUse.HP} HP - inventory: {amount - 1} - (other heal item types: {healItems.Count() - 1})");

await TrySend(() => _characterActions.UseItem(itemToUse.ID));
await TrySend(() => _characterActions.UseItem((short)itemToUse.ID));

await Task.Delay(ATTACK_BACKOFF_MS);
}
Expand Down
30 changes: 27 additions & 3 deletions EOLib/Domain/Character/CharacterActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,30 @@ public void ToggleSit()
_packetSendService.SendPacket(packet);
}

public void UseItem(int itemId)
public void UseItem(short itemId)
{
var packet = new PacketBuilder(PacketFamily.Item, PacketAction.Use)
.AddShort((short)itemId)
.AddShort(itemId)
.Build();

_packetSendService.SendPacket(packet);
}

public void EquipItem(short itemId, bool alternateLocation)
{
var packet = new PacketBuilder(PacketFamily.PaperDoll, PacketAction.Add)
.AddShort(itemId)
.AddChar((byte)(alternateLocation ? 1 : 0))
.Build();

_packetSendService.SendPacket(packet);
}

public void UnequipItem(short itemId, bool alternateLocation)
{
var packet = new PacketBuilder(PacketFamily.PaperDoll, PacketAction.Remove)
.AddShort(itemId)
.AddChar((byte)(alternateLocation ? 1 : 0))
.Build();

_packetSendService.SendPacket(packet);
Expand Down Expand Up @@ -159,7 +179,11 @@ public interface ICharacterActions

void ToggleSit();

void UseItem(int itemId);
void UseItem(short itemId);

void EquipItem(short itemId, bool alternateLocation);

void UnequipItem(short itemId, bool alternateLocation);

void PrepareCastSpell(int spellId);

Expand Down
54 changes: 0 additions & 54 deletions EOLib/Net/API/Avatar.cs

This file was deleted.

1 change: 0 additions & 1 deletion EOLib/Net/API/PacketAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public PacketAPI(EOClient client)
_createLockerMembers();
_createMessageMembers();
_createMusicMembers();
_createPaperdollMembers();
_createPartyMembers();
_createNPCMembers();
_createQuestMembers();
Expand Down
152 changes: 0 additions & 152 deletions EOLib/Net/API/Paperdoll.cs

This file was deleted.

Loading

0 comments on commit f2bb8a6

Please sign in to comment.