99using System . IO ;
1010using System . ComponentModel . DataAnnotations ;
1111using PKHeX . Core ;
12+ using System . Reflection . Metadata . Ecma335 ;
1213
1314namespace CoreAPI . Controllers
1415{
@@ -60,7 +61,7 @@ public Legalize Legalize([FromForm] [Required] IFormFile pokemon, [FromForm] str
6061 // POST: api/LegalityCheck
6162 [ Route ( "api/LegalityCheck" ) ]
6263 [ HttpPost ]
63- public string CheckLegality ( [ FromForm ] [ Required ] IFormFile pokemon , [ FromHeader ] string Version , [ FromForm ] string generation )
64+ public string CheckLegality ( [ FromForm ] [ Required ] IFormFile pokemon , [ FromForm ] string generation )
6465 {
6566 using var memoryStream = new MemoryStream ( ) ;
6667 pokemon . CopyTo ( memoryStream ) ;
@@ -91,12 +92,24 @@ public string CheckLegality([FromForm] [Required] IFormFile pokemon, [FromHeader
9192 return null ;
9293 }
9394
94- if ( Version == "" || Version == null )
95- {
96- Version = Utils . GetGameVersion ( pkm ) . ToString ( ) ;
97- }
9895 var la = new LegalityAnalysis ( pkm ) ;
9996 return la . Report ( ) ;
10097 }
98+ // ignore the following weird spagehti codes, but piepie62 nearly drove me to drinkin on trying to come up with a solution.
99+ [ Route ( "pksm/legality/check" ) ]
100+ [ HttpPost ]
101+ public string clRoute ( [ FromForm ] [ Required ] IFormFile pkmn , [ FromHeader ] string Generation )
102+ {
103+
104+ return CheckLegality ( pkmn , Generation ) ;
105+ }
106+
107+ [ Route ( "api/v1/bot/auto_legality" ) ]
108+ [ HttpPost ]
109+ public Legalize alRoute ( [ FromForm ] [ Required ] IFormFile pkmn , [ FromHeader ] string version , [ FromHeader ] string Generation )
110+ {
111+
112+ return Legalize ( pkmn , version , Generation ) ;
113+ }
101114 }
102115}
0 commit comments