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