Created
June 19, 2011 19:00
-
-
Save jesseadams/1034607 to your computer and use it in GitHub Desktop.
Adds slash command to bulk invite guild members of certain ranks to raid and more
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- General Options | |
local inviteRanks = { "Prodigy", "Pedagogue", "Abecedarian", "Lab Rat", "Genius"} | |
local inviteLevel = 85 | |
local autoConvertRaid = true | |
-- Loot Threshold | |
-- 0. Poor (gray): Broken I.W.I.N. Button | |
-- 1. Common (white): Archmage Vargoth's Staff | |
-- 2. Uncommon (green): X-52 Rocket Helmet | |
-- 3. Rare / Superior (blue): Onyxia Scale Cloak | |
-- 4. Epic (purple): Talisman of Ephemeral Power | |
-- 5. Legendary (orange): Fragment of Val'anyr | |
-- 6. Artifact (golden yellow): The Twin Blades of Azzinoth | |
-- 7. Heirloom (light yellow): Bloodied Arcanite Reaper | |
local lootThreshold = 4 | |
-- Loot Method | |
-- freeforall - Free for All - any group member can take any loot at any time | |
-- group - Group Loot - like Round Robin, but items above a quality threshold are rolled on | |
-- master - Master Looter - like Round Robin, but items above a quality threshold are left for a designated loot master to | |
-- needbeforegreed - Need before Greed - like Group Loot, but members automatically pass on items | |
-- roundrobin - Round Robin - group members take turns being able to loot | |
local lootMethod = "master" | |
local frame = CreateFrame("Frame", nil, UIParent); | |
local nettieCommandUsed = false | |
local lootSet = false | |
function table_match(needle, haystack) | |
for _,v in pairs(haystack) do | |
if v == needle then | |
return true | |
end | |
end | |
return false | |
end | |
function PossiblyConvertToRaid(self, event, ...) | |
if nettieCommandUsed then | |
if event == "PARTY_MEMBERS_CHANGED" and autoConvertRaid and GetNumPartyMembers() > 0 then | |
ConvertToRaid() | |
elseif event == "PARTY_CONVERTED_TO_RAID" then | |
SetLootMethod(lootMethod, UnitName("player")) | |
lootSet = true | |
elseif event == "PARTY_LOOT_METHOD_CHANGED" and lootSet then | |
SetLootThreshold(lootThreshold) | |
nettieCommandUsed = false | |
lootSet = false | |
end | |
end | |
end | |
function RaidInvite() | |
nettieCommandUsed = true | |
SendChatMessage("Inviting raiders to raid now!", "GUILD") | |
for index=1,GetNumGuildMembers() do | |
name, rank, rankIndex, level, class, zone, note, officernote, online, status, classFileName, achievementPoints, achievementRank, isMobile = GetGuildRosterInfo(index) | |
if table_match(rank, inviteRanks) and level == inviteLevel and online and not UnitIsPlayer(name) and not UnitInRaid(name) then | |
print("Inviting " .. name .. "...") | |
InviteUnit(name) | |
end | |
end | |
end | |
SLASH_RAIDINVITE1 = '/raidinvite' | |
SlashCmdList["RAIDINVITE"] = RaidInvite | |
frame:RegisterEvent("PARTY_MEMBERS_CHANGED"); | |
frame:RegisterEvent("PARTY_CONVERTED_TO_RAID"); | |
frame:RegisterEvent("PARTY_LOOT_METHOD_CHANGED"); | |
frame:SetScript("OnEvent", PossiblyConvertToRaid); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment