Updated LibOpenRaid and DetailsFramework

This commit is contained in:
Tercio Jose
2022-10-09 19:47:56 -03:00
parent 9974a87119
commit 944178f76f
126 changed files with 15502 additions and 15495 deletions
+127 -127
View File
@@ -10,7 +10,7 @@ local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details")
local CONST_GUILD_SYNC = "GS"
function Details:InitializeRaidHistoryWindow()
local DetailsRaidHistoryWindow = CreateFrame ("frame", "DetailsRaidHistoryWindow", UIParent,"BackdropTemplate")
local DetailsRaidHistoryWindow = CreateFrame("frame", "DetailsRaidHistoryWindow", UIParent,"BackdropTemplate")
DetailsRaidHistoryWindow.Frame = DetailsRaidHistoryWindow
DetailsRaidHistoryWindow.__name = Loc ["STRING_STATISTICS"]
DetailsRaidHistoryWindow.real_name = "DETAILS_STATISTICS"
@@ -33,14 +33,14 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
DetailsRaidHistoryWindow.Initialized = true
local f = DetailsRaidHistoryWindow or CreateFrame ("frame", "DetailsRaidHistoryWindow", UIParent,"BackdropTemplate") --, "ButtonFrameTemplate"
f:SetPoint ("center", UIParent, "center")
local f = DetailsRaidHistoryWindow or CreateFrame("frame", "DetailsRaidHistoryWindow", UIParent,"BackdropTemplate") --, "ButtonFrameTemplate"
f:SetPoint("center", UIParent, "center")
f:SetFrameStrata ("HIGH")
f:SetToplevel (true)
f:SetMovable (true)
f:SetWidth (850)
f:SetHeight (500)
f:SetWidth(850)
f:SetHeight(500)
tinsert (UISpecialFrames, "DetailsRaidHistoryWindow")
function f.OpenDB()
@@ -65,54 +65,54 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
f.Mode = 2
f.bg1 = f:CreateTexture (nil, "background")
f.bg1:SetTexture ([[Interface\AddOns\Details\images\background]], true)
f.bg1 = f:CreateTexture(nil, "background")
f.bg1:SetTexture([[Interface\AddOns\Details\images\background]], true)
f.bg1:SetAlpha (0.7)
f.bg1:SetVertexColor (0.27, 0.27, 0.27)
f.bg1:SetVertTile (true)
f.bg1:SetHorizTile (true)
f.bg1:SetSize (790, 454)
f.bg1:SetSize(790, 454)
f.bg1:SetAllPoints()
f:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true})
f:SetBackdropColor (.5, .5, .5, .5)
f:SetBackdropBorderColor (0, 0, 0, 1)
f:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true})
f:SetBackdropColor(.5, .5, .5, .5)
f:SetBackdropBorderColor(0, 0, 0, 1)
local titlebar = DF:CreateTitleBar(f, "Details! " .. Loc ["STRING_STATISTICS"])
if (not Details:GetTutorialCVar ("HISTORYPANEL_TUTORIAL")) then
local tutorialFrame = CreateFrame ("frame", "$parentTutorialFrame",f,"BackdropTemplate")
tutorialFrame:SetPoint ("center", f, "center")
local tutorialFrame = CreateFrame("frame", "$parentTutorialFrame",f,"BackdropTemplate")
tutorialFrame:SetPoint("center", f, "center")
tutorialFrame:SetFrameStrata ("DIALOG")
tutorialFrame:SetSize (400, 300)
tutorialFrame:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16,
tutorialFrame:SetSize(400, 300)
tutorialFrame:SetBackdrop({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16,
insets = {left = 0, right = 0, top = 0, bottom = 0}, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize=1})
tutorialFrame:SetBackdropColor (0, 0, 0, 1)
tutorialFrame:SetBackdropColor(0, 0, 0, 1)
tutorialFrame.Title = DF:CreateLabel (tutorialFrame, "Statistics" , 12, "orange") --curse localization isn't adding new strings (and I deleted the old one)
tutorialFrame.Title:SetPoint ("top", tutorialFrame, "top", 0, -5)
tutorialFrame.Title = DF:CreateLabel(tutorialFrame, "Statistics" , 12, "orange") --curse localization isn't adding new strings (and I deleted the old one)
tutorialFrame.Title:SetPoint("top", tutorialFrame, "top", 0, -5)
tutorialFrame.Desc = DF:CreateLabel (tutorialFrame, Loc ["STRING_GUILDDAMAGERANK_TUTORIAL_DESC"], 12)
tutorialFrame.Desc = DF:CreateLabel(tutorialFrame, Loc ["STRING_GUILDDAMAGERANK_TUTORIAL_DESC"], 12)
tutorialFrame.Desc.width = 370
tutorialFrame.Desc:SetPoint ("topleft", tutorialFrame, "topleft", 10, -45)
tutorialFrame.Desc:SetPoint("topleft", tutorialFrame, "topleft", 10, -45)
local closeButton = DF:CreateButton (tutorialFrame, function() Details:SetTutorialCVar ("HISTORYPANEL_TUTORIAL", true); tutorialFrame:Hide() end, 80, 20, Loc ["STRING_OPTIONS_CHART_CLOSE"])
closeButton:SetPoint ("bottom", tutorialFrame, "bottom", 0, 10)
closeButton:SetPoint("bottom", tutorialFrame, "bottom", 0, 10)
closeButton:SetTemplate (DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"))
end
--> background
local background = f:CreateTexture ("$parentBackgroundImage", "border")
--background
local background = f:CreateTexture("$parentBackgroundImage", "border")
background:SetAlpha (0.3)
background:SetPoint ("topleft", f, "topleft", 6, -65)
background:SetPoint ("bottomright", f, "bottomright", -10, 28)
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]])
--separate menu and main list
local div = f:CreateTexture(nil, "artwork")
div:SetTexture([[Interface\ACHIEVEMENTFRAME\UI-Achievement-MetalBorder-Left]])
div:SetAlpha (0.1)
div:SetPoint ("topleft", f, "topleft", 180, -64)
div:SetHeight (574)
div:SetPoint("topleft", f, "topleft", 180, -64)
div:SetHeight(574)
--select history or guild rank
local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE")
@@ -120,16 +120,16 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
local selectKillTimeline = function()
f.GuildRankCheckBox:SetValue (false)
f.HistoryCheckBox:SetValue (true)
f.GuildRankCheckBox:SetValue(false)
f.HistoryCheckBox:SetValue(true)
f.Mode = 1
_G.DetailsRaidHistoryWindow:Refresh()
f.ReportButton:Hide()
end
local selectGuildRank = function()
f.HistoryCheckBox:SetValue (false)
f.GuildRankCheckBox:SetValue (true)
f.HistoryCheckBox:SetValue(false)
f.GuildRankCheckBox:SetValue(true)
_G.DetailsRaidHistoryWindow.select_player:Select (1, true)
f.select_player2:Hide()
f.select_player2_label:Hide()
@@ -142,19 +142,19 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
local HistoryCheckBox, HistoryLabel = DF:CreateSwitch (f, selectKillTimeline, false, 18, 18, "", "", "HistoryCheckBox", nil, nil, nil, nil, Loc ["STRING_GUILDDAMAGERANK_SHOWHISTORY"], 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:SetPoint("topleft", f, "topleft", 100, -34)
HistoryLabel:SetPoint("left", HistoryCheckBox, "right", 2, 0)
HistoryCheckBox:SetAsCheckBox()
--guildrank
local GuildRankCheckBox, GuildRankLabel = DF:CreateSwitch (f, selectGuildRank, true, 18, 18, "", "", "GuildRankCheckBox", nil, nil, nil, nil, Loc ["STRING_GUILDDAMAGERANK_SHOWRANK"], 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:SetPoint("topleft", f, "topleft", 240, -34)
GuildRankLabel:SetPoint("left", GuildRankCheckBox, "right", 2, 0)
GuildRankCheckBox:SetAsCheckBox()
--> guild sync
--guild sync
local doGuildSync = function()
f.RequestedAmount = 0
f.DownloadedAmount = 0
@@ -166,35 +166,35 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
f.GuildSyncButton:Disable()
if (not f.SyncTexture) then
local workingFrame = CreateFrame ("frame", nil, f,"BackdropTemplate")
local workingFrame = CreateFrame("frame", nil, f,"BackdropTemplate")
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)
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 = DF:CreateAnimationHub (workingFrame)
animationHub:SetLooping ("Repeat")
f.WorkingAnimation = animationHub
local rotation = DF:CreateAnimation (animationHub, "ROTATION", 1, 3, -360)
local rotation = DF:CreateAnimation(animationHub, "ROTATION", 1, 3, -360)
rotation:SetTarget (f.SyncTextureCircle)
f.SyncText = workingFrame:CreateFontString (nil, "border", "GameFontNormal")
f.SyncText:SetPoint ("right", f.SyncTextureBackground, "left", 0, 0)
f.SyncText:SetText ("working")
f.SyncText:SetPoint("right", f.SyncTextureBackground, "left", 0, 0)
f.SyncText:SetText("working")
local endAnimationHub = DF:CreateAnimationHub (workingFrame, nil, function() workingFrame:Hide() end)
DF:CreateAnimation (endAnimationHub, "ALPHA", 1, 0.5, 1, 0)
DF:CreateAnimation(endAnimationHub, "ALPHA", 1, 0.5, 1, 0)
f.EndAnimationHub = endAnimationHub
end
@@ -215,10 +215,10 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
end
local GuildSyncButton = DF:CreateButton (f, doGuildSync, 130, 20, Loc ["STRING_GUILDDAMAGERANK_SYNCBUTTONTEXT"], nil, nil, nil, "GuildSyncButton", nil, nil, options_button_template, options_text_template)
GuildSyncButton:SetPoint ("topright", f, "topright", -20, -34)
GuildSyncButton:SetPoint("topright", f, "topright", -20, -34)
GuildSyncButton:SetIcon ([[Interface\GLUES\CharacterSelect\RestoreButton]], 12, 12, "overlay", {0.2, .8, 0.2, .8}, nil, 4)
--> listen to comm events
--listen to comm events
local eventListener = Details:CreateEventListener()
function eventListener:OnCommReceived (event, length, prefix, playerName, realmName, detailsVersion, guildSyncID, data)
@@ -239,7 +239,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
f.DownloadedSize = f.DownloadedSize + length
local downloadSpeed = f.DownloadedSize / (time() - f.SyncStartTime)
f.SyncText:SetText ("working [downloading " .. f.DownloadedAmount .. "/" .. f.RequestedAmount .. ", " .. format ("%.2f", downloadSpeed/1024) .. "Kbps]")
f.SyncText:SetText("working [downloading " .. f.DownloadedAmount .. "/" .. f.RequestedAmount .. ", " .. format ("%.2f", downloadSpeed/1024) .. "Kbps]")
end
end
end
@@ -252,7 +252,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
--requested to download a selected list of encounter tables
elseif (guildSyncID == "G") then
f.RequestedAmount = f.RequestedAmount + #missingIDs
f.SyncText:SetText ("working [downloading " .. f.DownloadedAmount .. "/" .. f.RequestedAmount .. "]")
f.SyncText:SetText("working [downloading " .. f.DownloadedAmount .. "/" .. f.RequestedAmount .. "]")
end
end
end
@@ -260,7 +260,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
eventListener:RegisterEvent ("COMM_EVENT_RECEIVED", "OnCommReceived")
eventListener:RegisterEvent ("COMM_EVENT_SENT", "OnCommSent")
--> report results
--report results
function f.BuildReport()
if (f.LatestResourceTable) then
local reportFunc = function(IsCurrent, IsReverse, AmtLines)
@@ -291,7 +291,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
end
local ReportButton = DF:CreateButton (f, f.BuildReport, 130, 20, Loc ["STRING_OPTIONS_REPORT_ANCHOR"]:gsub (":", ""), nil, nil, nil, "ReportButton", nil, nil, options_button_template, options_text_template)
ReportButton:SetPoint ("right", GuildSyncButton, "left", -2, 0)
ReportButton:SetPoint("right", GuildSyncButton, "left", -2, 0)
ReportButton:SetIcon ([[Interface\GLUES\CharacterSelect\RestoreButton]], 12, 12, "overlay", {0.2, .8, 0.2, .8}, nil, 4)
--
@@ -313,8 +313,8 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
end
end
--> window script handlers
f:SetScript ("OnMouseDown", function(self, button)
--window script handlers
f:SetScript("OnMouseDown", function(self, button)
if (self.isMoving) then
return
end
@@ -326,15 +326,15 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
end
end)
f:SetScript ("OnMouseUp", function(self, button)
f:SetScript("OnMouseUp", function(self, button)
if (self.isMoving and button == "LeftButton") then
self:StopMovingOrSizing()
self.isMoving = nil
end
end)
f:SetScript ("OnHide", function()
--> save latest shown state
f:SetScript("OnHide", function()
--save latest shown state
f.LatestSelection = f.LatestSelection or {}
f.LatestSelection.Raid = DetailsRaidHistoryWindow.select_raid.value
f.LatestSelection.Boss = DetailsRaidHistoryWindow.select_boss.value
@@ -362,7 +362,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
end
end
--> select raid:
--select raid:
local onRaidSelect = function(_, _, raid)
Details.rank_window.last_raid = raid
f:UpdateDropdowns (true)
@@ -372,10 +372,10 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
return raidList
end
local raid_dropdown = DF:CreateDropDown (f, buildRaidList, 1, dropdownWidth, 20, "select_raid")
local raid_string = DF:CreateLabel (f, Loc ["STRING_GUILDDAMAGERANK_RAID"] .. ":", _, _, "GameFontNormal", "select_raid_label")
local raid_string = DF:CreateLabel(f, Loc ["STRING_GUILDDAMAGERANK_RAID"] .. ":", _, _, "GameFontNormal", "select_raid_label")
raid_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
--> select boss:
--select boss:
local on_boss_select = function(_, _, boss)
on_select()
end
@@ -383,10 +383,10 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
return bossList
end
local boss_dropdown = DF:CreateDropDown (f, build_boss_list, 1, dropdownWidth, 20, "select_boss")
local boss_string = DF:CreateLabel (f, Loc ["STRING_GUILDDAMAGERANK_BOSS"] .. ":", _, _, "GameFontNormal", "select_boss_label")
local boss_string = DF:CreateLabel(f, Loc ["STRING_GUILDDAMAGERANK_BOSS"] .. ":", _, _, "GameFontNormal", "select_boss_label")
boss_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
--> select difficulty:
--select difficulty:
local on_diff_select = function(_, _, diff)
Details.rank_window.last_difficulty = diff
on_select()
@@ -396,10 +396,10 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
return difficultyList
end
local diff_dropdown = DF:CreateDropDown (f, build_diff_list, 1, dropdownWidth, 20, "select_diff")
local diff_string = DF:CreateLabel (f, Loc ["STRING_GUILDDAMAGERANK_DIFF"] .. ":", _, _, "GameFontNormal", "select_diff_label")
local diff_string = DF:CreateLabel(f, Loc ["STRING_GUILDDAMAGERANK_DIFF"] .. ":", _, _, "GameFontNormal", "select_diff_label")
diff_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
--> select role:
--select role:
local on_role_select = function(_, _, role)
on_select()
end
@@ -410,10 +410,10 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
}
end
local role_dropdown = DF:CreateDropDown (f, build_role_list, 1, dropdownWidth, 20, "select_role")
local role_string = DF:CreateLabel (f, Loc ["STRING_GUILDDAMAGERANK_ROLE"] .. ":", _, _, "GameFontNormal", "select_role_label")
local role_string = DF:CreateLabel(f, Loc ["STRING_GUILDDAMAGERANK_ROLE"] .. ":", _, _, "GameFontNormal", "select_role_label")
role_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
--> select guild:
--select guild:
local on_guild_select = function(_, _, guild)
on_select()
end
@@ -421,10 +421,10 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
return guildList
end
local guild_dropdown = DF:CreateDropDown (f, build_guild_list, 1, dropdownWidth, 20, "select_guild")
local guild_string = DF:CreateLabel (f, Loc ["STRING_GUILDDAMAGERANK_GUILD"] .. ":", _, _, "GameFontNormal", "select_guild_label")
local guild_string = DF:CreateLabel(f, Loc ["STRING_GUILDDAMAGERANK_GUILD"] .. ":", _, _, "GameFontNormal", "select_guild_label")
guild_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
--> select playerbase:
--select playerbase:
local on_player_select = function(_, _, player)
on_select()
end
@@ -435,10 +435,10 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
}
end
local player_dropdown = DF:CreateDropDown (f, build_player_list, 1, dropdownWidth, 20, "select_player")
local player_string = DF:CreateLabel (f, Loc ["STRING_GUILDDAMAGERANK_PLAYERBASE"] .. ":", _, _, "GameFontNormal", "select_player_label")
local player_string = DF:CreateLabel(f, Loc ["STRING_GUILDDAMAGERANK_PLAYERBASE"] .. ":", _, _, "GameFontNormal", "select_player_label")
player_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
--> select player:
--select player:
local onPlayer2Select = function(_, _, player)
f.latest_player_selected = player
f:BuildPlayerTable (player)
@@ -448,7 +448,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
local t = {}
local alreadyListed = {}
if (encounterTable) then
for encounterIndex, encounter in ipairs (encounterTable) do
for encounterIndex, encounter in ipairs(encounterTable) do
if (encounter.guild == guild) then
local roleTable = encounter [role]
for playerName, _ in pairs (roleTable) do
@@ -465,7 +465,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
return t
end
local player2_dropdown = DF:CreateDropDown (f, build_player2_list, 1, dropdownWidth, 20, "select_player2")
local player2_string = DF:CreateLabel (f, Loc ["STRING_GUILDDAMAGERANK_PLAYERBASE_PLAYER"] .. ":", _, _, "GameFontNormal", "select_player2_label")
local player2_string = DF:CreateLabel(f, Loc ["STRING_GUILDDAMAGERANK_PLAYERBASE_PLAYER"] .. ":", _, _, "GameFontNormal", "select_player2_label")
player2_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
function f:UpdateDropdowns(DoNotSelectRaid)
@@ -510,7 +510,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
elseif (difficulty == 16) then
local alreadyHave = false
for i, t in ipairs (difficultyList) do
for i, t in ipairs(difficultyList) do
if (t.label == "Mythic") then
alreadyHave = true
end
@@ -540,7 +540,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
end
end
for index, encounter in ipairs (encounterTable) do
for index, encounter in ipairs(encounterTable) do
local guild = encounter.guild
if (not guildRepeated [guild]) then
tinsert (guildList, {value = guild, label = guild, icon = icon, onclick = on_guild_select})
@@ -578,13 +578,13 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
wipe (bossList)
for difficulty, encounterIdTable in pairs (db) do
if (type (difficulty) == "number") then
if (type(difficulty) == "number") then
if (difficulty == 14) then
--tinsert (difficultyList, {value = 14, label = "Normal", icon = icon, onclick = on_diff_select})
--print ("has normal encounter")
elseif (difficulty == 15) then
local alreadyHave = false
for i, t in ipairs (difficultyList) do
for i, t in ipairs(difficultyList) do
if (t.label == "Heroic") then
alreadyHave = true
end
@@ -594,7 +594,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
end
elseif (difficulty == 16) then
local alreadyHave = false
for i, t in ipairs (difficultyList) do
for i, t in ipairs(difficultyList) do
if (t.label == "Mythic") then
alreadyHave = true
end
@@ -636,39 +636,39 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
boss_dropdown:Refresh()
end
--> anchors:
raid_string:SetPoint ("topleft", f, "topleft", 10, -70)
raid_dropdown:SetPoint ("topleft", f, "topleft", 10, -85)
--anchors:
raid_string:SetPoint("topleft", f, "topleft", 10, -70)
raid_dropdown:SetPoint("topleft", f, "topleft", 10, -85)
boss_string:SetPoint ("topleft", f, "topleft", 10, -110)
boss_dropdown:SetPoint ("topleft", f, "topleft", 10, -125)
boss_string:SetPoint("topleft", f, "topleft", 10, -110)
boss_dropdown:SetPoint("topleft", f, "topleft", 10, -125)
diff_string:SetPoint ("topleft", f, "topleft", 10, -150)
diff_dropdown:SetPoint ("topleft", f, "topleft", 10, -165)
diff_string:SetPoint("topleft", f, "topleft", 10, -150)
diff_dropdown:SetPoint("topleft", f, "topleft", 10, -165)
role_string:SetPoint ("topleft", f, "topleft", 10, -190)
role_dropdown:SetPoint ("topleft", f, "topleft", 10, -205)
role_string:SetPoint("topleft", f, "topleft", 10, -190)
role_dropdown:SetPoint("topleft", f, "topleft", 10, -205)
guild_string:SetPoint ("topleft", f, "topleft", 10, -230)
guild_dropdown:SetPoint ("topleft", f, "topleft", 10, -245)
guild_string:SetPoint("topleft", f, "topleft", 10, -230)
guild_dropdown:SetPoint("topleft", f, "topleft", 10, -245)
player_string:SetPoint ("topleft", f, "topleft", 10, -270)
player_dropdown:SetPoint ("topleft", f, "topleft", 10, -285)
player_string:SetPoint("topleft", f, "topleft", 10, -270)
player_dropdown:SetPoint("topleft", f, "topleft", 10, -285)
player2_string:SetPoint ("topleft", f, "topleft", 10, -310)
player2_dropdown:SetPoint ("topleft", f, "topleft", 10, -325)
player2_string:SetPoint("topleft", f, "topleft", 10, -310)
player2_dropdown:SetPoint("topleft", f, "topleft", 10, -325)
player2_string:Hide()
player2_dropdown:Hide()
--> refresh the window:
--refresh the window:
function f:BuildPlayerTable (playerName)
local encounterTable, guild, role = unpack (f.build_player2_data or {})
local data = {}
if (type (playerName) == "string" and string.len (playerName) > 1) then
for encounterIndex, encounter in ipairs (encounterTable) do
if (type(playerName) == "string" and string.len (playerName) > 1) then
for encounterIndex, encounter in ipairs(encounterTable) do
if (encounter.guild == guild) then
local roleTable = encounter [role]
@@ -687,7 +687,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
end
end
--> update graphic
--update graphic
if (not f.gframe) then
local onenter = function(self)
@@ -707,7 +707,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
GameCooltip:Hide()
end
f.gframe = DF:CreateGFrame (f, 650, 400, 35, onenter, onleave, "gframe", "$parentGF")
f.gframe:SetPoint ("topleft", f, "topleft", 190, -65)
f.gframe:SetPoint("topleft", f, "topleft", 190, -65)
end
f.gframe:Reset()
@@ -717,7 +717,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
end
local fillpanel = DF:NewFillPanel (f, {}, "$parentFP", "fillpanel", 710, 501, false, false, true, nil)
fillpanel:SetPoint ("topleft", f, "topleft", 195, -65)
fillpanel:SetPoint("topleft", f, "topleft", 195, -65)
function f:BuildGuildRankTable (encounterTable, guild, role)
@@ -729,7 +729,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
local playerScore = {}
--get the best of each player
for encounterIndex, encounter in ipairs (encounterTable) do
for encounterIndex, encounter in ipairs(encounterTable) do
if (encounter.guild == guild) then
local roleTable = encounter [role]
@@ -789,7 +789,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
table.sort (sortTable, function(a, b) return a[8] > b[8] end)
--> add the number before the player name
--add the number before the player name
for i = 1, #sortTable do
local t = sortTable [i]
t [1] = i .. ". " .. t [1]
@@ -816,7 +816,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
local player_class = {}
local amt_encounters = 0
for encounterIndex, encounter in ipairs (encounterTable) do
for encounterIndex, encounter in ipairs(encounterTable) do
if (encounter.guild == guild) then
local roleTable = encounter [role]
@@ -854,10 +854,10 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
end
end
--> sort alphabetical
--sort alphabetical
table.sort (players, function(a, b) return a[1] < b[1] end)
for index, playerTable in ipairs (players) do
for index, playerTable in ipairs(players) do
for i = #playerTable, amt_encounters do
tinsert (playerTable, "")
end
@@ -876,11 +876,11 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
fillpanel:UpdateRows (header)
fillpanel:Refresh()
fillpanel:SetPoint ("topleft", f, "topleft", 200, -65)
fillpanel:SetPoint("topleft", f, "topleft", 200, -65)
end
function f:Refresh (player_name)
--> build the main table
--build the main table
local diff = diff_dropdown.value
local boss = boss_dropdown.value
local role = role_dropdown.value
@@ -895,7 +895,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
if (diffTable) then
local encounters = diffTable [boss]
if (encounters) then
if (player == 1) then --> raid
if (player == 1) then --raid
fillpanel:Show()
if (f.gframe) then
f.gframe:Hide()
@@ -904,7 +904,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
player2_dropdown:Hide()
f:BuildRaidTable (encounters, guild, role)
elseif (player == 2) then --> only one player
elseif (player == 2) then --only one player
fillpanel:Hide()
if (f.gframe) then
f.gframe:Show()
@@ -925,7 +925,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
f:BuildPlayerTable (player2_dropdown.value)
end
else
if (player == 1) then --> raid
if (player == 1) then --raid
fillpanel:Show()
if (f.gframe) then
f.gframe:Hide()
@@ -934,7 +934,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
player2_dropdown:Hide()
f:BuildRaidTable ({}, guild, role)
elseif (player == 2) then --> only one player
elseif (player == 2) then --only one player
fillpanel:Hide()
if (f.gframe) then
f.gframe:Show()
@@ -955,8 +955,8 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
local statsWindow = _G.DetailsRaidHistoryWindow
--> table means some button send the request - nil for other ways
if (type (_raid) == "table" or (not _raid and not _boss and not _difficulty and not _role and not _guild and not _player_base and not _player_name)) then
--table means some button send the request - nil for other ways
if (type(_raid) == "table" or (not _raid and not _boss and not _difficulty and not _role and not _guild and not _player_base and not _player_name)) then
local f = statsWindow
if (f.LatestSelection) then
_raid = f.LatestSelection.Raid
@@ -997,12 +997,12 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
statsWindow.Mode = _history_type
if (statsWindow.Mode == 1) then
--overall
statsWindow.HistoryCheckBox:SetValue (true)
statsWindow.GuildRankCheckBox:SetValue (false)
statsWindow.HistoryCheckBox:SetValue(true)
statsWindow.GuildRankCheckBox:SetValue(false)
elseif (statsWindow.Mode == 2) then
--guild rank
statsWindow.GuildRankCheckBox:SetValue (true)
statsWindow.HistoryCheckBox:SetValue (false)
statsWindow.GuildRankCheckBox:SetValue(true)
statsWindow.HistoryCheckBox:SetValue(false)
end
end
@@ -1028,7 +1028,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild
end
if (_guild) then
if (type (_guild) == "boolean") then
if (type(_guild) == "boolean") then
_guild = GetGuildInfo ("player")
end
statsWindow.select_guild:Select (_guild)