Created
March 18, 2018 11:04
-
-
Save codebykyle/35cbb24faf3f5ae9776652bc9886904c to your computer and use it in GitHub Desktop.
Use skillup tomes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_addon.name = 'skillup' | |
_addon.author = 'Senotaru (Asura)' | |
_addon.version = '0.0.1' | |
_addon.lastUpdate = "2018.18.03" | |
_addon.commands = {'skillup'} | |
require('luau') | |
require('tables') | |
require('strings') | |
local packets = require('packets') | |
local isSkilling = false | |
local skillItem = '' | |
function addToChat(message, color) | |
color = color or 207 | |
windower.add_to_chat(color, message) | |
end | |
function arrayHas(array, value) | |
for index, key in ipairs(array) do | |
if (key == value) then | |
return true | |
end | |
end | |
return false | |
end | |
function startSkillup() | |
addToChat(' ') | |
addToChat('Starting Skillup') | |
isSkilling = true; | |
end | |
function stopSkillup() | |
addToChat(' ') | |
addToChat('Finished Skillup') | |
isSkilling = false | |
end | |
function setItem(item) | |
skillItem = item | |
end | |
function mainLoop() | |
if windower.ffxi.get_player().status == 0 then | |
useItem(skillItem) | |
end | |
if isSkilling then | |
mainLoop:schedule(2.5) | |
end | |
end | |
function useItem(item) | |
windower.send_command(string.format('input /item "%s" <me>', item)) | |
end | |
windower.register_event('load', function () | |
addToChat('Welcome!') | |
addToChat(' "//skillup start <item name>" Start using an item', 89) | |
addToChat(' "//skillup stop" to stop', 89) | |
end) | |
windower.register_event('addon command', function(command, ...) | |
command = command and command:lower() or 'help' | |
addToChat('command: ' .. command, 89) | |
local args = T{...}:map(string.lower) | |
local itemName = table.concat(args," ") | |
setItem(itemName) | |
if arrayHas({'start', 'go', 'on'}, command) then | |
startSkillup() | |
mainLoop() | |
elseif arrayHas({'stop', 'no', 'off'}, command) then | |
stopSkillup() | |
end | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does this still work? Do you use it as a script or do you load it as a plugin?
Thanks!