server/src/scripts/default.lua

79 lines
1.5 KiB
Lua
Raw Normal View History

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
2004-02-10 00:28:12 +01:00
-- 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()
2004-05-30 05:25:10 +02:00
if read_game(file)~=0 then
print("could not read game")
return -1
end
-- initialize starting equipment for new players
-- probably not necessary, since mapper sets new players, not server
add_equipment("conquesttoken", 1);
add_equipment("wood", 30);
add_equipment("stone", 30);
add_equipment("money", 2000 + get_turn() * 10);
-- run the turn:
read_orders(orders)
plan_monsters()
2004-05-30 05:25:10 +02:00
-- igjarjuk gets called:
-- require("igjarjuk-call.lua")
-- call_igjarjuk()
u = get_unit(atoi36("50ki"))
if u~=nil then
u.region:set_flag(14, true)
end
2004-05-30 05:25:10 +02:00
--
process_orders()
2004-04-11 04:29:14 +02:00
-- igjarjuk special
2004-05-16 08:40:55 +02:00
-- if get_turn() > 374 then
-- require("igjarjuk.lua")
2004-05-16 08:40:55 +02:00
-- wyrm()
-- end
2004-04-11 04:29:14 +02:00
write_passwords()
write_reports()
write_emails()
file = "" .. get_turn()
if write_game(file)~=0 then
print("could not write game")
return -1
end
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
2004-01-24 01:18:49 +01:00