Quantcast WoWInterface - View Single Post - Guild Note Group Inviter
View Single Post
01-25-18, 08:22 AM   #1
bamboozle
A Defias Bandit
Join Date: Jan 2018
Posts: 2
Guild Note Group Inviter

I know nothing about lua and was wondering if someone can help me fix some issue I'm having.

So the addon is supposed to invite people that match the phrase in the command to their guild note
E.I... '/rinv weekday' will invite anyone with weekday in their guild note.

So first off I took this addon
https://wow.curseforge.com/projects/...ojectID=254432

and edited the RosterInvite.lua to the following.
Code:
-- instantiate a new ace addon
local AddOn = LibStub("AceAddon-3.0"):NewAddon("RosterInvite", "AceConsole-3.0")

-- declare slash commands
SLASH_ROSTERINVITE1 = '/rinv'
SLASH_ROSTERINVITE2 = '/rosterinv'
SLASH_ROSTERINVITE3 = '/rosterinvite'
SLASH_ROSTERINVITE4 = '/rinvite'

-- declare handler for slash commands
local function Handler(msg, editbox)
    -- check for arguments
    local inviteAll = false
    --local rankName = msg
    local noteNames = {}
    if msg == "" then
        -- no arguments mean we should invite everyone
        inviteAll = true
        AddOn:Print("Inviting all guild members")
    else
        -- an argument means we should invite all players with that rank
        inviteAll = false
        local notes = string.lower(msg)
        AddOn:Print("Inviting guild members with notes: " .. notes)
        for note in string.gmatch(notes, "[^ ]+") do
            table.insert(noteNames, note)
        end
    end

    -- invite players
    numTotalMembers, numOnlineMaxLevelMembers, numOnlineMembers = GetNumGuildMembers()
    for i=1,numOnlineMembers,1 do
        -- get player info
        name, rank, rankIndex, level, class, zone, note, 
            officernote, online, status, classFileName, 
            achievementPoints, achievementRank, isMobile, 
            isSoREligible, standingID = GetGuildRosterInfo(i);
        -- check player info
        if inviteAll then
            -- invite the player
            InviteUnit(name)
            AddOn:Print("Invited: " .. name .. " (" .. string.lower(note) .. ")")
        else
            for _, noteName in pairs(noteNames) do
                if string.lower(note) == string.lower(noteName) then
                    -- invite the player
                    InviteUnit(name)
                    AddOn:Print("Invited: " .. name .. " (" .. noteName .. ")")
                end
            end
        end
    end
    AddOn:Print("Done")
end

-- register slash command handler
SlashCmdList["ROSTERINVITE"] = Handler;

-- declare ace oninit function
function AddOn:OnInitialize()
    AddOn:Print("Loaded")
end
Now this works, however, it will not invite people if they have more stuff in their note. So normally I would have someone note be "Weekday Raider 950 Feral" or "Weekend Raider 955 Prot pally". I would like to keep that but with the quick edit I made to the addon above, it doesn't work if I do keep that extra stuff. another issue, that is minor, is it being case sensitive, the addon will not work with capitals.

Once again any help will be great!

~ Cheers Bamboozle
  Reply With Quote