Compare commits
3 Commits
2b824e5e41
...
bad8dd4f58
Author | SHA1 | Date | |
---|---|---|---|
bad8dd4f58 | |||
f5c2ca7aa6 | |||
60b7158ab8 |
@ -8,7 +8,7 @@
|
|||||||
#Extends "Libs/Nadeo/TMNext/TrackMania/Modes/TMNextRoundsBase.Script.txt"
|
#Extends "Libs/Nadeo/TMNext/TrackMania/Modes/TMNextRoundsBase.Script.txt"
|
||||||
|
|
||||||
#Const CompatibleMapTypes "TrackMania\\TM_Race,TM_Race"
|
#Const CompatibleMapTypes "TrackMania\\TM_Race,TM_Race"
|
||||||
#Const Version "2022-06-11"
|
#Const Version "2023-08-08"
|
||||||
#Const ScriptName "Modes/TM2020-Gamemodes/TM_ReverseCup.Script.txt"
|
#Const ScriptName "Modes/TM2020-Gamemodes/TM_ReverseCup.Script.txt"
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
|
||||||
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#Setting S_NbOfWinners 1 as _("Number of winners")
|
#Setting S_NbOfWinners 1 as _("Number of winners")
|
||||||
#Setting S_FinishTimeout -1 as _("Finish timeout")
|
#Setting S_FinishTimeout -1 as _("Finish timeout")
|
||||||
|
#Setting S_ComplexPointsRepartition "" as "JSON of PointsRepartition depending for the number of the Players Alive" // Example: {"3": [3, 6, 10], "4,5": [1, 3, 6,10]}
|
||||||
#Setting S_PointsRepartition "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20"
|
#Setting S_PointsRepartition "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20"
|
||||||
#Setting S_RoundsPerMap 5 as _("Number of rounds per map") ///< Number of round to play on one map before going to the next one
|
#Setting S_RoundsPerMap 5 as _("Number of rounds per map") ///< Number of round to play on one map before going to the next one
|
||||||
|
|
||||||
@ -159,12 +160,12 @@ foreach (Event in PendingEvents) {
|
|||||||
if (Server_MatchInfo.RegistrationClosed && !Server_MatchInfo.Participants.exists(Event.Player.User.Login)) {
|
if (Server_MatchInfo.RegistrationClosed && !Server_MatchInfo.Participants.exists(Event.Player.User.Login)) {
|
||||||
Scores::SetPlayerMatchPoints(Event.Player.Score, C_Points_Spectator);
|
Scores::SetPlayerMatchPoints(Event.Player.Score, C_Points_Spectator);
|
||||||
// Equivalent of getCustomPoints:
|
// Equivalent of getCustomPoints:
|
||||||
declare netwrite Text[][Text] Net_TMxSM_ScoresTable_CustomPoints for Teams[0];
|
declare netwrite Text[][Text] Net_TMxSM_ScoresTable_CustomPoints for Teams[0] = [];
|
||||||
Net_TMxSM_ScoresTable_CustomPoints[Event.Player.User.WebServicesUserId] = [C_Text_Spectator, C_Color_Spectator];
|
Net_TMxSM_ScoresTable_CustomPoints[Event.Player.User.WebServicesUserId] = [C_Text_Spectator, C_Color_Spectator];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare netwrite Integer Net_ReverseCup_LiveRanking_Update for Teams[0];
|
declare netwrite Integer Net_ReverseCup_LiveRanking_Update for Teams[0] = 0;
|
||||||
Net_ReverseCup_LiveRanking_Update += 1;
|
Net_ReverseCup_LiveRanking_Update += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,6 +178,7 @@ declare Integer Server_PointsLimit;
|
|||||||
declare Integer Server_RoundsPerMap;
|
declare Integer Server_RoundsPerMap;
|
||||||
declare Integer Server_NbOfWinners;
|
declare Integer Server_NbOfWinners;
|
||||||
declare Integer Server_DNF_LossPoints;
|
declare Integer Server_DNF_LossPoints;
|
||||||
|
declare Text Server_ComplexPointsRepartition;
|
||||||
***
|
***
|
||||||
|
|
||||||
***Match_StartServer***
|
***Match_StartServer***
|
||||||
@ -203,12 +205,14 @@ Server_PointsLimit = S_PointsStartup;
|
|||||||
Server_RoundsPerMap = S_RoundsPerMap;
|
Server_RoundsPerMap = S_RoundsPerMap;
|
||||||
Server_NbOfWinners = S_NbOfWinners;
|
Server_NbOfWinners = S_NbOfWinners;
|
||||||
Server_DNF_LossPoints = S_DNF_LossPoints;
|
Server_DNF_LossPoints = S_DNF_LossPoints;
|
||||||
|
Server_ComplexPointsRepartition = S_ComplexPointsRepartition;
|
||||||
***
|
***
|
||||||
|
|
||||||
***Match_StartMatch***
|
***Match_StartMatch***
|
||||||
***
|
***
|
||||||
UIModules_ScoresTable::SetCustomPoints([]);
|
UIModules_ScoresTable::SetCustomPoints([]);
|
||||||
|
|
||||||
|
UpdateComplexPointsRepartition(S_ComplexPointsRepartition);
|
||||||
declare K_MatchInfo Server_MatchInfo for This = K_MatchInfo {};
|
declare K_MatchInfo Server_MatchInfo for This = K_MatchInfo {};
|
||||||
Server_MatchInfo = K_MatchInfo {};
|
Server_MatchInfo = K_MatchInfo {};
|
||||||
***
|
***
|
||||||
@ -292,7 +296,7 @@ MB_WarmUp(S_WarmUpNb, S_WarmUpDuration * 1000, S_WarmUpTimeout * 1000);
|
|||||||
|
|
||||||
***Match_StartWarmUp***
|
***Match_StartWarmUp***
|
||||||
***
|
***
|
||||||
declare netwrite Integer Net_ReverseCup_LiveRanking_Update for Teams[0];
|
declare netwrite Integer Net_ReverseCup_LiveRanking_Update for Teams[0] = 0;
|
||||||
Net_ReverseCup_LiveRanking_Update += 1;
|
Net_ReverseCup_LiveRanking_Update += 1;
|
||||||
***
|
***
|
||||||
|
|
||||||
@ -321,15 +325,30 @@ if (S_EnableCollisions) {
|
|||||||
|
|
||||||
|
|
||||||
ModeUtils::PlaySound(CUIConfig::EUISound::PhaseChange, 0);
|
ModeUtils::PlaySound(CUIConfig::EUISound::PhaseChange, 0);
|
||||||
UIModules_BigMessage::SetMessage(_("Rounds : ") ^ TL::ToText(G_NbOfValidRounds + 1) ^ " / " ^ TL::ToText(S_RoundsPerMap));
|
if (S_RoundsPerMap > 0) {
|
||||||
|
UIModules_BigMessage::SetMessage(_("Round: ") ^ TL::ToText(G_NbOfValidRounds + 1) ^ " / " ^ TL::ToText(S_RoundsPerMap));
|
||||||
|
} else {
|
||||||
|
UIModules_BigMessage::SetMessage(_("Round: ") ^ TL::ToText(G_NbOfValidRounds + 1));
|
||||||
|
}
|
||||||
MB_Sleep(3000);
|
MB_Sleep(3000);
|
||||||
UIModules_BigMessage::SetMessage("");
|
UIModules_BigMessage::SetMessage("");
|
||||||
|
|
||||||
|
declare Integer Round_NbPlayersInThisRound = 0;
|
||||||
***
|
***
|
||||||
|
|
||||||
***Match_StartRound***
|
***Match_StartRound***
|
||||||
***
|
***
|
||||||
UpdateScoresTableFooter(S_PointsStartup, S_RoundsPerMap, G_NbOfValidRounds, S_NbOfWinners);
|
UpdateScoresTableFooter(S_PointsStartup, S_RoundsPerMap, G_NbOfValidRounds, S_NbOfWinners);
|
||||||
CheckRoundBeforePlay();
|
|
||||||
|
declare K_MatchInfo Server_MatchInfo for This = K_MatchInfo {};
|
||||||
|
foreach (Score in Scores) {
|
||||||
|
if (Score.User == Null) continue;
|
||||||
|
if (Scores::GetPlayerMatchPoints(Score) < C_Points_LastChance) continue;
|
||||||
|
if (!Server_MatchInfo.Participants.exists(Score.User.Login)) continue;
|
||||||
|
Round_NbPlayersInThisRound += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckRoundBeforePlay(Round_NbPlayersInThisRound);
|
||||||
UpdateDNFLossPoints(Server_DNF_LossPoints);
|
UpdateDNFLossPoints(Server_DNF_LossPoints);
|
||||||
StateMgr::ForcePlayersStates([CupCommon_Const::C_State_Playing]);
|
StateMgr::ForcePlayersStates([CupCommon_Const::C_State_Playing]);
|
||||||
|
|
||||||
@ -356,7 +375,7 @@ CarRank::ThrottleUpdate(CarRank::C_SortCriteria_CurrentRace);
|
|||||||
***Match_PlayLoop***
|
***Match_PlayLoop***
|
||||||
***
|
***
|
||||||
// Manage race events
|
// Manage race events
|
||||||
declare RacePendingEvents = Race::GetPendingEvents();
|
declare Events::K_RaceEvent[] RacePendingEvents = Race::GetPendingEvents();
|
||||||
foreach (Event in RacePendingEvents) {
|
foreach (Event in RacePendingEvents) {
|
||||||
Race::ValidEvent(Event);
|
Race::ValidEvent(Event);
|
||||||
|
|
||||||
@ -365,10 +384,10 @@ foreach (Event in RacePendingEvents) {
|
|||||||
CarRank::ThrottleUpdate(CarRank::C_SortCriteria_CurrentRace);
|
CarRank::ThrottleUpdate(CarRank::C_SortCriteria_CurrentRace);
|
||||||
if (Event.Player != Null) {
|
if (Event.Player != Null) {
|
||||||
if (Event.IsEndRace) {
|
if (Event.IsEndRace) {
|
||||||
declare BetterRace = Scores::UpdatePlayerBestRaceIfBetter(Event.Player);
|
Scores::UpdatePlayerBestRaceIfBetter(Event.Player);
|
||||||
declare BetterLap = Scores::UpdatePlayerBestLapIfBetter(Event.Player);
|
Scores::UpdatePlayerBestLapIfBetter(Event.Player);
|
||||||
Scores::UpdatePlayerPrevRace(Event.Player);
|
Scores::UpdatePlayerPrevRace(Event.Player);
|
||||||
ComputeLatestRaceScores();
|
ComputeLatestRaceScores(Round_NbPlayersInThisRound);
|
||||||
|
|
||||||
Race::SortScores(Race::C_Sort_TotalPoints);
|
Race::SortScores(Race::C_Sort_TotalPoints);
|
||||||
|
|
||||||
@ -379,7 +398,7 @@ foreach (Event in RacePendingEvents) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Event.IsEndLap) {
|
if (Event.IsEndLap) {
|
||||||
declare Better = Scores::UpdatePlayerBestLapIfBetter(Event.Player);
|
Scores::UpdatePlayerBestLapIfBetter(Event.Player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -408,6 +427,11 @@ if (Server_PointsLimit != S_PointsStartup ||
|
|||||||
UpdateScoresTableFooter(S_PointsStartup, S_RoundsPerMap, G_NbOfValidRounds, S_NbOfWinners);
|
UpdateScoresTableFooter(S_PointsStartup, S_RoundsPerMap, G_NbOfValidRounds, S_NbOfWinners);
|
||||||
UpdateDNFLossPoints(Server_DNF_LossPoints);
|
UpdateDNFLossPoints(Server_DNF_LossPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Server_ComplexPointsRepartition != S_ComplexPointsRepartition) {
|
||||||
|
Server_ComplexPointsRepartition = S_ComplexPointsRepartition;
|
||||||
|
UpdateComplexPointsRepartition(Server_ComplexPointsRepartition);
|
||||||
|
}
|
||||||
***
|
***
|
||||||
|
|
||||||
***Match_EndRound***
|
***Match_EndRound***
|
||||||
@ -435,7 +459,7 @@ if (Round_ForceEndRound || Round_SkipPauseRound || Round_Skipped) {
|
|||||||
MB_Sleep(3000);
|
MB_Sleep(3000);
|
||||||
} else {
|
} else {
|
||||||
// Get the last round points
|
// Get the last round points
|
||||||
ComputeLatestRaceScores();
|
ComputeLatestRaceScores(Round_NbPlayersInThisRound);
|
||||||
+++Cup_EndRound_BeforeScoresUpdate+++
|
+++Cup_EndRound_BeforeScoresUpdate+++
|
||||||
Race::SortScores(Race::C_Sort_TotalPoints);
|
Race::SortScores(Race::C_Sort_TotalPoints);
|
||||||
UIManager.UIAll.ScoreTableVisibility = CUIConfig::EVisibility::ForcedVisible;
|
UIManager.UIAll.ScoreTableVisibility = CUIConfig::EVisibility::ForcedVisible;
|
||||||
@ -467,11 +491,11 @@ UIModules_ScoresTable::DisplayRoundPoints(False);
|
|||||||
|
|
||||||
Race::SortScores(Race::C_Sort_TotalPoints);
|
Race::SortScores(Race::C_Sort_TotalPoints);
|
||||||
|
|
||||||
if (!MB_MatchIsRunning()) {
|
if (MB_MatchIsRunning()) {
|
||||||
declare Eliminated <=> Scores::GetBestPlayer(Scores::C_Sort_MatchPoints);
|
|
||||||
Scores::SetPlayerWinner(Eliminated);
|
|
||||||
} else {
|
|
||||||
MB_SkipPodiumSequence();
|
MB_SkipPodiumSequence();
|
||||||
|
} else {
|
||||||
|
declare CSmScore Eliminated <=> Scores::GetBestPlayer(Scores::C_Sort_MatchPoints);
|
||||||
|
Scores::SetPlayerWinner(Eliminated);
|
||||||
}
|
}
|
||||||
***
|
***
|
||||||
|
|
||||||
@ -483,10 +507,10 @@ declare Text[] WinnersNames;
|
|||||||
foreach (Player in Players) {
|
foreach (Player in Players) {
|
||||||
if(!Spectators.exists(Player)) {
|
if(!Spectators.exists(Player)) {
|
||||||
if (Scores::GetPlayerMatchPoints(Player.Score) >= C_Points_LastChance) {
|
if (Scores::GetPlayerMatchPoints(Player.Score) >= C_Points_LastChance) {
|
||||||
if (Player.User.ClubTag != "") {
|
if (Player.User.ClubTag == "") {
|
||||||
WinnersNames.add("[$<"^Player.User.ClubTag^"$>] " ^ Player.User.Name);
|
|
||||||
} else {
|
|
||||||
WinnersNames.add(Player.User.Name);
|
WinnersNames.add(Player.User.Name);
|
||||||
|
} else {
|
||||||
|
WinnersNames.add("[$<"^Player.User.ClubTag^"$>] " ^ Player.User.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -524,7 +548,7 @@ UIModules_ScoresTable::ResetTrophies();
|
|||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
|
||||||
Void UpdateDNFLossPoints(Integer _DNF_LossPoints) {
|
Void UpdateDNFLossPoints(Integer _DNF_LossPoints) {
|
||||||
declare netwrite Integer Net_ReverseCup_DNF_LossPoints for Teams[0];
|
declare netwrite Integer Net_ReverseCup_DNF_LossPoints for Teams[0] = 0;
|
||||||
Net_ReverseCup_DNF_LossPoints = _DNF_LossPoints;
|
Net_ReverseCup_DNF_LossPoints = _DNF_LossPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +562,7 @@ Void UpdateDNFLossPoints(Integer _DNF_LossPoints) {
|
|||||||
*/
|
*/
|
||||||
Void UpdateScoresTableFooter(Integer _PointsLimit, Integer _RoundsPerMap, Integer _ValidRoundsNb, Integer _NbOfWinners) {
|
Void UpdateScoresTableFooter(Integer _PointsLimit, Integer _RoundsPerMap, Integer _ValidRoundsNb, Integer _NbOfWinners) {
|
||||||
declare Text[] Parts;
|
declare Text[] Parts;
|
||||||
declare Message = "";
|
declare Text Message = "";
|
||||||
|
|
||||||
if (_PointsLimit > 0) {
|
if (_PointsLimit > 0) {
|
||||||
if (Parts.count > 0) Message ^= "\n";
|
if (Parts.count > 0) Message ^= "\n";
|
||||||
@ -567,13 +591,28 @@ Void UpdateDNFLossPoints(Integer _DNF_LossPoints) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Void UpdateComplexPointsRepartition(Text _ComplexPointsRepartition) {
|
||||||
|
declare Integer[][Integer] Server_ComplexPointsRepartition for This = [];
|
||||||
|
Server_ComplexPointsRepartition = [];
|
||||||
|
|
||||||
|
declare Integer[][Text] TextComplexPointsRepartition;
|
||||||
|
TextComplexPointsRepartition.fromjson(_ComplexPointsRepartition);
|
||||||
|
|
||||||
|
foreach (TextMultipleRemainingPlayers => PointsRepartition in TextComplexPointsRepartition) {
|
||||||
|
declare Text[] MultipleRemainingPlayers = TL::Split(",", TextMultipleRemainingPlayers);
|
||||||
|
foreach (TextRemainingPlayers in MultipleRemainingPlayers) {
|
||||||
|
Server_ComplexPointsRepartition[TL::ToInteger(TextRemainingPlayers)] = PointsRepartition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
|
||||||
/** Get the time left to the players to finish the round after the first player
|
/** Get the time left to the players to finish the round after the first player
|
||||||
*
|
*
|
||||||
* @return The time left in ms
|
* @return The time left in ms
|
||||||
*/
|
*/
|
||||||
Integer GetFinishTimeout() {
|
Integer GetFinishTimeout() {
|
||||||
declare FinishTimeout = 0;
|
declare Integer FinishTimeout = 0;
|
||||||
|
|
||||||
if (S_FinishTimeout >= 0) {
|
if (S_FinishTimeout >= 0) {
|
||||||
FinishTimeout = S_FinishTimeout * 1000;
|
FinishTimeout = S_FinishTimeout * 1000;
|
||||||
@ -597,7 +636,7 @@ Integer GetFinishTimeout() {
|
|||||||
* @param _Rank The rank of the new looser
|
* @param _Rank The rank of the new looser
|
||||||
*/
|
*/
|
||||||
Void AnnounceEliminated(Text _Name, Integer _Rank) {
|
Void AnnounceEliminated(Text _Name, Integer _Rank) {
|
||||||
declare Message = "";
|
declare Text Message = "";
|
||||||
switch (_Rank) {
|
switch (_Rank) {
|
||||||
case 1: Message = TL::Compose("$f90$i$<%1$> takes 1st place!", _Name);
|
case 1: Message = TL::Compose("$f90$i$<%1$> takes 1st place!", _Name);
|
||||||
case 2: Message = TL::Compose("$f90$i$<%1$> takes 2nd place!", _Name);
|
case 2: Message = TL::Compose("$f90$i$<%1$> takes 2nd place!", _Name);
|
||||||
@ -609,11 +648,19 @@ Void AnnounceEliminated(Text _Name, Integer _Rank) {
|
|||||||
UIModules_BigMessage::SetMessage(Message);
|
UIModules_BigMessage::SetMessage(Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer[] GetPointsRepartition() {
|
Integer[] GetPointsRepartition(Integer _NbPlayersInThisRound) {
|
||||||
declare Integer[] PointsRepartition = PointsRepartition::GetPointsRepartition();
|
declare Integer[] PointsRepartition;
|
||||||
|
declare Integer[][Integer] Server_ComplexPointsRepartition for This = [];
|
||||||
|
|
||||||
if (S_FastForwardPointsRepartition) {
|
if (Server_ComplexPointsRepartition.existskey(_NbPlayersInThisRound)) {
|
||||||
|
PointsRepartition = Server_ComplexPointsRepartition[_NbPlayersInThisRound];
|
||||||
|
} else {
|
||||||
|
PointsRepartition = PointsRepartition::GetPointsRepartition();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (S_FastForwardPointsRepartition && _NbPlayersInThisRound > PointsRepartition.count) {
|
||||||
foreach (Score in Scores) {
|
foreach (Score in Scores) {
|
||||||
|
if (_NbPlayersInThisRound <= PointsRepartition.count) break;
|
||||||
declare Integer Points = Scores::GetPlayerMatchPoints(Score);
|
declare Integer Points = Scores::GetPlayerMatchPoints(Score);
|
||||||
if (Points > C_Points_Spectator && Points <= C_Points_Eliminated) {
|
if (Points > C_Points_Spectator && Points <= C_Points_Eliminated) {
|
||||||
PointsRepartition = PointsRepartition.slice(1, PointsRepartition.count - 1);
|
PointsRepartition = PointsRepartition.slice(1, PointsRepartition.count - 1);
|
||||||
@ -626,33 +673,32 @@ Integer[] GetPointsRepartition() {
|
|||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
|
||||||
/// Compute the latest race scores
|
/// Compute the latest race scores
|
||||||
Void ComputeLatestRaceScores() {
|
Void ComputeLatestRaceScores(Integer _NbPlayersInThisRound) {
|
||||||
Race::SortScores(Race::C_Sort_PrevRaceTime);
|
Race::SortScores(Race::C_Sort_PrevRaceTime);
|
||||||
|
|
||||||
// Points distributed between all players
|
// Points distributed between all players
|
||||||
declare I = 0;
|
declare Integer Key = 0;
|
||||||
declare J = 0;
|
|
||||||
declare CSmPlayer[] LastChancePlayersDNF_WithWorstCheckpoints;
|
declare CSmPlayer[] LastChancePlayersDNF_WithWorstCheckpoints;
|
||||||
declare Integer MinCheckpointNbPassed = 9999;
|
declare Integer MinCheckpointNbPassed = 9999;
|
||||||
|
|
||||||
declare Integer[] PointsRepartition = GetPointsRepartition();
|
declare Integer[] PointsRepartition = GetPointsRepartition(_NbPlayersInThisRound);
|
||||||
|
|
||||||
foreach (Score in Scores) {
|
foreach (Score in Scores) {
|
||||||
// Skip Spectators and already eliminated players
|
// Skip Spectators and already eliminated players
|
||||||
if (Scores::GetPlayerMatchPoints(Score) < C_Points_LastChance) continue;
|
if (Scores::GetPlayerMatchPoints(Score) < C_Points_LastChance) continue;
|
||||||
|
|
||||||
if (Scores::GetPlayerPrevRaceTime(Score) > 0) {
|
if (Scores::GetPlayerPrevRaceTime(Score) > 0) {
|
||||||
declare Points = 0;
|
declare Integer Points = 0;
|
||||||
if (PointsRepartition.count > 0) {
|
if (PointsRepartition.count > 0) {
|
||||||
if (PointsRepartition.existskey(I)) {
|
if (PointsRepartition.existskey(Key)) {
|
||||||
Points = 0 - PointsRepartition[I];
|
Points = 0 - PointsRepartition[Key];
|
||||||
} else {
|
} else {
|
||||||
Points = 0 - PointsRepartition[PointsRepartition.count - 1];
|
Points = 0 - PointsRepartition[PointsRepartition.count - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Scores::SetPlayerRoundPoints(Score, Points);
|
Scores::SetPlayerRoundPoints(Score, Points);
|
||||||
I += 1;
|
Key += 1;
|
||||||
} else {
|
} else {
|
||||||
// Apply DNF penality if Disconnected
|
// Apply DNF penality if Disconnected
|
||||||
if (Score.User == Null) {
|
if (Score.User == Null) {
|
||||||
@ -683,7 +729,6 @@ Void ComputeLatestRaceScores() {
|
|||||||
Scores::SetPlayerRoundPoints(Score, 0 - S_DNF_LossPoints);
|
Scores::SetPlayerRoundPoints(Score, 0 - S_DNF_LossPoints);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
J += 1;
|
|
||||||
}
|
}
|
||||||
if(S_LastChance_DNF_Mode == 1) {
|
if(S_LastChance_DNF_Mode == 1) {
|
||||||
foreach(Player in LastChancePlayersDNF_WithWorstCheckpoints) {
|
foreach(Player in LastChancePlayersDNF_WithWorstCheckpoints) {
|
||||||
@ -701,7 +746,7 @@ Void ComputeScores() {
|
|||||||
|
|
||||||
Race::SortScores(Race::C_Sort_TotalPoints);
|
Race::SortScores(Race::C_Sort_TotalPoints);
|
||||||
|
|
||||||
declare MaxRoundPoints = 0;
|
declare Integer MaxRoundPoints = 0;
|
||||||
foreach (Score in Scores) {
|
foreach (Score in Scores) {
|
||||||
if (MaxRoundPoints > Scores::GetPlayerRoundPoints(Score) && Scores::GetPlayerMatchPoints(Score) > C_Points_Eliminated) MaxRoundPoints = Scores::GetPlayerRoundPoints(Score);
|
if (MaxRoundPoints > Scores::GetPlayerRoundPoints(Score) && Scores::GetPlayerMatchPoints(Score) > C_Points_Eliminated) MaxRoundPoints = Scores::GetPlayerRoundPoints(Score);
|
||||||
}
|
}
|
||||||
@ -767,7 +812,7 @@ Void ComputeScores() {
|
|||||||
* @return True if it is the case, false otherwise
|
* @return True if it is the case, false otherwise
|
||||||
*/
|
*/
|
||||||
Boolean MapIsOver() {
|
Boolean MapIsOver() {
|
||||||
if (G_NbOfValidRounds >= S_RoundsPerMap) return True;
|
if (S_RoundsPerMap > 0 && G_NbOfValidRounds >= S_RoundsPerMap) return True;
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,20 +824,17 @@ Boolean MapIsOver() {
|
|||||||
*/
|
*/
|
||||||
Boolean MatchIsOver() {
|
Boolean MatchIsOver() {
|
||||||
Log::Log("[Cup] MatchIsOver() check | S_PointsStartup : "^S_PointsStartup);
|
Log::Log("[Cup] MatchIsOver() check | S_PointsStartup : "^S_PointsStartup);
|
||||||
declare NbOfPlayersActive = 0;
|
declare Integer NbOfPlayersActive = 0;
|
||||||
foreach (Player in Players) {
|
foreach (Score in Scores) {
|
||||||
if(!Spectators.exists(Player)) {
|
if (Scores::GetPlayerMatchPoints(Score) >= C_Points_LastChance) NbOfPlayersActive += 1;
|
||||||
if (Scores::GetPlayerMatchPoints(Player.Score) >= C_Points_LastChance) NbOfPlayersActive += 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there's only one player they need to reach the points limit to win
|
declare K_MatchInfo Server_MatchInfo for This = K_MatchInfo {};
|
||||||
// If there's more than one player then all players except one must reach the points limit
|
if (Server_MatchInfo.Participants.count == 1) {
|
||||||
declare PlayerEliminatedLimit = ML::Max(Players.count - 1, 1);
|
return NbOfPlayersActive == 0;
|
||||||
Log::Log("""[Cup] Match is over ? {{{(S_NbOfWinners >= NbOfPlayersActive)}}} | ({{{S_NbOfWinners}}} >= {{{NbOfPlayersActive}}})""");
|
}
|
||||||
if (S_NbOfWinners >= NbOfPlayersActive) return True;
|
|
||||||
|
return S_NbOfWinners >= NbOfPlayersActive;
|
||||||
return False;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
|
||||||
@ -819,14 +861,14 @@ Void DisplayCustomPoints() {
|
|||||||
/** Check round before playing it, if necessary to fast forward it
|
/** Check round before playing it, if necessary to fast forward it
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Void CheckRoundBeforePlay() {
|
Void CheckRoundBeforePlay(Integer _NbPlayersInThisRound) {
|
||||||
if(S_AllowFastForwardRounds == True) {
|
if(S_AllowFastForwardRounds == True) {
|
||||||
declare Integer[] PointsRepartition = GetPointsRepartition();
|
declare Integer[] PointsRepartition = GetPointsRepartition(_NbPlayersInThisRound);
|
||||||
declare Boolean IsRoundFastForwardCompatible = True;
|
declare Boolean IsRoundFastForwardCompatible = True;
|
||||||
|
|
||||||
// Check if no players are LastChance or have more points than the minimum points
|
// Check if no players are LastChance or have more points than the minimum points
|
||||||
foreach (Score in Scores) {
|
foreach (Score in Scores) {
|
||||||
declare PlayerMatchPoints = Scores::GetPlayerMatchPoints(Score);
|
declare Integer PlayerMatchPoints = Scores::GetPlayerMatchPoints(Score);
|
||||||
|
|
||||||
if (PlayerMatchPoints == C_Points_LastChance || PlayerMatchPoints > PointsRepartition[0]) {
|
if (PlayerMatchPoints == C_Points_LastChance || PlayerMatchPoints > PointsRepartition[0]) {
|
||||||
IsRoundFastForwardCompatible = False;
|
IsRoundFastForwardCompatible = False;
|
||||||
@ -837,7 +879,7 @@ Void CheckRoundBeforePlay() {
|
|||||||
// if no one, do :
|
// if no one, do :
|
||||||
if(IsRoundFastForwardCompatible == True) {
|
if(IsRoundFastForwardCompatible == True) {
|
||||||
foreach (Score in Scores) {
|
foreach (Score in Scores) {
|
||||||
declare PlayerMatchPoints = Scores::GetPlayerMatchPoints(Score);
|
declare Integer PlayerMatchPoints = Scores::GetPlayerMatchPoints(Score);
|
||||||
if (PlayerMatchPoints > C_Points_Eliminated) {
|
if (PlayerMatchPoints > C_Points_Eliminated) {
|
||||||
Scores::SetPlayerMatchPoints(Score, C_Points_LastChance);
|
Scores::SetPlayerMatchPoints(Score, C_Points_LastChance);
|
||||||
}
|
}
|
||||||
@ -853,7 +895,7 @@ Void CheckRoundBeforePlay() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Void UpdateLiveRaceUI() {
|
Void UpdateLiveRaceUI() {
|
||||||
declare netwrite Integer Net_ReverseCup_LiveRanking_Update for Teams[0];
|
declare netwrite Integer Net_ReverseCup_LiveRanking_Update for Teams[0] = 0;
|
||||||
Net_ReverseCup_LiveRanking_Update += 1;
|
Net_ReverseCup_LiveRanking_Update += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user