Skip to content

Commit

Permalink
changed: support for DepositOnBankHide variable (default false, toggl…
Browse files Browse the repository at this point in the history
…ed using /gt bankhide on/true/off/false)

added: ChatCommandDepositOnBankHide to Locale/enUS.lua
  • Loading branch information
speedwaystar committed Oct 5, 2024
1 parent 8495930 commit e7f6317
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
29 changes: 18 additions & 11 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ local SettingsDefaults = {
SkinElvUI = true,
LDBDisplayTotal = false,
PrettyLDB = false,
DepositOnBankOpen = true,
DepositOnBankHide = false,
}

-- Get the coin string for the databroker icon, because it needs to be shorter.
Expand Down Expand Up @@ -167,7 +167,7 @@ function E:Init()
if not GuildTithe_SavedDB or GuildTithe_SavedDB.SettingsVer < SettingsDefaults.SettingsVer then
GuildTithe_SavedDB = SettingsDefaults
end

-- Load the frames
GT_MiniTitheFrame:EnableMouse(not GuildTithe_SavedDB.MiniFrameLocked)
if GuildTithe_SavedDB.MiniFrameShown then
Expand All @@ -178,6 +178,10 @@ function E:Init()
if (GuildTithe_SavedDB.PrettyLDB == nil or GuildTithe_SavedDB.PrettyLDB == '') then
GuildTithe_SavedDB.PrettyLDB = false
end

if GuildTithe_SavedDB.DepositOnBankHide == nil then
GuildTithe_SavedDB.DepositOnBankHide = false
end
end

function E:ResetWindowSettings()
Expand Down Expand Up @@ -362,6 +366,7 @@ function E:DepositTithe(clicked, isMail)
SendMailMoneyCopper:SetText(copperAmount)
else
-- begin temporary test spam

print(LIGHTGRAY_FONT_COLOR:WrapTextInColorCode(format("Tithe before deposit: %s.",C_CurrencyInfo.GetCoinTextureString(GuildTithe_SavedDB.CurrentTithe))))
print(LIGHTGRAY_FONT_COLOR:WrapTextInColorCode(format("Guild bank before deposit: %s.",C_CurrencyInfo.GetCoinTextureString(GetGuildBankMoney()))))
print(LIGHTGRAY_FONT_COLOR:WrapTextInColorCode(format("Own balance before deposit: %s.",C_CurrencyInfo.GetCoinTextureString(GetMoney()))))
Expand Down Expand Up @@ -407,7 +412,7 @@ function E:PrintHelpMessages()
self:PrintMessage("=== Status ===")
self:PrintMessage(format(L.ChatCommandToggleDebug, tostring(E._DebugMode)), false, E._DebugMode )
self:PrintMessage(format(L.ChatCommandToggleChat, tostring(GuildTithe_SavedDB.Spammy)))
self:PrintMessage(format("Deposit on bank window frame %s.", GREEN_FONT_COLOR:WrapTextInColorCode( tostring(GuildTithe_SavedDB.DepositOnBankOpen and "show" or "hide"))))
self:PrintMessage(format(L.ChatCommandDepositOnBankHide ,tostring(GuildTithe_SavedDB.DepositOnBankHide)))
end

-- Handles slash commands
Expand Down Expand Up @@ -525,13 +530,15 @@ function E:OnChatCommand(msg)
self:PrintMessage(format(L.ChatCommandToggleChat, tostring(GuildTithe_SavedDB.Spammy)))

-- deposit on bank window open or close (potential fix for server lag)
elseif cmd == "bank" then
if args == "show" or args == "open" then
GuildTithe_SavedDB.DepositOnBankOpen = true
elseif args == "hide" or args == "close" or args == "closed" then
GuildTithe_SavedDB.DepositOnBankOpen = false
elseif cmd == "bankhide" then
if args == "on" or args == "true" then
GuildTithe_SavedDB.DepositOnBankHide = true
elseif args == "off" or args == "false" then
GuildTithe_SavedDB.DepositOnBankHide = false
else
GuildTithe_SavedDB.DepositOnBankHide = not GuildTithe_SavedDB.DepositOnBankHide
end
self:PrintMessage(format("Deposit on bank window frame %s.", GREEN_FONT_COLOR:WrapTextInColorCode(tostring(GuildTithe_SavedDB.DepositOnBankOpen and "show" or "hide"))))
self:PrintMessage(format(L.ChatCommandDepositOnBankHide, tostring(GuildTithe_SavedDB.DepositOnBankHide)))

-- This is where we're going to actually print the help info... Later though.
else
Expand Down Expand Up @@ -638,11 +645,11 @@ function E.EventHandler(self, event, ...)

-- GUILDBANKFRAME_OPENED: The GB was opened, deposit the outstanding tithe.
elseif event == "PLAYER_INTERACTION_MANAGER_FRAME_SHOW" and tonumber(arg1) == Enum.PlayerInteractionType.GuildBanker then
if GuildTithe_SavedDB.DepositOnBankOpen then
if not GuildTithe_SavedDB.DepositOnBankHide then
E:DepositTithe()
end
elseif event == "PLAYER_INTERACTION_MANAGER_FRAME_HIDE" and tonumber(arg1) == Enum.PlayerInteractionType.GuildBanker then
if not GuildTithe_SavedDB.DepositOnBankOpen then
if GuildTithe_SavedDB.DepositOnBankHide then
E:DepositTithe()
end
-- Mail_*: Update outstanding tithe from Mail sources
Expand Down
9 changes: 5 additions & 4 deletions Locale/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ L["ChatHelpLine8"] = "reset config -- Reset this character's config."
L["ChatHelpLine9"] = "current/tithe -- Show your current outstanding tithe."
L["ChatHelpLine10"] = "mini -- Toggle the Mini-frame."
L["ChatHelpLine11"] = "mini lock -- Lock or unlock the Mini-frame."
L["ChatHelpLine12"] = "debug (on/off) -- Toggle debug mode on and off."
L["ChatHelpLine13"] = "chat (on/off) -- Toggle chat output on and off."
L["ChatHelpLine14"] = "prettyldb (on/off) -- Toggle LDB text vs graphical display."
L["ChatHelpLine15"] = "bank show/hide -- deposit on bank window show or hide (default show)"
L["ChatHelpLine12"] = "debug (on/true/off/false) -- Toggle debug mode on and off."
L["ChatHelpLine13"] = "chat (on/true/off/false) -- Toggle chat output on and off."
L["ChatHelpLine14"] = "prettyldb (on/true/off/false) -- Toggle LDB text vs graphical display."
L["ChatHelpLine15"] = "bankhide (on/true/off/false) -- Deposit tithe on bank window hide (default false)"

L["ChatMiniFrameLock"] = "Mini-Frame locked."

Expand All @@ -35,6 +35,7 @@ L["ChatCommandSetOverCap"] = "Tithe cannot exceed gold cap."
L["ChatCommandSetSyntax"] = "Syntax: /gt set <amount in copper>."
L["ChatCommandToggleDebug"] = "Debug mode §c%s§r."
L["ChatCommandToggleChat"] = "Chat mode §c%s§r."
L["ChatCommandDepositOnBankHide"] = "Deposit on bank window frame hide §c%s§r."

L["ChatMiniFrameUnlock"] = "Mini-frame unlocked."
L["ChatNotEnoughFunds"] = "You don't have enough money to do that!"
Expand Down

0 comments on commit e7f6317

Please sign in to comment.