Skip to content

Commit

Permalink
Added additional means to surrender match
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Feb 19, 2021
1 parent 7b15d0a commit d7a23be
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
10 changes: 9 additions & 1 deletion REFlex.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion REFlex.toc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 10 additions & 0 deletions REFlexFunctions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d7a23be

Please sign in to comment.