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