/**
 *	XmlRpc2 base library
 */
#Const	Version			"2017-05-04"
#Const	ScriptName	"Libs/Nadeo/XmlRpc2_Base.Script.txt"

// ---------------------------------- //
// Libraries
// ---------------------------------- //
#Include "TextLib" as TL
#Include "Libs/Nadeo/XmlRpc2.Script.txt" as XmlRpc
#Include "Libs/Nadeo/WarmUp3Common.Script.txt" as WarmUp

// ---------------------------------- //
// Constants
// ---------------------------------- //
/// Callbacks
#Const C_Callback_CallbacksList					"XmlRpc.CallbacksList"
#Const C_Callback_CallbacksList_Enabled	"XmlRpc.CallbacksList_Enabled"
#Const C_Callback_CallbacksList_Disabled	"XmlRpc.CallbacksList_Disabled"
#Const C_Callback_CallbackHelp						"XmlRpc.CallbackHelp"
#Const C_Callback_MethodsList						"XmlRpc.MethodsList"
#Const C_Callback_MethodHelp							"XmlRpc.MethodHelp"
#Const C_Callback_Documentation					"XmlRpc.Documentation"
#Const C_Callback_ApiVersion							"XmlRpc.ApiVersion"
#Const C_Callback_AllApiVersions					"XmlRpc.AllApiVersions"
#Const C_Callback_StartServer_Start			"Maniaplanet.StartServer_Start"
#Const C_Callback_StartServer_End				"Maniaplanet.StartServer_End"
#Const C_Callback_StartMatch_Start				"Maniaplanet.StartMatch_Start"
#Const C_Callback_StartMatch_End					"Maniaplanet.StartMatch_End"
#Const C_Callback_StartMap_Start					"Maniaplanet.StartMap_Start"
#Const C_Callback_StartMap_End						"Maniaplanet.StartMap_End"
#Const C_Callback_StartRound_Start				"Maniaplanet.StartRound_Start"
#Const C_Callback_StartRound_End					"Maniaplanet.StartRound_End"
#Const C_Callback_StartTurn_Start				"Maniaplanet.StartTurn_Start"
#Const C_Callback_StartTurn_End					"Maniaplanet.StartTurn_End"
#Const C_Callback_StartPlayLoop					"Maniaplanet.StartPlayLoop"
#Const C_Callback_EndPlayLoop						"Maniaplanet.EndPlayLoop"
#Const C_Callback_EndTurn_Start					"Maniaplanet.EndTurn_Start"
#Const C_Callback_EndTurn_End						"Maniaplanet.EndTurn_End"
#Const C_Callback_EndRound_Start					"Maniaplanet.EndRound_Start"
#Const C_Callback_EndRound_End						"Maniaplanet.EndRound_End"
#Const C_Callback_EndMap_Start						"Maniaplanet.EndMap_Start"
#Const C_Callback_EndMap_End							"Maniaplanet.EndMap_End"
#Const C_Callback_EndMatch_Start					"Maniaplanet.EndMatch_Start"
#Const C_Callback_EndMatch_End						"Maniaplanet.EndMatch_End"
#Const C_Callback_EndServer_Start				"Maniaplanet.EndServer_Start"
#Const C_Callback_EndServer_End					"Maniaplanet.EndServer_End"
#Const C_Callback_LoadingMap_Start				"Maniaplanet.LoadingMap_Start"
#Const C_Callback_LoadingMap_End					"Maniaplanet.LoadingMap_End"
#Const C_Callback_UnloadingMap_Start			"Maniaplanet.UnloadingMap_Start"
#Const C_Callback_UnloadingMap_End				"Maniaplanet.UnloadingMap_End"
#Const C_Callback_Podium_Start						"Maniaplanet.Podium_Start"
#Const C_Callback_Podium_End							"Maniaplanet.Podium_End"
#Const C_Callback_ChannelProgression_Start	"Maniaplanet.ChannelProgression_Start"
#Const C_Callback_ChannelProgression_End		"Maniaplanet.ChannelProgression_End"
#Const C_Callback_UseTeams								"Maniaplanet.Mode.UseTeams"
/// Methods
#Const C_Method_Set_EnableCallbacks				"XmlRpc.EnableCallbacks"
#Const C_Method_Get_CallbacksList					"XmlRpc.GetCallbacksList"
#Const C_Method_Get_CallbacksList_Enabled	"XmlRpc.GetCallbacksList_Enabled"
#Const C_Method_Get_CallbacksList_Disabled	"XmlRpc.GetCallbacksList_Disabled"
#Const C_Method_Set_BlockCallbacks					"XmlRpc.BlockCallbacks"
#Const C_Method_Set_UnblockCallbacks				"XmlRpc.UnblockCallbacks"
#Const C_Method_Get_CallbackHelp						"XmlRpc.GetCallbackHelp"
#Const C_Method_Get_MethodsList						"XmlRpc.GetMethodsList"
#Const C_Method_Get_MethodHelp							"XmlRpc.GetMethodHelp"
#Const C_Method_Get_Documentation					"XmlRpc.GetDocumentation"
#Const C_Method_Set_ApiVersion							"XmlRpc.SetApiVersion"
#Const C_Method_Get_ApiVersion							"XmlRpc.GetApiVersion"
#Const C_Method_Get_AllApiVersions					"XmlRpc.GetAllApiVersions"
#Const C_Method_Get_UseTeams								"Maniaplanet.Mode.GetUseTeams"
#Const C_Method_Set_AltScoresTable					"Maniaplanet.UI.SetAltScoresTableVisibility"

// ---------------------------------- //
// Functions
// ---------------------------------- //
// ---------------------------------- //
// Private
// ---------------------------------- //
// ---------------------------------- //
/** Get map info in json format
 *
 *	@param	_Map											The map to export
 */
