server/src/scripts/wdw-run.lua

67 lines
1.3 KiB
Lua
Raw Normal View History

2004-08-21 14:02:45 +02:00
function process(orders)
-- read game and orders
2003-12-28 16:30:43 +01:00
local turnfile = "" .. get_turn()
if read_game(turnfile)~=0 then
print("could not read game")
return -1
end
2004-08-21 14:02:45 +02:00
-- read the orders file
read_orders(orders)
-- set up the sphinx
-- init_sphinxhints()
sphinx_handler()
2004-08-21 14:02:45 +02:00
sphinx_weekly()
-- run the turn:
-- (no more braineaters) spawn_braineaters(0.25)
plan_monsters()
2003-12-28 16:30:43 +01:00
process_orders()
update_guards()
update_scores()
-- write out the initial reports (no need to run a turn)
write_passwords()
write_reports()
2005-11-21 22:22:00 +01:00
write_emails()
write_summary()
2004-08-21 14:02:45 +02:00
-- siegbedingungen ausgeben
write_standings()
2004-08-21 14:02:45 +02:00
-- save the game
outfile = "" .. get_turn()
2003-12-18 00:11:52 +01:00
if write_game(outfile)~=0 then
print("could not write game")
return -1
end
end
2004-08-21 14:02:45 +02:00
--
-- main body of script
--
print("- Running wdw-run.lua")
scripts = {
"spells.lua",
"extensions.lua",
2004-08-21 14:02:45 +02:00
"wdw-sphinx.lua",
"wdw-standings.lua"
}
2004-08-21 14:02:45 +02:00
-- orderfile: contains the name of the orders.
if orderfile==nil then
print "you must specify an orderfile"
else
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
process(orderfile)
end