Skip to content

Commit

Permalink
Update Core.lua
Browse files Browse the repository at this point in the history
- API polish and updates (thanks @speedwaystar)
- limit deposits to prevent overrun of guild bank gold cap (thanks @speedwaystar)
- new commandline options: toggle debug flag/chat messages (thanks @speedwaystar)
- new option to deposit either at guild bank open or close (by @raptormama and @speedwaystar) - defaults to open
- option for 'pretty' LDB display (/gt prettyldb on), defaults to off for existing-user continuity
- localisation! In English only for now; feel free to submit strings in pull requests!
  • Loading branch information
raptormama authored Oct 7, 2024
1 parent c70d45d commit c005854
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions Core.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--[[
------------------------------------------------------------------------
Project: GuildTithe Reincarnated
File: Core rev. 129
File: Core rev. 130
Date: 2024-01-10T02:30Z
Purpose: Core Addon Code
Credits: Code written by Vandesdelca32, updated for Dragonflight by Miragosa
Expand Down Expand Up @@ -29,7 +29,7 @@ local addonName, _ = ...
local E, L = unpack(select(2, ...))
local GOLD_CAP = (9999999 * COPPER_PER_GOLD) + (99 * COPPER_PER_SILVER) + 99

--debugArgs: Returns literal "nil" or the tostring of all of the arguments passed to it.
-- debugArgs: Returns literal "nil" or the tostring of all of the arguments passed to it.
function E:debugArgs(...)
local tmp = {}
for i = 1, select("#", ...) do
Expand Down Expand Up @@ -167,14 +167,14 @@ 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
GT_MiniTitheFrame:Show()
end

--existing users won't have a setting for PrettyLDB. Fix that. (Defaults to off to preserve existing behavior)
-- existing users won't have a setting for PrettyLDB/when to deposit. Fix that. (Defaults to off to preserve existing behavior)
if (GuildTithe_SavedDB.PrettyLDB == nil or GuildTithe_SavedDB.PrettyLDB == '') then
GuildTithe_SavedDB.PrettyLDB = false
end
Expand Down Expand Up @@ -365,14 +365,18 @@ function E:DepositTithe(clicked, isMail)
SendMailMoneySilver:SetText(silverAmount)
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()))))
DepositGuildBankMoney(tithe)
-- end temporary test spam
end
-- 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()))))
-- end temporary test spam

if not GuildTithe_SavedDB.DepositOnBankHide then
C_Timer.After(1, function() DepositGuildBankMoney(tithe) end)
else
DepositGuildBankMoney(tithe)
end
end
end

if GuildTithe_SavedDB.Spammy or E._DebugMode then
Expand Down Expand Up @@ -694,7 +698,8 @@ end

-- Support addon compartment.
local aboutText = "GuildTithe";
local mouseButtonNote = "\nShow configuration window";
local mouseButtonNote = "\nShow configuration window\n" ..
"/gt for command line options"
AddonCompartmentFrame:RegisterAddon({
text = aboutText,
icon = "Interface\\ICONS\\inv_misc_coin_17.blp",
Expand Down

0 comments on commit c005854

Please sign in to comment.