# HG changeset patch # User ShadowTheAge # Date 1426194222 -10800 # Node ID edb74cf488c4f85b95d0664a14b735b2ee46e8f9 # Parent cb06c075c0d78aa17fb677ab5ed60b4dd5557763 added party stat & fix small bug diff -r cb06c075c0d7 -r edb74cf488c4 CrossRealmAssist.lua --- a/CrossRealmAssist.lua Thu Mar 12 23:08:30 2015 +0300 +++ b/CrossRealmAssist.lua Fri Mar 13 00:03:42 2015 +0300 @@ -11,7 +11,7 @@ local hintShown local tabs = {} -local curRealmStat +local curRealmStat, curPartyStat local scanstate=0 local recentRealms={} local recentgroups={} @@ -389,6 +389,7 @@ scanstate = 0 lfgScanInProgress = false addon:UnregisterEvent("ZONE_CHANGED_NEW_AREA") + addon:UnregisterEvent("SCENARIO_UPDATE") addon:UnregisterEvent("PLAYER_REGEN_ENABLED") addon:UnregisterEvent("LFG_LIST_SEARCH_RESULTS_RECEIVED") addon:UnregisterEvent("LFG_LIST_SEARCH_RESULT_UPDATED") @@ -577,16 +578,16 @@ end function addon:updatePartyInfo() - local realms = {} + curPartyStat = {} local inGroup = IsInGroup() if inGroup then if IsInRaid() then for i=1, MAX_RAID_MEMBERS do - addon:AddUnitIdStat("raid"..i, realms) + addon:AddUnitIdStat("raid"..i, curPartyStat) end else for i=1, MAX_PARTY_MEMBERS do - addon:AddUnitIdStat("party"..i, realms) + addon:AddUnitIdStat("party"..i, curPartyStat) end end end @@ -731,7 +732,20 @@ local LeaveGroup = { func = LeaveParty; - tooltip = "Leave current joined group", + tooltip = function(self) + local partyStat = addon:GetRealmStat(curPartyStat) + GameTooltip:AddLine("Players in party "..partyStat.players) + local max = partyStat.max; + for i=1,#partyStat do + local data = partyStat[i] + local percent = math.ceil(100 * data.count / partyStat.players - 0.5) .. "%"; + local pmax = data.count/max; + local green = 0.5 + pmax * 0.5; + local gray = 0.5 * (1-pmax) + GameTooltip:AddDoubleLine(data.realm, percent, gray,green,gray,gray,green,gray) + end + GameTooltip:AddLine("Click to leave party",1,0.5,0) + end, text = "Leave group" }