diff --git a/REFlex.lua b/REFlex.lua index e5def51..5335e15 100644 --- a/REFlex.lua +++ b/REFlex.lua @@ -61,7 +61,7 @@ local SendAddonMessage = _G.C_ChatInfo.SendAddonMessage local PlaySound = _G.PlaySound local ElvUI = _G.ElvUI -RE.Version = 311 +RE.Version = 312 RE.LastSquash = 1602662400 RE.FoundNewVersion = false @@ -100,6 +100,7 @@ RE.BackdropB = { } _G.SLASH_REFLEX1 = "/reflex" +_G.SLASH_REFLEXGG1 = "/gg" function RE:OnLoad(self) RE.SessionStart, RE.PlayerTimezone = RE:GetUTCTimestamp(true) @@ -241,6 +242,9 @@ function RE:OnEvent(_, event, ...) _G.REFlexFrame:Hide() end end + _G.SlashCmdList["REFLEXGG"] = function() + RE:SurrenderMatch() + end RE.LDB = LDB:NewDataObject("REFlex", { type = "data source", @@ -303,6 +307,8 @@ function RE:OnEvent(_, event, ...) else _G.REFlexFrame:Hide() end + elseif button == "MiddleButton" then + RE:SurrenderMatch() elseif button == "RightButton" then _G.InterfaceOptionsFrame:Show() InterfaceOptionsFrame_OpenToCategory(RE.OptionsMenu) @@ -315,6 +321,8 @@ function RE:OnEvent(_, event, ...) RE.Settings.LDBSide = "A" end RE.LDB.text = RE["LDB"..RE.Settings.LDBSide] + elseif button == "MiddleButton" then + RE:SurrenderMatch() elseif button == "RightButton" then if not _G.REFlexFrame:IsVisible() then _G.REFlexFrame:Show() diff --git a/REFlex.toc b/REFlex.toc index 39b8877..30a15c2 100644 --- a/REFlex.toc +++ b/REFlex.toc @@ -1,7 +1,7 @@ ## Interface: 90002 ## Title: |cFF74D06CRE|rFlex ## Notes: Collect statistics of played arena matches and battlegrounds. -## Version: 3.1.1 +## Version: 3.1.2 ## Author: AcidWeb ## SavedVariablesPerCharacter: REFlexSettings, REFlexDatabase, REFlexHonorDatabase ## X-Website: https://www.curseforge.com/wow/addons/reflex-battleground-historian diff --git a/REFlexFunctions.lua b/REFlexFunctions.lua index 95fff5c..f04dfcb 100644 --- a/REFlexFunctions.lua +++ b/REFlexFunctions.lua @@ -16,6 +16,10 @@ local GetCurrencyInfo = _G.C_CurrencyInfo.GetCurrencyInfo local GetConquestWeeklyProgress = _G.C_WeeklyRewards.GetConquestWeeklyProgress local GetSecondsUntilWeeklyReset = _G.C_DateAndTime.GetSecondsUntilWeeklyReset local PanelTemplates_GetSelectedTab = _G.PanelTemplates_GetSelectedTab +local IsActiveBattlefieldArena = _G.IsActiveBattlefieldArena +local IsInBrawl = _G.C_PvP.IsInBrawl +local CanSurrenderArena = _G.CanSurrenderArena +local SurrenderArena = _G.SurrenderArena local StaticPopup_Hide = _G.StaticPopup_Hide function RE:GetPlayerData(databaseID) @@ -799,6 +803,12 @@ function RE:ParseUTCTimestamp(month) end end +function RE:SurrenderMatch() + if IsActiveBattlefieldArena() and not IsInBrawl() and CanSurrenderArena() then + SurrenderArena() + end +end + function RE:Round(num, idp) local mult = 10^(idp or 0) return mfloor(num * mult + 0.5) / mult