Skip to content

Commit 2badf7d

Browse files
author
ny
committed
add world_id
1 parent 145f07a commit 2badf7d

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

plugins/XivMemory/AddressManager.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from FFxivPythonTrigger.memory import scan_address
1+
from FFxivPythonTrigger.memory import scan_address, scan_pattern
22
from FFxivPythonTrigger.Logger import Logger
33
from FFxivPythonTrigger.Storage import get_module_storage
44
from FFxivPythonTrigger.AddressManager import AddressManager
@@ -88,4 +88,10 @@
8888
party_sig = "48 8D 0D ? ? ? ? E8 ? ? ? ? 48 8B 4E ? 48 8B D8"
8989
party_addr = _am.get("party", scan_address, party_sig, cmd_len=7)
9090

91+
##########
92+
# world_id
93+
##########
94+
world_id_hook_sig = "48 89 5C 24 ? 57 48 83 EC ? 0F B6 42 ? 48 8B FA 88 81 ? ? ? ? 48 8B D9 0F B6 42 ?"
95+
world_id_hook_addr = _am.get("world_id_hook", scan_pattern, world_id_hook_sig)
96+
9197
_storage.save()

plugins/XivMemory/__init__.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
from functools import cache
3+
from ctypes import *
34

45
from FFxivPythonTrigger import PluginBase, Logger, memory
56
from FFxivPythonTrigger.SaintCoinach import realm
@@ -12,7 +13,7 @@
1213

1314
@cache
1415
def zone_name(zone_id):
15-
if not zone_id:return ""
16+
if not zone_id: return ""
1617
return territory_sheet[zone_id]['PlaceName']
1718

1819

@@ -25,6 +26,7 @@ class XivMemory(object):
2526
movement = Movement.movement
2627
inventory = Inventory.export
2728
party = Party.party
29+
world_id = 0
2830

2931
@property
3032
def zone_id(self):
@@ -43,6 +45,16 @@ class XivMemoryPlugin(PluginBase):
4345

4446
def __init__(self):
4547
super(XivMemoryPlugin, self).__init__()
48+
49+
class WorldIdHook(self.PluginHook):
50+
argtypes = [c_int64, c_int64]
51+
restype = c_int64
52+
53+
def hook_function(_self, a1, a2):
54+
XivMemory.world_id = memory.read_ushort(a2 + 4)
55+
return _self.original(a1, a2)
56+
57+
self.world_id_hook = WorldIdHook(AddressManager.world_id_hook_addr, True)
4658
self.apiClass = XivMemory()
4759
self.register_api('XivMemory', self.apiClass)
4860
self.work = False

0 commit comments

Comments
 (0)