core is now part of the server

simplifying git repository structure
This commit is contained in:
Enno Rehling 2013-05-11 13:02:21 -07:00
commit 89649844f6
439 changed files with 111083 additions and 0 deletions

16
core/.gitignore vendored Normal file
View file

@ -0,0 +1,16 @@
bin/
Debug/
Release/
*~
*.user
*.pdb
*.suo
*.sdf
*.opensdf
*.ipch
*.sh
*.tmp
src/*.vcproj.*.user
tags
build-vs2010
config

15
core/LICENSE Normal file
View file

@ -0,0 +1,15 @@
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View file

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<resource name="chainmail">
<item weight="200" score="90">
<construction skill="armorer" minskill="3" reqsize="1">
<requirement type="iron" quantity="3"/>
</construction>
<armor ac="3" penalty="0.15" magres="0.0"/>
</item>
</resource>

View file

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<resource name="laenmail">
<item weight="100" score="1000">
<construction skill="armorer" minskill="9" reqsize="1">
<requirement type="laen" quantity="3"/>
</construction>
<armor ac="6" penalty="0.0" magres="0.3" laen="yes" />
</item>
</resource>

View file

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<resource name="laenshield">
<item weight="0" score="1000">
<construction skill="armorer" minskill="7" reqsize="1">
<requirement type="laen" quantity="1"/>
</construction>
<armor ac="2" penalty="-0.25" magres="0.3" laen="yes" shield="yes" />
</item>
</resource>

10
core/res/armor/plate.xml Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<resource name="plate">
<item weight="400" score="150">
<function name="canuse" value="lua_canuse_item"/>
<construction skill="armorer" minskill="4" reqsize="1">
<requirement type="iron" quantity="5"/>
</construction>
<armor ac="5" penalty="0.30" magres="0.0"/>
</item>
</resource>

View file

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<resource name="rustychainmail">
<item weight="200" score="30">
<construction skill="armorer" minskill="3" reqsize="1">
<requirement type="iron" quantity="3"/>
</construction>
<armor ac="2" penalty="0.30" magres="0.0"/>
</item>
</resource>

View file

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<resource name="rustyshield">
<item weight="100" score="10">
<construction skill="armorer" minskill="2" reqsize="1">
<requirement type="iron" quantity="1"/>
</construction>
<armor ac="1" penalty="0.0" magres="0.0" shield="yes"/>
</item>
</resource>

View file

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<resource name="shield">
<item weight="100" score="30">
<construction skill="armorer" minskill="2" reqsize="1">
<requirement type="iron" quantity="1"/>
</construction>
<armor ac="1" penalty="-0.15" magres="0.0" shield="yes"/>
</item>
</resource>

23
core/res/calendar.xml Normal file
View file

@ -0,0 +1,23 @@
<?xml version="1.0"?>
<calendar name="secondage" newyear="month_1" start="0">
<season name="winter">
<month name="month_4" storm="50" />
<month name="month_5" storm="30" />
<month name="month_6" storm="60" />
</season>
<season name="spring">
<month name="month_7" storm="60" />
<month name="month_8" storm="10" />
</season>
<season name="summer">
<month name="month_9" storm="60" />
<month name="month_1" storm="10" />
</season>
<season name="fall">
<month name="month_2" storm="60" />
<month name="month_3" storm="80" />
</season>
<week name="firstweek" />
<week name="secondweek" />
<week name="thirdweek" />
</calendar>

10
core/res/common/armor.xml Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<resources xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="../armor/chainmail.xml"/>
<xi:include href="../armor/laenmail.xml"/>
<xi:include href="../armor/laenshield.xml"/>
<xi:include href="../armor/plate.xml"/>
<xi:include href="../armor/rustychainmail.xml"/>
<xi:include href="../armor/rustyshield.xml"/>
<xi:include href="../armor/shield.xml"/>
</resources>

View file

@ -0,0 +1,171 @@
<?xml version="1.0"?>
<buildings>
<building name="wormhole" maxsize="4" capacity="1" maxcapacity="4" nobuild="yes" nodestroy="yes" unique="yes" />
<building name="illusioncastle" capacity="0" maxcapacity="0" maxsize="0" nobuild="yes"/>
<building name="xmas_exit" maxsize="10" maxcapacity="2" nobuild="yes" nodestroy="yes" unique="yes"/>
<building name="caldera" capacity="1" nodestroy="yes" nobuild="yes"/>
<building name="genericbuilding" namechange="no" maxsize="1" nobuild="yes"/>
<building name="artacademy" maxsize="100" nobuild="yes" nodestroy="yes" unique="yes"/>
<building name="artsculpture" namechange="no" maxsize="100" nobuild="yes" nodestroy="yes" unique="yes"/>
<building name="blessedstonecircle" maxcapacity="3" maxsize="100" nobuild="yes" magic="yes" magres="60" magresbonus="30" auraregen="1.50">
<construction skill="building" minskill="2" reqsize="100" maxsize="100">
<requirement type="log" quantity="500"/>
<requirement type="stone" quantity="500"/>
</construction>
</building>
<building name="stonecircle" maxsize="100">
<construction skill="building" minskill="2" reqsize="100" maxsize="100">
<requirement type="log" quantity="500"/>
<requirement type="stone" quantity="500"/>
</construction>
</building>
<building name="inn" capacity="1">
<maintenance type="money" amount="5" variable="yes" vital="yes"/>
<construction skill="building" minskill="2" reqsize="10">
<requirement type="iron" quantity="10"/>
<requirement type="log" quantity="30"/>
<requirement type="stone" quantity="40"/>
<requirement type="money" quantity="2000"/>
</construction>
</building>
<building name="tunnel" capacity="1" maxsize="100">
<maintenance type="stone" amount="2"/>
<maintenance type="money" amount="100" vital="yes"/>
<construction skill="building" minskill="6" reqsize="100" maxsize="100">
<requirement type="iron" quantity="100"/>
<requirement type="log" quantity="500"/>
<requirement type="stone" quantity="1000"/>
<requirement type="money" quantity="30000"/>
</construction>
</building>
<building name="caravan" capacity="1" maxsize="10">
<maintenance type="horse" amount="2"/>
<maintenance type="money" amount="3000" vital="yes"/>
<construction skill="building" minskill="2" reqsize="10" maxsize="10">
<requirement type="iron" quantity="10"/>
<requirement type="log" quantity="50"/>
<requirement type="stone" quantity="10"/>
<requirement type="money" quantity="5000"/>
</construction>
</building>
<building name="dam" capacity="1" maxsize="50">
<maintenance type="log" amount="3"/>
<maintenance type="money" amount="1000" vital="yes"/>
<construction skill="building" minskill="4" reqsize="50" maxsize="50">
<requirement type="iron" quantity="50"/>
<requirement type="log" quantity="500"/>
<requirement type="stone" quantity="250"/>
<requirement type="money" quantity="25000"/>
</construction>
</building>
<building name="monument" namechange="no" capacity="1">
<construction skill="building" minskill="4" reqsize="1">
<requirement type="log" quantity="1"/>
<requirement type="stone" quantity="1"/>
<requirement type="iron" quantity="1"/>
<requirement type="money" quantity="400"/>
</construction>
</building>
<building name="stables" capacity="1">
<maintenance type="money" amount="150" vital="yes"/>
<construction skill="building" minskill="2" reqsize="1">
<requirement type="log" quantity="4"/>
<requirement type="stone" quantity="2"/>
<requirement type="iron" quantity="1"/>
<requirement type="money" quantity="100"/>
</construction>
</building>
<building name="sawmill" capacity="1">
<maintenance type="money" amount="250" vital="yes"/>
<construction skill="building" minskill="3" reqsize="1">
<requirement type="log" quantity="5"/>
<requirement type="stone" quantity="5"/>
<requirement type="iron" quantity="3"/>
<requirement type="money" quantity="200"/>
</construction>
</building>
<building name="smithy" capacity="1">
<function name="init" value="init_smithy"/>
<maintenance type="money" amount="300" vital="yes"/>
<maintenance type="log" amount="1"/>
<construction skill="building" minskill="3" reqsize="1">
<requirement type="log" quantity="5"/>
<requirement type="stone" quantity="5"/>
<requirement type="iron" quantity="2"/>
<requirement type="money" quantity="200"/>
</construction>
</building>
<building name="magictower" maxcapacity="2" maxsize="50" magic="yes" magres="40" fumblebonus="10" auraregen="1.75">
<maintenance type="money" amount="1000" vital="yes"/>
<construction skill="building" minskill="5" reqsize="50" maxsize="50">
<requirement type="log" quantity="150"/>
<requirement type="stone" quantity="250"/>
<requirement type="mallorn" quantity="100"/>
<requirement type="iron" quantity="150"/>
<requirement type="laen" quantity="100"/>
<requirement type="money" quantity="25000"/>
</construction>
</building>
<building name="academy" maxcapacity="25" maxsize="25">
<maintenance type="money" amount="1000" vital="yes"/>
<construction skill="building" minskill="3" reqsize="25" maxsize="25">
<requirement type="log" quantity="125"/>
<requirement type="stone" quantity="125"/>
<requirement type="iron" quantity="25"/>
<requirement type="money" quantity="12500"/>
</construction>
</building>
<building name="harbour" capacity="1" maxcapacity="25" maxsize="25" unique="yes">
<maintenance type="money" amount="250" vital="yes"/>
<construction skill="building" minskill="3" reqsize="25" maxsize="25">
<requirement type="log" quantity="125"/>
<requirement type="stone" quantity="125"/>
<requirement type="money" quantity="6250"/>
</construction>
</building>
<building name="quarry" capacity="1">
<maintenance type="money" amount="250" vital="yes"/>
<construction skill="building" minskill="2" reqsize="1">
<requirement type="iron" quantity="1"/>
<requirement type="log" quantity="5"/>
<requirement type="stone" quantity="1"/>
<requirement type="money" quantity="250"/>
</construction>
</building>
<building name="mine" capacity="1">
<maintenance type="money" amount="500" vital="yes"/>
<construction skill="building" minskill="4" reqsize="1">
<requirement type="iron" quantity="1"/>
<requirement type="log" quantity="10"/>
<requirement type="stone" quantity="5"/>
<requirement type="money" quantity="250"/>
</construction>
</building>
<building name="lighthouse" capacity="1" maxcapacity="4">
<maintenance type="money" amount="100" vital="yes"/>
<construction skill="building" minskill="3" reqsize="1">
<requirement type="iron" quantity="1"/>
<requirement type="log" quantity="1"/>
<requirement type="stone" quantity="2"/>
<requirement type="money" quantity="100"/>
</construction>
</building>
</buildings>

View file

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!-- TODO: this does not work yet -->
<production>
<construction resource="laenshield" skill="armorer" minskill="7" reqsize="1">
<requirement type="laen" quantity="1"/>
</construction>
<construction resource="laenmail" skill="armorer" minskill="9" reqsize="1">
<requirement type="laen" quantity="3"/>
</construction>
</production>

89
core/res/common/herbs.xml Normal file
View file

@ -0,0 +1,89 @@
<?xml version="1.0"?>
<resources>
<!-- this file contains herbs that are part of the alchemy system -->
<resource name="h0" appearance="herbbag"><!-- Flachwurz -->
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h1" appearance="herbbag"><!-- Würziger Wagemut -->
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h2" appearance="herbbag"><!-- Eulenauge -->
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h3" appearance="herbbag"><!-- Grüner Spinnerich -->
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h4" appearance="herbbag"><!-- Blauer Baumringel -->
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h5" appearance="herbbag"><!-- Elfenlieb -->
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h6" appearance="herbbag"><!-- Gurgelkraut -->
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h7" appearance="herbbag"><!-- Knotiger Saugwurz -->
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h8" appearance="herbbag"><!-- Blasenmorchel -->
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h9" appearance="herbbag"><!-- Wasserfinder -->
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h10" appearance="herbbag">
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h11" appearance="herbbag">
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h12" appearance="herbbag"><!-- Windbeutel -->
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h13" appearance="herbbag">
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h14" appearance="herbbag"><!-- Alraune -->
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h15" appearance="herbbag">
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h16" appearance="herbbag">
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h17" appearance="herbbag">
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h18" appearance="herbbag">
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h19" appearance="herbbag">
<item weight="0" score="10" herb="yes"/>
</resource>
<resource name="h20" appearance="herbbag">
<item weight="0" score="10" herb="yes"/>
</resource>
</resources>

152
core/res/common/items.xml Normal file
View file

@ -0,0 +1,152 @@
<?xml version="1.0"?>
<resources>
<resource name="ao_healing" appearance="amulet">
<item weight="0" score="6000"/>
</resource>
<resource name="aots" appearance="amulet">
<item weight="0" score="6000"/>
</resource>
<resource name="roi" appearance="">
<item weight="0" score="6000"/>
</resource>
<resource name="ror" appearance="">
<item weight="0" score="6000"/>
</resource>
<resource name="rop" appearance="">
<item weight="0" score="6000"/>
</resource>
<resource name="roqf" appearance="">
<item weight="0" score="6000"/>
</resource>
<resource name="trollbelt">
<item weight="0" score="6000"/>
</resource>
<resource name="presspass" cursed="yes">
<item weight="0" score="6000"/>
</resource>
<resource name="aurafocus">
<item weight="100" score="6000"/>
</resource>
<resource name="sphereofinv" appearance="">
<item weight="100" score="6000"/>
</resource>
<resource name="magicbag">
<item big="yes" notlost="yes" weight="100" score="6000"/>
</resource>
<resource name="magicherbbag" appearance="">
<item weight="100" score="6000"/>
</resource>
<resource name="ao_chastity" appearance="amulet">
<item weight="0" score="6000"/>
</resource>
<resource name="fairyboot">
<item weight="0" score="6000"/>
</resource>
<resource name="aoc" appearance="amulet">
<item weight="100">
<function name="use" value="use_birthdayamulet"/>
</item>
</resource>
<resource name="dreameye">
<item weight="100">
<function name="use" value="use_tacticcrystal"/>
</item>
</resource>
<resource name="pegasus">
<item weight="5000" notlost="yes" big="yes" score="6000" capacity="7000" animal="yes"/>
</resource>
<resource name="elvenhorse">
<item weight="5000" notlost="yes" big="yes" score="6000" capacity="7000" animal="yes">
<function name="give" value="givehorses"/>
</item>
</resource>
<resource name="dolphin">
<item weight="5000" notlost="yes" big="yes" score="6000" capacity="7000" animal="yes"/>
</resource>
<resource name="seaserpenthead">
<item weight="500" score="400"/>
</resource>
<resource name="dragonblood">
<item weight="100" score="100"/>
</resource>
<resource name="dragonhead">
<item weight="500" score="300"/>
</resource>
<!-- XE items -->
<resource name="skillpotion">
<!-- gives user one free learning attempt -->
<item weight="0">
<function name="use" value="use_skillpotion"/>
</item>
</resource>
<resource name="manacrystal">
<!-- gives user free aura -->
<item weight="0">
<function name="use" value="use_manacrystal"/>
</item>
</resource>
<!-- xmas items -->
<resource name="mistletoe">
<!-- Sets the chance of escape in a fight to 100 percent -->
<item notlost="yes" weight="0">
<function name="use" value="usemistletoe"/>
</item>
</resource>
<resource name="speedsail">
<item weight="0">
<function name="use" value="use_speedsail"/>
</item>
</resource>
<!-- items -->
<resource name="antimagic" appearance="amulet">
<item weight="0" score="2000">
<function name="use" value="use_antimagiccrystal"/>
</item>
</resource>
<resource name="wand_of_tears">
<item notlost="yes" weight="0">
<function name="use" value="use_wand_of_tears"/>
</item>
</resource>
<resource name="catapultammo">
<item weight="1000">
<construction skill="quarrying" minskill="3" reqsize="1">
<requirement type="stone" quantity="1"/>
</construction>
</item>
</resource>
<resource name="toadslime" appearance="vial">
<item weight="100" score="0"/>
</resource>
</resources>

View file

@ -0,0 +1,26 @@
<?xml version="1.0"?>
<resources>
<!-- this file contains luxury items that are part of the trade system -->
<resource name="balm">
<item weight="200"><luxury price="4"/></item>
</resource>
<resource name="spice">
<item weight="200"><luxury price="5"/></item>
</resource>
<resource name="jewel">
<item weight="100"><luxury price="7"/></item>
</resource>
<resource name="myrrh">
<item weight="200"><luxury price="5"/></item>
</resource>
<resource name="oil">
<item weight="300"><luxury price="3"/></item>
</resource>
<resource name="silk">
<item weight="300"><luxury price="6"/></item>
</resource>
<resource name="incense">
<item weight="200"><luxury price="4"/></item>
</resource>
</resources>

197
core/res/common/potions.xml Normal file
View file

@ -0,0 +1,197 @@
<?xml version="1.0"?>
<resources>
<!-- this file contains potions that are part of the alchemy system -->
<!-- potions -->
<resource name="p0" appearance="vial">
<item weight="0" score="30">
<function name="use" value="usepotion"/>
<potion level="1"/>
<construction skill="alchemy" minskill="2" reqsize="1">
<requirement type="h4"/>
<requirement type="h12"/>
</construction>
</item>
</resource>
<resource name="goliathwater" appearance="vial">
<item weight="0" score="30">
<function name="use" value="usepotion"/>
<potion level="1"/>
<construction skill="alchemy" minskill="2" reqsize="1">
<requirement type="h6"/>
<requirement type="h13"/>
</construction>
</item>
</resource>
<resource name="truthpotion" appearance="vial">
<item weight="0" score="30">
<function name="use" value="usepotion"/>
<potion level="1"/>
<construction skill="alchemy" minskill="2" reqsize="1">
<requirement type="h0"/>
<requirement type="h13"/>
</construction>
</item>
</resource>
<resource name="p2" appearance="vial">
<item weight="0" score="30">
<function name="use" value="usepotion"/>
<potion level="1"/>
<construction skill="alchemy" minskill="2" reqsize="1">
<requirement type="h5"/>
<requirement type="h7"/>
</construction>
</item>
</resource>
<resource name="p3" appearance="vial">
<item weight="0" score="60">
<function name="use" value="usepotion"/>
<potion level="2"/>
<construction skill="alchemy" minskill="4" reqsize="1">
<requirement type="h14"/>
<requirement type="h16"/>
<requirement type="h1"/>
</construction>
</item>
</resource>
<resource name="ointment" appearance="vial">
<!-- Wundsalbe -->
<item weight="0" score="60">
<function name="use" value="usehealingpotion"/>
<potion level="2"/>
<construction skill="alchemy" minskill="4" reqsize="1">
<requirement type="h19"/>
<requirement type="h4"/>
<requirement type="h1"/>
</construction>
</item>
</resource>
<resource name="peasantblood" appearance="vial">
<!-- Bauernblut -->
<item weight="0" score="60">
<function name="use" value="usebloodpotion"/>
<potion level="2"/>
<construction skill="alchemy" minskill="4" reqsize="1">
<requirement type="h17"/>
<requirement type="h13"/>
<requirement type="h4"/>
<requirement type="peasant"/>
</construction>
</item>
</resource>
<resource name="p6" appearance="vial">
<item weight="0" score="90">
<function name="use" value="usepotion"/>
<potion level="3"/>
<construction skill="alchemy" minskill="6" reqsize="1">
<requirement type="h9"/>
<requirement type="h15"/>
<requirement type="h12"/>
<requirement type="h6"/>
</construction>
</item>
</resource>
<resource name="p7" appearance="vial">
<item weight="0" score="90">
<function name="useonother" value="usefoolpotion"/>
<potion level="3"/>
<construction skill="alchemy" minskill="6" reqsize="1">
<requirement type="h2"/>
<requirement type="h3"/>
<requirement type="h17"/>
<requirement type="h13"/>
</construction>
</item>
</resource>
<resource name="nestwarmth" appearance="vial">
<item weight="0" score="90">
<function name="use" value="usewarmthpotion"/>
<potion level="3"/>
<construction skill="alchemy" minskill="6" reqsize="1">
<requirement type="h18"/>
<requirement type="h3"/>
<requirement type="h16"/>
<requirement type="h10"/>
</construction>
</item>
</resource>
<resource name="p9" appearance="vial">
<item weight="0" score="90">
<function name="use" value="usepotion"/>
<potion level="3"/>
<construction skill="alchemy" minskill="6" reqsize="1">
<requirement type="h4"/>
<requirement type="h11"/>
<requirement type="h10"/>
<requirement type="h7"/>
</construction>
</item>
</resource>
<resource name="p10" appearance="vial">
<item weight="0" score="90">
<function name="use" value="usepotion"/>
<potion level="3"/>
<construction skill="alchemy" minskill="6" reqsize="1">
<requirement type="h19"/>
<requirement type="h14"/>
<requirement type="h0"/>
<requirement type="h11"/>
</construction>
</item>
</resource>
<resource name="p11" appearance="vial">
<item weight="0" score="120">
<function name="use" value="usepotion"/>
<potion level="4"/>
<construction skill="alchemy" minskill="8" reqsize="1">
<requirement type="h14"/>
<requirement type="h20"/>
<requirement type="h15"/>
<requirement type="h8"/>
<requirement type="h5"/>
</construction>
</item>
</resource>
<resource name="p13" appearance="vial">
<item weight="0" score="120">
<function name="use" value="usepotion"/>
<potion level="4"/>
<construction skill="alchemy" minskill="8" reqsize="1">
<requirement type="h5"/>
<requirement type="h9"/>
<requirement type="h12"/>
<requirement type="h3"/>
<requirement type="h8"/>
<requirement type="dragonblood"/>
</construction>
</item>
</resource>
<resource name="p14" appearance="vial">
<item weight="0" score="120">
<function name="use" value="usepotion"/>
<potion level="4"/>
<construction skill="alchemy" minskill="8" reqsize="1">
<requirement type="h6"/>
<requirement type="h12"/>
<requirement type="h18"/>
<requirement type="h5"/>
<requirement type="h16"/>
</construction>
</item>
</resource>
</resources>

View file

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<resources xmlns:xi="http://www.w3.org/2001/XInclude">
<!--
this file contains the most important items and resources any game will
want to use. Or maybe you just have to roll your own file.
-->
<xi:include href="../resources/cart.xml"/>
<xi:include href="../resources/horse.xml"/>
<xi:include href="../resources/hp.xml"/>
<xi:include href="../resources/iron.xml"/>
<xi:include href="../resources/laen.xml"/>
<xi:include href="../resources/log.xml"/>
<xi:include href="../resources/mallorn.xml"/>
<xi:include href="../resources/mallornseed.xml"/>
<xi:include href="../resources/seed.xml"/>
<xi:include href="../resources/peasant.xml"/>
<xi:include href="../resources/stone.xml"/>
</resources>

View file

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<resources xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="../weapons/axe.xml"/>
<xi:include href="../weapons/bow.xml"/>
<xi:include href="../weapons/catapult.xml"/>
<xi:include href="../weapons/crossbow.xml"/>
<xi:include href="../weapons/firesword.xml"/>
<xi:include href="../weapons/greatbow.xml"/>
<xi:include href="../weapons/greatsword.xml"/>
<xi:include href="../weapons/halberd.xml"/>
<xi:include href="../weapons/laensword.xml"/>
<xi:include href="../weapons/lance.xml"/>
<xi:include href="../weapons/mallornbow.xml"/>
<xi:include href="../weapons/mallorncrossbow.xml"/>
<xi:include href="../weapons/mallornlance.xml"/>
<xi:include href="../weapons/mallornspear.xml"/>
<xi:include href="../weapons/runesword.xml"/>
<xi:include href="../weapons/rustyaxe.xml"/>
<xi:include href="../weapons/rustygreatsword.xml"/>
<xi:include href="../weapons/rustyhalberd.xml"/>
<xi:include href="../weapons/rustysword.xml"/>
<xi:include href="../weapons/spear.xml"/>
<xi:include href="../weapons/sword.xml"/>
</resources>

7456
core/res/de/strings.xml Normal file

File diff suppressed because it is too large Load diff

1680
core/res/en/strings.xml Normal file

File diff suppressed because it is too large Load diff

399
core/res/equipment.xml Normal file
View file

@ -0,0 +1,399 @@
<?xml version="1.0"?>
<equipment>
<!-- equipment given to familiars -->
<set name="lynx_familiar">
<skill name="espionage" level="1"/>
<skill name="magic" level="1"/>
<skill name="stealth" level="1"/>
<skill name="perception" level="1"/>
</set>
<set name="tunnelworm_familiar">
<skill name="magic" level="1"/>
<skill name="mining" level="1"/>
<skill name="forestry" level="1"/>
<skill name="stamina" level="1"/>
</set>
<set name="eagle_familiar">
<skill name="magic" level="1"/>
<skill name="perception" level="1"/>
</set>
<set name="rat_familiar">
<skill name="magic" level="1"/>
<skill name="espionage" level="1"/>
<skill name="stealth" level="1"/>
<skill name="perception" level="1"/>
<skill name="stamina" level="6"/>
</set>
<set name="songdragon_familiar">
<skill name="magic" level="1"/>
<!-- spells -->
<spell name="flee" level="2"/>
<spell name="sleep" level="7"/>
<spell name="frighten" level="8"/>
</set>
<set name="nymph_familiar">
<skill name="magic" level="1"/>
<skill name="bow" level="1"/>
<skill name="herbalism" level="1"/>
<skill name="training" level="1"/>
<skill name="riding" level="1"/>
<skill name="espionage" level="1"/>
<skill name="stealth" level="1"/>
<skill name="entertainment" level="1"/>
<skill name="perception" level="1"/>
<!-- spells -->
<spell name="seduction" level="6"/>
<spell name="calm_monster" level="6"/>
<spell name="song_of_confusion" level="4"/>
<spell name="appeasement" level="1"/>
</set>
<set name="unicorn_familiar">
<skill name="magic" level="1"/>
<skill name="stealth" level="1"/>
<skill name="perception" level="1"/>
<!-- spells -->
<spell name="resist_magic" level="3"/>
<spell name="song_of_peace" level="12"/>
<spell name="calm_monster" level="6"/>
<spell name="heroic_song" level="5"/>
<spell name="song_of_healing" level="2"/>
<spell name="appeasement" level="1"/>
</set>
<set name="direwolf_familiar">
<skill name="magic" level="1"/>
<skill name="perception" level="1"/>
</set>
<set name="ghost_familiar">
<skill name="magic" level="1"/>
<!-- spells -->
<spell name="steal_aura" level="6"/>
<spell name="frighten" level="8"/>
<spell name="summonundead" level="6"/>
</set>
<set name="imp_familiar">
<skill name="magic" level="1"/>
<skill name="espionage" level="1"/>
<skill name="stealth" level="1"/>
<skill name="perception" level="1"/>
<skill name="taxation" level="1"/>
<!-- spells -->
<spell name="steal_aura" level="6"/>
<spell name="shapeshift" level="3"/>
<spell name="seduction" level="6"/>
</set>
<set name="dreamcat_familiar">
<skill name="magic" level="1"/>
<skill name="espionage" level="1"/>
<skill name="stealth" level="1"/>
<skill name="perception" level="1"/>
<skill name="taxation" level="1"/>
<!-- spells -->
<spell name="shapeshift" level="3"/>
<spell name="transferauratraum" level="3"/>
</set>
<set name="fairy_familiar">
<skill name="magic" level="1"/>
<!-- spells -->
<spell name="appeasement" level="1"/>
<spell name="calm_monster" level="6"/>
<spell name="seduction" level="6"/>
</set>
<set name="owl_familiar">
<skill name="magic" level="1"/>
<skill name="espionage" level="1"/>
<skill name="stealth" level="1"/>
<skill name="perception" level="1"/>
</set>
<set name="hellcat_familiar">
<skill name="magic" level="1"/>
<skill name="perception" level="1"/>
</set>
<set name="tiger_familiar">
<skill name="magic" level="1"/>
<skill name="perception" level="1"/>
</set>
<!-- one equipment-set per player-race for the first unit in a faction -->
<set name="first_dwarf">
<item name="axe" amount="1"/>
<item name="chainmail" amount="1"/>
<skill name="melee" level="1"/>
</set>
<set name="first_elf">
<item name="fairyboot" amount="1"/>
<callback name="equip_newunits"/>
</set>
<set name="first_orc">
<skill name="polearm" level="4"/>
<skill name="melee" level="4"/>
<skill name="crossbow" level="4"/>
<skill name="catapult" level="4"/>
<skill name="bow" level="4"/>
</set>
<set name="first_goblin">
<item name="roi" amount="1"/>
<callback name="equip_newunits"/>
</set>
<set name="first_human">
<callback name="equip_newunits"/>
</set>
<set name="first_troll">
<skill name="building" level="1"/>
<skill name="perception" level="3"/>
<item name="stone" amount="50"/>
</set>
<set name="first_demon">
<skill name="stamina" level="15"/>
</set>
<set name="first_insect">
<item name="nestwarmth" amount="9"/>
</set>
<set name="first_halfling">
<skill name="trade" level="1"/>
<skill name="riding" level="2"/>
<item name="horse" amount="2"/>
<item name="cart" amount="1"/>
<item name="balm" amount="5"/>
<item name="spice" amount="5"/>
<item name="myrrh" amount="5"/>
<item name="jewel" amount="5"/>
<item name="oil" amount="5"/>
<item name="silk" amount="5"/>
<item name="incense" amount="5"/>
</set>
<set name="first_cat">
<item name="roi" amount="1"/>
<callback name="equip_newunits"/>
</set>
<set name="first_aquarian">
<skill name="sailing" level="1"/>
<callback name="equip_newunits"/>
</set>
<set name="first_centaur">
<callback name="equip_newunits"/>
</set>
<!-- equipment-sets for random encounters -->
<set name="random_desert">
<skill name="melee" level="d2"/>
<skill name="trade" level="d3"/>
<skill name="riding" level="d2+1"/>
<skill name="training" level="d2+1"/>
<item name="horse" amount="1"/>
<item name="sword" amount="1"/>
<item name="money" amount="d30+19"/>
</set>
<set name="random_swamp">
<skill name="stealth" level="d3+1"/>
<skill name="polearm" level="d3+1"/>
<item name="spear" amount="1"/>
<item name="money" amount="d20+9"/>
</set>
<set name="random_glacier">
<skill name="armorer" level="d2+1"/>
<skill name="melee" level="d2+1"/>
<item name="sword" amount="1"/>
<item name="money" amount="d20+19"/>
</set>
<set name="random_mountain">
<skill name="armorer" level="d2+1"/>
<skill name="melee" level="d2+1"/>
<skill name="trade" level="d3"/>
<item name="sword" amount="1"/>
<item name="money" amount="d40+59"/>
<subset chance="0.6">
<set name="item_plate"/>
</subset>
</set>
<set name="random_highland">
<skill name="melee" level="d2"/>
<item name="sword" amount="1"/>
<item name="money" amount="d10+19"/>
</set>
<set name="random_forest">
<skill name="stealth" level="d2"/>
<skill name="perception" level="d2+1"/>
<skill name="bow" level="d3+1"/>
<item name="bow" amount="1"/>
<item name="money" amount="d20+9"/>
<subset chance="0.2">
<set name="random_herbalist"/>
</subset>
</set>
<set name="random_herbalist">
<skill name="herbalism" level="d2"/>
</set>
<set name="random_villagers">
<item name="money" amount="d80+19"/>
<skill name="cartmaking" level="d2-1"/>
<skill name="mining" level="d2-1"/>
<skill name="quarrying" level="d2-1"/>
<skill name="forestry" level="d2-1"/>
<item name="horse" amount="2"/>
<item name="wagon" amount="d2-1"/>
<item name="money" amount="d30+10"/>
</set>
<set name="random_plain">
<item name="money" amount="d80+19"/>
<subset>
<set name="random_sword" chance="0.25"/>
<set name="random_spear" chance="0.25"/>
<set name="random_crossbow" chance="0.25"/>
<set name="random_bow" chance="0.25"/>
</subset>
<subset chance="0.4">
<set name="item_chain"/>
</subset>
<subset chance="0.3">
<set name="random_rider"/>
</subset>
</set>
<set name="random_spear">
<skill name="polearm" level="d3"/>
<item name="spear" amount="1"/>
</set>
<set name="random_sword">
<skill name="melee" level="d3"/>
<item name="sword" amount="1"/>
</set>
<set name="random_crossbow">
<skill name="crossbow" level="d3"/>
<item name="crossbow" amount="1"/>
</set>
<set name="random_bow">
<skill name="bow" level="d3"/>
<item name="bow" amount="1"/>
</set>
<set name="random_rider">
<item name="horse" amount="1"/>
<skill name="riding" level="d3"/>
</set>
<set name="recruited_dracoid">
<!-- dracoiden, von drachen rekrutiert -->
<skill name="polearm" level="d4+2"/>
<skill name="melee" level="d4+2"/>
<skill name="bow" level="d3+1"/>
<subset>
<!-- dracoiden haben immer eine von drei waffen -->
<set name="item_sword" chance="0.33"/>
<set name="item_spear" chance="0.33"/>
<set name="item_bow" chance="0.34"/>
</subset>
</set>
<set name="rising_undead">
<!-- untote, von den graebern auferstanden -->
<item name="rustysword" amount="1"/>
<item name="rustychainmail" amount="d2-1"/>
<subset chance="0.3">
<set name="item_rustyshield"/>
</subset>
</set>
<!-- single-item sets (that can be given a percentage-chance in a subset) -->
<set name="item_plate">
<item name="plate" amount="1"/>
</set>
<set name="item_spear">
<item name="spear" amount="1"/>
</set>
<set name="item_bow">
<item name="bow" amount="1"/>
</set>
<set name="item_sword">
<item name="sword" amount="1"/>
</set>
<set name="item_chain">
<item name="chainmail" amount="1"/>
</set>
<set name="item_log">
<item name="log" amount="1"/>
</set>
<set name="item_rustychain">
<item name="rustychainmail" amount="1"/>
</set>
<set name="dragon_spoils">
<item name="dragonblood" amount="4"/>
<item name="dragonhead" amount="1"/>
</set>
<set name="youngdragon_spoils">
<item name="dragonblood" amount="1"/>
</set>
<set name="wyrm_spoils">
<item name="dragonblood" amount="10"/>
<item name="dragonhead" amount="1"/>
</set>
<!-- sets that are used by the monster-spawning code -->
<set name="monster_dragon">
<skill name="magic" level="4"/>
<skill name="stealth" level="1"/>
<skill name="stamina" level="1"/>
<skill name="perception" level="d3"/>
<item name="money" amount="d500+99"/>
</set>
<set name="monster_braineater">
<skill name="stealth" level="1"/>
<skill name="perception" level="1"/>
</set>
<set name="monster_seaserpent">
<skill name="magic" level="4"/>
<skill name="stealth" level="2"/>
<skill name="stamina" level="1"/>
<skill name="perception" level="3"/>
</set>
</equipment>

2082
core/res/fr/strings.xml Normal file

File diff suppressed because it is too large Load diff

8520
core/res/messages.xml Normal file

File diff suppressed because it is too large Load diff

31
core/res/prefixes.xml Normal file
View file

@ -0,0 +1,31 @@
<?xml version="1.0"?>
<prefixes>
<prefix>Dunkel</prefix>
<prefix>Licht</prefix>
<prefix>Klein</prefix>
<prefix>Hoch</prefix>
<prefix>Huegel</prefix>
<prefix>Berg</prefix>
<prefix>Wald</prefix>
<prefix>Sumpf</prefix>
<prefix>Schnee</prefix>
<prefix>Sonnen</prefix>
<prefix>Mond</prefix>
<prefix>See</prefix>
<prefix>Tal</prefix>
<prefix>Schatten</prefix>
<prefix>Hoehlen</prefix>
<prefix>Blut</prefix>
<prefix>Wild</prefix>
<prefix>Chaos</prefix>
<prefix>Nacht</prefix>
<prefix>Nebel</prefix>
<prefix>Grau</prefix>
<prefix>Frost</prefix>
<prefix>Finster</prefix>
<prefix>Duester</prefix>
<prefix>flame</prefix>
<prefix>ice</prefix>
<prefix>star</prefix>
<prefix>black</prefix>
</prefixes>

View file

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<resource name="cart" big="true">
<item capacity="14000" weight="4000" score="60" vehicle="yes">
<construction skill="cartmaking" minskill="1" reqsize="1">
<requirement type="log" quantity="5"/>
</construction>
</item>
</resource>

View file

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<resource name="horse" limited="yes" material="rm_horse">
<item big="yes" weight="5000" score="10" capacity="7000" animal="yes">
<construction skill="training" minskill="1" reqsize="1"/>
<function name="give" value="givehorses"/>
</item>
<resourcelimit>
<function name="produce" value="lua_produceresource"/>
<function name="limit" value="lua_limitresource"/>
</resourcelimit>
</resource>

View file

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<resource name="hp" pooled="false">
<function name="change" value="lua_changeresource"/>
<function name="get" value="lua_getresource"/>
</resource>

View file

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<resource name="iron" limited="yes" material="rm_iron">
<item weight="500" score="10">
<construction skill="mining" minskill="1" reqsize="1"/>
</item>
<resourcelimit>
<modifier building="mine" type="skill" value="1"/>
<modifier building="mine" type="material" value="0.5"/>
<modifier race="dwarf" type="material" value="0.60"/>
<guard flag="mining"/>
</resourcelimit>
</resource>

View file

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<resource name="laen" limited="yes" material="rm_laen">
<item weight="200" score="100">
<construction skill="mining" minskill="7" reqsize="1"/>
</item>
<resourcelimit>
<modifier type="require" building="mine"/>
<guard flag="mining"/>
</resourcelimit>
</resource>

View file

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<resource name="log" material="rm_tree">
<item weight="500" score="10">
<construction skill="forestry" minskill="1" reqsize="1"/>
</item>
<resourcelimit>
<modifier building="sawmill" type="skill" value="1"/>
<modifier building="sawmill" type="material" value="0.5"/>
<guard flag="logging"/>
<function name="produce" value="lua_produceresource"/>
<function name="limit" value="lua_limitresource"/>
</resourcelimit>
</resource>

View file

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<resource name="mallorn" material="rm_mallorn">
<item weight="500" score="30">
<construction skill="forestry" minskill="2" reqsize="1"/>
</item>
<resourcelimit>
<modifier building="sawmill" type="skill" value="1"/>
<modifier building="sawmill" type="material" value="0.5"/>
<guard flag="logging"/>
<function name="produce" value="lua_produceresource"/>
<function name="limit" value="lua_limitresource"/>
</resourcelimit>
</resource>

View file

@ -0,0 +1,6 @@
<?xml version="1.0"?>
<resource name="mallornseed" limited="yes">
<item weight="10" score="100">
<construction skill="herbalism" minskill="4" reqsize="1"/>
</item>
</resource>

View file

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<resource name="peasant" pooled="false">
<function name="change" value="lua_changeresource"/>
<function name="get" value="lua_getresource"/>
</resource>

View file

@ -0,0 +1,6 @@
<?xml version="1.0"?>
<resource name="seed" limited="yes">
<item weight="10" score="50">
<construction skill="herbalism" minskill="3" reqsize="1"/>
</item>
</resource>

View file

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<resource name="stone" limited="yes" material="rm_stone">
<item weight="6000" score="10" big="yes">
<construction skill="quarrying" minskill="1" reqsize="1"/>
</item>
<resourcelimit>
<modifier building="quarry" type="skill" value="1"/>
<modifier building="quarry" type="material" value="0.5"/>
<modifier race="troll" type="material" value="0.75"/>
</resourcelimit>
</resource>

83
core/res/ships.xml Normal file
View file

@ -0,0 +1,83 @@
<?xml version="1.0"?>
<ships>
<ship name="trireme" range="7" storm="1.00" damage="1.00" cargo="200000" cptskill="4" minskill="1" sumskill="120" opensea="yes">
<coast terrain="ocean"/>
<coast terrain="plain"/>
<construction skill="shipcraft" minskill="4" maxsize="200" reqsize="1">
<requirement type="log" quantity="1"/>
</construction>
</ship>
<ship name="caravel" range="5" storm="1.00" damage="1.00" cargo="300000" cptskill="3" minskill="1" sumskill="30" opensea="yes">
<coast terrain="ocean"/>
<coast terrain="plain"/>
<construction skill="shipcraft" minskill="3" maxsize="250" reqsize="1">
<requirement type="log" quantity="1"/>
</construction>
</ship>
<ship name="dragonship" range="5" storm="1.00" damage="1.00" cargo="100000" cptskill="2" minskill="1" sumskill="50" opensea="yes">
<coast terrain="ocean"/>
<coast terrain="plain"/>
<construction skill="shipcraft" minskill="2" maxsize="100" reqsize="1">
<requirement type="log" quantity="1"/>
</construction>
</ship>
<ship name="longboat" range="3" storm="1.00" damage="1.00" cargo="50000" cptskill="1" minskill="1" sumskill="10" opensea="yes">
<coast terrain="ocean"/>
<coast terrain="plain"/>
<construction skill="shipcraft" minskill="1" maxsize="50" reqsize="1">
<requirement type="log" quantity="1"/>
</construction>
</ship>
<ship name="balloon" range="2" storm="1.00" damage="1.00" cargo="5000" cptskill="6" minskill="6" sumskill="6" opensea="yes" fly="yes">
<coast terrain="ocean"/>
<coast terrain="plain"/>
<coast terrain="swamp"/>
<coast terrain="desert"/>
<coast terrain="highland"/>
<coast terrain="mountain"/>
<coast terrain="glacier"/>
<coast terrain="volcano"/>
<coast terrain="activevolcano"/>
<coast terrain="iceberg_sleep"/>
<coast terrain="iceberg"/>
<construction skill="shipcraft" minskill="100" maxsize="5" reqsize="1"/>
</ship>
<ship name="boat" range="2" storm="1.00" damage="1.00" cargo="5000" cptskill="1" minskill="1" sumskill="2" opensea="yes">
<coast terrain="ocean"/>
<coast terrain="plain"/>
<coast terrain="swamp"/>
<coast terrain="desert"/>
<coast terrain="highland"/>
<coast terrain="mountain"/>
<coast terrain="glacier"/>
<coast terrain="volcano"/>
<coast terrain="activevolcano"/>
<coast terrain="iceberg_sleep"/>
<coast terrain="iceberg"/>
<construction skill="shipcraft" minskill="1" maxsize="5" reqsize="1">
<requirement type="log" quantity="1"/>
</construction>
</ship>
<ship name="flyingcarpet" range="3" storm="1.00" damage="1.00" cargo="50000" cptskill="6" minskill="6" sumskill="10" opensea="yes" fly="yes">
<coast terrain="ocean"/>
<coast terrain="plain"/>
<coast terrain="swamp"/>
<coast terrain="desert"/>
<coast terrain="highland"/>
<coast terrain="mountain"/>
<coast terrain="glacier"/>
<coast terrain="volcano"/>
<coast terrain="activevolcano"/>
<coast terrain="iceberg_sleep"/>
<coast terrain="iceberg"/>
<construction skill="shipcraft" minskill="100" maxsize="50" reqsize="1"/>
</ship>
</ships>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<spellbook name="cerddor">
<entry spell="create_roi" level="6" />
<entry spell="earn_silver#cerddor" level="1" />
<entry spell="create_aots" level="6" />
<entry spell="create_roqf" level="11" />
</spellbook>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<spellbook name="draig">
<entry spell="create_roi" level="6" />
<entry spell="earn_silver#draig" level="1" />
<entry spell="create_aots" level="6" />
<entry spell="create_firesword" level="12" />
<entry spell="create_trollbelt" level="9" />
</spellbook>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<spellbook name="gray">
<entry spell="create_runesword" level="6" />
<entry spell="create_chastitybelt" level="7" />
<entry spell="create_focus" level="9" />
<entry spell="create_ror" level="9" />
</spellbook>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<spellbook name="gwyrrd">
<entry spell="create_roi" level="6" />
<entry spell="earn_silver#gwyrrd" level="1" />
<entry spell="create_aots" level="6" />
<entry spell="create_magicherbbag" level="5" />
</spellbook>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<spellbook name="illaun">
<entry spell="create_roi" level="6" />
<entry spell="earn_silver#illaun" level="1" />
<entry spell="create_aots" level="6" />
<entry spell="create_dreameye" level="14" />
<entry spell="create_invisibility_sphere" level="13" />
</spellbook>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<spellbook name="tybied">
<entry spell="create_roi" level="6" />
<entry spell="earn_silver#tybied" level="1" />
<entry spell="create_aots" level="6" />
<entry spell="create_antimagic" level="7" />
<entry spell="create_rop" level="9" />
<entry spell="create_bagofholding" level="10" />
</spellbook>

145
core/res/spells.xml Normal file
View file

@ -0,0 +1,145 @@
<?xml version="1.0"?>
<spells xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="spellbooks/gray.xml"/>
<xi:include href="spellbooks/gwyrrd.xml"/>
<xi:include href="spellbooks/draig.xml"/>
<xi:include href="spellbooks/illaun.xml"/>
<xi:include href="spellbooks/cerddor.xml"/>
<xi:include href="spellbooks/tybied.xml"/>
<!-- shared spells -->
<spell name="create_roi" ship="true" rank="5" index="130">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="50" cost="fixed"/>
<resource name="money" amount="3000" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/>
</spell>
<spell name="create_aots" ship="true" rank="5" index="125">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="50" cost="fixed"/>
<resource name="money" amount="3000" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/>
</spell>
<!-- draig spells -->
<spell name="earn_silver#draig" ship="true" variable="true" rank="5" index="159">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="1" cost="level"/>
</spell>
<spell name="create_firesword" ship="true" rank="5" index="148">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="100" cost="fixed"/>
<resource name="p10" amount="1" cost="fixed"/>
<resource name="sword" amount="1" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/>
</spell>
<spell name="create_trollbelt" ship="true" rank="5" index="48">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="20" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/>
</spell>
<!-- gwyrrd spells -->
<spell name="earn_silver#gwyrrd" ship="true" variable="true" rank="5" index="159">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="1" cost="level"/>
</spell>
<spell name="create_magicherbbag" ship="true" rank="5" index="165">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="30" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/>
<resource name="p2" amount="1" cost="fixed"/>
</spell>
<!-- illaun spells -->
<spell name="earn_silver#illaun" ship="true" variable="true" rank="5" index="159">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="1" cost="level"/>
</spell>
<spell name="create_dreameye" ship="true" rank="5" index="149">
<function name="cast" value="lua_castspell"/>
<resource name="dragonhead" amount="1" cost="fixed"/>
<resource name="permaura" amount="5" cost="fixed"/>
</spell>
<spell name="create_invisibility_sphere" ship="true" rank="5" index="178">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="150" cost="fixed"/>
<resource name="money" amount="30000" cost="fixed"/>
<resource name="permaura" amount="3" cost="fixed"/>
</spell>
<!-- cerddor spells -->
<spell name="earn_silver#cerddor" ship="true" variable="true" rank="5" index="159">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="1" cost="level"/>
</spell>
<spell name="create_roqf" ship="true" rank="5" index="63">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="20" cost="fixed"/>
<resource name="money" amount="1000" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/>
</spell>
<!-- tybied spells -->
<spell name="earn_silver#tybied" ship="true" variable="true" rank="5" index="159">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="1" cost="level"/>
</spell>
<spell name="create_antimagic" ship="true" rank="5" index="38">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="50" cost="fixed"/>
<resource name="money" amount="3000" cost="fixed"/>
</spell>
<spell name="create_rop" ship="true" rank="5" index="1">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="100" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/>
<resource name="money" amount="4000" cost="fixed"/>
</spell>
<spell name="create_bagofholding" ship="true" rank="5" index="155">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="30" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/>
<resource name="money" amount="5000" cost="fixed"/>
</spell>
<!-- gray magic -->
<spell name="create_runesword" ship="true" rank="5" index="135">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="100" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/>
<resource name="money" amount="1000" cost="fixed"/>
<resource name="laensword" amount="1" cost="fixed"/>
</spell>
<spell name="create_chastitybelt" ship="true" rank="5" index="134">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="50" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/>
<resource name="money" amount="3000" cost="fixed"/>
</spell>
<spell name="create_focus" ship="true" rank="5" index="2">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="100" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/>
</spell>
<spell name="create_ror" ship="true" rank="5" index="3">
<function name="cast" value="lua_castspell"/>
<resource name="aura" amount="100" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/>
</spell>
</spells>

59
core/res/spoils.xml Normal file
View file

@ -0,0 +1,59 @@
<?xml version="1.0"?>
<resources>
<resource name="elfspoil">
<function name="change" value="changeitem"/>
<item weight="1"/>
</resource>
<resource name="demonspoil">
<function name="change" value="changeitem"/>
<item weight="1"/>
</resource>
<resource name="goblinspoil">
<function name="change" value="changeitem"/>
<item weight="1"/>
</resource>
<resource name="dwarfspoil">
<function name="change" value="changeitem"/>
<item weight="1"/>
</resource>
<resource name="halflingspoil">
<function name="change" value="changeitem"/>
<item weight="1"/>
</resource>
<resource name="humanspoil">
<function name="change" value="changeitem"/>
<item weight="1"/>
</resource>
<resource name="aquarianspoil">
<function name="change" value="changeitem"/>
<item weight="1"/>
</resource>
<resource name="insectspoil">
<function name="change" value="changeitem"/>
<item weight="1"/>
</resource>
<resource name="catspoil">
<function name="change" value="changeitem"/>
<item weight="1"/>
</resource>
<resource name="orcspoil">
<function name="change" value="changeitem"/>
<item weight="1"/>
</resource>
<resource name="trollspoil">
<function name="change" value="changeitem"/>
<item weight="1"/>
</resource>
</resources>

84
core/res/terrains.xml Normal file
View file

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<terrains>
<!-- defaults: walk="yes" sail="yes" fly="yes" shallow="yes" swim="no" forest="no" sea="no" land="yes" forbidden="no" arctic="no" cavalry="no" -->
<terrain name="ocean" size="100" shallow="no" walk="no" swim="yes" land="no" sea="yes" />
<terrain name="plain" size="10000" road="50" shallow="no" forest="yes" cavalry="yes" seed="3">
<herb name="h0" />
<herb name="h1" />
<herb name="h2" />
<herb name="h3" />
<herb name="h4" />
<herb name="h5" />
<resource name="iron" chance="0.1" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.15" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.01" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="swamp" size="2000" road="75" seed="2">
<herb name="h6" />
<herb name="h7" />
<herb name="h8" />
<resource name="iron" chance="0.02" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.02" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.02" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="desert" size="500" road="100" cavalry="yes" seed="2">
<herb name="h9" />
<herb name="h10" />
<herb name="h11" />
<resource name="iron" chance="0.15" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.25" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.025" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="highland" size="4000" road="100" cavalry="yes" seed="2">
<herb name="h12" />
<herb name="h13" />
<herb name="h14" />
<resource name="iron" chance="0.15" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.25" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.025" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="mountain" size="1000" road="250" seed="2">
<herb name="h15" />
<herb name="h16" />
<herb name="h17" />
<resource name="iron" chance="1.0" level="1" base="50" div="50" />
<resource name="stone" chance="1.0" level="1" base="100" div="100" />
<resource name="laen" chance="0.05" level="1" base="4" div="100" />
</terrain>
<terrain name="glacier" size="100" road="250" arctic="yes" seed="2">
<herb name="h18" />
<herb name="h19" />
<herb name="h20" />
<resource name="iron" chance="1.0" level="1" base="3" div="50" />
<resource name="stone" chance="1.0" level="1" base="2" div="100" />
<resource name="laen" chance="0.05" level="1" base="4" div="100" />
</terrain>
<terrain name="iceberg_sleep" size="100" road="250" arctic="yes">
<herb name="h18" />
<herb name="h19" />
<herb name="h20" />
<resource name="iron" chance="0.9" level="1" base="3" div="50" />
<resource name="stone" chance="0.9" level="1" base="2" div="100" />
<resource name="laen" chance="0.05" level="1" base="4" div="100" />
</terrain>
<terrain name="iceberg" size="100" arctic="yes">
<herb name="h18" />
<herb name="h19" />
<herb name="h20" />
<resource name="iron" chance="0.9" level="1" base="3" div="50" />
<resource name="stone" chance="0.9" level="1" base="2" div="100" />
</terrain>
<terrain name="firewall" size="100" road="250" land="no" walk="no" sail="no" fly="no" forbidden="yes" />
<terrain name="fog" sail="no" land="no" size="0" />
<terrain name="thickfog" forbidden="yes" sail="no" walk="no" fly="no" land="no" size="0" />
<terrain name="volcano" size="500" road="250" seed="1">
<resource name="iron" chance="0.5" level="1" base="50" div="50" />
<resource name="stone" chance="0.5" level="1" base="100" div="100" />
<resource name="laen" chance="0.075" level="1" base="4" div="100" />
</terrain>
<terrain name="activevolcano" size="500" road="250">
<resource name="iron" chance="0.5" level="1" base="50" div="50" />
<resource name="stone" chance="0.5" level="1" base="100" div="100" />
<resource name="laen" chance="0.075" level="1" base="4" div="100" />
</terrain>
</terrains>

14
core/res/weapons/axe.xml Normal file
View file

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<resource name="axe">
<item weight="200">
<function name="canuse" value="lua_canuse_item"/>
<construction skill="weaponsmithing" minskill="3" reqsize="1">
<requirement type="log" quantity="1"/>
<requirement type="iron" quantity="1"/>
</construction>
<weapon cut="true" skill="melee" offmod="1" defmod="-2">
<damage type="rider" value="2d6+4"/>
<damage type="footman" value="2d6+4"/>
</weapon>
</item>
</resource>

13
core/res/weapons/bow.xml Normal file
View file

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<resource name="bow">
<item weight="100">
<construction skill="weaponsmithing" minskill="2" reqsize="1">
<requirement type="log" quantity="1"/>
</construction>
<weapon pierce="true" missile="true" skill="bow" offmod="0" defmod="0" reload="0">
<damage type="rider" value="1d11+1"/>
<damage type="footman" value="1d11+1"/>
<modifier type="missile_target" value="2"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<resource name="catapult">
<item weight="10000">
<construction skill="cartmaking" minskill="5" reqsize="1">
<requirement type="log" quantity="10"/>
</construction>
<weapon siege="true" bash="true" missile="true" skill="catapult" offmod="0" defmod="0" reload="5">
<damage type="rider" value="3d10+5"/>
<damage type="footman" value="3d10+5"/>
<modifier type="missile_target" value="4"/>
<function name="attack" value="attack_catapult"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<resource name="crossbow">
<item weight="100">
<construction skill="weaponsmithing" minskill="3" reqsize="1">
<requirement type="log" quantity="1"/>
</construction>
<weapon armorpiercing="true" pierce="true" missile="true" skill="crossbow" offmod="0" defmod="0" reload="2">
<damage type="rider" value="3d3+5"/>
<damage type="footman" value="3d3+5"/>
<modifier type="missile_target" value="0"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<resource name="firesword">
<item weight="100">
<weapon minskill="7" magres="0.3" cut="true" skill="melee" offmod="1" defmod="1">
<function name="attack" value="attack_firesword"/>
<damage type="rider" value="3d6+10"/>
<damage type="footman" value="3d6+10"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<resource name="greatbow">
<item weight="100">
<function name="canuse" value="lua_canuse_item"/>
<construction skill="weaponsmithing" minskill="5" reqsize="1">
<modifier function="mod_elves_only"/>
<requirement type="mallorn" quantity="2"/>
</construction>
<weapon pierce="true" missile="true" skill="bow" offmod="0" defmod="0" reload="0" magres="0.0">
<damage type="rider" value="2d6+4"/>
<damage type="footman" value="2d6+4"/>
<modifier type="missile_target" value="2"/>
<modifier type="damage" value="1">
<race name="elf"/>
</modifier>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<resource name="greatsword">
<item weight="200" score="30">
<function name="canuse" value="lua_canuse_item"/>
<construction skill="weaponsmithing" minskill="4" reqsize="1">
<requirement type="iron" quantity="2"/>
</construction>
<weapon cut="true" skill="melee" offmod="-1" defmod="-2">
<damage type="rider" value="2d8+3"/>
<damage type="footman" value="2d8+3"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<resource name="halberd">
<item weight="200">
<function name="canuse" value="lua_canuse_item"/>
<construction skill="weaponsmithing" minskill="3" reqsize="1">
<requirement type="log" quantity="2"/>
<requirement type="iron" quantity="1"/>
</construction>
<weapon cut="true" skill="polearm" offmod="-1" defmod="2" magres="0.0">
<damage type="rider" value="2d6+3"/>
<damage type="footman" value="2d6+3"/>
<modifier type="skill" value="1" walking="true" against_riding="true" defensive="true"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<resource name="laensword">
<item weight="100" score="400">
<construction skill="weaponsmithing" minskill="8" reqsize="1">
<requirement type="laen" quantity="1"/>
</construction>
<weapon cut="true" skill="melee" offmod="1" defmod="1" magres="0.30">
<damage type="rider" value="3d6+10"/>
<damage type="footman" value="3d6+10"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<resource name="lance">
<item weight="200">
<function name="canuse" value="lua_canuse_item"/>
<construction skill="weaponsmithing" minskill="2" reqsize="1">
<requirement type="log" quantity="2"/>
</construction>
<weapon pierce="true" skill="polearm" offmod="0" defmod="-2">
<damage type="footman" value="1d5"/>
<damage type="rider" value="2d6+5"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<resource name="mallornbow">
<item weight="100">
<construction skill="weaponsmithing" minskill="5" reqsize="1">
<requirement type="mallorn" quantity="1"/>
</construction>
<weapon pierce="true" missile="true" skill="bow" offmod="0" defmod="0" reload="0" magres="0.15">
<damage type="rider" value="1d11+2"/>
<damage type="footman" value="1d11+2"/>
<modifier type="missile_target" value="2"/>
<modifier type="damage" value="1">
<race name="elf"/>
</modifier>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<resource name="mallorncrossbow">
<item weight="100">
<construction skill="weaponsmithing" minskill="5" reqsize="1">
<requirement type="mallorn" quantity="1"/>
</construction>
<weapon armorpiercing="true" pierce="true" missile="true" skill="crossbow" offmod="0" defmod="0" reload="2" magres="0.15">
<damage type="rider" value="3d3+5"/>
<damage type="footman" value="3d3+5"/>
<modifier type="missile_target" value="0"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<resource name="mallornlance">
<item weight="100">
<function name="canuse" value="lua_canuse_item"/>
<construction skill="weaponsmithing" minskill="5" reqsize="1">
<requirement type="mallorn" quantity="2"/>
</construction>
<weapon pierce="true" skill="polearm" minskill="5" offmod="0" defmod="0" magres="0.15">
<damage type="footman" value="1d5+1"/>
<damage type="rider" value="2d6+6"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<resource name="mallornspear">
<item weight="100">
<construction skill="weaponsmithing" minskill="5" reqsize="1">
<requirement type="mallorn" quantity="1"/>
</construction>
<weapon pierce="true" skill="polearm" minskill="5" offmod="0" defmod="0" magres="0.15">
<damage type="footman" value="1d10+1"/>
<damage type="rider" value="1d12+3"/>
<modifier type="skill" value="1" riding="true" against_riding="true" against_walking="true" offensive="true"/>
<modifier type="skill" value="1" walking="true" against_riding="true" against_walking="true" defensive="true"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<resource name="rep_crossbow">
<item weight="100">
<function name="canuse" value="lua_canuse_item"/>
<construction skill="weaponsmithing" minskill="5" reqsize="1">
<modifier function="mod_dwarves_only"/>
<requirement type="log" quantity="1"/>
<requirement type="iron" quantity="1"/>
</construction>
<weapon armorpiercing="true" pierce="true" missile="true" skill="crossbow" offmod="0" defmod="0" reload="1">
<damage type="rider" value="3d4+5"/>
<damage type="footman" value="3d4+5"/>
<modifier type="missile_target" value="0"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<resource name="runesword">
<item weight="100" score="2000">
<weapon minskill="7" cut="true" magical="yes" skill="melee" offmod="2" defmod="2">
<function name="attack" value="attack_firesword"/>
<damage type="rider" value="3d10+10"/>
<damage type="footman" value="3d10+10"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<resource name="rustyaxe">
<item weight="200">
<function name="canuse" value="lua_canuse_item"/>
<construction skill="weaponsmithing" minskill="3" reqsize="1">
<requirement type="log" quantity="1"/>
<requirement type="iron" quantity="1"/>
</construction>
<weapon cut="true" skill="melee" offmod="0" defmod="-3">
<damage type="rider" value="2d6"/>
<damage type="footman" value="2d6"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<resource name="rustygreatsword">
<item weight="200" score="20">
<construction skill="weaponsmithing" minskill="4" reqsize="1">
<requirement type="iron" quantity="2"/>
</construction>
<weapon cut="true" skill="melee" offmod="-2" defmod="-3">
<damage type="rider" value="2d8"/>
<damage type="footman" value="2d8"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<resource name="rustyhalberd">
<item weight="200" score="20">
<function name="canuse" value="lua_canuse_item"/>
<construction skill="weaponsmithing" minskill="3" reqsize="1">
<requirement type="iron" quantity="1"/>
<requirement type="log" quantity="1"/>
</construction>
<weapon cut="true" skill="polearm" offmod="-2" defmod="-1">
<damage type="rider" value="2d6"/>
<damage type="footman" value="2d6"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<resource name="rustysword">
<item weight="100" score="10">
<construction skill="weaponsmithing" minskill="3" reqsize="1">
<requirement type="iron" quantity="1"/>
</construction>
<weapon cut="true" skill="melee" offmod="-1" defmod="-1">
<damage type="rider" value="1d9"/>
<damage type="footman" value="1d9"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<resource name="spear">
<item weight="100">
<construction skill="weaponsmithing" minskill="2" reqsize="1">
<requirement type="log" quantity="1"/>
</construction>
<weapon pierce="true" skill="polearm" offmod="0" defmod="0">
<damage type="footman" value="1d10"/>
<damage type="rider" value="1d12+2"/>
<modifier type="skill" value="1" riding="true" against_riding="true" against_walking="true" offensive="true"/>
<modifier type="skill" value="1" walking="true" against_riding="true" against_walking="true" defensive="true"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<resource name="sword">
<item weight="100" score="30">
<construction skill="weaponsmithing" minskill="3" reqsize="1">
<requirement type="iron" quantity="1"/>
</construction>
<weapon cut="true" skill="melee">
<damage type="rider" value="1d9+2"/>
<damage type="footman" value="1d9+2"/>
</weapon>
</item>
</resource>

View file

@ -0,0 +1,11 @@
callbacks = {}
callbacks["attrib_init"] = function(attr)
if attr.name ~= nil then
local init = callbacks["init_" .. attr.name]
if init ~=nil then
init(attr)
end
end
end

118
core/scripts/default.lua Executable file
View file

@ -0,0 +1,118 @@
function change_locales(localechange)
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 dbupdate()
update_scores()
edb = db.open(config.basepath.."/eressea.db")
if edb~=nil then
edb:update_factions()
edb:update_scores()
else
print("could not open "..config.basepath.."/eressea.db")
end
end
function nmr_check(maxnmrs)
local nmrs = get_nmrs(1)
if nmrs >= maxnmrs then
print("Shit. More than " .. maxnmrs .. " factions with 1 NMR (" .. nmrs .. ")")
write_summary()
eressea.write_game("aborted.dat")
return -1
end
print (nmrs .. " Factions with 1 NMR")
return 0
end
function open_game(turn)
file = "" .. get_turn()
return eressea.read_game(file .. ".dat")
end
function write_emails(locales)
local files = {}
local key
local locale
local file
for key, locale in pairs(locales) do
files[locale] = io.open(config.basepath .. "/emails." .. locale, "w")
end
local faction
for faction in factions() do
if faction.email~="" then
files[faction.locale]:write(faction.email .. "\n")
end
end
for key, file in pairs(files) do
file:close()
end
end
function write_addresses()
local file
local faction
file = io.open(config.basepath .. "/adressen", "w")
for faction in factions() do
-- print(faction.id .. " - " .. faction.locale)
file:write(tostring(faction) .. ":" .. faction.email .. ":" .. faction.info .. "\n")
end
file:close()
end
function write_aliases()
local file
local faction
file = io.open(config.basepath .. "/aliases", "w")
for faction in factions() do
local unit
if faction.email ~= "" then
file:write("partei-" .. itoa36(faction.id) .. ": " .. faction.email .. "\n")
for unit in faction.units do
file:write("einheit-" .. itoa36(unit.id) .. ": " .. faction.email .. "\n")
end
end
end
file:close()
end
function write_files(locales)
write_passwords()
write_reports()
write_summary()
-- write_emails(locales)
-- write_aliases()
-- write_addresses()
end
function write_scores()
scores = {}
for r in regions() do
f = r.owner
if f~=nil then
value = scores[f.id]
if value==nil then value=0 end
value = value + r:get_resource("money")/100
scores[f.id] = value
end
end
for f in factions() do
score=scores[f.id]
if score==nil then score=0 end
print(math.floor(score)..":"..f.name..":"..itoa36(f.id))
end
end

View file

@ -0,0 +1,95 @@
---------------------------------------------
-- Return indentation string for passed level
---------------------------------------------
local function tabs(i)
return string.rep(".",i).." " -- Dots followed by a space
end
-----------------------------------------------------------
-- Return string representation of parameter's value & type
-----------------------------------------------------------
local function toStrType(t)
local function fttu2hex(t) -- Grab hex value from tostring() output
local str = tostring(t);
if str == nil then
return "tostring() failure! \n"
else
local str2 = string.match(str,"[ :][ (](%x+)")
if str2 == nil then
return "string.match() failure: "..str.."\n"
else
return "0x"..str2
end
end
end
-- Stringify a value of a given type using a table of functions keyed
-- by the name of the type (Lua's version of C's switch() statement).
local stringify = {
-- Keys are all possible strings that type() may return,
-- per http://www.lua.org/manual/5.1/manual.html#pdf-type.
["nil"] = function(v) return "nil (nil)" end,
["string"] = function(v) return '"'..v..'" (string)' end,
["number"] = function(v) return v.." (number)" end,
["boolean"] = function(v) return tostring(v).." (boolean)" end,
["function"] = function(v) return fttu2hex(v).." (function)" end,
["table"] = function(v) return fttu2hex(v).." (table)" end,
["thread"] = function(v) return fttu2hex(v).." (thread)" end,
["userdata"] = function(v) return fttu2hex(v).." (userdata)" end
}
return stringify[type(t)](t)
end
-------------------------------------
-- Count elements in the passed table
-------------------------------------
local function lenTable(t) -- What Lua builtin does this simple thing?
local n=0 -- '#' doesn't work with mixed key types
if ("table" == type(t)) then
for key in pairs(t) do -- Just count 'em
n = n + 1
end
return n
else
return nil
end
end
--------------------------------
-- Pretty-print the passed table
--------------------------------
local function do_dumptable(t, indent, seen)
-- "seen" is an initially empty table used to track all tables
-- that have been dumped so far. No table is dumped twice.
-- This also keeps the code from following self-referential loops,
-- the need for which was found when first dumping "_G".
if ("table" == type(t)) then -- Dump passed table
seen[t] = 1
if (indent == 0) then
print ("The passed table has "..lenTable(t).." entries:")
indent = 1
end
for f,v in pairsByKeys(t) do
if ("table" == type(v)) and (seen[v] == nil) then -- Recurse
print( tabs(indent)..toStrType(f).." has "..lenTable(v).." entries: {")
do_dumptable(v, indent+1, seen)
print( tabs(indent).."}" )
else
print( tabs(indent)..toStrType(f).." = "..toStrType(v))
end
end
else
print (tabs(indent).."Not a table!")
end
end
--------------------------------
-- Wrapper to handle persistence
--------------------------------
function dumptable(t) -- Only global declaration in the package
-- This wrapper exists only to set the environment for the first run:
-- The second param is the indentation level.
-- The third param is the list of tables dumped during this call.
-- Getting this list allocated and freed was a pain, and this
-- wrapper was the best solution I came up with...
return do_dumptable(t, 0, {})
end

View file

25
core/scripts/gates.lua Normal file
View file

@ -0,0 +1,25 @@
-- implements gates and travel between them
-- used in HSE and Eressea
function gate_travel(b, units)
-- we've found which units we want to exchange, now swap them:
local u
for key, u in pairs(units) do
u.region = b.region
u.building = b
end
end
function gate_units(b, maxsize)
local size = maxsize
local units = {}
local u
for u in b.units do
if u.number<=size and u.weight<=u.capacity then
units[u] = u
size = size - u.number
end
end
return units
end

43
core/scripts/init.lua Executable file
View file

@ -0,0 +1,43 @@
require(config.game .. ".modules")
require "default"
require "resources"
function run_editor()
local turn = get_turn()
if turn==0 then
turn = read_turn()
set_turn(turn)
end
eressea.read_game(turn .. ".dat")
gmtool.editor()
end
function run_tests()
print("running tests")
require "lunit"
lunit.clearstats()
local argv = tests or {}
local stats = lunit.main(argv)
if stats.errors > 0 or stats.failed > 0 then
return 1
end
return 0
end
function run_turn()
require(config.game .. ".main")
local turn = get_turn()
if turn==0 then
turn = read_turn()
set_turn(turn)
end
orderfile = orderfile or config.basepath .. '/orders.' .. turn
print("executing turn " .. get_turn() .. " with " .. orderfile)
local result = process(orderfile)
if result==0 then
dbupdate()
end
return result
end

101
core/scripts/multis.lua Normal file
View file

@ -0,0 +1,101 @@
function kill_nonstarters()
for f in factions() do
if f.lastturn==1 then
kill_faction(f, true)
end
end
end
function kill_multis(multis, destructive)
for idx, fno in ipairs(multis) do
local f = get_faction(fno)
if f~=nil and f.email=="doppelspieler@eressea.de" then
kill_faction(f, destructive)
end
end
end
function mark_multis(multis, block)
if multis~=nil then
for idx, fno in ipairs(multis) do
local f = get_faction(fno)
if f~=nil and f.email~="doppelspieler@eressea.de" then
print("* multi-player " .. tostring(f))
mark_multi(f, block)
end
end
end
end
-- destroy a faction
-- destructive: kill all of its buildings and the home region, too.
function kill_faction(f, destructive)
for u in f.units do
local r = u.region
local b = u.building
unit.destroy(u)
if destructive and b~=nil then
building.destroy(b)
local nuke = true
for v in r.units do
if v.faction.id~=f.id then
-- print("cannot nuke: " .. tostring(v.faction))
nuke = false
break
end
end
r.terrain_name = nil
if nuke and num_oceans(r)<=1 then
-- print("nuke!")
r.terrain = "ocean"
else
-- print("cannot nuke: > 1 oceans")
r.terrain = "glacier"
r.peasants = 10
r:set_resource("money", 100)
b = building.create(r, "monument")
b.size = 1
b.name = "Memento Mori"
b.info = "Eine kleine " .. translate("race::" .. f.race .."_x") .. "-Statue erinnert hier an ein verschwundenes Volk"
end
end
end
faction.destroy(f)
end
local function mark_multi(f, block)
f.password = "doppelspieler"
f.email = "doppelspieler@eressea.de"
f.banner = "Diese Partei steht wegen vermuteten Doppelspiels unter Beobachtung."
for u in f.units do
u.race_name = "toad"
if block and u.building~=nil then
local found = false
for u2 in u.region.units do
if u2.faction.id~=u.faction.id then
found = true
break
end
end
if not found then
u.region.terrain_name = "firewall"
u.region:set_flag(2) -- RF_BLOCKED
end
end
end
end
local function num_oceans(r)
local oceans = 0
local p = r:next(5)
for d = 0,5 do
local n = r:next(d)
if p.terrain~="ocean" and n.terrain=="ocean" then
oceans = oceans +1
end
p = n
end
return oceans
end

View file

@ -0,0 +1,89 @@
function peasant_getresource(u)
return u.region:get_resource("peasant")
end
function peasant_changeresource(u, delta)
local p = u.region:get_resource("peasant")
p = p + delta
if p < 0 then
p = 0
end
u.region:set_resource("peasant", p)
return p
end
function hp_getresource(u)
return u.hp
end
function hp_changeresource(u, delta)
local hp = u.hp + delta
if hp < u.number then
if hp < 0 then
hp = 0
end
u.number = hp
end
u.hp = hp
return hp
end
function horse_limit(r)
return r:get_resource("horse")
end
function horse_produce(r, n)
local horses = r:get_resource("horse")
if horses>=n then
r:set_resource("horse", horses-n)
else
r:set_resource("horse", 0)
end
end
function log_limit(r)
-- if r:get_flag(1) then -- RF_MALLORN
-- return 0
-- end
return r:get_resource("tree") + r:get_resource("sapling")
end
function log_produce(r, n)
local trees = r:get_resource("tree")
if trees>=n then
r:set_resource("tree", trees-n)
else
r:set_resource("tree", 0)
n = n - trees
trees = r:get_resource("sapling")
if trees>=n then
r:set_resource("sapling", trees-n)
else
r:set_resource("sapling", 0)
end
end
end
function mallorn_limit(r)
if not r:get_flag(1) then -- RF_MALLORN
return 0
end
return r:get_resource("tree") + r:get_resource("sapling")
end
function mallorn_produce(r, n)
local trees = r:get_resource("tree")
if trees>=n then
r:set_resource("tree", trees-n)
else
r:set_resource("tree", 0)
n = n - trees
trees = r:get_resource("sapling")
if trees>=n then
r:set_resource("sapling", trees-n)
else
r:set_resource("sapling", 0)
end
end
end

6
core/scripts/schema.sql Normal file
View file

@ -0,0 +1,6 @@
CREATE TABLE email(id INTEGER PRIMARY KEY, md5 VARCHAR(32) UNIQUE NOT NULL, email VARCHAR(32), bounces INT DEFAULT 0, confirmed TIMESTAMP DEFAULT NULL);
CREATE TABLE faction (id INTEGER PRIMARY KEY, user_id INTEGER REFERENCES user(id), no INTEGER, name VARCHAR(64), game_id INTEGER REFERENCES game(id), race VARCHAR(10), lang CHAR(2));
CREATE TABLE faction_email (faction_id INTEGER REFERENCES faction(id), email_id INTEGER REFERENCES email(id));
CREATE TABLE game (id INTEGER PRIMARY KEY, name VARCHAR(20), last_turn INTEGER);
CREATE TABLE score (turn INTEGER, faction_id INTEGER REFERENCES faction(id), value INTEGER, UNIQUE(turn, faction_id));
CREATE TABLE user(id INTEGER PRIMARY KEY, email_id INTEGER REFERENCES email(id), creation TIMESTAMP DEFAULT CURRENT_TIMESTAMP);

16
core/scripts/setup.lua Normal file
View file

@ -0,0 +1,16 @@
local srcpath = config.source_dir
local respath = srcpath .. '/' .. config.game .. '/res/'
local paths = { config.game..'/scripts/?.lua';'lunit/?.lua','external/lunit/?.lua','scripts/?.lua';'scripts/?' }
tests = {'common'}
for idx, test in pairs(tests) do
tests[idx] = srcpath .. '/scripts/tests/' .. test .. '.lua'
end
for idx, path in pairs(paths) do
package.path = srcpath .. '/' .. path .. ';' .. package.path
end
read_xml(respath..'config-'..config.game..'.xml', respath..'catalog-'..config.game..'.xml')
require "init"

156
core/scripts/spells.lua Normal file
View file

@ -0,0 +1,156 @@
function creation_message(mage, type, number)
local msg = message.create("item_create_spell")
local err = 0
err = err + msg:set_unit("mage", mage)
err = err + msg:set_int("number", number)
err = err + msg:set_resource("item", type)
if err ~= 0 then
return nil
else
return msg
end
end
local function create_item(mage, level, name, number)
local count = number or 1
mage:add_item(name, count);
local msg = creation_message(mage, name, count)
msg:send_faction(mage.faction)
return level
end
-- Wasser des Lebens
function create_potion_p2(r, mage, level, force)
return create_item(mage, level, "p2", level)
end
-- Siebenmeilentee
function create_potion_p0(r, mage, level, force)
return create_item(mage, level, "p0", level)
end
-- Wundsalbe
function create_potion_ointment(r, mage, level, force)
return create_item(mage, level, "ointment", level)
end
-- Bauernblut
function create_potion_peasantblood(r, mage, level, force)
return create_item(mage, level, "peasantblood", level)
end
-- Pferdeglück
function create_potion_p9(r, mage, level, force)
return create_item(mage, level, "p9", level)
end
-- Schaffenstrunk
function create_potion_p3(r, mage, level, force)
return create_item(mage, level, "p3", level)
end
-- Heiltrank
function create_potion_p14(r, mage, level, force)
return create_item(mage, level, "p14", level)
end
-- Elixier der Macht
function create_potion_p13(r, mage, level, force)
return create_item(mage, level, "p13", level)
end
-- Erschaffe ein Flammenschwert
function create_firesword(r, mage, level, force)
return create_item(mage, level, "firesword")
end
-- Erschaffe einen Gürtel der Trollstärke
function create_trollbelt(r, mage, level, force)
return create_item(mage, level, "trollbelt")
end
-- Erschaffe einen Ring der Unsichtbarkeit
function create_roi(r, mage, level, force)
return create_item(mage, level, "roi")
end
-- Erschaffe einen Ring der flinken Finger
function create_roqf(r, mage, level, force)
return create_item(mage, level, "roqf")
end
-- Erschaffe ein Amulett des wahren Sehens
function create_aots(r, mage, level, force)
return create_item(mage, level, "aots")
end
-- Erschaffe einen magischen Kräuterbeutel
function create_magicherbbag(r, mage, level, force)
return create_item(mage, level, "magicherbbag")
end
-- Erschaffe einen Taktikkristal
function create_dreameye(r, mage, level, force)
return create_item(mage, level, "dreameye")
end
-- Erschaffe einen Antimagiekristall
function create_antimagic(r, mage, level, force)
return create_item(mage, level, "antimagic")
end
-- Erschaffe eine Sphäre der Unsichtbarkeit
function create_invisibility_sphere(r, mage, level, force)
return create_item(mage, level, "sphereofinv")
end
-- Erschaffe einen Gürtel der Keuschheit
function create_chastitybelt(r, mage, level, force)
return create_item(mage, level, "ao_chastity")
end
-- Erschaffe ein Runenschwert
function create_runesword(r, mage, level, force)
return create_item(mage, level, "runesword")
end
-- Erschaffe ein Aurafokus
function create_focus(r, mage, level, force)
return create_item(mage, level, "aurafocus")
end
-- Erschaffe einen Ring der Macht
function create_rop(r, mage, level, force)
return create_item(mage, level, "rop")
end
-- Erschaffe einen Ring der Regeneration
function create_ror(r, mage, level, force)
return create_item(mage, level, "ror")
end
-- Erschaffe einen Zauberbeutel
function create_bagofholding(r, mage, level, force)
return create_item(mage, level, "magicbag")
end
-- TODO:
function earn_silver(r, mage, level, force)
local money = r:get_resource("money")
local wanted = 50 * force
local amount = wanted
if wanted > money then
amount = money
end
r:set_resource("money", money - amount)
mage:add_item("money", amount)
local msg = message.create("income")
msg:set_unit("unit", mage)
msg:set_region("region", r)
msg:set_int("mode", 6)
msg:set_int("wanted", wanted)
msg:set_int("amount", amount)
msg:send_faction(mage.faction)
return level
end

53
core/scripts/tests/attrib.lua Executable file
View file

@ -0,0 +1,53 @@
require "lunit"
module("tests.eressea.attrib", package.seeall, lunit.testcase)
function has_attrib(u, value)
for a in u.attribs do
if (a.data==value) then return true end
end
return false
end
function test_attrib_global()
a = attrib.create('global', {})
eressea.write_game('attrib.dat')
eressea.free_game()
eressea.read_game('attrib.dat')
end
function test_attrib()
local r = region.create(0,0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
local u2 = unit.create(f, r, 1)
data = { arr = { 'a', 'b', 'c' }, name = 'familiar', events = { die = 'familiar_died' }, data = { mage = u2 } }
a = { 'a' }
b = { 'a' }
uno = u.id
u2no = u2.id
a = attrib.create(u, 12)
a = attrib.create(u, "enno")
a = attrib.create(u, u2)
a = attrib.create(u, data)
eressea.write_game("attrib.dat")
eressea.free_game()
eressea.read_game("attrib.dat")
u = get_unit(uno)
u2 = get_unit(u2no)
assert_false(has_attrib(u, 42))
assert_true(has_attrib(u, "enno"))
assert_true(has_attrib(u, 12))
for a in u.attribs do
x = a.data
if (type(x)=="table") then
assert_equal('a', x.arr[1])
assert_equal('familiar', x.name)
assert_equal('familiar_died', x.events.die)
assert_equal(u2, x.data.mage)
break
end
end
end

61
core/scripts/tests/bindings.lua Executable file
View file

@ -0,0 +1,61 @@
require "lunit"
local eressea = eressea
local _G = _G
module("tests.bindings", lunit.testcase)
function test_eressea()
assert_equal("function", _G.type(eressea.free_game))
assert_equal("function", _G.type(eressea.read_game))
assert_equal("function", _G.type(eressea.write_game))
assert_equal("function", _G.type(eressea.read_orders))
end
function test_process()
assert_equal("function", _G.type(eressea.process.update_long_order))
assert_equal("function", _G.type(eressea.process.markets))
assert_equal("function", _G.type(eressea.process.produce))
assert_equal("function", _G.type(eressea.process.make_temp))
assert_equal("function", _G.type(eressea.process.settings))
assert_equal("function", _G.type(eressea.process.set_allies))
assert_equal("function", _G.type(eressea.process.set_prefix))
assert_equal("function", _G.type(eressea.process.set_stealth))
assert_equal("function", _G.type(eressea.process.set_status))
assert_equal("function", _G.type(eressea.process.set_name))
assert_equal("function", _G.type(eressea.process.set_group))
assert_equal("function", _G.type(eressea.process.set_origin))
assert_equal("function", _G.type(eressea.process.quit))
assert_equal("function", _G.type(eressea.process.study))
assert_equal("function", _G.type(eressea.process.movement))
assert_equal("function", _G.type(eressea.process.use))
assert_equal("function", _G.type(eressea.process.battle))
assert_equal("function", _G.type(eressea.process.siege))
assert_equal("function", _G.type(eressea.process.leave))
assert_equal("function", _G.type(eressea.process.promote))
assert_equal("function", _G.type(eressea.process.renumber))
assert_equal("function", _G.type(eressea.process.restack))
assert_equal("function", _G.type(eressea.process.set_spells))
assert_equal("function", _G.type(eressea.process.set_help))
assert_equal("function", _G.type(eressea.process.contact))
assert_equal("function", _G.type(eressea.process.enter))
assert_equal("function", _G.type(eressea.process.magic))
assert_equal("function", _G.type(eressea.process.give_control))
assert_equal("function", _G.type(eressea.process.regeneration))
assert_equal("function", _G.type(eressea.process.guard_on))
assert_equal("function", _G.type(eressea.process.guard_off))
assert_equal("function", _G.type(eressea.process.explain))
assert_equal("function", _G.type(eressea.process.messages))
assert_equal("function", _G.type(eressea.process.reserve))
assert_equal("function", _G.type(eressea.process.claim))
assert_equal("function", _G.type(eressea.process.follow))
assert_equal("function", _G.type(eressea.process.alliance))
assert_equal("function", _G.type(eressea.process.idle))
assert_equal("function", _G.type(eressea.process.set_default))
end
function test_settings()
assert_equal("function", _G.type(eressea.settings.set))
assert_equal("function", _G.type(eressea.settings.get))
end

65
core/scripts/tests/bson.lua Executable file
View file

@ -0,0 +1,65 @@
require "lunit"
module("tests.eressea.bson", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
end
function test_bson_create()
local a = attrib.create("global", 12)
assert_not_equal(nil, a)
for a in attrib.get("global") do
assert_equal(a.data, 12)
end
end
function test_illegal_arg()
local a = attrib.create(nil, 42)
assert_equal(nil, a)
a = attrib.create("fred", 42)
assert_equal(nil, a)
end
function test_bson_readwrite()
local i, r = region.create(0, 0, "mountain")
attrib.create(r, 42)
i = eressea.write_game("test_read_write.dat")
assert_equal(0, i)
eressea.free_game()
r = get_region(0, 0)
assert_equal(nil, r)
i = eressea.read_game("test_read_write.dat")
assert_equal(0, i)
r = get_region(0, 0)
assert_not_equal(nil, r)
for a in attrib.get(r) do
assert_equal(a.data, 42)
end
end
function test_bson()
local r = region.create(0, 0, "mountain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
assert_not_equal(nil, u)
assert_not_equal(nil, r)
assert_not_equal(nil, f)
attrib.create(r, 1)
assert_equal(attrib.get(r)().data, 1)
attrib.create(u, 3)
assert_equal(attrib.get(u)().data, 3)
attrib.create(f, 5)
assert_equal(attrib.get(f)().data, 5)
end
function test_bson_with_multiple_attribs()
local r = region.create(0, 0, "mountain")
attrib.create(r, { a=1})
attrib.create(r, { a=5})
local total = 0
for a in attrib.get(r) do
total = total + a.data.a;
end
assert_equal(6, total)
end

1339
core/scripts/tests/common.lua Executable file

File diff suppressed because it is too large Load diff

266
core/scripts/tests/orders.lua Executable file
View file

@ -0,0 +1,266 @@
require "lunit"
local _G = _G
local eressea = eressea
local default_ship = config.ships[1]
local default_building = config.buildings[1]
module("tests.orders", lunit.testcase)
local r, f, u
function setup()
eressea.free_game()
r = _G.region.create(0, 0, "mountain")
f = _G.faction.create("noreply@eressea.de", "human", "de")
u = _G.unit.create(f, r, 1)
u:clear_orders()
eressea.settings.set("rules.economy.food", "4")
eressea.settings.set("nmr.removenewbie", "0")
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("NewbieImmunity", "0")
end
function test_learn()
u:add_order("LERNEN Hiebwaffen")
_G.process_orders()
assert_not_equal(0, u:get_skill("melee"))
end
function test_give()
local u2 = _G.unit.create(f, r, 1)
u:add_item("money", 10)
u:add_order("GIB " .. u2.id .. "5 SILBER")
_G.process_orders()
assert_not_equal(5, u:get_item("money"))
assert_not_equal(5, u2:get_item("money"))
end
function test_make_temp()
u:add_order("MACHE TEMP 123 'Herpderp'")
u:add_order("// this comment will be copied")
u:add_order("ENDE")
eressea.process.make_temp()
for x in f.units do
if x.name == 'Herpderp' then u=x end
end
assert_equal('Herpderp', u.name)
assert_equal(0, u.number)
local c = 0
for o in u.orders do
assert_equal('// this comment will be copied', o)
c = c + 1
end
assert_equal(1, c)
end
function test_give_temp()
u.number = 2
u:add_order("GIB TEMP 123 1 PERSON")
u:add_order("MACHE TEMP 123 'Herpderp'")
u:add_order("ENDE")
_G.process_orders()
assert_equal(1, u.number)
for x in f.units do
if x.name == 'Herpderp' then u=x end
end
assert_equal('Herpderp', u.name)
assert_equal(1, u.number)
end
function test_process_settings()
f.options = 0
u:add_order("EMAIL herp@derp.com")
u:add_order("BANNER 'Herpderp'")
u:add_order("PASSWORT 'HerpDerp'")
u:add_order("OPTION AUSWERTUNG")
eressea.process.settings()
assert_equal("herp@derp.com", f.email)
assert_equal("Herpderp", f.info)
assert_equal("HerpDerp", f.password)
assert_equal(1, f.options)
end
function test_process_group()
u:add_order("GRUPPE herp")
eressea.process.set_group()
assert_equal('herp', u.group)
end
function test_process_origin()
u:add_order("URSPRUNG 1 2")
eressea.process.set_origin()
x, y = u.faction:get_origin()
assert_equal(1, x)
assert_equal(2, y)
end
function test_process_quit()
fno = f.id
u:add_order("STIRB '" .. u.faction.password .. "'")
assert_not_equal(nil, _G.get_faction(fno))
eressea.process.quit()
eressea.write_game('test.dat')
eressea.free_game()
eressea.read_game('test.dat')
assert_equal(nil, _G.get_faction(fno))
end
function test_process_make()
u.region:set_resource('tree', 100)
u:set_skill('forestry', 1)
u:add_order('MACHE HOLZ')
eressea.process.produce()
assert_equal(1, u:get_item('log'))
end
function test_process_study()
u:add_order("LERNEN Holzfaellen")
eressea.process.update_long_order()
eressea.process.study()
x, y = u.faction:get_origin()
assert_equal(1, u:get_skill('forestry'))
end
function test_process_teach()
eressea.settings.set("study.random_progress", "0")
u:set_skill('forestry', 3)
u2 = _G.unit.create(f, r, 10)
u2:clear_orders()
u2:set_skill('forestry', 1)
u2:add_order("LERNEN Holzfaellen")
u:add_order("LEHREN " .. _G.itoa36(u2.id))
eressea.process.update_long_order()
eressea.process.study()
assert_equal(2, u2:get_skill('forestry'))
end
function test_process_move()
r2 = _G.region.create(1, 0, 'plain')
u:add_order('NACH O')
assert_not_equal(r2.id, u.region.id)
eressea.process.update_long_order()
eressea.process.movement()
assert_equal(r2, u.region)
end
function test_process_leave()
r2 = _G.region.create(1, 0, 'plain')
b = _G.building.create(r, default_building)
u.building = b
assert_equal(b, u.building)
u:add_order('VERLASSEN')
eressea.process.leave()
assert_not_equal(b, u.building)
end
function test_process_name_unit()
u:add_order("BENENNE EINHEIT 'Weasel'")
u:add_order("BESCHREIBE EINHEIT 'Juanita'")
eressea.process.set_name()
assert_equal('Weasel', u.name)
assert_equal('Juanita', u.info)
end
function test_process_name_faction()
u:add_order("BENENNE PARTEI 'Herpderp'")
eressea.process.set_name()
assert_equal('Herpderp', f.name)
end
function test_process_name_building()
u:add_order("BENENNE GEBAEUDE 'Herpderp'")
u.building = _G.building.create(r, default_building)
eressea.process.set_name()
assert_equal('Herpderp', u.building.name)
end
function test_process_name_ship()
u:add_order("BENENNE SCHIFF 'Herpderp'")
u.ship = _G.ship.create(r, default_ship)
eressea.process.set_name()
assert_equal('Herpderp', u.ship.name)
end
function test_process_renumber()
u:add_order("NUMMER EINHEIT 'ii'")
eressea.process.renumber()
assert_equal(666, u.id)
end
function test_process_enter()
b = _G.building.create(r, default_building)
u:add_order("BETRETEN GEBAEUDE " .. _G.itoa36(b.id))
eressea.process.enter(1)
assert_equal(b, u.building)
end
function test_process_restack()
eressea.process.restack()
end
function test_process_setspells()
eressea.process.set_spells()
end
function test_process_help()
eressea.process.set_help()
end
function test_process_contact()
eressea.process.contact()
end
function test_process_battle()
eressea.process.battle()
end
function test_process_magic()
eressea.process.magic()
end
function test_process_give_control()
eressea.process.give_control()
end
function test_process_regeneration()
eressea.process.regeneration()
end
function test_process_guard_on()
eressea.process.guard_on()
end
function test_process_guard_off()
eressea.process.guard_off()
end
function test_process_explain()
eressea.process.explain()
end
function test_process_messages()
eressea.process.messages()
end
function test_process_reserve()
eressea.process.reserve()
end
function test_process_claim()
eressea.process.claim()
end
function test_process_follow()
eressea.process.follow()
end
function test_process_idle()
eressea.process.idle()
end
function test_process_set_default()
eressea.process.set_default()
end

97
core/scripts/tests/spells.lua Executable file
View file

@ -0,0 +1,97 @@
require "lunit"
module("tests.eressea.spells", package.seeall, lunit.testcase)
local r, f, u
function setup()
eressea.free_game()
eressea.settings.set("magic.regeneration.enable", "0")
eressea.settings.set("magic.fumble.enable", "0")
eressea.settings.set("rules.economy.food", "4")
r = region.create(0, 0, "plain")
f = faction.create("spell_payment@eressea.de", "elf", "de")
u = unit.create(f, r, 1)
u.magic = "gray"
u:set_skill("magic", 12)
end
function test_spell_payment()
u:add_spell("create_roi")
local permaura = u:get_pooled("permaura")
u:add_item("money", 3000)
u.aura = 50
u:clear_orders()
u:add_order("ZAUBERE 'Erschaffe einen Ring der Unsichtbarkeit' ")
process_orders()
write_reports()
assert_equal(1, u:get_item("roi"))
assert_equal(0, u:get_item("money"))
assert_equal(0, u.aura)
assert_equal(permaura-1, u:get_pooled("permaura"))
end
function test_spell_not_found_no_payment()
local permaura = u:get_pooled("permaura")
u:add_item("money", 3000)
u.aura = 50
u:clear_orders()
u:add_order("ZAUBERE 'Erschaffe einen Ring der Unsichtbarkeit' ")
process_orders()
assert_equal(0, u:get_item("roi"))
assert_equal(3000, u:get_item("money"))
assert_equal(50, u.aura)
assert_equal(permaura, u:get_pooled("permaura"))
end
function test_create_roi()
u:add_spell('create_roi')
u:cast_spell('create_roi')
assert_equal(1, u:get_item("roi"))
end
function test_create_roqf()
u:add_spell('create_roqf')
u:cast_spell('create_roqf')
assert_equal(1, u:get_item("roqf"))
end
function test_create_aots()
u:add_spell('create_aots')
u:cast_spell('create_aots')
assert_equal(1, u:get_item("aots"))
end
function test_create_ror()
u:add_spell('create_ror')
u:cast_spell('create_ror')
assert_equal(1, u:get_item("ror"))
end
function test_create_trollbelt()
u:add_spell('create_trollbelt')
u:cast_spell('create_trollbelt')
assert_equal(1, u:get_item("trollbelt"))
end
function test_create_dreameye()
u:add_spell('create_dreameye')
u:cast_spell('create_dreameye')
assert_equal(1, u:get_item("dreameye"))
end
function test_create_antimagic()
u:add_spell('create_antimagic')
u:cast_spell('create_antimagic')
assert_equal(1, u:get_item("antimagic"))
end
function test_create_rop()
u:add_spell('create_rop')
u:cast_spell('create_rop')
assert_equal(1, u:get_item("rop"))
end

206
core/src/CMakeLists.txt Executable file
View file

@ -0,0 +1,206 @@
cmake_minimum_required(VERSION 2.6)
project (eressea C)
IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
ENDIF(CMAKE_COMPILER_IS_GNUCC)
set (ERESSEA_LIBRARY ${PROJECT_NAME} CACHE INTERNAL "Eressea Core Library")
set (ERESSEA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "Eressea Core headers")
add_subdirectory(bindings)
set (ERESSEA_LIBRARIES
${CUTEST_LIBRARIES}
${CRITBIT_LIBRARIES}
${QUICKLIST_LIBRARIES}
${CRYPTO_LIBRARIES}
${INIPARSER_LIBRARIES}
${LUA_LIBRARIES}
${LIBXML2_LIBRARIES}
${SQLITE3_LIBRARIES}
${CURSES_LIBRARIES}
CACHE STRING "Eressea Libraries"
)
include_directories (${ERESSEA_INCLUDE_DIR})
include_directories (${CRITBIT_INCLUDE_DIR})
include_directories (${CRYPTO_INCLUDE_DIR})
include_directories (${QUICKLIST_INCLUDE_DIR})
include_directories (${CUTEST_INCLUDE_DIR})
include_directories (${LUA_INCLUDE_DIR})
include_directories (${TOLUA_INCLUDE_DIR})
include_directories (${LIBXML2_INCLUDE_DIR})
include_directories (${INIPARSER_INCLUDE_DIR})
FILE (GLOB_RECURSE LIB_HDR *.h)
set (TEST_SRC
tests.c
tests_test.c
gamecode/economy_test.c
gamecode/laws_test.c
gamecode/market_test.c
kernel/ally_test.c
kernel/battle_test.c
kernel/building_test.c
kernel/curse_test.c
kernel/equipment_test.c
kernel/item_test.c
kernel/magic_test.c
kernel/move_test.c
kernel/pool_test.c
kernel/reports_test.c
kernel/ship_test.c
kernel/spellbook_test.c
kernel/spell_test.c
util/base36_test.c
util/bsdstring_test.c
util/functions_test.c
util/umlaut_test.c
)
set (LIB_SRC
attributes/alliance.c
attributes/attributes.c
attributes/fleechance.c
attributes/follow.c
attributes/giveitem.c
attributes/gm.c
attributes/hate.c
attributes/iceberg.c
attributes/key.c
attributes/matmod.c
attributes/moved.c
attributes/movement.c
attributes/object.c
attributes/orcification.c
attributes/otherfaction.c
attributes/overrideroads.c
attributes/racename.c
attributes/raceprefix.c
attributes/reduceproduction.c
attributes/targetregion.c
eressea.c
gamecode/archetype.c
gamecode/creation.c
gamecode/creport.c
gamecode/economy.c
gamecode/give.c
gamecode/items.c
gamecode/laws.c
gamecode/market.c
gamecode/monster.c
gamecode/randenc.c
gamecode/report.c
gamecode/spy.c
gamecode/study.c
gamecode/summary.c
gamecode/xmlreport.c
gmtool.c
items/artrewards.c
items/demonseye.c
items/itemtypes.c
items/phoenixcompass.c
items/seed.c
items/speedsail.c
items/weapons.c
items/xerewards.c
kernel/alchemy.c
kernel/alliance.c
kernel/ally.c
kernel/battle.c
kernel/binarystore.c
kernel/build.c
kernel/building.c
kernel/calendar.c
kernel/command.c
kernel/config.c
kernel/connection.c
kernel/curse.c
kernel/equipment.c
kernel/faction.c
kernel/group.c
kernel/item.c
kernel/magic.c
kernel/message.c
kernel/move.c
kernel/names.c
kernel/order.c
kernel/pathfinder.c
kernel/plane.c
kernel/player.c
kernel/pool.c
kernel/race.c
kernel/region.c
kernel/reports.c
kernel/resources.c
kernel/save.c
kernel/ship.c
kernel/skill.c
kernel/spellbook.c
kernel/spell.c
kernel/sqlite.c
kernel/teleport.c
kernel/terrain.c
kernel/textstore.c
kernel/unit.c
kernel/xmlreader.c
modules/arena.c
modules/autoseed.c
modules/dungeon.c
modules/gmcmd.c
modules/museum.c
modules/score.c
modules/weather.c
modules/wormhole.c
modules/xmas.c
triggers/changefaction.c
triggers/changerace.c
triggers/clonedied.c
triggers/createcurse.c
triggers/createunit.c
triggers/gate.c
triggers/giveitem.c
triggers/killunit.c
triggers/removecurse.c
triggers/shock.c
triggers/timeout.c
triggers/triggers.c
triggers/unguard.c
triggers/unitmessage.c
util/attrib.c
util/base36.c
util/bsdstring.c
util/console.c
util/crmessage.c
util/dice.c
util/event.c
util/filereader.c
util/functions.c
util/goodies.c
util/language.c
util/listbox.c
util/lists.c
util/log.c
util/message.c
util/nrmessage.c
util/os.c
util/parser.c
util/rand.c
util/resolve.c
util/sql.c
util/strings.c
util/translation.c
util/umlaut.c
util/unicode.c
util/xml.c
)
add_library(${ERESSEA_LIBRARY} ${LIB_SRC} ${BIND_SRC} ${LIB_HDR})
target_link_libraries(${ERESSEA_LIBRARY} ${ERESSEA_LIBRARIES})
add_executable(${PROJECT_NAME}_test ${TEST_SRC})
target_link_libraries(${PROJECT_NAME}_test ${ERESSEA_LIBRARY})
add_test(${PROJECT_NAME} ${PROJECT_NAME}_test)

View file

@ -0,0 +1,32 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifndef H_ATTRIBUTE_AGGRESSIVE
#define H_ATTRIBUTE_AGGRESSIVE
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_aggressive;
extern struct attrib *make_aggressive(double probability);
extern void init_aggressive(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,34 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#include <platform.h>
#include <kernel/types.h>
#include "alliance.h"
#include <kernel/save.h>
#include <util/attrib.h>
attrib_type at_alliance = {
"alliance",
NULL,
NULL,
NULL,
a_writeint,
a_readint,
ATF_UNIQUE
};

View file

@ -0,0 +1,30 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifndef H_ATTRIBUTE_ALLIANCE
#define H_ATTRIBUTE_ALLIANCE
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_alliance;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,80 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#include <platform.h>
#include <kernel/config.h>
#include "attributes.h"
/* attributes includes */
#include "follow.h"
#include "gm.h"
#include "hate.h"
#include "iceberg.h"
#include "key.h"
#include "moved.h"
#include "movement.h"
#include "object.h"
#include "orcification.h"
#include "otherfaction.h"
#include "overrideroads.h"
#include "racename.h"
#include "raceprefix.h"
#include "reduceproduction.h"
#include "targetregion.h"
#ifdef WDW_PYRAMID
# include "alliance.h"
#endif
/* kernel includes */
#include <kernel/unit.h>
#include <kernel/faction.h>
#include <kernel/region.h>
#include <kernel/save.h>
#include <kernel/ship.h>
#include <kernel/building.h>
/* util includes */
#include <util/attrib.h>
attrib_type at_unitdissolve = {
"unitdissolve", NULL, NULL, NULL, a_writechars, a_readchars
};
void register_attributes(void)
{
at_register(&at_object);
at_register(&at_unitdissolve);
at_register(&at_overrideroads);
at_register(&at_raceprefix);
at_register(&at_iceberg);
at_register(&at_key);
at_register(&at_gm);
at_register(&at_follow);
at_register(&at_targetregion);
at_register(&at_orcification);
at_register(&at_hate);
at_register(&at_reduceproduction);
at_register(&at_otherfaction);
at_register(&at_racename);
at_register(&at_movement);
at_register(&at_moved);
#ifdef WDW_PYRAMID
at_register(&at_alliance);
#endif /* WDW_PYRAMID */
}

