From 1e14d58422f8fad4a733bfd795cbb4fbe53c93fa Mon Sep 17 00:00:00 2001 From: derSoerrn95 Date: Wed, 23 Feb 2022 16:53:41 +0100 Subject: [PATCH] Added missing NetworkId to ParticipantData Packet and added toString function for some types (#7) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(core): added NetworkId field * feat(core): added toString function for types for driver, session, team and track type * fix(core): harmonized ID name of NetworkID (was NetworkId) * fix(core): applied changes to name (removed Type and Name suffix) Co-authored-by: Sören Borgstedt --- pkg/env/driver/constants.go | 336 +++++++++++++++++++++++------------ pkg/env/session/constants.go | 50 ++++-- pkg/env/team/constants.go | 285 +++++++++++++++++++---------- pkg/env/track/constants.go | 99 +++++++---- pkg/packets/participants.go | 3 +- 5 files changed, 528 insertions(+), 245 deletions(-) diff --git a/pkg/env/driver/constants.go b/pkg/env/driver/constants.go index 306a9bd..63ed575 100644 --- a/pkg/env/driver/constants.go +++ b/pkg/env/driver/constants.go @@ -1,114 +1,232 @@ package driver // Drivers IDs +type Driver uint8 + const ( - CarlosSainz uint8 = 0 - DaniilKvyat uint8 = 1 - DanielRicciardo uint8 = 2 - FernandoAlonso uint8 = 3 - FelipeMassa uint8 = 4 - KimiRaikkonen uint8 = 6 - LewisHamilton uint8 = 7 - MaxVerstappen uint8 = 9 - NicoHulkenburg uint8 = 10 - KevinMagnussen uint8 = 11 - RomainGrosjean uint8 = 12 - SebastianVettel uint8 = 13 - SergioPerez uint8 = 14 - ValtteriBottas uint8 = 15 - EstebanOcon uint8 = 17 - LanceStroll uint8 = 19 - ArronBarnes uint8 = 20 - MartinGiles uint8 = 21 - AlexMurray uint8 = 22 - LucasRoth uint8 = 23 - IgorCorreia uint8 = 24 - SophieLevasseur uint8 = 25 - JonasSchiffer uint8 = 26 - AlainForest uint8 = 27 - JayLetourneau uint8 = 28 - EstoSaari uint8 = 29 - YasarAtiyeh uint8 = 30 - CallistoCalabresi uint8 = 31 - NaotaIzum uint8 = 32 - HowardClarke uint8 = 33 - WilheimKaufmann uint8 = 34 - MarieLaursen uint8 = 35 - FlavioNieves uint8 = 36 - PeterBelousov uint8 = 37 - KlimekMichalski uint8 = 38 - SantiagoMoreno uint8 = 39 - BenjaminCoppens uint8 = 40 - NoahVisser uint8 = 41 - GertWaldmuller uint8 = 42 - JulianQuesada uint8 = 43 - DanielJones uint8 = 44 - ArtemMarkelov uint8 = 45 - TadasukeMakino uint8 = 46 - SeanGelael uint8 = 47 - NyckDeVries uint8 = 48 - JackAitken uint8 = 49 - GeorgeRussell uint8 = 50 - MaximilianGunther uint8 = 51 - NireiFukuzumi uint8 = 52 - LucaGhiotto uint8 = 53 - LandoNorris uint8 = 54 - SergioSetteCamara uint8 = 55 - LouisDeletraz uint8 = 56 - AntonioFuoco uint8 = 57 - CharlesLeclerc uint8 = 58 - PierreGasly uint8 = 59 - AlexanderAlbon uint8 = 62 - NicholasLatifi uint8 = 63 - DorianBoccolacci uint8 = 64 - NikoKari uint8 = 65 - RobertoMerhi uint8 = 66 - ArjunMaini uint8 = 67 - AlessioLorandi uint8 = 68 - RubenMeijer uint8 = 69 - RashidNair uint8 = 70 - JackTremblay uint8 = 71 - AntonioGiovinazzi uint8 = 74 - RobertKubica uint8 = 75 - NobuharuMatsushita uint8 = 78 - NikitaMazepin uint8 = 79 - GuanyaZhou uint8 = 80 - MickSchumacher uint8 = 81 - CallumIlott uint8 = 82 - JuanManuelCorrea uint8 = 83 - JordanKing uint8 = 84 - MahaveerRaghunathan uint8 = 85 - TatianaCalderon uint8 = 86 - AnthoineHubert uint8 = 87 - GuilianoAlesi uint8 = 88 - RalphBoschung uint8 = 89 - MichaelSchumacher uint8 = 90 - DanTicktum uint8 = 91 - MarcusArmstrong uint8 = 92 - ChristianLundgaard uint8 = 93 - YukiTsunoda uint8 = 94 - JehanDaruvala uint8 = 95 - GulhermeSamaia uint8 = 96 - PedroPiquet uint8 = 97 - FelipeDrugovich uint8 = 98 - RoberSchwartzman uint8 = 99 - RoyNissany uint8 = 100 - MarinoSatorus uint8 = 101 - AidanJackson uint8 = 102 - CasperAkkerman uint8 = 103 - JensonButton uint8 = 109 - DavidCoulthard uint8 = 110 - NicoRosberg uint8 = 111 - OscarPiastri uint8 = 112 - LiamLawson uint8 = 113 - JuriVips uint8 = 114 - TheoPourchaire uint8 = 115 - RichardVerschoor uint8 = 116 - LirimZendeli uint8 = 117 - DavidBeckmann uint8 = 118 - GianlucaPetecof uint8 = 119 - MatteoNannini uint8 = 120 - AlessioDeledda uint8 = 121 - BentViscaal uint8 = 122 - EnzoFitipaldi uint8 = 123 + CarlosSainz Driver = 0 + DaniilKvyat Driver = 1 + DanielRicciardo Driver = 2 + FernandoAlonso Driver = 3 + FelipeMassa Driver = 4 + KimiRaikkonen Driver = 6 + LewisHamilton Driver = 7 + MaxVerstappen Driver = 9 + NicoHulkenburg Driver = 10 + KevinMagnussen Driver = 11 + RomainGrosjean Driver = 12 + SebastianVettel Driver = 13 + SergioPerez Driver = 14 + ValtteriBottas Driver = 15 + EstebanOcon Driver = 17 + LanceStroll Driver = 19 + ArronBarnes Driver = 20 + MartinGiles Driver = 21 + AlexMurray Driver = 22 + LucasRoth Driver = 23 + IgorCorreia Driver = 24 + SophieLevasseur Driver = 25 + JonasSchiffer Driver = 26 + AlainForest Driver = 27 + JayLetourneau Driver = 28 + EstoSaari Driver = 29 + YasarAtiyeh Driver = 30 + CallistoCalabresi Driver = 31 + NaotaIzum Driver = 32 + HowardClarke Driver = 33 + WilheimKaufmann Driver = 34 + MarieLaursen Driver = 35 + FlavioNieves Driver = 36 + PeterBelousov Driver = 37 + KlimekMichalski Driver = 38 + SantiagoMoreno Driver = 39 + BenjaminCoppens Driver = 40 + NoahVisser Driver = 41 + GertWaldmuller Driver = 42 + JulianQuesada Driver = 43 + DanielJones Driver = 44 + ArtemMarkelov Driver = 45 + TadasukeMakino Driver = 46 + SeanGelael Driver = 47 + NyckDeVries Driver = 48 + JackAitken Driver = 49 + GeorgeRussell Driver = 50 + MaximilianGunther Driver = 51 + NireiFukuzumi Driver = 52 + LucaGhiotto Driver = 53 + LandoNorris Driver = 54 + SergioSetteCamara Driver = 55 + LouisDeletraz Driver = 56 + AntonioFuoco Driver = 57 + CharlesLeclerc Driver = 58 + PierreGasly Driver = 59 + AlexanderAlbon Driver = 62 + NicholasLatifi Driver = 63 + DorianBoccolacci Driver = 64 + NikoKari Driver = 65 + RobertoMerhi Driver = 66 + ArjunMaini Driver = 67 + AlessioLorandi Driver = 68 + RubenMeijer Driver = 69 + RashidNair Driver = 70 + JackTremblay Driver = 71 + AntonioGiovinazzi Driver = 74 + RobertKubica Driver = 75 + NobuharuMatsushita Driver = 78 + NikitaMazepin Driver = 79 + GuanyaZhou Driver = 80 + MickSchumacher Driver = 81 + CallumIlott Driver = 82 + JuanManuelCorrea Driver = 83 + JordanKing Driver = 84 + MahaveerRaghunathan Driver = 85 + TatianaCalderon Driver = 86 + AnthoineHubert Driver = 87 + GuilianoAlesi Driver = 88 + RalphBoschung Driver = 89 + MichaelSchumacher Driver = 90 + DanTicktum Driver = 91 + MarcusArmstrong Driver = 92 + ChristianLundgaard Driver = 93 + YukiTsunoda Driver = 94 + JehanDaruvala Driver = 95 + GulhermeSamaia Driver = 96 + PedroPiquet Driver = 97 + FelipeDrugovich Driver = 98 + RoberSchwartzman Driver = 99 + RoyNissany Driver = 100 + MarinoSatorus Driver = 101 + AidanJackson Driver = 102 + CasperAkkerman Driver = 103 + JensonButton Driver = 109 + DavidCoulthard Driver = 110 + NicoRosberg Driver = 111 + OscarPiastri Driver = 112 + LiamLawson Driver = 113 + JuriVips Driver = 114 + TheoPourchaire Driver = 115 + RichardVerschoor Driver = 116 + LirimZendeli Driver = 117 + DavidBeckmann Driver = 118 + GianlucaPetecof Driver = 119 + MatteoNannini Driver = 120 + AlessioDeledda Driver = 121 + BentViscaal Driver = 122 + EnzoFitipaldi Driver = 123 ) + +var drivers = map[Driver]string{ + 0: "CarlosSainz", + 1: "DaniilKvyat", + 2: "DanielRicciardo", + 3: "FernandoAlonso", + 4: "FelipeMassa", + 6: "KimiRaikkonen", + 7: "LewisHamilton", + 9: "MaxVerstappen", + 10: "NicoHulkenburg", + 11: "KevinMagnussen", + 12: "RomainGrosjean", + 13: "SebastianVettel", + 14: "SergioPerez", + 15: "ValtteriBottas", + 17: "EstebanOcon", + 19: "LanceStroll", + 20: "ArronBarnes", + 21: "MartinGiles", + 22: "AlexMurray", + 23: "LucasRoth", + 24: "IgorCorreia", + 25: "SophieLevasseur", + 26: "JonasSchiffer", + 27: "AlainForest", + 28: "JayLetourneau", + 29: "EstoSaari", + 30: "YasarAtiyeh", + 31: "CallistoCalabresi", + 32: "NaotaIzum", + 33: "HowardClarke", + 34: "WilheimKaufmann", + 35: "MarieLaursen", + 36: "FlavioNieves", + 37: "PeterBelousov", + 38: "KlimekMichalski", + 39: "SantiagoMoreno", + 40: "BenjaminCoppens", + 41: "NoahVisser", + 42: "GertWaldmuller", + 43: "JulianQuesada", + 44: "DanielJones", + 45: "ArtemMarkelov", + 46: "TadasukeMakino", + 47: "SeanGelael", + 48: "NyckDeVries", + 49: "JackAitken", + 50: "GeorgeRussell", + 51: "MaximilianGunther", + 52: "NireiFukuzumi", + 53: "LucaGhiotto", + 54: "LandoNorris", + 55: "SergioSetteCamara", + 56: "LouisDeletraz", + 57: "AntonioFuoco", + 58: "CharlesLeclerc", + 59: "PierreGasly", + 62: "AlexanderAlbon", + 63: "NicholasLatifi", + 64: "DorianBoccolacci", + 65: "NikoKari", + 66: "RobertoMerhi", + 67: "ArjunMaini", + 68: "AlessioLorandi", + 69: "RubenMeijer", + 70: "RashidNair", + 71: "JackTremblay", + 74: "AntonioGiovinazzi", + 75: "RobertKubica", + 78: "NobuharuMatsushita", + 79: "NikitaMazepin", + 80: "GuanyaZhou", + 81: "MickSchumacher", + 82: "CallumIlott", + 83: "JuanManuelCorrea", + 84: "JordanKing", + 85: "MahaveerRaghunathan", + 86: "TatianaCalderon", + 87: "AnthoineHubert", + 88: "GuilianoAlesi", + 89: "RalphBoschung", + 90: "MichaelSchumacher", + 91: "DanTicktum", + 92: "MarcusArmstrong", + 93: "ChristianLundgaard", + 94: "YukiTsunoda", + 95: "JehanDaruvala", + 96: "GulhermeSamaia", + 97: "PedroPiquet", + 98: "FelipeDrugovich", + 99: "RoberSchwartzman", + 100: "RoyNissany", + 101: "MarinoSatorus", + 102: "AidanJackson", + 103: "CasperAkkerman", + 109: "JensonButton", + 110: "DavidCoulthard", + 111: "NicoRosberg", + 112: "OscarPiastri", + 113: "LiamLawson", + 114: "JuriVips", + 115: "TheoPourchaire", + 116: "RichardVerschoor", + 117: "LirimZendeli", + 118: "DavidBeckmann", + 119: "GianlucaPetecof", + 120: "MatteoNannini", + 121: "AlessioDeledda", + 122: "BentViscaal", + 123: "EnzoFitipaldi", +} + +func (s Driver) String() string { + return drivers[s] +} diff --git a/pkg/env/session/constants.go b/pkg/env/session/constants.go index 7b46765..5655091 100644 --- a/pkg/env/session/constants.go +++ b/pkg/env/session/constants.go @@ -1,18 +1,42 @@ package session // Session Types +type Session uint8 + const ( - Unknown uint8 = 0 - P1 uint8 = 1 - P2 uint8 = 2 - P3 uint8 = 3 - ShortP uint8 = 4 - Q1 uint8 = 5 - Q2 uint8 = 6 - Q3 uint8 = 7 - ShortQ uint8 = 8 - OSQ uint8 = 9 - R uint8 = 10 - R2 uint8 = 11 - TimeTrial uint8 = 12 + Unknown Session = 0 + P1 Session = 1 + P2 Session = 2 + P3 Session = 3 + ShortP Session = 4 + Q1 Session = 5 + Q2 Session = 6 + Q3 Session = 7 + ShortQ Session = 8 + OSQ Session = 9 + R Session = 10 + R2 Session = 11 + R3 Session = 12 + TimeTrial Session = 13 ) + +var sessions = map[Session]string{ + 0: "Unknown", + 1: "P1", + 2: "P2", + 3: "P3", + 4: "ShortP", + 5: "Q1", + 6: "Q2", + 7: "Q3", + 8: "ShortQ", + 9: "OSQ", + 10: "R", + 11: "R2", + 12: "R3", + 13: "TimeTrial", +} + +func (s Session) String() string { + return sessions[s] +} diff --git a/pkg/env/team/constants.go b/pkg/env/team/constants.go index 6ff7c9f..da117d9 100644 --- a/pkg/env/team/constants.go +++ b/pkg/env/team/constants.go @@ -1,97 +1,198 @@ package team // Team IDs +type Team uint8 + const ( - Mercedes uint8 = 0 - Ferrari uint8 = 1 - RedBulRacing uint8 = 2 - Williams uint8 = 3 - AstonMartin uint8 = 4 - Alpine uint8 = 5 - AlphaTauri uint8 = 6 - Haas uint8 = 7 - McLaren uint8 = 8 - AlfaRomeo uint8 = 9 - McLaren1988 uint8 = 10 - McLaren1991 uint8 = 11 - Williams1992 uint8 = 12 - Ferrari1995 uint8 = 13 - Williams1996 uint8 = 14 - McLaren1998 uint8 = 15 - Ferrari2002 uint8 = 16 - Ferrari2004 uint8 = 17 - Renault2006 uint8 = 18 - Ferrari2007 uint8 = 19 - McLaren2008 uint8 = 20 - RedBull2010 uint8 = 21 - Ferrari1976 uint8 = 22 - ARTGrandPrix uint8 = 23 - CamposVexatecRacing uint8 = 24 - Carlin uint8 = 25 - CharouzRacingSystem uint8 = 26 - DAMS uint8 = 27 - RussianTime uint8 = 28 - MPMotorsport uint8 = 29 - Pertamina uint8 = 30 - McLaren1990 uint8 = 31 - Trident uint8 = 32 - BWTArden uint8 = 33 - McLaren1976 uint8 = 34 - Lotus1972 uint8 = 35 - Ferrari1979 uint8 = 36 - McLaren1982 uint8 = 37 - Williams2003 uint8 = 38 - Brawn2009 uint8 = 39 - Lotus1978 uint8 = 40 - F1GenericCar uint8 = 41 - ArtGP2019 uint8 = 42 - Campos2019 uint8 = 43 - Carlin2019 uint8 = 44 - SauberJuniorCharouz2019 uint8 = 45 - Dams2019 uint8 = 46 - UniVirtuosi2019 uint8 = 47 - MPMotorsport2019 uint8 = 48 - Prema2019 uint8 = 49 - Trident2019 uint8 = 50 - Arden2019 uint8 = 51 - Benetton1994 uint8 = 53 - Benetton1995 uint8 = 54 - Ferrari2000 uint8 = 55 - Jordan1991 uint8 = 56 - Ferrari1990 uint = 63 - McLaren2010 uint = 64 - Ferrari2010 uint = 64 - ArtGP2020 uint = 70 - Campos2020 uint = 71 - Carlin2020 uint = 72 - Charouz2020 uint = 73 - Dam2020 uint = 74 - UniVirtuosi2020 uint = 75 - MPMotorsport2020 uint = 76 - Prema2020 uint = 77 - Trident2020 uint = 78 - BWT2020 uint = 79 - Hitech2020 uint = 80 - Mercedes2020 uint = 85 - Ferrari2020 uint = 86 - RedBull2020 uint = 87 - Williams2020 uint = 88 - RacingPoint2020 uint = 89 - Renault2020 uint = 90 - AlphaTauri2020 uint = 91 - Haas2020 uint = 92 - McLaren2020 uint = 93 - AlfaRomeo2020 uint = 94 - Prema2021 uint = 106 - UniVirtuosi2021 uint = 107 - Carlin2021 uint = 108 - Hitech2021 uint = 109 - ArtGP2021 uint = 110 - MPMotorsport2021 uint = 111 - Charouz2021 uint = 112 - Dams2021 uint = 113 - Campos2021 uint = 114 - BWT2021 uint = 115 - Trident2021 uint = 116 - MyTeam uint8 = 255 + Mercedes Team = 0 + Ferrari Team = 1 + RedBulRacing Team = 2 + Williams Team = 3 + AstonMartin Team = 4 + Alpine Team = 5 + AlphaTauri Team = 6 + Haas Team = 7 + McLaren Team = 8 + AlfaRomeo Team = 9 + McLaren1988 Team = 10 + McLaren1991 Team = 11 + Williams1992 Team = 12 + Ferrari1995 Team = 13 + Williams1996 Team = 14 + McLaren1998 Team = 15 + Ferrari2002 Team = 16 + Ferrari2004 Team = 17 + Renault2006 Team = 18 + Ferrari2007 Team = 19 + McLaren2008 Team = 20 + RedBull2010 Team = 21 + Ferrari1976 Team = 22 + ARTGrandPrix Team = 23 + CamposVexatecRacing Team = 24 + Carlin Team = 25 + CharouzRacingSystem Team = 26 + DAMS Team = 27 + RussianTime Team = 28 + MPMotorsport Team = 29 + Pertamina Team = 30 + McLaren1990 Team = 31 + Trident Team = 32 + BWTArden Team = 33 + McLaren1976 Team = 34 + Lotus1972 Team = 35 + Ferrari1979 Team = 36 + McLaren1982 Team = 37 + Williams2003 Team = 38 + Brawn2009 Team = 39 + Lotus1978 Team = 40 + F1GenericCar Team = 41 + ArtGP2019 Team = 42 + Campos2019 Team = 43 + Carlin2019 Team = 44 + SauberJuniorCharouz2019 Team = 45 + Dams2019 Team = 46 + UniVirtuosi2019 Team = 47 + MPMotorsport2019 Team = 48 + Prema2019 Team = 49 + Trident2019 Team = 50 + Arden2019 Team = 51 + Benetton1994 Team = 53 + Benetton1995 Team = 54 + Ferrari2000 Team = 55 + Jordan1991 Team = 56 + Ferrari1990 Team = 63 + McLaren2010 Team = 64 + Ferrari2010 Team = 64 + ArtGP2020 Team = 70 + Campos2020 Team = 71 + Carlin2020 Team = 72 + Charouz2020 Team = 73 + Dam2020 Team = 74 + UniVirtuosi2020 Team = 75 + MPMotorsport2020 Team = 76 + Prema2020 Team = 77 + Trident2020 Team = 78 + BWT2020 Team = 79 + Hitech2020 Team = 80 + Mercedes2020 Team = 85 + Ferrari2020 Team = 86 + RedBull2020 Team = 87 + Williams2020 Team = 88 + RacingPoint2020 Team = 89 + Renault2020 Team = 90 + AlphaTauri2020 Team = 91 + Haas2020 Team = 92 + McLaren2020 Team = 93 + AlfaRomeo2020 Team = 94 + Prema2021 Team = 106 + UniVirtuosi2021 Team = 107 + Carlin2021 Team = 108 + Hitech2021 Team = 109 + ArtGP2021 Team = 110 + MPMotorsport2021 Team = 111 + Charouz2021 Team = 112 + Dams2021 Team = 113 + Campos2021 Team = 114 + BWT2021 Team = 115 + Trident2021 Team = 116 + MyTeam Team = 255 ) + +var teams = map[Team]string{ + 0: "Mercedes", + 1: "Ferrari", + 2: "RedBulRacing", + 3: "Williams", + 4: "AstonMartin", + 5: "Alpine", + 6: "AlphaTauri", + 7: "Haas", + 8: "McLaren", + 9: "AlfaRomeo", + 10: "McLaren1988", + 11: "McLaren1991", + 12: "Williams1992", + 13: "Ferrari1995", + 14: "Williams1996", + 15: "McLaren1998", + 16: "Ferrari2002", + 17: "Ferrari2004", + 18: "Renault2006", + 19: "Ferrari2007", + 20: "McLaren2008", + 21: "RedBull2010", + 22: "Ferrari1976", + 23: "ARTGrandPrix", + 24: "CamposVexatecRacing", + 25: "Carlin", + 26: "CharouzRacingSystem", + 27: "DAMS", + 28: "RussianTime", + 29: "MPMotorsport", + 30: "Pertamina", + 31: "McLaren1990", + 32: "Trident", + 33: "BWTArden", + 34: "McLaren1976", + 35: "Lotus1972", + 36: "Ferrari1979", + 37: "McLaren1982", + 38: "Williams2003", + 39: "Brawn2009", + 40: "Lotus1978", + 41: "F1GenericCar", + 42: "ArtGP2019", + 43: "Campos2019", + 44: "Carlin2019", + 45: "SauberJuniorCharouz2019", + 46: "Dams2019", + 47: "UniVirtuosi2019", + 48: "MPMotorsport2019", + 49: "Prema2019", + 50: "Trident2019", + 51: "Arden2019", + 53: "Benetton1994", + 54: "Benetton1995", + 55: "Ferrari2000", + 56: "Jordan1991", + 63: "Ferrari1990", + 64: "McLaren2010", + 65: "Ferrari2010", // in enum 64; don't know what's correct + 70: "ArtGP2020", + 71: "Campos2020", + 72: "Carlin2020", + 73: "Charouz2020", + 74: "Dam2020", + 75: "UniVirtuosi2020", + 76: "MPMotorsport2020", + 77: "Prema2020", + 78: "Trident2020", + 79: "BWT2020", + 80: "Hitech2020", + 85: "Mercedes2020", + 86: "Ferrari2020", + 87: "RedBull2020", + 88: "Williams2020", + 89: "RacingPoint2020", + 90: "Renault2020", + 91: "AlphaTauri2020", + 92: "Haas2020", + 93: "McLaren2020", + 94: "AlfaRomeo2020", + 106: "Prema2021", + 107: "UniVirtuosi2021", + 108: "Carlin2021", + 109: "Hitech2021", + 110: "ArtGP2021", + 111: "MPMotorsport2021", + 112: "Charouz2021", + 113: "Dams2021", + 114: "Campos2021", + 115: "BWT2021", + 116: "Trident2021", + 255: "MyTeam", +} + +func (s Team) String() string { + return teams[s] +} diff --git a/pkg/env/track/constants.go b/pkg/env/track/constants.go index 6fd3a7e..8e64d8e 100644 --- a/pkg/env/track/constants.go +++ b/pkg/env/track/constants.go @@ -1,35 +1,74 @@ package track // Track IDs +type Track uint8 + const ( - Melbourne uint8 = 0 - PaulRicard uint8 = 1 - Shanghai uint8 = 2 - Sakhir uint8 = 3 - Catalunya uint8 = 4 - Monaco uint8 = 5 - Montreal uint8 = 6 - Silverstone uint8 = 7 - Hockenheim uint8 = 8 - Hungaroring uint8 = 9 - Spa uint8 = 10 - Monza uint8 = 11 - Singapore uint8 = 12 - Suzuka uint8 = 13 - AbuDhabi uint8 = 14 - Texas uint8 = 15 - Brazil uint8 = 16 - Austria uint8 = 17 - Sochi uint8 = 18 - Mexico uint8 = 19 - Baku uint8 = 20 - SakhirShort uint8 = 21 - SilverstoneShort uint8 = 22 - TexasShort uint8 = 23 - SuzukaShort uint8 = 24 - Hanoi uint8 = 25 - Zandvoort uint8 = 26 - Imola uint8 = 27 - Partimao uint8 = 28 - Jeddah uint8 = 29 + Melbourne Track = 0 + PaulRicard Track = 1 + Shanghai Track = 2 + Sakhir Track = 3 + Catalunya Track = 4 + Monaco Track = 5 + Montreal Track = 6 + Silverstone Track = 7 + Hockenheim Track = 8 + Hungaroring Track = 9 + Spa Track = 10 + Monza Track = 11 + Singapore Track = 12 + Suzuka Track = 13 + AbuDhabi Track = 14 + Texas Track = 15 + Brazil Track = 16 + Austria Track = 17 + Sochi Track = 18 + Mexico Track = 19 + Baku Track = 20 + SakhirShort Track = 21 + SilverstoneShort Track = 22 + TexasShort Track = 23 + SuzukaShort Track = 24 + Hanoi Track = 25 + Zandvoort Track = 26 + Imola Track = 27 + Partimao Track = 28 + Jeddah Track = 29 ) + +var tracks = map[Track]string{ + 0: "Melbourne", + 1: "PaulRicard", + 2: "Shanghai", + 3: "Sakhir", + 4: "Catalunya", + 5: "Monaco", + 6: "Montreal", + 7: "Silverstone", + 8: "Hockenheim", + 9: "Hungaroring", + 10: "Spa", + 11: "Monza", + 12: "Singapore", + 13: "Suzuka", + 14: "AbuDhabi", + 15: "Texas", + 16: "Brazil", + 17: "Austria", + 18: "Sochi", + 19: "Mexico", + 20: "Baku", + 21: "SakhirShort", + 22: "SilverstoneShort", + 23: "TexasShort", + 24: "SuzukaShort", + 25: "Hanoi", + 26: "Zandvoort", + 27: "Imola", + 28: "Partimao", + 29: "Jeddah", +} + +func (t Track) String() string { + return tracks[t] +} diff --git a/pkg/packets/participants.go b/pkg/packets/participants.go index 2dec082..1357e35 100644 --- a/pkg/packets/participants.go +++ b/pkg/packets/participants.go @@ -4,12 +4,13 @@ package packets // If this is a multiplayer game, the names will be the Steam Id on PC, or the LAN name if appropriate. // Frequency: Every 5 seconds -// Size: 1213 bytes +// Size: 1257 bytes // Version: 1 type ParticipantData struct { AIControlled uint8 // Whether the vehicle is AI (1) or Human (0) controlled DriverID uint8 // Driver id - see appendix + NetworkID uint8 // Network id – unique identifier for network players TeamID uint8 // Team id - see appendix MyTeam uint8 // My team flag – 1 = My Team, 0 = otherwise RaceNumber uint8 // Race number of the car