Skip to content

Instantly share code, notes, and snippets.

@drlongnecker
Created March 23, 2018 16:49
Show Gist options
  • Save drlongnecker/57a2b35418490e591232e231aa96998f to your computer and use it in GitHub Desktop.
Save drlongnecker/57a2b35418490e591232e231aa96998f to your computer and use it in GitHub Desktop.
macrochanger.lua
-- A quick rewrite of the Windower addon for Ashita v3 that swaps your macro pallette on job change.
-- Yes, I'm lazy.
_addon.name = 'MacroChanger'
_addon.author = 'Derahine'
_addon.version = '1.0.0.0'
require 'common'
jobs = {
[1] = 'WAR',
[2] = 'MNK',
[3] = 'WHM',
[4] = 'BLM',
[5] = 'RDM',
[6] = 'THF',
[7] = 'PLD',
[8] = 'DRK',
[9] = 'BST',
[10] = 'BRD',
[11] = 'RNG',
[12] = 'SAM',
[13] = 'NIN',
[14] = 'DRG',
[15] = 'SMN',
[16] = 'BLU',
[17] = 'COR',
[18] = 'PUP',
[19] = 'DNC',
[20] = 'SCH',
[21] = 'GEO',
[22] = 'RUN'
};
macros = {
WAR = {Book = '1', Page = '1'},
MNK = {Book = '2', Page = '1'},
WHM = {Book = '3', Page = '1'},
BLM = {Book = '4', Page = '1'},
RDM = {Book = '5', Page = '1'},
THF = {Book = '6', Page = '1'},
PLD = {Book = '7', Page = '1'},
DRK = {Book = '8', Page = '1'},
BST = {Book = '9', Page = '1'},
BRD = {Book = '10', Page = '1'},
RNG = {Book = '17', Page = '3'},
SAM = {Book = '12', Page = '1'},
NIN = {Book = '13', Page = '1'},
DRG = {Book = '14', Page = '1'},
SMN = {Book = '15', Page = '1'},
BLU = {Book = '16', Page = '1'},
COR = {Book = '17', Page = '1'},
PUP = {Book = '18', Page = '1'},
DNC = {Book = '19', Page = '1'},
SCH = {Book = '20', Page = '1'},
GEO = {Book = '3', Page = '3'},
RUN = {Book = '11', Page = '1'}
}
config = {
current_job = ''
}
ashita.register_event('load', function()
end);
ashita.register_event('unload', function()
end);
function send_to_log(msg)
print('\31\200[\31\05' .. _addon.name .. '\31\200]\30\01 ' .. msg);
end
ashita.register_event('incoming_packet', function(id, size, data)
if (id == 0x1B) then
local jobId = data:byte(0x08 + 1)
local job = jobs[jobId]
if (config.current_job ~= job) then
config.current_job = job
local book = ''
local page = ''
if job and macros[job] then
book = macros[job].Book
page = macros[job].Page
send_to_log('[\31\05'.. job ..'\30\01] Changing macros to Book: '.. book .. ' and Page: '.. page)
AshitaCore:GetChatManager():QueueCommand('/macro book '..book,1)
AshitaCore:GetChatManager():QueueCommand('/macro set '..page,1)
end
end
end
return false;
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment