Skip to content
7 changes: 0 additions & 7 deletions addons/salvage2/data/settings.xml

This file was deleted.

230 changes: 117 additions & 113 deletions addons/salvage2/salvage2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,142 +30,146 @@ require('tables')
require('strings')
require('maths')
require('logger')
texts = require ('texts')
config = require('config')
-----------------------------

settingtab = config.load()

--variables
posx = 1000
posy = 250
if settingtab['posx'] ~= nil then
posx = settingtab['posx']
posy = settingtab['posy']
end
pathos_ident = {'Main Weapon/Sub-Weapon restriction', 'Ranged Weapon/Ammo restriction', 'Head/Neck equipment restriction', 'Body equipment restriction', 'Hand equipment restriction', 'Earrings/Rings restriction', 'Back/Waist equipment restriction', 'Leg/Foot equipment restriction', 'Support Job restriction', 'Job Abilities restriction', 'Spellcasting restriction', 'Max HP Down', 'Max MP Down', 'STR Down', 'DEX Down', 'AGI Down', 'MND Down', 'INT Down', 'CHR Down', 'VIT Down'}
pathos_short = {'Weapon', 'Ranged', 'Head/Neck', 'Body', 'Hand', 'Earrings/Rings', 'Back/Waist', 'Leg/Foot', 'Support Job', 'Job Abilities', 'Spellcasting', 'Max HP', 'Max MP', 'STR', 'DEX', 'AGI', 'MND', 'INT', 'CHR', 'VIT'}
pathos_ident = {'Main Weapon/Sub-Weapon restriction', 'Ranged Weapon/Ammo restriction', 'Head/Neck equipment restriction', 'Body equipment restriction', 'Hand equipment restriction', 'Earrings/Rings restriction', 'Back/Waist equipment restriction', 'Leg/Foot equipment restriction', 'Support Job restriction', 'Job Abilities restriction', 'Spellcasting restriction', 'Max HP Down', 'Max MP Down', 'STR Down', 'DEX Down', 'AGI Down', 'MND Down', 'INT Down', 'CHR Down', 'VIT Down'}
pathos_short = {'Weapon', 'Ranged', 'Head/Neck', 'Body', 'Hand', 'Earrings/Rings', 'Back/Waist', 'Leg/Foot', 'Support Job', 'Job Abilities', 'Spellcasting', 'MaxHP', 'MaxMP', 'STR', 'DEX', 'AGI', 'MND', 'INT', 'CHR', 'VIT'}
salvage_zones = S{73, 74, 75, 76}

function settings_create()
-- get player's name
player = windower.ffxi.get_player()['name']
-- set all pathos as needed
for i=1, #pathos_ident do
if pathos_ident[i] ~= nil then
pathos_ident[pathos_ident[i]] = 1
end
end
end
defaults = {}
defaults.pos = {}
defaults.pos.x = 1000
defaults.pos.y = 150
defaults.color = {}
defaults.color.alpha = 200
defaults.color.red = 200
defaults.color.green = 200
defaults.color.blue = 200
defaults.bg = {}
defaults.bg.alpha = 200
defaults.bg.red = 30
defaults.bg.green = 30
defaults.bg.blue = 30

settings = config.load(defaults)
salvage_box2 = texts.new('No pathos', settings)

windower.register_event('addon command',function (...)
local params = {...};
if #params < 1 then
return
end
if params[1] then
if params[1]:lower() == "help" then
print('Salvage2 available commands:')
print('s2 help : Shows this help message')
print('s2 pos <x> <y> : Positions the list')
print('s2 [hide/show] : Hides the box')
print('s2 timer [start/stop] : Starts or stops the zone timer')
print('s2 remove <pathos> : Removes the pathos from the remaining list')
elseif params[1]:lower() == "pos" then
if params[3] then
local posx, posy = tonumber(params[2]), tonumber(params[3])
windower.text.set_location('salvage_box2', posx, posy)
end
elseif params[1]:lower() == "hide" then
windower.text.set_visibility('salvage_box2', false)
elseif params[1]:lower() == "show" then
windower.text.set_visibility('salvage_box2', true)
elseif params[1]:lower() == "timer" then
if params[2] == "start" then
windower.send_command('timers c Remaining 6000 up')
elseif params[2] == "stop" then
windower.send_command('timers d Remaining')
end
elseif params[1]:lower() == "debug" then
if params[2]:lower() == "start" then
windower.send_command('timers c Remaining 6000 up')
settings_create()
windower.text.set_visibility('salvage_box2', true)
initialize()
elseif params[2]:lower() == "stop" then
windower.send_command('timers d Remaining')
windower.text.set_visibility('salvage_box2', false)
end
elseif params[1]:lower() == "remove" then
for i=1, #pathos_short do
if pathos_short[i]:lower() == params[2]:lower() then
pathos_ident[pathos_ident[i]] = 0
initialize()
end
end
end
end
if #params < 1 then
return
end
if params[1] then
if params[1]:lower() == "help" then
print('Salvage2 available commands:')
print('s2 help : Shows this help message')
print('s2 pos <x> <y> : Positions the list')
print('s2 [hide/show] : Hides the box')
print('s2 timer [start/stop] : Starts or stops the zone timer')
print('s2 remove <pathos> : Removes the pathos from the remaining list')
elseif params[1]:lower() == "pos" then
if params[3] then
local posx, posy = tonumber(params[2]), tonumber(params[3])
windower.text.set_location('salvage_box2', posx, posy)
end
elseif params[1]:lower() == "hide" then
salvage_box2:hide()
elseif params[1]:lower() == "show" then
salvage_box2:show()
elseif params[1]:lower() == "timer" then
if params[2] == "start" then
windower.send_command('timers c Remaining 6000 up')
elseif params[2] == "stop" then
windower.send_command('timers d Remaining')
end
elseif params[1]:lower() == "debug" then
if params[2]:lower() == "start" then
windower.send_command('timers c Remaining 6000 up')
settings_create()
salvage_box2:show()
initialize()
elseif params[2]:lower() == "stop" then
windower.send_command('timers d Remaining')
salvage_box2:hide()
end
elseif params[1]:lower() == "remove" then
for i=1, #pathos_short do
if pathos_short[i]:lower() == params[2]:lower() then
pathos_ident[pathos_ident[i]] = 0
initialize()
end
end
end
end
end)

