Skip to content

Commit b928f5c

Browse files
committed
update to enable amount editing
1 parent dbadf0b commit b928f5c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

acnhpoker/Utilities.cs

+13-1
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,25 @@ public string GetItemSlotAddress(int slot)
2828
return "0x" + (ItemSlotBase + (( Clamp(slot, 1, 20) - 1 ) * 0x8)).ToString("X");
2929
}
3030

31+
public string GetItemCountAddress(int slot)
32+
{
33+
34+
return "0x" + ((ItemSlotBase + ((Clamp(slot, 1, 20) - 1) * 0x8) + 0x4)).ToString("X");
35+
}
36+
3137
public bool SpawnItem(Socket socket, int slot, String value, int amount)
3238
{
3339
try
3440
{
3541
byte[] msg = Encoding.UTF8.GetBytes("poke " + GetItemSlotAddress(slot) + " " + FormatItemId(value) + "\r\n");
36-
Debug.Print("poke " + GetItemSlotAddress(slot) + " " + FormatItemId(value));
3742
socket.Send(msg);
43+
44+
if (amount > 1)
45+
{
46+
var itemCount = GetItemCountAddress(slot);
47+
byte[] countMsg = Encoding.UTF8.GetBytes("poke " + itemCount + " " + (amount-1).ToString("X") + "\r\n");
48+
socket.Send(countMsg);
49+
}
3850
}
3951
catch
4052
{

0 commit comments

Comments
 (0)