You last visited: Today at 03:43
Advertisement
Sending Packets
Discussion on Sending Packets within the PW Hacks, Bots, Cheats, Exploits forum part of the Perfect World category.
11/09/2010, 18:57
#91
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 576
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 ); } }
11/09/2010, 19:07
#92
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 576
The packet sender class will store a packet in the process's memory when used for the first time, then at subsequent uses of a specific packet it will just writeMemory the new values into the packet at the correct positions.
The MemFunctions class contains some frequently used memory related functions (and DLL imports) which are used in the PacketSender class (and of course other classes i use :P).
The only addresses used frm the PWI_Offsets class are the base address and sendpacket function address, so you can just insert those as you see fit (for example pass to the class in the constructor).
The comments above the packets in the code aren't as detailed as in the autoIt code, so use that as a reference. Also in the end it says Regular Attack everywhere as I couldn't be bothered to update it anymore , what the packets do should be obvious from their names though hehe.
I personally use a PWprocess class that contains lists of all mobs / npcs / items / players and a packetsender, which would contain a closeHandle function call in the destructor and an openProcess function call in the constructor as in the packet sending example.
Standard disclaimer for my code:
Everything is probably functional and most likely not optimal in the efficiency department. Use at your own risk also :P
11/10/2010, 06:23
#93
elite*gold: 0
Join Date: Feb 2009
Posts: 71
Received Thanks: 2
Wow, sweet stuff Interest. Started building my SendPacket function today in C++. Not even sure it'd work but I'll start testing soon. I'll have a closer look at your C# classes and try to convert them to C++, althought I have to say I'm more of a beginner/intermediate c++ coder so far. But thank you. I'll keep you posted on my progress.
11/10/2010, 08:44
#94
elite*gold: 0
Join Date: Jun 2008
Posts: 142
Received Thanks: 13
copypasted comments are funny
11/10/2010, 09:56
#95
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 576
Quote:
Originally Posted by
sweetlady
Wow, sweet stuff Interest. Started building my SendPacket function today in C++. Not even sure it'd work but I'll start testing soon. I'll have a closer look at your C# classes and try to convert them to C++, althought I have to say I'm more of a beginner/intermediate c++ coder so far. But thank you. I'll keep you posted on my progress.
Hope it'll help you with that. It's been a long long time since I coded in C++, so I'm not sure if I can help you on that, but feel free to ask any questions
Quote:
Originally Posted by
silkytail
copypasted comments are funny
lol yeah they are
edit: fixed the header for one of the split stacks (should be 3C not 3B, as the previous entry was already 3B)
also, 3E0049 = flip while jumping
3E0048 = flip while running
11/11/2010, 07:09
#96
elite*gold: 0
Join Date: Apr 2009
Posts: 106
Received Thanks: 52
Interest07, can you give any example of injection asm produce in c#?
11/11/2010, 08:58
#97
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 576
The C# code on sending packets has inject code in it. I basically just throw the opcode i want to inject into a byte array, write that to the game's memory and run it. This is the part of the code above that handles the inject function. You pass the address of where the packet is loaded into the game's memory to the function with it's size. The sendpacket function then checks if it has already loaded the opcode into memory. If it hasn't it does so, else it writes the new packetAddress to the correct position and runs the opcode.
It will then remove the opcode again in the destructor of the class (so when you're done botting :P)
Code:
private int sendPacketOpcodeAddress;
private int packetAddressLocation;
private int packetSizeAddress;
//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
};
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);
}
11/11/2010, 09:45
#98
elite*gold: 0
Join Date: Apr 2009
Posts: 106
Received Thanks: 52
For example I need inject installation
and removal of certain navigation point
coordinates in the game, it can be
implemented through the send packets
function? and tell me how to do is
inject this?
11/11/2010, 10:07
#99
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 576
As far as I know the navigation points are pure client based, so no, not with packets. I was simply giving an example on how to inject a function/asm.
Why would you want to insert navigation points though?
11/11/2010, 10:37
#100
elite*gold: 0
Join Date: Apr 2009
Posts: 106
Received Thanks: 52
I want to make a kind of GPS navigator in the game, that at a certain point, this point was removed and was put out a new list of coordinates driven into a
text file
11/14/2010, 03:40
#101
elite*gold: 0
Join Date: Nov 2010
Posts: 8
Received Thanks: 0
Can you show complete the source code send packet gold in PW indo plese
11/14/2010, 03:45
#102
elite*gold: 0
Join Date: Nov 2010
Posts: 8
Received Thanks: 0
Plesss help me
Quote:
Originally Posted by
Smurfin
tks, done changing and now it works, tried using it to drop 1 gold per x millisecond and it leaves gold trails when walk
is SkillId the same for every server ? do you have the list for cleric ?
Can you show complete the source code send packet gold in server PW indo? ( in autoit)
11/14/2010, 08:40
#103
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 576
Look at the first post of this thread, it shows you exactly how to drop gold.
11/15/2010, 04:55
#104
elite*gold: 0
Join Date: Nov 2010
Posts: 8
Received Thanks: 0
>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\My Documents\Downloads\Compressed\Test\test1.au3"
D:\My Documents\Downloads\Compressed\Test\test1.au3 (8) : ==> Error opening the file.:
#include <NomadMemory.au3>
>Exit code: 1 Time: 0.225
what wrong in this program???????????
11/15/2010, 08:48
#105
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 576
you are missing the nomadMemory file in your autoIt Include folder.
I'll attach it for you (not sure if it's the most up to date one though, but it seems to work)
Attached Files
NomadMemory.rar
(2.7 KB, 75 views)
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 03:44 .