diff --git a/src/res/e2k9.xml b/src/res/e2k9.xml index af068c6d2..09bf97bae 100644 --- a/src/res/e2k9.xml +++ b/src/res/e2k9.xml @@ -108,7 +108,7 @@ - @@ -139,7 +139,7 @@ - + diff --git a/src/res/e2k9/items.xml b/src/res/e2k9/items.xml index 9122f1e32..48bea9a87 100644 --- a/src/res/e2k9/items.xml +++ b/src/res/e2k9/items.xml @@ -3,11 +3,14 @@ + - + + + diff --git a/src/res/e2k9/races.xml b/src/res/e2k9/races.xml index 1c7d58f2e..dfbacfdb0 100644 --- a/src/res/e2k9/races.xml +++ b/src/res/e2k9/races.xml @@ -42,6 +42,7 @@ + diff --git a/src/res/e2k9/weapons.xml b/src/res/e2k9/weapons.xml index bc14dab2c..0850b985f 100644 --- a/src/res/e2k9/weapons.xml +++ b/src/res/e2k9/weapons.xml @@ -5,7 +5,7 @@ - + diff --git a/src/res/weapons/greatbow-2.xml b/src/res/weapons/greatbow-2.xml new file mode 100644 index 000000000..7efc88ac0 --- /dev/null +++ b/src/res/weapons/greatbow-2.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/scripts/e2k9.lua b/src/scripts/e2k9.lua new file mode 100644 index 000000000..788bc86c4 --- /dev/null +++ b/src/scripts/e2k9.lua @@ -0,0 +1,107 @@ +-- the locales that this gameworld supports. +local locales = { "de", "en" } + +function loadscript(name) + local script = scriptpath .. "/" .. name + print("- loading " .. script) + if pcall(dofile, script)==0 then + print("Could not load " .. script) + end +end + +loadscript("default.lua") + +function change_locales() + -- local localechange = { } + local localechange = { de = { "rtph" } } + + for loc, flist in pairs(localechange) do + for index, name in pairs(flist) do + f = get_faction(atoi36(name)) + if f ~= nil then + f.locale = loc + print("LOCALECHANGE ", f, loc) + end + end + end +end + +function load_scripts() + scripts = { + "spells.lua", + "extensions.lua", + "e2k9/items.lua" + } + for index, value in pairs(scripts) do + loadscript(value) + end +end + +function process(orders) + -- initialize starting equipment for new players + + if open_game(get_turn())~=0 then + print("could not read game") + return -1 + end + init_summary() + + -- kill multi-players (external script) + -- loadscript("eressea/multis.lua") + + -- run the turn: + if read_orders(orders) ~= 0 then + print("could not read " .. orders) + return -1 + end + + plan_monsters() + + local nmrs = get_nmrs(1) + if nmrs >= 80 then + print("Shit. More than 80 factions with 1 NMR (" .. nmrs .. ")") + write_summary() + return -1 + end + print (nmrs .. " Factions with 1 NMR") + + process_orders() + + -- create new monsters: + spawn_dragons() + spawn_undead() + spawn_braineaters(0.25) + spawn_ents() + + -- post-turn updates: + update_xmas2006() + update_embassies() + update_guards() + update_scores() + + change_locales() + + -- use newfactions file to place out new players + autoseed(basepath .. "/newfactions", false) + + write_files(locales) + + file = "" .. get_turn() .. ".dat" + if write_game(file, "binary")~=0 then + print("could not write game") + return -1 + end +end + +-- +-- main body of script +-- + +-- orderfile: contains the name of the orders. +load_scripts() +if orderfile==nil then + print "you must specify an orderfile" +else + process(orderfile) +end + diff --git a/src/scripts/e2k9/items.lua b/src/scripts/e2k9/items.lua new file mode 100644 index 000000000..3b42d3d39 --- /dev/null +++ b/src/scripts/e2k9/items.lua @@ -0,0 +1,10 @@ +-- used internally to check greatbow and towershield +function item_canuse(u, iname) + if iname=="towershield" then + return u.race=="dwarf" + end + if iname=="greatbow" then + return u.race=="elf" + end + return true +end