From 6079431dda2672eb70087e5ab6a0515452e75806 Mon Sep 17 00:00:00 2001 From: shoopea Date: Wed, 10 Nov 2021 14:06:49 +0800 Subject: [PATCH] test --- ttd.go | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/ttd.go b/ttd.go index 4f8f996..7b4c8b2 100644 --- a/ttd.go +++ b/ttd.go @@ -21,12 +21,13 @@ type ClientTTD struct { } type CompanyTTD struct { - CompanyID uint8 - Name string - Protected bool - ClientID uint32 - FirstSeen time.Time - LastSeen time.Time + CompanyID uint8 + CompanyExtlID uint + Name string + Protected bool + ClientID uint32 + FirstSeen time.Time + LastSeen time.Time } type ServerTTD struct { @@ -318,9 +319,10 @@ func (s *ServerTTD) Poll(stop chan struct{}) { sp.Read(buffer[:p.PLength]) logInfoDebug("Server.Poll() : PacketServerCompanyNew :\n- CompanyID: %d", sp.CompanyID) c := &CompanyTTD{ - CompanyID: sp.CompanyID, - FirstSeen: time.Now(), - ClientID: 0, + CompanyID: sp.CompanyID, + CompanyExtlID: 256, + FirstSeen: time.Now(), + ClientID: 0, } s.Status.Companies[sp.CompanyID] = c case AdminPacketServerCompanyInfo: @@ -330,9 +332,10 @@ func (s *ServerTTD) Poll(stop chan struct{}) { sp.Read(buffer[:p.PLength]) //logInfoDebug("Server.Poll() : PacketServerCompanyInfo :\n- CompanyID: %d\n- Name: %s\n- President: %s\n- Protected: %t\n- Inauguration: %d\n- AI: %t", sp.CompanyID, sp.Name, sp.President, sp.Protected, sp.Inauguration, sp.AI) c := &CompanyTTD{ - CompanyID: sp.CompanyID, - FirstSeen: time.Now(), - ClientID: 0, + CompanyID: sp.CompanyID, + CompanyExtlID: 256, + FirstSeen: time.Now(), + ClientID: 0, } if _, ok := s.Status.Companies[sp.CompanyID]; !ok { s.Status.Companies[sp.CompanyID] = c @@ -349,9 +352,10 @@ func (s *ServerTTD) Poll(stop chan struct{}) { sp.Read(buffer[:p.PLength]) logInfoDebug("Server.Poll() : PacketServerCompanyUpdate :\n- CompanyID: %d\n- Name: %s\n- President: %s\n- Protected: %t", sp.CompanyID, sp.Name, sp.President, sp.Protected) c := &CompanyTTD{ - CompanyID: sp.CompanyID, - FirstSeen: time.Now(), - ClientID: 0, + CompanyID: sp.CompanyID, + CompanyExtlID: 256, + FirstSeen: time.Now(), + ClientID: 0, } if _, ok := s.Status.Companies[sp.CompanyID]; !ok { s.Status.Companies[sp.CompanyID] = c @@ -427,12 +431,12 @@ func (s *ServerTTD) Poll(stop chan struct{}) { } break } - - command, err := regexp.MatchString("\\[admin\\] Rcon command from 'gottdad' \\(.*\\): .*", sp.Text) - if command && sp.Origin == "net" { - break - } - + /* + command, err := regexp.MatchString("\\[admin\\] Rcon command from 'gottdad' \\(.*\\): .*", sp.Text) + if command && sp.Origin == "net" { + break + } + */ logInfoDebug("Server.Poll() : AdminPacketServerConsole :\n- Origin: %q\n- Text: %s", sp.Origin, sp.Text) case AdminPacketServerRCon: