Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added optional seeding to gmtool.build_island again #1032

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9950071
version increase, 28.4 dev begins
ennorehling Aug 27, 2023
2a0c8c0
fix some static analysis warnings
ennorehling Aug 30, 2023
eb04775
rewrite equip_weapons
ennorehling Sep 1, 2023
e9343cc
simplify equip_weapons
ennorehling Sep 1, 2023
eee05ef
break infinite loops
ennorehling Sep 1, 2023
68dfdda
fix Linux compilation
ennorehling Sep 1, 2023
e4a3696
Merge pull request #1019 from eressea/weapons
ennorehling Sep 1, 2023
9a31ded
imyu tests.c
ennorehling Sep 3, 2023
1ae0050
testing cursed and notlost behavior
ennorehling Sep 4, 2023
6e5a947
Typo in Pavillon
ennorehling Sep 9, 2023
d639310
fix a crash caused by new weapons code
ennorehling Sep 9, 2023
e051528
ex unused variables
ennorehling Sep 9, 2023
85dfd9a
correct message for buildings that cannot be built
ennorehling Sep 9, 2023
75d3e83
nobuild implies unique when building.
ennorehling Sep 9, 2023
dc10a3f
Katapultmeldung repariert
ennorehling Sep 10, 2023
2e165de
fix gxx compile
ennorehling Sep 10, 2023
a51de12
long orders prevent trading
ennorehling Sep 14, 2023
062837c
additional test for trade+other long order
ennorehling Sep 15, 2023
75f5b6f
install inifile (required by compress.sh) (#1025)
stm2 Sep 16, 2023
c798184
help screen for gmtool (#1023)
stm2 Sep 16, 2023
f29e805
units without items given to peasants on QUIT (#1020)
stm2 Sep 16, 2023
8210e76
try location error 22 cause (#1027)
ennorehling Sep 16, 2023
40480d0
remove CMAKE_INSTALL_PREFIX variable
ennorehling Sep 16, 2023
a1ac7ad
print full pathname in case of error
ennorehling Sep 16, 2023
1b5059c
remove stray write_report call
ennorehling Sep 16, 2023
e2756ef
added 'O' as shortcut for loaddata (#1022)
stm2 Sep 16, 2023
6e06b28
Python3 (#1024)
stm2 Sep 17, 2023
5ae25c1
added optional seeding to gmtool.build_island again
stm2 Sep 24, 2023
073c606
fixed compilation
stm2 Sep 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ Thumbs.db
*.cfg
*.cmd
tmp/
tests/orders.txt
tests/config.lua
/tests/reports
/tests/data
/quicklist
/cutest
/critbit
Expand Down
14 changes: 6 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,10 @@ add_subdirectory (clibs)
add_subdirectory (process)
add_subdirectory (src eressea)

install(DIRECTORY etc DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.txt")
install(DIRECTORY res conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.po")
install(DIRECTORY res conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.xml")
install(DIRECTORY res conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.json")
install(DIRECTORY scripts DESTINATION ${CMAKE_INSTALL_PREFIX} PATTERN "tests" EXCLUDE)
install(DIRECTORY lunit DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.lua")
install(DIRECTORY share DESTINATION ${CMAKE_INSTALL_PREFIX})

install(DIRECTORY etc DESTINATION "." FILES_MATCHING PATTERN "*.txt")
install(DIRECTORY res conf DESTINATION "." FILES_MATCHING PATTERN "*.po")
install(DIRECTORY res conf DESTINATION "." FILES_MATCHING PATTERN "*.xml")
install(DIRECTORY res conf DESTINATION "." FILES_MATCHING PATTERN "*.json")
install(DIRECTORY scripts DESTINATION "." PATTERN "tests" EXCLUDE)
install(DIRECTORY share DESTINATION ".")

104 changes: 53 additions & 51 deletions process/accept-orders.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
import os.path
import ConfigParser
import io
from configparser import ConfigParser
import string
import logging
import sys
import subprocess
import time
import socket
import rfc822
from stat import ST_MTIME
from email.Utils import parseaddr
from email.Parser import Parser
from email.utils import parseaddr, parsedate_tz, mktime_tz
from email.parser import Parser

if sys.version_info[0] > 2:
print("this script has not yet been converted to work with python 3")
sys.exit(2)
if 'ERESSEA' in os.environ:
dir = os.environ['ERESSEA']
elif 'HOME' in os.environ:
Expand All @@ -39,7 +36,7 @@
if not os.path.exists(inifile):
print("no such file: " . inifile)
else:
config = ConfigParser.ConfigParser()
config = ConfigParser()
config.read(inifile)
if config.has_option('game', 'email'):
frommail = config.get('game', 'email')
Expand All @@ -63,57 +60,57 @@

messages = {
"multipart-en" :
"ERROR: The orders you sent contain no plaintext. " \
"The Eressea server cannot process orders containing HTML " \
"or invalid attachments, which are the reasons why this " \
"usually happens. Please change the settings of your mail " \
"software and re-send the orders.",
u"ERROR: The orders you sent contain no plaintext. " \
u"The Eressea server cannot process orders containing HTML " \
u"or invalid attachments, which are the reasons why this " \
u"usually happens. Please change the settings of your mail " \
u"software and re-send the orders.",

"multipart-de" :
"FEHLER: Die von dir eingeschickte Mail enthält keinen " \
"Text. Evtl. hast Du den Zug als HTML oder als anderweitig " \
"ungültig formatierte Mail ingeschickt. Wir können ihn " \
"deshalb nicht berücksichtigen. Schicke den Zug nochmals " \
"als reinen Text ohne Formatierungen ein.",
u"FEHLER: Die von dir eingeschickte Mail enthält keinen " \
u"Text. Evtl. hast Du den Zug als HTML oder als anderweitig " \
u"ungültig formatierte Mail ingeschickt. Wir können ihn " \
u"deshalb nicht berücksichtigen. Schicke den Zug nochmals " \
u"als reinen Text ohne Formatierungen ein.",

"maildate-de":
"Es erreichte uns bereits ein Zug mit einem späteren " \
"Absendedatum (%s > %s). Entweder ist deine " \
"Systemzeit verstellt, oder ein Zug hat einen anderen Zug von " \
"dir auf dem Transportweg überholt. Entscheidend für die " \
"Auswertungsreihenfolge ist das Absendedatum, d.h. der Date:-Header " \
"deiner Mail.",
u"Es erreichte uns bereits ein Zug mit einem späteren " \
u"Absendedatum (%s > %s). Entweder ist deine " \
u"Systemzeit verstellt, oder ein Zug hat einen anderen Zug von " \
u"dir auf dem Transportweg überholt. Entscheidend für die " \
u"Auswertungsreihenfolge ist das Absendedatum, d.h. der Date:-Header " \
u"deiner Mail.",

"maildate-en":
"The server already received an order file that was sent at a later " \
"date (%s > %s). Either your system clock is wrong, or two messages have " \
"overtaken each other on the way to the server. The order of " \
"execution on the server is always according to the Date: header in " \
"your mail.",
u"The server already received an order file that was sent at a later " \
u"date (%s > %s). Either your system clock is wrong, or two messages have " \
u"overtaken each other on the way to the server. The order of " \
u"execution on the server is always according to the Date: header in " \
u"your mail.",

"nodate-en":
"Your message did not contain a valid Date: header in accordance with RFC2822.",
u"Your message did not contain a valid Date: header in accordance with RFC2822.",

"nodate-de":
"Deine Nachricht enthielt keinen gueltigen Date: header nach RFC2822.",
u"Deine Nachricht enthielt keinen gueltigen Date: header nach RFC2822.",

"error-de":
"Fehler",
u"Fehler",

"error-en":
"Error",
u"Error",

"warning-de":
"Warnung",
u"Warnung",

"warning-en":
"Warning",
u"Warning",

"subject-de":
"Befehle angekommen",
u"Befehle angekommen",

"subject-en":
"orders received"
u"orders received"
}

# return 1 if addr is a valid email address
Expand Down Expand Up @@ -178,7 +175,7 @@ def available_file(dirname, basename):
return maxdate, filename

def formatpar(string, l=76, indent=2):
words = string.split(string)
words = string.split()
res = ""
ll = 0
first = 1
Expand All @@ -190,7 +187,7 @@ def formatpar(string, l=76, indent=2):
ll = len(word)
else:
if ll + len(word) > l:
res = res + "\n"+" "*indent+word
res = res + u"\n"+" "*indent+word
ll = len(word) + indent
else:
res = res+" "+word
Expand All @@ -199,7 +196,7 @@ def formatpar(string, l=76, indent=2):
return res+"\n"

def store_message(message, filename):
outfile = open(filename, "w")
outfile = io.open(filename, "wb")
outfile.write(message.as_string())
outfile.close()
return
Expand All @@ -225,7 +222,7 @@ def write_part(outfile, part, sender):
except:
outfile.write(msg)
return False
outfile.write("\n");
outfile.write("\n".encode('ascii'));
return True

def copy_orders(message, filename, sender, mtime):
Expand All @@ -234,13 +231,13 @@ def copy_orders(message, filename, sender, mtime):
if writeheaders:
header_dir = dirname + '/headers'
if not os.path.exists(header_dir): os.mkdir(header_dir)
outfile = open(header_dir + '/' + basename, "w")
outfile = io.open(header_dir + '/' + basename, "wb")
for name, value in message.items():
outfile.write(name + ": " + value + "\n")
outfile.write((name + ": " + value + "\n").encode('utf8', 'ignore'))
outfile.close()

found = False
outfile = open(filename, "w")
outfile = io.open(filename, "wb")
if message.is_multipart():
for part in message.get_payload():
if write_part(outfile, part, sender):
Expand Down Expand Up @@ -284,15 +281,15 @@ def accept(game, locale, stream, extend=None):
if maildate is None:
turndate = time.time()
else:
turndate = rfc822.mktime_tz(rfc822.parsedate_tz(maildate))
turndate = mktime_tz(parsedate_tz(maildate))

text_ok = copy_orders(message, filename, email, turndate)

warning, msg, fail = None, "", False
if not maildate is None:
os.utime(filename, (turndate, turndate))
logger.debug("mail date is '%s' (%d)" % (maildate, turndate))
if False and turndate < maxdate:
if turndate < maxdate:
logger.warning("inconsistent message date " + email)
warning = " (" + messages["warning-" + locale] + ")"
msg = msg + formatpar(messages["maildate-" + locale] % (time.ctime(maxdate), time.ctime(turndate)), 76, 2) + "\n"
Expand All @@ -312,14 +309,19 @@ def accept(game, locale, stream, extend=None):
savedir = savedir + "/rejected"
if not os.path.exists(savedir): os.mkdir(savedir)
maxdate, filename = available_file(savedir, prefix + email)
store_message(message, filename)
if filename is None:
logger.error("too many failed attempts")
else:
store_message(message, filename)
fail = True

if sendmail and warning is not None:
logger.warning(warning)
subject = gamename + " " + messages["subject-"+locale] + warning
ps = subprocess.Popen(['mutt', '-s', subject, email], stdin=subprocess.PIPE)
ps.communicate(msg)
ps = subprocess.Popen(['mutt', '-s', subject, email], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = ps.communicate(msg.encode("utf8", "ignore"))
if output[0] != '':
logger.warning(output[0])

if not sendmail:
print(text_ok, fail, email)
Expand All @@ -341,7 +343,7 @@ def accept(game, locale, stream, extend=None):
locale = sys.argv[2]
infile = sys.stdin
if len(sys.argv)>3:
infile = open(sys.argv[3], "r")
infile = io.open(sys.argv[3], "rt")
retval = accept(game, locale, infile, delay)
if infile!=sys.stdin:
infile.close()
Expand Down
2 changes: 1 addition & 1 deletion process/checkpasswd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import sys, re
from epasswd import EPasswd
Expand Down
9 changes: 5 additions & 4 deletions process/compress.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/usr/bin/env python
#!/usr/bin/env python3

from sys import argv, exit
import os
import io
import os.path

gamename='Eressea'

if(len(argv) >= 3):
gamename=argv[2]

template="""#!/bin/bash
template=u"""#!/bin/bash
#PATH=$PATH:$HOME/bin

addr=%(email)s
Expand All @@ -19,7 +20,7 @@

turn = argv[1]
try:
infile = open("reports.txt", "rt")
infile = io.open("reports.txt", "rt")
except:
print("%s: reports.txt file does not exist" % (argv[0], ))
exit(0)
Expand Down Expand Up @@ -78,7 +79,7 @@
if os.path.isfile(extra):
files = files + [extra]
options["files"] = ' '.join(files)
batch = open("%s.sh" % options["faction"], "wt")
batch = io.open("%s.sh" % options["faction"], "wt")
batch.write(template % options)
batch.close()
infile.close()
2 changes: 1 addition & 1 deletion process/epasswd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

import bcrypt
import sqlite3
Expand Down
2 changes: 1 addition & 1 deletion process/getemail.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import sys, re
from epasswd import EPasswd
Expand Down
2 changes: 1 addition & 1 deletion process/getfaction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import sys, re
from epasswd import EPasswd
Expand Down
2 changes: 1 addition & 1 deletion process/orders-accept
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BIN=$(dirname "$SCRIPT")
cd "$ERESSEA/game-$game"
mkdir -p orders.dir
cd orders.dir
eval "$(python2.7 "$BIN/accept-orders.py" "$@")"
eval "$("$BIN/accept-orders.py" "$@")"
if [ -e "$ACCEPT_FILE" ]
then
rm -f "$LOCKFILE"
Expand Down
2 changes: 1 addition & 1 deletion res/core/common/items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</resource>

<resource name="presspass">
<item weight="0" score="6000" cursed="yes"/>
<item cursed="yes" weight="0" score="6000"/>
</resource>

<resource name="aurafocus">
Expand Down
8 changes: 4 additions & 4 deletions res/eressea/buildings.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<eressea>
<buildings>
<building name="temple" maxsize="50" maxcapacity="2" nobuild="yes" nodestroy="yes" unique="yes" auraregen="1.00" />
<building name="portal" maxsize="2" maxcapacity="2" nobuild="yes" nodestroy="yes" unique="yes" />
<building name="pavilion" maxsize="2" maxcapacity="2" nobuild="yes" nodestroy="yes" unique="yes" />
<building name="artacademy" maxsize="100" nobuild="yes" nodestroy="yes" unique="yes"/>
<building name="temple" maxsize="50" maxcapacity="2" nobuild="yes" nodestroy="yes" auraregen="1.00"/>
<building name="portal" maxsize="2" maxcapacity="2" nobuild="yes" nodestroy="yes"/>
<building name="pavilion" maxsize="2" maxcapacity="2" nobuild="yes" nodestroy="yes"/>
<building name="artacademy" maxsize="100" nobuild="yes" nodestroy="yes"/>
</buildings>
</eressea>
4 changes: 2 additions & 2 deletions res/eressea/items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</resource>

<resource name="ring_of_levitation" appearance="ring">
<item notlost="yes" weight="0" cursed="true" use="yes" />
<item cursed="true" notlost="yes" weight="0" use="yes" />
</resource>

<resource name="birthdaycake">
Expand Down Expand Up @@ -74,7 +74,7 @@
<!-- gimmicks, etc. -->
<resource name="aog">
<!-- Amulett des Treffens -->
<item notlost="yes" cursed="true" weight="0"/>
<item cursed="true" notlost="yes" weight="0"/>
</resource>

<resource name="aoc" appearance="amulet">
Expand Down
2 changes: 1 addition & 1 deletion res/translations/strings.de.po
Original file line number Diff line number Diff line change
Expand Up @@ -4690,7 +4690,7 @@ msgid "unit_guards"
msgstr "bewacht die Region"

msgid "pavilion"
msgstr "Pavillion"
msgstr "Pavillon"

msgctxt "race"
msgid "spell_d"
Expand Down
6 changes: 1 addition & 5 deletions s/build
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
ROOT=$(git rev-parse --show-toplevel)
BUILD=build
if [ -z "$JOBS" ] ; then
if [ -e /usr/sbin/sysctl ]; then
JOBS=`sysctl -n hw.ncpu`
else
JOBS=`nproc`
fi
JOBS=`nproc`
fi
DISTCC=`which distcc`
if [ ! -z "$DISTCC" ] ; then
Expand Down
1 change: 0 additions & 1 deletion s/cmake-init
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ cat >| build/config.cmake <<HEREDOC
SET (ERESSEA_DB "$ERESSEA_DB" CACHE STRING "Database driver")
SET (LUA_DIR "$LUA_DIR" CACHE PATH "Lua root path")
SET (CMAKE_BUILD_TYPE "$BUILD" CACHE STRING "")
SET (CMAKE_INSTALL_PREFIX "$DEST" CACHE PATH "")
SET (CMAKE_LIBRARY_PATH "$LIBRARY_PATH" CACHE PATH "")
SET (CMAKE_PREFIX_PATH "$PREFIX_PATH" CACHE PATH "")
HEREDOC
Expand Down
Loading