-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
134 lines (109 loc) · 3.63 KB
/
init.lua
File metadata and controls
134 lines (109 loc) · 3.63 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
--[[
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 inzonedisplaymsg = '\ao[\agInZoneDisplay\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
--]]
--#region library this should be in shared library
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
--#endregion library
-- GUI Control variables
local openGUI = true
local shouldDrawGUI = true
-- Do you have a flag?
-- ImGui main function for rendering the UI window
local function inZoneDisplay()
openGUI, shouldDrawGUI = ImGui.Begin('##InZone', openGUI, ImGuiButtonFlagsetFlagForLockedState())
if shouldDrawGUI then
local macroname = mq.TLO.Macro.Name()
local macrooutput = string.format("Mac: %s", macroname)
local inzone = mq.TLO.SpawnCount('PC')()
local output = string.format("PCs: %i", inzone)
-- R, G, B, Alpha
if macroname ~= nil then
ImGui.TextColored(0.05 , 0.95 , 0.95, 1, macrooutput)
end
ImGui.TextColored(0.05 , 0.95 , 0.95, 1, output)
end
ImGui.End()
end
mq.imgui.init('inZoneDisplay', inZoneDisplay)
local function help()
printf('%s \agInvisDisplay options include:', inzonedisplaymsg)
printf('%s \aounlock \ar---> \ag unlocks the window so you can move, size, and place it.', inzonedisplaymsg)
printf('%s \aolock \ar---> \ag locks the window, making it click through, transparent, and immovable.', inzonedisplaymsg)
end
local function do_invisdisplay(cmd, cmd2)
if cmd == 'unlock' then
printf('%s \agUnlocked!', inzonedisplaymsg)
Locked = false
end
if cmd == 'lock' then
printf('%s \agLocked!', inzonedisplaymsg)
Locked = true
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('/inzonedisplay', bind_invisdisplay)
printf('%s \aoby \agSic', inzonedisplaymsg)
printf('%s Please \ar\"/inzonedisplay help\"\ax for a options.', inzonedisplaymsg)
end
local function main()
while true do
mq.delay(300)
end
end
-- set it the bind and such
setup()
-- run the main loop
main()