Skip to content

Commit

Permalink
Merge pull request #741 from shavitush/very_good_yes
Browse files Browse the repository at this point in the history
v2.4.1
  • Loading branch information
shavitush authored Mar 8, 2019
2 parents 16a3308 + 15c67cc commit a0d2052
Show file tree
Hide file tree
Showing 13 changed files with 1,010 additions and 310 deletions.
1 change: 1 addition & 0 deletions addons/sourcemod/configs/shavit-styles.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"special" "0" // For third-party modules. The core plugins will not need this setting.
"specialstring" "" // For modularity. Separated with semicolon. Built-in flags: "segments".
"permission" "" // Permission required. Syntax: "flag;override". For example "p;style_tas" to require the 'p' flag or the "style_tas" override.
"ordering" "0" // Ordering in menus where styles appear. If this value is not present, style ID will be used instead.
}

"1"
Expand Down
67 changes: 66 additions & 1 deletion addons/sourcemod/scripting/include/shavit.inc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#endif
#define _shavit_included

#define SHAVIT_VERSION "2.4.0"
#define SHAVIT_VERSION "2.4.1"
#define STYLE_LIMIT 256
#define MAX_ZONES 64
#define MAX_NAME_LENGTH_SQL 32
Expand Down Expand Up @@ -156,6 +156,7 @@ enum struct stylesettings_t
bool bStrafeCountD;
float fRankingMultiplier;
int iSpecial;
int iOrdering;
}

enum struct chatstrings_t
Expand Down Expand Up @@ -546,6 +547,18 @@ forward void Shavit_OnWorstRecord(int client, int style, float time, int jumps,
*/
forward void Shavit_OnTierAssigned(const char[] map, int tier);

/**
* Gets called when the server acknowledges the client's ranking status.
* It is called after OnClientPostAdminCheck and at forced rank recalculations.
*
* @param client Client index.
* @param rank Client's rank. (0 if unranked or unassigned)
* @param points Client's points. (0.0 if unranked or unassigned)
* @param first True if the forward is called after the initial connection, false if it is caused by recalculation.
* @noreturn
*/
forward void Shavit_OnRankAssigned(int client, int rank, float points, bool first);

/**
* Called when replay playback starts.
*
Expand Down Expand Up @@ -652,6 +665,18 @@ native void Shavit_Replay_DeleteMap(const char[] map);
*/
native void Shavit_Rankings_DeleteMap(const char[] map);

/**
* Changes a player's bhop style.
*
* @param client Client index.
* @param style Style.
* @param force Ignore style permissions.
* @param manual Is it a manual style change? (Was it caused by user interaction?)
* @param noforward Bypasses the call to `Shavit_OnStyleChanged`.
* @return False if failed due to lack of access, true otherwise.
*/
native bool Shavit_ChangeClientStyle(int client, int style, bool force = false, bool manual = false, bool noforward = false);

/**
* Finishes the map for a player, with their current timer stats.
* Will not teleport the player to anywhere, it's handled inside the mapzones plugin.
Expand Down Expand Up @@ -762,6 +787,13 @@ native void Shavit_GetWRTime(int style, float &time, int track);
*/
native float Shavit_GetWorldRecord(int style, int track);

/**
* Reloads WR leaderboards cache for the current map.
*
* @noreturn
*/
native void Shavit_ReloadLeaderboards();

/**
* Saves the WR's record ID for the current map on a variable.
* Unused in base plugins, as of pre-1.4b.
Expand Down Expand Up @@ -878,6 +910,17 @@ native void Shavit_PauseTimer(int client);
*/
native void Shavit_ResumeTimer(int client);

/**
* Deletes the specified replay file.
* Replay data will be unloaded if necessary.
*
* @param map Map display name.
* @param style Bhop style.
* @param track Timer track.
* @return true if replay existed, false otherwise.
*/
native bool Shavit_DeleteReplay(const char[] map, int style, int track);

/**
* Retrieves the engine time of the replay bot's first frame.
*
Expand Down Expand Up @@ -1063,6 +1106,15 @@ native int Shavit_GetStyleStrings(int style, int stringtype, char[] StyleStrings
*/
native int Shavit_GetStyleCount();

/**
* Gets an array with style IDs in their configured menu ordering as specified in the styles config.
*
* @param arr Reference to array to fill with style IDs.
* @param size Array size.
* @noreturn
*/
native void Shavit_GetOrderedStyles(int[] arr, int size);

/**
* Saves chat related strings on string references.
*
Expand Down Expand Up @@ -1212,6 +1264,14 @@ native StringMap Shavit_GetMapTiers();
*/
native bool Shavit_HasStyleAccess(int client, int style);

/**
* Determines whether a client's timer is paused or not.
*
* @param client Client index.
* @return Boolean value.
*/
native bool Shavit_IsPaused(int client);

/**
* Use this native when printing anything in chat if it's related to the timer.
* This native will auto-assign colors and a chat prefix.
Expand Down Expand Up @@ -1265,6 +1325,8 @@ public SharedPlugin __pl_shavit =
#if !defined REQUIRE_PLUGIN
public void __pl_shavit_SetNTVOptional()
{
MarkNativeAsOptional("Shavit_ChangeClientStyle");
MarkNativeAsOptional("Shavit_DeleteReplay");
MarkNativeAsOptional("Shavit_FinishMap");
MarkNativeAsOptional("Shavit_ForceHUDUpdate");
MarkNativeAsOptional("Shavit_FormatChat");
Expand All @@ -1279,6 +1341,7 @@ public void __pl_shavit_SetNTVOptional()
MarkNativeAsOptional("Shavit_GetHUDSettings");
MarkNativeAsOptional("Shavit_GetMapTier");
MarkNativeAsOptional("Shavit_GetMapTiers");
MarkNativeAsOptional("Shavit_GetOrderedStyles");
MarkNativeAsOptional("Shavit_GetPerfectJumps");
MarkNativeAsOptional("Shavit_GetPlayerPB");
MarkNativeAsOptional("Shavit_GetPoints");
Expand Down Expand Up @@ -1315,6 +1378,7 @@ public void __pl_shavit_SetNTVOptional()
MarkNativeAsOptional("Shavit_InsideZone");
MarkNativeAsOptional("Shavit_IsClientCreatingZone");
MarkNativeAsOptional("Shavit_IsKZMap");
MarkNativeAsOptional("Shavit_IsPaused");
MarkNativeAsOptional("Shavit_IsPracticeMode");
MarkNativeAsOptional("Shavit_IsReplayDataLoaded");
MarkNativeAsOptional("Shavit_LoadSnapshot");
Expand All @@ -1323,6 +1387,7 @@ public void __pl_shavit_SetNTVOptional()
MarkNativeAsOptional("Shavit_PauseTimer");
MarkNativeAsOptional("Shavit_PrintToChat");
MarkNativeAsOptional("Shavit_Rankings_DeleteMap");
MarkNativeAsOptional("Shavit_ReloadLeaderboards");
MarkNativeAsOptional("Shavit_ReloadReplay");
MarkNativeAsOptional("Shavit_ReloadReplays");
MarkNativeAsOptional("Shavit_Replay_DeleteMap");
Expand Down
Loading

0 comments on commit a0d2052

Please sign in to comment.