View file

@ -0,0 +1,30 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifndef H_ATTRIBUTE_ATTRIBUTES
#define H_ATTRIBUTE_ATTRIBUTES
#ifdef __cplusplus
extern "C" {
#endif
extern void register_attributes(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,43 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#include <platform.h>
#include "fleechance.h"
#include <util/attrib.h>
attrib_type at_fleechance = {
"fleechance",
NULL,
NULL,
NULL,
NULL,
NULL,
};
attrib *make_fleechance(float fleechance)
{
attrib *a = a_new(&at_fleechance);
a->data.flt = fleechance;
return a;
}
void init_fleechance(void)
{
at_register(&at_fleechance);
}

View file

@ -0,0 +1,33 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifndef H_ATTRIBUTE_FLEECHANCE
#define H_ATTRIBUTE_FLEECHANCE
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_fleechance;
extern struct attrib *make_fleechance(float fleechance);
extern void init_fleechance(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,44 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#include <platform.h>
#include "follow.h"
#include <kernel/config.h>
#include <kernel/unit.h>
#include <util/attrib.h>
#include <util/storage.h>
#include <util/variant.h>
static int read_follow(attrib * a, void *owner, struct storage *store)
{
read_unit_reference(store); /* skip it */
return AT_READ_FAIL;
}
attrib_type at_follow = {
"follow", NULL, NULL, NULL, NULL, read_follow
};
attrib *make_follow(struct unit * u)
{
attrib *a = a_new(&at_follow);
a->data.v = u;
return a;
}

View file

@ -0,0 +1,34 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifndef H_ATTRIBUTE_FOLLOW
#define H_ATTRIBUTE_FOLLOW
#ifdef __cplusplus
extern "C" {
#endif
extern struct attrib_type at_follow;
struct unit;
extern struct attrib *make_follow(struct unit *u);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,132 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#include <platform.h>
#include "giveitem.h"
#include <kernel/config.h>
/* kernel includes */
#include <kernel/building.h>
#include <kernel/region.h>
#include <kernel/unit.h>
#include <kernel/item.h>
/* util includes */
#include <util/attrib.h>
#include <util/base36.h>
#include <util/resolve.h>
#include <util/storage.h>
#include <util/goodies.h>
/* libc includes */
#include <stdlib.h>
#include <string.h>
typedef struct give_data {
struct building *building;
struct item *items;
} give_data;
static void
a_writegive(const attrib * a, const void *owner, struct storage *store)
{
give_data *gdata = (give_data *) a->data.v;
item *itm;
write_building_reference(gdata->building, store);
for (itm = gdata->items; itm; itm = itm->next) {
store->w_tok(store, resourcename(itm->type->rtype, 0));
store->w_int(store, itm->number);
}
store->w_tok(store, "end");
}
static int a_readgive(attrib * a, void *owner, struct storage *store)
{
give_data *gdata = (give_data *) a->data.v;
variant var;
char zText[32];
var.i = store->r_id(store);
if (var.i > 0) {
gdata->building = findbuilding(var.i);
if (gdata->building == NULL) {
ur_add(var, &gdata->building, resolve_building);
}
} else {
gdata->building = NULL;
}
for (;;) {
int i;
store->r_tok_buf(store, zText, sizeof(zText));
if (!strcmp("end", zText))
break;
i = store->r_int(store);
if (i == 0)
i_add(&gdata->items, i_new(it_find(zText), i));
}
return AT_READ_OK;
}
static void a_initgive(struct attrib *a)
{
a->data.v = calloc(sizeof(give_data), 1);
}
static void a_finalizegive(struct attrib *a)
{
free(a->data.v);
}
static int a_giveitem(attrib * a)
{
give_data *gdata = (give_data *) a->data.v;
unit *u;
if (gdata->building == NULL || gdata->items == NULL)
return 0;
u = building_owner(gdata->building);
if (u == NULL)
return 1;
while (gdata->items) {
item *itm = gdata->items;
i_change(&u->items, itm->type, itm->number);
i_free(i_remove(&gdata->items, itm));
}
return 0;
}
attrib_type at_giveitem = {
"giveitem",
a_initgive, a_finalizegive,
a_giveitem,
a_writegive, a_readgive
};
attrib *make_giveitem(struct building * b, struct item * ip)
{
attrib *a = a_new(&at_giveitem);
give_data *gd = (give_data *) a->data.v;
gd->building = b;
gd->items = ip;
return a;
}
void init_giveitem(void)
{
at_register(&at_giveitem);
}

View file

@ -0,0 +1,36 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifndef H_ATTRIBUTE_GIVEITEM
#define H_ATTRIBUTE_GIVEITEM
#ifdef __cplusplus
extern "C" {
#endif
struct building;
struct item;
extern struct attrib_type at_giveitem;
extern struct attrib *make_giveitem(struct building *b, struct item *items);
extern void init_giveitem(void);
#ifdef __cplusplus
}
#endif
#endif

57
core/src/attributes/gm.c Normal file
View file

@ -0,0 +1,57 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#include <platform.h>
#include <kernel/config.h>
#include "gm.h"
/* kernel includes */
#include <kernel/plane.h>
/* util includes */
#include <util/attrib.h>
#include <util/storage.h>
static void write_gm(const attrib * a, const void *owner, struct storage *store)
{
write_plane_reference((plane *) a->data.v, store);
}
static int read_gm(attrib * a, void *owner, struct storage *store)
{
plane *pl;
int result = read_plane_reference(&pl, store);
a->data.v = pl;
return result;
}
attrib_type at_gm = {
"gm",
NULL,
NULL,
NULL,
write_gm,
read_gm,
};
attrib *make_gm(const struct plane * pl)
{
attrib *a = a_new(&at_gm);
a->data.v = (void *)pl;
return a;
}

35
core/src/attributes/gm.h Normal file
View file

@ -0,0 +1,35 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifndef H_ATTRIBUTE_GM
#define H_ATTRIBUTE_GM
#ifdef __cplusplus
extern "C" {
#endif
/* this is an attribute used by the kernel (isallied) */
struct plane;
extern struct attrib_type at_gm;
extern struct attrib *make_gm(const struct plane *pl);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,68 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#include <platform.h>
#include <kernel/config.h>
#include "hate.h"
#include <kernel/unit.h>
#include <kernel/version.h>
#include <util/attrib.h>
#include <util/resolve.h>
#include <util/storage.h>
static int verify_hate(attrib * a)
{
if (a->data.v == NULL) {
return 0;
}
return 1;
}
static void
write_hate(const attrib * a, const void *owner, struct storage *store)
{
write_unit_reference((unit *) a->data.v, store);
}
static int read_hate(attrib * a, void *owner, struct storage *store)
{
int result =
read_reference(&a->data.v, store, read_unit_reference, resolve_unit);
if (result == 0 && !a->data.v) {
return AT_READ_FAIL;
}
return AT_READ_OK;
}
attrib_type at_hate = {
"hates",
NULL,
NULL,
verify_hate,
write_hate,
read_hate,
};
attrib *make_hate(struct unit * u)
{
attrib *a = a_new(&at_hate);
a->data.v = u;
return a;
}

Some files were not shown because too many files have changed in this diff Show more