background fps cap and height of floating text

This commit is contained in:
konaka
2025-10-30 05:36:18 +08:00
parent 187d4f03b1
commit bdcd3c0b41
2 changed files with 226 additions and 26 deletions
+79 -4
View File
@@ -107,6 +107,22 @@ local function UnitXP_SP3_FPScap(cap)
return UnitXP_SP3_Addon["FPScap"];
end
local function UnitXP_SP3_backgroundFPScap(cap)
local test, result = pcall(UnitXP, "backgroundFPScap", cap);
if not test then
if not skipUpdateMessage then
skipUpdateMessage = true;
UnitXP_SP3_Print(
"UnitXP_SP3.dll failed to execute \"backgroundFPScap\". You might need to update UnitXP_SP3.dll to support this method.");
end
return UnitXP_SP3_Addon["backgroundFPScap"];
end
UnitXP_SP3_Addon["backgroundFPScap"] = result;
return UnitXP_SP3_Addon["backgroundFPScap"];
end
local function UnitXP_SP3_setTargetingRangeConeFactor(factor)
local test, result = pcall(UnitXP, "target", "rangeCone", factor);
@@ -170,7 +186,13 @@ function UnitXP_SP3_detoured_CombatText_AddMessage(message, scrollFunction, r, g
if displayType == "crit" then
pcall(UnitXP, "addCombatText", "crit", message, r, g, b);
else
pcall(UnitXP, "addCombatText", "normal", message, r, g, b);
if COMBAT_TEXT_FLOAT_MODE == "1" then
pcall(UnitXP, "addCombatText", "normal", message, r, g, b);
elseif COMBAT_TEXT_FLOAT_MODE == "2" then
pcall(UnitXP, "addCombatText", "downward", message, r, g, b);
else
pcall(UnitXP, "addCombatText", "arc", message, r, g, b);
end
end
return nil;
else
@@ -220,6 +242,22 @@ local function UnitXP_SP3_combatTextSP3_fontSize(size)
return UnitXP_SP3_Addon["combatTextSP3_fontSize"];
end
local function UnitXP_SP3_combatTextSP3_nameplateHeight(size)
local test, result = pcall(UnitXP, "combatTextSP3", "setNameplateHeight", size);
if not test then
if not skipUpdateMessage then
skipUpdateMessage = true;
UnitXP_SP3_Print(
"UnitXP_SP3.dll failed to execute \"combatTextSP3 setNameplateHeight\". You might need to update UnitXP_SP3.dll to support this method.");
end
return UnitXP_SP3_Addon["combatTextSP3_nameplateHeight"];
end
UnitXP_SP3_Addon["combatTextSP3_nameplateHeight"] = result;
return UnitXP_SP3_Addon["combatTextSP3_nameplateHeight"];
end
local function UnitXP_SP3_setPrioritizeTargetNameplate(enable)
local test, result = pcall(UnitXP, "prioritizeTargetNameplate", enable);
@@ -401,9 +439,15 @@ local function UnitXP_SP3_reloadConfig()
UnitXP_SP3_FPScap(UnitXP_SP3_Addon["FPScap"]);
xpsp3_editBox_FPScap:SetNumber(UnitXP_SP3_Addon["FPScap"]);
UnitXP_SP3_backgroundFPScap(UnitXP_SP3_Addon["backgroundFPScap"]);
xpsp3_editBox_backgroundFPScap:SetNumber(UnitXP_SP3_Addon["backgroundFPScap"]);
UnitXP_SP3_combatTextSP3_fontSize(UnitXP_SP3_Addon["combatTextSP3_fontSize"]);
xpsp3_editBox_combatTextSP3_fontSize:SetNumber(UnitXP_SP3_Addon["combatTextSP3_fontSize"]);
UnitXP_SP3_combatTextSP3_nameplateHeight(UnitXP_SP3_Addon["combatTextSP3_nameplateHeight"]);
xpsp3_editBox_combatTextSP3_nameplateHeight:SetNumber(UnitXP_SP3_Addon["combatTextSP3_nameplateHeight"]);
UnitXP_SP3_setTargetingRangeConeFactor(UnitXP_SP3_Addon["targetingRangeConeFactor"]);
UnitXP_SP3_setCameraHeight(UnitXP_SP3_Addon["cameraHeight"]);
@@ -427,9 +471,17 @@ local function UnitXP_SP3_reloadConfig()
if UnitXP_SP3_Addon["combatTextSP3"] then
UnitXP_SP3_combatTextSP3("enable");
xpsp3_checkButton_combatTextSP3:SetChecked(true);
xpsp3_editBox_combatTextSP3_fontSize:Show();
xpsp3_editBox_combatTextSP3_nameplateHeight:Show();
xpsp3_fontString_combatTextSP3_fontSize:Show();
xpsp3_fontString_combatTextSP3_nameplateHeight:Show();
else
UnitXP_SP3_combatTextSP3("disable");
xpsp3_checkButton_combatTextSP3:SetChecked(false);
xpsp3_editBox_combatTextSP3_fontSize:Hide();
xpsp3_editBox_combatTextSP3_nameplateHeight:Hide();
xpsp3_fontString_combatTextSP3_fontSize:Hide();
xpsp3_fontString_combatTextSP3_nameplateHeight:Hide();
end
if UnitXP_SP3_Addon["hideEXPtext"] then
@@ -528,7 +580,9 @@ function UnitXP_SP3_UI_OnClick(widget)
end
xpsp3_editBox_FPScap:ClearFocus();
xpsp3_editBox_backgroundFPScap:ClearFocus();
xpsp3_editBox_combatTextSP3_fontSize:ClearFocus();
xpsp3_editBox_combatTextSP3_nameplateHeight:ClearFocus();
skipUpdateMessage = false;
@@ -537,9 +591,15 @@ function UnitXP_SP3_UI_OnClick(widget)
if string.find(widget:GetName(), "_FPScap") then
UnitXP_SP3_FPScap(widget:GetNumber());
end
if string.find(widget:GetName(), "_backgroundFPScap") then
UnitXP_SP3_backgroundFPScap(widget:GetNumber());
end
if string.find(widget:GetName(), "_combatTextSP3_fontSize") then
UnitXP_SP3_combatTextSP3_fontSize(widget:GetNumber());
end
if string.find(widget:GetName(), "_combatTextSP3_nameplateHeight") then
UnitXP_SP3_combatTextSP3_nameplateHeight(widget:GetNumber());
end
end
if string.find(widget:GetName(), "_button_") then
@@ -740,7 +800,7 @@ end
function UnitXP_SP3_OnEvent(event)
if event == "ADDON_LOADED" and arg1 == "UnitXP_SP3_Addon" then
local dataVersion = 29;
local dataVersion = 31;
if UnitXP_SP3_Addon == nil or UnitXP_SP3_Addon["dataVersion"] ~= dataVersion then
UnitXP_SP3_Addon = {};
UnitXP_SP3_Addon["dataVersion"] = dataVersion;
@@ -755,10 +815,12 @@ function UnitXP_SP3_OnEvent(event)
UnitXP_SP3_Addon["nameplateCombatFilter"] = false;
UnitXP_SP3_Addon["showInCombatNameplatesNearPlayer"] = false;
UnitXP_SP3_Addon["FPScap"] = 0;
UnitXP_SP3_Addon["backgroundFPScap"] = 60;
UnitXP_SP3_Addon["weatherAlwaysClear"] = false;
UnitXP_SP3_Addon["hideCritterNameplate"] = true;
UnitXP_SP3_Addon["combatTextSP3"] = false;
UnitXP_SP3_Addon["combatTextSP3_fontSize"] = 40;
UnitXP_SP3_Addon["combatTextSP3_nameplateHeight"] = 55;
UnitXP_SP3_Addon["hideEXPtext"] = false;
UnitXP_SP3_Addon["notify_flashTaskbarIcon"] = {};
@@ -850,16 +912,22 @@ function UnitXP_SP3_OnEvent(event)
return;
elseif event == "PLAYER_ENTERING_WORLD" then
local test, result = pcall(UnitXP, "FPScap", UnitXP_SP3_Addon["FPScap"]);
local test = pcall(UnitXP, "FPScap", UnitXP_SP3_Addon["FPScap"]);
local test2 = pcall(UnitXP, "backgroundFPScap", UnitXP_SP3_Addon["backgroundFPScap"]);
if not test then
UnitXP_SP3_Print(
"UnitXP_SP3.dll failed to execute \"FPScap\". You might need to update UnitXP_SP3.dll to support this method.");
end
if not test2 then
UnitXP_SP3_Print(
"UnitXP_SP3.dll failed to execute \"backgroundFPScap\". You might need to update UnitXP_SP3.dll to support this method.");
end
return;
elseif event == "PLAYER_LEAVING_WORLD" then
-- Some user report a faster loading time when FPS cap turns off
local test, result = pcall(UnitXP, "FPScap", 0);
local test = pcall(UnitXP, "FPScap", 0);
local test2 = pcall(UnitXP, "backgroundFPScap", 0);
if not test then
if not skipUpdateMessage then
@@ -868,6 +936,13 @@ function UnitXP_SP3_OnEvent(event)
"UnitXP_SP3.dll failed to execute \"FPScap\". You might need to update UnitXP_SP3.dll to support this method.");
end
end
if not test2 then
if not skipUpdateMessage then
skipUpdateMessage = true;
UnitXP_SP3_Print(
"UnitXP_SP3.dll failed to execute \"backgroundFPScap\". You might need to update UnitXP_SP3.dll to support this method.");
end
end
return;
end
+147 -22
View File
@@ -10,7 +10,7 @@ xsi:schemaLocation="http://www.blizzard.com/wow/ui/ C:\Projects\WoW\Bin\Interfac
<Frame name="xpsp3Frame" toplevel="true" frameStrata="DIALOG" movable="true" enableMouse="true" hidden="true" parent="UIParent">
<TitleRegion setAllPoints="true"/>
<Size>
<AbsDimension x="500" y="385"/>
<AbsDimension x="550" y="385"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativeTo="UIParent" />
@@ -62,12 +62,42 @@ xsi:schemaLocation="http://www.blizzard.com/wow/ui/ C:\Projects\WoW\Bin\Interfac
</Anchor>
</Anchors>
</FontString>
<FontString inherits="GameFontNormal" text="Background:" justifyH="LEFT" justifyV="TOP">
<Size x="200" y="440" />
<Anchors>
<Anchor point="TOPLEFT" relativeTo="xpsp3Frame">
<Offset>
<AbsDimension x="399" y="-40"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="xpsp3_fontString_combatTextSP3_fontSize" inherits="GameFontNormal" text="Size:" justifyH="LEFT" justifyV="TOP">
<Size x="200" y="440" />
<Anchors>
<Anchor point="TOPLEFT" relativeTo="xpsp3Frame">
<Offset>
<AbsDimension x="295" y="-260"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="xpsp3_fontString_combatTextSP3_nameplateHeight" inherits="GameFontNormal" text="Elevation:" justifyH="LEFT" justifyV="TOP">
<Size x="200" y="440" />
<Anchors>
<Anchor point="TOPLEFT" relativeTo="xpsp3Frame">
<Offset>
<AbsDimension x="413" y="-260"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString inherits="GameFontNormal" text="Targeting functions could be accessed via Key Bindings Menu" justifyH="CENTER" justifyV="TOP">
<Size x="500" y="440" />
<Anchors>
<Anchor point="TOPLEFT" relativeTo="xpsp3Frame">
<Offset>
<AbsDimension x="0" y="-330"/>
<AbsDimension x="0" y="-325"/>
</Offset>
</Anchor>
</Anchors>
@@ -437,7 +467,7 @@ xsi:schemaLocation="http://www.blizzard.com/wow/ui/ C:\Projects\WoW\Bin\Interfac
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="274" y="-250"/>
<AbsDimension x="274" y="-290"/>
</Offset>
</Anchor>
</Anchors>
@@ -461,33 +491,33 @@ xsi:schemaLocation="http://www.blizzard.com/wow/ui/ C:\Projects\WoW\Bin\Interfac
</CheckButton>
<EditBox name="xpsp3_editBox_combatTextSP3_fontSize" letters="2" autoFocus="false" numeric="true">
<Size x="40" y="32" />
<Size x="50" y="32" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="453" y="-220"/>
<AbsDimension x="343" y="-250"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture file="Interface\ChatFrame\UI-ChatInputBorder-Left">
<Size x="25" y="32" />
<Size x="30" y="32" />
<Anchors>
<Anchor point="LEFT">
<Offset x="-17" y="0" />
</Anchor>
</Anchors>
<TexCoords left="0" right="0.1" top="0" bottom="1.0"/>
<TexCoords left="0" right="0.12" top="0" bottom="1.0"/>
</Texture>
<Texture file="Interface\ChatFrame\UI-ChatInputBorder-Right">
<Size x="25" y="32" />
<Size x="30" y="32" />
<Anchors>
<Anchor point="RIGHT">
<Offset x="-7" y="0" />
</Anchor>
</Anchors>
<TexCoords left="0.9" right="1.0" top="0" bottom="1.0"/>
<TexCoords left="0.88" right="1.0" top="0" bottom="1.0"/>
</Texture>
</Layer>
</Layers>
@@ -507,36 +537,83 @@ xsi:schemaLocation="http://www.blizzard.com/wow/ui/ C:\Projects\WoW\Bin\Interfac
</Scripts>
<FontString inherits="ChatFontNormal" />
</EditBox>
<EditBox name="xpsp3_editBox_FPScap" letters="3" autoFocus="false" numeric="true">
<Size x="100" y="32" />
<EditBox name="xpsp3_editBox_combatTextSP3_nameplateHeight" letters="3" autoFocus="false" numeric="true">
<Size x="50" y="32" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="350" y="-30"/>
<AbsDimension x="490" y="-250"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture file="Interface\ChatFrame\UI-ChatInputBorder-Left">
<Size x="75" y="32" />
<Size x="30" y="32" />
<Anchors>
<Anchor point="LEFT">
<Offset x="-17" y="0" />
</Anchor>
</Anchors>
<TexCoords left="0" right="0.3" top="0" bottom="1.0"/>
<TexCoords left="0" right="0.12" top="0" bottom="1.0"/>
</Texture>
<Texture file="Interface\ChatFrame\UI-ChatInputBorder-Right">
<Size x="75" y="32" />
<Size x="30" y="32" />
<Anchors>
<Anchor point="RIGHT">
<Offset x="10" y="0" />
<Offset x="-7" y="0" />
</Anchor>
</Anchors>
<TexCoords left="0.7" right="1.0" top="0" bottom="1.0"/>
<TexCoords left="0.88" right="1.0" top="0" bottom="1.0"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnEditFocusGained>
xpsp3tooltip:SetOwner(this, "ANCHOR_LEFT");
xpsp3tooltip:SetText("Raise or lower combat text on enemies");
xpsp3tooltip:AddLine("Range from 0 to 256. Press Enter to confirm",1,1,1);
xpsp3tooltip:Show();
</OnEditFocusGained>
<OnEditFocusLost>
xpsp3tooltip:Hide();
</OnEditFocusLost>
<OnEnterPressed>
UnitXP_SP3_UI_OnClick(this);
</OnEnterPressed>
</Scripts>
<FontString inherits="ChatFontNormal" />
</EditBox>
<EditBox name="xpsp3_editBox_FPScap" letters="3" autoFocus="false" numeric="true">
<Size x="50" y="32" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="343" y="-30"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture file="Interface\ChatFrame\UI-ChatInputBorder-Left">
<Size x="30" y="32" />
<Anchors>
<Anchor point="LEFT">
<Offset x="-17" y="0" />
</Anchor>
</Anchors>
<TexCoords left="0" right="0.12" top="0" bottom="1.0"/>
</Texture>
<Texture file="Interface\ChatFrame\UI-ChatInputBorder-Right">
<Size x="30" y="32" />
<Anchors>
<Anchor point="RIGHT">
<Offset x="-7" y="0" />
</Anchor>
</Anchors>
<TexCoords left="0.88" right="1.0" top="0" bottom="1.0"/>
</Texture>
</Layer>
</Layers>
@@ -557,6 +634,54 @@ xsi:schemaLocation="http://www.blizzard.com/wow/ui/ C:\Projects\WoW\Bin\Interfac
<FontString inherits="ChatFontNormal" />
</EditBox>
<EditBox name="xpsp3_editBox_backgroundFPScap" letters="3" autoFocus="false" numeric="true">
<Size x="50" y="32" />
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="490" y="-30"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture file="Interface\ChatFrame\UI-ChatInputBorder-Left">
<Size x="30" y="32" />
<Anchors>
<Anchor point="LEFT">
<Offset x="-17" y="0" />
</Anchor>
</Anchors>
<TexCoords left="0" right="0.12" top="0" bottom="1.0"/>
</Texture>
<Texture file="Interface\ChatFrame\UI-ChatInputBorder-Right">
<Size x="30" y="32" />
<Anchors>
<Anchor point="RIGHT">
<Offset x="-7" y="0" />
</Anchor>
</Anchors>
<TexCoords left="0.88" right="1.0" top="0" bottom="1.0"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnEditFocusGained>
xpsp3tooltip:SetOwner(this, "ANCHOR_LEFT");
xpsp3tooltip:SetText("Limit background-frames-per-second to the specific value");
xpsp3tooltip:AddLine("Zero means no limit. Press Enter to confirm",1,1,1);
xpsp3tooltip:Show();
</OnEditFocusGained>
<OnEditFocusLost>
xpsp3tooltip:Hide();
</OnEditFocusLost>
<OnEnterPressed>
UnitXP_SP3_UI_OnClick(this);
</OnEnterPressed>
</Scripts>
<FontString inherits="ChatFontNormal" />
</EditBox>
<Button name="xpsp3_button_cameraHeight_raise" parent="xpsp3Frame" inherits="GameMenuButtonTemplate" text="Raise Camera">
<Size>
@@ -583,7 +708,7 @@ xsi:schemaLocation="http://www.blizzard.com/wow/ui/ C:\Projects\WoW\Bin\Interfac
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="380" y="-75"/>
<AbsDimension x="390" y="-75"/>
</Offset>
</Anchor>
</Anchors>
@@ -619,7 +744,7 @@ xsi:schemaLocation="http://www.blizzard.com/wow/ui/ C:\Projects\WoW\Bin\Interfac
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="380" y="-105"/>
<AbsDimension x="390" y="-105"/>
</Offset>
</Anchor>
</Anchors>
@@ -655,7 +780,7 @@ xsi:schemaLocation="http://www.blizzard.com/wow/ui/ C:\Projects\WoW\Bin\Interfac
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="380" y="-135"/>
<AbsDimension x="390" y="-135"/>
</Offset>
</Anchor>
</Anchors>