Done, worked (hope in raid too)
Code:
SLASH_RAIDSTRING1 = "/rs"
SLASH_MAKERAID1 = "/rm"
ClassTable = {
["WARRIOR"] = 1,
["ROGUE"] = 2,
["HUNTER"] = 3,
["PALADIN"] = 4,
["SHAMAN"] = 5,
["DRUID"] = 6,
["WARLOCK"] = 7,
["MAGE"] = 8,
["PRIEST"] = 9,
["DEATHKNIGHT"] = 10,
}
SlashCmdList["MAKERAID"] = function(msg, editBox)
URLFrame:Show();
end
local current, numInGroup = {}, {}
local function UpdateRaidState()
wipe(numInGroup)
wipe(current)
for i = 1, GetNumGroupMembers() do
local name, rank, subgroup, level, class, fileName, zone, online, isDead, role, isML = GetRaidRosterInfo(i);
current[name] = { index = i, group = subgroup }
numInGroup[subgroup] = (numInGroup[subgroup] or 0) + 1
end
end
function SortRaid()
local str = URLFrameEditBox:GetText();
-- Get a snapshot of the current raid layout:
UpdateRaidState()
local wanted = {}
-- Build a map of the desired raid layout:
for name, group in string.gmatch(str, "([^&:]+):(%d+)") do
-- Ignore named players not in the raid.
if current[name] then
wanted[name] = group
end
end
-- Look for players not in the wanted group and move them:
for name, group in pairs(wanted) do
if current[name].group ~= group then
if numInGroup[group] then
if numInGroup[group] or numInGroup[group] < 5 then
-- Just move them:
SetRaidSubgroup(current[name].index, group)
else
-- Look for someone to swap with:
for xname, xdata in pairs(current) do
if xdata.group == group and wanted[xname] ~= group then
-- Do the swap:
SwapRaidSubgroup(current[name].index, xdata.index)
-- Update the snapshot:
UpdateRaidState()
end
end
end
else
SetRaidSubgroup(current[name].index, group)
end
end
end
end
function setContains(set, key)
return set[key] ~= nil
end
SlashCmdList["RAIDSTRING"] = function(msg, editBox)
bool = UnitInRaid("player");
name, realm = UnitName("player");
if bool then
local membercount = GetNumGroupMembers();
guildName = GetGuildInfo("player");
local realm = GetRealmName();
xml = "<RaidInfo><Info>Raidassist</Info><Password>W2Any"..realm.."dEAv"..name.."2AxaS</Password><Realm>"..realm.."</Realm><Guild>"..guildName.."</Guild><Name>"..name.."</Name><PlayerInfos>";
for i=1, membercount do
local localizedClass, englishClass = UnitClass("raid" .. i);
local name, online = UnitName("raid" .. i)
xml = xml.. "<key"..i.."><name>"..name.."</name><class>"..englishClass.."</class></key"..i..">";
end
xml = xml.."</PlayerInfos></RaidInfo>";
ShowDkpLink(xml);
end
end
function ShowDkpLink(link)
URLFrameEditBox:SetText(link);
URLFrameEditBox:HighlightText();
URLFrame:Show();
end
Download AddOn:
**snip**
Raidassist Page:
http://absence-gilde.com/?p=raidposi&b=1&s=1&g=1&u=0&e