Compare commits

..

4 Commits

Author SHA1 Message Date
Beu
81f062d54c add sleep when changing map 2023-09-08 19:56:43 +02:00
Beu
8f0bc2de59 manage when player join the server 2023-09-08 19:56:11 +02:00
Beu
3a9c12cd0e manage WR with a time 2023-09-08 19:55:45 +02:00
Beu
fad3a3dc8e add TriggerAction to open the UI 2023-09-08 19:02:44 +02:00

View File

@ -51,6 +51,7 @@
#Const C_MlId_LiveAltitude "ClimbTheMap_Altidude" #Const C_MlId_LiveAltitude "ClimbTheMap_Altidude"
#Const C_Callback_UpdatePBs "Trackmania.ClimbTheMap.UpdatePBs" #Const C_Callback_UpdatePBs "Trackmania.ClimbTheMap.UpdatePBs"
#Const C_Callback_RequestPB "Trackmania.ClimbTheMap.RequestPB"
#Const C_Method_SetPlayersPB "Trackmania.ClimbTheMap.SetPlayersPB" #Const C_Method_SetPlayersPB "Trackmania.ClimbTheMap.SetPlayersPB"
#Const C_Method_SetWR "Trackmania.ClimbTheMap.SetWR" #Const C_Method_SetWR "Trackmania.ClimbTheMap.SetWR"
@ -71,7 +72,7 @@ StateMgr::Load();
XmlRpc::RegisterCallback(C_Callback_UpdatePBs, """ XmlRpc::RegisterCallback(C_Callback_UpdatePBs, """
* Name: {{{C_Callback_UpdatePBs}}} * Name: {{{C_Callback_UpdatePBs}}}
* Type: CallbackArray * Type: CallbackArray
* Description: * Description: List of the new PB
* Data: * Data:
- Version >=2.0.0: - Version >=2.0.0:
``` ```
@ -83,11 +84,23 @@ XmlRpc::RegisterCallback(C_Callback_UpdatePBs, """
] ]
``` ```
"""); """);
XmlRpc::RegisterCallback(C_Callback_RequestPB, """
* Name: {{{C_Callback_RequestPB}}}
* Type: CallbackArray
* Description: Request PB to be sure that the Player is initialized by the ManiaScript
* Data:
- Version >=2.0.0:
```
[
"Vvjdn4WBRE6irR6Oie7RpA"
]
```
""");
XmlRpc::RegisterMethod(C_Method_SetPlayersPB, """ XmlRpc::RegisterMethod(C_Method_SetPlayersPB, """
* Name: {{{C_Method_SetPlayersPB}}} * Name: {{{C_Method_SetPlayersPB}}}
* Type: TriggerModeScriptEventArray * Type: TriggerModeScriptEventArray
* Description: Request the current properties of the AFK libraries. * Description: List of the new PB
* Data: * Data:
- Version >=3.5.0: - Version >=3.5.0:
``` ```
@ -102,7 +115,7 @@ XmlRpc::RegisterMethod(C_Method_SetPlayersPB, """
XmlRpc::RegisterMethod(C_Method_SetWR, """ XmlRpc::RegisterMethod(C_Method_SetWR, """
* Name: {{{C_Method_SetWR}}} * Name: {{{C_Method_SetWR}}}
* Type: TriggerModeScriptEventArray * Type: TriggerModeScriptEventArray
* Description: Request the current properties of the AFK libraries. * Description: WR
* Data: * Data:
- Version >=3.5.0: - Version >=3.5.0:
``` ```
@ -118,6 +131,7 @@ XmlRpc::RegisterMethod(C_Method_SetWR, """
*** ***
StateMgr::Unload(); StateMgr::Unload();
XmlRpc::UnregisterCallback(C_Callback_UpdatePBs); XmlRpc::UnregisterCallback(C_Callback_UpdatePBs);
XmlRpc::UnregisterCallback(C_Callback_RequestPB);
XmlRpc::UnregisterMethod(C_Method_SetPlayersPB); XmlRpc::UnregisterMethod(C_Method_SetPlayersPB);
XmlRpc::UnregisterMethod(C_Method_SetWR); XmlRpc::UnregisterMethod(C_Method_SetWR);
*** ***
@ -166,6 +180,7 @@ foreach (Event in PendingEvents) {
case CSmModeEvent::EType::OnPlayerAdded: { case CSmModeEvent::EType::OnPlayerAdded: {
StateMgr::InitializePlayer(Event.Player); StateMgr::InitializePlayer(Event.Player);
CarRank::InitializePlayer(Event.Player); CarRank::InitializePlayer(Event.Player);
XmlRpc::SendCallback(C_Callback_RequestPB, [Event.Player.User.Login]);
} }
} }
} }
@ -190,19 +205,22 @@ foreach (Event in XmlRpc.PendingEvents) {
declare netwrite Integer Net_ClimbTheMap_AltitudePerName_Update for Teams[0]; declare netwrite Integer Net_ClimbTheMap_AltitudePerName_Update for Teams[0];
Net_ClimbTheMap_AltitudePerName_Update += 1; Net_ClimbTheMap_AltitudePerName_Update += 1;
} else if (Event.ParamArray1 == C_Method_SetWR) { } else if (Event.ParamArray1 == C_Method_SetWR) {
if (Event.ParamArray2.count < 2) continue; if (Event.ParamArray2.count < 3) continue;
declare netwrite Int2 Net_ClimbTheMap_AltitudeOfWaypoints for Teams[0]; declare netwrite Int2 Net_ClimbTheMap_AltitudeOfWaypoints for Teams[0];
declare Integer Altitude = ML::Min(TL::ToInteger(Event.ParamArray2[1]), Net_ClimbTheMap_AltitudeOfWaypoints.Y); declare Integer Altitude = ML::Min(TL::ToInteger(Event.ParamArray2[1]), Net_ClimbTheMap_AltitudeOfWaypoints.Y);
declare Integer Time = TL::ToInteger(Event.ParamArray2[2]);
declare netwrite Integer Net_ClimbTheMap_TimeOfWR for Teams[0];
declare netwrite Integer Net_ClimbTheMap_AltitudeOfWR for Teams[0]; declare netwrite Integer Net_ClimbTheMap_AltitudeOfWR for Teams[0];
if (Net_ClimbTheMap_AltitudeOfWR < Altitude) {
if ((Time > 0 && Net_ClimbTheMap_TimeOfWR <= 0 || Net_ClimbTheMap_TimeOfWR > Time) ||
(Time <= 0 && Net_ClimbTheMap_AltitudeOfWR < Altitude)) {
Net_ClimbTheMap_TimeOfWR = Time;
Net_ClimbTheMap_AltitudeOfWR = Altitude; Net_ClimbTheMap_AltitudeOfWR = Altitude;
declare netwrite Text Net_ClimbTheMap_NamefWR for Teams[0]; declare netwrite Text Net_ClimbTheMap_NamefWR for Teams[0];
Net_ClimbTheMap_NamefWR = Event.ParamArray2[0]; Net_ClimbTheMap_NamefWR = Event.ParamArray2[0];
declare netwrite Integer Net_ClimbTheMap_AltitudePerName_Update for Teams[0]; declare netwrite Integer Net_ClimbTheMap_AltitudePerName_Update for Teams[0];
Net_ClimbTheMap_AltitudePerName_Update += 1; Net_ClimbTheMap_AltitudePerName_Update += 1;
} }
} }
} }
} }
@ -240,8 +258,8 @@ declare Integer Map_NextUpdate;
declare Integer[Text] Map_XmlRpc_AltitudePerLogin_Queue; declare Integer[Text] Map_XmlRpc_AltitudePerLogin_Queue;
declare Integer Map_XmlRpc_Queue_NextUpdate; declare Integer Map_XmlRpc_Queue_NextUpdate;
declare netwrite Integer Net_ClimbTheMap_TimeOfWR for Teams[0];
declare netwrite Integer Net_ClimbTheMap_AltitudeOfWR for Teams[0]; declare netwrite Integer Net_ClimbTheMap_AltitudeOfWR for Teams[0];
declare netwrite Text Net_ClimbTheMap_NamefWR for Teams[0]; declare netwrite Text Net_ClimbTheMap_NamefWR for Teams[0];
declare netwrite Integer[Text] Net_ClimbTheMap_AltitudePerName for Teams[0]; declare netwrite Integer[Text] Net_ClimbTheMap_AltitudePerName for Teams[0];
@ -276,6 +294,7 @@ if (Start == Null && Finishes.count == 0) {
Net_ClimbTheMap_UpdateFrequency = S_AltitudeUpdateFrequency; Net_ClimbTheMap_UpdateFrequency = S_AltitudeUpdateFrequency;
Net_ClimbTheMap_TimeOfWR = 0;
Net_ClimbTheMap_AltitudeOfWR = 0; Net_ClimbTheMap_AltitudeOfWR = 0;
Net_ClimbTheMap_NamefWR = ""; Net_ClimbTheMap_NamefWR = "";
Net_ClimbTheMap_AltitudePerName = []; Net_ClimbTheMap_AltitudePerName = [];
@ -314,6 +333,15 @@ foreach (Event in RacePendingEvents) {
Scores::UpdatePlayerBestRaceIfBetter(Event.Player); Scores::UpdatePlayerBestRaceIfBetter(Event.Player);
Scores::UpdatePlayerBestLapIfBetter(Event.Player); Scores::UpdatePlayerBestLapIfBetter(Event.Player);
Scores::UpdatePlayerPrevRace(Event.Player); Scores::UpdatePlayerPrevRace(Event.Player);
declare Integer Time = Event.Player.RaceWaypointTimes[Event.Player.RaceWaypointTimes.count - 1];
if (Net_ClimbTheMap_TimeOfWR <= 0 || Net_ClimbTheMap_TimeOfWR > Time) {
Net_ClimbTheMap_TimeOfWR = Time;
declare netwrite Int2 Net_ClimbTheMap_AltitudeOfWaypoints for Teams[0];
Net_ClimbTheMap_AltitudeOfWR = Net_ClimbTheMap_AltitudeOfWaypoints.Y;
Net_ClimbTheMap_NamefWR = Event.Player.User.Name;
}
} }
CarRank::ThrottleUpdate(CarRank::C_SortCriteria_BestRace); CarRank::ThrottleUpdate(CarRank::C_SortCriteria_BestRace);
} }
@ -331,7 +359,7 @@ if (Now > Map_NextUpdate) {
declare Integer Altitude = ML::FloorInteger(Player.Position.Y); declare Integer Altitude = ML::FloorInteger(Player.Position.Y);
if (Net_ClimbTheMap_AltitudeOfWR < Altitude) { if (Net_ClimbTheMap_TimeOfWR <= 0 && Net_ClimbTheMap_AltitudeOfWR < Altitude) {
declare netwrite Int2 Net_ClimbTheMap_AltitudeOfWaypoints for Teams[0]; declare netwrite Int2 Net_ClimbTheMap_AltitudeOfWaypoints for Teams[0];
Net_ClimbTheMap_AltitudeOfWR = ML::Min(Altitude, Net_ClimbTheMap_AltitudeOfWaypoints.Y); Net_ClimbTheMap_AltitudeOfWR = ML::Min(Altitude, Net_ClimbTheMap_AltitudeOfWaypoints.Y);
Net_ClimbTheMap_NamefWR = Player.User.Name; Net_ClimbTheMap_NamefWR = Player.User.Name;
@ -405,6 +433,7 @@ Race::StopSkipOutroAll();
ModeUtils::PlaySound(CUIConfig::EUISound::EndRound, 0); ModeUtils::PlaySound(CUIConfig::EUISound::EndRound, 0);
UIModules_BigMessage::SetMessage("Changing Map"); UIModules_BigMessage::SetMessage("Changing Map");
MB_Sleep(5000);
*** ***
***Match_AfterPodiumSequence*** ***Match_AfterPodiumSequence***
@ -451,6 +480,7 @@ Void SetMl() {
<frameinstance modelid="framemodel-dot" pos="0 120"/> <frameinstance modelid="framemodel-dot" pos="0 120"/>
</frame> </frame>
</frame> </frame>
<quad id="quad-invisiblebutton" pos="-10 10" size="45 140" scriptevents="1"/>
<frame pos="2 -120"> <frame pos="2 -120">
<frameinstance id="frame-marker-wr" modelid="framemodel-marker" z-index="-1" hidden="1"/> <frameinstance id="frame-marker-wr" modelid="framemodel-marker" z-index="-1" hidden="1"/>
<frameinstance id="frame-marker-pb" modelid="framemodel-marker" z-index="-2" hidden="1"/> <frameinstance id="frame-marker-pb" modelid="framemodel-marker" z-index="-2" hidden="1"/>
@ -631,6 +661,13 @@ main() {
I += 1; I += 1;
} }
} }
foreach (Event in PendingEvents) {
if (Event.Type == CMlScriptEvent::Type::MouseClick && Event.ControlId == "quad-invisiblebutton") {
TriggerPageAction("Trackmania.ClimbTheMap.ShowAltitudeRecords");
}
}
Last_PageWasVisible = True; Last_PageWasVisible = True;
} else { } else {
Last_PageWasVisible = False; Last_PageWasVisible = False;