CompanyExtlID
This commit is contained in:
		
							parent
							
								
									6e092ea3b2
								
							
						
					
					
						commit
						bcc20d3402
					
				
							
								
								
									
										15
									
								
								ttd.go
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								ttd.go
									
									
									
									
									
								
							@ -13,7 +13,7 @@ import (
 | 
			
		||||
 | 
			
		||||
type ClientTTD struct {
 | 
			
		||||
	ClientID     uint32
 | 
			
		||||
	ClientExtlID uint
 | 
			
		||||
	ClientExtlID int64
 | 
			
		||||
	Name         string
 | 
			
		||||
	Address      string
 | 
			
		||||
	CompanyID    uint8
 | 
			
		||||
@ -23,8 +23,9 @@ type ClientTTD struct {
 | 
			
		||||
 | 
			
		||||
type CompanyTTD struct {
 | 
			
		||||
	CompanyID     uint8
 | 
			
		||||
	CompanyExtlID uint
 | 
			
		||||
	CompanyExtlID int64
 | 
			
		||||
	Name          string
 | 
			
		||||
	Value         int64
 | 
			
		||||
	Protected     bool
 | 
			
		||||
	ClientID      uint32
 | 
			
		||||
	FirstSeen     time.Time
 | 
			
		||||
@ -446,6 +447,16 @@ func (s *ServerTTD) Poll(stop chan struct{}) {
 | 
			
		||||
				Packet: p,
 | 
			
		||||
			}
 | 
			
		||||
			sp.Read(buffer[:p.PLength])
 | 
			
		||||
			r := regexp.MustCompile("#:(?P<CompanyID>[0-9]+)\\(.*\\) Company Name: '(?P<CompanyName>.+)'.*Value: (?P<CompanyValue>[0-9]+)( )+.*")
 | 
			
		||||
			if r.MatchString(sp.Output) {
 | 
			
		||||
				for _, co := range srv.Status.Companies {
 | 
			
		||||
					if co.Name == r.ReplaceAllString(sp.Output, "${CompanyName}") {
 | 
			
		||||
						co.CompanyExtlID, _ = strconv.ParseInt(r.ReplaceAllString(sp.Output, "${CompanyID}"), 10, 64)
 | 
			
		||||
						co.Value, _ = strconv.ParseInt(r.ReplaceAllString(sp.Output, "${CompanyValue}"), 10, 64)
 | 
			
		||||
						break
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			logInfoDebug("Server.Poll() : AdminPacketServerRCon :\n-  ColorID: %d\n-  Output: %s", sp.ColorID, sp.Output)
 | 
			
		||||
 | 
			
		||||
		case AdminPacketServerRConEnd:
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
// Code generated by version.sh (@generated) DO NOT EDIT.
 | 
			
		||||
package main
 | 
			
		||||
var githash = "fe292ba"
 | 
			
		||||
var buildstamp = "2021-11-10_06:16:28"
 | 
			
		||||
var commits = "182"
 | 
			
		||||
var version = "fe292ba-b182 - 2021-11-10_06:16:28"
 | 
			
		||||
var githash = "6e092ea"
 | 
			
		||||
var buildstamp = "2021-11-10_06:35:44"
 | 
			
		||||
var commits = "183"
 | 
			
		||||
var version = "6e092ea-b183 - 2021-11-10_06:35:44"
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user