-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
196 lines (165 loc) · 5.65 KB
/
init.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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
--[[
Created by Sic
-- Thanks to the lua peeps, SpecialEd, kaen01, dannuic, knightly, aquietone, brainiac and all the others
--]]
local mq = require 'mq'
require 'ImGui'
--require('lib.sic.utilfunc')
--local Actors = require 'actors'
-- GUI Control variables
local openGUI = true
local shouldDrawGUI = true
local invisdisplaymsg = '\ao[\agInvisDisplay\ao]\ag::\aw'
--[[ TODO:: Fix git to use the library
Created by Sic
-- Thanks to the lua peeps, SpecialEd, kaen01, dannuic, knightly, aquietone, brainiac and all the others
This will act as a little include library for reused functions
--]]
Locked = true
Anon = false
-- Colors w/ full alpha
Color_green = { 0, 1, 0, 1 }
Color_red = '1, 0, 0, 1'
Color_blue = '0, 0, 1, 1'
function Color_Text(rgba_t, text)
local t = { unpack(rgba_t) }
table.insert(t, #t+1, text)
print(t)
return unpack(t)
end
function printf(s,...)
return print(string.format(s,...))
end
function IsAnyoneInvis()
local groupsize = mq.TLO.Me.GroupSize()
if groupsize ~= nil and groupsize > 0 then
for i = 0, mq.TLO.Me.GroupSize() do
if not mq.TLO.Group.Member(i).OtherZone() and mq.TLO.Group.Member(i).Invis() then
return true
end
end
end
return mq.TLO.Me.Invis()
end
-- If we "unlock" the window we want to be able to move it and resize it
-- If we "lock" the window, we don't want to be able to click it, resize it, move it, etc.
-- Do you have a flag?!
function ImGuiButtonFlagsetFlagForLockedState()
if Locked then
return bit32.bor(ImGuiWindowFlags.NoTitleBar, ImGuiWindowFlags.NoBackground, ImGuiWindowFlags.NoResize, ImGuiWindowFlags.NoMove, ImGuiWindowFlags.NoInputs)
elseif not Locked then
return bit32.bor(ImGuiWindowFlags.NoTitleBar)
end
end
local function whattodisplay(i)
if not Anon then
return mq.TLO.Group.Member(i).Name()
elseif Anon then
return mq.TLO.Group.Member(i).Class.ShortName()
end
end
local function solodisplay()
if not Anon then
return mq.TLO.Me.Name()
elseif Anon then
return mq.TLO.Me.Class.ShortName()
end
end
-- ImGui main function for rendering the UI window
-- local uisample = function()
local bdebug = true
local function invisDisplay()
local draw = IsAnyoneInvis()
if draw then
openGUI, shouldDrawGUI = ImGui.Begin('##Invis', openGUI, ImGuiButtonFlagsetFlagForLockedState())
if shouldDrawGUI then
local meinvis = mq.TLO.Me.Invis()
if meinvis then
local invistype = 0
if mq.TLO.Me.Invis(1)() then
invistype = invistype + 1
end
if mq.TLO.Me.Invis(2)() then
invistype = invistype + 2
end
local nametodisplay = solodisplay()
if invistype == 3 then
-- both invis types; green
ImGui.TextColored(0.05, 0.95, 0.05, 1, nametodisplay)
elseif invistype == 2 then
-- ivu; blue
ImGui.TextColored(0.0, 0.2, 1.0, 1, nametodisplay)
elseif invistype == 1 then
-- regular invis; pink
ImGui.TextColored(0.9, 0.5, 1.0, 1, nametodisplay)
end
end
local groupsize = mq.TLO.Me.GroupSize()
local grouped = mq.TLO.Me.Grouped()
if grouped and groupsize > 0 then
for i = 1, groupsize do
local groupinvis = mq.TLO.Group.Member(i).Invis()
if groupinvis then
-- mq/eq does not let us know which kind
ImGui.TextColored(0.05, 0.95, 0.05, 1, whattodisplay(i))
end
end
end
end
ImGui.End()
end
end
mq.imgui.init('invisDisplay', invisDisplay)
local function help()
printf('%s \agInvisDisplay options include:', invisdisplaymsg)
printf('%s \aounlock \ar---> \ag unlocks the window so you can move, size, and place it.', invisdisplaymsg)
printf('%s \aolock \ar---> \ag locks the window, making it click through, transparent, and immovable.', invisdisplaymsg)
printf('%s \aoanon on \ar---> \agDisplays Class ShortName instead of Character Name.', invisdisplaymsg)
printf('%s \aoanon off \ar---> \agDisplays Character Name of Class ShortName.', invisdisplaymsg)
end
local function do_invisdisplay(cmd, cmd2)
if cmd == 'unlock' then
printf('%s \agUnlocked!', invisdisplaymsg)
Locked = false
end
if cmd == 'lock' then
printf('%s \agLocked!', invisdisplaymsg)
Locked = true
end
if cmd == 'anon' then
if cmd2 ~= nil and cmd2 == 'on' then
printf('%s \agAnon on!', invisdisplaymsg)
Anon = true
elseif cmd2 ~= nil and cmd2 == 'off' then
printf('%s \agAnon off!', invisdisplaymsg)
Anon = false
end
end
end
local function bind_invisdisplay(cmd, cmd2)
if cmd == nil or cmd == 'help' then
help()
return
end
do_invisdisplay(cmd, cmd2)
end
local function setup()
-- make the bind
mq.bind('/invisdisplay', bind_invisdisplay)
printf('%s \aoby \agSic', invisdisplaymsg)
printf('%s Please \ar\"/invisdisplay help\"\ax for a options.', invisdisplaymsg)
end
local function main()
while true do
mq.delay(300)
-- this might be unnecessary
-- intent is to catch a crash on zoning
if mq.TLO.Me.LastZoned() < 15 then
mq.delay(10)
end
end
end
-- set it the bind and such
setup()
-- run the main loop
main()