Mercurial > wow > crossrealmassist
comparison CrossRealmAssist.lua @ 17:edb74cf488c4 beta-0.51
added party stat & fix small bug
| author | ShadowTheAge |
|---|---|
| date | Fri, 13 Mar 2015 00:03:42 +0300 |
| parents | c97b3a4e5feb |
| children | f7f4ac669077 |
comparison
equal
deleted
inserted
replaced
| 16:cb06c075c0d7 | 17:edb74cf488c4 |
|---|---|
| 9 local homeRealm, realmSep, gui, btRefresh, btSettings, btQuick, btManual, lbRealm, lbStatus, playerName, lfgui, lfgTabSelected, lfgTable, lbThrottle, curLfgGroup, sheduledScan, wasInGroup, inInstance | 9 local homeRealm, realmSep, gui, btRefresh, btSettings, btQuick, btManual, lbRealm, lbStatus, playerName, lfgui, lfgTabSelected, lfgTable, lbThrottle, curLfgGroup, sheduledScan, wasInGroup, inInstance |
| 10 local settingsMenu | 10 local settingsMenu |
| 11 local hintShown | 11 local hintShown |
| 12 | 12 |
| 13 local tabs = {} | 13 local tabs = {} |
| 14 local curRealmStat | 14 local curRealmStat, curPartyStat |
| 15 local scanstate=0 | 15 local scanstate=0 |
| 16 local recentRealms={} | 16 local recentRealms={} |
| 17 local recentgroups={} | 17 local recentgroups={} |
| 18 local autoScanGroups={} | 18 local autoScanGroups={} |
| 19 local active=false | 19 local active=false |
| 387 gui:Hide() | 387 gui:Hide() |
| 388 if lfgui then lfgui:Hide() end | 388 if lfgui then lfgui:Hide() end |
| 389 scanstate = 0 | 389 scanstate = 0 |
| 390 lfgScanInProgress = false | 390 lfgScanInProgress = false |
| 391 addon:UnregisterEvent("ZONE_CHANGED_NEW_AREA") | 391 addon:UnregisterEvent("ZONE_CHANGED_NEW_AREA") |
| 392 addon:UnregisterEvent("SCENARIO_UPDATE") | |
| 392 addon:UnregisterEvent("PLAYER_REGEN_ENABLED") | 393 addon:UnregisterEvent("PLAYER_REGEN_ENABLED") |
| 393 addon:UnregisterEvent("LFG_LIST_SEARCH_RESULTS_RECEIVED") | 394 addon:UnregisterEvent("LFG_LIST_SEARCH_RESULTS_RECEIVED") |
| 394 addon:UnregisterEvent("LFG_LIST_SEARCH_RESULT_UPDATED") | 395 addon:UnregisterEvent("LFG_LIST_SEARCH_RESULT_UPDATED") |
| 395 addon:UnregisterEvent("LFG_LIST_SEARCH_FAILED") | 396 addon:UnregisterEvent("LFG_LIST_SEARCH_FAILED") |
| 396 addon:UnregisterEvent("GROUP_ROSTER_UPDATE") | 397 addon:UnregisterEvent("GROUP_ROSTER_UPDATE") |
| 575 function addon:RealmVisited(realm, head) | 576 function addon:RealmVisited(realm, head) |
| 576 recentRealms[realm] = GetTime() | 577 recentRealms[realm] = GetTime() |
| 577 end | 578 end |
| 578 | 579 |
| 579 function addon:updatePartyInfo() | 580 function addon:updatePartyInfo() |
| 580 local realms = {} | 581 curPartyStat = {} |
| 581 local inGroup = IsInGroup() | 582 local inGroup = IsInGroup() |
| 582 if inGroup then | 583 if inGroup then |
| 583 if IsInRaid() then | 584 if IsInRaid() then |
| 584 for i=1, MAX_RAID_MEMBERS do | 585 for i=1, MAX_RAID_MEMBERS do |
| 585 addon:AddUnitIdStat("raid"..i, realms) | 586 addon:AddUnitIdStat("raid"..i, curPartyStat) |
| 586 end | 587 end |
| 587 else | 588 else |
| 588 for i=1, MAX_PARTY_MEMBERS do | 589 for i=1, MAX_PARTY_MEMBERS do |
| 589 addon:AddUnitIdStat("party"..i, realms) | 590 addon:AddUnitIdStat("party"..i, curPartyStat) |
| 590 end | 591 end |
| 591 end | 592 end |
| 592 end | 593 end |
| 593 if inGroup ~= wasInGroup then | 594 if inGroup ~= wasInGroup then |
| 594 addon:RefreshZone(true) | 595 addon:RefreshZone(true) |
| 729 | 730 |
| 730 local action | 731 local action |
| 731 | 732 |
| 732 local LeaveGroup = { | 733 local LeaveGroup = { |
| 733 func = LeaveParty; | 734 func = LeaveParty; |
| 734 tooltip = "Leave current joined group", | 735 tooltip = function(self) |
| 736 local partyStat = addon:GetRealmStat(curPartyStat) | |
| 737 GameTooltip:AddLine("Players in party "..partyStat.players) | |
| 738 local max = partyStat.max; | |
| 739 for i=1,#partyStat do | |
| 740 local data = partyStat[i] | |
| 741 local percent = math.ceil(100 * data.count / partyStat.players - 0.5) .. "%"; | |
| 742 local pmax = data.count/max; | |
| 743 local green = 0.5 + pmax * 0.5; | |
| 744 local gray = 0.5 * (1-pmax) | |
| 745 GameTooltip:AddDoubleLine(data.realm, percent, gray,green,gray,gray,green,gray) | |
| 746 end | |
| 747 GameTooltip:AddLine("Click to leave party",1,0.5,0) | |
| 748 end, | |
| 735 text = "Leave group" | 749 text = "Leave group" |
| 736 } | 750 } |
| 737 | 751 |
| 738 local CancelJoin = { | 752 local CancelJoin = { |
| 739 func = function() | 753 func = function() |
