PaddedPackets.xs.svn-base
上传用户:market2
上传日期:2018-11-18
资源大小:18786k
文件大小:2k
源码类别:

外挂编程

开发平台:

Windows_Unix

  1. #include "EXTERN.h"
  2. #include "perl.h"
  3. #include "XSUB.h"
  4. #include "engine.h"
  5. using namespace OpenKore::PaddedPackets;
  6. static Engine engine;
  7. static dword lastTargetId = 0;
  8. static word sitPacketID = 0x89;
  9. static word skillPacketID = 0x113;
  10. MODULE = Network::PaddedPackets PACKAGE = Network::PaddedPackets
  11. PROTOTYPES: ENABLE
  12. unsigned int
  13. createSitStand(packet, sit)
  14. char *packet
  15. unsigned int sit
  16. CODE:
  17. engine.addKey(lastTargetId);
  18. lastTargetId = 0;
  19. engine.addKey(sit ? 2 : 3);
  20. RETVAL = engine.encode((byte *) packet, sitPacketID);
  21. OUTPUT:
  22. RETVAL
  23. unsigned int
  24. createAtk(packet, targetId, ctrl)
  25. char *packet
  26. unsigned int targetId
  27. unsigned int ctrl
  28. CODE: ctrl = ctrl + 1; // Shut up compiler warning.
  29. engine.addKey(targetId);
  30. engine.addKey(7);
  31. RETVAL = engine.encode((byte *) packet, sitPacketID);
  32. OUTPUT:
  33. RETVAL
  34. unsigned int
  35. createSkillUse(packet, skillId, skillLv, targetId)
  36. char *packet
  37. unsigned int skillId
  38. unsigned int skillLv
  39. unsigned int targetId
  40. CODE:
  41. engine.addKey(skillLv);
  42. engine.addKey(skillId);
  43. engine.addKey(targetId);
  44. RETVAL = engine.encode((byte *) packet, skillPacketID);
  45. OUTPUT:
  46. RETVAL
  47. void
  48. setMapSync(mapSync)
  49. unsigned int mapSync
  50. CODE:
  51. engine.setMapSync(mapSync);
  52. void
  53. setSync(sync)
  54. unsigned int sync
  55. CODE:
  56. engine.setSync(sync);
  57. void
  58. setAccountId(accountId)
  59. unsigned int accountId
  60. CODE:
  61. engine.setAccId(accountId);
  62. void
  63. setPacket(packet, packetLength, targetId)
  64. char *packet
  65. unsigned int packetLength
  66. unsigned int targetId
  67. CODE:
  68. engine.setPacket((byte *) packet, packetLength);
  69. lastTargetId = targetId;
  70. void
  71. setPacketIDs(sit, skill)
  72. unsigned short sit
  73. unsigned short skill
  74. CODE:
  75. sitPacketID = sit;
  76. skillPacketID = skill;
  77. void
  78. decodePacket(packet, keyCount)
  79. char *packet
  80. unsigned int keyCount
  81. CODE:
  82. engine.decode((byte *) packet, keyCount);
  83. unsigned int
  84. getKey(keyIndex)
  85. unsigned int keyIndex
  86. CODE:
  87. RETVAL = engine.getKey(keyIndex);
  88. OUTPUT:
  89. RETVAL