Renaming a lot of the HSE script files, because they are more generic than I

thought they would be and can be reused.

Added HSE4 rules files.

Added sorting by Race to the mapper's newfaction list, which might be a bad
idea for automated seeding.
This commit is contained in:
Enno Rehling 2005-02-18 09:34:12 +00:00
parent b9aabcc944
commit 03b2543d30
10 changed files with 188 additions and 53 deletions

View File

@ -233,7 +233,7 @@ read_newfactions(const char * filename)
for (;;) {
faction * f = factions;
char race[20], email[64], lang[8], password[16];
newfaction *nf;
newfaction *nf, **nfi;
int bonus, subscription;
int alliance = 0;
@ -277,8 +277,13 @@ read_newfactions(const char * filename)
nf->lang = find_locale(lang);
nf->bonus = bonus;
assert(nf->race && nf->email && nf->lang);
nf->next = newfactions;
newfactions = nf;
nfi = &newfactions;
while (*nfi) {
if ((*nfi)->race==nf->race) break;
nfi=&(*nfi)->next;
}
nf->next = *nfi;
*nfi = nf;
}
fclose(F);
}

56
src/res/hse4.xml Normal file
View File

@ -0,0 +1,56 @@
<?xml version="1.0"?>
<eressea xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="messages.xml"/>
<!-- Localization -->
<xi:include href="de/strings.xml"/>
<xi:include href="en/strings.xml"/>
<xi:include href="resources.xml"/>
<xi:include href="races.xml"/>
<xi:include href="prefixes.xml"/>
<xi:include href="ships.xml"/>
<xi:include href="buildings.xml"/>
<xi:include file="terrains.xml"/>
<xi:include file="alchemy.xml"/>
<xi:include file="technologies.xml"/>
<xi:include file="skills.xml"/>
<equipment>
<item name="wood" amount="5"/>
<item name="stone" amount="10"/>
</equipment>
<game name="HSE4" welcome="eressea">
<comment>Game specific</comment>
<order name="MEINUNG" disable="yes"/>
<order name="NUMMER" disable="yes"/>
<order name="MAGIEGEBIET" disable="yes"/>
<param name="entertain.base" value="15"/>
<param name="entertain.perlevel" value="5"/>
<param name="nmr.timeout" value="20"/>
<param name="nmr.removenewbie" value="0"/>
<param name="GiveRestriction" value="3"/>
<param name="NewbieImmunity" value="4"/>
<param name="hunger.long" value="1"/>
<param name="database.gameid" value="6"/>
<param name="globalreport" value="world"/>
<param name="rules.check_overload" value="1"/>
<param name="report.mailit" value="/usr/sbin:$HOME/eressea/bin:/bin:/usr/bin:/usr/local/bin"/>
</game>
<xi:include href="eressea/de/strings.xml"/>
<xi:include href="eressea/en/strings.xml"/>
<xi:include href="eressea/races.xml"/>
<xi:include href="eressea/items-hse.xml"/>
<xi:include href="eressea/dungeons.xml"/>
<xi:include href="eressea/temple.xml"/>
<strings>
<string name="mailto">
<text locale="de">hse-server@eressea.de</text>
<text locale="en">hse-server@eressea.de</text>
</string>
<string name="mailcmd">
<text locale="de">ERESSEA BEFEHLE</text>
<text locale="en">ERESSEA ORDERS</text>
</string>
</strings>
</eressea>

View File

@ -1,6 +1,6 @@
dofile(scriptpath .. "/hse05-grails.lua")
dofile(scriptpath .. "/hse05-spoils.lua")
dofile(scriptpath .. "/hse05-buildings.lua")
dofile(scriptpath .. "/hse-grails.lua")
dofile(scriptpath .. "/hse-spoils.lua")
dofile(scriptpath .. "/hse-buildings.lua")
function write_stats(filename)
local file = io.open(reportpath .. "/" .. filename, "w")

View File

@ -1,7 +1,7 @@
function run_scripts()
scripts = {
"hse05-portals.lua",
"hse05-stats.lua"
"hse-portals.lua",
"hse-stats.lua"
}
for index in scripts do
local script = scriptpath .. "/" .. scripts[index]

74
src/scripts/hse4-run.lua Normal file
View File

@ -0,0 +1,74 @@
function run_scripts()
scripts = {
"hse-portals.lua",
"hse-stats.lua"
}
for index in scripts do
local script = scriptpath .. "/" .. scripts[index]
print("- loading " .. script)
if pcall(dofile, script)==0 then
print("Could not load " .. script)
end
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)
file = "" .. get_turn()
if read_game(file)~=0 then
print("could not read game")
return -1
end
-- run the turn:
read_orders(orders)
run_scripts()
plan_monsters()
process_orders()
write_passwords()
write_reports()
write_emails()
file = "" .. get_turn()
if write_game(file)~=0 then
print("could not write game")
return -1
end
write_stats("grails.txt")
end
--
-- main body of script
--
-- orderfile: contains the name of the orders.
if orderfile==nil then
print "you must specify an orderfile"
else
process(orderfile)
end