Revert Top10 Changes

This commit is contained in:
SaengerItsWar 2023-06-20 11:30:36 +02:00
parent 8656854dc9
commit 7f147fd73d
Signed by: SaengerItsWar
GPG key ID: 2AA301E9EEDC190B
2 changed files with 11 additions and 116 deletions

View file

@ -6,7 +6,7 @@
#pragma semicolon 1
#pragma newdecls required
#define PLUGIN_VERSION "1.5.0"
#define PLUGIN_VERSION "1.4.7"
chatstrings_t gS_ChatStrings;
public Plugin myinfo =
@ -40,12 +40,6 @@ Convar g_cvBPbAmount;
Convar g_cvBPbAmountAgain;
Convar g_cvTasEnabled;
Convar g_cvNewCalc;
Convar g_cvTop10Enabled;
Convar g_cvTop10Amount;
Convar g_cvTop10AmountAgain;
Convar g_cvBonusTop10Enabled;
Convar g_cvBonusTop10Amount;
Convar g_cvBonusTop10AmountAgain;
//globals
char g_cMap[160];
@ -95,13 +89,7 @@ public void OnPluginStart()
g_cvBPbAmountAgain = new Convar("credits_amount_pb_bonus_again", "5.0", "How many point should be given for breaking the own Personal Best Again?", 0, true, 1.0, false);
g_cvTasEnabled = new Convar("credits_tas_enabled", "0", "Enable Store Credits for a TAS Style?", 0, true, 0.0, true, 1.0);
g_cvNewCalc = new Convar("credits_new_calculation", "1", "Enable the New Calculation for the credits?", 0, true, 0.0, true, 1.0);
g_cvTop10Enabled = new Convar("credits_top10_enabled", "1", "Enable Store credits given for being in the Top10 of a map?", 0, true, 0.0, true, 1.0);
g_cvTop10Amount = new Convar("credits_top10_amunt", "10", "How many points should be given for the First Place any other one will be devided through his own place.", 0, true, 1.0, false);
g_cvTop10AmountAgain = new Convar("credits_top10_amunt_again", "5", "How many points should be given for the First Place any other one will be devided through his own place again.", 0, true, 1.0, false);
g_cvBonusTop10Enabled = new Convar("credits_top10_enabled", "1", "Enable Store credits given for being in the Top10 of a map?", 0, true, 0.0, true, 1.0);
g_cvBonusTop10Amount = new Convar("credits_top10_amunt", "10", "How many points should be given for the First Place any other one will be devided through his own place.", 0, true, 1.0, false);
g_cvBonusTop10AmountAgain = new Convar("credits_top10_amunt_again", "5", "How many points should be given for the First Place any other one will be devided through his own place again.", 0, true, 1.0, false);
Convar.CreateConfig("shavit-credits");
}
@ -128,7 +116,7 @@ public void Shavit_OnTierAssigned(const char[] map, int tier) {
public void Shavit_OnLeaveZone(int client, int zone, int track, int id, int entity) {
if (IsClientInGame(client) && IsFakeClient(client))
return;
if (zone == Zone_Start) {
g_iStyle[client] = Shavit_GetBhopStyle(client);
g_fPB[client] = Shavit_GetClientPB(client, g_iStyle[client], track);
@ -181,7 +169,7 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
}
}
}
if (g_cvBNormalEnabled.BoolValue == true) {
if (track == Track_Bonus) {
if (g_iCompletions[client] == 0) {
@ -201,13 +189,13 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
} else {
iCredits = g_cvNormalBAmountAgain.IntValue;
}
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits, "finishing map Bonus Again");
Shavit_PrintToChat(client, "%t", "NormalBonusFinishAgain", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
}
}
}
if (g_cvEnabledPb.BoolValue == true) {
if (time < g_fPB[client]) {
if (track == Track_Main) {
@ -218,7 +206,7 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
} else {
iCredits = g_cvPBAmount.IntValue * g_iTier;
}
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits, "Personal Best");
Shavit_PrintToChat(client, "%t", "PersonalBest", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
} else if (g_iCompletions[client] >=1) {
@ -229,14 +217,14 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
} else {
iCredits = g_cvPBAmountAgain.IntValue * g_iTier;
}
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits, "Personal Best Again");
Shavit_PrintToChat(client, "%t", "PersonalBestAgain", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
}
}
}
}
if (g_cvEnabledBPb.BoolValue == true) {
if (time < g_fPB[client]) {
if (track == Track_Bonus) {
@ -247,7 +235,7 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
} else {
iCredits = g_cvBPbAmount.IntValue;
}
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits, "Personal Best Bonus");
Shavit_PrintToChat(client, "%t", "BonusPersonalBest", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
} else if (g_iCompletions[client] >=1) {
@ -257,72 +245,13 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
} else {
iCredits = g_cvBPbAmountAgain.IntValue;
}
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits, "Personal Best Bonus Again");
Shavit_PrintToChat(client, "%t", "BonusPersonalBestAgain", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
}
}
}
}
if (g_cvTop10Enabled.BoolValue == true) {
int place;
place = Shavit_GetRankForTime(style, time, track);
if (place <= 10) {
if(g_iCompletions[client] == 0) {
int iCredits;
if (g_cvNewCalc.BoolValue == true) {
iCredits = CalculatePointsTop10(g_cvTop10Amount.IntValue, style, place);
} else {
float fCredits = (g_cvTop10Amount.IntValue / place);
iCredits = RoundFloat(fCredits);
}
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits, "Top 10 Finish");
Shavit_PrintToChat(client, "%t", "NormalTop10", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
} else if (g_iCompletions[client] >= 1){
int iCredits;
if (g_cvNewCalc.BoolValue == true) {
iCredits = CalculatePointsTop10(g_cvTop10AmountAgain.IntValue, style, place);
} else {
float fCredits = (g_cvTop10AmountAgain.IntValue / place);
iCredits = RoundFloat(fCredits);
}
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits, "Top 10 Finish Again");
Shavit_PrintToChat(client, "%t", "NormalTop10Again", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
}
}
}
if (g_cvBonusTop10Enabled.BoolValue == true) {
int place;
place = Shavit_GetRankForTime(style, time, track);
if (place <= 10) {
if(g_iCompletions[client] == 0) {
int iCredits;
if (g_cvNewCalc.BoolValue == true) {
iCredits = CalculatePointsTop10Bonus(g_cvBonusTop10Amount.IntValue, style, place);
} else {
float fCredits = (g_cvBonusTop10Amount.IntValue / place);
iCredits = RoundFloat(fCredits);
}
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits, "Top 10 Bonus Finish");
Shavit_PrintToChat(client, "%t", "BonusTop10", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
} else if (g_iCompletions[client] >= 1){
int iCredits;
if (g_cvNewCalc.BoolValue == true) {
iCredits = CalculatePointsTop10Bonus(g_cvBonusTop10AmountAgain.IntValue, style, place);
} else {
float fCredits = (g_cvBonusTop10AmountAgain.IntValue / place);
iCredits = RoundFloat(fCredits);
}
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits, "Top 10 Bonus Finish Again");
Shavit_PrintToChat(client, "%t", "BonusTop10Again", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
}
}
}
}
public void Shavit_OnWorldRecord(int client, int style, float time, int jumps, int strafes, float sync, int track) {
@ -401,18 +330,4 @@ public int CalculatePointsBonus(int cvAmount, int style) {
float fResult = cvAmount * Shavit_GetStyleSettingFloat(style, "rankingmultiplier");
int iRoundResult = RoundFloat(fResult);
return iRoundResult;
}
public int CalculatePointsTop10(int cvAmount, int style, int place) {
float fResult = (cvAmount * g_iTier )* Shavit_GetStyleSettingFloat(style, "rankingmultiplier");
float fResult1 = fResult - (cvAmount / place);
int iRoundResult = RoundFloat(fResult1);
return iRoundResult;
}
public int CalculatePointsTop10Bonus(int cvAmount, int style, int place) {
float fResult = cvAmount * Shavit_GetStyleSettingFloat(style, "rankingmultiplier");
float fResult1 = fResult - (cvAmount / place);
int iRoundResult = RoundFloat(fResult1);
return iRoundResult;
}

View file

@ -40,26 +40,6 @@
"#format" "{1:s}{2:d}{3:s}"
"en" "You have earned {1}{2}{3} credits for breaking your bonus Personal Best again."
}
"NormalTop10"
{
"#format" "{1:s},{2:d},{3:s}"
"en" "You have earned {1}{2}{3} credits for being in Top 10."
}
"NormalTop10Again"
{
"#format" "{1:s},{2:d},{3:s}"
"en" "You have earned {1}{2}{3} credits for being in Top 10 again."
}
"BonusTop10"
{
"#format" "{1:s},{2:d},{3:s}"
"en" "You have earned {1}{2}{3} credits for being in The Bonus Top 10."
}
"BonusTop10Again"
{
"#format" "{1:s},{2:d},{3:s}"
"en" "You have earned {1}{2}{3} credits for being in the Bonus Top 10 again."
}
"WorldRecord"
{
"#format" "{1:s}{2:d}{3:s}"