remove some debug/spam

This commit is contained in:
shoopea 2021-12-11 10:44:10 +08:00
parent 0bfa4461ba
commit eec4d75635
2 changed files with 10 additions and 10 deletions

12
ttd.go
View File

@ -526,6 +526,7 @@ func (s *ServerTTD) Poll(stop chan struct{}) {
} }
sp.Read(buffer[:p.PLength]) sp.Read(buffer[:p.PLength])
r := regexp.MustCompile("#:(?P<CompanyID>[0-9]+)\\((?P<Color>[a-zA-Z]+)\\) Company Name: '(?P<CompanyName>.+)'.*Money: (?P<Money>[0-9]+).*Loan: (?P<Loan>[0-9]*).*Value: (?P<Value>[0-9]+).* \\(T:(?P<Train>[0-9]+), R:(?P<Road>[0-9]+), P:(?P<Plane>[0-9]+), S:(?P<Ship>[0-9]+)\\).*$") r := regexp.MustCompile("#:(?P<CompanyID>[0-9]+)\\((?P<Color>[a-zA-Z]+)\\) Company Name: '(?P<CompanyName>.+)'.*Money: (?P<Money>[0-9]+).*Loan: (?P<Loan>[0-9]*).*Value: (?P<Value>[0-9]+).* \\(T:(?P<Train>[0-9]+), R:(?P<Road>[0-9]+), P:(?P<Plane>[0-9]+), S:(?P<Ship>[0-9]+)\\).*$")
r2 := regexp.MustCompile("Client #(?P<ClientID>[0-9]+).*name: '(?P<ClientName>.+)'.*company: (?P<CompanyID>[0-9]+)( )+IP: .*$")
if r.MatchString(sp.Output) { if r.MatchString(sp.Output) {
coID := uint8(0) coID := uint8(0)
for _, co := range srv.Status.Companies { for _, co := range srv.Status.Companies {
@ -564,17 +565,16 @@ func (s *ServerTTD) Poll(stop chan struct{}) {
stats.Plane, _ = strconv.Atoi(r.ReplaceAllString(sp.Output, "${Plane}")) stats.Plane, _ = strconv.Atoi(r.ReplaceAllString(sp.Output, "${Plane}"))
stats.Ship, _ = strconv.Atoi(r.ReplaceAllString(sp.Output, "${Ship}")) stats.Ship, _ = strconv.Atoi(r.ReplaceAllString(sp.Output, "${Ship}"))
} }
} } else if r2.MatchString(sp.Output) {
r = regexp.MustCompile("Client #(?P<ClientID>[0-9]+).*name: '(?P<ClientName>.+)'.*company: (?P<CompanyID>[0-9]+)( )+IP: .*$")
if r.MatchString(sp.Output) {
for _, c := range srv.Status.Clients { for _, c := range srv.Status.Clients {
if c.Name == r.ReplaceAllString(sp.Output, "${ClientName}") { if c.Name == r2.ReplaceAllString(sp.Output, "${ClientName}") {
c.ClientExtlID, _ = strconv.ParseInt(r.ReplaceAllString(sp.Output, "${ClientID}"), 10, 64) c.ClientExtlID, _ = strconv.ParseInt(r2.ReplaceAllString(sp.Output, "${ClientID}"), 10, 64)
break break
} }
} }
} } else {
logInfoDebug("Server.Poll() : AdminPacketServerRCon :\n- ColorID: %d\n- Output: %s", sp.ColorID, sp.Output) logInfoDebug("Server.Poll() : AdminPacketServerRCon :\n- ColorID: %d\n- Output: %s", sp.ColorID, sp.Output)
}
case AdminPacketServerRConEnd: case AdminPacketServerRConEnd:
sp := PacketServerRConEnd{ sp := PacketServerRConEnd{

View File

@ -1,6 +1,6 @@
// Code generated by version.sh (@generated) DO NOT EDIT. // Code generated by version.sh (@generated) DO NOT EDIT.
package main package main
var githash = "1520326" var githash = "0bfa446"
var buildstamp = "2021-12-11_02:35:54" var buildstamp = "2021-12-11_02:44:00"
var commits = "253" var commits = "254"
var version = "1520326-b253 - 2021-12-11_02:35:54" var version = "0bfa446-b254 - 2021-12-11_02:44:00"