- this is part of ToS June 20th update.

- New Death Recap implemented! replaces the default from Blizzard and can be configured at Options > Raid Tools.
- New Guild Damage and Heal rank on '/details ranking' panel.
- Added a Guild Sync button on the Details! Ranking Panel.
- Added Custom display 'Damage on Shields', useful for encounter like Maiden of Vigilance where there's big shields to be removed and you want to know who is doing more damage to it.
- Added Heal Absorbed display under Heal bracket.\n\nHeal Absorb are the heal denied by abilities such like DK's Necrotic Strike or raid boss Sisters of the Moon 'Embrace of the Eclipse' ability.\nThe tooltip of this display shows which players got heal denied, which abilities absorbed the heal, which abilities tried to heal but got the heal denied.
- Added Alternate Power display under Energy bracket, it shows the total of alternate power gain from each player, useful for encounters such as Demonic Inquisition.
- Fixed Paladin 'Light of the Martyr' damage to self.
This commit is contained in:
Tercio
2017-06-14 19:32:17 -03:00
parent 5869d2bc85
commit e28dbc990d
14 changed files with 866 additions and 90 deletions
+305 -38
View File
@@ -11,6 +11,9 @@ local GetNumGroupMembers = GetNumGroupMembers
local ItemUpgradeInfo = LibStub ("LibItemUpgradeInfo-1.0")
local LibGroupInSpecT = LibStub ("LibGroupInSpecT-1.1")
local storageDebug = false
local store_instances = _detalhes.InstancesToStoreData
function _detalhes:UpdateGears()
_detalhes:UpdateParser()
@@ -686,6 +689,46 @@ function _detalhes.storage:OpenRaidStorage()
return db
end
function _detalhes.storage:GetBestFromGuild (diff, encounter_id, role)
local db = _detalhes.storage:OpenRaidStorage()
local best = 0
local bestplayername
local onencounter
if (not role) then
role = "damage"
end
role = string.lower (role)
if (role == "damager") then
role = "damage"
elseif (role == "healer") then
role = "healing"
end
local table = db [diff]
if (table) then
local encounters = table [encounter_id]
if (encounters) then
for index, encounter in ipairs (encounters) do
local players = encounter [role]
if (players) then
for playername, t in pairs (players) do
if (t[1] > best) then
best = t [1]
bestplayername = playername
onencounter = encounter
end
end
end
end
end
end
return best, bestplayername, onencounter
end
function _detalhes.storage:GetBestFromPlayer (diff, encounter_id, role, playername)
local db = _detalhes.storage:OpenRaidStorage()
@@ -726,6 +769,210 @@ function _detalhes.storage:GetBestFromPlayer (diff, encounter_id, role, playerna
return best, onencounter
end
function _detalhes.storage:DBGuildSync()
_detalhes:SendGuildData ("GS", "R")
end
--remote call RoS
function _detalhes.storage:GetIDsToGuildSync()
local db = _detalhes.storage:OpenRaidStorage()
local IDs = {}
--build the encounter ID list
for diff, diffTable in pairs (db or {}) do
if (type (diffTable) == "table") then
for encounterID, encounterTable in pairs (diffTable) do
for index, encounter in ipairs (encounterTable) do
tinsert (IDs, encounter.time)
end
end
end
end
if (_detalhes.debug) then
_detalhes:Msg ("(debug) [RoS-EncounterSync] sending " .. #IDs .. " IDs.")
end
return IDs
end
--local call RoC - received the encounter IDS - need to know which fights is missing
function _detalhes.storage:CheckMissingIDsToGuildSync (IDsList)
local db = _detalhes.storage:OpenRaidStorage()
if (type (IDsList) ~= "table") then
if (_detalhes.debug) then
_detalhes:Msg ("(debug) [RoS-EncounterSync] RoC IDsList isn't a table.")
end
return
end
--this will prevent to request the same fight from multiple people
_detalhes.RecentRequestedIDs = _detalhes.RecentRequestedIDs or {}
--store the IDs which need to be sync
local RequestIDs = {}
--check missing IDs
for index, ID in ipairs (IDsList) do
local found = false
for diff, diffTable in pairs (db or {}) do
if (type (diffTable) == "table") then
for encounterID, encounterTable in pairs (diffTable) do
for index, encounter in ipairs (encounterTable) do
if (ID == encounter.time) then
found = true
break
end
end
end
end
end
if (not found) then
if (not _detalhes.RecentRequestedIDs [ID]) then
tinsert (RequestIDs, ID)
_detalhes.RecentRequestedIDs [ID] = true
end
end
end
if (_detalhes.debug) then
_detalhes:Msg ("(debug) [RoC-EncounterSync] RoS found " .. #RequestIDs .. " encounters out dated.")
end
return RequestIDs
end
--remote call RoS - build the encounter list from the IDsList
function _detalhes.storage:BuildEncounterDataToGuildSync (IDsList)
local db = _detalhes.storage:OpenRaidStorage()
if (type (IDsList) ~= "table") then
if (_detalhes.debug) then
_detalhes:Msg ("(debug) [RoS-EncounterSync] IDsList isn't a table.")
end
return
end
local EncounterList = {}
local CurrentTable = {}
tinsert (EncounterList, CurrentTable)
local AmtToSend = 0
local MaxAmount = 0
if (_detalhes.debug) then
_detalhes:Msg ("(debug) [RoS-EncounterSync] the client requested " .. #IDsList .. " encounters.")
end
for index, ID in ipairs (IDsList) do
for diff, diffTable in pairs (db or {}) do
if (type (diffTable) == "table") then
for encounterID, encounterTable in pairs (diffTable) do
for index, encounter in ipairs (encounterTable) do
if (ID == encounter.time) then
--send this encounter
CurrentTable [diff] = CurrentTable [diff] or {}
CurrentTable [diff] [encounterID] = CurrentTable [diff] [encounterID] or {}
tinsert (CurrentTable [diff] [encounterID], encounter)
AmtToSend = AmtToSend + 1
MaxAmount = MaxAmount + 1
if (MaxAmount == 3) then
CurrentTable = {}
tinsert (EncounterList, CurrentTable)
MaxAmount = 0
end
end
end
end
end
end
end
if (_detalhes.debug) then
_detalhes:Msg ("(debug) [RoS-EncounterSync] sending " .. AmtToSend .. " encounters.")
end
return EncounterList
end
local have_encounter = function (db, ID)
for diff, diffTable in pairs (db or {}) do
if (type (diffTable) == "table") then
for encounterID, encounterTable in pairs (diffTable) do
for index, encounter in ipairs (encounterTable) do
if (ID == encounter.time) then
return true
end
end
end
end
end
return false
end
--local call RoC - add the fights to the client db
function _detalhes.storage:AddGuildSyncData (data)
local db = _detalhes.storage:OpenRaidStorage()
local AddedAmount = 0
_detalhes.LastGuildSyncReceived = GetTime()
for diff, diffTable in pairs (data) do
if (type (diff) == "number" and type (diffTable) == "table") then
for encounterID, encounterTable in pairs (diffTable) do
if (type (encounterID) == "number" and type (encounterTable) == "table") then
for index, encounter in ipairs (encounterTable) do
--validate the encounter
if (type (encounter.time) == "number" and type (encounter.guild) == "string" and type (encounter.date) == "string" and type (encounter.healing) == "table" and type (encounter.elapsed) == "number" and type (encounter.damage) == "table") then
--check if this encounter already has been added from another sync
if (not have_encounter (db, encounter.time)) then
db [diff] = db [diff] or {}
db [diff] [encounterID] = db [diff] [encounterID] or {}
tinsert (db [diff] [encounterID], encounter)
if (_G.DetailsRaidHistoryWindow and _G.DetailsRaidHistoryWindow:IsShown()) then
_G.DetailsRaidHistoryWindow:Refresh()
end
AddedAmount = AddedAmount + 1
else
if (_detalhes.debug) then
_detalhes:Msg ("(debug) [RoS-EncounterSync] received a duplicated encounter table.")
end
end
else
if (_detalhes.debug) then
_detalhes:Msg ("(debug) [RoS-EncounterSync] received an invalid encounter table.")
end
end
end
end
end
end
end
if (_detalhes.debug) then
_detalhes:Msg ("(debug) [RoS-EncounterSync] added " .. AddedAmount .. " to database.")
end
if (_G.DetailsRaidHistoryWindow and _G.DetailsRaidHistoryWindow:IsShown()) then
_G.DetailsRaidHistoryWindow:UpdateDropdowns()
_G.DetailsRaidHistoryWindow:Refresh()
end
end
function _detalhes.storage:ListDiffs()
local db = _detalhes.storage:OpenRaidStorage()
local t = {}
@@ -855,24 +1102,23 @@ function _detalhes.storage:GetEncounterData (diff, encounter_id, guild)
return t
end
local store_instances = {
[1448] = true, --Hellfire Citadel
[1205] = true, --Blackrock Foundry
[1228] = true, --Highmaul
--[1136] = true, --SoO
}
function _detalhes:StoreEncounter (combat)
combat = combat or _detalhes.tabela_vigente
if (not combat) then
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: combat not found.")
end
return
end
local name, type, difficulty, difficultyName, maxPlayers, playerDifficulty, isDynamicInstance, mapID, instanceGroupSize = GetInstanceInfo()
if (not store_instances [mapID]) then
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: instance not allowed.")
end
return
end
@@ -880,13 +1126,16 @@ function _detalhes:StoreEncounter (combat)
local encounter_id = boss_info and boss_info.id
if (not encounter_id) then
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: encounter ID not found.")
end
return
end
local diff = combat:GetDifficulty()
--> check for heroic and mythic
if (diff == 15 or diff == 16) then --test on raid finder ' or diff == 17' -- normal mode: diff == 14 or
if (storageDebug or (diff == 15 or diff == 16)) then --test on raid finder ' or diff == 17' -- normal mode: diff == 14 or
--> check the guild name
local match = 0
@@ -901,12 +1150,16 @@ function _detalhes:StoreEncounter (combat)
end
end
if (match < raid_size * 0.75) then
print ("|cFFFFFF00Details! Storage|r: can't save the encounter, need at least 75% of players be from your guild.")
if (match < raid_size * 0.75 and not storageDebug) then
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: can't save the encounter, need at least 75% of players be from your guild.")
end
return
end
else
print ("|cFFFFFF00Details! Storage|r: can't save the encounter, need at least 75% of players be from your guild.")
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: can't save the encounter, need at least 75% of players be from your guild.")
end
return
end
@@ -914,7 +1167,9 @@ function _detalhes:StoreEncounter (combat)
if (not IsAddOnLoaded ("Details_DataStorage")) then
local loaded, reason = LoadAddOn ("Details_DataStorage")
if (not loaded) then
print ("|cFFFFFF00Details! Storage|r: can't save the encounter, couldn't load DataStorage, may be the addon is disabled.")
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: can't save the encounter, couldn't load DataStorage, may be the addon is disabled.")
end
return
end
end
@@ -962,34 +1217,35 @@ function _detalhes:StoreEncounter (combat)
local role = UnitGroupRolesAssigned ("raid" .. i)
if (role == "DAMAGER" or role == "TANK") then
local player_name, player_realm = UnitName ("raid" .. i)
if (player_realm and player_realm ~= "") then
player_name = player_name .. "-" .. player_realm
end
local _, _, class = UnitClass (player_name)
local damage_actor = damage_container_pool [damage_container_hash [player_name]]
if (damage_actor) then
local guid = UnitGUID (player_name) or UnitGUID (UnitName ("raid" .. i))
this_combat_data.damage [player_name] = {floor (damage_actor.total), _detalhes.item_level_pool [guid] and _detalhes.item_level_pool [guid].ilvl or 0, class or 0}
end
elseif (role == "HEALER") then
local player_name, player_realm = UnitName ("raid" .. i)
if (player_realm and player_realm ~= "") then
player_name = player_name .. "-" .. player_realm
end
local _, _, class = UnitClass (player_name)
local heal_actor = healing_container_pool [healing_container_hash [player_name]]
if (heal_actor) then
local guid = UnitGUID (player_name) or UnitGUID (UnitName ("raid" .. i))
this_combat_data.healing [player_name] = {floor (heal_actor.total), _detalhes.item_level_pool [guid] and _detalhes.item_level_pool [guid].ilvl or 0, class or 0}
if (UnitIsInMyGuild ("raid" .. i)) then
if (role == "DAMAGER" or role == "TANK") then
local player_name, player_realm = UnitName ("raid" .. i)
if (player_realm and player_realm ~= "") then
player_name = player_name .. "-" .. player_realm
end
local _, _, class = UnitClass (player_name)
local damage_actor = damage_container_pool [damage_container_hash [player_name]]
if (damage_actor) then
local guid = UnitGUID (player_name) or UnitGUID (UnitName ("raid" .. i))
this_combat_data.damage [player_name] = {floor (damage_actor.total), _detalhes.item_level_pool [guid] and _detalhes.item_level_pool [guid].ilvl or 0, class or 0}
end
elseif (role == "HEALER") then
local player_name, player_realm = UnitName ("raid" .. i)
if (player_realm and player_realm ~= "") then
player_name = player_name .. "-" .. player_realm
end
local _, _, class = UnitClass (player_name)
local heal_actor = healing_container_pool [healing_container_hash [player_name]]
if (heal_actor) then
local guid = UnitGUID (player_name) or UnitGUID (UnitName ("raid" .. i))
this_combat_data.healing [player_name] = {floor (heal_actor.total), _detalhes.item_level_pool [guid] and _detalhes.item_level_pool [guid].ilvl or 0, class or 0}
end
end
end
end
tinsert (encounter_database, this_combat_data)
@@ -1016,6 +1272,13 @@ function _detalhes:StoreEncounter (combat)
end
end
--guild best
local amount, playerName, encounterObject = _detalhes.storage:GetBestFromGuild (diff, encounter_id, myrole)
if (amount > 0) then
--> player got the high score on his guild
end
local lower_instance = _detalhes:GetLowerInstanceNumber()
if (lower_instance) then
local instance = _detalhes:GetInstance (lower_instance)
@@ -1030,6 +1293,10 @@ function _detalhes:StoreEncounter (combat)
instance:InstanceAlert ("Boss Defeated, Open History! ", icon, 40, func, true)
end
end
else
if (_detalhes.debug) then
print ("|cFFFFFF00Details! Storage|r: raid difficulty must be heroic or mythic.")
end
end
end
+90
View File
@@ -35,6 +35,8 @@
local CONST_WIPE_CALL = "WI"
local CONST_GUILD_SYNC = "GS"
local CONST_CLOUD_REQUEST = "CR"
local CONST_CLOUD_FOUND = "CF"
local CONST_CLOUD_DATARQ = "CD"
@@ -56,6 +58,8 @@
["WIPE_CALL"] = CONST_WIPE_CALL,
["GUILD_SYNC"] = CONST_GUILD_SYNC,
["MISSDATA_ROGUE_SOULRIP"] = CONST_ROGUE_SR, --soul rip from akaari's soul (LEGION ONLY)
}
@@ -263,6 +267,90 @@
end
end
--guild sync R = someone pressed the sync button
--guild sync L = list of fights IDs
--guild sync G = requested a list of encounters
--guild sync A = received missing encounters, add them
function _detalhes.network.GuildSync (player, realm, core_version, type, data)
local chr_name = Ambiguate (player .. "-" .. realm, "none")
if (UnitName ("player") == chr_name) then
return
end
if (core_version ~= _detalhes.realversion) then
if (core_version > _detalhes.realversion) then
--_detalhes:Msg ("your Details! is out dated and cannot perform the action, please update it.")
end
return false
end
if (type == "R") then --RoS
_detalhes.LastGuildSyncDataTime1 = _detalhes.LastGuildSyncDataTime1 or 0
--build our table and send to the player
if (_detalhes.LastGuildSyncDataTime1 > GetTime()) then
--return false
end
local IDs = _detalhes.storage:GetIDsToGuildSync()
if (IDs [1]) then
local from = UnitName ("player")
local realm = GetRealmName()
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_GUILD_SYNC, from, realm, _detalhes.realversion, "L", IDs), "WHISPER", chr_name)
end
_detalhes.LastGuildSyncDataTime1 = GetTime() + 60
return true
elseif (type == "L") then --RoC
local MissingIDs = _detalhes.storage:CheckMissingIDsToGuildSync (data)
if (MissingIDs [1]) then
local from = UnitName ("player")
local realm = GetRealmName()
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_GUILD_SYNC, from, realm, _detalhes.realversion, "G", MissingIDs), "WHISPER", chr_name)
end
return true
elseif (type == "G") then --RoS
local EncounterData = _detalhes.storage:BuildEncounterDataToGuildSync (data)
if (EncounterData [1]) then
local task = C_Timer.NewTicker (4, function (task)
task.TickID = task.TickID + 1
local data = task.EncounterData [task.TickID]
if (not data) then
task:Cancel()
return
end
local from = UnitName ("player")
local realm = GetRealmName()
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_GUILD_SYNC, from, realm, _detalhes.realversion, "A", data), "WHISPER", task.Target)
if (_detalhes.debug) then
_detalhes:Msg ("(debug) [RoS-EncounterSync] send-task sending data #" .. task.TickID .. ".")
end
end)
task.TickID = 0
task.EncounterData = EncounterData
task.Target = chr_name
end
return true
elseif (type == "A") then --RoC
_detalhes.storage:AddGuildSyncData (data)
return true
end
end
function _detalhes.network.HandleMissData (player, realm, core_version, data)
-- [1] - container
@@ -299,6 +387,8 @@
[CONST_CLOUD_EQUALIZE] = _detalhes.network.Cloud_Equalize,
[CONST_WIPE_CALL] = _detalhes.network.Wipe_Call,
[CONST_GUILD_SYNC] = _detalhes.network.GuildSync,
[CONST_ROGUE_SR] = _detalhes.network.HandleMissData, --soul rip from akaari's soul (LEGION ONLY)
}
+20 -2
View File
@@ -316,7 +316,23 @@
else
link = GetSpellLink (spellid)
end
_detalhes:Msg ("First hit: " .. (link or "") .. " from " .. (who_name or "Unknown"))
--check boss targets
local gotTarget = false
for i = 1, 5 do
local boss = UnitExists ("boss" .. i)
if (boss) then
local target = UnitName ("boss" .. i .. "target")
if (target and type (target) == "string" and not gotTarget) then
_detalhes:Msg ("|cFFFFFF00First hit|r: " .. (link or "") .. " from " .. (who_name or "Unknown") .. " |cFFFFFF00First Boss Target|r: " .. target)
gotTarget = true
end
end
end
if (not gotTarget) then
_detalhes:Msg ("First hit: " .. (link or "") .. " from " .. (who_name or "Unknown"))
end
end
_detalhes:EntrarEmCombate (who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags)
else
@@ -3928,7 +3944,9 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
for i = #_detalhes.schedule_add_to_overall, 1, -1 do
local CombatToAdd = tremove (_detalhes.schedule_add_to_overall, i)
_detalhes.historico:adicionar_overall (CombatToAdd)
if (CombatToAdd) then
_detalhes.historico:adicionar_overall (CombatToAdd)
end
end
end
+235 -12
View File
@@ -1096,7 +1096,7 @@
local db = _detalhes.storage:OpenRaidStorage()
if (not db) then
return _detalhes:Msg ("Fail to open raid storage, may be the addon is disabled.")
return _detalhes:Msg ("Fail to open 'Details Storage', maybe the addon is disabled?")
end
local f = CreateFrame ("frame", "DetailsRaidHistoryWindow", UIParent, "ButtonFrameTemplate")
@@ -1109,17 +1109,115 @@
f:SetHeight (500)
tinsert (UISpecialFrames, "DetailsRaidHistoryWindow")
f.Mode = 1
--wallpaper
local background = f:CreateTexture (nil, "border")
background:SetAlpha (0.3)
background:SetPoint ("topleft", f, "topleft", 6, -65)
background:SetPoint ("bottomright", f, "bottomright", -10, 28)
--separate menu and main list
local div = f:CreateTexture (nil, "artwork")
div:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-MetalBorder-Left]])
div:SetAlpha (0.3)
div:SetPoint ("topleft", f, "topleft", 180, -64)
div:SetHeight (460)
--select history or guild rank
local options_switch_template = _detalhes.gump:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE")
local options_text_template = _detalhes.gump:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")
local options_button_template = _detalhes.gump:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
local select_history = function()
f.GuildRankCheckBox:SetValue (false)
f.HistoryCheckBox:SetValue (true)
f.Mode = 1
_G.DetailsRaidHistoryWindow:Refresh()
end
local select_guildrank = function()
f.HistoryCheckBox:SetValue (false)
f.GuildRankCheckBox:SetValue (true)
DetailsRaidHistoryWindow.select_player:Select (1, true)
f.select_player2:Hide()
f.select_player2_label:Hide()
f.Mode = 2
_G.DetailsRaidHistoryWindow:Refresh()
end
local HistoryCheckBox, HistoryLabel = _detalhes.gump:CreateSwitch (f, select_history, true, 18, 18, "", "", "HistoryCheckBox", nil, nil, nil, nil, "Show History", options_switch_template) --, options_text_template
HistoryLabel:ClearAllPoints()
HistoryCheckBox:ClearAllPoints()
HistoryCheckBox:SetPoint ("topleft", f, "topleft", 100, -34)
HistoryLabel:SetPoint ("left", HistoryCheckBox, "right", 2, 0)
HistoryCheckBox:SetAsCheckBox()
local GuildRankCheckBox, GuildRankLabel = _detalhes.gump:CreateSwitch (f, select_guildrank, false, 18, 18, "", "", "GuildRankCheckBox", nil, nil, nil, nil, "Show Guild Rank", options_switch_template) --, options_text_template
GuildRankLabel:ClearAllPoints()
GuildRankCheckBox:ClearAllPoints()
GuildRankCheckBox:SetPoint ("topleft", f, "topleft", 240, -34)
GuildRankLabel:SetPoint ("left", GuildRankCheckBox, "right", 2, 0)
GuildRankCheckBox:SetAsCheckBox()
local guild_sync = function()
_detalhes.storage:DBGuildSync()
f.GuildSyncButton:Disable()
if (not f.SyncTexture) then
local workingFrame = CreateFrame ("frame", nil, f)
f.WorkingFrame = workingFrame
workingFrame:SetSize (1, 1)
f.SyncTextureBackground = workingFrame:CreateTexture (nil, "border")
f.SyncTextureBackground:SetPoint ("bottomright", f, "bottomright", -5, -1)
f.SyncTextureBackground:SetTexture ([[Interface\COMMON\StreamBackground]])
f.SyncTextureBackground:SetSize (32, 32)
f.SyncTextureCircle = workingFrame:CreateTexture (nil, "artwork")
f.SyncTextureCircle:SetPoint ("center", f.SyncTextureBackground, "center", 0, 0)
f.SyncTextureCircle:SetTexture ([[Interface\COMMON\StreamCircle]])
f.SyncTextureCircle:SetSize (32, 32)
f.SyncTextureGrade = workingFrame:CreateTexture (nil, "overlay")
f.SyncTextureGrade:SetPoint ("center", f.SyncTextureBackground, "center", 0, 0)
f.SyncTextureGrade:SetTexture ([[Interface\COMMON\StreamFrame]])
f.SyncTextureGrade:SetSize (32, 32)
local animationHub = _detalhes.gump:CreateAnimationHub (workingFrame)
animationHub:SetLooping ("Repeat")
f.WorkingAnimation = animationHub
local rotation = _detalhes.gump:CreateAnimation (animationHub, "ROTATION", 1, 3, -360)
rotation:SetTarget (f.SyncTextureCircle)
--_detalhes.gump:CreateAnimation (animationHub, "ALPHA", 1, 0.5, 0, 1)
f.SyncText = workingFrame:CreateFontString (nil, "border", "GameFontNormal")
f.SyncText:SetPoint ("right", f.SyncTextureBackground, "left", 0, 0)
f.SyncText:SetText ("working")
local endAnimationHub = _detalhes.gump:CreateAnimationHub (workingFrame, nil, function() workingFrame:Hide() end)
_detalhes.gump:CreateAnimation (endAnimationHub, "ALPHA", 1, 0.5, 1, 0)
f.EndAnimationHub = endAnimationHub
end
f.WorkingFrame:Show()
f.WorkingAnimation:Play()
C_Timer.NewTicker (10, function (self)
if (not _detalhes.LastGuildSyncReceived) then
f.GuildSyncButton:Enable()
f.EndAnimationHub:Play()
elseif (_detalhes.LastGuildSyncReceived+10 < GetTime()) then
f.GuildSyncButton:Enable()
f.EndAnimationHub:Play()
self:Cancel()
end
end)
end
local GuildSyncButton = _detalhes.gump:CreateButton (f, guild_sync, 130, 20, "Sync With Guild", nil, nil, nil, "GuildSyncButton", nil, nil, options_button_template, options_text_template)
GuildSyncButton:SetPoint ("topright", f, "topright", -20, -34)
GuildSyncButton:SetIcon ([[Interface\GLUES\CharacterSelect\RestoreButton]], 12, 12, "overlay", {0.2, .8, 0.2, .8}, nil, 4)
--
function f:SetBackgroundImage (encounterId)
local instanceId = _detalhes:GetInstanceIdFromEncounterId (encounterId)
if (instanceId) then
@@ -1147,7 +1245,7 @@
end
end)
f.TitleText:SetText ("Raid History")
f.TitleText:SetText ("Details! Raid Ranking")
f.portrait:SetTexture ([[Interface\AddOns\Details\images\icons2]])
f.portrait:SetTexCoord (192/512, 258/512, 322/512, 388/512)
@@ -1170,6 +1268,7 @@
--> select raid:
local on_raid_select = function (_, _, raid)
f:UpdateDropdowns (true)
on_select()
end
local build_raid_list = function()
@@ -1265,7 +1364,7 @@
local player2_dropdown = gump:CreateDropDown (f, build_player2_list, 1, dropdown_size, 20, "select_player2")
local player2_string = gump:CreateLabel (f, "Player:", _, _, "GameFontNormal", "select_player2_label")
function f:UpdateDropdowns()
function f:UpdateDropdowns (DoNotSelectRaid)
--difficulty
wipe (diff_list)
@@ -1277,6 +1376,8 @@
local raid_repeated = {}
local guild_repeated = {}
local raidSelected = DetailsRaidHistoryWindow.select_raid:GetValue()
for difficulty, encounterIdTable in pairs (db) do
if (type (difficulty) == "number") then
@@ -1292,13 +1393,18 @@
if (not boss_repeated [encounterId]) then
local encounter, instance = _detalhes:GetBossEncounterDetailsFromEncounterId (_, encounterId)
if (encounter) then
tinsert (boss_list, {value = encounterId, label = encounter.boss, icon = icon, onclick = on_boss_select})
boss_repeated [encounterId] = true
local InstanceID = _detalhes:GetInstanceIdFromEncounterId (encounterId)
if (raidSelected == InstanceID) then
tinsert (boss_list, {value = encounterId, label = encounter.boss, icon = icon, onclick = on_boss_select})
boss_repeated [encounterId] = true
end
if (not raid_repeated [instance.name]) then
tinsert (raid_list, {value = instance.id, label = instance.name, icon = icon, onclick = on_raid_select})
raid_repeated [instance.name] = true
end
end
end
@@ -1317,13 +1423,49 @@
diff_dropdown:Select (1, true)
boss_dropdown:Refresh()
boss_dropdown:Select (1, true)
raid_dropdown:Refresh()
raid_dropdown:Select (1, true)
if (not DoNotSelectRaid) then
raid_dropdown:Refresh()
raid_dropdown:Select (1, true)
end
guild_dropdown:Refresh()
guild_dropdown:Select (1, true)
end
function f.UpdateBossDropdown()
local raidSelected = DetailsRaidHistoryWindow.select_raid:GetValue()
local boss_repeated = {}
wipe (boss_list)
for difficulty, encounterIdTable in pairs (db) do
if (type (difficulty) == "number") then
if (difficulty == 14) then
tinsert (diff_list, {value = 14, label = "Normal", icon = icon, onclick = on_diff_select})
elseif (difficulty == 15) then
tinsert (diff_list, {value = 15, label = "Heroic", icon = icon, onclick = on_diff_select})
elseif (difficulty == 16) then
tinsert (diff_list, {value = 16, label = "Mythic", icon = icon, onclick = on_diff_select})
end
for encounterId, encounterTable in pairs (encounterIdTable) do
if (not boss_repeated [encounterId]) then
local encounter, instance = _detalhes:GetBossEncounterDetailsFromEncounterId (_, encounterId)
if (encounter) then
local InstanceID = _detalhes:GetInstanceIdFromEncounterId (encounterId)
if (raidSelected == InstanceID) then
tinsert (boss_list, {value = encounterId, label = encounter.boss, icon = icon, onclick = on_boss_select})
boss_repeated [encounterId] = true
end
end
end
end
end
end
boss_dropdown:Refresh()
end
--> anchors:
raid_string:SetPoint ("topleft", f, "topleft", 10, -70)
raid_dropdown:SetPoint ("topleft", f, "topleft", 10, -85)
@@ -1421,11 +1563,86 @@
local fillpanel = gump:NewFillPanel (f, {}, "$parentFP", "fillpanel", 630, 400, false, false, true, nil)
fillpanel:SetPoint ("topleft", f, "topleft", 200, -65)
function f:BuildGuildRankTable (encounterTable, guild, role)
local header = {{name = "Player Name", type = "text"}, {name = "Total", type = "text"}, {name = "Per Second", type = "text"}, {name = "Length", type = "text"}, {name = "Item Level", type = "text"}, {name = "Date", type = "text"}}
local players = {}
local players_index = {}
local playerScore = {}
--get the best of each player
for encounterIndex, encounter in ipairs (encounterTable) do
if (encounter.guild == guild) then
local roleTable = encounter [role]
local date = encounter.date
date = date:gsub (".*%s", "")
date = date:sub (1, -4)
for playerName, playerTable in pairs (roleTable) do
if (not playerScore [playerName]) then
playerScore [playerName] = {
total = 0,
ps = 0,
ilvl = 0,
date = 0,
class = 0,
length = 0,
}
end
local total = playerTable [1]
if (total > playerScore [playerName].total) then
playerScore [playerName].total = total
playerScore [playerName].ps = total / encounter.elapsed
playerScore [playerName].ilvl = playerTable [2]
playerScore [playerName].length = encounter.elapsed
playerScore [playerName].date = date
playerScore [playerName].class = playerTable [3]
end
end
end
end
local sortTable = {}
for playerName, t in pairs (playerScore) do
local className = select (2, GetClassInfo (t.class or 0))
local classColor = "FFFFFFFF"
if (className) then
classColor = RAID_CLASS_COLORS [className] and RAID_CLASS_COLORS [className].colorStr
end
tinsert (sortTable, {
"|c" .. classColor .. playerName .. "|r",
_detalhes:comma_value (t.total),
_detalhes:ToK2 (t.ps),
_detalhes.gump:IntegerToTimer (t.length),
floor (t.ilvl),
t.date,
t.total,
})
end
table.sort (sortTable, function(a, b) return a[7] > b[7] end)
fillpanel:SetFillFunction (function (index) return sortTable [index] end)
fillpanel:SetTotalFunction (function() return #sortTable end)
fillpanel:UpdateRows (header)
fillpanel:Refresh()
end
function f:BuildRaidTable (encounterTable, guild, role)
if (f.Mode == 2) then
f:BuildGuildRankTable (encounterTable, guild, role)
return
end
local header = {{name = "Player Name", type = "text"}} -- , width = 90
local players = {}
local players_index = {}
local player_class = {}
local amt_encounters = 0
for encounterIndex, encounter in ipairs (encounterTable) do
@@ -1445,6 +1662,7 @@
if (not index) then
player = {playerName}
player_class [playerName] = playerTable [3]
for i = 1, amt_encounters-1 do
tinsert (player, "")
end
@@ -1469,19 +1687,20 @@
for i = #playerTable, amt_encounters do
tinsert (playerTable, "")
end
local className = select (2, GetClassInfo (player_class [playerTable [1]] or 0))
if (className) then
local classColor = RAID_CLASS_COLORS [className] and RAID_CLASS_COLORS [className].colorStr
playerTable [1] = "|c" .. classColor .. playerTable [1] .. "|r"
end
end
--_detalhes:DumpTable (players, true)
--table.sort (players, sort_alphabetical)
fillpanel:SetFillFunction (function (index) return players [index] end)
fillpanel:SetTotalFunction (function() return #players end)
fillpanel:UpdateRows (header)
fillpanel:Refresh()
end
function f:Refresh (player_name)
@@ -1495,6 +1714,7 @@
local diffTable = db [diff]
f:SetBackgroundImage (boss)
--_detalhes:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild, _player_base, _player_name)
if (diffTable) then
local encounters = diffTable [boss]
@@ -1555,12 +1775,15 @@
end
_G.DetailsRaidHistoryWindow:UpdateDropdowns()
_G.DetailsRaidHistoryWindow:UpdateDropdowns()
_G.DetailsRaidHistoryWindow:Refresh()
_G.DetailsRaidHistoryWindow:Show()
if (_raid) then
DetailsRaidHistoryWindow.select_raid:Select (_raid)
_G.DetailsRaidHistoryWindow:Refresh()
DetailsRaidHistoryWindow.UpdateBossDropdown()
end
if (_boss) then
DetailsRaidHistoryWindow.select_boss:Select (_boss)