Trustworthy, An Addon To Search Trusts You Have.

Langues: JP EN DE FR
users online
Forum » Windower » General » Trustworthy, an addon to search trusts you have.
Trustworthy, an addon to search trusts you have.
 Valefor.Omnys
Offline
Serveur: Valefor
Game: FFXI
user: omnys
Posts: 1759
By Valefor.Omnys 2016-09-03 14:52:29
Link | Citer | R
 
Here's a simple addon I've just submitted to Windower but as this login campaign is almost over, people may find an immediate use now.

It's called Trustworthy and it allows you to search trusts you have. using syntax like //tw find [partial name].

//tw find zeid


Like most addons, it can be used while game interfaces are open so you can use the addon while scrolling through the list of trusts available this month from the login campaign.
Code
_addon.name = 'Trustworthy'
_addon.version = '0.1'
_addon.author = 'Omnys@Valefor'
_addon.commands = {'trustworthy','tw'}

res = require('resources')
require('logger')

spells = res.spells
trusts = S(res.spells:type('Trust'):map(table.get-{'name'}))
MyTrusts = {}
known = {}

function establishTrusts()
    known = windower.ffxi.get_spells()

    MyTrusts = T{}
    for k, v in pairs(known) do
        if spells[k] and spells[k].type == "Trust"  then 
            MyTrusts[string.lower(spells[k].english)] = v
        end
    end
end
establishTrusts()

windower.register_event('zone change',function()
    -- Get Trust list again in case ciphers were learned, makes searches accurate
    establishTrusts:schedule(10)
end)

windower.register_event('addon command', function(...)
    local args = T{...}:map(string.lower)
    local cmd = table.concat(args," ")
    if args[1] == nil or args[1] == "help" then
        log("Type //tw [partial trust name]")
    elseif (args[1] == "find" or args[1] == "search") and #args > 1 then
        cmd = windower.regex.replace(cmd,"^"..args[1].." ","")
        log("Trusts matching '"..cmd.."'.")
        for k, v in pairs(MyTrusts) do
            if string.find(k,string.lower(cmd)) then
                if v then
                    windower.add_to_chat(255,"    You already have "..string.upper(k)..".")
                else
                    windower.add_to_chat(167,"    You do not have "..string.upper(k)..".")
                end
            end
        end
    end
end)


If you want to use it, you'll need to add a folder in your windower\addons folder called trustworthy and a file inside that called trustworthy.lua.

If you run into any problems doing this, on any version of windows (like the file appears to be placed and named correctly but Windower is saying it can't find the addon) follow these steps: Displaying Known File Extension in Windows

1. Click the Start menu. ...
2. Type "folder options" (without the quotes). ...
3. A dialog box with the title "Folder Options" will appear.
3a. You may need to click the "View" tab at the top
4. Find and uncheck "Hide extensions for known file types".
5. Click the "OK" button at the bottom of the dialog box.

Edit: Fixed a filtering problem.
[+]
Log in to post.