diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index d31e794b..dbb8c19c 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -1985,17 +1985,25 @@ local SimplePanel_frame_backdrop_border_color = {0, 0, 0, 1} function DF:CreateScaleBar (frame, config) local scaleBar, text = DF:CreateSlider (frame, 120, 14, 0.6, 1.6, 0.1, config.scale, true, "ScaleBar", nil, "Scale:", DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE"), DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")) scaleBar.thumb:SetWidth(24) + scaleBar:SetValueStep(0.1) + scaleBar:SetObeyStepOnDrag() + scaleBar.mouseDown = false text:SetPoint ("topleft", frame, "topleft", 12, -7) scaleBar:SetFrameLevel (DF.FRAMELEVEL_OVERLAY) scaleBar.OnValueChanged = function (_, _, value) - config.scale = value - if (not scaleBar.IsValueChanging) then - frame:SetScale (config.scale) + if (scaleBar.mouseDown) then + config.scale = value end end + + scaleBar:SetHook ("OnMouseDown", function() + scaleBar.mouseDown = true + end) + scaleBar:SetHook ("OnMouseUp", function() - frame:SetScale (config.scale) + frame:SetScale(config.scale) + scaleBar.mouseDown = false end) scaleBar:SetAlpha (0.70) diff --git a/frames/window_statistics.lua b/frames/window_statistics.lua index 90d9fb30..381835b0 100644 --- a/frames/window_statistics.lua +++ b/frames/window_statistics.lua @@ -21,7 +21,7 @@ function Details:InitializeRaidHistoryWindow() function DetailsRaidHistoryWindow.RefreshWindow() Details:OpenRaidHistoryWindow() - C_Timer.After(3, function() + C_Timer.After(1, function() Details:OpenRaidHistoryWindow() end) end @@ -30,12 +30,7 @@ end function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild, _player_base, _player_name, _history_type) if (not DetailsRaidHistoryWindow or not DetailsRaidHistoryWindow.Initialized) then - - local db = Details.storage:OpenRaidStorage() - if (not db) then - return Details:Msg (Loc ["STRING_GUILDDAMAGERANK_DATABASEERROR"]) - end - + DetailsRaidHistoryWindow.Initialized = true local f = DetailsRaidHistoryWindow or CreateFrame ("frame", "DetailsRaidHistoryWindow", UIParent,"BackdropTemplate") --, "ButtonFrameTemplate" @@ -47,9 +42,29 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild f:SetWidth (850) f:SetHeight (500) tinsert (UISpecialFrames, "DetailsRaidHistoryWindow") - + + function f.OpenDB() + local db = Details.storage:OpenRaidStorage() + if (not db) then + Details:Msg(Loc ["STRING_GUILDDAMAGERANK_DATABASEERROR"]) + return + end + return db + end + + local db = f.OpenDB() + if (not db) then + return + end + + C_Timer.After(8, function() + --if (f:IsShown()) then + -- return Details:OpenRaidHistoryWindow(_raid, _boss, _difficulty, _role, _guild, _player_base, _player_name, _history_type) + --end + end) + f.Mode = 2 - + f.bg1 = f:CreateTexture (nil, "background") f.bg1:SetTexture ([[Interface\AddOns\Details\images\background]], true) f.bg1:SetAlpha (0.7) @@ -62,50 +77,8 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild 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) - - --> menu title bar - --[=[]] - local titlebar = CreateFrame ("frame", nil, f,"BackdropTemplate") - titlebar:SetPoint ("topleft", f, "topleft", 2, -3) - titlebar:SetPoint ("topright", f, "topright", -2, -3) - titlebar:SetHeight (20) - titlebar:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true}) - titlebar:SetBackdropColor (.5, .5, .5, 1) - titlebar:SetBackdropBorderColor (0, 0, 0, 1) - --]=] - local titlebar = DF:CreateTitleBar(f, "Details! " .. Loc ["STRING_STATISTICS"]) - - --> menu title - -- local titleLabel = DF:NewLabel (titlebar, titlebar, nil, "titulo", "Details! " .. Loc ["STRING_STATISTICS"], "GameFontNormal", 12) --{227/255, 186/255, 4/255} - -- titleLabel:SetPoint ("center", titlebar , "center") - -- titleLabel:SetPoint ("top", titlebar , "top", 0, -4) - - --> close button - --[=[]] - f.Close = CreateFrame ("button", "$parentCloseButton", f) - f.Close:SetPoint ("right", titlebar, "right", -2, 0) - f.Close:SetSize (16, 16) - - f.Close:SetNormalTexture (DF.folder .. "icons") - f.Close:SetHighlightTexture (DF.folder .. "icons") - f.Close:SetPushedTexture (DF.folder .. "icons") - - f.Close:GetNormalTexture():SetTexCoord (0, 16/128, 0, 1) - f.Close:GetHighlightTexture():SetTexCoord (0, 16/128, 0, 1) - f.Close:GetPushedTexture():SetTexCoord (0, 16/128, 0, 1) - f.Close:SetAlpha (0.7) - f.Close:SetScript ("OnClick", function() f:Hide() end) ---]=] - --[=[]] - local closeButton = CreateFrame("button", "DetailsStatisticsWindowCloseButton", titlebar, "UIPanelCloseButton") - closeButton:SetWidth(32) - closeButton:SetHeight(32) - closeButton:SetText("X") - closeButton:SetFrameLevel(closeButton:GetFrameLevel()+2) - - f.Close = closeButton ---]=] + local titlebar = DF:CreateTitleBar(f, "Details! " .. Loc ["STRING_STATISTICS"]) if (not Details:GetTutorialCVar ("HISTORYPANEL_TUTORIAL")) then local tutorialFrame = CreateFrame ("frame", "$parentTutorialFrame",f,"BackdropTemplate") @@ -128,36 +101,36 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild closeButton:SetTemplate (DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")) end - --wallpaper + --> 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) - --separate menu and main list + --> 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) - + --select history or guild rank local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE") local options_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE") local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE") - - local select_history = function() + + local selectKillTimeline = function() f.GuildRankCheckBox:SetValue (false) f.HistoryCheckBox:SetValue (true) f.Mode = 1 _G.DetailsRaidHistoryWindow:Refresh() f.ReportButton:Hide() end - - local select_guildrank = function() + + local selectGuildRank = function() f.HistoryCheckBox:SetValue (false) f.GuildRankCheckBox:SetValue (true) - DetailsRaidHistoryWindow.select_player:Select (1, true) + _G.DetailsRaidHistoryWindow.select_player:Select (1, true) f.select_player2:Hide() f.select_player2_label:Hide() f.Mode = 2 @@ -165,86 +138,86 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild f.ReportButton:Show() end - local HistoryCheckBox, HistoryLabel = DF:CreateSwitch (f, select_history, false, 18, 18, "", "", "HistoryCheckBox", nil, nil, nil, nil, Loc ["STRING_GUILDDAMAGERANK_SHOWHISTORY"], options_switch_template) --, options_text_template + --kill timeline + 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:SetAsCheckBox() - - local GuildRankCheckBox, GuildRankLabel = DF:CreateSwitch (f, select_guildrank, true, 18, 18, "", "", "GuildRankCheckBox", nil, nil, nil, nil, Loc ["STRING_GUILDDAMAGERANK_SHOWRANK"], options_switch_template) --, options_text_template + + --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:SetAsCheckBox() - - local guild_sync = function() - - f.RequestedAmount = 0 - f.DownloadedAmount = 0 - f.EstimateSize = 0 - f.DownloadedSize = 0 - f.SyncStartTime = time() - - Details.storage:DBGuildSync() - f.GuildSyncButton:Disable() - - if (not f.SyncTexture) then - 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) - - local animationHub = DF:CreateAnimationHub (workingFrame) - animationHub:SetLooping ("Repeat") - f.WorkingAnimation = animationHub - - local rotation = DF:CreateAnimation (animationHub, "ROTATION", 1, 3, -360) - rotation:SetTarget (f.SyncTextureCircle) - --DF: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 = DF:CreateAnimationHub (workingFrame, nil, function() workingFrame:Hide() end) - DF: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 Details.LastGuildSyncReceived) then - f.GuildSyncButton:Enable() - f.EndAnimationHub:Play() - elseif (Details.LastGuildSyncReceived+10 < GetTime()) then - f.GuildSyncButton:Enable() - f.EndAnimationHub:Play() - self:Cancel() + --> guild sync + local doGuildSync = function() + f.RequestedAmount = 0 + f.DownloadedAmount = 0 + f.EstimateSize = 0 + f.DownloadedSize = 0 + f.SyncStartTime = time() + + Details.storage:DBGuildSync() + f.GuildSyncButton:Disable() + + if (not f.SyncTexture) then + 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) + + local animationHub = DF:CreateAnimationHub (workingFrame) + animationHub:SetLooping ("Repeat") + f.WorkingAnimation = animationHub + + 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") + + local endAnimationHub = DF:CreateAnimationHub (workingFrame, nil, function() workingFrame:Hide() end) + DF:CreateAnimation (endAnimationHub, "ALPHA", 1, 0.5, 1, 0) + f.EndAnimationHub = endAnimationHub end - end) - - end - - local GuildSyncButton = DF:CreateButton (f, guild_sync, 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:SetIcon ([[Interface\GLUES\CharacterSelect\RestoreButton]], 12, 12, "overlay", {0.2, .8, 0.2, .8}, nil, 4) - + + f.WorkingFrame:Show() + f.WorkingAnimation:Play() + + C_Timer.NewTicker (10, function(self) + if (not Details.LastGuildSyncReceived) then + f.GuildSyncButton:Enable() + f.EndAnimationHub:Play() + + elseif (Details.LastGuildSyncReceived+10 < GetTime()) then + f.GuildSyncButton:Enable() + f.EndAnimationHub:Play() + self:Cancel() + end + end) + 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:SetIcon ([[Interface\GLUES\CharacterSelect\RestoreButton]], 12, 12, "overlay", {0.2, .8, 0.2, .8}, nil, 4) + --> listen to comm events local eventListener = Details:CreateEventListener() @@ -252,7 +225,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild if (prefix == CONST_GUILD_SYNC) then --received a list of encounter IDs if (guildSyncID == "L") then - + --received one encounter table elseif (guildSyncID == "A") then if (not f.RequestedAmount) then @@ -260,23 +233,22 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild return end f.DownloadedAmount = (f.DownloadedAmount or 0) + 1 - + --size = 1 byte per characters in the string f.EstimateSize = length * f.RequestedAmount > f.EstimateSize and length * f.RequestedAmount or f.RequestedAmount f.DownloadedSize = f.DownloadedSize + length - local downloadSpeed = f.DownloadedSize / (time() - f.SyncStartTime) - + local downloadSpeed = f.DownloadedSize / (time() - f.SyncStartTime) + f.SyncText:SetText ("working [downloading " .. f.DownloadedAmount .. "/" .. f.RequestedAmount .. ", " .. format ("%.2f", downloadSpeed/1024) .. "Kbps]") end end end - - function eventListener:OnCommSent (event, length, prefix, playerName, realmName, detailsVersion, guildSyncID, missingIDs, arg8, arg9) + + function eventListener:OnCommSent(event, length, prefix, playerName, realmName, detailsVersion, guildSyncID, missingIDs, arg8, arg9) if (prefix == CONST_GUILD_SYNC) then --requested a list of encounters if (guildSyncID == "R") then - - + --requested to download a selected list of encounter tables elseif (guildSyncID == "G") then f.RequestedAmount = f.RequestedAmount + #missingIDs @@ -284,43 +256,43 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild end end end - + eventListener:RegisterEvent ("COMM_EVENT_RECEIVED", "OnCommReceived") eventListener:RegisterEvent ("COMM_EVENT_SENT", "OnCommSent") - - function f.BuildReport() - if (f.LatestResourceTable) then - local reportFunc = function (IsCurrent, IsReverse, AmtLines) - local bossName = f.select_boss.label:GetText() - local bossDiff = f.select_diff.label:GetText() - local guildName = f.select_guild.label:GetText() - - local reportTable = {"Details!: DPS Rank for: " .. (bossDiff or "") .. " " .. (bossName or "--x--x--") .. " <" .. (guildName or "") .. ">"} - local result = {} - - for i = 1, AmtLines do - if (f.LatestResourceTable[i]) then - local playerName = f.LatestResourceTable[i][1] - playerName = playerName:gsub ("%|c%x%x%x%x%x%x%x%x", "") - playerName = playerName:gsub ("%|r", "") - playerName = playerName:gsub (".*%s", "") - tinsert (result, {playerName, f.LatestResourceTable[i][2]}) - else - break + + --> report results + function f.BuildReport() + if (f.LatestResourceTable) then + local reportFunc = function (IsCurrent, IsReverse, AmtLines) + local bossName = f.select_boss.label:GetText() + local bossDiff = f.select_diff.label:GetText() + local guildName = f.select_guild.label:GetText() + local reportTable = {"Details!: DPS Rank for: " .. (bossDiff or "") .. " " .. (bossName or "--x--x--") .. " <" .. (guildName or "") .. ">"} + local result = {} + + for i = 1, AmtLines do + if (f.LatestResourceTable[i]) then + local playerName = f.LatestResourceTable[i][1] + playerName = playerName:gsub ("%|c%x%x%x%x%x%x%x%x", "") + playerName = playerName:gsub ("%|r", "") + playerName = playerName:gsub (".*%s", "") + tinsert (result, {playerName, f.LatestResourceTable[i][2]}) + else + break + end end + + Details:FormatReportLines (reportTable, result) + Details:SendReportLines (reportTable) end - - Details:FormatReportLines (reportTable, result) - Details:SendReportLines (reportTable) + + Details:SendReportWindow (reportFunc, nil, nil, true) end - - Details:SendReportWindow (reportFunc, nil, nil, true) end - 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:SetIcon ([[Interface\GLUES\CharacterSelect\RestoreButton]], 12, 12, "overlay", {0.2, .8, 0.2, .8}, nil, 4) + + 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:SetIcon ([[Interface\GLUES\CharacterSelect\RestoreButton]], 12, 12, "overlay", {0.2, .8, 0.2, .8}, nil, 4) -- function f:SetBackgroundImage (encounterId) @@ -337,236 +309,233 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild background:SetColorTexture(0.2, 0.2, 0.2, 0.8) end --]] - background:SetColorTexture(0.2, 0.2, 0.2, 0.8) end end - - f:SetScript ("OnMouseDown", function(self, button) - if (self.isMoving) then - return - end - if (button == "RightButton") then - self:Hide() - else - self:StartMoving() - self.isMoving = true - end - end) - 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.LatestSelection = f.LatestSelection or {} - f.LatestSelection.Raid = DetailsRaidHistoryWindow.select_raid.value - f.LatestSelection.Boss = DetailsRaidHistoryWindow.select_boss.value - f.LatestSelection.Diff = DetailsRaidHistoryWindow.select_diff.value - f.LatestSelection.Role = DetailsRaidHistoryWindow.select_role.value - f.LatestSelection.Guild = DetailsRaidHistoryWindow.select_guild.value - f.LatestSelection.PlayerBase = DetailsRaidHistoryWindow.select_player.value - f.LatestSelection.PlayerName = DetailsRaidHistoryWindow.select_player2.value - end) - - local dropdown_size = 160 + + --> window script handlers + f:SetScript ("OnMouseDown", function(self, button) + if (self.isMoving) then + return + end + if (button == "RightButton") then + self:Hide() + else + self:StartMoving() + self.isMoving = true + end + end) + + 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.LatestSelection = f.LatestSelection or {} + f.LatestSelection.Raid = DetailsRaidHistoryWindow.select_raid.value + f.LatestSelection.Boss = DetailsRaidHistoryWindow.select_boss.value + f.LatestSelection.Diff = DetailsRaidHistoryWindow.select_diff.value + f.LatestSelection.Role = DetailsRaidHistoryWindow.select_role.value + f.LatestSelection.Guild = DetailsRaidHistoryWindow.select_guild.value + f.LatestSelection.PlayerBase = DetailsRaidHistoryWindow.select_player.value + f.LatestSelection.PlayerName = DetailsRaidHistoryWindow.select_player2.value + end) + + local dropdownWidth = 160 local icon = [[Interface\FriendsFrame\battlenet-status-offline]] - - local diff_list = {} - local raid_list = {} - local boss_list = {} - local guild_list = {} + + local difficultyList = {} + local raidList = {} + local bossList = {} + local guildList = {} local sort_alphabetical = function(a,b) return a[1] < b[1] end local sort_alphabetical2 = function(a,b) return a.value < b.value end - + local on_select = function() if (f.Refresh) then f:Refresh() end end - + --> select raid: - local on_raid_select = function (_, _, raid) - Details.rank_window.last_raid = raid - f:UpdateDropdowns (true) - on_select() - end - local build_raid_list = function() - return raid_list - end - local raid_dropdown = DF:CreateDropDown (f, build_raid_list, 1, dropdown_size, 20, "select_raid") - local raid_string = DF:CreateLabel (f, Loc ["STRING_GUILDDAMAGERANK_RAID"] .. ":", _, _, "GameFontNormal", "select_raid_label") - raid_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) - + local onRaidSelect = function (_, _, raid) + Details.rank_window.last_raid = raid + f:UpdateDropdowns (true) + on_select() + end + local buildRaidList = function() + 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") + raid_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) + --> select boss: - local on_boss_select = function (_, _, boss) - on_select() - end - local build_boss_list = function() - return boss_list - end - local boss_dropdown = DF:CreateDropDown (f, build_boss_list, 1, dropdown_size, 20, "select_boss") - local boss_string = DF:CreateLabel (f, Loc ["STRING_GUILDDAMAGERANK_BOSS"] .. ":", _, _, "GameFontNormal", "select_boss_label") - boss_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) + local on_boss_select = function (_, _, boss) + on_select() + end + local build_boss_list = function() + 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") + boss_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) --> select difficulty: - local on_diff_select = function (_, _, diff) - Details.rank_window.last_difficulty = diff - on_select() - end - - local build_diff_list = function() - return diff_list - end - local diff_dropdown = DF:CreateDropDown (f, build_diff_list, 1, dropdown_size, 20, "select_diff") - local diff_string = DF:CreateLabel (f, Loc ["STRING_GUILDDAMAGERANK_DIFF"] .. ":", _, _, "GameFontNormal", "select_diff_label") - diff_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) - + local on_diff_select = function (_, _, diff) + Details.rank_window.last_difficulty = diff + on_select() + end + + local build_diff_list = function() + 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") + diff_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) + --> select role: - local on_role_select = function (_, _, role) - on_select() - end - local build_role_list = function() - return { - {value = "damage", label = "Damager", icon = icon, onclick = on_role_select}, - {value = "healing", label = "Healer", icon = icon, onclick = on_role_select} - } - end - local role_dropdown = DF:CreateDropDown (f, build_role_list, 1, dropdown_size, 20, "select_role") - local role_string = DF:CreateLabel (f, Loc ["STRING_GUILDDAMAGERANK_ROLE"] .. ":", _, _, "GameFontNormal", "select_role_label") - role_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) - + local on_role_select = function (_, _, role) + on_select() + end + local build_role_list = function() + return { + {value = "damage", label = "Damager", icon = icon, onclick = on_role_select}, + {value = "healing", label = "Healer", icon = icon, onclick = on_role_select} + } + 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") + role_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) + --> select guild: - local on_guild_select = function (_, _, guild) - on_select() - end - local build_guild_list = function() - return guild_list - end - local guild_dropdown = DF:CreateDropDown (f, build_guild_list, 1, dropdown_size, 20, "select_guild") - local guild_string = DF:CreateLabel (f, Loc ["STRING_GUILDDAMAGERANK_GUILD"] .. ":", _, _, "GameFontNormal", "select_guild_label") - guild_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) - + local on_guild_select = function (_, _, guild) + on_select() + end + local build_guild_list = function() + 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") + guild_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) + --> select playerbase: - local on_player_select = function (_, _, player) - on_select() - end - local build_player_list = function() - return { - {value = 1, label = Loc ["STRING_GUILDDAMAGERANK_PLAYERBASE_RAID"], icon = icon, onclick = on_player_select}, - {value = 2, label = Loc ["STRING_GUILDDAMAGERANK_PLAYERBASE_INDIVIDUAL"], icon = icon, onclick = on_player_select}, - } - end - local player_dropdown = DF:CreateDropDown (f, build_player_list, 1, dropdown_size, 20, "select_player") - local player_string = DF:CreateLabel (f, Loc ["STRING_GUILDDAMAGERANK_PLAYERBASE"] .. ":", _, _, "GameFontNormal", "select_player_label") - player_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) + local on_player_select = function (_, _, player) + on_select() + end + local build_player_list = function() + return { + {value = 1, label = Loc ["STRING_GUILDDAMAGERANK_PLAYERBASE_RAID"], icon = icon, onclick = on_player_select}, + {value = 2, label = Loc ["STRING_GUILDDAMAGERANK_PLAYERBASE_INDIVIDUAL"], icon = icon, onclick = on_player_select}, + } + 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") + player_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) --> select player: - local on_player2_select = function (_, _, player) - f.latest_player_selected = player - f:BuildPlayerTable (player) - end - local build_player2_list = function() - local encounterTable, guild, role = unpack (f.build_player2_data or {}) - local t = {} - local already_listed = {} - if (encounterTable) then - for encounterIndex, encounter in ipairs (encounterTable) do - if (encounter.guild == guild) then - local roleTable = encounter [role] - for playerName, _ in pairs (roleTable) do - if (not already_listed [playerName]) then - tinsert (t, {value = playerName, label = playerName, icon = icon, onclick = on_player2_select}) - already_listed [playerName] = true + local onPlayer2Select = function (_, _, player) + f.latest_player_selected = player + f:BuildPlayerTable (player) + end + local build_player2_list = function() + local encounterTable, guild, role = unpack (f.build_player2_data or {}) + local t = {} + local alreadyListed = {} + if (encounterTable) then + for encounterIndex, encounter in ipairs (encounterTable) do + if (encounter.guild == guild) then + local roleTable = encounter [role] + for playerName, _ in pairs (roleTable) do + if (not alreadyListed [playerName]) then + tinsert (t, {value = playerName, label = playerName, icon = icon, onclick = onPlayer2Select}) + alreadyListed [playerName] = true + end end end end end + + table.sort(t, sort_alphabetical2) + return t end - - table.sort (t, sort_alphabetical2) - - return t - end - local player2_dropdown = DF:CreateDropDown (f, build_player2_list, 1, dropdown_size, 20, "select_player2") - 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) - + 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") + player2_dropdown:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) + + + function f:UpdateDropdowns(DoNotSelectRaid) + local currentGuild = guild_dropdown.value - + --difficulty - wipe (diff_list) - wipe (boss_list) - wipe (raid_list) - wipe (guild_list) - - local boss_repeated = {} - local raid_repeated = {} - local guild_repeated = {} - - local raidSelected = DetailsRaidHistoryWindow.select_raid:GetValue() - - for difficulty, encounterIdTable in pairs (db) do - - if (type (difficulty) == "number") then + wipe(difficultyList) + wipe(bossList) + wipe(raidList) + wipe(guildList) + + local bossRepeated = {} + local raidRepeated = {} + local guildRepeated = {} + + local raidSelected = _G.DetailsRaidHistoryWindow.select_raid:GetValue() + db = f.OpenDB() + if (not db) then + return + end + + 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}) + --don't show normal encounters + --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 (diff_list) do + for i, t in ipairs(difficultyList) do if (t.label == "Heroic") then alreadyHave = true end end + if (not alreadyHave) then - tinsert (diff_list, 1, {value = 15, label = "Heroic", icon = icon, onclick = on_diff_select}) + tinsert (difficultyList, 1, {value = 15, label = "Heroic", icon = icon, onclick = on_diff_select}) end + elseif (difficulty == 16) then local alreadyHave = false - for i, t in ipairs (diff_list) do + for i, t in ipairs (difficultyList) do if (t.label == "Mythic") then alreadyHave = true end end + if (not alreadyHave) then - tinsert (diff_list, {value = 16, label = "Mythic", icon = icon, onclick = on_diff_select}) + tinsert (difficultyList, {value = 16, label = "Mythic", icon = icon, onclick = on_diff_select}) end end - for encounterId, encounterTable in pairs (encounterIdTable) do - if (not boss_repeated [encounterId]) then - local encounter, instance = Details:GetBossEncounterDetailsFromEncounterId (_, encounterId) + for encounterId, encounterTable in pairs (encounterIdTable) do + if (not bossRepeated[encounterId]) then + local encounter, instance = Details:GetBossEncounterDetailsFromEncounterId(nil, encounterId) + if (encounter) then local InstanceID = Details:GetInstanceIdFromEncounterId (encounterId) if (raidSelected == InstanceID) then - --[=[ - local bossIndex = Details:GetBossIndex (InstanceID, encounterId) - if (bossIndex) then - local l, r, t, b, texturePath = Details:GetBossIcon (InstanceID, bossIndex) - if (texturePath) then - tinsert (boss_list, {value = encounterId, label = encounter.boss, icon = texturePath, texcoord = {l, r, t, b}, onclick = on_boss_select}) - else - tinsert (boss_list, {value = encounterId, label = encounter.boss, icon = icon, onclick = on_boss_select}) - end - else - tinsert (boss_list, {value = encounterId, label = encounter.boss, icon = icon, onclick = on_boss_select}) - end - --]=] - - tinsert (boss_list, {value = encounterId, label = encounter.boss, icon = icon, onclick = on_boss_select}) - boss_repeated [encounterId] = true + tinsert (bossList, {value = encounterId, label = encounter.boss, icon = icon, onclick = on_boss_select}) + bossRepeated [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 + if (not raidRepeated [instance.name]) then + tinsert (raidList, {value = instance.id, label = instance.name, icon = icon, onclick = onRaidSelect}) + raidRepeated [instance.name] = true end end @@ -574,16 +543,16 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild for index, encounter in ipairs (encounterTable) do local guild = encounter.guild - if (not guild_repeated [guild]) then - tinsert (guild_list, {value = guild, label = guild, icon = icon, onclick = on_guild_select}) - guild_repeated [guild] = true + if (not guildRepeated [guild]) then + tinsert (guildList, {value = guild, label = guild, icon = icon, onclick = on_guild_select}) + guildRepeated [guild] = true end end end end end - table.sort (boss_list, function (t1, t2) return t1.label < t2.label end) + table.sort (bossList, function (t1, t2) return t1.label < t2.label end) diff_dropdown:Refresh() @@ -607,32 +576,32 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild local raidSelected = DetailsRaidHistoryWindow.select_raid:GetValue() local boss_repeated = {} - wipe (boss_list) + wipe (bossList) 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}) + --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 (diff_list) do + for i, t in ipairs (difficultyList) do if (t.label == "Heroic") then alreadyHave = true end end if (not alreadyHave) then - tinsert (diff_list, 1, {value = 15, label = "Heroic", icon = icon, onclick = on_diff_select}) + tinsert (difficultyList, 1, {value = 15, label = "Heroic", icon = icon, onclick = on_diff_select}) end elseif (difficulty == 16) then local alreadyHave = false - for i, t in ipairs (diff_list) do + for i, t in ipairs (difficultyList) do if (t.label == "Mythic") then alreadyHave = true end end if (not alreadyHave) then - tinsert (diff_list, {value = 16, label = "Mythic", icon = icon, onclick = on_diff_select}) + tinsert (difficultyList, {value = 16, label = "Mythic", icon = icon, onclick = on_diff_select}) end end @@ -647,15 +616,15 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild if (bossIndex) then local l, r, t, b, texturePath = Details:GetBossIcon (InstanceID, bossIndex) if (texturePath) then - tinsert (boss_list, {value = encounterId, label = encounter.boss, icon = texturePath, texcoord = {l, r, t, b}, onclick = on_boss_select}) + tinsert (bossList, {value = encounterId, label = encounter.boss, icon = texturePath, texcoord = {l, r, t, b}, onclick = on_boss_select}) else - tinsert (boss_list, {value = encounterId, label = encounter.boss, icon = icon, onclick = on_boss_select}) + tinsert (bossList, {value = encounterId, label = encounter.boss, icon = icon, onclick = on_boss_select}) end else - tinsert (boss_list, {value = encounterId, label = encounter.boss, icon = icon, onclick = on_boss_select}) + tinsert (bossList, {value = encounterId, label = encounter.boss, icon = icon, onclick = on_boss_select}) end --]=] - tinsert (boss_list, {value = encounterId, label = encounter.boss, icon = icon, onclick = on_boss_select}) + tinsert (bossList, {value = encounterId, label = encounter.boss, icon = icon, onclick = on_boss_select}) boss_repeated [encounterId] = true end end @@ -664,7 +633,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild end end - table.sort (boss_list, function (t1, t2) return t1.label < t2.label end) + table.sort (bossList, function (t1, t2) return t1.label < t2.label end) boss_dropdown:Refresh() end @@ -981,92 +950,98 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild end end end - + f.FirstRun = true - end - + end --end of DetailsRaidHistoryWindow creation + + 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 - local f = _G.DetailsRaidHistoryWindow - if (f.LatestSelection) then - _raid = f.LatestSelection.Raid - _boss = f.LatestSelection.Boss - _difficulty = f.LatestSelection.Diff - _role = f.LatestSelection.Role - _guild = f.LatestSelection.Guild - _player_base = f.LatestSelection.PlayerBase - _player_name = f.LatestSelection.PlayerBase + 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 + _boss = f.LatestSelection.Boss + _difficulty = f.LatestSelection.Diff + _role = f.LatestSelection.Role + _guild = f.LatestSelection.Guild + _player_base = f.LatestSelection.PlayerBase + _player_name = f.LatestSelection.PlayerBase + end end - end - - if (_G.DetailsRaidHistoryWindow.FirstRun) then + + if (statsWindow.FirstRun) then _difficulty = Details.rank_window.last_difficulty or _difficulty + if (IsInGuild()) then - local guildName = GetGuildInfo ("player") + local guildName = GetGuildInfo("player") if (guildName) then _guild = guildName end end + if (Details.rank_window.last_raid ~= "") then _raid = Details.rank_window.last_raid or _raid end - - _G.DetailsRaidHistoryWindow.FirstRun = nil end - - _G.DetailsRaidHistoryWindow:UpdateDropdowns() - _G.DetailsRaidHistoryWindow:UpdateDropdowns() - - _G.DetailsRaidHistoryWindow:Refresh() - _G.DetailsRaidHistoryWindow:Show() - + + statsWindow:UpdateDropdowns() + --statsWindow:UpdateDropdowns() + statsWindow:Refresh() + statsWindow:Show() + if (_history_type == 1 or _history_type == 2) then - DetailsRaidHistoryWindow.Mode = _history_type - if (DetailsRaidHistoryWindow.Mode == 1) then + statsWindow.Mode = _history_type + if (statsWindow.Mode == 1) then --overall - DetailsRaidHistoryWindow.HistoryCheckBox:SetValue (true) - DetailsRaidHistoryWindow.GuildRankCheckBox:SetValue (false) - elseif (DetailsRaidHistoryWindow.Mode == 2) then + statsWindow.HistoryCheckBox:SetValue (true) + statsWindow.GuildRankCheckBox:SetValue (false) + elseif (statsWindow.Mode == 2) then --guild rank - DetailsRaidHistoryWindow.GuildRankCheckBox:SetValue (true) - DetailsRaidHistoryWindow.HistoryCheckBox:SetValue (false) + statsWindow.GuildRankCheckBox:SetValue (true) + statsWindow.HistoryCheckBox:SetValue (false) end end - + if (_raid) then - DetailsRaidHistoryWindow.select_raid:Select (_raid) - _G.DetailsRaidHistoryWindow:Refresh() - DetailsRaidHistoryWindow.UpdateBossDropdown() + statsWindow.select_raid:Select (_raid) + statsWindow:Refresh() + statsWindow.UpdateBossDropdown() end + if (_boss) then - DetailsRaidHistoryWindow.select_boss:Select (_boss) - _G.DetailsRaidHistoryWindow:Refresh() + statsWindow.select_boss:Select (_boss) + statsWindow:Refresh() end + if (_difficulty) then - DetailsRaidHistoryWindow.select_diff:Select (_difficulty) - _G.DetailsRaidHistoryWindow:Refresh() + statsWindow.select_diff:Select (_difficulty) + statsWindow:Refresh() end + if (_role) then - DetailsRaidHistoryWindow.select_role:Select (_role) - _G.DetailsRaidHistoryWindow:Refresh() + statsWindow.select_role:Select (_role) + statsWindow:Refresh() end + if (_guild) then if (type (_guild) == "boolean") then _guild = GetGuildInfo ("player") end - DetailsRaidHistoryWindow.select_guild:Select (_guild) - _G.DetailsRaidHistoryWindow:Refresh() - end - if (_player_base) then - DetailsRaidHistoryWindow.select_player:Select (_player_base) - _G.DetailsRaidHistoryWindow:Refresh() - end - if (_player_name) then - DetailsRaidHistoryWindow.select_player2:Refresh() - DetailsRaidHistoryWindow.select_player2:Select (_player_name) - _G.DetailsRaidHistoryWindow:Refresh (_player_name) + statsWindow.select_guild:Select (_guild) + statsWindow:Refresh() end - DetailsPluginContainerWindow.OpenPlugin (DetailsRaidHistoryWindow) + if (_player_base) then + statsWindow.select_player:Select (_player_base) + statsWindow:Refresh() + end + + if (_player_name) then + statsWindow.select_player2:Refresh() + statsWindow.select_player2:Select (_player_name) + statsWindow:Refresh (_player_name) + end + + DetailsPluginContainerWindow.OpenPlugin(statsWindow) end diff --git a/functions/raidinfo.lua b/functions/raidinfo.lua index a419525e..f5eee559 100644 --- a/functions/raidinfo.lua +++ b/functions/raidinfo.lua @@ -6,60 +6,141 @@ local C_Timer = _G.C_Timer local DetailsFramework = _G.DetailsFramework local tinsert = _G.tinsert -do - --> data for Castle Nathria (Shadowlands tier 1) - --F:\World of Warcraft\_retail_\BlizzardInterfaceArt\Interface\GLUES\LOADINGSCREENS\Expansion07\Main\LOADINGSCREEN_NzothRAID - local INSTANCE_EJID = 1190 - local INSTANCE_MAPID = 2296 - local HDIMAGESPATH = [[Details\images\raid]] - local HDFILEPREFIX = "CastleNathriaRaid" - local LOADINGSCREEN_FILE, LOADINGSCREEN_COORDS = [[Expansion08\Main\LoadScreen_CastleNathriaRaid]], {0, 1, 285/1024, 875/1024} - local EJ_LOREBG = "UI-EJ-LOREBG-CastleNathria" - local RAID_TIER = 26 +function Details.InstallRaidInfo() - local PORTRAIT_LIST = { - 3752190, --Shriekwing - Shriekwing - 3753151, --Huntsman Altimor - Huntsman Altimor - 3753157, --Kael'thas Sunstrider - Sun King's Salvation - 3752156, --Artificer Xy'Mox - Artificer Xy'mox - 3752174, --Hungering Destroyer - Hungering Destroyer - 3752178, --Lady Inerva Darkvein - Lady Inerva Darkvein - 3753159, --Castellan Niklaus - The Council of Blood - 3752191, --Sludgefist - Sludgefist - 3753156, --General Kaal - Stone Legion Generals - 3752159, --Sire Denathrius - Sire Denathrius - } + do + --> data for Sanctum of Domination (Shadowlands tier 1) + local INSTANCE_EJID = 1193 + local INSTANCE_MAPID = 2450 + local HDIMAGESPATH = [[Details\images\raid]] + local HDFILEPREFIX = 'SanctumofDominationRaid' + local EJ_LOREBG = 'UI-EJ-LOREBG-SanctumofDomination' - local ENCOUNTER_ID_CL = { - 2398, 2418, 2402, 2405, 2383, 2406, 2412, 2399, 2417, 2407, - [2398] = 1, --Shriekwing - [2418] = 2, --Huntsman Altimor - [2402] = 3, --Kael'thas - [2405] = 4, --Artificer Xy'mox - [2383] = 5, --Hungering Destroyer - [2406] = 6, --Lady Inerva Darkvein - [2412] = 7, --The Council of Blood - [2399] = 8, --Sludgefist - [2417] = 9, --Stone Legion Generals - [2407] = 10, --Sire Denathrius - } + local ENCOUNTER_ID_CL = { + [2423] = 1, --The Tarragrue + [2433] = 2, --The Eye of the Jailer + [2429] = 3, --The Nine + [2432] = 4, --Remnant of Ner'zhul + [2434] = 5, --Soulrender Dormazain + [2430] = 6, --Painsmith Raznal + [2436] = 7, --Guardian of the First Ones + [2431] = 8, --Fatescribe Roh-Kalo + [2422] = 9, --Kel'Thuzad + [2435] = 10, --Sylvanas Windrunner + 2423, 2433, 2429, 2432, 2434, 2430, 2436, 2431, 2422, 2435, + } - local ENCOUNTER_ID_EJ = { - 2393, 2429, 2422, 2418, 2428, 2420, 2426, 2394, 2425, 2424, - [2393] = 1, --Shriekwing - [2429] = 2, --Huntsman Altimor - [2422] = 3, --Sun King's Salvation - [2418] = 4, --Artificer Xy'mox - [2428] = 5, --Hungering Destroyer - [2420] = 6, --Lady Inerva Darkvein - [2426] = 7, --The Council of Blood - [2394] = 8, --Sludgefist - [2425] = 9, --Stone Legion Generals - [2424] = 10, --Sire Denathrius - } - - --> install the raid - C_Timer.After (10, function() + local ENCOUNTER_ID_EJ = { + [2435] = 1, --The Tarragrue + [2442] = 2, --The Eye of the Jailer + [2439] = 3, --The Nine + [2444] = 4, --Remnant of Ner'zhul + [2445] = 5, --Soulrender Dormazain + [2443] = 6, --Painsmith Raznal + [2446] = 7, --Guardian of the First Ones + [2447] = 8, --Fatescribe Roh-Kalo + [2440] = 9, --Kel'Thuzad + [2441] = 10, --Sylvanas Windrunner + 2435, 2442, 2439, 2444, 2445, 2443, 2446, 2447, 2440, 2441, + } + + --load encounter journal + DetailsFramework.EncounterJournal.EJ_SelectInstance(INSTANCE_EJID) + local InstanceName = DetailsFramework.EncounterJournal.EJ_GetInstanceInfo(INSTANCE_EJID) + + local BOSSNAMES = { + "The Tarragrue", --1 + "The Eye of the Jailer", --2 + "The Nine", --3 + "Remnant of Ner'zhul", --4 + "Soulrender Dormazain", --5 + "Painsmith Raznal", --6 + "Guardian of the First Ones", --7 + "Fatescribe Roh-Kalo", --8 + "Kel'Thuzad", --9 + "Sylvanas Windrunner", --10 + } + + local ENCOUNTERS = { + {boss = "The Tarragrue", portrait = 4071444}, + {boss = "The Eye of the Jailer", portrait = 4071426}, + {boss = "The Nine", portrait = 4071445}, + {boss = "Remnant of Ner'zhul", portrait = 4071439}, + {boss = "Soulrender Dormazain", portrait = 4071442}, + {boss = "Painsmith Raznal", portrait = 4079051}, + {boss = "Guardian of the First Ones", portrait = 4071428}, + {boss = "Fatescribe Roh-Kalo", portrait = 4071427}, + {boss = "Kel'Thuzad", portrait = 4071435}, + {boss = "Sylvanas Windrunner", portrait = 4071443}, + } + + _detalhes:InstallEncounter ({ + id = INSTANCE_MAPID, --map id + ej_id = INSTANCE_EJID, --encounter journal id + name = InstanceName, + icons = "Interface\\AddOns\\" .. HDIMAGESPATH .. "\\" .. HDFILEPREFIX .. "_BossFaces", + icon = "Interface\\AddOns\\" .. HDIMAGESPATH .. "\\" .. HDFILEPREFIX .. "_Icon256x128", + is_raid = true, + backgroundEJ = "Interface\\EncounterJournal\\" .. EJ_LOREBG, + encounter_ids = ENCOUNTER_ID_EJ, + encounter_ids2 = ENCOUNTER_ID_CL, + boss_names = BOSSNAMES, + encounters = ENCOUNTERS, + boss_ids = { + --npc ids + }, + }) + end + + do + --> data for Castle Nathria (Shadowlands tier 1) + --F:\World of Warcraft\_retail_\BlizzardInterfaceArt\Interface\GLUES\LOADINGSCREENS\Expansion07\Main\LOADINGSCREEN_NzothRAID + local INSTANCE_EJID = 1190 + local INSTANCE_MAPID = 2296 + local HDIMAGESPATH = [[Details\images\raid]] + local HDFILEPREFIX = "CastleNathriaRaid" + local EJ_LOREBG = "UI-EJ-LOREBG-CastleNathria" + + local PORTRAIT_LIST = { + 3752190, --Shriekwing - Shriekwing + 3753151, --Huntsman Altimor - Huntsman Altimor + 3753157, --Kael'thas Sunstrider - Sun King's Salvation + 3752156, --Artificer Xy'Mox - Artificer Xy'mox + 3752174, --Hungering Destroyer - Hungering Destroyer + 3752178, --Lady Inerva Darkvein - Lady Inerva Darkvein + 3753159, --Castellan Niklaus - The Council of Blood + 3752191, --Sludgefist - Sludgefist + 3753156, --General Kaal - Stone Legion Generals + 3752159, --Sire Denathrius - Sire Denathrius + } + + local ENCOUNTER_ID_CL = { + 2398, 2418, 2402, 2405, 2383, 2406, 2412, 2399, 2417, 2407, + [2398] = 1, --Shriekwing + [2418] = 2, --Huntsman Altimor + [2402] = 3, --Kael'thas + [2405] = 4, --Artificer Xy'mox + [2383] = 5, --Hungering Destroyer + [2406] = 6, --Lady Inerva Darkvein + [2412] = 7, --The Council of Blood + [2399] = 8, --Sludgefist + [2417] = 9, --Stone Legion Generals + [2407] = 10, --Sire Denathrius + } + + local ENCOUNTER_ID_EJ = { + 2393, 2429, 2422, 2418, 2428, 2420, 2426, 2394, 2425, 2424, + [2393] = 1, --Shriekwing + [2429] = 2, --Huntsman Altimor + [2422] = 3, --Sun King's Salvation + [2418] = 4, --Artificer Xy'mox + [2428] = 5, --Hungering Destroyer + [2420] = 6, --Lady Inerva Darkvein + [2426] = 7, --The Council of Blood + [2394] = 8, --Sludgefist + [2425] = 9, --Stone Legion Generals + [2424] = 10, --Sire Denathrius + } --load encounter journal DetailsFramework.EncounterJournal.EJ_SelectInstance (INSTANCE_EJID) @@ -69,7 +150,7 @@ do --build the boss name list local BOSSNAMES = {} local ENCOUNTERS = {} - + for i = 1, #PORTRAIT_LIST do local bossName = DetailsFramework.EncounterJournal.EJ_GetEncounterInfoByIndex (i, INSTANCE_EJID) if (bossName) then @@ -85,24 +166,20 @@ do end _detalhes:InstallEncounter ({ - raidTier = RAID_TIER, id = INSTANCE_MAPID, --map id ej_id = INSTANCE_EJID, --encounter journal id name = InstanceName, icons = "Interface\\AddOns\\" .. HDIMAGESPATH .. "\\" .. HDFILEPREFIX .. "_BossFaces", icon = "Interface\\AddOns\\" .. HDIMAGESPATH .. "\\" .. HDFILEPREFIX .. "_Icon256x128", is_raid = true, - backgroundFile = {file = [[Interface\GLUES\LOADINGSCREENS\]] .. LOADINGSCREEN_FILE, coords = LOADINGSCREEN_COORDS}, backgroundEJ = "Interface\\EncounterJournal\\" .. EJ_LOREBG, - encounter_ids = ENCOUNTER_ID_EJ, encounter_ids2 = ENCOUNTER_ID_CL, boss_names = BOSSNAMES, encounters = ENCOUNTERS, - boss_ids = { --npc ids }, }) - end) -end + end +end \ No newline at end of file diff --git a/startup.lua b/startup.lua index 406414c4..99cb7b1e 100644 --- a/startup.lua +++ b/startup.lua @@ -476,7 +476,7 @@ function Details:StartMeUp() --I'll never stop! --enforce to show 6 abilities on the tooltip --_detalhes.tooltip.tooltip_max_abilities = 6 freeeeeedooommmmm - + Details.InstallRaidInfo() --Plater integration C_Timer.After(2, function()