Text Private_GetJson_Map(CMap _Map) {
	if (_Map == Null || _Map.MapInfo == Null) return "{}";
	
	return """{
		"uid": {{{XmlRpc::JsonGetText(_Map.MapInfo.MapUid)}}},
		"name": {{{XmlRpc::JsonGetText(_Map.MapInfo.Name)}}},
		"filename": {{{XmlRpc::JsonGetText(_Map.MapInfo.FileName)}}},
		"author": {{{XmlRpc::JsonGetText(_Map.MapInfo.AuthorLogin)}}},
		"environment": {{{XmlRpc::JsonGetText(_Map.MapInfo.CollectionName)}}},
		"mood": {{{XmlRpc::JsonGetText(_Map.DecorationName)}}},
		"bronzetime": {{{dump(_Map.MapInfo.TMObjective_BronzeTime)}}},
		"silvertime": {{{dump(_Map.MapInfo.TMObjective_SilverTime)}}},
		"goldtime": {{{dump(_Map.MapInfo.TMObjective_GoldTime)}}},
		"authortime": {{{dump(_Map.MapInfo.TMObjective_AuthorTime)}}},
		"copperprice": {{{dump(_Map.MapInfo.CopperPrice)}}},
		"laprace": {{{XmlRpc::JsonGetBoolean(_Map.MapInfo.TMObjective_IsLapRace)}}},
		"nblaps": {{{dump(_Map.TMObjective_NbLaps)}}},
		"maptype": {{{XmlRpc::JsonGetText(_Map.MapInfo.MapType)}}},
		"mapstyle": {{{XmlRpc::JsonGetText(_Map.MapInfo.MapStyle)}}}
	}""";
}

// ---------------------------------- //
/// Get map info json format description
Text Private_GetJsonDescription_Map() {
	return """{
				"uid": "4dNDBnxvcwDaXmQz4Qf5khJUSOd", //< Unique id of the map
				"name": "NameOfTheMap", //< Name of the map
				"filename": "Path\\To\\Map\\NameOfTheMap.Map.Gbx", //< Path to the file from the "Maps" folder
				"author": "AuthorLogin", //< Login of the author
				"environment": "Storm", //< Environment used to build the map
				"mood": "Day", //< Mood used to build the map
				"bronzetime": -1, //< Bronze medal time (valid in Trackmania only)
				"silvertime": -1, //< Silver medal time (valid in Trackmania only)
				"goldtime": -1, //< Gold medal time (valid in Trackmania only)
				"authortime": -1, //< Author medal time (valid in Trackmania only)
				"copperprice": 1008, //< Price of the map in coppers
				"laprace": false, //< Is the map a mutlilaps (valid in Trackmania only)
				"nblaps": 0, //< Number of laps if the map is a mutlilaps (valid in Trackmania only)
				"maptype": "ShootMania\\MapTypeArena", //< MapType used to validate the map
				"mapstyle": "StyleOfTheMap" //< Style applied to the map
			}""";
}

// ---------------------------------- //
// Public
// ---------------------------------- //
// ---------------------------------- //
/**	Return the version number of the script
 *
 *	@return														The version number of the script
 */
Text GetScriptVersion() {
	return Version;
}

// ---------------------------------- //
/**	Return the name of the script
 *
 *	@return														The name of the script
 */
Text GetScriptName() {
	return ScriptName;
}

// ---------------------------------- //
/** Send a list of all registered callbacks
 *
 *	@param	_ResponseId								Id to insert in the response callback
 */
Void SendCallbacksList(Text _ResponseId) {
	declare CallbacksList = XmlRpc::GetCallbacks();
	declare Response = """{
	"responseid": {{{XmlRpc::JsonGetText(_ResponseId)}}},
	"callbacks": {{{XmlRpc::JsonGetTextArray(CallbacksList)}}}
}""";
	XmlRpc::SendCallback(C_Callback_CallbacksList, [Response]);
}

// ---------------------------------- //
/** Send a list of all enabled callbacks
 *
 *	@param	_ResponseId								Id to insert in the response callback
 */
Void SendEnabledCallbacksList(Text _ResponseId) {
	declare CallbacksList = XmlRpc::GetEnabledCallbacks();
	declare Response = """{
	"responseid": {{{XmlRpc::JsonGetText(_ResponseId)}}},
	"callbacks": {{{XmlRpc::JsonGetTextArray(CallbacksList)}}}
}""";
	XmlRpc::SendCallback(C_Callback_CallbacksList_Enabled, [Response]);
}

// ---------------------------------- //
/** Send a list of all disabled callbacks
 *
 *	@param	_ResponseId								Id to insert in the response callback
 */
Void SendDisabledCallbacksList(Text _ResponseId) {
	declare CallbackList = XmlRpc::GetDisabledCallbacks();
	declare Response = """{
	"responseid": {{{XmlRpc::JsonGetText(_ResponseId)}}},
	"callbacks": {{{XmlRpc::JsonGetTextArray(CallbackList)}}}
}""";
	XmlRpc::SendCallback(C_Callback_CallbacksList_Disabled, [Response]);
}

// ---------------------------------- //
/** Send help for a given callback
 *
 *	@param	_CallbackName							The name of the callback to get help for
 *	@param	_ResponseId								Id to insert in the response callback
 */
Void SendCallbackHelp(Text _CallbackName, Text _ResponseId) {
	declare Description = XmlRpc::GetCallbackHelp(_CallbackName);
	declare Response = """{
	"responseid": {{{XmlRpc::JsonGetText(_ResponseId)}}},
	"callback": {{{XmlRpc::JsonGetText(_CallbackName)}}},
	"available": {{{XmlRpc::JsonGetBoolean(XmlRpc::CallbackIsRegistered(_CallbackName))}}},
	"disabled": {{{XmlRpc::JsonGetBoolean(!XmlRpc::CallbackIsEnabled(_CallbackName))}}}
}""";
	XmlRpc::SendCallback(C_Callback_CallbackHelp, [Response, Description]);
}

// ---------------------------------- //
/** Send a list of all registered methods
 *
 *	@param	_ResponseId								Id to insert in the response callback
 */
