Search code examples
apiluaworld-of-warcraft

WoW API: demote all people with some rank?


I would like to demote (rank down) every member of my guild with a specific rank (e.g. all Newbies to Incomers)

--- any ideas how to do this in World of Warcraft API ?

(Im guessing some loop over all guild members' names testing if rank and demote then? - please write example if so)

Thank you for your future answers :)


Solution

  • When I played, the the first place I'd always look was wowwiki. Here's the list of guild functions. Looks like you can call GetGuildRosterInfo from 1 to GetNumGuildMember times (or until GetGuildRosterInfo(N) returns nil) to get player name and rank, then call GuildDemote to demote players.

    Something like this (totally untested; I don't even have WoW installed these days):

    for i=1,GetNumGuildMembers() do
        local name, rank = GetGuildRosterInfo(i)
        if rank == "The rank you're iterested in" then
            GuildDemote(name)
        end
    end
    

    You can try out API calls in game. You can even write most of your addon in game. When I played, I wrote quite a few addons for myself and published a few. One of them (Hack) was an in-game Lua script editor. I think someone has picked up the ball on that and kept it going. You should look to get something like that.