Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- F = CreateFrame("Frame")
- F:RegisterEvent("UPDATE_BATTLEFIELD_STATUS")
- local rb={}
- local msg=nil
- F:SetScript("OnEvent", function()
- --make sure we're in an arena and not a battleground
- iRA = select(2,IsActiveBattlefieldArena())
- if iRA then
- --If the arena has not yet ended, get current ratings and return without doing anything
- battlefieldWinner = GetBattlefieldWinner()
- if (battlefieldWinner == nil) then
- if not rb[1] then
- for i=1,4 do
- rb[i]=GetPersonalRatedInfo(i)
- end
- end
- return
- end
- --Get new ratings
- local ra={}
- for i=1,4 do
- ra[i]=GetPersonalRatedInfo(i)
- end
- --Get bracket
- local b
- for i=1,4 do
- if ra[i]<rb[i] or ra[i]>rb[i] then
- b=i
- end
- end
- --Get mmr
- local mmr1=select(4,GetBattlefieldTeamInfo(battlefieldWinner))
- local mmr2= select(4,GetBattlefieldTeamInfo(((battlefieldWinner-1)*(-1))))
- --Generate message
- if b~=nil then
- if GetBattlefieldArenaFaction()==battlefieldWinner then
- msg="(rating: "..GetPersonalRatedInfo(b).." (+"..(ra[b]-rb[b]).."); mmr: "..mmr1.." (vs "..mmr2.."))";
- else
- msg="(rating: "..GetPersonalRatedInfo(b).." (-"..(rb[b]-ra[b]).."); mmr: "..mmr2.." (vs "..mmr1.."))";
- end
- else
- if GetBattlefieldArenaFaction()==battlefieldWinner then
- msg="(rating: no change (+0); mmr: "..mmr1.." (vs "..mmr2.."))";
- else
- msg="(rating: no change (-0); mmr: "..mmr2.." (vs "..mmr1.."))";
- end
- end
- --Partymessage and reset vars
- SendChatMessage(msg, "PARTY");
- rb={}
- msg=nil
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement