mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-06 18:08:26 +00:00
Added shavit_rankings_weighting because y'all complain about rankings
This commit is contained in:
parent
a0ab1b7147
commit
487d3e4a9c
@ -66,6 +66,9 @@ StringMap gA_MapTiers = null;
|
|||||||
ConVar gCV_PointsPerTier = null;
|
ConVar gCV_PointsPerTier = null;
|
||||||
float gF_PointsPerTier = 50.0;
|
float gF_PointsPerTier = 50.0;
|
||||||
|
|
||||||
|
ConVar gCV_WeightingMultiplier = null;
|
||||||
|
float gF_WeightingMultiplier = 0.975;
|
||||||
|
|
||||||
int gI_Rank[MAXPLAYERS+1];
|
int gI_Rank[MAXPLAYERS+1];
|
||||||
float gF_Points[MAXPLAYERS+1];
|
float gF_Points[MAXPLAYERS+1];
|
||||||
|
|
||||||
@ -144,6 +147,9 @@ public void OnPluginStart()
|
|||||||
gCV_PointsPerTier = CreateConVar("shavit_rankings_pointspertier", "50.0", "Base points to use for per-tier scaling.\nRead the design idea to see how it works: https://github.com/shavitush/bhoptimer/issues/465", 0, true, 1.0);
|
gCV_PointsPerTier = CreateConVar("shavit_rankings_pointspertier", "50.0", "Base points to use for per-tier scaling.\nRead the design idea to see how it works: https://github.com/shavitush/bhoptimer/issues/465", 0, true, 1.0);
|
||||||
gCV_PointsPerTier.AddChangeHook(OnConVarChanged);
|
gCV_PointsPerTier.AddChangeHook(OnConVarChanged);
|
||||||
|
|
||||||
|
gCV_WeightingMultiplier = CreateConVar("shavit_rankings_weighting", "0.975", "Weighing multiplier. 1.0 to disable weighting.\nFormula: p[1] * this^0 + p[2] * this^1 + p[3] * this^2 + ... + p[n] * this^(n-1)\nRestart server to apply.", 0, true, 0.01, true, 1.0);
|
||||||
|
gCV_WeightingMultiplier.AddChangeHook(OnConVarChanged);
|
||||||
|
|
||||||
AutoExecConfig();
|
AutoExecConfig();
|
||||||
|
|
||||||
LoadTranslations("common.phrases");
|
LoadTranslations("common.phrases");
|
||||||
@ -320,11 +326,11 @@ public void SQL_CreateTable_Callback(Database db, DBResultSet results, const cha
|
|||||||
"LEAVE iter; " ...
|
"LEAVE iter; " ...
|
||||||
"END IF; " ...
|
"END IF; " ...
|
||||||
"SET total = total + (p * mult); " ...
|
"SET total = total + (p * mult); " ...
|
||||||
"SET mult = mult * 0.975; " ...
|
"SET mult = mult * %f; " ...
|
||||||
"END LOOP; " ...
|
"END LOOP; " ...
|
||||||
"CLOSE cur; " ...
|
"CLOSE cur; " ...
|
||||||
"RETURN total; " ...
|
"RETURN total; " ...
|
||||||
"END;;", gS_MySQLPrefix);
|
"END;;", gS_MySQLPrefix, gF_WeightingMultiplier);
|
||||||
|
|
||||||
RunLongFastQuery(bSuccess, "CREATE GetRecordPoints",
|
RunLongFastQuery(bSuccess, "CREATE GetRecordPoints",
|
||||||
"CREATE FUNCTION GetRecordPoints(rstyle INT, rtrack INT, rtime FLOAT, rmap CHAR(128), pointspertier FLOAT, stylemultiplier FLOAT) " ...
|
"CREATE FUNCTION GetRecordPoints(rstyle INT, rtrack INT, rtime FLOAT, rmap CHAR(128), pointspertier FLOAT, stylemultiplier FLOAT) " ...
|
||||||
@ -380,6 +386,7 @@ void RunLongFastQuery(bool &success, const char[] func, const char[] query, any
|
|||||||
public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue)
|
public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||||
{
|
{
|
||||||
gF_PointsPerTier = gCV_PointsPerTier.FloatValue;
|
gF_PointsPerTier = gCV_PointsPerTier.FloatValue;
|
||||||
|
gF_WeightingMultiplier = gCV_WeightingMultiplier.FloatValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnClientConnected(int client)
|
public void OnClientConnected(int client)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user