@@ -5,16 +5,16 @@ namespace VexTrack.Core
55{
66 public static class HistoryDataCalc
77 {
8- public static string CalcHistoryResultFromScores ( string scoreType , int score , int enemyScore , bool surrenderedWin , bool surrenderedLoss )
8+ public static string CalcHistoryResultFromScores ( string scoreType , string description , int score , int enemyScore , bool surrenderedWin , bool surrenderedLoss )
99 {
1010 if ( scoreType == "Score" )
1111 {
1212 if ( surrenderedWin ) return "Surrendered Win" ;
1313 if ( surrenderedLoss ) return "Surrendered Loss" ;
1414 }
1515
16- if ( scoreType == "Placement" || scoreType == "None" ) enemyScore = - 1 ;
17- if ( scoreType == "None" ) score = - 1 ;
16+ if ( scoreType == "Placement" ) enemyScore = - 1 ;
17+ if ( scoreType == "None" ) ( _ , _ , score , enemyScore ) = DescriptionToScores ( description ) ;
1818
1919 if ( enemyScore == - 1 )
2020 {
@@ -81,24 +81,22 @@ public static (string, string, int, int) DescriptionToScores(string description)
8181
8282 int score = - 1 ;
8383 int enemyScore = - 1 ;
84+
8485
85- if ( ! isCustom )
86- {
87- string [ ] splitDesc = description . Split ( " " ) ;
88- string scoreStr = "" ;
86+ string [ ] splitDesc = description . Split ( " " ) ;
87+ string scoreStr = "" ;
8988
90- foreach ( string token in splitDesc )
91- {
92- if ( ! token . Contains ( "-" ) ) { continue ; }
93- scoreStr = token ;
89+ foreach ( string token in splitDesc )
90+ {
91+ if ( ! token . Contains ( "-" ) ) { continue ; }
92+ scoreStr = token ;
9493
95- string [ ] scoreTokens = scoreStr . Split ( "-" ) ;
96- if ( scoreTokens . Length != 2 ) continue ;
97- if ( scoreTokens [ 0 ] == "" || scoreTokens [ 1 ] == "" ) continue ;
94+ string [ ] scoreTokens = scoreStr . Split ( "-" ) ;
95+ if ( scoreTokens . Length != 2 ) continue ;
96+ if ( scoreTokens [ 0 ] == "" || scoreTokens [ 1 ] == "" ) continue ;
9897
99- ( score , enemyScore ) = ( int . Parse ( scoreTokens [ 0 ] ) , int . Parse ( scoreTokens [ 1 ] ) ) ;
100- break ;
101- }
98+ ( score , enemyScore ) = ( int . Parse ( scoreTokens [ 0 ] ) , int . Parse ( scoreTokens [ 1 ] ) ) ;
99+ break ;
102100 }
103101
104102 string desc = isCustom ? description : "" ;
@@ -138,7 +136,7 @@ public HistoryEntryData(string sUUID, string hUUID, string gameMode, long time,
138136 SurrenderedLoss = surrenderedLoss ;
139137
140138 if ( Constants . ScoreTypes [ GameMode ] == "None" ) Title = Description ;
141- else if ( Constants . ScoreTypes [ GameMode ] == "Placement" ) Title = GameMode + " " + HistoryDataCalc . CalcHistoryResultFromScores ( "Placement" , Score , EnemyScore , SurrenderedWin , SurrenderedLoss ) ;
139+ else if ( Constants . ScoreTypes [ GameMode ] == "Placement" ) Title = GameMode + " " + HistoryDataCalc . CalcHistoryResultFromScores ( "Placement" , Description , Score , EnemyScore , SurrenderedWin , SurrenderedLoss ) ;
142140 else Title = GameMode + " " + Score . ToString ( ) + "-" + EnemyScore . ToString ( ) ;
143141 }
144142 }
0 commit comments