mirror of
https://github.com/brues-code/Vanilla_MikScrollingBattleText.git
synced 2026-10-05 05:00:03 +00:00
Patch 4.0
Patch 4.0
This commit is contained in:
@@ -151,6 +151,7 @@ local searchPatternTriggers = {};
|
||||
-- Holds previous health and mana values.
|
||||
local lastSelfHealthPercentage = 0;
|
||||
local lastSelfManaPercentage = 0;
|
||||
local lastSelfManaAmount = UnitMana("player");
|
||||
local lastPetHealthPercentage = 0;
|
||||
local lastEnemyHealthPercentage = 0;
|
||||
local lastFriendlyHealthPercentage = 0;
|
||||
@@ -3450,7 +3451,9 @@ function MikCEH.ParseSelfHealthTriggers()
|
||||
-- Get trigger event data and call the trigger handler.
|
||||
local eventData = MikCEH.GetThresholdTriggerEventData(triggerKey, healthAmount);
|
||||
MikCEH.SendTriggerEvent(eventData);
|
||||
PlaySoundFile("Interface\\AddOns\\MikScrollingBattleText\\sounds\\LowHealth.mp3");
|
||||
if MikSBT.CurrentProfile.LowHealthSound then
|
||||
PlaySoundFile("Interface\\AddOns\\MikScrollingBattleText\\sounds\\LowHealth.mp3");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3467,7 +3470,14 @@ function MikCEH.ParseSelfManaTriggers()
|
||||
if (UnitPowerType("player") == 0) then
|
||||
local manaAmount = UnitMana("player");
|
||||
local manaPercentage = manaAmount / UnitManaMax("player");
|
||||
|
||||
|
||||
-- Mana per Five Ticks
|
||||
local manaDiff = manaAmount - lastSelfManaAmount;
|
||||
if ( manaDiff > 0 and MikSBT.CurrentProfile.ShowAllManaGains) then
|
||||
local eventData = MikCEH.GetNotificationEventData(MikCEH.NOTIFICATIONTYPE_POWER_GAIN, manaDiff.." "..MANA, 0);
|
||||
MikCEH.SendEvent(eventData);
|
||||
end
|
||||
|
||||
-- Loop through self mana triggers.
|
||||
for triggerKey, triggerSettings in selfManaTriggers do
|
||||
-- Check if we just crossed the trigger's threshold.
|
||||
@@ -3475,12 +3485,15 @@ function MikCEH.ParseSelfManaTriggers()
|
||||
-- Get trigger event data and call the trigger handler.
|
||||
local eventData = MikCEH.GetThresholdTriggerEventData(triggerKey, manaAmount);
|
||||
MikCEH.SendTriggerEvent(eventData);
|
||||
PlaySoundFile("Interface\\AddOns\\MikScrollingBattleText\\sounds\\LowMana.mp3");
|
||||
if MikSBT.CurrentProfile.LowManaSound then
|
||||
PlaySoundFile("Interface\\AddOns\\MikScrollingBattleText\\sounds\\LowMana.mp3");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Update the last mana percentage.
|
||||
lastSelfManaPercentage = manaPercentage;
|
||||
lastSelfManaAmount = manaAmount;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1217,6 +1217,16 @@ function MikSBT.UpdateProfiles()
|
||||
profile.CreationVersion = 3.0;
|
||||
end
|
||||
|
||||
-- Check if the profile was created prior to version 4.0.
|
||||
if (profile.CreationVersion < 4.0) then
|
||||
|
||||
profile.ShowAllManaGains = false;
|
||||
profile.LowHealthSound = true;
|
||||
profile.LowManaSound = true;
|
||||
|
||||
profile.CreationVersion = 4.0;
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1517,6 +1527,10 @@ function MikSBT.AddAnimation(animationEvent)
|
||||
return;
|
||||
end
|
||||
end
|
||||
|
||||
if animationEvent.EventType == "MSBT_EVENTTYPE_NOTIFICATION_POWER_GAIN" and animationEvent.EffectName ~= 0 and MikSBT.CurrentProfile.ShowAllManaGains then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- Check if the animation event is to be displayed sticky style.
|
||||
@@ -1527,24 +1541,24 @@ function MikSBT.AddAnimation(animationEvent)
|
||||
-- Color UnitName by class
|
||||
local UnitID = MikCEH.GetUnitIDFromName(animationEvent.Name)
|
||||
if UnitID then
|
||||
local Class = UnitClass(UnitID)
|
||||
if Class and Class == "Paladin" then
|
||||
local _, Class = UnitClass(UnitID)
|
||||
if Class and Class == "PALADIN" then
|
||||
animationEvent.Text = string.gsub(animationEvent.Text, animationEvent.Name, "|cffF58CBA|h"..animationEvent.Name.."|h|r")
|
||||
elseif Class and Class == "Druide" then
|
||||
elseif Class and Class == "DRUID" then
|
||||
animationEvent.Text = string.gsub(animationEvent.Text, animationEvent.Name, "|cffFF7D0A|h"..animationEvent.Name.."|h|r")
|
||||
elseif Class and Class == "Chasseur" then
|
||||
elseif Class and Class == "HUNTER" then
|
||||
animationEvent.Text = string.gsub(animationEvent.Text, animationEvent.Name, "|cffABD473|h"..animationEvent.Name.."|h|r")
|
||||
elseif Class and Class == "Mage" then
|
||||
elseif Class and Class == "MAGE" then
|
||||
animationEvent.Text = string.gsub(animationEvent.Text, animationEvent.Name, "|cff69CCF0|h"..animationEvent.Name.."|h|r")
|
||||
elseif Class and Class == "Prêtre" then
|
||||
elseif Class and Class == "PRIEST" then
|
||||
animationEvent.Text = string.gsub(animationEvent.Text, animationEvent.Name, "|cffFFFFFF|h"..animationEvent.Name.."|h|r")
|
||||
elseif Class and Class == "Voleur" then
|
||||
elseif Class and Class == "ROGUE" then
|
||||
animationEvent.Text = string.gsub(animationEvent.Text, animationEvent.Name, "|cffFFF569|h"..animationEvent.Name.."|h|r")
|
||||
elseif Class and Class == "Chaman" then
|
||||
elseif Class and Class == "SHAMAN" then
|
||||
animationEvent.Text = string.gsub(animationEvent.Text, animationEvent.Name, "|cff0070DE|h"..animationEvent.Name.."|h|r")
|
||||
elseif Class and Class == "Démoniste" then
|
||||
elseif Class and Class == "WARLOCK" then
|
||||
animationEvent.Text = string.gsub(animationEvent.Text, animationEvent.Name, "|cff9482C9|h"..animationEvent.Name.."|h|r")
|
||||
elseif Class and Class == "Guerrier" then
|
||||
elseif Class and Class == "WARRIOR" then
|
||||
animationEvent.Text = string.gsub(animationEvent.Text, animationEvent.Name, "|cffC79C6E|h"..animationEvent.Name.."|h|r")
|
||||
end
|
||||
end
|
||||
@@ -1800,6 +1814,97 @@ function MikSBT.FindBuff( obuff, unit, item)
|
||||
tooltip:Hide();
|
||||
end
|
||||
|
||||
-- **********************************************************************************
|
||||
-- This function return some debug stuff
|
||||
-- for real.
|
||||
-- **********************************************************************************
|
||||
|
||||
local depth = 0
|
||||
|
||||
local function dump(...)
|
||||
local out = "";
|
||||
for i = 1, arg.n, 1 do
|
||||
if depth > 30 then
|
||||
out = out .. "|cffffd800... Too many things here!|r"
|
||||
return out;
|
||||
end
|
||||
local d = arg[i];
|
||||
local t = type(d);
|
||||
if (t == "table") then
|
||||
out = out .. "{ |cff9f9f9f--[[" .. tostring(arg[i]) .. "]]|r\n";
|
||||
local first = true;
|
||||
if (d) then
|
||||
for k, v in pairs(d) do
|
||||
if (not first) then out = out .. ", \n"; end
|
||||
first = false;
|
||||
depth = depth + 1
|
||||
out = out .. " " .. dump(k);
|
||||
out = out .. " = ";
|
||||
out = out .. dump(v);
|
||||
end
|
||||
end
|
||||
out = out .. "\n}, |cff9f9f9f--[[" .. tostring(arg[i]) .. "]]|r\n";
|
||||
elseif (t == "nil") then
|
||||
out = out .. "|cffff7f7fnil|r";
|
||||
elseif (t == "number") then
|
||||
out = out .. "|cffff7fff" .. d .. "|r";
|
||||
elseif (t == "string") then
|
||||
out = out .. '"|cff7fd5ff' .. d .. '|r"';
|
||||
elseif (t == "boolean") then
|
||||
if (d) then
|
||||
out = out .. "|cffff9100true|r";
|
||||
else
|
||||
out = out .. "|cffff9100false|r";
|
||||
end
|
||||
elseif (t == "function") then
|
||||
out = out .. "|cff7fd5ff" .. tostring(d) .. "|r";
|
||||
elseif (t == "userdata") then
|
||||
out = out .. string.format("|cffffea00<%s:%s>|r", t, getmetatable(d) or "(anon)")
|
||||
else
|
||||
out = out .. string.upper(t) .. "??";
|
||||
end
|
||||
|
||||
if (i < arg.n) then out = out .. ", "; end
|
||||
end
|
||||
return out;
|
||||
end
|
||||
|
||||
function MikSBT.debugPrint(...)
|
||||
local debugWin = 0;
|
||||
local name, shown;
|
||||
for i=1, NUM_CHAT_WINDOWS do
|
||||
name,_,_,_,_,_,shown = GetChatWindowInfo(i);
|
||||
if (string.lower(name) == "debug") then debugWin = i; break; end
|
||||
end
|
||||
if (debugWin == 0) then return end
|
||||
local out = "";
|
||||
depth = 0
|
||||
for i = 1, arg.n, 1 do
|
||||
if (i > 1) then out = out .. ", "; end
|
||||
out = arg[i].." = "
|
||||
arg[i] = getglobal(arg[i])
|
||||
local t = type(arg[i]);
|
||||
if (t == "string") then
|
||||
out = out .. '"|cff7fd5ff'..arg[i]..'|r"';
|
||||
elseif (t == "number") then
|
||||
out = out .. "|cffff7fff" .. arg[i] .. "|r";
|
||||
elseif (t == "boolean") then
|
||||
out = out .. "|cffff9100" .. arg[i] .. "|r";
|
||||
elseif (t == nil) then
|
||||
out = out .. "|cffff7f7f" .. arg[i] .. "|r";
|
||||
else
|
||||
out = out .. dump(arg[i]);
|
||||
end
|
||||
end
|
||||
local start = GetTime()
|
||||
getglobal("ChatFrame"..debugWin):AddMessage("|cffffd800<|r\n" .. out, 1.0, 1.0, 1.0);
|
||||
getglobal("ChatFrame"..debugWin):AddMessage("|cffffd800> displayed in:|r "..string.format( "%.4f",GetTime()-start).."|cffffd800s|r", 1.0, 1.0, 1.0);
|
||||
end
|
||||
|
||||
SLASH_MSBTDUMPCMD1 = "/bump"
|
||||
SlashCmdList["MSBTDUMPCMD"] = MikSBT.debugPrint
|
||||
|
||||
|
||||
-- **********************************************************************************
|
||||
-- This function gets the next animation display info object for the correct
|
||||
-- scroll area.
|
||||
|
||||
@@ -12,8 +12,8 @@ MikSBT = {};
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
MikSBT.MOD_NAME = "MikScrollingBattleText"
|
||||
MikSBT.VERSION_NUMBER = 3.9;
|
||||
MikSBT.VERSION_STRING = "v3.9";
|
||||
MikSBT.VERSION_NUMBER = 4;
|
||||
MikSBT.VERSION_STRING = "v4.0";
|
||||
MikSBT.WINDOW_TITLE = "Mik's Scrolling Battle Text " .. MikSBT.VERSION_STRING .. " - \124cffF58CBA\124hAthene Edit\124h\124r";
|
||||
|
||||
MikSBT.COMMAND = "/msbt";
|
||||
@@ -161,6 +161,9 @@ MikSBT.DEFAULT_CONFIG = {
|
||||
ShowOverheals = true,
|
||||
ShowGameDamage = true,
|
||||
UseStickyCrits = true,
|
||||
ShowAllManaGains = false,
|
||||
LowHealthSound = true,
|
||||
LowManaSound = true,
|
||||
AnimationStep = 1.5,
|
||||
MasterFontSettings = {
|
||||
Normal = {FontIndex=7, OutlineIndex=2, FontSize=18},
|
||||
|
||||
@@ -598,6 +598,17 @@ function MikSBTOpt.InitCheckboxes()
|
||||
key = "Tab1FrameShowGameDamageCheckbox";
|
||||
MikSBTOpt.SetupCheckbox(OPTIONS_FRAME_NAME .. key, MikSBTOpt.CHECKBOXES[key].Label, MikSBTOpt.CHECKBOXES[key].Tooltip, "ShowGameDamage");
|
||||
|
||||
-- Initialize the Show All Mana Gains checkbox.
|
||||
key = "Tab1FrameShowAllManaGainsCheckbox";
|
||||
MikSBTOpt.SetupCheckbox(OPTIONS_FRAME_NAME .. key, MikSBTOpt.CHECKBOXES[key].Label, MikSBTOpt.CHECKBOXES[key].Tooltip, "ShowAllManaGains");
|
||||
|
||||
-- Initialize the Low Health Sound checkbox.
|
||||
key = "Tab1FrameLowHealthSoundCheckbox";
|
||||
MikSBTOpt.SetupCheckbox(OPTIONS_FRAME_NAME .. key, MikSBTOpt.CHECKBOXES[key].Label, MikSBTOpt.CHECKBOXES[key].Tooltip, "LowHealthSound");
|
||||
|
||||
-- Initialize the Low Mana Sound checkbox.
|
||||
key = "Tab1FrameLowManaSoundCheckbox";
|
||||
MikSBTOpt.SetupCheckbox(OPTIONS_FRAME_NAME .. key, MikSBTOpt.CHECKBOXES[key].Label, MikSBTOpt.CHECKBOXES[key].Tooltip, "LowManaSound");
|
||||
|
||||
-- Initialize the show scroll area events checkboxes.
|
||||
key = "Tab2FrameShowEventsCheckbox"; MikSBTOpt.SetupCheckbox(OPTIONS_FRAME_NAME .. key, MikSBTOpt.CHECKBOXES[key].Label, MikSBTOpt.CHECKBOXES[key].Tooltip, "DisplaySettings.Incoming.Show");
|
||||
@@ -3562,6 +3573,14 @@ function MikSBTOpt.PopulateProfileOptions()
|
||||
MikSBTOpt.PopulateCheckbox(OPTIONS_FRAME_NAME .. "Tab1FrameShowGameDamageCheckbox");
|
||||
MikSBT.SetOptionShowGameDamage(MikSBT.CurrentProfile.ShowGameDamage);
|
||||
|
||||
-- Populate the Show All Mana Gains checkbox.
|
||||
MikSBTOpt.PopulateCheckbox(OPTIONS_FRAME_NAME .. "Tab1FrameShowAllManaGainsCheckbox");
|
||||
|
||||
-- Populate the Low Health Sound checkbox.
|
||||
MikSBTOpt.PopulateCheckbox(OPTIONS_FRAME_NAME .. "Tab1FrameLowHealthSoundCheckbox");
|
||||
|
||||
-- Populate the Low Mana Sound checkbox.
|
||||
MikSBTOpt.PopulateCheckbox(OPTIONS_FRAME_NAME .. "Tab1FrameLowManaSoundCheckbox");
|
||||
|
||||
-- Populate the scroll area show events checkboxes to the values in the profile.
|
||||
MikSBTOpt.PopulateCheckbox(OPTIONS_FRAME_NAME .. "Tab2FrameShowEventsCheckbox");
|
||||
|
||||
@@ -2607,7 +2607,39 @@
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</CheckButton>
|
||||
|
||||
|
||||
<!-- All Mana Gains Checkbox -->
|
||||
<CheckButton name="$parentShowAllManaGainsCheckbox" inherits="MSBTCheckTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT" relativeTo="$parentShowPartialEffectsCheckbox">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="10" />
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</CheckButton>
|
||||
|
||||
<!-- Low Health Sound Checkbox -->
|
||||
<CheckButton name="$parentLowHealthSoundCheckbox" inherits="MSBTCheckTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativePoint="RIGHT" relativeTo="$parentShowAllManaGainsCheckboxText">
|
||||
<Offset>
|
||||
<AbsDimension x="10" y="0" />
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</CheckButton>
|
||||
|
||||
<!-- Low Mana Sound Checkbox -->
|
||||
<CheckButton name="$parentLowManaSoundCheckbox" inherits="MSBTCheckTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativePoint="RIGHT" relativeTo="$parentLowHealthSoundCheckboxText">
|
||||
<Offset>
|
||||
<AbsDimension x="10" y="0" />
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</CheckButton>
|
||||
|
||||
<!-- Animation Step Slider -->
|
||||
<Slider name="$parentAnimationStepSlider" inherits="MSBTSliderTemplate">
|
||||
|
||||
@@ -86,6 +86,9 @@ MikSBTOpt.DROPDOWNS = {
|
||||
MikSBTOpt.CHECKBOXES = {
|
||||
["Tab1FrameDisableCheckbox"] = { Label="Disable Mik's Scrolling Battle Text", Tooltip="Sets whether or not MSBT is disabled."},
|
||||
["Tab1FrameShowPartialEffectsCheckbox"] = { Label="Show Partial Effects", Tooltip="Sets whether or not to show partial resists, absorbs, blocks, etc."},
|
||||
["Tab1FrameShowAllManaGainsCheckbox"] = { Label="Show All Mana Gains", Tooltip="Sets whether or not to show all mana gains: mp5, drinking, etc. |cffff0000(spammy !)"},
|
||||
["Tab1FrameLowHealthSoundCheckbox"] = { Label="Low Health Sound", Tooltip="Sets whether or not to play a sound when your health is low."},
|
||||
["Tab1FrameLowManaSoundCheckbox"] = { Label="Low Mana Sound", Tooltip="Sets whether or not to play a sound when your mana is low."},
|
||||
["Tab1FrameUseStickyCritsCheckbox"] = { Label="Display Crits Sticky", Tooltip="Sets whether or not to display crits using the sticky style."},
|
||||
["Tab1FrameShowOverhealsCheckbox"] = { Label="Show Overheals", Tooltip="Sets whether or not to display overhealing information."},
|
||||
["Tab1FrameShowGameDamageCheckbox"] = { Label="Show Game Damage", Tooltip="Sets whether or not to display the game's damage above the enemy's heads."},
|
||||
|
||||
Reference in New Issue
Block a user