diff --git a/TitanClassicRegen/TitanClassicRegen.lua b/TitanClassicRegen/TitanClassicRegen.lua new file mode 100644 index 0000000..9fa90ad --- /dev/null +++ b/TitanClassicRegen/TitanClassicRegen.lua @@ -0,0 +1,325 @@ +-- ************************************************************************** +-- * TitanClassicRegen.lua +-- * +-- * By: TitanMod, Dark Imakuni, Adsertor and the Titan Panel Development Team +-- ************************************************************************** + +-- ******************************** Constants ******************************* +local TITAN_REGEN_ID = "Regen" +local TITAN_REGEN_HP_FORMAT = "%d"; +local TITAN_REGEN_HP_FORMAT_PERCENT = "%.2f"; +local TITAN_REGEN_MP_FORMAT = "%d"; +local TITAN_REGEN_MP_FORMAT_PERCENT = "%.2f"; +local updateTable = {TITAN_REGEN_ID, TITAN_PANEL_UPDATE_ALL}; +-- ******************************** Variables ******************************* +local TITAN_RegenCurrHealth = 0; +local TITAN_RegenCurrMana = 0; +local TITAN_RegenMP = 0; +local TITAN_RegenHP = 0; +local TITAN_RegenCheckedManaState = 0; +local TITAN_RegenMaxHPRate = 0; +local TITAN_RegenMinHPRate = 9999; +local TITAN_RegenMaxMPRate = 0; +local TITAN_RegenMinMPRate = 9999; +local TITAN_RegenMPDuringCombat = 0; +local TITAN_RegenMPCombatTrack = 0; +local L = LibStub("AceLocale-3.0"):GetLocale("TitanClassic", true) +-- ******************************** Functions ******************************* + +-- ************************************************************************** +-- NAME : TitanRegenTemp_GetColoredTextRGB(text, r, g, b) +-- DESC : Define colors for colored text and display +-- VARS : text = text to display, r = red value, g = green value, b = blue value +-- ************************************************************************** +local function TitanRegenTemp_GetColoredTextRGB(text, r, g, b) + if (text and r and g and b) then + local redColorCode = format("%02x", r * 255); + local greenColorCode = format("%02x", g * 255); + local blueColorCode = format("%02x", b * 255); + local colorCode = "|cff"..redColorCode..greenColorCode..blueColorCode; + return colorCode..text..FONT_COLOR_CODE_CLOSE; + end +end + +-- ************************************************************************** +-- NAME : TitanPanelTitanRegenButton_OnLoad() +-- DESC : Registers the plugin upon it loading +-- ************************************************************************** +function TitanPanelTitanRegenButton_OnLoad(self) + self.registry = { + id = TITAN_REGEN_ID, + category = "Built-ins", + version = TITAN_VERSION, + menuText = L["TITAN_REGEN_MENU_TEXT"], + buttonTextFunction = "TitanPanelTitanRegenButton_GetButtonText", + tooltipTitle = L["TITAN_REGEN_MENU_TOOLTIP_TITLE"], + tooltipTextFunction = "TitanPanelTitanRegenButton_GetTooltipText", + controlVariables = { + ShowIcon = false, + ShowLabelText = true, + ShowRegularText = false, + ShowColoredText = false, + DisplayOnRightSide = false + }, + savedVariables = { + ShowLabelText = 1, + ShowMPRegen = 1, + ShowHPRegen = 1, + ShowPercentage = false, + ShowColoredText = false + } + }; + + self:RegisterEvent("UNIT_HEALTH"); + self:RegisterEvent("UNIT_MANA"); + self:RegisterEvent("PLAYER_ENTERING_WORLD"); + self:RegisterEvent("PLAYER_REGEN_DISABLED"); + self:RegisterEvent("PLAYER_REGEN_ENABLED"); +end + +-- ************************************************************************** +-- NAME : TitanPanelXPButton_OnEvent +-- DESC : Parse events registered to addon and act on them +-- ************************************************************************** +function TitanPanelTitanRegenButton_OnEvent(self, event, a1, ...) + if ( event == "PLAYER_ENTERING_WORLD") then + if (UnitPowerMax("player") == 0) then + TitanSetVar(TITAN_REGEN_ID, "ShowMPRegen", 0); + end + end + + if ( event == "PLAYER_REGEN_DISABLED") then + TITAN_RegenMPDuringCombat = 0; + TITAN_RegenMPCombatTrack = 1; + end + + if ( event == "PLAYER_REGEN_ENABLED") then + TITAN_RegenMPCombatTrack = 0; + end + + local currHealth = 0; + local currMana = 0; + local runUpdate = 0; + + if (TitanGetVar(TITAN_REGEN_ID,"ShowHPRegen") == 1) then + if ( event == "UNIT_HEALTH" and a1 == "player" ) then + currHealth = UnitHealth("player"); + runUpdate = 1; + if ( currHealth > TITAN_RegenCurrHealth and TITAN_RegenCurrHealth ~= 0 ) then + TITAN_RegenHP = currHealth-TITAN_RegenCurrHealth; + + if (TITAN_RegenHP > TITAN_RegenMaxHPRate) then + TITAN_RegenMaxHPRate = TITAN_RegenHP; + end + if (TITAN_RegenHP < TITAN_RegenMinHPRate or TITAN_RegenMinHPRate == 9999) then + TITAN_RegenMinHPRate = TITAN_RegenHP; + end + end + TITAN_RegenCurrHealth = currHealth; + end + end + + if (TitanGetVar(TITAN_REGEN_ID,"ShowMPRegen") == 1) then + if ( event == "UNIT_MANA" and a1 == "player" ) then + currMana = UnitMana("player"); + runUpdate = 1; + if ( currMana > TITAN_RegenCurrMana and TITAN_RegenCurrMana ~= 0 ) then + TITAN_RegenMP = currMana-TITAN_RegenCurrMana; + + if (TITAN_RegenMPCombatTrack == 1) then + TITAN_RegenMPDuringCombat = TITAN_RegenMPDuringCombat + TITAN_RegenMP; + end + + if (TITAN_RegenMP > TITAN_RegenMaxMPRate) then + TITAN_RegenMaxMPRate = TITAN_RegenMP; + end + if (TITAN_RegenMP < TITAN_RegenMinMPRate or TITAN_RegenMinMPRate == 9999) then + TITAN_RegenMinMPRate = TITAN_RegenMP; + end + end + TITAN_RegenCurrMana = currMana; + end + end + + if (runUpdate == 1) then + TitanPanelPluginHandle_OnUpdate(updateTable) + end +end + +-- ************************************************************************** +-- NAME : TitanPanelTitanRegenButton_GetButtonText(id) +-- DESC : Calculate regeneration logic for button text +-- VARS : id = button ID +-- ************************************************************************** +function TitanPanelTitanRegenButton_GetButtonText(id) + local labelTextHP = ""; + local valueTextHP = ""; + local labelTextMP = ""; + local valueTextMP = ""; + local OutputStr = ""; + + if UnitHealth("player") == UnitHealthMax("player") then + TITAN_RegenHP = 0; + end + if UnitMana("player") == UnitPowerMax("player") then + TITAN_RegenMP = 0; + end + + -- safety in case both are off, then cant ever turn em on + if (TitanGetVar(TITAN_REGEN_ID,"ShowHPRegen") == nil and TitanGetVar(TITAN_REGEN_ID,"ShowMPRegen") == nil) then + TitanSetVar(TITAN_REGEN_ID,"ShowHPRegen",1); + end + + if (TitanGetVar(TITAN_REGEN_ID,"ShowHPRegen") == 1) then + labelTextHP = L["TITAN_REGEN_BUTTON_TEXT_HP"]; + if (TitanGetVar(TITAN_REGEN_ID,"ShowPercentage") == 1) then + valueTextHP = format(TITAN_REGEN_HP_FORMAT_PERCENT, (TITAN_RegenHP/UnitHealthMax("player"))*100); + else + valueTextHP = format(TITAN_REGEN_HP_FORMAT, TITAN_RegenHP); + end + if (TitanGetVar(TITAN_REGEN_ID, "ShowColoredText")) then + valueTextHP = TitanUtils_GetGreenText(valueTextHP); + else + valueTextHP = TitanUtils_GetHighlightText(valueTextHP); + end + end + + if (TitanGetVar(TITAN_REGEN_ID,"ShowMPRegen") == 1) then + labelTextMP = L["TITAN_REGEN_BUTTON_TEXT_MP"]; + if (TitanGetVar(TITAN_REGEN_ID,"ShowPercentage") == 1) then + valueTextMP = format(TITAN_REGEN_MP_FORMAT_PERCENT, (TITAN_RegenMP/UnitPowerMax("player"))*100); + else + valueTextMP = format(TITAN_REGEN_MP_FORMAT, TITAN_RegenMP); + end + if (TitanGetVar(TITAN_REGEN_ID, "ShowColoredText")) then + valueTextMP = TitanRegenTemp_GetColoredTextRGB(valueTextMP, 0.0, 0.0, 1.0); + else + valueTextMP = TitanUtils_GetHighlightText(valueTextMP); + end + end + + -- supports turning off labels + return labelTextHP, valueTextHP, labelTextMP, valueTextMP; +end + +-- ************************************************************************** +-- NAME : TitanPanelTitanRegenButton_GetTooltipText() +-- DESC : Display tooltip text +-- ************************************************************************** +function TitanPanelTitanRegenButton_GetTooltipText() + + local minHP = TITAN_RegenMinHPRate; + local minMP = TITAN_RegenMinMPRate; + + if minHP == 9999 then minHP = 0 end; + if minMP == 9999 then minMP = 0 end; + + if (TitanGetVar(TITAN_REGEN_ID,"ShowMPRegen") == 1) then + local regenPercent; + regenPercent = (TITAN_RegenMPDuringCombat/UnitPowerMax("player"))*100; + + return "".. + format(L["TITAN_REGEN_TOOLTIP1"], UnitHealth("player"),UnitHealthMax("player"),UnitHealthMax("player")-UnitHealth("player")).."\n".. + format(L["TITAN_REGEN_TOOLTIP2"], UnitMana("player"),UnitPowerMax("player"),UnitPowerMax("player")-UnitMana("player")).."\n".. + format(L["TITAN_REGEN_TOOLTIP3"], TITAN_RegenMaxHPRate).."\n".. + format(L["TITAN_REGEN_TOOLTIP4"], minHP).."\n".. + format(L["TITAN_REGEN_TOOLTIP5"], TITAN_RegenMaxMPRate).."\n".. + format(L["TITAN_REGEN_TOOLTIP6"], minMP).."\n".. + format(L["TITAN_REGEN_TOOLTIP7"], TITAN_RegenMPDuringCombat, regenPercent).."\n" + ; + else + return "".. + format(L["TITAN_REGEN_TOOLTIP1"], UnitHealth("player"),UnitHealthMax("player"),UnitHealthMax("player")-UnitHealth("player")).."\n".. + format(L["TITAN_REGEN_TOOLTIP3"], TITAN_RegenMaxHPRate).."\n".. + format(L["TITAN_REGEN_TOOLTIP4"], minHP).."\n" + ; + end +end + +-- ************************************************************************** +-- NAME : TitanPanelRightClickMenu_PrepareTitanRegenMenu() +-- DESC : Display rightclick menu options +-- ************************************************************************** +function TitanPanelRightClickMenu_PrepareTitanRegenMenu() + local id = TITAN_REGEN_ID; + local info; + + TitanPanelRightClickMenu_AddTitle(TitanPlugins[id].menuText); + + info = {}; + info.text = L["TITAN_REGEN_MENU_SHOW2"]; + info.func = TitanRegen_ShowHPRegen; + info.checked = TitanGetVar(TITAN_REGEN_ID,"ShowHPRegen"); + L_UIDropDownMenu_AddButton(info); + + info = {}; + info.text = L["TITAN_REGEN_MENU_SHOW3"]; + info.func = TitanRegen_ShowMPRegen; + info.checked = TitanGetVar(TITAN_REGEN_ID,"ShowMPRegen"); + L_UIDropDownMenu_AddButton(info); + + info = {}; + info.text = L["TITAN_REGEN_MENU_SHOW4"]; + info.func = TitanRegen_ShowPercentage; + info.checked = TitanGetVar(TITAN_REGEN_ID,"ShowPercentage"); + L_UIDropDownMenu_AddButton(info); + + TitanPanelRightClickMenu_AddSpacer(); + + info = {}; + info.text = L["TITAN_PANEL_MENU_SHOW_COLORED_TEXT"]; + info.func = TitanRegen_ShowColoredText; + info.checked = TitanGetVar(TITAN_REGEN_ID, "ShowColoredText"); + L_UIDropDownMenu_AddButton(info); + + TitanPanelRightClickMenu_AddToggleLabelText("TitanRegen"); + TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], id, TITAN_PANEL_MENU_FUNC_HIDE); +end + +-- ************************************************************************** +-- NAME : TitanRegen_UpdateSettings() +-- DESC : Update button text on setting change +-- ************************************************************************** +function TitanRegen_UpdateSettings() + -- safety in case both are off, then cant ever turn em on + if (TitanGetVar(TITAN_REGEN_ID,"ShowHPRegen") == nil and TitanGetVar(TITAN_REGEN_ID,"ShowMPRegen") == nil) then + TitanSetVar(TITAN_REGEN_ID,"ShowHPRegen",1); + end + TitanPanelButton_UpdateButton(TITAN_REGEN_ID); +end + +-- ************************************************************************** +-- NAME : TitanRegen_ShowHPRegen() +-- DESC : Show HP regeneration option on button +-- ************************************************************************** +function TitanRegen_ShowHPRegen() + TitanToggleVar(TITAN_REGEN_ID, "ShowHPRegen"); + TitanRegen_UpdateSettings(); +end + +-- ************************************************************************** +-- NAME : TitanRegen_ShowMPRegen() +-- DESC : Show MP regeneration option on button +-- ************************************************************************** +function TitanRegen_ShowMPRegen() + TitanToggleVar(TITAN_REGEN_ID, "ShowMPRegen"); + TitanRegen_UpdateSettings(); +end + +-- ************************************************************************** +-- NAME : TitanRegen_ShowPercentage() +-- DESC : Show values as percentage option on button +-- ************************************************************************** +function TitanRegen_ShowPercentage() + TitanToggleVar(TITAN_REGEN_ID, "ShowPercentage"); + TitanRegen_UpdateSettings(); +end + +-- ************************************************************************** +-- NAME : TitanRegen_ShowColoredText() +-- DESC : Show colored text option on button +-- ************************************************************************** +function TitanRegen_ShowColoredText() + TitanToggleVar(TITAN_REGEN_ID, "ShowColoredText"); + TitanRegen_UpdateSettings(); +end \ No newline at end of file diff --git a/TitanClassicRegen/TitanClassicRegen.toc b/TitanClassicRegen/TitanClassicRegen.toc new file mode 100644 index 0000000..959523d --- /dev/null +++ b/TitanClassicRegen/TitanClassicRegen.toc @@ -0,0 +1,10 @@ +## Interface: 11302 +## Title: Titan Panel Classic [|cffeda55fRegen|r] |cff00aa001.1.0.11302|r +## Notes: Adds a regen monitor to Titan panel to show HP/MANA regen +## Author: Titan Panel Development Team (http://www.titanpanel.org) +## SavedVariables: +## OptionalDeps: +## Dependencies: TitanClassic +## Version: 1.1.0.11302 +## X-Child-Of: TitanClassic +TitanClassicRegen.xml \ No newline at end of file diff --git a/TitanClassicRegen/TitanClassicRegen.xml b/TitanClassicRegen/TitanClassicRegen.xml new file mode 100644 index 0000000..779f1e0 --- /dev/null +++ b/TitanClassicRegen/TitanClassicRegen.xml @@ -0,0 +1,19 @@ +<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ +..\FrameXML\UI.xsd"> + <Script file="TitanClassicRegen.lua"/> + <Frame parent="UIParent"> + <Frames> + <Button name="TitanPanelTitanRegenButton" inherits="TitanPanelTextTemplate" frameStrata="FULLSCREEN" toplevel="true"> + <Scripts> + <OnLoad> + TitanPanelTitanRegenButton_OnLoad(self); + TitanPanelButton_OnLoad(self); + </OnLoad> + <OnEvent> + TitanPanelTitanRegenButton_OnEvent(self, event, ...); + </OnEvent> + </Scripts> + </Button> + </Frames> + </Frame> +</Ui> \ No newline at end of file diff --git a/TitanClassicRegen/TitanRegen.lua b/TitanClassicRegen/TitanRegen.lua deleted file mode 100644 index 9c79b85..0000000 --- a/TitanClassicRegen/TitanRegen.lua +++ /dev/null @@ -1,326 +0,0 @@ --- ************************************************************************** --- * TitanClassicRegen.lua --- * --- * By: TitanMod, Dark Imakuni, Adsertor and the Titan Panel Development Team --- ************************************************************************** - --- ******************************** Constants ******************************* -local TITAN_REGEN_ID = "Regen" -local TITAN_REGEN_HP_FORMAT = "%d"; -local TITAN_REGEN_HP_FORMAT_PERCENT = "%.2f"; -local TITAN_REGEN_MP_FORMAT = "%d"; -local TITAN_REGEN_MP_FORMAT_PERCENT = "%.2f"; -local updateTable = {TITAN_REGEN_ID, TITAN_PANEL_UPDATE_ALL}; --- ******************************** Variables ******************************* -local TITAN_RegenCurrHealth = 0; -local TITAN_RegenCurrMana = 0; -local TITAN_RegenMP = 0; -local TITAN_RegenHP = 0; -local TITAN_RegenCheckedManaState = 0; -local TITAN_RegenMaxHPRate = 0; -local TITAN_RegenMinHPRate = 9999; -local TITAN_RegenMaxMPRate = 0; -local TITAN_RegenMinMPRate = 9999; -local TITAN_RegenMPDuringCombat = 0; -local TITAN_RegenMPCombatTrack = 0; -local L = LibStub("AceLocale-3.0"):GetLocale("TitanClassic", true) --- ******************************** Functions ******************************* - --- ************************************************************************** --- NAME : TitanRegenTemp_GetColoredTextRGB(text, r, g, b) --- DESC : Define colors for colored text and display --- VARS : text = text to display, r = red value, g = green value, b = blue value --- ************************************************************************** -local function TitanRegenTemp_GetColoredTextRGB(text, r, g, b) - if (text and r and g and b) then - local redColorCode = format("%02x", r * 255); - local greenColorCode = format("%02x", g * 255); - local blueColorCode = format("%02x", b * 255); - local colorCode = "|cff"..redColorCode..greenColorCode..blueColorCode; - return colorCode..text..FONT_COLOR_CODE_CLOSE; - end -end - --- ************************************************************************** --- NAME : TitanPanelTitanRegenButton_OnLoad() --- DESC : Registers the plugin upon it loading --- ************************************************************************** -function TitanPanelTitanRegenButton_OnLoad(self) - self.registry = { - id = TITAN_REGEN_ID, - category = "Built-ins", - version = TITAN_VERSION, - menuText = L["TITAN_REGEN_MENU_TEXT"], - buttonTextFunction = "TitanPanelTitanRegenButton_GetButtonText", - tooltipTitle = L["TITAN_REGEN_MENU_TOOLTIP_TITLE"], - tooltipTextFunction = "TitanPanelTitanRegenButton_GetTooltipText", - controlVariables = { - ShowIcon = false, - ShowLabelText = true, - ShowRegularText = false, - ShowColoredText = false, - DisplayOnRightSide = false - }, - savedVariables = { - ShowLabelText = 1, - ShowMPRegen = 1, - ShowHPRegen = 1, - ShowPercentage = false, - ShowColoredText = false - } - - }; - - self:RegisterEvent("UNIT_HEALTH"); - self:RegisterEvent("UNIT_MANA"); - self:RegisterEvent("PLAYER_ENTERING_WORLD"); - self:RegisterEvent("PLAYER_REGEN_DISABLED"); - self:RegisterEvent("PLAYER_REGEN_ENABLED"); -end - --- ************************************************************************** --- NAME : TitanPanelXPButton_OnEvent --- DESC : Parse events registered to addon and act on them --- ************************************************************************** -function TitanPanelTitanRegenButton_OnEvent(self, event, a1, ...) - if ( event == "PLAYER_ENTERING_WORLD") then - if (UnitManaMax("player") == 0) then - TitanSetVar(TITAN_REGEN_ID, "ShowMPRegen", 0); - end - end - - if ( event == "PLAYER_REGEN_DISABLED") then - TITAN_RegenMPDuringCombat = 0; - TITAN_RegenMPCombatTrack = 1; - end - - if ( event == "PLAYER_REGEN_ENABLED") then - TITAN_RegenMPCombatTrack = 0; - end - - local currHealth = 0; - local currMana = 0; - local runUpdate = 0; - - if (TitanGetVar(TITAN_REGEN_ID,"ShowHPRegen") == 1) then - if ( event == "UNIT_HEALTH" and a1 == "player" ) then - currHealth = UnitHealth("player"); - runUpdate = 1; - if ( currHealth > TITAN_RegenCurrHealth and TITAN_RegenCurrHealth ~= 0 ) then - TITAN_RegenHP = currHealth-TITAN_RegenCurrHealth; - - if (TITAN_RegenHP > TITAN_RegenMaxHPRate) then - TITAN_RegenMaxHPRate = TITAN_RegenHP; - end - if (TITAN_RegenHP < TITAN_RegenMinHPRate or TITAN_RegenMinHPRate == 9999) then - TITAN_RegenMinHPRate = TITAN_RegenHP; - end - end - TITAN_RegenCurrHealth = currHealth; - end - end - - if (TitanGetVar(TITAN_REGEN_ID,"ShowMPRegen") == 1) then - if ( event == "UNIT_MANA" and a1 == "player" ) then - currMana = UnitMana("player"); - runUpdate = 1; - if ( currMana > TITAN_RegenCurrMana and TITAN_RegenCurrMana ~= 0 ) then - TITAN_RegenMP = currMana-TITAN_RegenCurrMana; - - if (TITAN_RegenMPCombatTrack == 1) then - TITAN_RegenMPDuringCombat = TITAN_RegenMPDuringCombat + TITAN_RegenMP; - end - - if (TITAN_RegenMP > TITAN_RegenMaxMPRate) then - TITAN_RegenMaxMPRate = TITAN_RegenMP; - end - if (TITAN_RegenMP < TITAN_RegenMinMPRate or TITAN_RegenMinMPRate == 9999) then - TITAN_RegenMinMPRate = TITAN_RegenMP; - end - end - TITAN_RegenCurrMana = currMana; - end - end - - if (runUpdate == 1) then - TitanPanelPluginHandle_OnUpdate(updateTable) - end -end - --- ************************************************************************** --- NAME : TitanPanelTitanRegenButton_GetButtonText(id) --- DESC : Calculate regeneration logic for button text --- VARS : id = button ID --- ************************************************************************** -function TitanPanelTitanRegenButton_GetButtonText(id) - local labelTextHP = ""; - local valueTextHP = ""; - local labelTextMP = ""; - local valueTextMP = ""; - local OutputStr = ""; - - if UnitHealth("player") == UnitHealthMax("player") then - TITAN_RegenHP = 0; - end - if UnitMana("player") == UnitManaMax("player") then - TITAN_RegenMP = 0; - end - - -- safety in case both are off, then cant ever turn em on - if (TitanGetVar(TITAN_REGEN_ID,"ShowHPRegen") == nil and TitanGetVar(TITAN_REGEN_ID,"ShowMPRegen") == nil) then - TitanSetVar(TITAN_REGEN_ID,"ShowHPRegen",1); - end - - if (TitanGetVar(TITAN_REGEN_ID,"ShowHPRegen") == 1) then - labelTextHP = L["TITAN_REGEN_BUTTON_TEXT_HP"]; - if (TitanGetVar(TITAN_REGEN_ID,"ShowPercentage") == 1) then - valueTextHP = format(TITAN_REGEN_HP_FORMAT_PERCENT, (TITAN_RegenHP/UnitHealthMax("player"))*100); - else - valueTextHP = format(TITAN_REGEN_HP_FORMAT, TITAN_RegenHP); - end - if (TitanGetVar(TITAN_REGEN_ID, "ShowColoredText")) then - valueTextHP = TitanUtils_GetGreenText(valueTextHP); - else - valueTextHP = TitanUtils_GetHighlightText(valueTextHP); - end - end - - if (TitanGetVar(TITAN_REGEN_ID,"ShowMPRegen") == 1) then - labelTextMP = L["TITAN_REGEN_BUTTON_TEXT_MP"]; - if (TitanGetVar(TITAN_REGEN_ID,"ShowPercentage") == 1) then - valueTextMP = format(TITAN_REGEN_MP_FORMAT_PERCENT, (TITAN_RegenMP/UnitManaMax("player"))*100); - else - valueTextMP = format(TITAN_REGEN_MP_FORMAT, TITAN_RegenMP); - end - if (TitanGetVar(TITAN_REGEN_ID, "ShowColoredText")) then - valueTextMP = TitanRegenTemp_GetColoredTextRGB(valueTextMP, 0.0, 0.0, 1.0); - else - valueTextMP = TitanUtils_GetHighlightText(valueTextMP); - end - end - - -- supports turning off labels - return labelTextHP, valueTextHP, labelTextMP, valueTextMP; -end - --- ************************************************************************** --- NAME : TitanPanelTitanRegenButton_GetTooltipText() --- DESC : Display tooltip text --- ************************************************************************** -function TitanPanelTitanRegenButton_GetTooltipText() - - local minHP = TITAN_RegenMinHPRate; - local minMP = TITAN_RegenMinMPRate; - - if minHP == 9999 then minHP = 0 end; - if minMP == 9999 then minMP = 0 end; - - if (TitanGetVar(TITAN_REGEN_ID,"ShowMPRegen") == 1) then - local regenPercent; - regenPercent = (TITAN_RegenMPDuringCombat/UnitManaMax("player"))*100; - - return "".. - format(L["TITAN_REGEN_TOOLTIP1"], UnitHealth("player"),UnitHealthMax("player"),UnitHealthMax("player")-UnitHealth("player")).."\n".. - format(L["TITAN_REGEN_TOOLTIP2"], UnitMana("player"),UnitManaMax("player"),UnitManaMax("player")-UnitMana("player")).."\n".. - format(L["TITAN_REGEN_TOOLTIP3"], TITAN_RegenMaxHPRate).."\n".. - format(L["TITAN_REGEN_TOOLTIP4"], minHP).."\n".. - format(L["TITAN_REGEN_TOOLTIP5"], TITAN_RegenMaxMPRate).."\n".. - format(L["TITAN_REGEN_TOOLTIP6"], minMP).."\n".. - format(L["TITAN_REGEN_TOOLTIP7"], TITAN_RegenMPDuringCombat, regenPercent).."\n" - ; - else - return "".. - format(L["TITAN_REGEN_TOOLTIP1"], UnitHealth("player"),UnitHealthMax("player"),UnitHealthMax("player")-UnitHealth("player")).."\n".. - format(L["TITAN_REGEN_TOOLTIP3"], TITAN_RegenMaxHPRate).."\n".. - format(L["TITAN_REGEN_TOOLTIP4"], minHP).."\n" - ; - end -end - --- ************************************************************************** --- NAME : TitanPanelRightClickMenu_PrepareTitanRegenMenu() --- DESC : Display rightclick menu options --- ************************************************************************** -function TitanPanelRightClickMenu_PrepareTitanRegenMenu() - local id = TITAN_REGEN_ID; - local info; - - TitanPanelRightClickMenu_AddTitle(TitanPlugins[id].menuText); - - info = {}; - info.text = L["TITAN_REGEN_MENU_SHOW2"]; - info.func = TitanRegen_ShowHPRegen; - info.checked = TitanGetVar(TITAN_REGEN_ID,"ShowHPRegen"); - L_UIDropDownMenu_AddButton(info); - - info = {}; - info.text = L["TITAN_REGEN_MENU_SHOW3"]; - info.func = TitanRegen_ShowMPRegen; - info.checked = TitanGetVar(TITAN_REGEN_ID,"ShowMPRegen"); - L_UIDropDownMenu_AddButton(info); - - info = {}; - info.text = L["TITAN_REGEN_MENU_SHOW4"]; - info.func = TitanRegen_ShowPercentage; - info.checked = TitanGetVar(TITAN_REGEN_ID,"ShowPercentage"); - L_UIDropDownMenu_AddButton(info); - - TitanPanelRightClickMenu_AddSpacer(); - - info = {}; - info.text = L["TITAN_PANEL_MENU_SHOW_COLORED_TEXT"]; - info.func = TitanRegen_ShowColoredText; - info.checked = TitanGetVar(TITAN_REGEN_ID, "ShowColoredText"); - L_UIDropDownMenu_AddButton(info); - - TitanPanelRightClickMenu_AddToggleLabelText("TitanRegen"); - TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], id, TITAN_PANEL_MENU_FUNC_HIDE); -end - --- ************************************************************************** --- NAME : TitanRegen_UpdateSettings() --- DESC : Update button text on setting change --- ************************************************************************** -function TitanRegen_UpdateSettings() - -- safety in case both are off, then cant ever turn em on - if (TitanGetVar(TITAN_REGEN_ID,"ShowHPRegen") == nil and TitanGetVar(TITAN_REGEN_ID,"ShowMPRegen") == nil) then - TitanSetVar(TITAN_REGEN_ID,"ShowHPRegen",1); - end - TitanPanelButton_UpdateButton(TITAN_REGEN_ID); -end - --- ************************************************************************** --- NAME : TitanRegen_ShowHPRegen() --- DESC : Show HP regeneration option on button --- ************************************************************************** -function TitanRegen_ShowHPRegen() - TitanToggleVar(TITAN_REGEN_ID, "ShowHPRegen"); - TitanRegen_UpdateSettings(); -end - --- ************************************************************************** --- NAME : TitanRegen_ShowMPRegen() --- DESC : Show MP regeneration option on button --- ************************************************************************** -function TitanRegen_ShowMPRegen() - TitanToggleVar(TITAN_REGEN_ID, "ShowMPRegen"); - TitanRegen_UpdateSettings(); -end - --- ************************************************************************** --- NAME : TitanRegen_ShowPercentage() --- DESC : Show values as percentage option on button --- ************************************************************************** -function TitanRegen_ShowPercentage() - TitanToggleVar(TITAN_REGEN_ID, "ShowPercentage"); - TitanRegen_UpdateSettings(); -end - --- ************************************************************************** --- NAME : TitanRegen_ShowColoredText() --- DESC : Show colored text option on button --- ************************************************************************** -function TitanRegen_ShowColoredText() - TitanToggleVar(TITAN_REGEN_ID, "ShowColoredText"); - TitanRegen_UpdateSettings(); -end \ No newline at end of file diff --git a/TitanClassicRegen/TitanRegen.toc b/TitanClassicRegen/TitanRegen.toc deleted file mode 100644 index 959523d..0000000 --- a/TitanClassicRegen/TitanRegen.toc +++ /dev/null @@ -1,10 +0,0 @@ -## Interface: 11302 -## Title: Titan Panel Classic [|cffeda55fRegen|r] |cff00aa001.1.0.11302|r -## Notes: Adds a regen monitor to Titan panel to show HP/MANA regen -## Author: Titan Panel Development Team (http://www.titanpanel.org) -## SavedVariables: -## OptionalDeps: -## Dependencies: TitanClassic -## Version: 1.1.0.11302 -## X-Child-Of: TitanClassic -TitanClassicRegen.xml \ No newline at end of file diff --git a/TitanClassicRegen/TitanRegen.xml b/TitanClassicRegen/TitanRegen.xml deleted file mode 100644 index 779f1e0..0000000 --- a/TitanClassicRegen/TitanRegen.xml +++ /dev/null @@ -1,19 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ -..\FrameXML\UI.xsd"> - <Script file="TitanClassicRegen.lua"/> - <Frame parent="UIParent"> - <Frames> - <Button name="TitanPanelTitanRegenButton" inherits="TitanPanelTextTemplate" frameStrata="FULLSCREEN" toplevel="true"> - <Scripts> - <OnLoad> - TitanPanelTitanRegenButton_OnLoad(self); - TitanPanelButton_OnLoad(self); - </OnLoad> - <OnEvent> - TitanPanelTitanRegenButton_OnEvent(self, event, ...); - </OnEvent> - </Scripts> - </Button> - </Frames> - </Frame> -</Ui> \ No newline at end of file