forked from github/server
kicking out a few more hardcoded item_type objects.
This commit is contained in:
parent
cb9106473b
commit
f6524ee015
12 changed files with 88 additions and 109 deletions
|
@ -36,6 +36,11 @@
|
||||||
static int
|
static int
|
||||||
use_skillpotion(struct unit * u, const struct item_type * itype, int amount, struct order * ord)
|
use_skillpotion(struct unit * u, const struct item_type * itype, int amount, struct order * ord)
|
||||||
{
|
{
|
||||||
|
/* the problem with making this a lua function is that there's no way
|
||||||
|
* to get the list of skills for a unit. and with the way skills are
|
||||||
|
* currently saved, it doesn't look likely (can't make eressea::list
|
||||||
|
* from them)
|
||||||
|
*/
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i!=amount;++i) {
|
for (i=0;i!=amount;++i) {
|
||||||
skill * sv = u->skills;
|
skill * sv = u->skills;
|
||||||
|
@ -52,23 +57,6 @@ use_skillpotion(struct unit * u, const struct item_type * itype, int amount, str
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static resource_type rt_skillpotion = {
|
|
||||||
{ "skillpotion", "skillpotion_p" },
|
|
||||||
{ "skillpotion", "skillpotion_p" },
|
|
||||||
RTF_ITEM,
|
|
||||||
&res_changeitem
|
|
||||||
};
|
|
||||||
|
|
||||||
item_type it_skillpotion = {
|
|
||||||
&rt_skillpotion, /* resourcetype */
|
|
||||||
0, 0, 0, /* flags, weight, capacity */
|
|
||||||
NULL, /* construction */
|
|
||||||
&use_skillpotion,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
use_manacrystal(struct unit * u, const struct item_type * itype, int amount, struct order * ord)
|
use_manacrystal(struct unit * u, const struct item_type * itype, int amount, struct order * ord)
|
||||||
{
|
{
|
||||||
|
@ -91,28 +79,9 @@ use_manacrystal(struct unit * u, const struct item_type * itype, int amount, str
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static resource_type rt_manacrystal = {
|
|
||||||
{ "manacrystal", "manacrystal_p" },
|
|
||||||
{ "manacrystal", "manacrystal_p" },
|
|
||||||
RTF_ITEM,
|
|
||||||
&res_changeitem
|
|
||||||
};
|
|
||||||
|
|
||||||
item_type it_manacrystal = {
|
|
||||||
&rt_manacrystal, /* resourcetype */
|
|
||||||
0, 0, 0, /* flags, weight, capacity */
|
|
||||||
NULL, /* construction */
|
|
||||||
&use_manacrystal,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
register_xerewards(void)
|
register_xerewards(void)
|
||||||
{
|
{
|
||||||
it_register(&it_skillpotion);
|
|
||||||
it_register(&it_manacrystal);
|
|
||||||
register_function((pf_generic)use_skillpotion, "useskillpotion");
|
register_function((pf_generic)use_skillpotion, "useskillpotion");
|
||||||
register_function((pf_generic)use_manacrystal, "usemanacrystal");
|
register_function((pf_generic)use_manacrystal, "usemanacrystal");
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern struct item_type it_skillpotion;
|
|
||||||
extern struct item_type it_astralcrystal;
|
|
||||||
extern void register_xerewards(void);
|
extern void register_xerewards(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -332,20 +332,6 @@ use_museumexitticket(unit *u, const struct item_type *itype, int amount, order *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
resource_type rt_museumexitticket = {
|
|
||||||
{ "museumexitticket", "museumexitticket_p"},
|
|
||||||
{ "museumexitticket", "museumexitticket_p"},
|
|
||||||
RTF_ITEM,
|
|
||||||
&res_changeitem
|
|
||||||
};
|
|
||||||
|
|
||||||
item_type it_museumexitticket = {
|
|
||||||
&rt_museumexitticket,
|
|
||||||
ITF_CURSED, 0, 0,
|
|
||||||
NULL,
|
|
||||||
&use_museumexitticket
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
use_museumticket(unit *u, const struct item_type *itype, int amount, order * ord)
|
use_museumticket(unit *u, const struct item_type *itype, int amount, order * ord)
|
||||||
{
|
{
|
||||||
|
@ -382,25 +368,11 @@ use_museumticket(unit *u, const struct item_type *itype, int amount, order * ord
|
||||||
i_change(&u->items, itype, -1);
|
i_change(&u->items, itype, -1);
|
||||||
|
|
||||||
/* Benutzer ein Exitticket geben */
|
/* Benutzer ein Exitticket geben */
|
||||||
i_change(&u->items, &it_museumexitticket, 1);
|
i_change(&u->items, itype, 1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
resource_type rt_museumticket = {
|
|
||||||
{ "museumticket", "museumticket_p"},
|
|
||||||
{ "museumticket", "museumticket_p"},
|
|
||||||
RTF_ITEM,
|
|
||||||
&res_changeitem
|
|
||||||
};
|
|
||||||
|
|
||||||
item_type it_museumticket = {
|
|
||||||
&rt_museumticket,
|
|
||||||
ITF_NONE, 0, 0,
|
|
||||||
NULL,
|
|
||||||
&use_museumticket
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
void
|
||||||
register_museum(void)
|
register_museum(void)
|
||||||
{
|
{
|
||||||
|
@ -409,14 +381,8 @@ register_museum(void)
|
||||||
at_register(&at_museumgivebackcookie);
|
at_register(&at_museumgivebackcookie);
|
||||||
at_register(&at_museumgiveback);
|
at_register(&at_museumgiveback);
|
||||||
|
|
||||||
rt_register(&rt_museumticket);
|
register_function((pf_generic)use_museumticket, "use_museumticket");
|
||||||
it_register(&it_museumticket);
|
register_function((pf_generic)use_museumexitticket, "use_museumexitticket");
|
||||||
|
|
||||||
rt_register(&rt_museumexitticket);
|
|
||||||
it_register(&it_museumexitticket);
|
|
||||||
|
|
||||||
register_function((pf_generic)use_museumticket, "usemuseumticket");
|
|
||||||
register_function((pf_generic)use_museumexitticket, "usemuseumexitticket");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -65,7 +65,7 @@ xe_givepotion(unit *u, struct order *ord)
|
||||||
cmistake(u, ord, 63, MSG_EVENT);
|
cmistake(u, ord, 63, MSG_EVENT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
i_change(&u2->items, &it_skillpotion, 1);
|
i_change(&u2->items, it_find("skillpotion"), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/reports.h>
|
#include <kernel/reports.h>
|
||||||
#include <kernel/save.h>
|
#include <kernel/save.h>
|
||||||
|
#include <kernel/skill.h>
|
||||||
#include <kernel/teleport.h>
|
#include <kernel/teleport.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
|
@ -217,6 +218,15 @@ lua_equipunit(unit& u, const char * eqname)
|
||||||
equip_unit(&u, get_equipment(eqname));
|
equip_unit(&u, get_equipment(eqname));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
lua_learnskill(unit& u, const char * skname, float chances)
|
||||||
|
{
|
||||||
|
skill_t sk = sk_find(skname);
|
||||||
|
if (sk!=NOSKILL) {
|
||||||
|
learn_skill(&u, sk, chances);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
bind_eressea(lua_State * L)
|
bind_eressea(lua_State * L)
|
||||||
{
|
{
|
||||||
|
@ -239,6 +249,7 @@ bind_eressea(lua_State * L)
|
||||||
def("remove_empty_units", &remove_empty_units),
|
def("remove_empty_units", &remove_empty_units),
|
||||||
|
|
||||||
def("equip_unit", &lua_equipunit),
|
def("equip_unit", &lua_equipunit),
|
||||||
|
def("learn_skill", &lua_learnskill),
|
||||||
|
|
||||||
/* scripted monsters */
|
/* scripted monsters */
|
||||||
def("plan_monsters", &lua_planmonsters),
|
def("plan_monsters", &lua_planmonsters),
|
||||||
|
|
|
@ -1,5 +1,49 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
|
<resource name="aog">
|
||||||
|
<!-- Amulett des Treffens -->
|
||||||
|
<item notlost="yes" weight="0"/>
|
||||||
|
</resource>
|
||||||
|
|
||||||
|
<!-- museum items -->
|
||||||
|
<resource name="museumexitticket">
|
||||||
|
<!-- you get your stuff back when leaving the museum -->
|
||||||
|
<item notlost="yes" weight="0">
|
||||||
|
<function name="use" value="use_museumexitticket"/>
|
||||||
|
</item>
|
||||||
|
</resource>
|
||||||
|
|
||||||
|
<resource name="museumticket">
|
||||||
|
<!-- you get your stuff back when leaving the museum -->
|
||||||
|
<item weight="0">
|
||||||
|
<function name="use" value="use_museumticket"/>
|
||||||
|
</item>
|
||||||
|
</resource>
|
||||||
|
|
||||||
|
<!-- XE items -->
|
||||||
|
<resource name="skillpotion">
|
||||||
|
<!-- gives user one free learning attempt -->
|
||||||
|
<item weight="0">
|
||||||
|
<function name="use" value="useskillpotion"/>
|
||||||
|
</item>
|
||||||
|
</resource>
|
||||||
|
|
||||||
|
<resource name="manacrystal">
|
||||||
|
<!-- gives user free aura -->
|
||||||
|
<item weight="0">
|
||||||
|
<function name="use" value="usemanacrystal"/>
|
||||||
|
</item>
|
||||||
|
</resource>
|
||||||
|
|
||||||
|
<!-- HSE items -->
|
||||||
|
<resource name="studypotion">
|
||||||
|
<item weight="0">
|
||||||
|
<function name="use" value="use_studypotion"/>
|
||||||
|
</item>
|
||||||
|
</resource>
|
||||||
|
|
||||||
|
<!-- xmas items -->
|
||||||
<resource name="mistletoe">
|
<resource name="mistletoe">
|
||||||
<!-- Sets the chance of escape in a fight to 100 percent -->
|
<!-- Sets the chance of escape in a fight to 100 percent -->
|
||||||
<item notlost="yes" weight="0">
|
<item notlost="yes" weight="0">
|
||||||
|
@ -7,6 +51,25 @@
|
||||||
</item>
|
</item>
|
||||||
</resource>
|
</resource>
|
||||||
|
|
||||||
|
<resource name="speedsail">
|
||||||
|
<item weight="0" cursed="yes">
|
||||||
|
<function name="use" value="use_speedsail"/>
|
||||||
|
</item>
|
||||||
|
</resource>
|
||||||
|
|
||||||
|
<resource name="snowball">
|
||||||
|
<!-- xmas gimmik -->
|
||||||
|
<item notlost="yes" weight="0">
|
||||||
|
<function name="use" value="usesnowball"/>
|
||||||
|
</item>
|
||||||
|
</resource>
|
||||||
|
|
||||||
|
<resource name="snowman">
|
||||||
|
<!-- xmas gimmik -->
|
||||||
|
<item notlost="yes" weight="1"/>
|
||||||
|
</resource>
|
||||||
|
|
||||||
|
<!-- items -->
|
||||||
<resource name="seed" limited="yes">
|
<resource name="seed" limited="yes">
|
||||||
<item weight="10" score="50">
|
<item weight="10" score="50">
|
||||||
<construction skill="herbalism" minskill="3" reqsize="1"/>
|
<construction skill="herbalism" minskill="3" reqsize="1"/>
|
||||||
|
@ -31,35 +94,6 @@
|
||||||
</item>
|
</item>
|
||||||
</resource>
|
</resource>
|
||||||
|
|
||||||
<resource name="aog">
|
|
||||||
<!-- Amulett des Treffens -->
|
|
||||||
<item notlost="yes" weight="0"/>
|
|
||||||
</resource>
|
|
||||||
|
|
||||||
<resource name="snowball">
|
|
||||||
<!-- xmas gimmik -->
|
|
||||||
<item notlost="yes" weight="0">
|
|
||||||
<function name="use" value="usesnowball"/>
|
|
||||||
</item>
|
|
||||||
</resource>
|
|
||||||
|
|
||||||
<resource name="studypotion">
|
|
||||||
<item weight="0">
|
|
||||||
<function name="use" value="use_studypotion"/>
|
|
||||||
</item>
|
|
||||||
</resource>
|
|
||||||
|
|
||||||
<resource name="speedsail">
|
|
||||||
<item weight="0" cursed="yes">
|
|
||||||
<function name="use" value="use_speedsail"/>
|
|
||||||
</item>
|
|
||||||
</resource>
|
|
||||||
|
|
||||||
<resource name="snowman">
|
|
||||||
<!-- xmas gimmik -->
|
|
||||||
<item notlost="yes" weight="1"/>
|
|
||||||
</resource>
|
|
||||||
|
|
||||||
<resource name="mallornbow">
|
<resource name="mallornbow">
|
||||||
<item weight="100">
|
<item weight="100">
|
||||||
<construction skill="weaponsmithing" minskill="5" reqsize="1">
|
<construction skill="weaponsmithing" minskill="5" reqsize="1">
|
||||||
|
|
|
@ -72,6 +72,7 @@ if orderfile==nil then
|
||||||
print "you must specify an orderfile"
|
print "you must specify an orderfile"
|
||||||
else
|
else
|
||||||
loadscript("spells.lua")
|
loadscript("spells.lua")
|
||||||
|
loadscript("extensions.lua")
|
||||||
process(orderfile)
|
process(orderfile)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ end
|
||||||
function run_scripts()
|
function run_scripts()
|
||||||
scripts = {
|
scripts = {
|
||||||
"spells.lua",
|
"spells.lua",
|
||||||
"familiars.lua",
|
"extensions.lua",
|
||||||
"eternath.lua",
|
"eternath.lua",
|
||||||
"wedding-jadee.lua",
|
"wedding-jadee.lua",
|
||||||
"ponnuki.lua"
|
"ponnuki.lua"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
function run_scripts()
|
function run_scripts()
|
||||||
scripts = {
|
scripts = {
|
||||||
"spells.lua",
|
"spells.lua",
|
||||||
"familiars.lua",
|
"extensions.lua",
|
||||||
"hse-portals.lua",
|
"hse-portals.lua",
|
||||||
"hse-stats.lua"
|
"hse-stats.lua"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
function run_scripts()
|
function run_scripts()
|
||||||
scripts = {
|
scripts = {
|
||||||
"spells.lua",
|
"spells.lua",
|
||||||
"familiars.lua",
|
"extensions.lua",
|
||||||
"hse-portals.lua",
|
"hse-portals.lua",
|
||||||
"hse-stats.lua"
|
"hse-stats.lua"
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ print("- Running wdw-run.lua")
|
||||||
|
|
||||||
scripts = {
|
scripts = {
|
||||||
"spells.lua",
|
"spells.lua",
|
||||||
"familiars.lua",
|
"extensions.lua",
|
||||||
"wdw-sphinx.lua",
|
"wdw-sphinx.lua",
|
||||||
"wdw-standings.lua"
|
"wdw-standings.lua"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue