Changeset 308 for scripts/usr/local/lib/7dtd/monitor-log.sh
- Timestamp:
- Aug 7, 2017, 7:18:35 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/usr/local/lib/7dtd/monitor-log.sh
r298 r308 56 56 for H in $(getHooksFor playerDisconnect $INSTANCE); do 57 57 $H $INSTANCE "$playerId" "$entityId" "$NICKNAME" "$STEAMID" 58 done 59 } 60 61 handlePlayerSpawnedInWorld() { 62 local entityId="$1" 63 local playerId="$2" 64 local ownerId="$3" 65 local playerName="$4" 66 local reason="$5" 67 local position="$6" 68 69 for H in $(getHooksFor playerSpawned $INSTANCE); do 70 $H $INSTANCE "$entityId" "$playerId" "$ownerId" "$playerName" "$reason" "$position" 58 71 done 59 72 } … … 133 146 handleConnect "$entityId" "$playerName" "$steamId" "$ip" "$steamOwner" 134 147 unset entityId playerName steamId steamOwner ip 135 else136 148 #Player disconnected: EntityID=[0-9]*, PlayerID='[0-9]*', OwnerID='[0-9]*', PlayerName='.*'$ 137 if [ -n "$(echo "$line" | grep '^Player disconnected: ')" ]; then149 elif [ -n "$(echo "$line" | grep '^Player disconnected: ')" ]; then 138 150 playerId=$(expr "$line" : "Player disconnected: EntityID=[0-9]*, PlayerID='\([0-9]*\)', OwnerID='[0-9]*', PlayerName='.*'$") 139 151 entityId=$(expr "$line" : "Player disconnected: EntityID=\([0-9]*\), PlayerID='[0-9]*', OwnerID='[0-9]*', PlayerName='.*'$") 140 152 handleDisconnect "$playerId" "$entityId" 141 153 unset playerId entityId 142 else 154 #PlayerSpawnedInWorld (reason: .+, position: [0-9]+, [0-9]+, [0-9]+): EntityID=[0-9]+, PlayerID='[0-9]+', OwnerID='[0-9]+', PlayerName='.*' 155 elif [ -n "$(echo "$line" | grep '^PlayerSpawnedInWorld ')" ]; then 156 reason=$(expr "$line" : "PlayerSpawnedInWorld (reason: \(.+\), position: [0-9]+, [0-9]+, [0-9]+): EntityID=[0-9]+, PlayerID='[0-9]+', OwnerID='[0-9]+', PlayerName='.*'$") 157 position=$(expr "$line" : "PlayerSpawnedInWorld (reason: .+, position: \([0-9]+, [0-9]+, [0-9]+\)): EntityID=[0-9]+, PlayerID='[0-9]+', OwnerID='[0-9]+', PlayerName='.*'$") 158 entityId=$(expr "$line" : "PlayerSpawnedInWorld (reason: .+, position: [0-9]+, [0-9]+, [0-9]+): EntityID=\([0-9]+\), PlayerID='[0-9]+', OwnerID='[0-9]+', PlayerName='.*'$") 159 playerId=$(expr "$line" : "PlayerSpawnedInWorld (reason: .+, position: [0-9]+, [0-9]+, [0-9]+): EntityID=[0-9]+, PlayerID='\([0-9]+\)', OwnerID='[0-9]+', PlayerName='.*'$") 160 ownerId=$(expr "$line" : "PlayerSpawnedInWorld (reason: .+, position: [0-9]+, [0-9]+, [0-9]+): EntityID=[0-9]+, PlayerID='[0-9]+', OwnerID='\([0-9]+\)', PlayerName='.*'$") 161 playerName=$(expr "$line" : "PlayerSpawnedInWorld (reason: .+, position: [0-9]+, [0-9]+, [0-9]+): EntityID=[0-9]+, PlayerID='[0-9]+', OwnerID='[0-9]+', PlayerName='\(.*\)'$") 162 handlePlayerSpawnedInWorld "$entityId" "$playerId" "$ownerId" "$playerName" "$reason" "$position" 163 unset reason position entityId playerId ownerId playerName 143 164 #GMSG: .*$ 144 if [ -n "$(echo "$line" | grep -E '^GMSG: .+')" ]; then165 elif [ -n "$(echo "$line" | grep -E '^GMSG: .+')" ]; then 145 166 msg=$(expr "$line" : 'GMSG: \(.*\)$') 146 167 handleGmsg "$msg" 147 168 unset msg 148 else149 169 #Chat: 'name': .*$ 150 if [ -n "$(echo "$line" | grep -E '^Chat: .+')" ]; then170 elif [ -n "$(echo "$line" | grep -E '^Chat: .+')" ]; then 151 171 name=$(expr "$line" : "Chat: '\(.*\)': .*$") 152 172 msg=$(expr "$line" : "Chat: '.*': \(.*\)$") 153 173 handleChat "$name" "$msg" 154 174 unset name msg 155 else156 175 #Executing command ".*" from client ".*"$ 157 if [ -n "$(echo "$line" | grep '^Executing command '.*' from client')" ]; then176 elif [ -n "$(echo "$line" | grep '^Executing command '.*' from client')" ]; then 158 177 cmd=$(expr "$line" : "Executing command '\(.*\)' from client .*$") 159 178 nick=$(expr "$line" : "Executing command '.*' from client \(.*\)$") 160 179 handleRemoteCommand "$cmd" "$nick" 161 180 unset cmd nick 162 else163 181 #Executing command ".*" by Telnet from .*$ 164 if [ -n "$(echo "$line" | grep '^Executing command '.*' by Telnet from ')" ]; then182 elif [ -n "$(echo "$line" | grep '^Executing command '.*' by Telnet from ')" ]; then 165 183 cmd=$(expr "$line" : "Executing command '\(.*\)' by Telnet from .*$") 166 184 ip=$(expr "$line" : "Executing command '.*' by Telnet from \(.*\)$") … … 168 186 unset cmd ip 169 187 fi 170 fi171 fi172 fi173 fi174 fi175 188 fi 176 189 done
Note:
See TracChangeset
for help on using the changeset viewer.