Changeset 482 for scripts/usr/local/lib/7dtd/monitor-log.sh
- Timestamp:
- Nov 14, 2023, 5:44:17 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/usr/local/lib/7dtd/monitor-log.sh
r344 r482 37 37 local entityId="$1" 38 38 local name="$2" 39 local steamId="$3" 40 local ip="$4" 41 local ownerId="$5" 39 local platformId="$3" 40 local crossId="$4" 41 local ip="$5" 42 local ownerId="$6" 42 43 43 logPlayerConnect $INSTANCE "$entityId" "$name" "$ steamId" "$ip" "$ownerId"44 logPlayerConnect $INSTANCE "$entityId" "$name" "$platformId" "$crossId" "$ip" "$ownerId" 44 45 45 46 for H in $(getHooksFor playerConnect $INSTANCE); do 46 $H $INSTANCE "$entityId" "$name" "$ steamId" "$ip" "$ownerId"47 $H $INSTANCE "$entityId" "$name" "$platformId" "$ip" "$ownerId" "$crossId" 47 48 done 48 49 } 49 50 50 51 handleDisconnect() { 51 local playerId="$1" 52 local entityId="$2" 52 local entityId="$1" 53 53 54 54 logPlayerDisconnect $INSTANCE "$entityId" 55 55 56 56 for H in $(getHooksFor playerDisconnect $INSTANCE); do 57 $H $INSTANCE "$ playerId" "$entityId" "$NICKNAME" "$STEAMID"57 $H $INSTANCE "$entityId" "$NICKNAME" "$PLATFORMID" "$IP" "$OWNERID" "$CROSSID" 58 58 done 59 59 } … … 61 61 handlePlayerSpawnedInWorld() { 62 62 local entityId="$1" 63 local playerId="$2" 64 local ownerId="$3" 65 local playerName="$4" 66 local reason="$5" 67 local position="$6" 63 local platformId="$2" 64 local crossId="$3" 65 local ownerId="$4" 66 local playerName="$5" 67 local reason="$6" 68 local position="$7" 68 69 69 70 for H in $(getHooksFor playerSpawned $INSTANCE); do 70 $H $INSTANCE "$entityId" "$pla yerId" "$ownerId" "$playerName" "$reason" "$position"71 $H $INSTANCE "$entityId" "$platformId" "$ownerId" "$playerName" "$reason" "$position" "$crossId" 71 72 done 72 73 } … … 135 136 while read line ; do 136 137 if [ -n "$line" ]; then 137 #Player connected, entityid=1278, name=termo2, steamid=76561197997439820, steamOwner=76561197997439820, ip=178.203.27.140138 #Player connected, entityid=1278, name=termo2, pltfmid=Steam_76561197997439820, crossid=EOS_eab...421, steamOwner=Steam_76561197997439820, ip=178.203.27.140 138 139 #Player connected, entityid=[0-9]*, name=.*, steamid=[0-9]*, steamOwner=[0-9]*, ip=[a-fA-F:0-9.]*$ 139 140 if [ -n "$(echo "$line" | grep '^Player connected,')" ]; then 140 entityId=$(expr "$line" : 'Player connected, entityid=\([0-9]*\), name=.*, steamid=[0-9]*, steamOwner=[0-9]*, ip=[a-fA-F:0-9.]*$') 141 playerName=$(expr "$line" : 'Player connected, entityid=[0-9]*, name=\(.*\), steamid=[0-9]*, steamOwner=[0-9]*, ip=[a-fA-F:0-9.]*$') 142 steamId=$(expr "$line" : 'Player connected, entityid=[0-9]*, name=.*, steamid=\([0-9]*\), steamOwner=[0-9]*, ip=[a-fA-F:0-9.]*$') 143 steamOwner=$(expr "$line" : 'Player connected, entityid=[0-9]*, name=.*, steamid=[0-9]*, steamOwner=\([0-9]*\), ip=[a-fA-F:0-9.]*$') 144 ip=$(expr "$line" : 'Player connected, entityid=[0-9]*, name=.*, steamid=[0-9]*, steamOwner=[0-9]*, ip=\([a-fA-F:0-9.]*\)$') 141 entityId=$(expr "$line" : 'Player connected, entityid=\([0-9]*\), name=.*, pltfmid=.*, crossid=.*, steamOwner=.*, ip=[a-fA-F:0-9.]*$') 142 playerName=$(expr "$line" : 'Player connected, entityid=[0-9]*, name=\(.*\), pltfmid=.*, crossid=.*, steamOwner=.*, ip=[a-fA-F:0-9.]*$') 143 platformId=$(expr "$line" : 'Player connected, entityid=[0-9]*, name=.*, pltfmid=\(.*\), crossid=.*, steamOwner=.*, ip=[a-fA-F:0-9.]*$') 144 crossId=$(expr "$line" : 'Player connected, entityid=[0-9]*, name=.*, pltfmid=.*, crossid=\(.*\), steamOwner=.*, ip=[a-fA-F:0-9.]*$') 145 steamOwner=$(expr "$line" : 'Player connected, entityid=[0-9]*, name=.*, pltfmid=.*, crossid=.*, steamOwner=\(.*\), ip=[a-fA-F:0-9.]*$') 146 ip=$(expr "$line" : 'Player connected, entityid=[0-9]*, name=.*, pltfmid=.*, crossid=.*, steamOwner=.*, ip=\([a-fA-F:0-9.]*\)$') 145 147 sleep 1 146 handleConnect "$entityId" "$playerName" "$ steamId" "$ip" "$steamOwner"147 unset entityId playerName steamId steamOwner ip148 handleConnect "$entityId" "$playerName" "$platformId" "$crossId" "$ip" "$steamOwner" 149 unset entityId playerName platformId crossId steamOwner ip 148 150 #Player disconnected: EntityID=[0-9]*, PlayerID='[0-9]*', OwnerID='[0-9]*', PlayerName='.*'$ 149 151 elif [ -n "$(echo "$line" | grep '^Player disconnected: ')" ]; then 150 playerId=$(expr "$line" : "Player disconnected: EntityID=[0-9]*, PlayerID='\([0-9]*\)', OwnerID='[0-9]*', PlayerName='.*'$") 151 entityId=$(expr "$line" : "Player disconnected: EntityID=\([0-9]*\), PlayerID='[0-9]*', OwnerID='[0-9]*', PlayerName='.*'$") 152 handleDisconnect "$playerId" "$entityId" 153 unset playerId entityId 154 #PlayerSpawnedInWorld (reason: .+, position: [0-9]+, [0-9]+, [0-9]+): EntityID=[0-9]+, PlayerID='[0-9]+', OwnerID='[0-9]+', PlayerName='.*' 152 entityId=$(expr "$line" : "Player disconnected: EntityID=\(.*\), PltfmId='.*$") 153 handleDisconnect "$entityId" 154 unset entityId 155 #PlayerSpawnedInWorld (reason: .*, position: .*, .*, .*): EntityID=.*, PltfmId='.*', CrossId='.*', OwnerID='.*', PlayerName='.*', ClientNumber='.*' 155 156 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 157 reason=$(expr "$line" : "PlayerSpawnedInWorld (reason: \(.*\), position: .*, .*, .*): EntityID=.*, PltfmId='.*', CrossId='.*', OwnerID='.*', PlayerName='.*', ClientNumber='.*'$") 158 position=$(expr "$line" : "PlayerSpawnedInWorld (reason: .*, position: \(.*, .*, .*\)): EntityID=.*, PltfmId='.*', CrossId='.*', OwnerID='.*', PlayerName='.*', ClientNumber='.*'$") 159 entityId=$(expr "$line" : "PlayerSpawnedInWorld (reason: .*, position: .*, .*, .*): EntityID=\(.*\), PltfmId='.*', CrossId='.*', OwnerID='.*', PlayerName='.*', ClientNumber='.*'$") 160 platformId=$(expr "$line" : "PlayerSpawnedInWorld (reason: .*, position: .*, .*, .*): EntityID=.*, PltfmId='\(.*\)', CrossId='.*', OwnerID='.*', PlayerName='.*', ClientNumber='.*'$") 161 crossId=$(expr "$line" : "PlayerSpawnedInWorld (reason: .*, position: .*, .*, .*): EntityID=.*, PltfmId='.*', CrossId='\(.*\)', OwnerID='.*', PlayerName='.*', ClientNumber='.*'$") 162 ownerId=$(expr "$line" : "PlayerSpawnedInWorld (reason: .*, position: .*, .*, .*): EntityID=.*, PltfmId='.*', CrossId='.*', OwnerID='\(.*\)', PlayerName='.*', ClientNumber='.*'$") 163 playerName=$(expr "$line" : "PlayerSpawnedInWorld (reason: .*, position: .*, .*, .*): EntityID=.*, PltfmId='.*', CrossId='.*', OwnerID='.*', PlayerName='\(.*\)', ClientNumber='.*'$") 164 handlePlayerSpawnedInWorld "$entityId" "$platformId" "$crossId" "$ownerId" "$playerName" "$reason" "$position" 165 unset reason position entityId platformId crossId ownerId playerName 164 166 #GMSG: .*$ 165 167 elif [ -n "$(echo "$line" | grep -E '^GMSG: .+')" ]; then … … 169 171 #Chat (from '<steamid>', entity id '<entityid>', to '<targettype>'): '<senderchatname>': <msg> 170 172 elif [ -n "$(echo "$line" | grep -E '^Chat .+')" ]; then 171 steamId=$(expr "$line" : "Chat (from '\(. +\)', entity id '[0-9]+', to '[a-fA-F:0-9.]+'): '.*': .*$")172 entityId=$(expr "$line" : "Chat (from '. +', entity id '\([0-9]+\)', to '[a-fA-F:0-9.]+'): '.*': .*$")173 targetType=$(expr "$line" : "Chat (from '. +', entity id '[0-9]+', to '\([a-fA-F:0-9.]+\)'): '.*': .*$")174 name=$(expr "$line" : "Chat (from '. +', entity id '[0-9]+', to '[a-fA-F:0-9.]+'): '\(.*\)': .*$")175 msg=$(expr "$line" : "Chat (from '. +', entity id '[0-9]+', to '[a-fA-F:0-9.]+'): '.*': \(.*\)$")173 steamId=$(expr "$line" : "Chat (from '\(.*\)', entity id '.*', to '.*'): '.*': .*$") 174 entityId=$(expr "$line" : "Chat (from '.*', entity id '\(.*\)', to '.*'): '.*': .*$") 175 targetType=$(expr "$line" : "Chat (from '.*', entity id '.*', to '\(.*\)'): '.*': .*$") 176 name=$(expr "$line" : "Chat (from '.*', entity id '.*', to '.*'): '\(.*\)': .*$") 177 msg=$(expr "$line" : "Chat (from '.*', entity id '.*', to '.*'): '.*': \(.*\)$") 176 178 handleChat "$name" "$msg" "$steamId" "$entityId" "$targetType" 177 179 unset name msg steamId entityId targetType
Note:
See TracChangeset
for help on using the changeset viewer.