added a configure able TAS Exclusion
This commit is contained in:
parent
d262d8d3aa
commit
3cd3966b60
2 changed files with 41 additions and 31 deletions
Binary file not shown.
|
@ -33,6 +33,7 @@ Convar g_cvEnabledBPb;
|
|||
Convar g_cvNormalBAmount;
|
||||
Convar g_cvWrBAmount;
|
||||
Convar g_cvBPbAmount;
|
||||
Convar g_cvTasEnabled;
|
||||
|
||||
//globals
|
||||
char g_cMap[160];
|
||||
|
@ -43,11 +44,11 @@ bool g_bRankings;
|
|||
|
||||
public void OnAllPluginsLoaded()
|
||||
{
|
||||
if(!LibraryExists("store_zephyrus"))
|
||||
if (!LibraryExists("store_zephyrus"))
|
||||
{
|
||||
SetFailState("store_zephyrus is required for the plugin to work.");
|
||||
}
|
||||
else if(!LibraryExists("shavit-wr"))
|
||||
else if (!LibraryExists("shavit-wr"))
|
||||
{
|
||||
SetFailState("Shavit WR is required for the plugin to work.");
|
||||
}
|
||||
|
@ -71,6 +72,7 @@ public void OnPluginStart()
|
|||
g_cvNormalBAmount = new Convar("credits_amount_normal_bonus", "10.0", "How many points should be given for finishing a Map?", 0, true, 1.0, false);
|
||||
g_cvWrBAmount = new Convar("credits_amount_wr_bonus", "25.0", "How many points should be given for breaking a Map record?", 0, true, 1.0, false);
|
||||
g_cvBPbAmount = new Convar("credits_amount_pb_bonus", "10.0", "How many point should be given for breaking the own Personal Best?", 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);
|
||||
|
||||
|
||||
Convar.CreateConfig("shavit-credits");
|
||||
|
@ -96,7 +98,7 @@ public void Shavit_OnChatConfigLoaded()
|
|||
|
||||
public void OnLibraryAdded(const char[] name)
|
||||
{
|
||||
if(StrEqual(name, "shavit-rankings"))
|
||||
if (StrEqual(name, "shavit-rankings"))
|
||||
{
|
||||
g_bRankings = true;
|
||||
}
|
||||
|
@ -104,7 +106,7 @@ public void OnLibraryAdded(const char[] name)
|
|||
|
||||
public void OnLibraryRemoved(const char[] name)
|
||||
{
|
||||
if(StrEqual(name, "shavit-rankings"))
|
||||
if (StrEqual(name, "shavit-rankings"))
|
||||
{
|
||||
g_bRankings = false;
|
||||
}
|
||||
|
@ -126,30 +128,34 @@ public void Shavit_OnStyleConfigLoaded(int styles)
|
|||
|
||||
public void Shavit_OnLeaveZone(int client, int zone, int track, int id, int entity)
|
||||
{
|
||||
if(zone == Zone_Start){
|
||||
if (zone == Zone_Start) {
|
||||
g_iStyle = Shavit_GetBhopStyle(client);
|
||||
g_fPB = Shavit_GetClientPB(client, g_iStyle, track);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Shavit_OnFinish(int client, int style, float time, int jumps, int strafes, float sync, int track)
|
||||
{
|
||||
char sStyleSpecialString[sizeof(stylestrings_t::sSpecialString)];
|
||||
Shavit_GetStyleStrings(style, sSpecialString, sStyleSpecialString, sizeof(sStyleSpecialString));
|
||||
|
||||
|
||||
if (StrContains(sStyleSpecialString, "segments") != -1)
|
||||
return;
|
||||
return;
|
||||
|
||||
if (!g_cvTasEnabled.BoolValue)
|
||||
if (StrContains(sStyleSpecialString, "tas") != -1)
|
||||
return;
|
||||
|
||||
if (g_cvNormalEnabled.BoolValue == true)
|
||||
{
|
||||
if (g_cvT1Enabled.BoolValue == true || g_iTier != 1)
|
||||
{
|
||||
|
||||
if(track == 0)
|
||||
if (track == 0)
|
||||
{
|
||||
int iCredits;
|
||||
|
||||
if(g_bRankings == true)
|
||||
if (g_bRankings == true)
|
||||
{
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = (g_cvNormalAmount.IntValue * g_iTier) * fMultiplier;
|
||||
|
@ -161,15 +167,15 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
|
|||
iCredits = g_cvNormalAmount.IntValue * g_iTier;
|
||||
}
|
||||
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits);
|
||||
|
||||
|
||||
Shavit_PrintToChat(client, "%t", "NormalFinish", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
|
||||
|
||||
}
|
||||
|
||||
else if(g_cvBNormalEnabled.BoolValue == true)
|
||||
else if (g_cvBNormalEnabled.BoolValue == true)
|
||||
{
|
||||
int iCredits;
|
||||
if(g_bRankings == true)
|
||||
if (g_bRankings == true)
|
||||
{
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = g_cvNormalBAmount.IntValue * fMultiplier;
|
||||
|
@ -180,7 +186,7 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
|
|||
{
|
||||
iCredits = g_cvNormalBAmount.IntValue;
|
||||
}
|
||||
|
||||
|
||||
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits);
|
||||
Shavit_PrintToChat(client, "%t", "NormalBonusFinish", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
|
||||
}
|
||||
|
@ -191,10 +197,10 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
|
|||
{
|
||||
if (time <= g_fPB)
|
||||
{
|
||||
if(track == 0)
|
||||
if (track == 0)
|
||||
{
|
||||
int iCredits;
|
||||
if(g_bRankings == true)
|
||||
if (g_bRankings == true)
|
||||
{
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = (g_cvPBAmount.IntValue * g_iTier) * fMultiplier;
|
||||
|
@ -204,16 +210,16 @@ 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);
|
||||
Shavit_PrintToChat(client, "%t", "PersonalBest", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
|
||||
}
|
||||
|
||||
else if(g_cvEnabledBPb.BoolValue == true)
|
||||
else if (g_cvEnabledBPb.BoolValue == true)
|
||||
{
|
||||
int iCredits;
|
||||
if(g_bRankings == true)
|
||||
if (g_bRankings == true)
|
||||
{
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = g_cvBPbAmount.IntValue * fMultiplier;
|
||||
|
@ -223,7 +229,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);
|
||||
Shavit_PrintToChat(client, "%t", "BonusPersonalBest", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
|
||||
}
|
||||
|
@ -235,17 +241,21 @@ public void Shavit_OnWorldRecord(int client, int style, float time, int jumps, i
|
|||
{
|
||||
char sStyleSpecialString[sizeof(stylestrings_t::sSpecialString)];
|
||||
Shavit_GetStyleStrings(style, sSpecialString, sStyleSpecialString, sizeof(sStyleSpecialString));
|
||||
|
||||
|
||||
if (StrContains(sStyleSpecialString, "segments") != -1)
|
||||
return;
|
||||
return;
|
||||
|
||||
if (!g_cvTasEnabled.BoolValue)
|
||||
if (StrContains(sStyleSpecialString, "tas") != -1)
|
||||
return;
|
||||
|
||||
if (g_cvWREnabled.BoolValue == true)
|
||||
{
|
||||
if(track == 0)
|
||||
if (track == 0)
|
||||
{
|
||||
int iCredits;
|
||||
if(g_bRankings == true)
|
||||
{
|
||||
if (g_bRankings == true)
|
||||
{
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = (g_cvWrAmount.IntValue * g_iTier) * fMultiplier;
|
||||
int iRoundResult = RoundFloat(fResult);
|
||||
|
@ -254,16 +264,16 @@ public void Shavit_OnWorldRecord(int client, int style, float time, int jumps, i
|
|||
else
|
||||
{
|
||||
iCredits = g_cvWrAmount.IntValue * g_iTier;
|
||||
}
|
||||
}
|
||||
|
||||
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits);
|
||||
Shavit_PrintToChat(client, "%t", "WorldRecord", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
|
||||
}
|
||||
|
||||
else if(g_cvBWREnabled.BoolValue == true)
|
||||
else if (g_cvBWREnabled.BoolValue == true)
|
||||
{
|
||||
int iCredits;
|
||||
if(g_bRankings == true)
|
||||
if (g_bRankings == true)
|
||||
{
|
||||
float fMultiplier = gA_StyleSettings[style].fRankingMultiplier;
|
||||
float fResult = g_cvWrBAmount.IntValue * fMultiplier;
|
||||
|
@ -274,9 +284,9 @@ public void Shavit_OnWorldRecord(int client, int style, float time, int jumps, i
|
|||
{
|
||||
iCredits = g_cvWrBAmount.IntValue;
|
||||
}
|
||||
|
||||
|
||||
Store_SetClientCredits(client, Store_GetClientCredits(client) + iCredits);
|
||||
|
||||
|
||||
Shavit_PrintToChat(client, "%t", "BonusWorldRecord", gS_ChatStrings.sVariable, iCredits, gS_ChatStrings.sText);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue