Code:
private int sellSingleCatShopItemAddress;
private byte[] sellSingleCatShopItemAddressRev;
private byte[] sellSingleCatShopItemPkt = new byte[]
{
0x25, 0x00, //Header
0x15, 0x00, 0x00, 0x00, //npcInteraction type
0x1A, 0x00, 0x00, 0x00, //nBytes following
0x00, 0x00, 0x00, 0x00, //catshopId [player + C4C]
0x00, 0x00, 0x00, 0x00,
0xA8, 0x00, 0x50, 0x39,
0x01, 0x00, 0x00, 0x00, //nItems Sold
0x00, 0x00, 0x00, 0x00, //typeId
0x00, 0x00, //shopIndex
0x00, 0x00, //inv index
0x00, 0x00 //amount
};
public void sellSingleCatShopItem(int typeId, int shopIndex, short amount, int catShopId, short invIndex)
{
//Get size of the packet
int packetSize = sellSingleCatShopItemPkt.Length;
if (sellSingleCatShopItemAddress == 0)
{
//load packet in memory
loadPacket(sellSingleCatShopItemPkt, ref sellSingleCatShopItemAddress, ref sellSingleCatShopItemAddressRev);
}
byte[] catShopIdRev = BitConverter.GetBytes(catShopId);
catShopIdRev.Reverse();
MemFunctions.MemWriteBytes(pr_processHandle, sellSingleCatShopItemAddress + 10, catShopIdRev);
byte[] typeIdRev = BitConverter.GetBytes(typeId);
typeIdRev.Reverse();
MemFunctions.MemWriteBytes(pr_processHandle, sellSingleCatShopItemAddress + 26, typeIdRev);
byte[] shopIndexRev = BitConverter.GetBytes(shopIndex);
shopIndexRev.Reverse();
MemFunctions.MemWriteBytes(pr_processHandle, sellSingleCatShopItemAddress + 30, shopIndexRev);
byte[] invIndexRev = BitConverter.GetBytes(invIndex);
invIndexRev.Reverse();
MemFunctions.MemWriteBytes(pr_processHandle, sellSingleCatShopItemAddress + 32, invIndexRev);
byte[] amountRev = BitConverter.GetBytes(amount);
amountRev.Reverse();
MemFunctions.MemWriteBytes(pr_processHandle, sellSingleCatShopItemAddress + 34, amountRev);
sendPacket(sellSingleCatShopItemAddressRev, packetSize);
}
private int buySingleCatShopItemAddress;
private byte[] buySingleCatShopItemAddressRev;
private byte[] buySingleCatShopItemPkt = new byte[]
{
0x25, 0x00, //Header
0x13, 0x00, 0x00, 0x00, //npcInteraction type
0x1A, 0x00, 0x00, 0x00, //nBytes following
0x00, 0x00, 0x00, 0x00, //catshopId [player + C4C]
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, //nItems Sold
0x00, 0x00, 0x00, 0x00, //typeId
0x00, 0x00, 0x00, 0x00, //shopIndex
0x00, 0x00 //amount
};
public void buySingleCatShopItem(int typeId, int shopIndex, short amount, int catShopId)
{
//Get size of the packet
int packetSize = buySingleCatShopItemPkt.Length;
if (buySingleCatShopItemAddress == 0)
{
//load packet in memory
loadPacket(buySingleCatShopItemPkt, ref buySingleCatShopItemAddress, ref buySingleCatShopItemAddressRev);
}
byte[] catShopIdRev = BitConverter.GetBytes(catShopId);
catShopIdRev.Reverse();
MemFunctions.MemWriteBytes(pr_processHandle, buySingleCatShopItemAddress + 10, catShopIdRev);
byte[] typeIdRev = BitConverter.GetBytes(typeId);
typeIdRev.Reverse();
MemFunctions.MemWriteBytes(pr_processHandle, buySingleCatShopItemAddress + 26, typeIdRev);
byte[] shopIndexRev = BitConverter.GetBytes(shopIndex);
shopIndexRev.Reverse();
MemFunctions.MemWriteBytes(pr_processHandle, buySingleCatShopItemAddress + 30, shopIndexRev);
byte[] amountRev = BitConverter.GetBytes(amount);
amountRev.Reverse();
MemFunctions.MemWriteBytes(pr_processHandle, buySingleCatShopItemAddress + 34, amountRev);
sendPacket(buySingleCatShopItemAddressRev, packetSize);
}