From 401fb7613024dc451648ed7a4d691693033b31c0 Mon Sep 17 00:00:00 2001 From: Krizz Date: Fri, 10 Apr 2020 09:38:09 -0400 Subject: [PATCH 1/7] Salvage2 Update I have restructured parts of Salvage2 so that it uses the new Texts for boxes, and it now works again. --- addons/salvage2/data/settings.xml | 55 ++++++++++++++++++--- addons/salvage2/salvage2.lua | 80 ++++++++++++++++--------------- 2 files changed, 91 insertions(+), 44 deletions(-) diff --git a/addons/salvage2/data/settings.xml b/addons/salvage2/data/settings.xml index 08ba0f7f9..725855ecb 100644 --- a/addons/salvage2/data/settings.xml +++ b/addons/salvage2/data/settings.xml @@ -1,7 +1,50 @@ - + - - 1000 - 250 - - \ No newline at end of file + + + 200 + 30 + 30 + 30 + true + + + 200 + 200 + 200 + 200 + + + false + false + true + false + false + + 0 + + 1000 + 150 + + 900 + 250 + + 255 + 255 + Arial + + + + 255 + 255 + 12 + + 255 + 0 + 0 + 0 + 0 + + + + diff --git a/addons/salvage2/salvage2.lua b/addons/salvage2/salvage2.lua index 4e8fb289a..a42ed78d0 100644 --- a/addons/salvage2/salvage2.lua +++ b/addons/salvage2/salvage2.lua @@ -30,31 +30,33 @@ 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 = {...}; @@ -75,9 +77,9 @@ local params = {...}; windower.text.set_location('salvage_box2', posx, posy) end elseif params[1]:lower() == "hide" then - windower.text.set_visibility('salvage_box2', false) + salvage_box2:hide() elseif params[1]:lower() == "show" then - windower.text.set_visibility('salvage_box2', true) + salvage_box2:show() elseif params[1]:lower() == "timer" then if params[2] == "start" then windower.send_command('timers c Remaining 6000 up') @@ -88,11 +90,11 @@ local params = {...}; if params[2]:lower() == "start" then windower.send_command('timers c Remaining 6000 up') settings_create() - windower.text.set_visibility('salvage_box2', true) + salvage_box2:show() initialize() elseif params[2]:lower() == "stop" then windower.send_command('timers d Remaining') - windower.text.set_visibility('salvage_box2', false) + salvage_box2:hide() end elseif params[1]:lower() == "remove" then for i=1, #pathos_short do @@ -109,29 +111,37 @@ windower.register_event('login', function(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) + salvage_box2:show() else windower.send_command('timers d Remaining') settings_create() initialize() - windower.text.set_visibility('salvage_box2', false) + 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') - + original = original:strip_format() + local pathos, name = original:match('(.*) removed for (%w+)') if pathos ~= nil then + --print('Pathos found '..pathos) 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 @@ -153,15 +163,9 @@ function initialize() 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) + salvage_box2:text(pathos_remain) if pathos_remain == (" Pathos Remaining: \n ") then - windower.text.set_visibility('salvage_box2',false) + salvage_box2:hide() end end From 4554c09b124c0de841855f8c15d0008d69da8b90 Mon Sep 17 00:00:00 2001 From: Krizz Date: Fri, 10 Apr 2020 09:45:32 -0400 Subject: [PATCH 2/7] DynamisHelper Update Change textbox method to use Texts, and made other structure adjustments. --- addons/dynamishelper/data/settings.xml | 108 +++++++++-- addons/dynamishelper/dynamishelper.lua | 238 ++++++++++++++----------- 2 files changed, 233 insertions(+), 113 deletions(-) diff --git a/addons/dynamishelper/data/settings.xml b/addons/dynamishelper/data/settings.xml index dbd5ac88c..df24557d4 100644 --- a/addons/dynamishelper/data/settings.xml +++ b/addons/dynamishelper/data/settings.xml @@ -1,12 +1,100 @@ - + - - on - off - 1000 - 250 - off - 900 - 250 - + + + on + on + on + + + + 200 + 30 + 30 + 30 + true + + + 200 + 200 + 200 + 200 + + + false + false + true + false + false + + 0 + + 1000 + 150 + + + 255 + 255 + Arial + + + + 255 + 255 + 12 + + 255 + 0 + 0 + 0 + 0 + + + + + + 200 + 30 + 30 + 30 + true + + + 200 + 200 + 200 + 200 + + + false + false + true + false + false + + 0 + + 1000 + 250 + + + 255 + 255 + Arial + + + + 255 + 255 + 12 + + 255 + 0 + 0 + 0 + 0 + + + + diff --git a/addons/dynamishelper/dynamishelper.lua b/addons/dynamishelper/dynamishelper.lua index 3ba0c8c5a..3c7aa1548 100644 --- a/addons/dynamishelper/dynamishelper.lua +++ b/addons/dynamishelper/dynamishelper.lua @@ -36,6 +36,8 @@ _addon.version = '1.0.2.0' require('strings') require('sets') +texts = require 'texts' +require('logger') config = require('config') res = require('resources') @@ -202,23 +204,50 @@ proctype = {"ja","magic","ws","random","none"} StaggerCount = 0 current_proc = "lolidk" currentime = 0 +obtained = nil goodzone = false -timer = "off" -tracker = "off" -proc = "off" -trposx = 1000 -trposy = 250 -pposx = 800 -pposy = 250 - -settings = config.load() -timer = settings['timer'] -tracker = settings['tracker'] -trposx = settings['trposx'] -trposy = settings['trposy'] -proc = settings['proc'] -pposx = settings['pposx'] -pposy = settings['pposy'] +timer = "on" +tracker = "on" +proc = "on" +debugMode = "off" + +defaults = {} +defaults.display = {} +defaults.display.timer = "on" +defaults.display.tracker = "on" +defaults.display.proc = "on" +defaults.proc_box = {} +defaults.proc_box.pos = {} +defaults.proc_box.pos.x = 1000 +defaults.proc_box.pos.y = 200 +defaults.proc_box.color = {} +defaults.proc_box.color.alpha = 200 +defaults.proc_box.color.red = 200 +defaults.proc_box.color.green = 200 +defaults.proc_box.color.blue = 200 +defaults.proc_box.bg = {} +defaults.proc_box.bg.alpha = 200 +defaults.proc_box.bg.red = 30 +defaults.proc_box.bg.green = 30 +defaults.proc_box.bg.blue = 30 +defaults.tracker_box = {} +defaults.tracker_box.pos = {} +defaults.tracker_box.pos.x = 1000 +defaults.tracker_box.pos.y = 250 +defaults.tracker_box.color = {} +defaults.tracker_box.color.alpha = 200 +defaults.tracker_box.color.red = 200 +defaults.tracker_box.color.green = 200 +defaults.tracker_box.color.blue = 200 +defaults.tracker_box.bg = {} +defaults.tracker_box.bg.alpha = 200 +defaults.tracker_box.bg.red = 30 +defaults.tracker_box.bg.green = 30 +defaults.tracker_box.bg.blue = 30 + +settings = config.load('data\\settings.xml',defaults) +dynamis_box = texts.new(' Empty', settings.tracker_box, settings) +proc_box = texts.new(' Unknown', settings.proc_box, settings) for i=1, #Currency do Currency[Currency[i]] = 0 @@ -228,7 +257,6 @@ windower.register_event('load', 'login', function() if windower.ffxi.get_info().logged_in then player = windower.ffxi.get_player().name obtained = nil - initializebox() end end) @@ -251,60 +279,76 @@ windower.register_event('addon command',function (...) timer = params[2] print('Timer feature is '..timer) else print("Invalid timer option.") - end - elseif params[1]:lower() == "tracker" then - if params[2]:lower() == "on" then - tracker = "on" - initializebox() - windower.text.set_visibility('dynamis_box',true) - print('Tracker enabled') - elseif params[2]:lower() == "off" then - tracker = "off" - windower.text.set_visibility('dynamis_box',false) - print('Tracker disabled') - elseif params[2]:lower() == "reset" then - for i=1, #Currency do - Currency[Currency[i]] = 0 - end - obtainedf() - initializebox() - print('Tracker reset') - elseif params[2]:lower() == "pos" then - if params[3] then - trposx, trposy = tonumber(params[3]), tonumber(params[4]) - obtainedf() - initializebox() - else print("Invalid tracker option.") - end - end - elseif params[1]:lower() == "ll" then - if params[2]:lower() == "create" then - player = windower.ffxi.get_player()['name'] - io.open(windower.addon_path..'../../plugins/ll/dynamis-'..player..'.txt',"w"):write('if item is 1452, 1453, 1455, 1456, 1449, 1450 then lot'):close() - windower.send_command('ll profile dynamis-'..player..'.txt') - else print("Invalid light luggage option.") - end - elseif params[1]:lower() == "proc" then - if params[2]:lower() == "on" then - proc = params[2] - print('Proc feature enabled.') - elseif params[2]:lower() == "off" then - proc = params[2] - windower.text.set_visibility('proc_box',false) - print('Proc feature disabled.') - elseif params[2]:lower() == "pos" then - pposx, pposy = tonumber(params[3]), tonumber(params[4]) - initializeproc() - end + end + elseif params[1]:lower() == "tracker" then + if params[2]:lower() == "on" then + tracker = "on" + initializebox() + print('Tracker enabled') + elseif params[2]:lower() == "off" then + tracker = "off" + dynamis_box:hide() + print('Tracker disabled') + elseif params[2]:lower() == "reset" then + settings = config.load(trdefaults) + dynamis_box = texts.new('Nothing to show', settings) + for i=1, #Currency do + Currency[Currency[i]] = 0 + end + obtainedf() + print('Tracker reset') + elseif params[2]:lower() == "pos" then + if params[3] then + trposx, trposy = tonumber(params[3]), tonumber(params[4]) + dynamis_box:pos(posx, posy) + else print("Invalid tracker option.") + end + end + elseif params[1]:lower() == "ll" then + if params[2]:lower() == "create" then + player = windower.ffxi.get_player()['name'] + io.open(windower.addon_path..'../../plugins/ll/dynamis-'..player..'.txt',"w"):write('if item is 1452, 1453, 1455, 1456, 1449, 1450 then lot'):close() + windower.send_command('ll profile dynamis-'..player..'.txt') + else print("Invalid light luggage option.") + end + elseif params[1]:lower() == "proc" then + if params[2]:lower() == "on" then + proc = params[2] + print('Proc feature enabled.') + elseif params[2]:lower() == "off" then + proc = params[2] + proc_box:hide() + print('Proc feature disabled.') + elseif params[2]:lower() == "pos" then + pposx, pposy = tonumber(params[3]), tonumber(params[4]) + proc_box:pos(posx, posy) + end + elseif params[1]:lower() == "debug" then + if params[2]:lower() == "on" then + debugMode = "on" + goodzone = true + proc = "on" + tracker = "on" + mob = "Test" + obtained = "1" + setproc() + initializebox() + elseif params[2]:lower() == "off" then + debugMode = "off" + goodzone = ProcZones:contains(windower.ffxi.get_info().zone) + initializeproc() + initializebox() + end + end end - end end) windower.register_event('incoming text',function (original, new, color) -- print('event_incoming_text function') + original = original:strip_format() if timer == 'on' then - a,b,fiend = string.find(original,"%w+'s attack staggers the (%w+)%!") + local fiend = original:match("%w+'s attack staggers the (%w+)%!") if fiend == 'fiend' then StaggerCount = StaggerCount + 1 windower.send_command('timers c '..StaggerCount..' 30 down') @@ -312,18 +356,19 @@ windower.register_event('incoming text',function (original, new, color) end end if tracker == 'on' then - a,b,item = string.find(original,"%w+ obtains an? ..(%w+ %w+ %w+ %w+)..\46") - if item == nil then - a,b,item = string.find(original,"%w+ obtains an? ..(%w+ %w+ %w+)..\46") - if item == nil then - a,b,item = string.find(original,"%w+ obtains an? ..(%w+%-%w+ %w+)..\46") - if item == nil then - a,b,item = string.find(original,"%w+ obtains an? ..(%w+ %w+)..\46") - end - end - end --- a,b,item = string.find(original,"%w+ obtains an? ..(.*)..\46") - if item ~= nil then + if debugMode == "on" then print("Starting tracker function") end + local item = original:match("%w+ obtains an? (%w+ %w+ %w+ %w+).") + if item == nil then + item = original:match("%w+ obtains an? (%w+ %w+ %w+).") + end + if item == nil then + item = original:match("%w+ obtains an? (%w+%-%w+ %w+).") + end + if item == nil then + item = original:match("%w+ obtains an? (%w+ %w+).") + end + if item then + if debugMode == "on" then print(item) end item = item:lower() for i=1, #Currency do if item == Currency[i]:lower() then @@ -351,33 +396,28 @@ end windower.register_event('zone change', function(id) goodzone = ProcZones:contains(id) + if debugMode == "on" then goodzone = true end if not goodzone then - windower.text.set_visibility('proc_box', false) + proc_box:hide() + dynamis_box:hide() end end) function initializebox() if obtained ~= nil and tracker == "on" then - windower.text.create('dynamis_box') - windower.text.set_bg_color('dynamis_box',200,30,30,30) - windower.text.set_color('dynamis_box',255,200,200,200) - windower.text.set_location('dynamis_box',trposx,trposy) - windower.text.set_visibility('dynamis_box',true) - windower.text.set_bg_visibility('dynamis_box',true) - windower.text.set_font('dynamis_box','Arial',12) - windower.text.set_text('dynamis_box',obtained); + dynamis_box:show() + dynamis_box:text(obtained) end + end windower.register_event('target change', function(targ_id) - --goodzone = ProcZones:contains(windower.ffxi.get_info().zone) + goodzone = ProcZones:contains(windower.ffxi.get_info().zone) + if debugMode == "on" then goodzone = true end if goodzone and proc == 'on' and targ_id ~= 0 then mob = windower.ffxi.get_mob_by_index(targ_id)['name'] setproc() end - - --print(ProcZones:contains(windower.ffxi.get_info().zone)) - end) function setproc() @@ -409,23 +449,15 @@ function setproc() end function initializeproc() --- print('initializeproc function') - windower.text.create('proc_box') - windower.text.set_bg_color('proc_box',200,30,30,30) - windower.text.set_color('proc_box',255,200,200,200) - windower.text.set_location('proc_box',pposx,pposy) - if proc == 'on' then - windower.text.set_visibility('proc_box', true) - end - windower.text.set_bg_visibility('proc_box',1) - windower.text.set_font('proc_box','Arial',12) - windower.text.set_text('proc_box',' Current proc for \n '..mob..'\n is '..current_proc); - if proc == "off" then - windower.text.set_visibility('proc_box', false) + if goodzone == true and proc == 'on' then + proc_box:show() + proc_box:text(' Current proc for \n '..mob..'\n is '..current_proc) + else + proc_box:hide() end end windower.register_event('unload',function () windower.text.delete('dynamis_box') windower.text.delete('proc_box') -end) +end) \ No newline at end of file From ed30313710e724c6ce4a2ef9306f852f5d5d7e01 Mon Sep 17 00:00:00 2001 From: Krizz Date: Fri, 10 Apr 2020 10:03:10 -0400 Subject: [PATCH 3/7] Revert "DynamisHelper Update" This reverts commit 4554c09b124c0de841855f8c15d0008d69da8b90. --- addons/dynamishelper/data/settings.xml | 108 ++--------- addons/dynamishelper/dynamishelper.lua | 238 +++++++++++-------------- 2 files changed, 113 insertions(+), 233 deletions(-) diff --git a/addons/dynamishelper/data/settings.xml b/addons/dynamishelper/data/settings.xml index df24557d4..dbd5ac88c 100644 --- a/addons/dynamishelper/data/settings.xml +++ b/addons/dynamishelper/data/settings.xml @@ -1,100 +1,12 @@ - + - - - on - on - on - - - - 200 - 30 - 30 - 30 - true - - - 200 - 200 - 200 - 200 - - - false - false - true - false - false - - 0 - - 1000 - 150 - - - 255 - 255 - Arial - - - - 255 - 255 - 12 - - 255 - 0 - 0 - 0 - 0 - - - - - - 200 - 30 - 30 - 30 - true - - - 200 - 200 - 200 - 200 - - - false - false - true - false - false - - 0 - - 1000 - 250 - - - 255 - 255 - Arial - - - - 255 - 255 - 12 - - 255 - 0 - 0 - 0 - 0 - - - - + + on + off + 1000 + 250 + off + 900 + 250 + diff --git a/addons/dynamishelper/dynamishelper.lua b/addons/dynamishelper/dynamishelper.lua index 3c7aa1548..3ba0c8c5a 100644 --- a/addons/dynamishelper/dynamishelper.lua +++ b/addons/dynamishelper/dynamishelper.lua @@ -36,8 +36,6 @@ _addon.version = '1.0.2.0' require('strings') require('sets') -texts = require 'texts' -require('logger') config = require('config') res = require('resources') @@ -204,50 +202,23 @@ proctype = {"ja","magic","ws","random","none"} StaggerCount = 0 current_proc = "lolidk" currentime = 0 -obtained = nil goodzone = false -timer = "on" -tracker = "on" -proc = "on" -debugMode = "off" - -defaults = {} -defaults.display = {} -defaults.display.timer = "on" -defaults.display.tracker = "on" -defaults.display.proc = "on" -defaults.proc_box = {} -defaults.proc_box.pos = {} -defaults.proc_box.pos.x = 1000 -defaults.proc_box.pos.y = 200 -defaults.proc_box.color = {} -defaults.proc_box.color.alpha = 200 -defaults.proc_box.color.red = 200 -defaults.proc_box.color.green = 200 -defaults.proc_box.color.blue = 200 -defaults.proc_box.bg = {} -defaults.proc_box.bg.alpha = 200 -defaults.proc_box.bg.red = 30 -defaults.proc_box.bg.green = 30 -defaults.proc_box.bg.blue = 30 -defaults.tracker_box = {} -defaults.tracker_box.pos = {} -defaults.tracker_box.pos.x = 1000 -defaults.tracker_box.pos.y = 250 -defaults.tracker_box.color = {} -defaults.tracker_box.color.alpha = 200 -defaults.tracker_box.color.red = 200 -defaults.tracker_box.color.green = 200 -defaults.tracker_box.color.blue = 200 -defaults.tracker_box.bg = {} -defaults.tracker_box.bg.alpha = 200 -defaults.tracker_box.bg.red = 30 -defaults.tracker_box.bg.green = 30 -defaults.tracker_box.bg.blue = 30 - -settings = config.load('data\\settings.xml',defaults) -dynamis_box = texts.new(' Empty', settings.tracker_box, settings) -proc_box = texts.new(' Unknown', settings.proc_box, settings) +timer = "off" +tracker = "off" +proc = "off" +trposx = 1000 +trposy = 250 +pposx = 800 +pposy = 250 + +settings = config.load() +timer = settings['timer'] +tracker = settings['tracker'] +trposx = settings['trposx'] +trposy = settings['trposy'] +proc = settings['proc'] +pposx = settings['pposx'] +pposy = settings['pposy'] for i=1, #Currency do Currency[Currency[i]] = 0 @@ -257,6 +228,7 @@ windower.register_event('load', 'login', function() if windower.ffxi.get_info().logged_in then player = windower.ffxi.get_player().name obtained = nil + initializebox() end end) @@ -279,76 +251,60 @@ windower.register_event('addon command',function (...) timer = params[2] print('Timer feature is '..timer) else print("Invalid timer option.") - end - elseif params[1]:lower() == "tracker" then - if params[2]:lower() == "on" then - tracker = "on" - initializebox() - print('Tracker enabled') - elseif params[2]:lower() == "off" then - tracker = "off" - dynamis_box:hide() - print('Tracker disabled') - elseif params[2]:lower() == "reset" then - settings = config.load(trdefaults) - dynamis_box = texts.new('Nothing to show', settings) - for i=1, #Currency do - Currency[Currency[i]] = 0 - end - obtainedf() - print('Tracker reset') - elseif params[2]:lower() == "pos" then - if params[3] then - trposx, trposy = tonumber(params[3]), tonumber(params[4]) - dynamis_box:pos(posx, posy) - else print("Invalid tracker option.") - end - end - elseif params[1]:lower() == "ll" then - if params[2]:lower() == "create" then - player = windower.ffxi.get_player()['name'] - io.open(windower.addon_path..'../../plugins/ll/dynamis-'..player..'.txt',"w"):write('if item is 1452, 1453, 1455, 1456, 1449, 1450 then lot'):close() - windower.send_command('ll profile dynamis-'..player..'.txt') - else print("Invalid light luggage option.") - end - elseif params[1]:lower() == "proc" then - if params[2]:lower() == "on" then - proc = params[2] - print('Proc feature enabled.') - elseif params[2]:lower() == "off" then - proc = params[2] - proc_box:hide() - print('Proc feature disabled.') - elseif params[2]:lower() == "pos" then - pposx, pposy = tonumber(params[3]), tonumber(params[4]) - proc_box:pos(posx, posy) - end - elseif params[1]:lower() == "debug" then - if params[2]:lower() == "on" then - debugMode = "on" - goodzone = true - proc = "on" - tracker = "on" - mob = "Test" - obtained = "1" - setproc() - initializebox() - elseif params[2]:lower() == "off" then - debugMode = "off" - goodzone = ProcZones:contains(windower.ffxi.get_info().zone) - initializeproc() - initializebox() - end - end + end + elseif params[1]:lower() == "tracker" then + if params[2]:lower() == "on" then + tracker = "on" + initializebox() + windower.text.set_visibility('dynamis_box',true) + print('Tracker enabled') + elseif params[2]:lower() == "off" then + tracker = "off" + windower.text.set_visibility('dynamis_box',false) + print('Tracker disabled') + elseif params[2]:lower() == "reset" then + for i=1, #Currency do + Currency[Currency[i]] = 0 + end + obtainedf() + initializebox() + print('Tracker reset') + elseif params[2]:lower() == "pos" then + if params[3] then + trposx, trposy = tonumber(params[3]), tonumber(params[4]) + obtainedf() + initializebox() + else print("Invalid tracker option.") + end + end + elseif params[1]:lower() == "ll" then + if params[2]:lower() == "create" then + player = windower.ffxi.get_player()['name'] + io.open(windower.addon_path..'../../plugins/ll/dynamis-'..player..'.txt',"w"):write('if item is 1452, 1453, 1455, 1456, 1449, 1450 then lot'):close() + windower.send_command('ll profile dynamis-'..player..'.txt') + else print("Invalid light luggage option.") + end + elseif params[1]:lower() == "proc" then + if params[2]:lower() == "on" then + proc = params[2] + print('Proc feature enabled.') + elseif params[2]:lower() == "off" then + proc = params[2] + windower.text.set_visibility('proc_box',false) + print('Proc feature disabled.') + elseif params[2]:lower() == "pos" then + pposx, pposy = tonumber(params[3]), tonumber(params[4]) + initializeproc() + end end + end end) windower.register_event('incoming text',function (original, new, color) -- print('event_incoming_text function') - original = original:strip_format() if timer == 'on' then - local fiend = original:match("%w+'s attack staggers the (%w+)%!") + a,b,fiend = string.find(original,"%w+'s attack staggers the (%w+)%!") if fiend == 'fiend' then StaggerCount = StaggerCount + 1 windower.send_command('timers c '..StaggerCount..' 30 down') @@ -356,19 +312,18 @@ windower.register_event('incoming text',function (original, new, color) end end if tracker == 'on' then - if debugMode == "on" then print("Starting tracker function") end - local item = original:match("%w+ obtains an? (%w+ %w+ %w+ %w+).") - if item == nil then - item = original:match("%w+ obtains an? (%w+ %w+ %w+).") - end - if item == nil then - item = original:match("%w+ obtains an? (%w+%-%w+ %w+).") - end - if item == nil then - item = original:match("%w+ obtains an? (%w+ %w+).") - end - if item then - if debugMode == "on" then print(item) end + a,b,item = string.find(original,"%w+ obtains an? ..(%w+ %w+ %w+ %w+)..\46") + if item == nil then + a,b,item = string.find(original,"%w+ obtains an? ..(%w+ %w+ %w+)..\46") + if item == nil then + a,b,item = string.find(original,"%w+ obtains an? ..(%w+%-%w+ %w+)..\46") + if item == nil then + a,b,item = string.find(original,"%w+ obtains an? ..(%w+ %w+)..\46") + end + end + end +-- a,b,item = string.find(original,"%w+ obtains an? ..(.*)..\46") + if item ~= nil then item = item:lower() for i=1, #Currency do if item == Currency[i]:lower() then @@ -396,28 +351,33 @@ end windower.register_event('zone change', function(id) goodzone = ProcZones:contains(id) - if debugMode == "on" then goodzone = true end if not goodzone then - proc_box:hide() - dynamis_box:hide() + windower.text.set_visibility('proc_box', false) end end) function initializebox() if obtained ~= nil and tracker == "on" then - dynamis_box:show() - dynamis_box:text(obtained) + windower.text.create('dynamis_box') + windower.text.set_bg_color('dynamis_box',200,30,30,30) + windower.text.set_color('dynamis_box',255,200,200,200) + windower.text.set_location('dynamis_box',trposx,trposy) + windower.text.set_visibility('dynamis_box',true) + windower.text.set_bg_visibility('dynamis_box',true) + windower.text.set_font('dynamis_box','Arial',12) + windower.text.set_text('dynamis_box',obtained); end - end windower.register_event('target change', function(targ_id) - goodzone = ProcZones:contains(windower.ffxi.get_info().zone) - if debugMode == "on" then goodzone = true end + --goodzone = ProcZones:contains(windower.ffxi.get_info().zone) if goodzone and proc == 'on' and targ_id ~= 0 then mob = windower.ffxi.get_mob_by_index(targ_id)['name'] setproc() end + + --print(ProcZones:contains(windower.ffxi.get_info().zone)) + end) function setproc() @@ -449,15 +409,23 @@ function setproc() end function initializeproc() - if goodzone == true and proc == 'on' then - proc_box:show() - proc_box:text(' Current proc for \n '..mob..'\n is '..current_proc) - else - proc_box:hide() +-- print('initializeproc function') + windower.text.create('proc_box') + windower.text.set_bg_color('proc_box',200,30,30,30) + windower.text.set_color('proc_box',255,200,200,200) + windower.text.set_location('proc_box',pposx,pposy) + if proc == 'on' then + windower.text.set_visibility('proc_box', true) + end + windower.text.set_bg_visibility('proc_box',1) + windower.text.set_font('proc_box','Arial',12) + windower.text.set_text('proc_box',' Current proc for \n '..mob..'\n is '..current_proc); + if proc == "off" then + windower.text.set_visibility('proc_box', false) end end windower.register_event('unload',function () windower.text.delete('dynamis_box') windower.text.delete('proc_box') -end) \ No newline at end of file +end) From 68d0cdfd3b34a51248f5ccfae022c11744d4c596 Mon Sep 17 00:00:00 2001 From: Krizz Date: Fri, 10 Apr 2020 11:45:02 -0400 Subject: [PATCH 4/7] Delete settings.xml --- addons/salvage2/data/settings.xml | 50 ------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 addons/salvage2/data/settings.xml diff --git a/addons/salvage2/data/settings.xml b/addons/salvage2/data/settings.xml deleted file mode 100644 index 725855ecb..000000000 --- a/addons/salvage2/data/settings.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - 200 - 30 - 30 - 30 - true - - - 200 - 200 - 200 - 200 - - - false - false - true - false - false - - 0 - - 1000 - 150 - - 900 - 250 - - 255 - 255 - Arial - - - - 255 - 255 - 12 - - 255 - 0 - 0 - 0 - 0 - - - - From 1810b61fc81c6484ace53729645dbeafd26d5c45 Mon Sep 17 00:00:00 2001 From: Krizz Date: Fri, 10 Apr 2020 11:45:47 -0400 Subject: [PATCH 5/7] Delete settings.xml --- addons/salvage2/data/settings.xml | 50 ------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 addons/salvage2/data/settings.xml diff --git a/addons/salvage2/data/settings.xml b/addons/salvage2/data/settings.xml deleted file mode 100644 index 725855ecb..000000000 --- a/addons/salvage2/data/settings.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - 200 - 30 - 30 - 30 - true - - - 200 - 200 - 200 - 200 - - - false - false - true - false - false - - 0 - - 1000 - 150 - - 900 - 250 - - 255 - 255 - Arial - - - - 255 - 255 - 12 - - 255 - 0 - 0 - 0 - 0 - - - - From cab7299ea31b0abc4febc196bf3781d87d807faa Mon Sep 17 00:00:00 2001 From: Krizz Date: Fri, 10 Apr 2020 11:52:34 -0400 Subject: [PATCH 6/7] Salvage2 Tabs to Spaces As requested --- addons/salvage2/salvage2.lua | 188 +++++++++++++++++------------------ 1 file changed, 94 insertions(+), 94 deletions(-) diff --git a/addons/salvage2/salvage2.lua b/addons/salvage2/salvage2.lua index a42ed78d0..5d525ae74 100644 --- a/addons/salvage2/salvage2.lua +++ b/addons/salvage2/salvage2.lua @@ -60,116 +60,116 @@ 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 : Positions the list') - print('s2 [hide/show] : Hides the box') - print('s2 timer [start/stop] : Starts or stops the zone timer') - print('s2 remove : 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 + 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 : Positions the list') + print('s2 [hide/show] : Hides the box') + print('s2 timer [start/stop] : Starts or stops the zone timer') + print('s2 remove : 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) 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 + -- 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() - salvage_box2:show() - else - windower.send_command('timers d Remaining') - settings_create() - initialize() - salvage_box2:hide() - 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) - 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 + 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 - salvage_box2:text(pathos_remain) - if pathos_remain == (" Pathos Remaining: \n ") then - salvage_box2:hide() - 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 ) From acd8f0d1a3e599e001ebdc6e71fa5eba979cc0cc Mon Sep 17 00:00:00 2001 From: Krizz Date: Tue, 14 Apr 2020 20:13:26 -0400 Subject: [PATCH 7/7] Salvage2 and THTracker parenthesis and tabs Parenthesis and tabs --- addons/salvage2/salvage2.lua | 2 +- addons/thtracker/thtracker.lua | 50 +++++++++++++++++----------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/addons/salvage2/salvage2.lua b/addons/salvage2/salvage2.lua index 5d525ae74..1d9eb7cde 100644 --- a/addons/salvage2/salvage2.lua +++ b/addons/salvage2/salvage2.lua @@ -30,7 +30,7 @@ require('tables') require('strings') require('maths') require('logger') -texts = require 'texts' +texts = require ('texts') config = require('config') ----------------------------- diff --git a/addons/thtracker/thtracker.lua b/addons/thtracker/thtracker.lua index 1a045ccd1..e3be84364 100644 --- a/addons/thtracker/thtracker.lua +++ b/addons/thtracker/thtracker.lua @@ -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 = {} @@ -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) \ No newline at end of file