This commit is contained in:
shoopea 2020-06-21 19:15:20 +02:00
parent 2f214a6d67
commit e8b7b1aa0b

16
main.go
View File

@ -144,7 +144,7 @@ func main() {
Packet: p, Packet: p,
} }
sp.Read(b[:p.PLength]) sp.Read(b[:p.PLength])
logInfoDebug("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("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 := Client{ clt := Client{
ClientID: sp.ClientID, ClientID: sp.ClientID,
Name: sp.Name, Name: sp.Name,
@ -171,16 +171,15 @@ func main() {
Packet: p, Packet: p,
} }
sp.Read(b[:p.PLength]) sp.Read(b[:p.PLength])
logInfoDebug("AdminPacketServerChat :\n- ActionID: %d\n- DestinationID: %d\n- ClientID: %d\n- Message: %s\n- Amount: %d", sp.ActionID, sp.DestinationID, sp.ClientID, sp.Message, sp.Amount)
if sp.Message == "!unpause" { if sp.Message == "!unpause" {
logInfoDebug("AdminPacketServerChat : Unpausing") logInfoDebug("AdminPacketServerChat : Unpausing")
forcePaused = false forcePaused = false
} } else if sp.Message == "!pause" {
if sp.Message == "!pause" {
logInfoDebug("AdminPacketServerChat : Pausing") logInfoDebug("AdminPacketServerChat : Pausing")
forcePaused = true forcePaused = true
} else {
logInfoDebug("AdminPacketServerChat :\n- ActionID: %d\n- DestinationID: %d\n- ClientID: %d\n- Message: %s\n- Amount: %d", sp.ActionID, sp.DestinationID, sp.ClientID, sp.Message, sp.Amount)
} }
case AdminPacketServerConsole: case AdminPacketServerConsole:
sp := PacketServerConsole{ sp := PacketServerConsole{
@ -198,7 +197,6 @@ func main() {
Packet: p, Packet: p,
} }
sp.Read(b[:p.PLength]) sp.Read(b[:p.PLength])
logInfoDebug("AdminPacketServerRCon :\n- ColorID: %d\n- Output: %s", sp.ColorID, sp.Output)
ok, _ := regexp.MatchString("Client #[0-9]+ name: '.*' company: [0-9]+ IP: .*", sp.Output) ok, _ := regexp.MatchString("Client #[0-9]+ name: '.*' company: [0-9]+ IP: .*", sp.Output)
if ok { if ok {
@ -214,17 +212,21 @@ func main() {
clt.CompanyID = uint8(ID64) clt.CompanyID = uint8(ID64)
clt.Address = r.ReplaceAllString(sp.Output, "${Address}") clt.Address = r.ReplaceAllString(sp.Output, "${Address}")
clients[clt.ClientID] = &clt clients[clt.ClientID] = &clt
} else {
logInfoDebug("AdminPacketServerRCon :\n- ColorID: %d\n- Output: %s", sp.ColorID, sp.Output)
} }
case AdminPacketServerRConEnd: case AdminPacketServerRConEnd:
sp := PacketServerRConEnd{ sp := PacketServerRConEnd{
Packet: p, Packet: p,
} }
sp.Read(b[:p.PLength]) sp.Read(b[:p.PLength])
logInfoDebug("AdminPacketServerRConEnd :\n- Command: %s", sp.Command)
if sp.Command == "clients" { if sp.Command == "clients" {
for k, v := range clients { for k, v := range clients {
logInfoDebug("Client[%d] : %s - %d (%s)", k, v.Name, v.CompanyID, v.Address) logInfoDebug("Client[%d] : %s - %d (%s)", k, v.Name, v.CompanyID, v.Address)
} }
} else {
logInfoDebug("AdminPacketServerRConEnd :\n- Command: %s", sp.Command)
} }
default: default:
logInfoDebug("Packet fully read : len : %d / type : %d", p.PLength, p.PType) logInfoDebug("Packet fully read : len : %d / type : %d", p.PLength, p.PType)