From 0c5efc7a6185054eb88ad276bef1ca37860fdc94 Mon Sep 17 00:00:00 2001 From: Christian Schlittchen Date: Sun, 27 Nov 2005 13:40:09 +0000 Subject: [PATCH] =?UTF-8?q?write=5Femails=20auch=20f=C3=BCr=20wdw?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scripts/eressea.lua | 21 +-------------------- src/scripts/wdw-run.lua | 1 + src/scripts/write_emails.lua | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+), 20 deletions(-) create mode 100644 src/scripts/write_emails.lua diff --git a/src/scripts/eressea.lua b/src/scripts/eressea.lua index 1e2429c4a..a322a7dc0 100644 --- a/src/scripts/eressea.lua +++ b/src/scripts/eressea.lua @@ -25,6 +25,7 @@ function run_scripts() scripts = { "spells.lua", "extensions.lua", + "write_emails.lua", "eressea/eternath.lua", "eressea/wedding-jadee.lua", "eressea/ponnuki.lua" @@ -34,26 +35,6 @@ function run_scripts() end end -function write_emails() - local locales = { "de", "en" } - local files = {} - local key - for key in locales do - local locale = locales[key] - files[locale] = io.open(basepath .. "/emails." .. locale, "w") - end - - local faction - for faction in factions() do - -- print(faction.id .. " - " .. faction.locale) - files[faction.locale]:write(faction.email .. "\n") - end - - for key in files do - files[key]:close() - end -end - function process(orders) -- initialize starting equipment for new players equipment_setitem("new_faction", "conquesttoken", "1"); diff --git a/src/scripts/wdw-run.lua b/src/scripts/wdw-run.lua index 5ca23c0a0..5613d6399 100644 --- a/src/scripts/wdw-run.lua +++ b/src/scripts/wdw-run.lua @@ -54,6 +54,7 @@ print("- Running wdw-run.lua") scripts = { "spells.lua", "extensions.lua", + "write_emails.lua", "wdw/sphinx.lua", "wdw/standings.lua" } diff --git a/src/scripts/write_emails.lua b/src/scripts/write_emails.lua new file mode 100644 index 000000000..ff1c568a2 --- /dev/null +++ b/src/scripts/write_emails.lua @@ -0,0 +1,21 @@ + +function write_emails() + local locales = { "de", "en" } + local files = {} + local key + for key in locales do + local locale = locales[key] + files[locale] = io.open(basepath .. "/emails." .. locale, "w") + end + + local faction + for faction in factions() do + -- print(faction.id .. " - " .. faction.locale) + files[faction.locale]:write(faction.email .. "\n") + end + + for key in files do + files[key]:close() + end +end +