From dda0fd9d27f503c9dd294c1bcdf86f359152fbac Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 20 Jan 2019 02:48:14 +0100 Subject: [PATCH 1/4] fix sendreport script --- process/getfaction.py | 32 ++++++++++++++++++++++++++++++++ process/sendreport.sh | 5 +++-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100755 process/getfaction.py diff --git a/process/getfaction.py b/process/getfaction.py new file mode 100755 index 000000000..005ccfc4d --- /dev/null +++ b/process/getfaction.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +import sys, re +from epasswd import EPasswd + +if len(sys.argv)<4: + sys.exit(-2) + +filename=sys.argv[1] +myfaction=sys.argv[2] +quiet=len(sys.argv)<=3 + +def log(str): + if not quiet: + print(str) + +pw_data = EPasswd() +try: + pw_data.load_database(filename) + log("loaded from db " + filename) +except: + pw_data.load_file(filename) + log("loaded from file " + filename) + +if pw_data.fac_exists(myfaction): + log("faction found: " + myfaction) + print(pw_data.get_email(myfaction)) + sys.exit(0) +else: + log("faction missing: " + myfaction) + +sys.exit(-1) diff --git a/process/sendreport.sh b/process/sendreport.sh index 7b1afccf0..f61db1a9c 100755 --- a/process/sendreport.sh +++ b/process/sendreport.sh @@ -30,11 +30,12 @@ LOCKFILE="$ERESSEA/.report.lock" echo "$(date):report:$GAME:$EMAIL:$FACTION:$PASSWD" >> "$ERESSEA/request.log" cd "$ERESSEA" || exit +BIN="$ERESSEA/server/bin" PWFILE="game-$GAME/eressea.db" if [ ! -e "$PWFILE" ]; then PWFILE="game-$GAME/passwd" fi -checkpasswd.py "$PWFILE" "$FACTION" "$PASSWD" || reply "Das Passwort fuer die Partei $FACTION ist ungueltig" +$BIN/checkpasswd.py "$PWFILE" "$FACTION" "$PASSWD" || reply "Das Passwort fuer die Partei $FACTION ist ungueltig" cd "$ERESSEA/game-$GAME/reports" || exit if [ ! -e "${FACTION}.sh" ]; then @@ -45,7 +46,7 @@ fi bash "${FACTION}.sh" "$EMAIL" || reply "Unbekannte Partei $FACTION" -OWNER=$(getfaction.py "$PWFILE" "$FACTION") +OWNER=$($BIN/getfaction.py "$PWFILE" "$FACTION") if [ ! -z "$OWNER" ]; then echo "Der Report Deiner Partei wurde an ${EMAIL} gesandt." \ | mutt -s "Reportnachforderung Partei ${FACTION}" "$OWNER" From 8eba9d6eafdbe369e54ba5c7287c0f63709b4255 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 20 Jan 2019 03:06:33 +0100 Subject: [PATCH 2/4] fix getfaction script, return email --- process/getfaction.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/process/getfaction.py b/process/getfaction.py index 005ccfc4d..11350ec8a 100755 --- a/process/getfaction.py +++ b/process/getfaction.py @@ -3,7 +3,7 @@ import sys, re from epasswd import EPasswd -if len(sys.argv)<4: +if len(sys.argv)<3: sys.exit(-2) filename=sys.argv[1] @@ -23,8 +23,8 @@ except: log("loaded from file " + filename) if pw_data.fac_exists(myfaction): - log("faction found: " + myfaction) print(pw_data.get_email(myfaction)) + log("faction found: " + myfaction) sys.exit(0) else: log("faction missing: " + myfaction) From 55c8b9f72aa4ad46bc489656aa88c5009e826013 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 20 Jan 2019 03:08:37 +0100 Subject: [PATCH 3/4] fix shellcheck --- process/received.sh | 1 + process/sendreport.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/process/received.sh b/process/received.sh index 817186000..9a0c4511d 100644 --- a/process/received.sh +++ b/process/received.sh @@ -1 +1,2 @@ +#!/bin/sh grep -hiw ERESSEA orders.dir/turn-* | cut -d\ -f2 | sort -u diff --git a/process/sendreport.sh b/process/sendreport.sh index f61db1a9c..d38b2a14f 100755 --- a/process/sendreport.sh +++ b/process/sendreport.sh @@ -35,7 +35,7 @@ PWFILE="game-$GAME/eressea.db" if [ ! -e "$PWFILE" ]; then PWFILE="game-$GAME/passwd" fi -$BIN/checkpasswd.py "$PWFILE" "$FACTION" "$PASSWD" || reply "Das Passwort fuer die Partei $FACTION ist ungueltig" +"$BIN/checkpasswd.py" "$PWFILE" "$FACTION" "$PASSWD" || reply "Das Passwort fuer die Partei $FACTION ist ungueltig" cd "$ERESSEA/game-$GAME/reports" || exit if [ ! -e "${FACTION}.sh" ]; then @@ -46,7 +46,7 @@ fi bash "${FACTION}.sh" "$EMAIL" || reply "Unbekannte Partei $FACTION" -OWNER=$($BIN/getfaction.py "$PWFILE" "$FACTION") +OWNER=$("$BIN/getfaction.py" "$PWFILE" "$FACTION") if [ ! -z "$OWNER" ]; then echo "Der Report Deiner Partei wurde an ${EMAIL} gesandt." \ | mutt -s "Reportnachforderung Partei ${FACTION}" "$OWNER" From 148146d94eb3ce2d08cc5383c375b9a7bcd52da9 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 21 Jan 2019 11:00:31 +0100 Subject: [PATCH 4/4] BUG 2540: Vertraute ohne Auraim CR repariert --- src/creport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/creport.c b/src/creport.c index 3ac9dffe9..b3445f5e1 100644 --- a/src/creport.c +++ b/src/creport.c @@ -915,7 +915,8 @@ void cr_output_unit(stream *out, const faction * f, if (fval(u, UFL_HUNGER) && (u->faction == f)) { stream_printf(out, "1;hunger\n"); } - if (is_mage(u)) { + mage = get_mage(u); + if (mage) { stream_printf(out, "%d;Aura\n", get_spellpoints(u)); stream_printf(out, "%d;Auramax\n", max_spellpoints_depr(u->region, u)); } @@ -957,7 +958,6 @@ void cr_output_unit(stream *out, const faction * f, } /* spells that this unit can cast */ - mage = get_mage(u); if (mage) { int maxlevel = effskill(u, SK_MAGIC, 0); cr_output_spells(out, u, maxlevel);