Void SendMethodsList(Text _ResponseId) {
	declare MethodsList = XmlRpc::GetMethods();
	declare Response = """{
	"responseid": {{{XmlRpc::JsonGetText(_ResponseId)}}},
	"methods": {{{XmlRpc::JsonGetTextArray(MethodsList)}}}
}""";
	XmlRpc::SendCallback(C_Callback_MethodsList, [Response]);
}

// ---------------------------------- //
/** Send help for a given method
 *
 *	@param	_MethodName								The name of the method to get help for
 *	@param	_ResponseId								Id to insert in the response callback
 */
Void SendMethodHelp(Text _MethodName, Text _ResponseId) {
	declare Description = XmlRpc::GetMethodHelp(_MethodName);
	declare Response = """{
	"responseid": {{{XmlRpc::JsonGetText(_ResponseId)}}},
	"method": {{{XmlRpc::JsonGetText(_MethodName)}}},
	"available": {{{XmlRpc::JsonGetBoolean(XmlRpc::MethodIsRegistered(_MethodName))}}}
}""";
	XmlRpc::SendCallback(C_Callback_MethodHelp, [Response, Description]);
}

// ---------------------------------- //
/** Send the whole callbacks and methods documentation
 *
 *	@param	_ResponseId								Id to insert in the response callback
 */
Void SendDocumentation(Text _ResponseId) {
	declare Documentation = XmlRpc::GenerateDocumentation();
	declare Response = """{
	"responseid": {{{XmlRpc::JsonGetText(_ResponseId)}}}
}""";
	XmlRpc::SendCallback(C_Callback_Documentation, [Response, Documentation]);
}

// ---------------------------------- //
/** Send the currently selected api version
 *
 *	@param	_ResponseId								Id to insert in the response callback
 */
Void SendApiVersion(Text _ResponseId) {
	declare ApiVersion = XmlRpc::GetApiVersion();
	declare Response = """{
	"responseid": {{{XmlRpc::JsonGetText(_ResponseId)}}},
	"version": {{{XmlRpc::JsonGetText(ApiVersion)}}}
}""";
	XmlRpc::SendCallback(C_Callback_ApiVersion, [Response]);
}

// ---------------------------------- //
/** Send all available api versions
 *
 *	@param	_ResponseId								Id to insert in the response callback
 */
Void SendAllApiVersions(Text _ResponseId) {
	declare AllVersions = XmlRpc::GetAllApiVersions();
	declare LatestVersion = XmlRpc::GetLatestApiVersion();
	declare Response = """{
	"responseid": {{{XmlRpc::JsonGetText(_ResponseId)}}},
	"latest": {{{XmlRpc::JsonGetText(LatestVersion)}}},
	"versions": {{{XmlRpc::JsonGetTextArray(AllVersions)}}}
}""";
	XmlRpc::SendCallback(C_Callback_AllApiVersions, [Response]);
}

// ---------------------------------- //
/** Send if the game mode use teams or not
 *
 *	@param	_ResponseId								Id to insert in the response callback
 */
Void SendUseTeams(Text _ResponseId) {
	declare Response = """{
	"responseid": {{{XmlRpc::JsonGetText(_ResponseId)}}},
	"teams": {{{XmlRpc::JsonGetBoolean(UseClans)}}}
}""";
	XmlRpc::SendCallback(C_Callback_UseTeams, [Response]);
}

// ---------------------------------- //
/** Send a callback signaling the 
 *	end/beginning of a mode base section
 */
