- Timestamp:
- Jul 12, 2014, 4:09:13 PM (10 years ago)
- Location:
- scripts/usr/local/lib/7dtd
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/usr/local/lib/7dtd/VERSION
r70 r71 1 Version: 2 81 Version: 29 2 2 Release: 2014-07-12 -
scripts/usr/local/lib/7dtd/playerlog.sh
r67 r71 10 10 # Create empty player list if not existing 11 11 createPlayerList() { 12 if [ ! -f $PLAYERSXML ]; then 12 if [ ! -f "$PLAYERSXML" ]; then 13 echo "<Players/>" > $PLAYERSXML 14 fi 15 if [ -z "$(cat $PLAYERSXML)" ]; then 13 16 echo "<Players/>" > $PLAYERSXML 14 17 fi … … 20 23 $XMLSTARLET ed -L \ 21 24 -u "/Players/Player/@online" -v "false" \ 22 $PLAYERSXML25 "$PLAYERSXML" 23 26 } 24 27 … … 34 37 NICKNAME="$4" 35 38 36 echo "$(timestamp) +++ $ENTITYID $NICKNAME $STEAMID" >> $PLAYERSLOG39 echo "$(timestamp) +++ $ENTITYID $NICKNAME $STEAMID" >> "$PLAYERSLOG" 37 40 38 41 createPlayerList … … 40 43 XPATHBASE="/Players/Player[@steamid='$STEAMID']" 41 44 42 if [ -z $($XMLSTARLET sel -t -v "$XPATHBASE/@steamid" $PLAYERSXML) ]; then45 if [ -z $($XMLSTARLET sel -t -v "$XPATHBASE/@steamid" "$PLAYERSXML") ]; then 43 46 $XMLSTARLET ed -L \ 44 47 -s "/Players" -t elem -n "Player" -v "" \ … … 50 53 -i "$XPATHBASE" -t attr -n "online" -v "true" \ 51 54 -i "$XPATHBASE" -t attr -n "entityid" -v "$ENTITYID" \ 52 $PLAYERSXML55 "$PLAYERSXML" 53 56 else 54 LOGINS=$($XMLSTARLET sel -t -v "$XPATHBASE/@logins" $PLAYERSXML)57 LOGINS=$($XMLSTARLET sel -t -v "$XPATHBASE/@logins" "$PLAYERSXML") 55 58 (( LOGINS++ )) 56 59 $XMLSTARLET ed -L \ … … 59 62 -u "$XPATHBASE/@entityid" -v "$ENTITYID" \ 60 63 -u "$XPATHBASE/@logins" -v "$LOGINS" \ 61 $PLAYERSXML64 "$PLAYERSXML" 62 65 fi 63 66 } … … 75 78 76 79 if [ -f $PLAYERSXML ]; then 77 if [ ! -z $($XMLSTARLET sel -t -v "$XPATHBASE/@steamid" $PLAYERSXML) ]; then78 NICKNAME=$($XMLSTARLET sel -t -v "$XPATHBASE/@nick" $PLAYERSXML)79 STEAMID=$($XMLSTARLET sel -t -v "$XPATHBASE/@steamid" $PLAYERSXML)80 LOGINTIME=$($XMLSTARLET sel -t -v "$XPATHBASE/@lastlogin" $PLAYERSXML)81 PLAYTIME=$($XMLSTARLET sel -t -v "$XPATHBASE/@playtime" $PLAYERSXML)80 if [ ! -z $($XMLSTARLET sel -t -v "$XPATHBASE/@steamid" "$PLAYERSXML") ]; then 81 NICKNAME=$($XMLSTARLET sel -t -v "$XPATHBASE/@nick" "$PLAYERSXML") 82 STEAMID=$($XMLSTARLET sel -t -v "$XPATHBASE/@steamid" "$PLAYERSXML") 83 LOGINTIME=$($XMLSTARLET sel -t -v "$XPATHBASE/@lastlogin" "$PLAYERSXML") 84 PLAYTIME=$($XMLSTARLET sel -t -v "$XPATHBASE/@playtime" "$PLAYERSXML") 82 85 NOW=$(date '+%s') 83 86 PLAYTIME=$(( PLAYTIME + NOW - LOGINTIME )) … … 85 88 -u "$XPATHBASE/@playtime" -v "$PLAYTIME" \ 86 89 -u "$XPATHBASE/@online" -v "false" \ 87 $PLAYERSXML90 "$PLAYERSXML" 88 91 fi 89 92 fi 90 93 91 echo "$(timestamp) --- $ENTITYID $NICKNAME $STEAMID" >> $PLAYERSLOG94 echo "$(timestamp) --- $ENTITYID $NICKNAME $STEAMID" >> "$PLAYERSLOG" 92 95 } 93 96
Note:
See TracChangeset
for help on using the changeset viewer.