Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.43 KB | None | 0 0
  1. __author__ = 'JoshMain'
  2.  
  3. import psutil
  4. from ctypes import *
  5.  
  6. def _get_pid():
  7.     pid = -1
  8.  
  9.     for p in psutil.process_iter():
  10.         if p.name == 'pol.exe':
  11.             return p.pid
  12.  
  13.     return pid
  14. class c_PlayerStats(Structure):
  15.     _fields_ = [("Str", c_short),
  16.             ("Dex", c_short),
  17.             ("Vit", c_short),
  18.             ("Agi", c_short),
  19.             ("Int", c_short),
  20.             ("Mnd", c_short),
  21.             ("Chr", c_short)]
  22.  
  23. class c_PlayerElements(Structure):
  24.     _fields_ = [("Fire", c_short),
  25.             ("Ice", c_short),
  26.             ("Wind", c_short),
  27.             ("Earth", c_short),
  28.             ("Lightning", c_short),
  29.             ("Water", c_short),
  30.             ("Light", c_short),
  31.             ("Dark", c_short)]
  32.  
  33. class c_PlayerCombatSkills(Structure):
  34.     _fields_ = [("HandToHand", c_ushort),
  35.         ("Dagger", c_ushort),
  36.         ("Sword", c_ushort),
  37.         ("GreatSword", c_ushort),
  38.         ("Axe", c_ushort),
  39.         ("GreatAxe", c_ushort),
  40.         ("Scythe", c_ushort),
  41.         ("Polearm", c_ushort),
  42.         ("Katana", c_ushort),
  43.         ("GreatKatana", c_ushort),
  44.         ("Club", c_ushort),
  45.         ("Staff", c_ushort),
  46.         ("unkweap0", c_ushort),
  47.         ("unkweap1", c_ushort),
  48.         ("unkweap2", c_ushort),
  49.         ("unkweap3", c_ushort),
  50.         ("unkweap4", c_ushort),
  51.         ("unkweap5", c_ushort),
  52.         ("unkweap6", c_ushort),
  53.         ("unkweap7", c_ushort),
  54.         ("unkweap8", c_ushort),
  55.         ("unkweap9", c_ushort),
  56.         ("unkweap10", c_ushort),
  57.         ("unkweap11", c_ushort),
  58.         ("Archery", c_ushort),
  59.         ("Marksmanship", c_ushort),
  60.         ("Throwing", c_ushort),
  61.         ("Guarding", c_ushort),
  62.         ("Evasion", c_ushort),
  63.         ("Shield", c_ushort),
  64.         ("Parrying", c_ushort)]
  65.  
  66. class c_PlayerMagicSkills(Structure):
  67.     _fields_ = [("Divine", c_ushort),
  68.                 ("Healing", c_ushort),
  69.                 ("Enhancing", c_ushort),
  70.                 ("Enfeebling", c_ushort),
  71.                 ("Elemental", c_ushort),
  72.                 ("Dark", c_ushort),
  73.                 ("Summon", c_ushort),
  74.                 ("Ninjitsu", c_ushort),
  75.                 ("Singing", c_ushort),
  76.                 ("String", c_ushort),
  77.                 ("Wind", c_ushort),
  78.                 ("BlueMagic", c_ushort),
  79.                 ("unkmagic0", c_ushort),
  80.                 ("unkmagic1", c_ushort),
  81.                 ("unkmagic2", c_ushort),
  82.                 ("unkmagic3", c_ushort)]
  83.  
  84. class c_PlayerCraftLevels(Structure):
  85.     _fields_ = [("Fishing", c_ushort),
  86.             ("Woodworking", c_ushort),
  87.             ("Smithing", c_ushort),
  88.             ("Goldsmithing", c_ushort),
  89.             ("Clothcraft", c_ushort),
  90.             ("Leathercraft", c_ushort),
  91.             ("Bonecraft", c_ushort),
  92.             ("Alchemy", c_ushort),
  93.             ("Cooking", c_ushort)]
  94.  
  95. class c_PlayerInfo(Structure):
  96.     _fields_ = [("HPMax", c_int),
  97.             ("MPMax", c_int),
  98.             ("MainJob", c_char),
  99.             ("MainJobLVL", c_char),
  100.             ("SubJob", c_char),
  101.             ("SubJobLVL", c_char),
  102.             ("EXPIntoLVL", c_ushort),
  103.             ("EXPForLVL", c_ushort),
  104.             ("Stats", c_PlayerStats),
  105.             ("StatModifiers", c_PlayerStats),
  106.             ("Attack", c_short),
  107.             ("Defense", c_short),
  108.             ("Elements", c_PlayerElements),
  109.             ("Title", c_short),
  110.             ("Rank", c_short),
  111.             ("RankPts", c_short),
  112.             ("Nation", c_byte),
  113.             ("Residence", c_byte),
  114.             ("HomePoint", c_int),
  115.             ("CombatSkills", c_PlayerCombatSkills),
  116.             ("MagicSkills", c_PlayerMagicSkills),
  117.             ("CraftLevels", c_PlayerCraftLevels),
  118.             ("null0", c_char),
  119.             ("LimitPoints", c_ushort),
  120.             ("MeritPoints", c_ubyte),
  121.             ("LimitMode", c_ubyte),
  122.             ("null1", c_char),
  123.             ("Buffs", c_ushort)]
  124.  
  125. class KeyboardHelper(object):
  126.     def __init__(self, windower):
  127.         self.windower = windower
  128.         self.helper = windower._dll.CreateKeyboardHelper(c_char_p('WindowerMMFKeyboardHandler_' + str(_get_pid())))
  129.  
  130.     def send(self, string):
  131.         self.windower._dll.CKHSendString(self.helper, c_char_p(string))
  132.  
  133.     def keydown(self, key):
  134.         self.windower._dll.CKHSetKey(self.helper, c_char(key), c_bool(True))
  135.  
  136.     def keyup(self, key):
  137.         self.windower._dll.CKHSetKey(self.helper, c_char(key), c_bool(False))
  138.  
  139.     def block(self):
  140.         self.windower._dll.CKHBlockInput(self.helper, c_bool(True))
  141.  
  142.     def unblock(self):
  143.         self.windower._dll.CKHBlockInput(self.helper, c_bool(False))
  144.  
  145.     def delete(self):
  146.         self.windower._dll.DeleteKeyboardHelper(self.helper)
  147.  
  148. class WindowerHelper(object):
  149.     def __init__(self):
  150.         self._dll = windll.LoadLibrary('WindowerHelper.dll')
  151.  
  152.     def create_keyboard_helper(self):
  153.         return KeyboardHelper(self)
  154.  
  155.     def create_console_helper(self):
  156.         return ConsoleHelper(self)
  157.  
  158. class FFACE(object):
  159.     def __init__(self):
  160.         self._dll = cdll.LoadLibrary('FFACE.dll')
  161.         self.instance = self._dll.CreateInstance(_get_pid())
  162.  
  163.     @property
  164.  
  165.     def access(self):
  166.         return self._dll.Access(self.instance)
  167.  
  168.     def get_max_inventory(self):
  169.         return self._dll.GetInventoryMax(self.instance)
  170.  
  171.     def get_max_satchel(self):
  172.         return self._dll.GetSatchelMax(self.instance)
  173.  
  174.     def get_inventory_item(self, index):
  175.             class c_Items(Structure):
  176.                 _fields_ = [("ID", c_ushort),
  177.                             ("Index", c_ubyte),
  178.                             ("Count", c_uint),
  179.                             ("Flag", c_uint),
  180.                             ("Price", c_uint),
  181.                             ("Extra", c_ushort)]
  182.             self._dll.GetInventoryItem.restype = c_Items
  183.             return self._dll.GetInventoryItem(self.instance, index)
  184.  
  185.     def get_player_info(self):
  186.             s = c_PlayerInfo()
  187.             self._dll.GetPlayerInfo(self.instance, byref(s))
  188.             return s
  189.             del s
  190.    
  191.     def get_chat_line_count(self):
  192.         return self._dll.GetChatLineCount(self.instance)
  193.  
  194.     def is_menu_open(self):
  195.         return self._dll.MenuIsOpen(self.instance)
  196.  
  197.     def get_vana_utc(self):
  198.         return self._dll.GetVanaUTC(self.instance)
  199.  
  200. if __name__ == '__main__':
  201.  
  202.     fface = FFACE()
  203.  
  204.     playerinfo = fface.get_player_info()
  205.     print playerinfo.EXPIntoLVL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement