Skip to content

Commit

Permalink
2017-07-12 update.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aessi committed Jul 12, 2017
1 parent 6a84752 commit 21e1a69
Show file tree
Hide file tree
Showing 11 changed files with 150 additions and 40 deletions.
60 changes: 44 additions & 16 deletions Common/Scripts/Libs/Nadeo/MatchmakingMatch.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Matchmaking match library
*/

#Const Version "2017-05-12"
#Const Version "2017-07-11"
#Const ScriptName "Libs/Nadeo/MatchmakingMatch.Script.txt"

#Include "TextLib" as TL
Expand Down Expand Up @@ -48,21 +48,22 @@
// ---------------------------------- //
// Globales
// ---------------------------------- //
declare Text G_LibMMMatch_MatchId; ///< Id of the match
declare Integer G_LibMMMatch_MatchStatus; ///< Current match status
declare Integer[Integer][Text] G_LibMMMatch_MissingPlayers; ///< List of missing players login, if they were kicked or not and their clan
declare Text[] G_LibMMMatch_KickedPlayers; ///< List of kicked players
declare Integer[] G_LibMMMatch_Scores; ///< Scores of the current match
declare Integer G_LibMMMatch_NextPing; ///< Time of the next ping to the API
declare Integer G_LibMMMatch_EmptySince; ///< Time since when the server is empty
declare Integer G_LibMMMatch_NextPlayersNumberCheck;///< Time of the next players number check
declare Boolean G_LibMMMatch_AllowSubstitutes; ///< Allow the matchmaking to search substitutes to missing players
declare Integer[Text] G_LibMMMatch_GhostPlayers; ///< Logins and clans list of the ghost players
declare Integer G_LibMMMatch_GhostPlayersIndex; ///< Next index to use when creating a chost players
declare Boolean G_LibMMMatch_NewMissingPlayer; ///< True if there's some new missing players not already sent to the API
declare Integer[][Text] G_LibMMMatch_Players; ///< Logins, clans and order of the allowed players in the match
declare Text G_LibMMMatch_LobbyLogin; ///< Login of the lobby server where to send back the players
declare Integer[Text] G_LibMMMatch_Clans; ///< Clans assigned to the players by the matchmaking
declare Text G_LibMMMatch_MatchId; ///< Id of the match
declare Integer G_LibMMMatch_MatchStatus; ///< Current match status
declare Integer[Integer][Text] G_LibMMMatch_MissingPlayers; ///< List of missing players login, if they were kicked or not and their clan
declare Text[] G_LibMMMatch_KickedPlayers; ///< List of kicked players
declare Integer[] G_LibMMMatch_Scores; ///< Scores of the current match
declare Integer G_LibMMMatch_NextPing; ///< Time of the next ping to the API
declare Integer G_LibMMMatch_EmptySince; ///< Time since when the server is empty
declare Integer G_LibMMMatch_NextPlayersNumberCheck; ///< Time of the next players number check
declare Boolean G_LibMMMatch_AllowSubstitutes; ///< Allow the matchmaking to search substitutes to missing players
declare Boolean G_LibMMMatch_EnablePenalty; ///< Enable the penalty for leaving an ongoing match
declare Integer[Text] G_LibMMMatch_GhostPlayers; ///< Logins and clans list of the ghost players
declare Integer G_LibMMMatch_GhostPlayersIndex; ///< Next index to use when creating a chost players
declare Boolean G_LibMMMatch_NewMissingPlayer; ///< True if there's some new missing players not already sent to the API
declare Integer[][Text] G_LibMMMatch_Players; ///< Logins, clans and order of the allowed players in the match
declare Text G_LibMMMatch_LobbyLogin; ///< Login of the lobby server where to send back the players
declare Integer[Text] G_LibMMMatch_Clans; ///< Clans assigned to the players by the matchmaking

