/
Naught-Include.lua
134 lines (106 loc) · 2.68 KB
/
Naught-Include.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
function init_include()
-- Default Macros
if info.MacroBook == nil then
info.MacroBook = {1, 1}
end
-- Set up default message color
info.MessageColor = 50
info.SubJob = player.sub_job
-- Handle user-based keybinds
if user_keybinds then
user_keybinds()
end
-- Handle Spell Map registrations
if user_spell_maps then
user_spell_maps()
end
-- Track when sub job changes
windower.raw_register_event('job change', sub_job_change)
-- Include the bard library
include('Naught-Bard.lua')
-- Inlucde the commands library
include('Naught-Commands.lua')
-- Let the play know what's going on
echo_status()
-- Do default lockstyles
engage_lockstyle(true)
end
function sub_job_change(main_job, main_level, sub_job, sub_level)
-- Notify file
if info.SubJob ~= player.sub_job then
if job_sub_change then
job_sub_change(info.SubJob, player.sub_job)
end
end
-- Track update
info.SubJob = player.sub_job
end
function gs_echo(msg)
add_to_chat(info.MessageColor, msg)
end
function echo_status()
gs_echo(" ")
gs_echo("GearSwap Loaded: "..player.name.." ("..player.main_job.."/"..player.sub_job..")")
if echo_modes then
echo_modes()
end
end
function ja_before_spell(ja, spell)
local ja_cmd = "@input /ja \""..ja.."\" <me>;"
local wait = "wait 1.5;"
local spell_cmd = "input /ma \""..spell.name.."\" "..spell.target.name
send_command(ja_cmd..wait..spell_cmd)
end
function select_macro_book()
if info.MacroBook ~= nil and info.MacroBook.length > 0 then
set_macro_page(info.MacroBook[0], info.MacroBook[1])
end
end
function file_unload()
-- Unbind keys
if user_unbind then
user_unbind()
end
disable_blinkmenot()
end
function bind_key(key, command, ctrl, alt)
local modifier = ""
if ctrl then
modifier = "^"
end
if alt then
modifier = "!"
end
send_command("bind "..modifier..key.." "..command)
end
function unbind(key)
send_command('unbind !'..key.."; unbind ^"..key.."; unbind "..key)
end
function clear_default_binds()
unbind('f9')
unbind('f10')
unbind('f11')
unbind('f12')
end
function engage_lockstyle(wait)
if info.LockstyleSet ~= nil then
if wait then
send_command("wait 5; input /lockstyleset "..info.LockstyleSet.."; input /echo Lockstyle Set #"..info.LockstyleSet.." Engaged")
else
send_command("input /lockstyleset "..info.LockstyleSet)
end
end
if info.UseBlinkMeNot == true then
engage_blinkmenot()
end
end
function engage_blinkmenot()
send_command("wait 6; du blinking all always on")
end
function disable_blinkmenot()
if info.UseBlinkMeNot == true then
send_command("du blinking all always off")
end
end
-- Call setup
init_include()