fixing xml config for e2 and e3

This commit is contained in:
Enno Rehling 2014-04-24 06:24:35 -07:00
parent 985b4376df
commit 921ab4947e
11 changed files with 75 additions and 262 deletions

View File

@ -5,6 +5,12 @@
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI <rewriteURI
uriStartString="eressea:///core/" uriStartString="config:///game/"
rewritePrefix="../res/eressea/" />
<rewriteURI
uriStartString="config:///default/"
rewritePrefix="../res/" />
<rewriteURI
uriStartString="config:///core/"
rewritePrefix="../core/res/" /> rewritePrefix="../core/res/" />
</catalog> </catalog>

View File

@ -1,37 +1,37 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<eressea xmlns:xi="http://www.w3.org/2001/XInclude"> <eressea xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="eressea:///core/messages.xml"/> <xi:include href="config:///core/messages.xml"/>
<!-- Localization --> <!-- Localization -->
<xi:include href="eressea:///core/de/strings.xml"/> <xi:include href="config:///core/de/strings.xml"/>
<xi:include href="eressea:///core/en/strings.xml"/> <xi:include href="config:///core/en/strings.xml"/>
<xi:include href="eressea/spellinfo.xml" /> <xi:include href="config:///game/spellinfo.xml" />
<xi:include href="eressea:///core/common/items.xml" /> <xi:include href="config:///core/common/items.xml" />
<xi:include href="eressea:///core/common/armor.xml" /> <xi:include href="config:///core/common/armor.xml" />
<xi:include href="eressea:///core/common/weapons.xml" /> <xi:include href="config:///core/common/weapons.xml" />
<xi:include href="eressea:///core/common/resources.xml" /> <xi:include href="config:///core/common/resources.xml" />
<xi:include href="eressea:///core/common/luxuries.xml" /> <xi:include href="config:///core/common/luxuries.xml" />
<xi:include href="eressea:///core/common/herbs.xml" /> <xi:include href="config:///core/common/herbs.xml" />
<xi:include href="eressea:///core/common/potions.xml" /> <xi:include href="config:///core/common/potions.xml" />
<xi:include href="eressea:///core/spoils.xml"/> <xi:include href="config:///core/spoils.xml"/>
<xi:include href="eressea/races.xml"/> <xi:include href="config:///game/races.xml"/>
<xi:include href="eressea:///core/prefixes.xml"/> <xi:include href="config:///core/prefixes.xml"/>
<xi:include href="eressea:///core/ships.xml"/> <xi:include href="config:///core/ships.xml"/>
<xi:include href="eressea:///core/common/buildings.xml"/> <xi:include href="config:///core/common/buildings.xml"/>
<xi:include href="eressea:///core/equipment.xml"/> <xi:include href="config:///core/equipment.xml"/>
<xi:include href="eressea:///core/terrains.xml"/> <xi:include href="config:///core/terrains.xml"/>
<xi:include href="eressea/terrains.xml"/> <xi:include href="config:///game/terrains.xml"/>
<xi:include href="directions.xml"/> <xi:include href="config:///default/directions.xml"/>
<xi:include href="eressea/artrewards.xml"/> <xi:include href="config:///game/artrewards.xml"/>
<xi:include href="eressea/buildings.xml"/> <xi:include href="config:///game/buildings.xml"/>
<xi:include href="eressea:///core/calendar.xml"/> <xi:include href="config:///core/calendar.xml"/>
<calendar name="secondage" newyear="month_1" start="184"/> <calendar name="secondage" newyear="month_1" start="184"/>
<xi:include href="eressea/equipment.xml"/> <xi:include href="config:///game/equipment.xml"/>
<xi:include href="eressea/items.xml"/> <xi:include href="config:///game/items.xml"/>
<xi:include href="eressea/spells.xml"/> <xi:include href="config:///game/spells.xml"/>
<xi:include href="eressea/strings.xml"/> <xi:include href="config:///game/strings.xml"/>
<xi:include href="adamantium.xml"/> <xi:include href="config:///default/adamantium.xml"/>
<equipment> <equipment>
<set name="first_unit"> <set name="first_unit">
<item name="conquesttoken" amount="1"/> <item name="conquesttoken" amount="1"/>
@ -44,11 +44,11 @@
</set> </set>
</equipment> </equipment>
<xi:include href="names-undead.xml"/> <xi:include href="config:///default/names-undead.xml"/>
<xi:include href="names-skeletons.xml"/> <xi:include href="config:///default/names-skeletons.xml"/>
<xi:include href="names-zombies.xml"/> <xi:include href="config:///default/names-zombies.xml"/>
<xi:include href="names-ghouls.xml"/> <xi:include href="config:///default/names-ghouls.xml"/>
<xi:include href="names-dragons.xml"/> <xi:include href="config:///default/names-dragons.xml"/>
<game name="Eressea"> <game name="Eressea">
<!-- Game specific settings --> <!-- Game specific settings -->

2
game-e2/runtests.lua Normal file
View File

@ -0,0 +1,2 @@
require "setup"
run_tests()

View File

@ -10,6 +10,5 @@ for idx, path in pairs(paths) do
package.path = srcpath .. '/' .. path .. ';' .. package.path package.path = srcpath .. '/' .. path .. ';' .. package.path
end end
read_xml(respath..'/config-eressea.xml', respath..'/catalog-eressea.xml') assert(read_xml())
require "init" require "init"

View File

@ -4,13 +4,13 @@
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"> "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI
uriStartString="config:///core/"
rewritePrefix="../core/res/" />
<rewriteURI <rewriteURI
uriStartString="config:///game/" uriStartString="config:///game/"
rewritePrefix="../res/e3a/" /> rewritePrefix="../res/e3a/" />
<rewriteURI <rewriteURI
uriStartString="config:///default/" uriStartString="config:///default/"
rewritePrefix="../res/" /> rewritePrefix="../res/" />
<rewriteURI
uriStartString="config:///core/"
rewritePrefix="../core/res/" />
</catalog> </catalog>

View File

@ -1,3 +1,2 @@
require "setup" require "setup"
read_xml("config.xml", "catalog.xml")
run_tests() run_tests()

View File

@ -10,6 +10,5 @@ for idx, path in pairs(paths) do
package.path = srcpath .. '/' .. path .. ';' .. package.path package.path = srcpath .. '/' .. path .. ';' .. package.path
end end
read_xml(respath..'/config-e3a.xml', respath..'/catalog-e3a.xml') assert(read_xml())
require "init" require "init"

View File

@ -1,10 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI
uriStartString="eressea:///core/"
rewritePrefix="../core/res/" />
</catalog>

View File

@ -1,190 +0,0 @@
<?xml version="1.0"?>
<eressea xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="eressea:///core/messages.xml"/>
<!-- Localization -->
<xi:include href="eressea:///core/de/strings.xml"/>
<xi:include href="eressea:///core/en/strings.xml"/>
<xi:include href="eressea:///core/common/items.xml"/>
<xi:include href="eressea:///core/common/herbs.xml" />
<xi:include href="eressea:///core/spoils.xml"/>
<xi:include href="eressea:///core/prefixes.xml"/>
<xi:include href="eressea:///core/common/buildings.xml"/>
<xi:include href="eressea:///core/equipment.xml"/>
<xi:include href="directions.xml"/>
<xi:include href="e3a/ships.xml"/>
<xi:include href="e3a/shipnames.xml"/>
<xi:include href="e3a/terrains.xml"/>
<xi:include href="eressea:///core/calendar.xml"/>
<calendar name="thirdage" newyear="month_1" start="1"/>
<xi:include href="e3a/items.xml" />
<xi:include href="e3a/strings.xml"/>
<xi:include href="e3a/messages.xml"/>
<xi:include href="e3a/races.xml"/>
<xi:include href="e3a/buildings.xml"/>
<xi:include href="e3a/equipment.xml"/>
<xi:include href="e3a/spells.xml"/>
<xi:include href="e3a/luxuries.xml" />
<xi:include href="e3a/weapons.xml" />
<xi:include href="e3a/armor.xml" />
<xi:include href="e3a/resources.xml" />
<xi:include href="adamantium.xml"/>
<equipment>
<set name="first_unit">
<item name="conquesttoken" amount="1"/>
<item name="log" amount="10"/>
<item name="stone" amount="10"/>
<item name="money" amount="5000"/>
</set>
</equipment>
<xi:include href="names-undead.xml"/>
<xi:include href="names-skeletons.xml"/>
<xi:include href="names-zombies.xml"/>
<xi:include href="names-ghouls.xml"/>
<xi:include href="names-dragons.xml"/>
<game name="E3">
<!-- Game specific settings -->
<param name="database.gameid" value="7"></param>
<order name="BETEN" disable="yes"/>
<order name="BELAGERE" disable="yes"/>
<order name="BEKLAUEN" disable="yes"/>
<order name="FRIEDEN" disable="yes"/>
<order name="GM" disable="yes"/>
<order name="JIHAD" disable="yes"/>
<order name="KRIEG" disable="yes"/>
<order name="KAUFEN" disable="yes"/>
<order name="LEHREN" disable="yes"/>
<order name="LIEFERE" disable="yes"/>
<order name="OPFERE" disable="yes"/>
<order name="SABOTIEREN" disable="yes"/>
<order name="SPIONIEREN" disable="yes"/>
<order name="TREIBEN" disable="yes"/>
<order name="UNTERHALTEN" disable="yes"/>
<order name="VERKAUFEN" disable="yes"/>
<skill name="armorer" enable="true"/>
<skill name="bow" enable="true"/>
<skill name="building" enable="true"/>
<skill name="cartmaking" enable="true"/>
<skill name="catapult" enable="true"/>
<skill name="crossbow" enable="true"/>
<skill name="forestry" enable="true"/>
<skill name="magic" enable="true"/>
<skill name="melee" enable="true"/>
<skill name="mining" enable="true"/>
<skill name="polearm" enable="true"/>
<skill name="quarrying" enable="true"/>
<skill name="riding" enable="true"/>
<skill name="roadwork" enable="true"/>
<skill name="sailing" enable="true"/>
<skill name="shipcraft" enable="true"/>
<skill name="stamina" enable="true"/>
<skill name="tactics" enable="true"/>
<skill name="training" enable="true"/>
<skill name="unarmed" enable="true"/>
<skill name="weaponsmithing" enable="true"/>
<skill name="herbalism" enable="false"/>
<skill name="alchemy" enable="false"/>
<skill name="entertainment" enable="false"/>
<skill name="espionage" enable="false"/>
<skill name="perception" enable="false"/>
<skill name="stealth" enable="false"/>
<skill name="taxation" enable="false"/>
<skill name="trade" enable="false"/>
<param name="NewbieImmunity" value="9"/> <!-- ends after turn 9 -->
<param name="modules.astralspace" value="0"/>
<param name="modules.wormholes" value="0"/>
<param name="modules.markets" value="1"/>
<!-- resource limitations -->
<param name="magic.regeneration" value="0.75"/>
<param name="magic.power" value="0.5"/>
<param name="resource.factor" value="0.25"/>
<param name="skills.cost.tactics" value="500"/>
<param name="entertain.base" value="0"/>
<param name="entertain.perlevel" value="20"/>
<param name="nmr.timeout" value="5"/>
<param name="nmr.removenewbie" value="0"/>
<param name="GiveRestriction" value="3"/>
<param name="hunger.long" value="0"/>
<param name="hunger.demon.skill" value="1"/>
<param name="hunger.damage" value="1d9+9"/>
<param name="hunger.demons" value="1"/>
<param name="init_spells" value="0"/>
<param name="recruit.allow_merge" value="1"/>
<param name="study.expensivemigrants" value="1"/>
<param name="study.speedup" value="0"/>
<param name="world.era" value="3"/>
<param name="rules.migrants" value="0"/>
<param name="rules.transfermen" value="0"/>
<param name="rules.stealth.faction" value="1"/>
<param name="rules.stealth.anon_battle" value="0"/>
<param name="rules.check_overload" value="0"/>
<param name="rules.combat.goblinbonus" value="3"/>
<param name="rules.ship.damage_drift" value="0.00"/> <!-- percent damage from drifting-->
<param name="rules.alliances" value="1"/>
<param name="rules.combat.herospeed" value="3"/>
<param name="rules.combat.demon_vampire" value="5"/> <!-- regen 1 hp per X points of damage done -->
<param name="rules.combat.skill_bonus" value="0"/>
<!--param name="rules.combat.loot" value="5"/--> <!-- only self + others - keeploot -->
<param name="rules.items.loot_divisor" value="2"/> <!-- damage skims off 1/2 of goods transfers -->
<param name="rules.items.give_divisor" value="2"/> <!-- corruption skims off 1/2 of goods transfers -->
<param name="rules.move.owner_leave" value="1"/> <!-- owner must leave before moving -->
<param name="rules.region_owners" value="1"/>
<param name="rules.cavalry.skill" value="2"/>
<param name="rules.cavalry.mode" value="1"/>
<param name="rules.magic.multipotion" value="1"/>
<param name="rules.magic.wol_effect" value="5"/>
<param name="rules.magic.factionlist" value="1"/>
<param name="rules.magic.wol_type" value="2"/>
<param name="rules.magic.blessed_harvest" value="1"/>
<param name="rules.magic.elfpower" value="1"/> <!-- elves get ring-of-power bonus in a forest -->
<param name="rules.magic.playerschools" value="gwyrrd illaun draig cerddor"/>
<param name="rules.build.other_buildings" value="1"/>
<param name="rules.economy.taxation" value="1"/>
<param name="rules.economy.food" value="2"/>
<param name="rules.economy.wages" value="1"/>
<param name="rules.economy.roqf" value="5"/>
<param name="rules.economy.herbrot" value="0"/>
<param name="rules.dwarf_castles" value="1"/>
<!-- param name="rules.nmr.destroy" value="1"/ -->
<param name="rules.limit.faction" value="250"/>
<!--param name="rules.give" value="15"/ --> <!-- self + peasants + herbs + lux - goods -->
<param name="rules.economy.grow" value="1"/>
<param name="rules.tactics.formula" value="1"/> <!-- 10% per skilldiff -->
<param name="rules.help.mask" value="fight guard money give"/>
<param name="movement.shipspeed.skillbonus" value="6"/>
<param name="alliance.auto" value="fight"/>
<param name="alliance.restricted" value="fight"/>
</game>
<rules>
<function name="wage" value="minimum_wage"/>
</rules>
<strings>
<string name="mailto">
<text locale="de">eressea-server@eressea.de</text>
<text locale="en">eressea-server@eressea.de</text>
</string>
<string name="newbie_info_1">
<text locale="de">Bitte denke daran, deine Befehle mit dem Betreff
E3 BEFEHLE an eressea-server@eressea.de zu senden.</text>
<text locale="en">Remember to send your orders to
eressea-server@eressea.de with the subject E3 ORDERS.</text>
</string>
<string name="mailcmd">
<text locale="de">E3 BEFEHLE</text>
<text locale="en">E3 ORDERS</text>
</string>
</strings>
</eressea>

View File

@ -462,9 +462,14 @@ static int tolua_init_reports(lua_State * L)
static int tolua_write_report(lua_State * L) static int tolua_write_report(lua_State * L)
{ {
faction *f = (faction *) tolua_tousertype(L, 1, 0); faction *f = (faction *) tolua_tousertype(L, 1, 0);
time_t ltime = time(0); if (f) {
int result = write_reports(f, ltime); time_t ltime = time(0);
tolua_pushnumber(L, (lua_Number) result); int result = write_reports(f, ltime);
tolua_pushnumber(L, (lua_Number)result);
}
else {
tolua_pushstring(L, "function expects a faction, got nil");
}
return 1; return 1;
} }
@ -997,8 +1002,8 @@ int tolua_read_xml(lua_State * L)
{ {
const char *filename = tolua_tostring(L, 1, "config.xml"); const char *filename = tolua_tostring(L, 1, "config.xml");
const char *catalog = tolua_tostring(L, 2, "catalog.xml"); const char *catalog = tolua_tostring(L, 2, "catalog.xml");
init_data(filename, catalog); lua_pushinteger(L, init_data(filename, catalog));
return 0; return 1;
} }
typedef struct event_args { typedef struct event_args {
@ -1204,9 +1209,13 @@ int eressea_run(lua_State *L, const char *luafile)
/* run the main script */ /* run the main script */
if (luafile) { if (luafile) {
log_debug("executing script %s\n", luafile); log_debug("executing script %s\n", luafile);
lua_getglobal(L, "debug");
lua_getfield(L, -1, "traceback");
lua_remove(L, -2);
lua_getglobal(L, "dofile"); lua_getglobal(L, "dofile");
lua_pushstring(L, luafile); lua_pushstring(L, luafile);
err = lua_pcall(L, 1, 1, 0); err = lua_pcall(L, 1, 1, -3);
if (err != 0) { if (err != 0) {
log_lua_error(L); log_lua_error(L);
abort(); abort();

View File

@ -108,29 +108,28 @@ int read_xml(const char *filename, const char *catalog)
{ {
xml_reader *reader = xmlReaders; xml_reader *reader = xmlReaders;
xmlDocPtr doc; xmlDocPtr doc;
int result;
if (catalog) { if (catalog) {
xmlLoadCatalog(catalog); xmlLoadCatalog(catalog);
} }
#ifdef XML_PARSE_XINCLUDE doc = xmlReadFile(filename, NULL, XML_PARSE_XINCLUDE | XML_PARSE_NONET | XML_PARSE_PEDANTIC | XML_PARSE_COMPACT);
doc = xmlReadFile(filename, NULL, XML_PARSE_XINCLUDE|XML_PARSE_NONET|XML_PARSE_PEDANTIC);
#else
doc = xmlParseFile(filename);
#endif
if (doc == NULL) { if (doc == NULL) {
log_error("could not open '%s'\n", filename); log_error("could not open '%s'\n", filename);
return -1; return -1;
} }
xmlXIncludeProcess(doc); result = xmlXIncludeProcessFlags(doc, XML_PARSE_XINCLUDE | XML_PARSE_NONET | XML_PARSE_PEDANTIC | XML_PARSE_COMPACT);
if (result >= 0) {
while (reader != NULL) { while (reader != NULL) {
int i = reader->callback(doc); int i = reader->callback(doc);
if (i != 0) { if (i != 0) {
return i; return i;
} }
reader = reader->next; reader = reader->next;
}
result = 0;
} }
xmlFreeDoc(doc); xmlFreeDoc(doc);
return 0; return result;
} }