forked from ThornyFFXI/tCrossBar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcallbacks.lua
More file actions
154 lines (130 loc) · 4.02 KB
/
callbacks.lua
File metadata and controls
154 lines (130 loc) · 4.02 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
local renderTarget;
local player = require('state.player');
local pGameMenu = ashita.memory.find('FFXiMain.dll', 0, "8B480C85C974??8B510885D274??3B05", 16, 0);
local pEventSystem = ashita.memory.find('FFXiMain.dll', 0, "A0????????84C0741AA1????????85C0741166A1????????663B05????????0F94C0C3", 0, 0);
local pInterfaceHidden = ashita.memory.find('FFXiMain.dll', 0, "8B4424046A016A0050B9????????E8????????F6D81BC040C3", 0, 0);
local pChatExpanded = ashita.memory.find('FFXiMain.dll', 0, '83EC??B9????????E8????????0FBF4C24??84C0', 0x04, 0);
local function GetMenuName()
local subPointer = ashita.memory.read_uint32(pGameMenu);
local subValue = ashita.memory.read_uint32(subPointer);
if (subValue == 0) then
return '';
end
local menuHeader = ashita.memory.read_uint32(subValue + 4);
local menuName = ashita.memory.read_string(menuHeader + 0x46, 16);
return string.gsub(menuName, '\x00', '');
end
--Credit: Loonsie /
local function GetChatExpanded()
local ptr = ashita.memory.read_uint32(pChatExpanded);
if (ptr == 0) then
return false;
end
return (ashita.memory.read_uint8(ptr + 0xF1) ~= 0);
end
local function GetEventSystemActive()
if (pEventSystem == 0) then
return false;
end
local ptr = ashita.memory.read_uint32(pEventSystem + 1);
if (ptr == 0) then
return false;
end
return (ashita.memory.read_uint8(ptr) == 1);
end
local function GetInterfaceHidden()
if (pEventSystem == 0) then
return false;
end
local ptr = ashita.memory.read_uint32(pInterfaceHidden + 10);
if (ptr == 0) then
return false;
end
return (ashita.memory.read_uint8(ptr + 0xB4) == 1);
end
local altMaps = T{
['menu cnqframe'] = true,
['menu scanlist'] = true,
};
local function ShouldHide()
if gToggleHide then
return true;
end
if (gSettings.HideWhileZoning) then
if (player:GetLoggedIn() == false) then
return true;
end
end
if (gSettings.HideWhileCutscene) then
if (GetEventSystemActive()) then
return true;
end
end
if (gSettings.HideWhileMap) then
local activeMenu = GetMenuName();
if (string.sub(activeMenu, 1, 11) == 'menu map') or (altMaps[activeMenu]) then
return true;
end
end
if (gSettings.HideWhileChat) then
if (GetChatExpanded()) then
return true;
end
end
if (GetInterfaceHidden()) then
return true;
end
return false;
end
ashita.events.register('d3d_present', 'd3d_present_cb', function ()
player:UpdateBLUSpells();
gController:Tick();
gConfigGUI:Render();
gBindingGUI:Render();
renderTarget = nil;
if (gConfigGUI.ForceDisplay) then
gConfigGUI.ForceDisplay:Render(1);
renderTarget = gConfigGUI.ForceDisplay;
return;
end
if (gBindingGUI.ForceDisplay) then
gBindingGUI.ForceDisplay:Render(gBindingGUI.ForceState);
renderTarget = gBindingGUI.ForceDisplay;
return;
end
if (ShouldHide()) then
return;
end
renderTarget = gSingleDisplay;
local macroState = gController:GetMacroState();
if (macroState == 0) then
if (gSettings.ShowDoubleDisplay) then
renderTarget = gDoubleDisplay;
end
elseif (macroState < 3) then
if (gSettings.LTRTMode == 'FullDouble') then
renderTarget = gDoubleDisplay;
elseif (gSettings.LTRTMode == 'HalfDouble') then
gDoubleDisplay:Render(macroState, true);
return;
end
end
renderTarget:Render(macroState);
end);
local mouseDown;
ashita.events.register('mouse', 'mouse_cb', function (e)
if (renderTarget ~= nil) then
renderTarget:HandleMouse(e);
end
if (e.message == 513) then
if (e.blocked == true) then
mouseDown = true;
end
end
if (e.message == 514) then
if mouseDown then
e.blocked = true;
mouseDown = false;
end
end
end);