Skip to content

Commit

Permalink
reset buffs, not UI settings on new releases
Browse files Browse the repository at this point in the history
  • Loading branch information
ynazar1 committed Nov 16, 2024
1 parent fabbf1a commit 5568c3e
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 24 deletions.
64 changes: 45 additions & 19 deletions SmartBuff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
-- Version/Release info, bump these as needed:
-- Bump .toc file and optionally update notes in localization.en.lua

SMARTBUFF_DATE = "011124"; -- EU Date
SMARTBUFF_VERSION = "r31." .. SMARTBUFF_DATE;
-- Update the NR below to force full reload of SB_Data on first login
-- Bump on major logic or buff changes only
SMARTBUFF_VERSIONNR = 110005;
SMARTBUFF_DATE = "151124"; -- EU Date
SMARTBUFF_VERSION = "r32." .. SMARTBUFF_DATE;
-- Update the NR below to force reload of SB_Buffs on first login
SMARTBUFF_VERSIONNR = 110006;
-- End of version info

SMARTBUFF_TITLE = "SmartBuff";
Expand Down Expand Up @@ -181,7 +180,7 @@ local sounds = sharedMedia:HashTable("sound")

local DebugChatFrame = DEFAULT_CHAT_FRAME;

-- Popup
-- Popup reset all data
StaticPopupDialogs["SMARTBUFF_DATA_PURGE"] = {
text = SMARTBUFF_OFT_PURGE_DATA,
button1 = SMARTBUFF_OFT_YES,
Expand All @@ -192,6 +191,17 @@ StaticPopupDialogs["SMARTBUFF_DATA_PURGE"] = {
hideOnEscape = 1
}

-- Popup reset buffs
StaticPopupDialogs["SMARTBUFF_BUFFS_PURGE"] = {
text = SMARTBUFF_OFT_PURGE_BUFFS,
button1 = SMARTBUFF_OFT_YES,
button2 = SMARTBUFF_OFT_NO,
OnAccept = function() SMARTBUFF_ResetBuffs() end,
timeout = 0,
whileDead = 1,
hideOnEscape = 1
}

-- Popup to reloadui
StaticPopupDialogs["SMARTBUFF_GUI_RELOAD"] = {
text = SMARTBUFF_OFT_REQ_RELOAD,
Expand Down Expand Up @@ -1541,9 +1551,11 @@ function SMARTBUFF_SyncBuffTimers()
buffS = cBuffs[i].BuffS;

-- TOCHECK
rbTime = B[CS()][ct][buffS].RBTime;
if (rbTime <= 0) then
rbTime = O.RebuffTimer;
if B[CS()][ct][buffS].RBTime then
rbTime = B[CS()][ct][buffS].RBTime;
if (rbTime <= 0) then
rbTime = O.RebuffTimer;
end
end

if (buffS and B[CS()][ct][buffS].EnableS and cBuffs[i].IDS ~= nil and cBuffs[i].DurationS > 0) then
Expand Down Expand Up @@ -3180,15 +3192,16 @@ function SMARTBUFF_Options_Init(self)
end
end

-- major version changes are backwards incompatible by definition, so trigger a RESET ALL
-- Do a reset of buff data on changes
O.VersionNr = O.VersionNr or SMARTBUFF_VERSIONNR -- don't reset if O.VersionNr == nil
if O.VersionNr < SMARTBUFF_VERSIONNR then
if (O.VersionNr ~= SMARTBUFF_VERSIONNR) then
O.VersionNr = SMARTBUFF_VERSIONNR;
StaticPopup_Show("SMARTBUFF_DATA_PURGE");
SMARTBUFF_SetBuffs();
StaticPopup_Show("SMARTBUFF_BUFFS_PURGE");
SMARTBUFF_SetTemplate()
InitBuffOrder(true);
SMARTBUFF_AddMsg("Upgraded SmartBuff to " .. SMARTBUFF_VERSION, true);
end
SMARTBUFF_AddMsg("Upgraded SmartBuff to " .. SMARTBUFF_VERSION);
-- TODO: Bring back major reset of everything but also there's a UI button still to do it

if (SMARTBUFF_OptionsGlobal == nil) then
SMARTBUFF_OptionsGlobal = {};
Expand All @@ -3203,6 +3216,7 @@ function SMARTBUFF_Options_Init(self)

if (OG.FirstStart ~= SMARTBUFF_VERSION) then
SMARTBUFF_OptionsFrame_Open(true);
OG.FirstStart = SMARTBUFF_VERSION;
if (OG.Tutorial == nil) then
OG.Tutorial = SMARTBUFF_VERSIONNR;
SMARTBUFF_ToggleTutorial();
Expand Down Expand Up @@ -3239,12 +3253,22 @@ function SMARTBUFF_InitActionButtonPos()
--print(format("x = %.0f, y = %.0f", O.ActionBtnX, O.ActionBtnY));
end

-- Reset all options, buffs and window position
function SMARTBUFF_ResetAll()
wipe(SMARTBUFF_Buffs);
wipe(SMARTBUFF_Options);
ReloadUI();
end

-- Reset only buffs. Useful for upgrades, keep UI options
-- Don't reload UI. Since buffs are after reset
function SMARTBUFF_ResetBuffs()
wipe(SMARTBUFF_Buffs);
SMARTBUFF_SetTemplate()
InitBuffOrder(true);
SMARTBUFF_OptionsFrame_Close(true)
end

function SMARTBUFF_SetButtonPos(self)
local x, y = self:GetLeft(), self:GetTop() - UIParent:GetHeight();
O.ActionBtnX = x;
Expand Down Expand Up @@ -3568,11 +3592,6 @@ function SMARTBUFF_OptionsFrame_Toggle()
SmartBuff_PlayerSetup:Hide();
end
SmartBuffOptionsFrame:Hide();
-- if we were a new build then request a reloadui.
if (OG.FirstStart ~= SMARTBUFF_VERSION) then
OG.FirstStart = SMARTBUFF_VERSION;
StaticPopup_Show("SMARTBUFF_GUI_RELOAD");
end
else
SmartBuffOptionsCredits_lblText:SetText(SMARTBUFF_CREDITS);
SmartBuffOptionsFrame:Show();
Expand All @@ -3589,6 +3608,13 @@ function SMARTBUFF_OptionsFrame_Open(force)
end
end

function SMARTBUFF_OptionsFrame_Close(force)
if (not isInit) then return; end
if (SmartBuffOptionsFrame:IsVisible() or force) then
SmartBuffOptionsFrame:Hide();
end
end

function SmartBuff_BuffSetup_Show(i)
local icon1 = cBuffs[i].IconS;
local icon2 = cBuffs[i].IconG;
Expand Down
2 changes: 1 addition & 1 deletion SmartBuff.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Interface: 110005
## Title: SmartBuff |cff0099ffRetail|r
## Version: 30.110005.1
## Version: 32.110005
## Author: |cff20d2ffCodermik & Aeldra|r (EU-Proudmoore)
## Contributing Author: |cff20d2ffSpeedwaystar
## Notes: Cast the most important buffs on you or party/raid members/pets. Use /sbm for options menu.
Expand Down
18 changes: 17 additions & 1 deletion SmartBuff.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@
</OnClick>
</Scripts>
</Button>
<Button name="SmartBuffOptionsFrameResetOrder" inherits="UIPanelButtonTemplate" text="SMARTBUFF_OFT_RESETLIST">
<Button name="SmartBuffOptionsFrameResetBuffs" inherits="UIPanelButtonTemplate" text="SMARTBUFF_OFT_RESETBUFFS">
<Size>
<AbsDimension x="88" y="33" />
</Size>
Expand All @@ -1518,6 +1518,22 @@
<Offset x="212" y="27" />
</Anchor>
</Anchors>
<Scripts>
<OnClick>
SMARTBUFF_OptionsFrame_Toggle();
StaticPopup_Show("SMARTBUFF_BUFFS_PURGE");
</OnClick>
</Scripts>
</Button>
<Button name="SmartBuffOptionsFrameResetOrder" inherits="UIPanelButtonTemplate" text="SMARTBUFF_OFT_RESETLIST">
<Size>
<AbsDimension x="88" y="33" />
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parent" relativePoint="BOTTOMLEFT">
<Offset x="306" y="27" />
</Anchor>
</Anchors>
<Scripts>
<OnClick>
SMARTBUFF_BuffOrderReset();
Expand Down
2 changes: 2 additions & 0 deletions localization.cn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ SMARTBUFF_OFT_HIDESABUTTON = "隐藏动作按钮";
SMARTBUFF_OFT_INCOMBAT = "战斗中触发";
SMARTBUFF_OFT_SMARTDEBUFF = "SmartDebuff";
SMARTBUFF_OFT_PURGE_DATA = "您确定要重置所有 SmartBuff 数据吗?\n此操作将强制重新加载 UI!";
SMARTBUFF_OFT_RESETBUFFS = "Reset Buffs";
SMARTBUFF_OFT_PURGE_BUFFS = "New Version, reset ALL SmartBuff buff data?\nThis will reset all buff profiles!";
SMARTBUFF_OFT_REQ_RELOAD = "新版本需要重新加载 GUI\n准备就绪后单击继续。";
SMARTBUFF_OFT_YES = "是的";
SMARTBUFF_OFT_NO = "";
Expand Down
2 changes: 2 additions & 0 deletions localization.de.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ SMARTBUFF_OFT_LINKGRPBUFFCHECK = "Grp Link";
SMARTBUFF_OFT_LINKSELFBUFFCHECK = "Selbst Link";
SMARTBUFF_OFT_RESETALL = "Reset Alles";
SMARTBUFF_OFT_RESETLIST = "Reset Liste";
SMARTBUFF_OFT_RESETBUFFS = "Reset Buffs";
SMARTBUFF_OFT_PURGE_BUFFS = "New Version, reset ALL SmartBuff buff data?\nThis will reset all buff profiles!";
SMARTBUFF_OFT_YES = "Ja";
SMARTBUFF_OFT_NO = "Nein";
SMARTBUFF_OFT_OKAY = "Neu laden"
Expand Down
9 changes: 6 additions & 3 deletions localization.en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ SMARTBUFF_WHATSNEW = "\n\n|cffffffff Whats new:|r\n\n"
.." |cffffffffDragonflight version by Codermik, additional retail\n"
.." programming by Speedwaystar/MrWizard.\n"
.."\n\n"
.." Changes in r30.011024:\n\n"
.." * Delve performance bug fix.\n"
.." * Adding hearty food missing items\n"
.." Changes in r32.151124:\n\n"
.." * Purge buffs, not options on new release\n"
.." * No forced UI reloads, less disruptions\n"
.." * Bunch of minor bug fixes\n"
.."\n\n"
.." |c0000FF96Many thanks to Chris S., Samantha R. and\n"
.." Twilight's Sundries for their kind donations.\n"
Expand Down Expand Up @@ -109,6 +110,8 @@ SMARTBUFF_OFT_LINKGRPBUFFCHECK = "Grp link";
SMARTBUFF_OFT_LINKSELFBUFFCHECK = "Self link";
SMARTBUFF_OFT_RESETALL = "Reset All";
SMARTBUFF_OFT_RESETLIST = "Reset List";
SMARTBUFF_OFT_RESETBUFFS = "Reset Buffs";
SMARTBUFF_OFT_PURGE_BUFFS = "New Version, reset ALL SmartBuff buff data?\nThis will reset all buff profiles!";
SMARTBUFF_OFT_YES = "Yes";
SMARTBUFF_OFT_NO = "No";
SMARTBUFF_OFT_OKAY = "Continue"
Expand Down
2 changes: 2 additions & 0 deletions localization.es.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ SMARTBUFF_OFT_LINKGRPBUFFCHECK = "Grp link";
SMARTBUFF_OFT_LINKSELFBUFFCHECK = "Self link";
SMARTBUFF_OFT_RESETALL = "Reset All";
SMARTBUFF_OFT_RESETLIST = "Reset List";
SMARTBUFF_OFT_RESETBUFFS = "Reset Buffs";
SMARTBUFF_OFT_PURGE_BUFFS = "New Version, reset ALL SmartBuff buff data?\nThis will reset all buff profiles!";
SMARTBUFF_OFT_YES = "Yes";
SMARTBUFF_OFT_NO = "No";
SMARTBUFF_OFT_OKAY = "Continuar"
Expand Down
2 changes: 2 additions & 0 deletions localization.fr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ SMARTBUFF_OFT_LINKGRPBUFFCHECK = "Grp link";
SMARTBUFF_OFT_LINKSELFBUFFCHECK = "Self link";
SMARTBUFF_OFT_RESETALL = "Reset All";
SMARTBUFF_OFT_RESETLIST = "Reset List";
SMARTBUFF_OFT_RESETBUFFS = "Reset Buffs";
SMARTBUFF_OFT_PURGE_BUFFS = "New Version, reset ALL SmartBuff buff data?\nThis will reset all buff profiles!";
SMARTBUFF_OFT_YES = "Oui";
SMARTBUFF_OFT_NO = "No";
SMARTBUFF_OFT_OKAY = "Continuer"
Expand Down
2 changes: 2 additions & 0 deletions localization.ru.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ SMARTBUFF_OFT_LINKGRPBUFFCHECK = "Grp link";
SMARTBUFF_OFT_LINKSELFBUFFCHECK = "Self link";
SMARTBUFF_OFT_RESETALL = "Reset All";
SMARTBUFF_OFT_RESETLIST = "Reset List";
SMARTBUFF_OFT_RESETBUFFS = "Reset Buffs";
SMARTBUFF_OFT_PURGE_BUFFS = "New Version, reset ALL SmartBuff buff data?\nThis will reset all buff profiles!";
SMARTBUFF_OFT_YES = "Да";
SMARTBUFF_OFT_NO = "Нет";
SMARTBUFF_OFT_OKAY = "Продолжать"
Expand Down
2 changes: 2 additions & 0 deletions localization.tw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ SMARTBUFF_OFT_LINKGRPBUFFCHECK = "團隊buff檢查";
SMARTBUFF_OFT_LINKSELFBUFFCHECK = "自我buff檢查";
SMARTBUFF_OFT_RESETALL = "重置設定";
SMARTBUFF_OFT_RESETLIST = "重置法術清單";
SMARTBUFF_OFT_RESETBUFFS = "Reset Buffs";
SMARTBUFF_OFT_PURGE_BUFFS = "New Version, reset ALL SmartBuff buff data?\nThis will reset all buff profiles!";
SMARTBUFF_OFT_YES = "";
SMARTBUFF_OFT_NO = "";
SMARTBUFF_OFT_OKAY = "继续"
Expand Down

0 comments on commit 5568c3e

Please sign in to comment.