summaryrefslogtreecommitdiff
path: root/tmw-info
diff options
context:
space:
mode:
Diffstat (limited to 'tmw-info')
-rwxr-xr-xtmw-info230
1 files changed, 39 insertions, 191 deletions
diff --git a/tmw-info b/tmw-info
index e37a654..8282ffc 100755
--- a/tmw-info
+++ b/tmw-info
@@ -7,6 +7,8 @@
# Ledmitz (2020) - GPL 3.0
+# Chat logs DIR
+CHAT_LOGS="$HOME/.local/share/mana/logs/server.themanaworld.org/"
months=(01 02 03 04 05 06 07 08 09 10 11 12)
thisYear=$(date -u +'%Y')
thisMonth=$(date -u +'%m')
@@ -16,17 +18,8 @@ TMW_INFO="$HOME/.tmw-info"
ITEM_DIR="$TMW_INFO/item"
# Monster DB DIR
MOB_DIR="$TMW_INFO/mob"
-# Chat logs DIR
-CHAT_LOGS="$HOME/.local/share/mana/logs/server.themanaworld.org/"
-
-
-
-
-
-
-
-
-
+# Commands DIR
+TMW_CMDS="$TMW_INFO/cmds"
# GM Log DIR
TMW_GM_LOGS="$TMW_INFO/logs"
GM_LOG_LIST="$TMW_INFO/gm_log_list"
@@ -46,6 +39,7 @@ trap FINISH EXIT
help(){
echo "tmw-info [command] [STRING]"
echo " help / --help / -h (this help screen)"
+ echo " cmds-update (downloads command source files. Should be run before using \"cmds\")"
echo " cmds (ManaPlus and GM command reference)"
echo " news (reads game news)"
echo " online (shows online players)"
@@ -105,7 +99,7 @@ elif [ "$1" == "gm-update" ]; then
:
else
# Get the bytecounts reported by server to compare with local file
- BYTECOUNT_WEB=$(grep "gm.log.$year-$month" "$GM_LOG_LIST" | awk '{print $4}' | sed -E 's/\s//g')
+ BYTECOUNT_WEB=$(grep "gm.log.$year-$month " "$GM_LOG_LIST" | awk '{print $4}' | sed -E 's/\s//g')
BYTECOUNT_LOCAL=$(ls -l "$TMW_GM_LOGS/gm.log.$year-$month" 2> '/dev/null' | awk '{print $5}' | sed -E 's/\s//g')
#echo $BYTECOUNT_WEB
#echo $BYTECOUNT_LOCAL
@@ -113,6 +107,13 @@ elif [ "$1" == "gm-update" ]; then
echo "Downloading $month/$year"
wget -q -c -P "$TMW_GM_LOGS" "https://server.themanaworld.org/gm/gm.log.$year-$month"
fi
+ # Added for file rebuilt from corrupted (2020-09-old)
+ BYTECOUNT_WEB_OLD=$(grep "gm.log.$year-$month-old " "$GM_LOG_LIST" | awk '{print $4}' | sed -E 's/\s//g')
+ BYTECOUNT_LOCAL_OLD=$(ls -l "$TMW_GM_LOGS/gm.log.$year-$month-old" 2> '/dev/null' | awk '{print $5}' | sed -E 's/\s//g')
+ if [[ "$BYTECOUNT_WEB_OLD" != "$BYTECOUNT_LOCAL_OLD" ]]; then
+ echo "Downloading $month/$year-old"
+ wget -q -c -P "$TMW_GM_LOGS" "https://server.themanaworld.org/gm/gm.log.$year-$month-old"
+ fi
fi
done
done
@@ -136,19 +137,14 @@ elif [ "$1" == "gm-asearch" ]; then
echo 'You must run gm-update before searching'
exit 0
fi
- ## Livio > You can probably tidy this up as a for loop and an array? I'm more used to while loops
# All terms: This must not be an array
SEARCH_TERMS=$(echo "$*" | sed -E 's/^gm-asearch\s//g' | sed 's/\[/\\\[/g' | sed 's/\]/\\\]/g')
WORD_COUNT=$(echo "$SEARCH_TERMS" | wc -w)
COUNT='1'
- #echo "SEARCH_TERMS: $SEARCH_TERMS"
- #echo "WORD_COUNT: $WORD_COUNT"
- #echo "COUNT: $COUNT"
echo "========== Results (all): $SEARCH_TERMS ==========" | sed 's/\\//g'
while [ "$COUNT" -le "$WORD_COUNT" ]
do
WORD=$(echo "$SEARCH_TERMS" | awk "{print \$$COUNT}")
- #echo "WORD: $WORD"
if [ "$COUNT" = '1' ]; then
grep -hi "$WORD" "$TMW_GM_LOGS"/* > "$TMW_INFO/gm-asearch$COUNT.tmp"
else
@@ -156,8 +152,6 @@ elif [ "$1" == "gm-asearch" ]; then
fi
LAST_COUNT="$COUNT"
COUNT=$(( COUNT + 1 ))
- #echo "COUNT: $COUNT"
- #echo "LAST_COUNT: $LAST_COUNT"
done
cat "$TMW_INFO/gm-asearch$LAST_COUNT.tmp"
elif [ "$1" == "gm-esearch" ]; then
@@ -237,14 +231,10 @@ elif [ "$1" == "chat-search" ]; then
SEARCH_TERMS=$(echo "$*" | sed -E 's/^chat-search\s//g' | sed 's/\[/\\\[/g' | sed 's/\]/\\\]/g')
WORD_COUNT=$(echo "$SEARCH_TERMS" | wc -w)
COUNT='1'
- #echo "SEARCH_TERMS: $SEARCH_TERMS"
- #echo "WORD_COUNT: $WORD_COUNT"
- #echo "COUNT: $COUNT"
echo "========== Results (chat): $SEARCH_TERMS ==========" | sed 's/\\//g'
while [ "$COUNT" -le "$WORD_COUNT" ]
do
WORD=$(echo "$SEARCH_TERMS" | awk "{print \$$COUNT}")
- #echo "WORD: $WORD"
if [ "$COUNT" = '1' ]; then
grep -ir "$WORD" "$CHAT_LOGS"/* | sed -E 's/^.*server.themanaworld.org\/\///g' > "$TMW_INFO/chat-search$COUNT.tmp"
else
@@ -252,10 +242,15 @@ elif [ "$1" == "chat-search" ]; then
fi
LAST_COUNT="$COUNT"
COUNT=$(( COUNT + 1 ))
- #echo "COUNT: $COUNT"
- #echo "LAST_COUNT: $LAST_COUNT"
done
cat "$TMW_INFO/chat-search$LAST_COUNT.tmp"
+ echo -e "\nLeave blank to cancel or enter a date as Year-Month/Day/CHAT_TAB(e.g. 2015-12/25/#General) to view the log:"
+ read -p "Logfile: " CHAT
+ if [[ "$CHAT" == '' ]]; then
+ exit 0
+ else
+ cat "$CHAT_LOGS$CHAT.log" | less
+ fi
elif [ "$1" == 'item-update' ]; then
mkdir -p "$ITEM_DIR"
ITEM_FILES=($(curl -s 'https://github.com/themanaworld/tmwa-server-data/tree/master/world/map/db' | sed 's/<\/*[^>]*>//g' | grep -o 'item_db.*\.txt'))
@@ -274,14 +269,10 @@ elif [ "$1" == "item-search" ]; then
SEARCH_TERMS=$(echo "$*" | sed -E 's/^item-search\s//g' | sed 's/\[/\\\[/g' | sed 's/\]/\\\]/g')
WORD_COUNT=$(echo "$SEARCH_TERMS" | wc -w)
COUNT='1'
- #echo "SEARCH_TERMS: $SEARCH_TERMS"
- #echo "WORD_COUNT: $WORD_COUNT"
- #echo "COUNT: $COUNT"
echo "========== Results (item): $SEARCH_TERMS ==========" | sed 's/\\//g'
while [ "$COUNT" -le "$WORD_COUNT" ]
do
WORD=$(echo "$SEARCH_TERMS" | awk "{print \$$COUNT}")
- #echo "WORD: $WORD"
if [ "$COUNT" = '1' ]; then
grep -hi "$WORD" "$ITEM_DIR"/* > "$TMW_INFO/item-search$COUNT.tmp"
else
@@ -289,8 +280,6 @@ elif [ "$1" == "item-search" ]; then
fi
LAST_COUNT="$COUNT"
COUNT=$(( COUNT + 1 ))
- #echo "COUNT: $COUNT"
- #echo "LAST_COUNT: $LAST_COUNT"
done
while IFS= read -r LINE; do
echo -e "ID: $(echo "$LINE" | awk '{print $1}') Name: $(echo "$LINE" | awk '{print $2}') Type: $(echo "$LINE" | awk '{print $3}') \
@@ -320,14 +309,10 @@ elif [ "$1" == "mob-search" ]; then
SEARCH_TERMS=$(echo "$*" | sed -E 's/^mob-search\s//g' | sed 's/\[/\\\[/g' | sed 's/\]/\\\]/g')
WORD_COUNT=$(echo "$SEARCH_TERMS" | wc -w)
COUNT='1'
- #echo "SEARCH_TERMS: $SEARCH_TERMS"
- #echo "WORD_COUNT: $WORD_COUNT"
- #echo "COUNT: $COUNT"
echo "========== Results (monster): $SEARCH_TERMS ==========" | sed 's/\\//g'
while [ "$COUNT" -le "$WORD_COUNT" ]
do
WORD=$(echo "$SEARCH_TERMS" | awk "{print \$$COUNT}")
- #echo "WORD: $WORD"
if [ "$COUNT" = '1' ]; then
grep -hi "$WORD" "$MOB_DIR"/* > "$TMW_INFO/mob-search$COUNT.tmp"
else
@@ -335,8 +320,6 @@ elif [ "$1" == "mob-search" ]; then
fi
LAST_COUNT="$COUNT"
COUNT=$(( COUNT + 1 ))
- #echo "COUNT: $COUNT"
- #echo "LAST_COUNT: $LAST_COUNT"
done
while IFS= read -r LINE; do
MOB_ID=$(echo "$LINE" | awk '{print $1}' | sed 's/,//g')
@@ -355,24 +338,17 @@ elif [ "$1" == "mob-search" ]; then
fi
DROP_COUNT='1'
DROP_COUNT_MAX=$(echo "$DROP_NAMES" | wc -w)
- #echo "MOB_ID: $MOB_ID"
- #echo "DROP_IDS: ${DROP_IDS[@]}"
- #echo "DROP_NAMES: $DROP_NAMES"
- #echo "DROP_PERCS: $DROP_PERCS"
- #echo "DROP_COUNT_MAX: $DROP_COUNT_MAX"
while [ "$DROP_COUNT" -le "$DROP_COUNT_MAX" ]; do
DROP_NAME=$(echo "$DROP_NAMES" | awk "{print $"$DROP_COUNT"}")
DROP_PERC=$(echo "$DROP_PERCS" | awk "{print $"$DROP_COUNT"}")
DROP_PERCENT=$(echo "scale=2; $DROP_PERC / 100" | bc)
DROP_RATIO=$(echo "scale=2; 100 / $DROP_PERCENT" | bc | sed 's/.00$//g' )
- #echo "DROP_NAME: $DROP_NAME"
- #echo "DROP_PERC: $DROP_PERC"
echo "$DROP_NAME($DROP_PERCENT% | $DROP_RATIO:1)," >> "$TMW_INFO/mob-drops-$MOB_ID.tmp"
cat < "$TMW_INFO/mob-drops-$MOB_ID.tmp" | tr '\n' ' ' > "$TMW_INFO/mob-drops-$MOB_ID.tmp.tmp"
mv "$TMW_INFO/mob-drops-$MOB_ID.tmp.tmp" "$TMW_INFO/mob-drops-$MOB_ID.tmp"
DROP_COUNT=$(( DROP_COUNT + 1 ))
done
- DROPS=$(sed 's/^$//g' "$TMW_INFO/mob-drops-$MOB_ID.tmp" 2> '/dev/null' | sed -E 's/,\s*$//g')
+ DROPS=$(sed 's/^$//g' "$TMW_INFO/mob-drops-$MOB_ID.tmp" 2> '/dev/null' | sed -E 's/,\s*$//g' | sed -E 's/,\s*$//g')
echo -e "\
ID: $(echo "$LINE" | awk '{print $1}') NAME: $(echo "$LINE" | awk '{print $2 $3}') LVL: $(echo "$LINE" | awk '{print $4}')\n\
HP: $(echo "$LINE" | awk '{print $5}') SP: $(echo "$LINE" | awk '{print $6}') \
@@ -386,156 +362,28 @@ INT=$(echo "$LINE" | awk '{print $17}') DEX=$(echo "$LINE" | awk '{print $18}')
MUTATIONS: $(echo "$LINE" | awk '{print $56}') MUTATION STR: $(echo "$LINE" | awk '{print $57}')\n\
DROPS: $DROPS\n\
"
- done < "$TMW_INFO/mob-search$LAST_COUNT.tmp"
+ done < "$TMW_INFO/mob-search$LAST_COUNT.tmp"
+elif [ "$1" == 'update-cmds' ];then
+ mkdir -p "$TMW_CMDS"
+ echo "Downloading client commands..."
+ wget -q -c -P "$TMW_CMDS" "https://wiki.themanaworld.org/index.php/User:Jak1/sandbox/client_commands"
+ echo "Downloading \"atcommand_athena.conf...\""
+ wget -q -c -P "$TMW_CMDS" "https://github.com/themanaworld/tmwa-server-data/blob/master/world/map/conf/atcommand_athena.conf"
+ echo "Downloading \"commands...\""
+ wget -q -c -P "$TMW_CMDS" "https://github.com/themanaworld/tmwa-server-data/tree/master/world/map/npc/commands"
elif [ "$1" == 'cmds' ];then
- echo '
-/closeall - close all whispers.
-/ignoreall - add all whispers to ignore list.
-/msg NICK text, /whisper NICK text, /w NICK text - send whisper message to nick.
-/query NICK, /q NICK - open new whisper tab for nick.
-/help - show small help about chat commands.
-/target NICK - select nick as target. Can be monster or player nick.
-/targetmercenary - target closest mercenary.
-/targetpet - target pet.
-/outfit N - wear outfit number N.
-/outfit next - wear next outfit.
-/outfit prev - wear previous outfit.
-/talkpet TEXT - talk from your pet.
-/emote N - use emotion number N.
-/emotepet N - use emotion number N from your pet.
-/away, /away MSG - set away mode.
-/pseudoaway, /pseudoaway MSG - set/unset pseudo away mode.
-/follow NICK - start follow mode.
-/imitation NICK - start imitation mode.
-/heal NICK - heal nick.
-/move X Y - move to X,Y position in short distance.
-/movetotarget - move to target position.
-/movetohome - move to home position.
-/sethome - set home position.
-/navigate x y - move to position x,y in current map in any distance.
-/mail NICK MSG - send offline message to NICK. Working only in tmw server.
-/disconnect - quick disconnect from server.
-/attack - attack target.
-/atkhuman - select and attack nearest player.
-/magicattack - attack target with magic.
-/undress NICK - remove all clothes from nick. Local effect only.
-/addattack NAME - add monster to attack list.
-/addpriorityattack NAME - add monster to priority attack list.
-/removeattack NAME - remove monster from attack list.
-/addignoreattack NAME - add monster to ignore attack list.
-/setdrop N - set drop counter to requested value.
-/drop - drop N items from 0 slot.
-/dropn - drop N items from any slot.
-/info - show guild info. Only for native guilds only.
-/wait NAME - wait for nick or moster with name.
-/gm MESSAGE - send message to all online gms.
-/catchpet - try to catch pet.
-/trade NICK - start trade with nick.
-/priceload - load shop price from disc.
-/pricesave - save shop price to disc.
-/ignore NICK - add nick to ignore list.
-/unignore NICK - Remove nick from ignore list.
-/friend NICK, /befriend NICK - add nick to friends list.
-/disregard NICK - add nick to disregarded list.
-/neutral NICK - add nick to neutral relation list.
-/blacklist NICK - add nick to blacklist relation list.
-/erase NICK - add nick to erased list.
-/enemy NICK - add nick to enemies list.
-/createparty NAME - create party with selected name.
-/me text - send text to chat as /me command in irc.
-/serverignoreall - ignore all whispers on server side.
-/serverunignoreall - unignore all whispers on server side.
-/who - print online players number to chat.
-/present - print visible players number to chat.
-/all - show visible beings list in debug tab.
-/where - print current player position to chat.
-/cacheinfo - show text cache info.
-/uptime - show client uptime.
-/dumpe - dump environment variables into chat.
-/dumpg - dump graphics and some other settings to chat.
-/dumpgl - dump OpenGL version into chat.
-/dumpt - dump tests info into chat.
-/dumpogl - dump all OpenGL variables into log file.
-/dumpmods - dump all enabled mod names into chat.
-/dirs - show client dirs in debug chat tab.
-/uploadconfig - upload main config into pastebin service.
-/uploadserverconfig - upload server config into pastebin service.
-/uploadlog - upload log into pastebin service.
-/announce MESSAGE - show global message.
-/createitems - open dialog for creating items.
-/clear - clear current chat tab.
-/enablehighlight - enable highlight in current tab.
-/disablehighlight - disable highlight in current tab.
-/enableaway - enable away messages in current tab.
-/disableaway - disable away messages in current tab.
-/cleangraphics - remove all cached graphics. Useful for content developers.
-/testparticle FILENAME - set test particle on player.
-/mercenaryfire - fire mercenary.
-/firehomunculus - fire homunculus.
-/sethomunname NAME - set homunculus name.
-/setpetname NAME - set new pet name.
-/petaistart - enable pet ai.
-/petaistop - disable pet ai.
-/petmoveup - move pet one tile up.
-/petmovedown - move pet one tile down.
-/petmoveleft - move pet one tile left.
-/petmoveright - move pet one tile right.
-/petdirectup - rotate pet up.
-/petdirectdown - rotate pet down.
-/petdirectleft - rotate pet left.
-/petdirectright - rorate pet right.
-/cleanfonts - remove all cached render strings.
-/url URL - insert url into chat.
-/open URL - open url in browser.
-/help - show this help.
-/invite NICK - invite a player to your party.
-/leave - leave the party you are in.
-/kick NICK - kick someone from the party you are in.
-/notice TEXT - set notice guild text.
-/item - show party item sharing options.
-/item 0 - disable party item sharing options.
-/item 1 - enable party item sharing options.
-/exp - show party experience sharing options.
-/exp 0 - disable party experience sharing options.
-/exp 1 - enable party experience sharing options.
-@spawn
-@item
-@hugo
-@linus
-@warp
-@goto
-@jump
-@save
-@storage
-@gstorage
-@hide
-@visible
-@invisible
-@die
-@kill
-@alive
-@blvl
-@jlvl
-@pvpon
-@pvpoff
-@killmonster
-@kick
-@broadcast
-@localbroadcast
-@hairstyle
-@haircolor
-@ignorelist
-@killer
-@killable
-@summon
-@skill-learn
-@ipcheck
-'\
- | less
+ if [ ! -f "$TMW_CMDS/client_commands" ] || [ ! -f "$TMW_CMDS/atcommand_athena.conf" ] || [ ! -f "$TMW_CMDS/commands" ]; then
+ echo "You must run \"update-cmds\" first"
+ fi
+ (echo -e "\nClient Commands:"
+ cat < "$TMW_CMDS/client_commands" | sed 's/<\/*[^>]*>//g' | grep -Eo '/[a-z]+ ' | sort -n | sed -E 's/\n/\t/g'| uniq
+ echo -e "\nDefault Server \"@\" Commands:"
+ cat < "$TMW_CMDS/atcommand_athena.conf" | sed 's/<\/*[^>]*>//g' | grep -Eo '[A-Za-z0-9]+: [0-9]+'
+ echo -e "\nCustom Server \"@\" Commands:"
+ cat < "$TMW_CMDS/commands" | sed 's/<\/*[^>]*>//g' | grep -Eo '[A-Za-z0-9]+.txt' | sed 's/.txt$//g' | grep -v '^import$\|^procedures$') | less
else
echo 'Incorrect syntax'
help
exit 0
fi
-