From 942a030afd348ab2e02eac8054b43e3c3a72ea48 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 15 Nov 2021 13:53:59 +0800 Subject: *rename --- .../Libraries/lua-addons/addons/ohShi/Readme.md | 39 +++ .../lua-addons/addons/ohShi/data/settings.xml | 42 ++++ .../lua-addons/addons/ohShi/data/warning.png | Bin 0 -> 13657 bytes .../lua-addons/addons/ohShi/default_settings.lua | 81 ++++++ .../lua-addons/addons/ohShi/helper_functions.lua | 146 +++++++++++ .../Libraries/lua-addons/addons/ohShi/ohShi.lua | 273 +++++++++++++++++++++ .../lua-addons/addons/ohShi/text_handling.lua | 145 +++++++++++ 7 files changed, 726 insertions(+) create mode 100644 Data/BuiltIn/Libraries/lua-addons/addons/ohShi/Readme.md create mode 100644 Data/BuiltIn/Libraries/lua-addons/addons/ohShi/data/settings.xml create mode 100644 Data/BuiltIn/Libraries/lua-addons/addons/ohShi/data/warning.png create mode 100644 Data/BuiltIn/Libraries/lua-addons/addons/ohShi/default_settings.lua create mode 100644 Data/BuiltIn/Libraries/lua-addons/addons/ohShi/helper_functions.lua create mode 100644 Data/BuiltIn/Libraries/lua-addons/addons/ohShi/ohShi.lua create mode 100644 Data/BuiltIn/Libraries/lua-addons/addons/ohShi/text_handling.lua (limited to 'Data/BuiltIn/Libraries/lua-addons/addons/ohShi') diff --git a/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/Readme.md b/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/Readme.md new file mode 100644 index 0000000..679684b --- /dev/null +++ b/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/Readme.md @@ -0,0 +1,39 @@ +**Author:** Ricky Gall +**Version:** 2.55 +**Description:** +Replacement for yarnregex for Windower 4 I made for a friend. Uses the chat log so filters must be off. At least until i figure out another way to do it. Keeps track of various event related things. Such as, VW proc messages, mob casting, mob tp moves, TH procs and cor rolls, as well as others. Digi of shiva created the icon and was the driving force behind testing/giving me the idea to do this. Digi also created the default mob list/danger list and chose the name. + +**Abbreviation:** //ohShi + +**Commands:** + 1. help - Brings up this menu. + 2. showrolls | selfrolls - Show corsair rolls in tracker | only own rolls. + 3. staggeronly - Only show voidwatch stagger notices. + 4. track(on/off) <abyssea/dangerous/legion/meebles/other/voidwatch> (name) - Begin or stop tracking (type (default: other)) of mob (name). + 5. spell/ws(on/off) <name> - Start or stop watching for <name> spell|ws. +**The following commands all correspond to the tracker:** + 6. fonttype <name> - change to (name) font + 7. fontsize <size> - change to (size) font + 8. pos <x> <y> - change boxes x/y coordinates (can click/drag as well) + 9. bgcolor <r> <g> <b> - change background color (r: red) (g: green) (b: blue) + 10. txtcolor <r> <g> <b> - change text color (r: red) (g: green) (b: blue) + 11. duration <time> - Changes the duration things stay in tracker. + 12. settings - shows current textbox settings + 13. show/hide - toggles visibility of the tracker so you can make changes. + +**Changes:** +* v2.55 + * Added vagary weakness tracking +* v2.5 + * Complete overhaul. + * Added ability to click/drag the text box + * Add selfrolls command (if this is on only your rolls will show) + * Due to the overhaul, all of your settings (except your moblist) will be reset to default. +* v2.1 + * On load/help command announce addon version +* v2.0 + * Fixed issue with nil value on ws or blue magic cast from player + * Fixed magic messages due to the spell resources being different + * Added confirmation and boxflash on settings change + * Settings file updated. moblist.xml deprecated + diff --git a/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/data/settings.xml b/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/data/settings.xml new file mode 100644 index 0000000..8baab64 --- /dev/null +++ b/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/data/settings.xml @@ -0,0 +1,42 @@ + + + + + 255 + 0 + 0 + 0 + + + Aeroga IV, Aeroja, Blizzaga IV, Blizzaja, Breakga, Death, Firaga IV, Firaja, Kaustra, Meteor, Stonega IV, Stoneja, Thundaga IV, Thundaja + Arm Cannon, Astral Flow, Ballistic Kick, Beastruction, Chainspell, Danse Macabre, Divesting Gale, Eradicator, Extreme Purgitation, Frog Chorus, Frog Song, Fulmination, Gates of Hades, Geirrothr, Gorge, Mandible Massacre, Nerve Gas, Oblivion's Mantle, Pawn's Penumbra, Raksha Stance, Rancid Reflux, Slimy Proposal, Thundris Shriek, Yama's Judgment, Zantetsuken + + 10 + + Alfard, Carabosse, Glavoid, Isgebind, Orthrus + Apademak, Provenance Watcher + Lofty, Mired, Paramount, Soaring, Veiled + Dreyruk, Goldwing, Grannus, Izyx, Melisseus, Samursk, Silagilith, Surtr, Svaha, Umagrhk + Bloodthirsty, Cerberus, Dvergr, Enraged, Hydra, Khimaira, Khrysokhimaira, Odin, Tiamat + Aello, Agathos, Akvan, Asb, Belphoebe, Bismarck, Botulus Rex, Celaeno, Cherufe, Gasha, Gaunab, Giltine, Goji, Gugalanna, Hahava, Ig-Alima, Kaggen, Kalasutrax, Kholomodumo, Mellonia, Morta, Ocythoe, Pil, Provenance Watcher, Qilin, Rukh, Sarbaz, Shah, Taweret, Uptala, Wazir + + 0 + + 400 + 300 + + false + true + false + + 255 + 255 + + Consolas + 255 + 255 + 10 + + false + + diff --git a/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/data/warning.png b/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/data/warning.png new file mode 100644 index 0000000..23c294d Binary files /dev/null and b/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/data/warning.png differ diff --git a/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/default_settings.lua b/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/default_settings.lua new file mode 100644 index 0000000..7e19ca5 --- /dev/null +++ b/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/default_settings.lua @@ -0,0 +1,81 @@ +--[[ +Copyright (c) 2013, Ricky Gall +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +]] + +--Declaring default settings +defaults = T{} +--Addon settings +defaults.staggeronly = false +defaults.showrolls = true +defaults.selfrolls = false +defaults.duration = 10 + +--Textbox settings +defaults.bg = {} +defaults.bg.alpha = 100 +defaults.bg.red = 0 +defaults.bg.blue = 0 +defaults.bg.green = 0 +defaults.pos = {} +defaults.pos.x = 400 +defaults.pos.y = 300 +defaults.text = {} +defaults.text.red = 255 +defaults.text.green = 255 +defaults.text.blue = 255 +defaults.text.font = 'Consolas' +defaults.text.size = 10 + +--Moblist defaults +defaults.moblist = T{} +defaults.moblist['voidwatch'] = S{"Qilin", "Celaeno", "Morta", "Bismarck", "Ig-Alima", "Kalasutrax", "Ocythoe", "Gaunab", "Hahava", "Cherufe", "Botulus Rex", "Taweret", "Agathos", "Goji", "Gugalanna", "Gasha", "Giltine", "Mellonia", "Kaggen", "Akvan", "Pil", "Belphoebe", "Kholomodumo", "Aello", "Uptala", "Sarbaz", "Shah", "Wazir", "Asb", "Rukh", "Provenance Watcher"} +defaults.moblist['abyssea'] = S{"Alfard", "Orthrus", "Carabosse", "Glavoid", "Isgebind"} +defaults.moblist['legion'] = S{"Veiled", "Lofty", "Soaring", "Mired", "Paramount"} +defaults.moblist['meebles'] = S{"Goldwing", "Silagilith", "Surtr", "Dreyruk", "Samursk", "Umagrhk", "Izyx", "Grannus", "Svaha", "Melisseus"} +defaults.moblist['other'] = S{"Tiamat", "Khimaira", "Khrysokhimaira", "Cerberus", "Dvergr", "Bloodthirsty", "Hydra", "Enraged", "Odin"} +defaults.moblist['dangerous'] = S{"Provenance Watcher", "Apademak"} +defaults.dangerwords = T{} +defaults.dangerwords['weaponskills'] = S{"Zantetsuken", "Geirrothr", "Astral Flow", "Chainspell", "Beastruction", "Mandible Massacre", "Oblivion's Mantle", "Divesting Gale", "Frog Song", "Frog Chorus", "Danse Macabre", "Raksha Stance", "Yama's Judgment", "Ballistic Kick", "Eradicator", "Arm Cannon", "Gorge", "Extreme Purgitation", "Slimy Proposal", "Rancid Reflux", "Pawn's Penumbra", "Gates of Hades", "Fulmination", "Nerve Gas", "Thundris Shriek"} +defaults.dangerwords['spells'] = S{"Death", "Meteor", "Kaustra", "Breakga", "Thundaga IV", "Thundaja", "Firaga IV", "Firaja", "Aeroga IV", "Aeroja", "Blizzaga IV", "Blizzaja", "Stonega IV", "Stoneja"} + +--Fill settings from either defaults table or settings.xml +settings = config.load(defaults) +ohShi_tb = texts.new(settings) + +--create tables to be used throughout the addon +tracking = T{} +prims = S{} +--[[ keeping in case the function below doesn't work. +trusts = S{'Kupipi','Excenmille','Naji','Ayame','Zeid','Curilla', + 'NanaaMihgo','Trion','Shantotto','Volker','Ajido-Marujido', + 'MihliAliapoh','Valaineral','Joachim','Lion','Prishe','Ulmia', + 'Ironeater','Gadalar','NajaSalaheem','Cherukiki','Nashmeira', + 'Zazarg','Ingrid','LhekoHabhoka','Ovjang','Mnejing','Sakura', + 'Luzaf','Najelith', 'Maat','Gessho','Aldo','Moogle','Fablinix', + 'D.Shantotto','Elvira','Noillurie','LhuMhakaracca','FerreousCoffin', + 'StarSibyl','Mumor'}]] + trusts = S(res.spells:type('Trust'):map(string.gsub-{' ', ''} .. table.get-{'name'})) diff --git a/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/helper_functions.lua b/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/helper_functions.lua new file mode 100644 index 0000000..e08fb21 --- /dev/null +++ b/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/helper_functions.lua @@ -0,0 +1,146 @@ +--[[ +Copyright (c) 2013, Ricky Gall +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +]] + +--This function checks the string sent to it against your mob list +--returns true if it's found and false if not. +function mCheck(str) + for category,_ in pairs(settings.moblist) do + for name,_ in pairs(settings.moblist[category]) do + if str:lower():contains(name:lower()) then + return true + end + end + end + return false +end + +--This function checks the string sent to it against your mob list +--returns true if it's found and false if not. +function mDanger(str) + for name,_ in pairs(settings.moblist.dangerous) do + if str:lower():contains(name:lower()) then + return true + end + end + return false +end + +--This function checks the string sent to it against your danger list +--returns true if it's found and false if not. +function dCheck(typ, sid) + --log('DEBUG TYP: '..typ..' ID: '..sid) + sid = tonumber(sid) + if typ == 'spell' then + if settings.dangerwords.spells:find(string.imatch-{res.spells[sid].english .. '$'}) then + return true + end + elseif sid <= 255 then + if settings.dangerwords.weaponskills:find(string.imatch-{res.weapon_skills[sid].english .. '$'}) then + return true + end + else + if settings.dangerwords.weaponskills:find(string.imatch-{res.monster_abilities[sid].english .. '$'}) then + return true + end + end + + return false +end + +--Check if the actor is actually an npc rather than a player +function isMob(id) + if not trusts:contains(windower.ffxi.get_mob_by_id(id)['name']) then + return windower.ffxi.get_mob_by_id(id)['is_npc'] + end + return false +end + +--This function is used to parse the windower resources +--to fill tables with ability/spell names/ids. +--Created by Byrth +function parse_resources(lines_file) + local ignore_fields = S{'german','french','japanese','index','recast','fr','frl','de','del','jp','jpl'} + local completed_table = {} + local counter = 0 + for i in ipairs(lines_file) do + local str = tostring(lines_file[i]) + local g,h,typ,key = string.find(str,'<(%w+) id="(%d+)" ') + if typ == 's' then + g,h,key = string.find(str,'index="(%d+)" ') + end + if key ~=nil then + completed_table[tonumber(key)]={} + local q = 1 + while q <= str:len() do + local a,b,ind,val = string.find(str,'(%w+)="([^"]+)"',q) + if ind~=nil then + if not ignore_fields[ind] then + if val == "true" or val == "false" then + completed_table[tonumber(key)][ind] = str2bool(val) + else + completed_table[tonumber(key)][ind] = val:gsub('"','\42'):gsub(''','\39') + end + end + q = b+1 + else + q = str:len()+1 + end + end + local k,v,english = string.find(str,'>([^<]+) nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +]] + + +_addon.name = 'OhShi' +_addon.version = '2.55' +_addon.author = 'Nitrous (Shiva)' +_addon.command = 'ohshi' + +--Requiring libraries used in this addon +--These should be saved in addons/libs +require('logger') +require('tables') +require('strings') +require('sets') +config = require('config') +files = require('files') +chat = require('chat') +texts = require('texts') +res = require('resources') +require('default_settings') +require('text_handling') +require('helper_functions') + +--This function is called when the addon loads. Defines aliases and +--registers functions, as well as filling the resource tables. +windower.register_event('load', initText) + +--Used when the addon is unloaded to save settings. +windower.register_event('unload',function() + settings:update(ohShi_tb._settings) + settings:save('all') +end) + +function saveSettings() + addText('OhShi Settings Updated') + settings:save('all') +end + +--This function is used to process addon commands +--like //ohshi help and the like. +windower.register_event('addon command', function(...) + local args = T{...} + if args[1] == nil then args[1] = 'help' end + if args[1] ~= nil then + local comm = table.remove(args,1):lower() + + if S{'showrolls','selfrolls'}:contains(comm) then + settings[comm] = not settings[comm] + settings.staggeronly = false + if comm == 'selfrolls' and not settings.showrolls then + settings.showrolls = true + elseif comm == 'showrolls' and settings.selfrolls then + settings.selfrolls = false + end + print('OhShi Showrolls:', settings.showrolls) + print('OhShi Selfrolls:', settings.selfrolls) + settings:save('all') + elseif comm == "staggeronly" then + settings.staggeronly = not settings.sstaggeronly + print('OhShi Stagger Only mode:', settings.staggeronly) + elseif comm == 'duration' then + if tonumber(args[1]) then + settings.duration = tonumber(args[1]) + print('OhShi Duration:',settings.duration) + saveSettings() + end + elseif S{'trackon','trackoff'}:contains(comm) then + local typ = '' + if S{'abyssea','dangerous','legion','meebles','other','voidwatch'}:contains(args[1]) then + typ = table.remove(args,1):lower() + else + typ = 'other' + end + local list = args:concat(' '):capitalize() + if comm == 'trackon' then + if not settings.moblist[typ]:find(string.imatch-{list}) then + settings.moblist[typ]:add(list) + notice(list..' added to '..typ..' table.') + end + else + if settings.moblist[typ]:find(string.imatch-{list}) then + settings.moblist[typ]:remove(settings.moblist[typ]:find(string.imatch-{list})) + notice(list..' removed from '..typ..' table.') + end + end + settings:save('all') + elseif S{'spellon','spelloff','wson','wsoff'}:contains(comm) then + local typ = '' + if S{'spellon','spelloff'}:contains(comm) then + typ = 'spells' + else + typ = 'weaponskills' + end + local list = args:concat(' '):capitalize() + if comm:find('on$') then + if not settings.dangerwords[typ]:find(string.imatch-{list..'$'}) then + settings.dangerwords[typ]:add(list) + notice(list..' added to '..typ..' table.') + end + else + if settings.dangerwords[typ]:find(string.imatch-{list..'$'}) then + settings.dangerwords[typ]:remove(settings.dangerwords[typ]:find(string.imatch-{list..'$'})) + notice(list..' removed from '..typ..' table.') + end + end + settings:save('all') + elseif S{'fonttype','fontsize','pos','bgcolor','txtcolor'}:contains(comm) then + if comm == 'fonttype' then ohShi_tb:font(args[1] or nil) + elseif comm == 'fontsize' then ohShi_tb:size(args[1] or nil) + elseif comm == 'pos' then ohShi_tb:pos(args[1] or nil,args[2] or nil) + elseif comm == 'bgcolor' then ohShi_tb:bgcolor(args[1] or nil,args[2] or nil,args[3] or nil) + elseif comm == 'txtcolor' then ohShi_tb:color(args[1] or nil,args[2] or nil,args[3] or nil) + end + settings:update(ohShi_tb._settings) + settings.bg.alpha = nil + settings.padding = nil + settings.text.alpha = nil + settings.text.content = nil + settings.visible = nil + saveSettings() + elseif comm == 'clear' then + tracking:clear() + textUpdate() + elseif S{'show','hide','settings'}:contains(comm) then + if comm == 'show' then + ohShi_tb:text('ohShi showing for settings') + ohShi_tb:show() + elseif comm == 'hide' then + settings:update(ohShi_tb._settings) + settings.bg.alpha = nil + settings.padding = nil + settings.text.alpha = nil + settings.text.content = nil + settings.visible = nil + textUpdate() + ohShi_tb:hide() + settings:save('all') + elseif comm == 'settings' then + windower.add_to_chat(207,'OhShi - Current Textbox Settings') + windower.add_to_chat(207,' BG: R: '..settings.bg.red..' G: '..settings.bg.green..' B: '..settings.bg.blue) + windower.add_to_chat(207,' Font: '..settings.text.font..' Size: '..settings.text.size) + windower.add_to_chat(207,' Text: R: '..settings.text.red..' G: '..settings.text.green..' B: '..settings.text.blue) + windower.add_to_chat(207,' Pos: X: '..settings.pos.x..' Y: '..settings.pos.y) + end + else + local helptext = [[OhShi - Command List: + 1. help - Brings up this menu. + 2. showrolls | selfrolls - Show corsair rolls in tracker | only own rolls. + 3. staggeronly - Only show voidwatch stagger notices. + 4. track(on/off) [abyssea/dangerous/legion/meebles/other/voidwatch] + - Begin or stop tracking of mob named . + 5. spell/ws(on/off) - Start or stop watching for spell|ws. + 6. clear - Clears the textbox and the tracking table (use if textbox locks up) + The following all correspond to the tracker: + fonttype | fontsize | pos - can also click/drag + bgcolor | txtcolor + duration