// ---------------------------------- //
// Functions
Expand Down Expand Up @@ -112,6 +113,7 @@ Void Unload() {
G_LibMMMatch_EmptySince = -1;
G_LibMMMatch_NextPlayersNumberCheck = -1;
G_LibMMMatch_AllowSubstitutes = True;
G_LibMMMatch_EnablePenalty = True;
G_LibMMMatch_GhostPlayers.clear();
G_LibMMMatch_GhostPlayersIndex = 0;
G_LibMMMatch_NewMissingPlayer = False;
Expand Down Expand Up @@ -345,11 +347,16 @@ Void PostMatchStatus() {
if (MatchScoresText != "") MatchScoresText ^= ",";
MatchScoresText ^= MatchScore;
}

declare PenaltyText = "true";
if (!G_LibMMMatch_EnablePenalty) PenaltyText = "false";

declare PostData = """
{
"serverlogin": "{{{TL::MLEncode(ServerLogin)}}}",
"status": {{{GetMatchStatus()}}},
"matchid": {{{GetMatchIdInteger()}}},
"penalty": {{{PenaltyText}}},
"scores": [{{{MatchScoresText}}}],
"missingplayers": [{{{MissingPlayers}}}]
}""";
Expand Down Expand Up @@ -468,6 +475,27 @@ Void ForceAllowSubstitutes(Boolean _AllowSubstitute) {
G_LibMMMatch_AllowSubstitutes = _AllowSubstitute;
}

// ---------------------------------- //
/** Enable or disable the penalties
* for leaving a match
*
* @param _Enabled True to enable the penalties,
* False to disable them
*/
Void EnablePenalty(Boolean _Enabled) {
G_LibMMMatch_EnablePenalty = _Enabled;
}

// ---------------------------------- //
/** Check if penalties are enabled
*
* @return True if the penalties are enabled,
* False otherwise
*/
Boolean PenaltyEnabled() {
return G_LibMMMatch_EnablePenalty;
}

// ---------------------------------- //
/** Create a ghost player
*
Expand Down
25 changes: 17 additions & 8 deletions Common/Scripts/Libs/Nadeo/TrackMania/Events.Script.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Events library
*/
#Const Version "2017-04-04"
#Const Version "2017-07-12"
#Const ScriptName "Libs/Nadeo/TrackMania/Events.Script.txt"

// ---------------------------------- //
Expand Down Expand Up @@ -215,9 +215,13 @@ Void Private_XmlRpc_Event_Stunt(CTmModeEvent _Event) {
/** Pass on an event
*
* @param _Event The event to pass on
*
* @return True if the event was processed
* False if the event was dropped
*/
Void Private_PassOn(CTmModeEvent _Event) {
This.PassOn(_Event);
Boolean Private_PassOn(CTmModeEvent _Event) {
declare Processed = This.PassOn(_Event);
if (!Processed) return False;

if (_Event != Null) {
declare Removed = G_DiscardedEvents.remove(_Event.Id);
Expand All @@ -235,6 +239,8 @@ Void Private_PassOn(CTmModeEvent _Event) {
default: Private_XmlRpc_Event_Default(_Event);
}
}

return True;
}

// ---------------------------------- //
Expand Down Expand Up @@ -276,11 +282,14 @@ Text GetScriptName() {
/** Pass on an event
*
* @param _Event The event to pass on
*
* @return True if the event was processed
* False if the event was dropped
*/
Void Valid(CTmModeEvent _Event) {
if (_Event == Null) return;
Boolean Valid(CTmModeEvent _Event) {
if (_Event == Null) return False;

Private_PassOn(_Event);
return Private_PassOn(_Event);
}

// ---------------------------------- //
Expand All @@ -303,7 +312,7 @@ Void Invalid(CTmModeEvent _Event) {
* @return True if the event was passed on,
* False otherwise
*/
Boolean Validated(CSmModeEvent _Event) {
Boolean Validated(CTmModeEvent _Event) {
if (_Event == Null) return False;
return G_PassedOnEvents.exists(_Event.Id);
}
Expand All @@ -317,7 +326,7 @@ Boolean Validated(CSmModeEvent _Event) {
* @return True if the event was discarded,
* False otherwise
*/
Boolean Invalidated(CSmModeEvent _Event) {
Boolean Invalidated(CTmModeEvent _Event) {
if (_Event == Null) return False;
return G_DiscardedEvents.exists(_Event.Id);
}
Expand Down
27 changes: 25 additions & 2 deletions Common/Scripts/Modes/ModeMatchmaking2.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
#Extends "Modes/ModeBase2.Script.txt"

#Const MB_MM_Version "2017-06-01"
#Const MB_MM_Version "2017-07-11"
#Const MB_MM_ScriptName "Modes/ModeMatchmaking2.Script.txt"

// ---------------------------------- //
Expand All @@ -26,6 +26,7 @@
#Setting S_MatchmakingVoteForMap False as "<hidden>" ///< Allow players to vote for the next played map
#Setting S_MatchmakingProgressive False as "<hidden>" ///< Can start a match with less players than the required number
#Setting S_MatchmakingWaitingTime 20 as "<hidden>" ///< Waiting time at the beginning of the matches
#Setting S_MatchmakingEnablePenalty True as "<hidden>" ///< Enable the penalty for leaving a match
#Setting S_LobbyRoundPerMap 60 as "<hidden>" ///< "Nb of rounds per map in lobby mode")
#Setting S_LobbyMatchmakerPerRound 6 as "<hidden>" ///< Number of matchmaker call in a "King of the Lobby" round
#Setting S_LobbyMatchmakerWait 2 as "<hidden>" ///< Waiting time before the next call to the matchmaking function
Expand All @@ -44,7 +45,7 @@
// ---------------------------------- //
// Constants
// ---------------------------------- //
#Const C_Lobby_Private_BotsNb 0 ///< Number of bots in the lobby
#Const C_Lobby_Private_BotsNb 0 ///< Number of bots in the lobby
#Const C_Match_Private_RematchWaitingTime 15000 ///< Waiting time at the beginning of a new map without a new matchmaking session

// ---------------------------------- //
Expand Down Expand Up @@ -852,6 +853,28 @@ Boolean MM_Private_SubstitutesAreAllowed() {
return MMMatch::GetAllowSubstitutes();
}

// ---------------------------------- //
/** Enable or disable the penalty for
* leaving a match
*
* @param _Enabled True to enable the penalty
* False to disable
*/
Void MM_Private_EnablePenalty(Boolean _Enabled) {
MMMatch::EnablePenalty(_Enabled);
}

// ---------------------------------- //
/** Check if the penalty for leaving
* a match is enabled
*
* @return True if the penalty is enabled
* False if the penalty is disabled
*/
Boolean MM_Private_PenaltyIsEnabled() {
return MMMatch::PenaltyEnabled();
}

// ---------------------------------- //
/** Get the slot selected by the matchmaking for the player
*
Expand Down
24 changes: 23 additions & 1 deletion Common/Scripts/Modes/ShootMania/Base/ModeShootmania.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
#Extends "Modes/ShootMania/Base/ModeMatchmaking2.Script.txt"

#Const MS_Version "2017-05-19"
#Const MS_Version "2017-07-11"
#Const MS_ScriptName "Modes/ShootMania/ModeShootmania.Script.txt"

/*
Expand Down Expand Up @@ -1327,4 +1327,26 @@ Void MM_AllowSubstitutes(Boolean _AllowSubstitutes) {
*/
Boolean MM_SubstitutesAreAllowed() {
return MM_Private_SubstitutesAreAllowed();
}

// ---------------------------------- //
/** Enable or disable the penalty for
* leaving a match
*
* @param _Enabled True to enable the penalty
* False to disable
*/
Void MM_EnablePenalty(Boolean _Enabled) {
MM_Private_EnablePenalty(_Enabled);
}

// ---------------------------------- //
/** Check if the penalty for leaving
* a match is enabled
*
* @return True if the penalty is enabled
* False if the penalty is disabled
*/
Boolean MM_PenaltyIsEnabled() {
return MM_Private_PenaltyIsEnabled();
}
24 changes: 23 additions & 1 deletion Common/Scripts/Modes/TrackMania/Base/ModeTrackmania.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
#Extends "Modes/TrackMania/Base/ModeMatchmaking2.Script.txt"

#Const MT_Version "2017-05-15"
#Const MT_Version "2017-07-11"
#Const MT_ScriptName "Modes/TrackMania/ModeTrackmania.Script.txt"

/*
Expand Down Expand Up @@ -1344,4 +1344,26 @@ Void MM_AllowSubstitutes(Boolean _AllowSubstitutes) {
*/
Boolean MM_SubstitutesAreAllowed() {
return MM_Private_SubstitutesAreAllowed();
}

// ---------------------------------- //
/** Enable or disable the penalty for
* leaving a match
*
* @param _Enabled True to enable the penalty
* False to disable
*/
Void MM_EnablePenalty(Boolean _Enabled) {
MM_Private_EnablePenalty(_Enabled);
}

// ---------------------------------- //
/** Check if the penalty for leaving
* a match is enabled
*
* @return True if the penalty is enabled
* False if the penalty is disabled
*/
Boolean MM_PenaltyIsEnabled() {
return MM_Private_PenaltyIsEnabled();
}
5 changes: 3 additions & 2 deletions Common/Scripts/Modes/TrackMania/Chase.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#Extends "Modes/TrackMania/Base/ModeTrackmania.Script.txt"

#Const CompatibleMapTypes "Race"
#Const Version "2017-06-20"
#Const Version "2017-07-12"
#Const ScriptName "Modes/TrackMania/Chase/Chase.Script.txt"

// ---------------------------------- //
Expand Down Expand Up @@ -666,7 +666,8 @@ foreach (Clan => PlayersIds in PlayersToRemove) {
// ---------------------------------- //
// Manage events
foreach (Event in PendingEvents) {
Events::Valid(Event);
declare Processed = Events::Valid(Event);
if (!Processed) continue;

// ---------------------------------- //
// Waypoint
Expand Down
5 changes: 3 additions & 2 deletions Common/Scripts/Modes/TrackMania/Cup.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#Extends "Modes/TrackMania/Base/RoundsBase2.Script.txt"

#Const CompatibleMapTypes "Race"
#Const Version "2017-06-21"
#Const Version "2017-07-12"
#Const ScriptName "Modes/TrackMania/Cup/Cup.Script.txt"

// ---------------------------------- //
Expand Down Expand Up @@ -161,7 +161,8 @@ foreach (Score in Scores) {
// ---------------------------------- //
// Manage events
foreach (Event in PendingEvents) {
Events::Valid(Event);
declare Processed = Events::Valid(Event);
if (!Processed) continue;

// ---------------------------------- //
// Waypoint
Expand Down
5 changes: 3 additions & 2 deletions Common/Scripts/Modes/TrackMania/Laps.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#Extends "Modes/TrackMania/Base/ModeTrackmania.Script.txt"

#Const CompatibleMapTypes "Race"
#Const Version "2017-06-21"
#Const Version "2017-07-12"
#Const ScriptName "Modes/TrackMania/Laps/Laps.Script.txt"

// ---------------------------------- //
Expand Down Expand Up @@ -177,7 +177,8 @@ foreach (Player in Players) {
}

foreach (Event in PendingEvents) {
Events::Valid(Event);
declare Processed = Events::Valid(Event);
if (!Processed) continue;

// ---------------------------------- //
// Waypoint
Expand Down
5 changes: 3 additions & 2 deletions Common/Scripts/Modes/TrackMania/Rounds.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#Extends "Modes/TrackMania/Base/RoundsBase2.Script.txt"

#Const CompatibleMapTypes "Race"
#Const Version "2017-06-28"
#Const Version "2017-07-12"
#Const ScriptName "Modes/TrackMania/Rounds/Rounds.Script.txt"

// ---------------------------------- //
Expand Down Expand Up @@ -115,7 +115,8 @@ UpdateScoresTableFooter(S_PointsLimit, S_RoundsPerMap, S_MapsPerMatch);
// ---------------------------------- //
// Manage events
foreach (Event in PendingEvents) {
Events::Valid(Event);
declare Processed = Events::Valid(Event);
if (!Processed) continue;

// ---------------------------------- //
// Waypoint
Expand Down
5 changes: 3 additions & 2 deletions Common/Scripts/Modes/TrackMania/Team.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#Extends "Modes/TrackMania/Base/RoundsBase2.Script.txt"

#Const CompatibleMapTypes "Race"
#Const Version "2017-06-21"
#Const Version "2017-07-12"
#Const ScriptName "Modes/TrackMania/Team/Team.Script.txt"

// ---------------------------------- //
Expand Down Expand Up @@ -147,7 +147,8 @@ CutOffTimeLimit = -1;
// ---------------------------------- //
// Manage events
foreach (Event in PendingEvents) {
Events::Valid(Event);
declare Processed = Events::Valid(Event);
if (!Processed) continue;

// ---------------------------------- //
// Waypoint
Expand Down
Loading

0 comments on commit 21e1a69

Please sign in to comment.