Void SendStartServer_Start(Boolean _Restarted, Boolean _ModeUpdated, Text _ModeName) {
	declare Response = """{
	"restarted": {{{XmlRpc::JsonGetBoolean(_Restarted)}}},
	"mode": {
		"updated": {{{XmlRpc::JsonGetBoolean(_ModeUpdated)}}},
		"name": {{{XmlRpc::JsonGetText(_ModeName)}}}
	},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_StartServer_Start, [Response]);
}
Void SendStartServer_End(Boolean _Restarted, Boolean _ModeUpdated, Text _ModeName) {
	declare Response = """{
	"restarted": {{{XmlRpc::JsonGetBoolean(_Restarted)}}},
	"mode": {
		"updated": {{{XmlRpc::JsonGetBoolean(_ModeUpdated)}}},
		"name": {{{XmlRpc::JsonGetText(_ModeName)}}}
	},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_StartServer_End, [Response]);
}
Void SendStartMatch_Start(Integer _Count) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_StartMatch_Start, [Response]);
}
Void SendStartMatch_End(Integer _Count) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_StartMatch_End, [Response]);
}
Void SendStartMap_Start(Integer _Count, CMap _Map, Boolean _Restarted) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"restarted": {{{XmlRpc::JsonGetBoolean(_Restarted)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}},
	"map": {{{Private_GetJson_Map(_Map)}}}
}""";
	XmlRpc::SendCallback(C_Callback_StartMap_Start, [Response]);
}
Void SendStartMap_End(Integer _Count, CMap _Map, Boolean _Restarted) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"restarted": {{{XmlRpc::JsonGetBoolean(_Restarted)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}},
	"map": {{{Private_GetJson_Map(_Map)}}}
}""";
	XmlRpc::SendCallback(C_Callback_StartMap_End, [Response]);
}
Void SendStartRound_Start(Integer _Count) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_StartRound_Start, [Response]);
}
Void SendStartRound_End(Integer _Count) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_StartRound_End, [Response]);
}
Void SendStartTurn_Start(Integer _Count) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_StartTurn_Start, [Response]);
}
Void SendStartTurn_End(Integer _Count) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_StartTurn_End, [Response]);
}
Void SendStartPlayLoop(Integer _Count) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_StartPlayLoop, [Response]);
}
Void SendEndPlayLoop(Integer _Count) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_EndPlayLoop, [Response]);

}
Void SendEndTurn_Start(Integer _Count) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_EndTurn_Start, [Response]);
}
Void SendEndTurn_End(Integer _Count) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_EndTurn_End, [Response]);
}
Void SendEndRound_Start(Integer _Count) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_EndRound_Start, [Response]);
}
Void SendEndRound_End(Integer _Count) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_EndRound_End, [Response]);
}
Void SendEndMap_Start(Integer _Count, CMap _Map) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"map": {{{Private_GetJson_Map(_Map)}}}
}""";
	XmlRpc::SendCallback(C_Callback_EndMap_Start, [Response]);
}
Void SendEndMap_End(Integer _Count, CMap _Map) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}},
	"map": {{{Private_GetJson_Map(_Map)}}}
}""";
	XmlRpc::SendCallback(C_Callback_EndMap_End, [Response]);
}
Void SendEndMatch_Start(Integer _Count) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_EndMatch_Start, [Response]);
}
Void SendEndMatch_End(Integer _Count) {
	declare Response = """{
	"count": {{{dump(_Count)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_EndMatch_End, [Response]);
}
Void SendEndServer_Start() {
	declare Response = """{
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_EndServer_Start, [Response]);
}
Void SendEndServer_End() {
	declare Response = """{
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_EndServer_End, [Response]);
}
Void SendLoadingMap_Start(Boolean _Restarted) {
	declare Response = """{
	"restarted": {{{XmlRpc::JsonGetBoolean(_Restarted)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_LoadingMap_Start, [Response]);
}
Void SendLoadingMap_End(CMap _Map, Boolean _Restarted) {
	declare Response = """{
	"restarted": {{{XmlRpc::JsonGetBoolean(_Restarted)}}},
	"time": {{{XmlRpc::JsonGetInteger(Now)}}},
	"map": {{{Private_GetJson_Map(_Map)}}}
}""";
	XmlRpc::SendCallback(C_Callback_LoadingMap_End, [Response]);
}
Void SendUnloadingMap_Start(CMap _Map) {
	declare Response = """{
	"time": {{{XmlRpc::JsonGetInteger(Now)}}},
	"map": {{{Private_GetJson_Map(_Map)}}}
}""";
	XmlRpc::SendCallback(C_Callback_UnloadingMap_Start, [Response]);
}
Void SendUnloadingMap_End() {
	declare Response = """{
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_UnloadingMap_End, [Response]);
}
Void SendPodium_Start() {
	declare Response = """{
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_Podium_Start, [Response]);
}
Void SendPodium_End() {
	declare Response = """{
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_Podium_End, [Response]);
}
Void SendChannelProgression_Start() {
	declare Response = """{
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_ChannelProgression_Start, [Response]);
}
Void SendChannelProgression_End() {
	declare Response = """{
	"time": {{{XmlRpc::JsonGetInteger(Now)}}}
}""";
	XmlRpc::SendCallback(C_Callback_ChannelProgression_End, [Response]);
}

// ---------------------------------- //
/** Function to call at each yield
 *	to update the library
 */
Void Yield() {
	foreach (Event in XmlRpc.PendingEvents) {
		if (Event.Type == CXmlRpcEvent::EType::CallbackArray) {
			switch (Event.ParamArray1) {
				case C_Method_Set_EnableCallbacks: {
					declare Enabled = "";
					if (Event.ParamArray2.existskey(0)) Enabled = Event.ParamArray2[0];
					if (Enabled == "" || TL::ToLowerCase(Enabled) == "false") {
						XmlRpc::Disable();
					} else {
						XmlRpc::Enable();
					}
				}
				case C_Method_Get_CallbacksList: {
					declare ResponseId = "";
					if (Event.ParamArray2.existskey(0)) ResponseId = Event.ParamArray2[0];
					SendCallbacksList(ResponseId);
				}
				case C_Method_Get_CallbacksList_Enabled: {
					declare ResponseId = "";
					if (Event.ParamArray2.existskey(0)) ResponseId = Event.ParamArray2[0];
					SendEnabledCallbacksList(ResponseId);
				}
				case C_Method_Get_CallbacksList_Disabled: {
					declare ResponseId = "";
					if (Event.ParamArray2.existskey(0)) ResponseId = Event.ParamArray2[0];
					SendDisabledCallbacksList(ResponseId);
				}
				case C_Method_Set_BlockCallbacks: {
					foreach (Callback in Event.ParamArray2) {
						XmlRpc::DisableCallback(Callback);
					}
				}
				case C_Method_Set_UnblockCallbacks: {
					foreach (Callback in Event.ParamArray2) {
						XmlRpc::EnableCallback(Callback);
					}
				}
				case C_Method_Get_CallbackHelp: {
					declare CallbackName = "";
					declare ResponseId = "";
					if (Event.ParamArray2.existskey(0)) CallbackName = Event.ParamArray2[0];
					if (Event.ParamArray2.existskey(1)) ResponseId = Event.ParamArray2[1];
					SendCallbackHelp(CallbackName, ResponseId);
				}
				case C_Method_Get_MethodsList: {
					declare ResponseId = "";
					if (Event.ParamArray2.existskey(0)) ResponseId = Event.ParamArray2[0];
					SendMethodsList(ResponseId);
				}
				case C_Method_Get_MethodHelp: {
					declare MethodName = "";
					declare ResponseId = "";
					if (Event.ParamArray2.existskey(0)) MethodName = Event.ParamArray2[0];
					if (Event.ParamArray2.existskey(1)) ResponseId = Event.ParamArray2[1];
					SendMethodHelp(MethodName, ResponseId);
				}
				case C_Method_Get_Documentation: {
					declare ResponseId = "";
					if (Event.ParamArray2.existskey(0)) ResponseId = Event.ParamArray2[0];
					SendDocumentation(ResponseId);
				}
				case C_Method_Set_ApiVersion: {
					declare ApiVersion = "";
					if (Event.ParamArray2.existskey(0)) ApiVersion = Event.ParamArray2[0];
					XmlRpc::SetApiVersion(ApiVersion);
				}
				case C_Method_Get_ApiVersion: {
					declare ResponseId = "";
					if (Event.ParamArray2.existskey(0)) ResponseId = Event.ParamArray2[0];
					SendApiVersion(ResponseId);
				}
				case C_Method_Get_AllApiVersions: {
					declare ResponseId = "";
					if (Event.ParamArray2.existskey(0)) ResponseId = Event.ParamArray2[0];
					SendAllApiVersions(ResponseId);
				}
				case C_Method_Get_UseTeams: {
					declare ResponseId = "";
					if (Event.ParamArray2.existskey(0)) ResponseId = Event.ParamArray2[0];
					SendUseTeams(ResponseId);
				}
				case WarmUp::C_Method_WarmUp_GetStatus: {
					declare ResponseId = "";
					if (Event.ParamArray2.existskey(0)) ResponseId = Event.ParamArray2[0];
					WarmUp::SendStatusCallback(ResponseId, WarmUp::IsLoaded(), WarmUp::IsActive());
				}
				case C_Method_Set_AltScoresTable: {
					declare Login = "";
					if (Event.ParamArray2.existskey(0)) Login = Event.ParamArray2[0];
					
					declare Visible = True;
					declare TmpVisible = "";
					if (Event.ParamArray2.existskey(1)) TmpVisible = Event.ParamArray2[1];
					if (TmpVisible == "" || TL::ToLowerCase(TmpVisible) == "false") {
						Visible = False;
					} else {
						Visible = True;
					}
					
					if (Login != "") {
						foreach (Player in AllPlayers) {
							if (Player.User.Login == Login) {
								declare UI <=> UIManager.GetUI(Player);
								if (UI != Null) {
									UI.AltMenuNoDefaultScores = !Visible;
									UI.AltMenuNoCustomScores = !Visible;
								}
								break;
							}
						}
					}
				}
			}
		}
	}
}

// ---------------------------------- //
/// Unload the library
Void Unload() {
	// Unregister callbacks
	XmlRpc::UnregisterCallback(C_Callback_CallbacksList);
	XmlRpc::UnregisterCallback(C_Callback_CallbacksList_Enabled);
	XmlRpc::UnregisterCallback(C_Callback_CallbacksList_Disabled);
	XmlRpc::UnregisterCallback(C_Callback_CallbackHelp);
	XmlRpc::UnregisterCallback(C_Callback_MethodsList);
	XmlRpc::UnregisterCallback(C_Callback_MethodHelp);
	XmlRpc::UnregisterCallback(C_Callback_Documentation);
	XmlRpc::UnregisterCallback(C_Callback_ApiVersion);
	XmlRpc::UnregisterCallback(C_Callback_AllApiVersions);
	XmlRpc::UnregisterCallback(C_Callback_StartServer_Start);
	XmlRpc::UnregisterCallback(C_Callback_StartServer_End);
	XmlRpc::UnregisterCallback(C_Callback_StartMatch_Start);
	XmlRpc::UnregisterCallback(C_Callback_StartMatch_End);
	XmlRpc::UnregisterCallback(C_Callback_StartMap_Start);
	XmlRpc::UnregisterCallback(C_Callback_StartMap_End);
	XmlRpc::UnregisterCallback(C_Callback_StartRound_Start);
	XmlRpc::UnregisterCallback(C_Callback_StartRound_End);
	XmlRpc::UnregisterCallback(C_Callback_StartTurn_Start);
	XmlRpc::UnregisterCallback(C_Callback_StartTurn_End);
	XmlRpc::UnregisterCallback(C_Callback_StartPlayLoop);
	XmlRpc::UnregisterCallback(C_Callback_EndPlayLoop);
	XmlRpc::UnregisterCallback(C_Callback_EndTurn_Start);
	XmlRpc::UnregisterCallback(C_Callback_EndTurn_End);
	XmlRpc::UnregisterCallback(C_Callback_EndRound_Start);
	XmlRpc::UnregisterCallback(C_Callback_EndRound_End);
	XmlRpc::UnregisterCallback(C_Callback_EndMap_Start);
	XmlRpc::UnregisterCallback(C_Callback_EndMap_End);
	XmlRpc::UnregisterCallback(C_Callback_EndMatch_Start);
	XmlRpc::UnregisterCallback(C_Callback_EndMatch_End);
	XmlRpc::UnregisterCallback(C_Callback_EndServer_Start);
	XmlRpc::UnregisterCallback(C_Callback_EndServer_End);
	XmlRpc::UnregisterCallback(C_Callback_LoadingMap_Start);
	XmlRpc::UnregisterCallback(C_Callback_LoadingMap_End);
	XmlRpc::UnregisterCallback(C_Callback_UnloadingMap_Start);
	XmlRpc::UnregisterCallback(C_Callback_UnloadingMap_End);
	XmlRpc::UnregisterCallback(C_Callback_Podium_Start);
	XmlRpc::UnregisterCallback(C_Callback_Podium_End);
	XmlRpc::UnregisterCallback(C_Callback_ChannelProgression_Start);
	XmlRpc::UnregisterCallback(C_Callback_ChannelProgression_End);
	XmlRpc::UnregisterCallback(C_Callback_UseTeams);
	
	// Unregister methods
	XmlRpc::UnregisterMethod(C_Method_Set_EnableCallbacks);
	XmlRpc::UnregisterMethod(C_Method_Get_CallbacksList);
	XmlRpc::UnregisterMethod(C_Method_Get_CallbacksList_Enabled);
	XmlRpc::UnregisterMethod(C_Method_Get_CallbacksList_Disabled);
	XmlRpc::UnregisterMethod(C_Method_Set_BlockCallbacks);
	XmlRpc::UnregisterMethod(C_Method_Set_UnblockCallbacks);
	XmlRpc::UnregisterMethod(C_Method_Get_CallbackHelp);
	XmlRpc::UnregisterMethod(C_Method_Get_MethodsList);
	XmlRpc::UnregisterMethod(C_Method_Get_MethodHelp);
	XmlRpc::UnregisterMethod(C_Method_Get_Documentation);
	XmlRpc::UnregisterMethod(C_Method_Set_ApiVersion);
	XmlRpc::UnregisterMethod(C_Method_Get_ApiVersion);
	XmlRpc::UnregisterMethod(C_Method_Get_AllApiVersions);
	XmlRpc::UnregisterMethod(C_Method_Get_UseTeams);
	XmlRpc::UnregisterMethod(C_Method_Set_AltScoresTable);
	
	WarmUp::UnregisterBaseXmlRpc();
}

// ---------------------------------- //
/// Load the library
Void Load() {
	Unload();
	
	// Register callbacks
	XmlRpc::RegisterCallback(C_Callback_CallbacksList, """
* Name: {{{C_Callback_CallbacksList}}}
* Type: CallbackArray
* Description: A list with the names of all registered callbacks.
* Data:
	- Version >=2.0.0:
	```
	[
		{
			"responseid": "xyz", //< Facultative id passed by a script event  
			"callbacks": ["Callback1", "Callback2", "Callback3", ..., "CallbackN"] //< List of callbacks names  
		}
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_CallbacksList_Enabled, """
* Name: {{{C_Callback_CallbacksList_Enabled}}}
* Type: CallbackArray
* Description: A list with the names of all enabled callbacks.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"responseid": "xyz", //< Facultative id passed by a script event
			"callbacks": ["Callback1", "Callback2", "Callback3", ..., "CallbackN"] //< List of callbacks names
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_CallbacksList_Disabled, """
* Name: {{{C_Callback_CallbacksList_Disabled}}}
* Type: CallbackArray
* Description: A list with the names of all disabled callbacks.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"responseid": "xyz", //< Facultative id passed by a script event
			"callbacks": ["Callback1", "Callback2", "Callback3", ..., "CallbackN"] //< List of callbacks names
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_CallbackHelp, """
* Name: {{{C_Callback_CallbackHelp}}}
* Type: CallbackArray
* Description: Description of a callback and its content. The array contains two items.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"responseid": "xyz", //< Facultative id passed by a script event
			"callback": "CallbackName", //< The name of the described callback
			"available": true, //< Is the callback available in this game mode?
			"disabled": false //< Is the callback blocked?
		}", 
		"Description of the callback" //< The description of the callback
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_MethodsList, """
* Name: {{{C_Callback_MethodsList}}}
* Type: CallbackArray
* Description: A list with the names of all registered methods.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"responseid": "xyz", //< Facultative id passed by a script event
			"methods": ["Method1", "Method2", "Method3", ..., "MethodN"] //< List of callbacks names
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_MethodHelp, """
* Name: {{{C_Callback_MethodHelp}}}
* Type: CallbackArray
* Description: Description of a method and its parameters. The array contains two items.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"responseid": "xyz", //< Facultative id passed by a script event
			"method": "MethodName", //< The name of the described method
			"available": true //< Is the method available in this game mode?
		}", 
		"Description of the method" //< The description of the method
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_Documentation, """
* Name: {{{C_Callback_Documentation}}}
* Type: CallbackArray
* Description: Documentation about the game mode xmlrpc methods and callbacks. The array contains two items.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"responseid": "xyz" //< Facultative id passed by a script event
		}", 
		"Documentation" //< The documentation
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_ApiVersion, """
* Name: {{{C_Callback_ApiVersion}}}
* Type: CallbackArray
* Description: Give the currently selected API version.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"responseid": "xyz", //< Facultative id passed by a script event
			"version": "1.2.3-beta.4.5.6+build789" //< The API version in semver format
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_AllApiVersions, """
* Name: {{{C_Callback_AllApiVersions}}}
* Type: CallbackArray
* Description: Give the latest and all available api versions.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"responseid": "xyz", //< Facultative id passed by a script event
			"latest": "1.2.3-beta.4.5.6+build789" //< The latest API version in semver format
			"versions": ["1.0.0", "1.0.1", "1.1.0", "1.2.3-beta.4.5.6+build789"] //< All available versions
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_StartServer_Start, """
* Name: {{{C_Callback_StartServer_Start}}}
* Type: CallbackArray
* Description: Callback sent when the "StartServer" section start.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"restarted": false, //< true if the script was restarted
			"mode": {
				"updated": true, //< true if the mode was changed
				"name": "TimeAttack" //< The name of the mode
			},
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_StartServer_End, """
* Name: {{{C_Callback_StartServer_End}}}
* Type: CallbackArray
* Description: Callback sent when the "StartServer" section end.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"restarted": false, //< true if the script was restarted
			"mode": {
				"updated": true, //< true if the mode was changed
				"name": "TimeAttack" //< The name of the mode
			},
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_StartMatch_Start, """
* Name: {{{C_Callback_StartMatch_Start}}}
* Type: CallbackArray
* Description: Callback sent when the "StartMatch" section start.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_StartMatch_End, """
* Name: {{{C_Callback_StartMatch_End}}}
* Type: CallbackArray
* Description: Callback sent when the "StartMatch" section end.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_StartMap_Start, """
* Name: {{{C_Callback_StartMap_Start}}}
* Type: CallbackArray
* Description: Callback sent when the "StartMap" section start.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"restarted": false, //< true if the map was restarted, false otherwise
			"time": 123450, //< Server time when the callback was sent
			"map": {{{Private_GetJsonDescription_Map()}}}
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_StartMap_End, """
* Name: {{{C_Callback_StartMap_End}}}
* Type: CallbackArray
* Description: Callback sent when the "StartMap" section end.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"restarted": false, //< true if the map was restarted, false otherwise
			"time": 123450, //< Server time when the callback was sent
			"map": {{{Private_GetJsonDescription_Map()}}}
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_StartRound_Start, """
* Name: {{{C_Callback_StartRound_Start}}}
* Type: CallbackArray
* Description: Callback sent when the "StartRound" section start.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_StartRound_End, """
* Name: {{{C_Callback_StartRound_End}}}
* Type: CallbackArray
* Description: Callback sent when the "StartRound" section end.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_StartTurn_Start, """
* Name: {{{C_Callback_StartTurn_Start}}}
* Type: CallbackArray
* Description: Callback sent when the "StartTurn" section start.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_StartTurn_End, """
* Name: {{{C_Callback_StartTurn_End}}}
* Type: CallbackArray
* Description: Callback sent when the "StartTurn" section end.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_StartPlayLoop, """
* Name: {{{C_Callback_StartPlayLoop}}}
* Type: CallbackArray
* Description: Callback sent when the "PlayLoop" section start.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_EndPlayLoop, """
* Name: {{{C_Callback_EndPlayLoop}}}
* Type: CallbackArray
* Description: Callback sent when the "PlayLoop" section end.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_EndTurn_Start, """
* Name: {{{C_Callback_EndTurn_Start}}}
* Type: CallbackArray
* Description: Callback sent when the "EndTurn" section start.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_EndTurn_End, """
* Name: {{{C_Callback_EndTurn_End}}}
* Type: CallbackArray
* Description: Callback sent when the "EndTurn" section end.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_EndRound_Start, """
* Name: {{{C_Callback_EndRound_Start}}}
* Type: CallbackArray
* Description: Callback sent when the "EndRound" section start.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_EndRound_End, """
* Name: {{{C_Callback_EndRound_End}}}
* Type: CallbackArray
* Description: Callback sent when the "EndRound" section end.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_EndMap_Start, """
* Name: {{{C_Callback_EndMap_Start}}}
* Type: CallbackArray
* Description: Callback sent when the "EndMap" section start.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450, //< Server time when the callback was sent
			"map": {{{Private_GetJsonDescription_Map()}}}
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_EndMap_End, """
* Name: {{{C_Callback_EndMap_End}}}
* Type: CallbackArray
* Description: Callback sent when the "EndMap" section end.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450, //< Server time when the callback was sent
			"map": {{{Private_GetJsonDescription_Map()}}}
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_EndMatch_Start, """
* Name: {{{C_Callback_EndMatch_Start}}}
* Type: CallbackArray
* Description: Callback sent when the "EndMatch" section start.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_EndMatch_End, """
* Name: {{{C_Callback_EndMatch_End}}}
* Type: CallbackArray
* Description: Callback sent when the "EndMatch" section end.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"count": 123, //< Each time this section is played, this number is incremented by one
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_EndServer_Start, """
* Name: {{{C_Callback_EndServer_Start}}}
* Type: CallbackArray
* Description: Callback sent when the "EndServer" section start.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_EndServer_End, """
* Name: {{{C_Callback_EndServer_End}}}
* Type: CallbackArray
* Description: Callback sent when the "EndServer" section end.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_LoadingMap_Start, """
* Name: {{{C_Callback_LoadingMap_Start}}}
* Type: CallbackArray
* Description: Callback sent when the server starts to load a map.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"restarted": false, //< true if the map was restarted, false otherwise
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_LoadingMap_End, """
* Name: {{{C_Callback_LoadingMap_End}}}
* Type: CallbackArray
* Description: Callback sent when the server finishes to load a map.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"restarted": false, //< true if the map was restarted, false otherwise
			"time": 123450, //< Server time when the callback was sent
			"map": {{{Private_GetJsonDescription_Map()}}}
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_UnloadingMap_Start, """
* Name: {{{C_Callback_UnloadingMap_Start}}}
* Type: CallbackArray
* Description: Callback sent when the server starts to unload a map.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"time": 123450, //< Server time when the callback was sent
			"map": {{{Private_GetJsonDescription_Map()}}}
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_UnloadingMap_End, """
* Name: {{{C_Callback_UnloadingMap_End}}}
* Type: CallbackArray
* Description: Callback sent when the server finishes to unload a map.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_Podium_Start, """
* Name: {{{C_Callback_Podium_Start}}}
* Type: CallbackArray
* Description: Callback sent when the podium sequence starts.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_Podium_End, """
* Name: {{{C_Callback_Podium_End}}}
* Type: CallbackArray
* Description: Callback sent when the podium sequence ends.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_ChannelProgression_Start, """
* Name: {{{C_Callback_ChannelProgression_Start}}}
* Type: CallbackArray
* Description: Callback sent when the channel progression sequence starts.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_ChannelProgression_End, """
* Name: {{{C_Callback_ChannelProgression_End}}}
* Type: CallbackArray
* Description: Callback sent when the channel progression sequence ends.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"time": 123450 //< Server time when the callback was sent
		}"
	]
	```
""");
	XmlRpc::RegisterCallback(C_Callback_UseTeams, """
* Name: {{{C_Callback_UseTeams}}}
* Type: CallbackArray
* Description: Tell if the game mode uses teams or not.
* Data:
	- Version >=2.0.0:
	```
	[
		"{
			"responseid": "xyz", //< Facultative id passed by a script event
			"teams": true //< true if the game mode uses teams, false otherwise
		}"
	]
	```
""");
	
	
	// Register methods
	XmlRpc::RegisterMethod(C_Method_Set_EnableCallbacks, """
* Name: {{{C_Method_Set_EnableCallbacks}}}
* Type: TriggerModeScriptEventArray
* Description: Enable or disable script callbacks.
* Data:
	- Version >=2.0.0:
	```
	[
		"true" //< "true" to enable callbacks, "false" to disable them.
	]
	```
""");
	XmlRpc::RegisterMethod(C_Method_Get_CallbacksList, """
* Name: {{{C_Method_Get_CallbacksList}}}
* Type: TriggerModeScriptEventArray
* Description: Request a list of all available callbacks. This method will trigger the "{{{C_Callback_CallbacksList}}}" callback.
* Data:
	- Version >=2.0.0:
	```
	[
		"responseid" //< Facultative id that will be passed to the "{{{C_Callback_CallbacksList}}}" callback.
	]
	```
""");
	XmlRpc::RegisterMethod(C_Method_Get_CallbacksList_Enabled, """
* Name: {{{C_Method_Get_CallbacksList_Enabled}}}
* Type: TriggerModeScriptEventArray
* Description: Request a list of all enabled callbacks. This method will trigger the "{{{C_Callback_CallbacksList_Enabled}}}" callback.
* Data:
	- Version >=2.0.0:
	```
	[
		"responseid" //< Facultative id that will be passed to the "{{{C_Callback_CallbacksList_Enabled}}}" callback.
	]
	```
""");
	XmlRpc::RegisterMethod(C_Method_Get_CallbacksList_Disabled, """
* Name: {{{C_Method_Get_CallbacksList_Disabled}}}
* Type: TriggerModeScriptEventArray
* Description: Request a list of all disabled callbacks. This method will trigger the "{{{C_Callback_CallbacksList_Disabled}}}" callback.
* Data:
	- Version >=2.0.0:
	```
	[
		"responseid" //< Facultative id that will be passed to the "{{{C_Callback_CallbacksList_Disabled}}}" callback.
	]
	```
""");
	XmlRpc::RegisterMethod(C_Method_Set_BlockCallbacks, """
* Name: {{{C_Method_Set_BlockCallbacks}}}
* Type: TriggerModeScriptEventArray
* Description: Block a callback and prevent it from being sent by the script.
* Data:
	- Version >=2.0.0:
	```
	[
		"CallbackName",  //< The name of the callback to block
		"CallbackNameN" //< You can pass as many callbacks as you want
	]
	```
""");
	XmlRpc::RegisterMethod(C_Method_Set_UnblockCallbacks, """
* Name: {{{C_Method_Set_UnblockCallbacks}}}
* Type: TriggerModeScriptEventArray
* Description: Unblock a blocked callback.
* Data:
	- Version >=2.0.0:
	```
	[
		"CallbackName", //< The name of the callback to unblock
		"CallbackNameN" //< You can pass as many callbacks as you want
	]
	```
""");
	XmlRpc::RegisterMethod(C_Method_Get_CallbackHelp, """
* Name: {{{C_Method_Get_CallbackHelp}}}
* Type: TriggerModeScriptEventArray
* Description: Request help about a callback. This method will trigger the "{{{C_Callback_CallbackHelp}}}" callback.
* Data:
	- Version >=2.0.0:
	```
	[
		"callbackname", //< Name of the callback to get help for
		"responseid" //< Facultative id that will be passed to the "{{{C_Callback_CallbackHelp}}}" callback.
	]
	```
""");
	XmlRpc::RegisterMethod(C_Method_Get_MethodsList, """
* Name: {{{C_Method_Get_MethodsList}}}
* Type: TriggerModeScriptEventArray
* Description: Request a list of all available methods. This method will trigger the "{{{C_Callback_MethodsList}}}" callback.
* Data:
	- Version >=2.0.0:
	```
	[
		"responseid" //< Facultative id that will be passed to the "{{{C_Callback_MethodsList}}}" callback.
	]
	```
""");
	XmlRpc::RegisterMethod(C_Method_Get_MethodHelp, """
* Name: {{{C_Method_Get_MethodHelp}}}
* Type: TriggerModeScriptEventArray
* Description: Request help about a method. This method will trigger the "{{{C_Callback_MethodHelp}}}" callback.
* Data:
	- Version >=2.0.0:
	```
	[
		"callbackname", //< Name of the method to get help for
		"responseid" //< Facultative id that will be passed to the "{{{C_Callback_MethodHelp}}}" callback.
	]
	```
""");
	XmlRpc::RegisterMethod(C_Method_Get_Documentation, """
* Name: {{{C_Method_Get_Documentation}}}
* Type: TriggerModeScriptEventArray
* Description: Request the current game mode xmlrpc callbacks and methods documentation. This method will trigger the "{{{C_Callback_Documentation}}}" callback.
* Data:
	- Version >=2.0.0:
	```
	[
		"responseid" //< Facultative id that will be passed to the "{{{C_Callback_Documentation}}}" callback.
	]
	```
""");
	XmlRpc::RegisterMethod(C_Method_Set_ApiVersion, """
* Name: {{{C_Method_Set_ApiVersion}}}
* Type: TriggerModeScriptEventArray
* Description: Select the version of the API to use.
* Data:
	- Version >=2.0.0:
	```
	[
		"1.2.3-beta.4.5.6+build789" //< The version to use in semver format
	]
	```
""");
	XmlRpc::RegisterMethod(C_Method_Get_ApiVersion, """
* Name: {{{C_Method_Get_ApiVersion}}}
* Type: TriggerModeScriptEventArray
* Description: Request the version of the API currently in use. This method will trigger the "{{{C_Callback_ApiVersion}}}" callback.
* Data:
	- Version >=2.0.0:
	```
	[
		"responseid" //< Facultative id that will be passed to the "{{{C_Callback_ApiVersion}}}" callback.
	]
	```
""");XmlRpc::RegisterMethod(C_Method_Get_AllApiVersions, """
* Name: {{{C_Method_Get_AllApiVersions}}}
* Type: TriggerModeScriptEventArray
* Description: Request all available versions of the API. This method will trigger the "{{{C_Callback_AllApiVersions}}}" callback.
* Data:
	- Version >=2.0.0:
	```
	[
		"responseid" //< Facultative id that will be passed to the "{{{C_Callback_AllApiVersions}}}" callback.
	]
	```
""");
	XmlRpc::RegisterMethod(C_Method_Get_UseTeams, """
* Name: {{{C_Method_Get_UseTeams}}}
* Type: TriggerModeScriptEventArray
* Description: Check if the game mode uses teams or not.
* Data:
	- Version >=2.0.0:
	```
	[
		"responseid" //< Facultative id that will be passed to the "{{{C_Callback_UseTeams}}}" callback.
	]
	```
""");
	XmlRpc::RegisterMethod(C_Method_Set_AltScoresTable, """
* Name: {{{C_Method_Set_AltScoresTable}}}
* Type: TriggerModeScriptEventArray
* Description: Enable or disable the scores table display with the alt key.
* Data:
	- Version >=2.0.0:
	```
	[
		"PlayerLogin", //< The login of the player to update
		"false" //< false to disable, true to enable
	]
	```
""");
	
	WarmUp::RegisterBaseXmlRpc();
}