Changeset 234 for scripts/usr/local


Ignore:
Timestamp:
May 1, 2015, 11:22:18 AM (10 years ago)
Author:
alloc
Message:

v.86: Fixes #101

Location:
scripts/usr/local/lib/7dtd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • scripts/usr/local/lib/7dtd/VERSION

    r231 r234  
    1 Version: 83
    2 Release: 2015-04-18
    3 DediBuild: 593110
     1Version: 86
     2Release: 2015-05-01
     3DediBuild: 605981
    44
  • scripts/usr/local/lib/7dtd/monitor-log.sh

    r220 r234  
    2020
    2121handleConnect() {
    22         local clientId="$1"
    23         local entityId="$2"
    24         local name="$3"
    25         local steamId="$4"
    26         local ip="$5"
     22        local entityId="$1"
     23        local name="$2"
     24        local steamId="$3"
     25        local ip="$4"
    2726       
    2827        logPlayerConnect $INSTANCE "$entityId" "$name" "$steamId" "$ip"
    2928
    3029        for H in $(getHooksFor playerConnect); do
    31                 $H $INSTANCE "$clientId" "$entityId" "$name" "$steamId" "$ip"
     30                $H $INSTANCE "$entityId" "$name" "$steamId" "$ip"
    3231        done
    3332}
    3433
    3534handleDisconnect() {
    36         local clientId="$1"
     35        local playerId="$1"
    3736        local entityId="$2"
    3837
     
    4039
    4140        for H in $(getHooksFor playerDisconnect); do
    42                 $H $INSTANCE "$clientId" "$entityId" "$NICKNAME" "$STEAMID"
     41                $H $INSTANCE "$playerId" "$entityId" "$NICKNAME" "$STEAMID"
    4342        done
    4443}
     
    9998while read line ; do
    10099        if [ -n "$line" ]; then
    101                 #Player connected, clientid=[0-9]*, entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=[0-9.]*$
     100                #Player connected, entityid=1278, name=termo2, steamid=76561197997439820, ip=178.203.27.140
     101                #Player connected, entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=[0-9.]*$
    102102                if [ -n "$(echo "$line" | grep '^Player connected,')" ]; then
    103                         clientId=$(expr "$line" : 'Player connected, clientid=\([0-9]*\), entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=[0-9.]*$')
    104                         entityId=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=\([0-9]*\), name=.*, steamid=[0-9]*, ip=[0-9.]*$')
    105                         playerName=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=[0-9]*, name=\(.*\), steamid=[0-9]*, ip=[0-9.]*$')
    106                         steamId=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=[0-9]*, name=.*, steamid=\([0-9]*\), ip=[0-9.]*$')
    107                         ip=$(expr "$line" : 'Player connected, clientid=[0-9]*, entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=\([0-9.]*\)$')
     103                        entityId=$(expr "$line" : 'Player connected, entityid=\([0-9]*\), name=.*, steamid=[0-9]*, ip=[0-9.]*$')
     104                        playerName=$(expr "$line" : 'Player connected, entityid=[0-9]*, name=\(.*\), steamid=[0-9]*, ip=[0-9.]*$')
     105                        steamId=$(expr "$line" : 'Player connected, entityid=[0-9]*, name=.*, steamid=\([0-9]*\), ip=[0-9.]*$')
     106                        ip=$(expr "$line" : 'Player connected, entityid=[0-9]*, name=.*, steamid=[0-9]*, ip=\([0-9.]*\)$')
    108107                        sleep 1
    109                         handleConnect "$clientId" "$entityId" "$playerName" "$steamId" "$ip"
    110                         unset clientId entityId playerName steamId ip
     108                        handleConnect "$entityId" "$playerName" "$steamId" "$ip"
     109                        unset entityId playerName steamId ip
    111110                else
    112                 #Removing player with id clientId=[0-9]*, entityId=[0-9]*$
    113                 if [ -n "$(echo "$line" | grep '^Removing player with id ')" ]; then
    114                         playerId=$(expr "$line" : 'Removing player with id clientId=\([0-9]*\), entityId=[0-9]*$')
    115                         entityId=$(expr "$line" : 'Removing player with id clientId=[0-9]*, entityId=\([0-9]*\)$')
     111                #Player disconnected: EntityID=[0-9]*, PlayerID='[0-9]*', OwnerID='[0-9]*', PlayerName='.*'$
     112                if [ -n "$(echo "$line" | grep '^Player disconnected: ')" ]; then
     113                        playerId=$(expr "$line" : "Player disconnected: EntityID=[0-9]*, PlayerID='\([0-9]*\)', OwnerID='[0-9]*', PlayerName='.*'$")
     114                        entityId=$(expr "$line" : "Player disconnected: EntityID=\([0-9]*\), PlayerID='[0-9]*', OwnerID='[0-9]*', PlayerName='.*'$")
    116115                        handleDisconnect "$playerId" "$entityId"
    117116                        unset playerId entityId
     
    123122                        unset msg
    124123                else
    125                 #Executed command ".*" from player ".*"$
    126                 if [ -n "$(echo "$line" | grep '^Executed command ')" ]; then
    127                         cmd=$(expr "$line" : 'Executed command "\(.*\)" from player ".*"$')
    128                         nick=$(expr "$line" : 'Executed command ".*" from player "\(.*\)"$')
     124                #Executing command ".*" from client ".*"$
     125                if [ -n "$(echo "$line" | grep '^Executing command '.*' from client')" ]; then
     126                        cmd=$(expr "$line" : "Executing command '\(.*\)' from client .*$")
     127                        nick=$(expr "$line" : "Executing command '.*' from client \(.*\)$")
    129128                        handleRemoteCommand "$cmd" "$nick"
    130129                        unset cmd nick
    131130                else
    132                 #Telnet executed ".*" from: .*$
    133                 if [ -n "$(echo "$line" | grep '^Telnet executed ')" ]; then
    134                         cmd=$(expr "$line" : 'Telnet executed "\(.*\)" from: .*$')
    135                         ip=$(expr "$line" : 'Telnet executed ".*" from: \(.*\)$')
     131                #Executing command ".*" by Telnet from .*$
     132                if [ -n "$(echo "$line" | grep '^Executing command '.*' by Telnet from ')" ]; then
     133                        cmd=$(expr "$line" : "Executing command '\(.*\)' by Telnet from .*$")
     134                        ip=$(expr "$line" : "Executing command '.*' by Telnet from \(.*\)$")
    136135                        handleTelnetCommand "$cmd" "$ip"
    137136                        unset cmd ip
Note: See TracChangeset for help on using the changeset viewer.