Added shavit_rankings_weighting because y'all complain about rankings

This commit is contained in:
shavit 2018-12-27 06:14:33 +02:00
parent a0ab1b7147
commit 487d3e4a9c

View File

@ -66,6 +66,9 @@ StringMap gA_MapTiers = null;
ConVar gCV_PointsPerTier = null;
float gF_PointsPerTier = 50.0;
ConVar gCV_WeightingMultiplier = null;
float gF_WeightingMultiplier = 0.975;
int gI_Rank[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.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();
LoadTranslations("common.phrases");
@ -320,11 +326,11 @@ public void SQL_CreateTable_Callback(Database db, DBResultSet results, const cha
"LEAVE iter; " ...
"END IF; " ...
"SET total = total + (p * mult); " ...
"SET mult = mult * 0.975; " ...
"SET mult = mult * %f; " ...
"END LOOP; " ...
"CLOSE cur; " ...
"RETURN total; " ...
"END;;", gS_MySQLPrefix);
"END;;", gS_MySQLPrefix, gF_WeightingMultiplier);
RunLongFastQuery(bSuccess, "CREATE GetRecordPoints",
"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)
{
gF_PointsPerTier = gCV_PointsPerTier.FloatValue;
gF_WeightingMultiplier = gCV_WeightingMultiplier.FloatValue;
}
public void OnClientConnected(int client)