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/ohShi.lua | 273 +++++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 Data/BuiltIn/Libraries/lua-addons/addons/ohShi/ohShi.lua (limited to 'Data/BuiltIn/Libraries/lua-addons/addons/ohShi/ohShi.lua') diff --git a/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/ohShi.lua b/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/ohShi.lua new file mode 100644 index 0000000..567b15f --- /dev/null +++ b/Data/BuiltIn/Libraries/lua-addons/addons/ohShi/ohShi.lua @@ -0,0 +1,273 @@ +--[[ +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. +]] + + +_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