windower.register_event('login', function(name)
player = name
player = name
end)

salvage_zones = S{73, 74, 75, 76}
function settings_create()
-- get player's name
player = windower.ffxi.get_player()['name']
-- set all pathos as needed
for i=1, #pathos_ident do
if pathos_ident[i] ~= nil then
pathos_ident[pathos_ident[i]] = 1
end
end
end

windower.register_event('zone change', function(id)
if salvage_zones:contains(id) then
windower.send_command('timers c Remaining 6000 up')
settings_create()
initialize()
windower.text.set_visibility('salvage_box2', true)
else
windower.send_command('timers d Remaining')
settings_create()
initialize()
windower.text.set_visibility('salvage_box2', false)
end
if salvage_zones:contains(id) then
windower.send_command('timers c Remaining 6000 up')
settings_create()
initialize()
salvage_box2:show()
else
windower.send_command('timers d Remaining')
settings_create()
initialize()
salvage_box2:hide()
end
end)

windower.register_event('incoming text',function (original, new, color)

a,b,pathos,name = string.find(original,'..(.*) removed for (%w+)\46')

if pathos ~= nil then
if name == player then
-- Insert code to remove pathos from list
for i=1, #pathos_ident do
if pathos_ident[i]:lower() == pathos:lower() then
if pathos_ident[pathos_ident[i]] == 1 then
pathos_ident[pathos_ident[i]] = 0
initialize()
end
end
end
end
return new, color
end
original = original:strip_format()
local pathos, name = original:match('(.*) removed for (%w+)')
if pathos ~= nil then
--print('Pathos found '..pathos)
if name == player then
for i=1, #pathos_ident do
if pathos_ident[i]:lower() == pathos:lower() then
if pathos_ident[pathos_ident[i]] == 1 then
pathos_ident[pathos_ident[i]] = 0
initialize()
end
end
end
end
return new, color
end
end)

function initialize()
pathos_remain = (" Pathos Remaining: \n ")
for i=1, #pathos_ident do
if pathos_ident[pathos_ident[i]] == 1 then
item = pathos_short[i]
pathos_remain = (pathos_remain..item..' \n ')
end
end
windower.text.create('salvage_box2')
windower.text.set_bg_color('salvage_box2',200,30,30,30)
windower.text.set_color('salvage_box2',255,200,200,200)
windower.text.set_location('salvage_box2',posx,posy)
windower.text.set_bg_visibility('salvage_box2',1)
windower.text.set_font('salvage_box2','Arial',12)
windower.text.set_text('salvage_box2', pathos_remain)
if pathos_remain == (" Pathos Remaining: \n ") then
windower.text.set_visibility('salvage_box2',false)
end
pathos_remain = (" Pathos Remaining: \n ")
for i=1, #pathos_ident do
if pathos_ident[pathos_ident[i]] == 1 then
item = pathos_short[i]
pathos_remain = (pathos_remain..item..' \n ')
end
end
salvage_box2:text(pathos_remain)
if pathos_remain == (" Pathos Remaining: \n ") then
salvage_box2:hide()
end
end

windower.register_event('unload',function ()
windower.text.delete('salvage_box2')
windower.send_command('timers d Remaining')
windower.text.delete('salvage_box2')
windower.send_command('timers d Remaining')
end )
50 changes: 25 additions & 25 deletions addons/thtracker/thtracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ _addon.author = 'Krizz'
_addon.version = 1.1
_addon.commands = {'thtracker', 'th'}

config = require 'config'
texts = require 'texts'
config = require ('config')
texts = require ('texts')
require('logger')

defaults = {}
Expand Down Expand Up @@ -75,32 +75,32 @@ windower.register_event('addon command', function(command, ...)
end)

windower.register_event('incoming text', function(original, new, color)
original = original:strip_format()
local name, count = original:match('Additional effect: Treasure Hunter effectiveness against[%s%a%a%a]- (.*) increases to (%d+).')
if name and count then
name = name.gsub(name, "the ", "")
mob = name
th:text(' '..name..'\n TH: '..count);
th:show()
end
original = original:strip_format()
local name, count = original:match('Additional effect: Treasure Hunter effectiveness against[%s%a%a%a]- (.*) increases to (%d+).')
if name and count then
name = name.gsub(name, "the ", "")
mob = name
th:text(' '..name..'\n TH: '..count);
th:show()
end

local deadmob = original:match('%w+ defeats[%s%a%a%a]- (.*).')
if deadmob then
deadmob = deadmob.gsub(deadmob, "the ", "")
end
if deadmob == mob then
th:text('No current mob')
th:hide()
mob = nil
end
local deadmob = original:match('%w+ defeats[%s%a%a%a]- (.*).')
if deadmob then
deadmob = deadmob.gsub(deadmob, "the ", "")
end
if deadmob == mob then
th:text('No current mob')
th:hide()
mob = nil
end

end)

windower.register_event('zone change', function()
th:text('No current mob')
th:hide()
th:text('No current mob')
th:hide()
end)