forked from gaithern/KH-1FM-AP-LUA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
1fmAPSynthShopHint.lua
54 lines (48 loc) · 1.75 KB
/
1fmAPSynthShopHint.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
LUAGUI_NAME = "1fmAPSynthShopHint"
LUAGUI_AUTH = "Gicu"
LUAGUI_DESC = "Kingdom Hearts 1FM AP Integration"
game_version = 1 --1 for ESG 1.0.0.9, 2 for Steam 1.0.0.9
if os.getenv('LOCALAPPDATA') ~= nil then
client_communication_path = os.getenv('LOCALAPPDATA') .. "\\KH1FM\\"
else
client_communication_path = os.getenv('HOME') .. "/KH1FM/"
ok, err, code = os.rename(client_communication_path, client_communication_path)
if not ok and code ~= 13 then
os.execute("mkdir " .. path)
end
end
local canExecute = false
local world = {0x2340DDC, 0x233FE84}
local room = {0x2340DDC + 0x68, 0x233FE84 + 0x8}
local spawn = {0x2DEBD28, 0x2DEB3A8}
function file_exists(name)
local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end
end
function _OnInit()
IsEpicGLVersion = 0x3A2B86
IsSteamGLVersion = 0x3A29A6
if GAME_ID == 0xAF71841E and ENGINE_TYPE == "BACKEND" then
if ReadByte(IsEpicGLVersion) == 0xFF then
ConsolePrint("Epic Version Detected")
game_version = 1
end
if ReadByte(IsSteamGLVersion) == 0xFF then
ConsolePrint("Steam Version Detected")
game_version = 2
end
canExecute = true
end
end
function _OnFrame()
if canExecute then
if ReadByte(world[game_version]) == 0x03 and ReadByte(room[game_version]) == 0x0B and (ReadByte(spawn[game_version]) == 0x36 or ReadByte(spawn[game_version]) == 0x34) then --In Item Workshop
if not file_exists(client_communication_path .. "insynthshop") then
file = io.open(client_communication_path .. "insynthshop", "w")
io.output(file)
io.write("")
io.close(file)
end
end
end
end