mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 10:28:26 +00:00
mess around with point calculation queries again
This commit is contained in:
parent
1bb7b3e274
commit
673b172871
@ -736,10 +736,16 @@ public Action Command_RecalcMap(int client, int args)
|
|||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// You can use Sourcepawn_GetRecordPoints() as a reference for how the queries calculate points.
|
||||||
void FormatRecalculate(bool bUseCurrentMap, int track, int style, char[] sQuery, int sQueryLen)
|
void FormatRecalculate(bool bUseCurrentMap, int track, int style, char[] sQuery, int sQueryLen)
|
||||||
{
|
{
|
||||||
float fMultiplier = Shavit_GetStyleSettingFloat(style, "rankingmultiplier");
|
float fMultiplier = Shavit_GetStyleSettingFloat(style, "rankingmultiplier");
|
||||||
|
|
||||||
|
if (track > 0)
|
||||||
|
{
|
||||||
|
fMultiplier *= 0.25;
|
||||||
|
}
|
||||||
|
|
||||||
if (Shavit_GetStyleSettingBool(style, "unranked") || fMultiplier == 0.0)
|
if (Shavit_GetStyleSettingBool(style, "unranked") || fMultiplier == 0.0)
|
||||||
{
|
{
|
||||||
FormatEx(sQuery, sQueryLen,
|
FormatEx(sQuery, sQueryLen,
|
||||||
@ -757,53 +763,35 @@ void FormatRecalculate(bool bUseCurrentMap, int track, int style, char[] sQuery,
|
|||||||
|
|
||||||
if (bUseCurrentMap)
|
if (bUseCurrentMap)
|
||||||
{
|
{
|
||||||
if (track == Track_Main)
|
float fTier = (track > 0) ? 1.0 : float(gI_Tier);
|
||||||
{
|
|
||||||
if (gB_WorldRecordsCached)
|
|
||||||
{
|
|
||||||
float fWR = Shavit_GetWorldRecord(style, track);
|
|
||||||
|
|
||||||
FormatEx(sQuery, sQueryLen,
|
// a faster, joinless query is used for main due to it having 70% of playertimes.
|
||||||
"UPDATE %splayertimes PT " ...
|
if (track == Track_Main && gB_WorldRecordsCached)
|
||||||
"SET PT.points_calced_from = %f, " ...
|
{
|
||||||
" PT.points = " ...
|
float fWR = Shavit_GetWorldRecord(style, track);
|
||||||
" %f * (%f / PT.time) " ...
|
|
||||||
"WHERE PT.style = %d AND PT.track = 0 AND PT.map = '%s' AND PT.points_calced_from != %f;",
|
FormatEx(sQuery, sQueryLen,
|
||||||
gS_MySQLPrefix,
|
"UPDATE %splayertimes PT " ...
|
||||||
fWR,
|
"SET PT.points_calced_from = %f, " ...
|
||||||
(((fWR * gCV_PointsPerTier.FloatValue) * 1.5) + (fWR / 15.0)) * fMultiplier,
|
" PT.points = " ...
|
||||||
fWR,
|
" %f " ...
|
||||||
style,
|
" * (%f / PT.time) " ...
|
||||||
gS_Map,
|
"WHERE PT.style = %d AND PT.track = 0 AND PT.map = '%s' AND PT.points_calced_from != %f;",
|
||||||
fWR
|
gS_MySQLPrefix,
|
||||||
);
|
fWR,
|
||||||
}
|
(((gCV_PointsPerTier.FloatValue * fTier) * 1.5) + (fWR / 15.0)) * fMultiplier,
|
||||||
else
|
fWR,
|
||||||
{
|
style,
|
||||||
FormatEx(sQuery, sQueryLen,
|
gS_Map,
|
||||||
"UPDATE %splayertimes PT " ...
|
fWR
|
||||||
"INNER JOIN %swrs WR ON " ...
|
);
|
||||||
" PT.track = 0 AND PT.track = WR.track AND PT.style = %d AND PT.style = WR.style AND PT.map = '%s' AND PT.map = WR.map AND PT.points_calced_from != WR.time " ...
|
|
||||||
"SET PT.points_calced_from = WR.time, " ...
|
|
||||||
" PT.points = "...
|
|
||||||
" (%f + (WR.time / 15.0)) " ...
|
|
||||||
" * (WR.time / PT.time) " ...
|
|
||||||
" * %f " ...
|
|
||||||
";",
|
|
||||||
gS_MySQLPrefix, gS_MySQLPrefix,
|
|
||||||
style,
|
|
||||||
gS_Map,
|
|
||||||
((gCV_PointsPerTier.FloatValue * gI_Tier) * 1.5),
|
|
||||||
fMultiplier
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FormatEx(sQuery, sQueryLen,
|
FormatEx(sQuery, sQueryLen,
|
||||||
"UPDATE %splayertimes PT " ...
|
"UPDATE %splayertimes PT " ...
|
||||||
"INNER JOIN %swrs WR ON " ...
|
"INNER JOIN %swrs WR ON " ...
|
||||||
" PT.track > 0 AND PT.track = WR.track AND PT.style = %d AND PT.style = WR.style AND PT.map = '%s' AND PT.map = WR.map AND PT.points_calced_from != WR.time " ...
|
" PT.track %c 0 AND PT.track = WR.track AND PT.style = %d AND PT.style = WR.style AND PT.map = '%s' AND PT.map = WR.map AND PT.points_calced_from != WR.time " ...
|
||||||
"SET PT.points_calced_from = WR.time, " ...
|
"SET PT.points_calced_from = WR.time, " ...
|
||||||
" PT.points = "...
|
" PT.points = "...
|
||||||
" (%f + (WR.time / 15.0)) " ...
|
" (%f + (WR.time / 15.0)) " ...
|
||||||
@ -811,10 +799,11 @@ void FormatRecalculate(bool bUseCurrentMap, int track, int style, char[] sQuery,
|
|||||||
" * %f " ...
|
" * %f " ...
|
||||||
";",
|
";",
|
||||||
gS_MySQLPrefix, gS_MySQLPrefix,
|
gS_MySQLPrefix, gS_MySQLPrefix,
|
||||||
|
(track > 0) ? '>' : '=',
|
||||||
style,
|
style,
|
||||||
gS_Map,
|
gS_Map,
|
||||||
((gCV_PointsPerTier.FloatValue * 1) * 1.5),
|
((gCV_PointsPerTier.FloatValue * fTier) * 1.5),
|
||||||
fMultiplier * 0.25
|
fMultiplier
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -823,21 +812,23 @@ void FormatRecalculate(bool bUseCurrentMap, int track, int style, char[] sQuery,
|
|||||||
FormatEx(sQuery, sQueryLen,
|
FormatEx(sQuery, sQueryLen,
|
||||||
"UPDATE %splayertimes PT " ...
|
"UPDATE %splayertimes PT " ...
|
||||||
"INNER JOIN %swrs WR ON " ...
|
"INNER JOIN %swrs WR ON " ...
|
||||||
" PT.track = WR.track AND PT.style = WR.style AND PT.map = WR.map AND PT.points_calced_from != WR.time " ...
|
" PT.track %c 0 AND PT.track = WR.track AND PT.style = %d AND PT.style = WR.style AND PT.map = WR.map AND PT.points_calced_from != WR.time " ...
|
||||||
"INNER JOIN %smaptiers MT ON " ...
|
"INNER JOIN %smaptiers MT ON " ...
|
||||||
" PT.map = MT.map " ...
|
" PT.map = MT.map " ...
|
||||||
"SET PT.points_calced_from = WR.time, " ...
|
"SET PT.points_calced_from = WR.time, " ...
|
||||||
" PT.points = "...
|
" PT.points = "...
|
||||||
" (((%f * MT.tier) * 1.5) + (WR.time / 15.0)) " ...
|
" (((%f * %s) * 1.5) + (WR.time / 15.0)) " ...
|
||||||
"* (WR.time / PT.time) " ...
|
" * (WR.time / PT.time) " ...
|
||||||
"* %f %s " ...
|
" * %f " ...
|
||||||
"WHERE PT.style = %d AND PT.track %c 0;",
|
";",
|
||||||
gS_MySQLPrefix, gS_MySQLPrefix, gS_MySQLPrefix,
|
gS_MySQLPrefix,
|
||||||
gCV_PointsPerTier.FloatValue,
|
gS_MySQLPrefix,
|
||||||
fMultiplier,
|
(track > 0) ? '>' : '=',
|
||||||
(track > 0) ? "* 0.25" : "",
|
|
||||||
style,
|
style,
|
||||||
(track > 0) ? '>' : '='
|
gS_MySQLPrefix,
|
||||||
|
gCV_PointsPerTier.FloatValue,
|
||||||
|
(track > 0) ? "1" : "MT.tier",
|
||||||
|
fMultiplier
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1444,33 +1435,28 @@ public int Native_GuessPointsForTime(Handle plugin, int numParams)
|
|||||||
gCV_PointsPerTier.FloatValue,
|
gCV_PointsPerTier.FloatValue,
|
||||||
Shavit_GetStyleSettingFloat(rstyle, "rankingmultiplier"),
|
Shavit_GetStyleSettingFloat(rstyle, "rankingmultiplier"),
|
||||||
pwr,
|
pwr,
|
||||||
tier == -1 ? gI_Tier : tier
|
float(tier == -1 ? gI_Tier : tier)
|
||||||
);
|
);
|
||||||
|
|
||||||
return view_as<int>(ppoints);
|
return view_as<int>(ppoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
float Sourcepawn_GetRecordPoints(int rtrack, float rtime, float pointspertier, float stylemultiplier, float pwr, int ptier)
|
float Sourcepawn_GetRecordPoints(int rtrack, float rtime, float pointspertier, float stylemultiplier, float pwr, float ptier)
|
||||||
{
|
{
|
||||||
float ppoints = 0.0;
|
float ppoints = 0.0;
|
||||||
|
|
||||||
if (rtrack > 0)
|
if (rtrack > 0)
|
||||||
{
|
{
|
||||||
ptier = 1;
|
ptier = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ppoints = ((pointspertier * ptier) * 1.5) + (pwr / 15.0);
|
ppoints = ((pointspertier * ptier) * 1.5) + (pwr / 15.0);
|
||||||
|
ppoints *= (pwr / rtime);
|
||||||
if (rtime > pwr)
|
ppoints *= stylemultiplier;
|
||||||
{
|
|
||||||
ppoints = ppoints * (pwr / rtime);
|
|
||||||
}
|
|
||||||
|
|
||||||
ppoints = ppoints * stylemultiplier;
|
|
||||||
|
|
||||||
if (rtrack > 0)
|
if (rtrack > 0)
|
||||||
{
|
{
|
||||||
ppoints = ppoints * 0.25;
|
ppoints *= 0.25;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ppoints;
|
return ppoints;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user