add rcon clients/companies
This commit is contained in:
		
							parent
							
								
									fe292ba42a
								
							
						
					
					
						commit
						6e092ea3b2
					
				
							
								
								
									
										24
									
								
								ttd.go
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								ttd.go
									
									
									
									
									
								
							@ -13,6 +13,7 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
type ClientTTD struct {
 | 
					type ClientTTD struct {
 | 
				
			||||||
	ClientID     uint32
 | 
						ClientID     uint32
 | 
				
			||||||
 | 
						ClientExtlID uint
 | 
				
			||||||
	Name         string
 | 
						Name         string
 | 
				
			||||||
	Address      string
 | 
						Address      string
 | 
				
			||||||
	CompanyID    uint8
 | 
						CompanyID    uint8
 | 
				
			||||||
@ -236,6 +237,7 @@ func (s *ServerTTD) Poll(stop chan struct{}) {
 | 
				
			|||||||
			//logInfoDebug("Server.Poll() : AdminPacketServerClientInfo :\n-  ClientID: %d\n-  Address: %s\n-  Name: %s\n-  Lang: %d\n-  Date: %d\n-  CompanyID: %d", sp.ClientID, sp.Address, sp.Name, sp.Lang, sp.Date, sp.CompanyID)
 | 
								//logInfoDebug("Server.Poll() : AdminPacketServerClientInfo :\n-  ClientID: %d\n-  Address: %s\n-  Name: %s\n-  Lang: %d\n-  Date: %d\n-  CompanyID: %d", sp.ClientID, sp.Address, sp.Name, sp.Lang, sp.Date, sp.CompanyID)
 | 
				
			||||||
			clt := &ClientTTD{
 | 
								clt := &ClientTTD{
 | 
				
			||||||
				ClientID:     sp.ClientID,
 | 
									ClientID:     sp.ClientID,
 | 
				
			||||||
 | 
									ClientExtlID: 4294967296,
 | 
				
			||||||
				CompanyID:    255,
 | 
									CompanyID:    255,
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if _, ok := s.Status.Clients[sp.ClientID]; ok {
 | 
								if _, ok := s.Status.Clients[sp.ClientID]; ok {
 | 
				
			||||||
@ -503,6 +505,17 @@ func (s *ServerTTD) UpdateClients() {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	err := s.Send(px.Bytes())
 | 
						err := s.Send(px.Bytes())
 | 
				
			||||||
	logErrorDebug(err, "Server.UpdateClients() : Send(PacketAdminPoll) : AdminUpdateClientInfo")
 | 
						logErrorDebug(err, "Server.UpdateClients() : Send(PacketAdminPoll) : AdminUpdateClientInfo")
 | 
				
			||||||
 | 
						for _, c := range srv.Status.Clients {
 | 
				
			||||||
 | 
							if c.ClientExtlID == 4294967296 {
 | 
				
			||||||
 | 
								px2 := PacketAdminRCon{
 | 
				
			||||||
 | 
									Packet:  Packet{PType: AdminPacketAdminRCon},
 | 
				
			||||||
 | 
									Command: "clients",
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								err = s.Send(px2.Bytes())
 | 
				
			||||||
 | 
								logErrorDebug(err, "Server.UpdateClients() : Send(PacketAdminPoll) : AdminPacketAdminRCon")
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	s.Status.UpdateClients = time.Now()
 | 
						s.Status.UpdateClients = time.Now()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -515,6 +528,17 @@ func (s *ServerTTD) UpdateCompanies() {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	err := s.Send(px.Bytes())
 | 
						err := s.Send(px.Bytes())
 | 
				
			||||||
	logErrorDebug(err, "Server.UpdateCompanies() : Send(UpdateCompanies) : AdminUpdateClientInfo")
 | 
						logErrorDebug(err, "Server.UpdateCompanies() : Send(UpdateCompanies) : AdminUpdateClientInfo")
 | 
				
			||||||
 | 
						for _, co := range srv.Status.Companies {
 | 
				
			||||||
 | 
							if co.CompanyExtlID == 256 {
 | 
				
			||||||
 | 
								px2 := PacketAdminRCon{
 | 
				
			||||||
 | 
									Packet:  Packet{PType: AdminPacketAdminRCon},
 | 
				
			||||||
 | 
									Command: "companies",
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								err = s.Send(px2.Bytes())
 | 
				
			||||||
 | 
								logErrorDebug(err, "Server.UpdateClients() : Send(PacketAdminPoll) : AdminPacketAdminRCon")
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	s.Status.UpdateCompanies = time.Now()
 | 
						s.Status.UpdateCompanies = time.Now()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -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 = "4772cd7"
 | 
					var githash = "fe292ba"
 | 
				
			||||||
var buildstamp = "2021-11-10_05:41:24"
 | 
					var buildstamp = "2021-11-10_06:16:28"
 | 
				
			||||||
var commits = "179"
 | 
					var commits = "182"
 | 
				
			||||||
var version = "4772cd7-b179 - 2021-11-10_05:41:24"
 | 
					var version = "fe292ba-b182 - 2021-11-10_06:16:28"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user