add rcon clients/companies
This commit is contained in:
parent
fe292ba42a
commit
6e092ea3b2
40
ttd.go
40
ttd.go
@ -12,12 +12,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ClientTTD struct {
|
type ClientTTD struct {
|
||||||
ClientID uint32
|
ClientID uint32
|
||||||
Name string
|
ClientExtlID uint
|
||||||
Address string
|
Name string
|
||||||
CompanyID uint8
|
Address string
|
||||||
Paused bool
|
CompanyID uint8
|
||||||
LastSeen time.Time
|
Paused bool
|
||||||
|
LastSeen time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
type CompanyTTD struct {
|
type CompanyTTD struct {
|
||||||
@ -235,8 +236,9 @@ func (s *ServerTTD) Poll(stop chan struct{}) {
|
|||||||
sp.Read(buffer[:p.PLength])
|
sp.Read(buffer[:p.PLength])
|
||||||
//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,
|
||||||
CompanyID: 255,
|
ClientExtlID: 4294967296,
|
||||||
|
CompanyID: 255,
|
||||||
}
|
}
|
||||||
if _, ok := s.Status.Clients[sp.ClientID]; ok {
|
if _, ok := s.Status.Clients[sp.ClientID]; ok {
|
||||||
clt = s.Status.Clients[sp.ClientID]
|
clt = s.Status.Clients[sp.ClientID]
|
||||||
@ -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…
Reference in New Issue
Block a user