- Mini-Queste, muss getestet werden! Questbelohnung noch nicht implementiert.

This commit is contained in:
Christian Schlittchen 2002-04-27 14:25:35 +00:00
parent cf9112ad7c
commit 059427e309
12 changed files with 300 additions and 9 deletions

View File

@ -23,6 +23,7 @@
# include "seed.h" # include "seed.h"
#endif #endif
#include "birthday_firework.h" #include "birthday_firework.h"
#include "questkeys.h"
void void
register_items(void) register_items(void)
@ -38,6 +39,7 @@ register_items(void)
register_birthday_firework(); register_birthday_firework();
register_lebkuchenherz(); register_lebkuchenherz();
register_catapultammo(); register_catapultammo();
register_questkeys();
} }
void void

View File

@ -0,0 +1,136 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#include <config.h>
#include <eressea.h>
#include "questkeys.h"
/* kernel includes */
#include <faction.h>
#include <item.h>
#include <message.h>
#include <plane.h>
#include <region.h>
#include <unit.h>
#include <border.h>
/* util includes */
#include <functions.h>
/* libc includes */
#include <assert.h>
#include <stdlib.h>
extern border *borders[];
static int
use_questkey(struct unit * u, const struct item_type * itype, int amount, const char * cmd)
{
border *bo;
int key, key1, key2;
region *r1, *r2;
int lock, k;
message *m;
unit *u2;
if(u->region->x != 43 || u->region->y != -39) {
ADDMSG(&u->faction->msgs, msg_error(u, cmd, "use_questkey_wrongregion", ""));
return EUNUSABLE;
}
r1 = findregion(43,-39);
r2 = findregion(44,-39);
key1 = region_hashkey(r1);
key2 = region_hashkey(r2);
key = min(key2, key) % BMAXHASH;
bo = borders[key];
while (bo && !((bo->from==r1 && bo->to==r2) || (bo->from==r2 && bo->to==r1))) {
if(bo->type == &bt_questportal) {
break;
}
bo = bo->nexthash;
}
assert(bo != NULL);
lock = (int)bo->data;
if(itype == &it_questkey1) k = 1;
if(itype == &it_questkey2) k = 2;
if(lock & k) {
m = msg_message("questportal_unlock","region unit key", u->region, u, k);
lock = lock & ~k;
} else {
m = msg_message("questportal_lock","region unit key", u->region, u, k);
lock = lock | k;
}
bo->data = (void *)lock;
for(u2 = u->region->units; u2; u2=u2->next) {
freset(u2->faction, FL_DH);
}
for(u2 = u->region->units; u2; u2=u2->next) {
if(!fval(u2->faction, FL_DH)) {
add_message(&u2->faction->msgs, m);
fset(u2->faction, FL_DH);
}
}
return 0;
}
static resource_type rt_questkey1 = {
{ "questkey1", "questkey1_p" },
{ "questkey1", "questkey1_p" },
RTF_ITEM,
&res_changeitem
};
static resource_type rt_questkey2 = {
{ "questkey2", "questkey2_p" },
{ "questkey2", "questkey2_p" },
RTF_ITEM,
&res_changeitem
};
item_type it_questkey1 = {
&rt_questkey1, /* resourcetype */
ITF_NOTLOST, 1, 0, /* flags, weight, capacity */
NULL, /* construction */
&use_questkey,
NULL,
NULL
};
item_type it_questkey2 = {
&rt_questkey2, /* resourcetype */
ITF_NOTLOST, 1, 0, /* flags, weight, capacity */
NULL, /* construction */
&use_questkey,
NULL,
NULL
};
void
register_questkeys(void)
{
it_register(&it_questkey1);
it_register(&it_questkey2);
register_function((pf_generic)use_questkey, "usequestkey");
}

View File

@ -0,0 +1,18 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
extern struct item_type it_questkey1;
extern struct item_type it_questkey2;
extern void register_questkeys(void);

View File

@ -24,8 +24,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#define BMAXHASH 8191
unsigned int nextborder = 0; unsigned int nextborder = 0;
border * borders[BMAXHASH]; border * borders[BMAXHASH];
@ -383,6 +381,54 @@ border_type bt_illusionwall = {
b_uvisible, /* uvisible */ b_uvisible, /* uvisible */
}; };
/***
* special quest door
***/
boolean b_blockquestportal(const border * b, const unit * u, const region * r) {
if((int)b->data > 0) return true;
return false;
}
static const char *
b_namequestportal(const border * b, const region * r, const struct faction * f, int gflags)
{
/* TODO: f->locale bestimmt die Sprache */
int lock = (int)b->data;
unused(b);
unused(r);
if (gflags & GF_ARTICLE) {
if(lock > 0) {
return "ein gewaltiges verschlossenes Tor";
} else {
return "ein gewaltiges offenes Tor";
}
} else {
if(lock > 0) {
return "gewaltiges verschlossenes Tor";
} else {
return "gewaltiges offenes Tor";
}
}
return "";
}
border_type bt_questportal = {
"questportal",
b_opaque,
NULL, /* init */
NULL, /* destroy */
b_read, /* read */
b_write, /* write */
b_blockquestportal, /* block */
b_namequestportal, /* name */
b_rvisible, /* rvisible */
b_fvisible, /* fvisible */
b_uvisible, /* uvisible */
};
/*** /***
* roads. meant to replace the old at_road or r->road attribute * roads. meant to replace the old at_road or r->road attribute
***/ ***/

View File

@ -15,6 +15,8 @@
#ifndef BORDER_H #ifndef BORDER_H
#define BORDER_H #define BORDER_H
#define BMAXHASH 8191
extern unsigned int nextborder; extern unsigned int nextborder;
typedef struct border { typedef struct border {
@ -110,6 +112,7 @@ extern border_type bt_noway;
extern border_type bt_wall; extern border_type bt_wall;
extern border_type bt_illusionwall; extern border_type bt_illusionwall;
extern border_type bt_road; extern border_type bt_road;
extern border_type bt_questportal;
extern attrib_type at_countdown; extern attrib_type at_countdown;

View File

@ -2258,6 +2258,7 @@ attrib_init(void)
register_bordertype(&bt_firewall); register_bordertype(&bt_firewall);
register_bordertype(&bt_wisps); register_bordertype(&bt_wisps);
register_bordertype(&bt_road); register_bordertype(&bt_road);
register_bordertype(&bt_questportal);
at_register(&at_jihad); at_register(&at_jihad);
at_register(&at_skillmod); at_register(&at_skillmod);

View File

@ -673,12 +673,12 @@ enum {
RC_GHOUL, RC_GHOUL,
RC_GHOUL_LORD, RC_GHOUL_LORD,
RC_MUS_SPIRIT, /* 59 */ RC_MUS_SPIRIT, /* 60 */
RC_GNOME, /* 60 */ RC_GNOME, /* 61 */
RC_TEMPLATE, /* 61 */ RC_TEMPLATE, /* 62 */
RC_CLONE, /* 62 */ RC_CLONE, /* 63 */
RC_SHADOWDRAGON, RC_SHADOWDRAGON, /* 64 */
RC_SHADOWBAT, RC_SHADOWBAT,
RC_NIGHTMARE, RC_NIGHTMARE,
RC_VAMPUNICORN, RC_VAMPUNICORN,

View File

@ -277,7 +277,7 @@ const terraindata_t terrain[] = {
{ {
"hall1", '%', "hall1", '%',
NULL, NULL,
"in eine Halle", NULL,
0, /* Steine pro Runde */ 0, /* Steine pro Runde */
0, /* Steine fuer Strasse */ 0, /* Steine fuer Strasse */
0, /* bewirtschaftbare Parzellen */ 0, /* bewirtschaftbare Parzellen */
@ -288,7 +288,7 @@ const terraindata_t terrain[] = {
{ {
"corridor1", '%', "corridor1", '%',
NULL, NULL,
"in einen Gang", NULL,
0, /* Steine pro Runde */ 0, /* Steine pro Runde */
0, /* Steine fuer Strasse */ 0, /* Steine fuer Strasse */
0, /* bewirtschaftbare Parzellen */ 0, /* bewirtschaftbare Parzellen */
@ -306,6 +306,17 @@ const terraindata_t terrain[] = {
FORBIDDEN_LAND, /* Flags */ FORBIDDEN_LAND, /* Flags */
NULL NULL
}, },
/* T_WALL1 */
{
"wall1", '#',
NULL,
NULL,
0, /* Steine pro Runde */
0, /* Steine fuer Strasse */
0, /* bewirtschaftbare Parzellen */
FORBIDDEN_LAND, /* Flags */
NULL
},
/*** sentinel - must be last ***/ /*** sentinel - must be last ***/
{ {
NULL, 'X', NULL, 'X',

View File

@ -43,6 +43,7 @@ enum {
T_HALL1, T_HALL1,
T_CORRIDOR1, T_CORRIDOR1,
T_MAGICSTORM, T_MAGICSTORM,
T_WALL1,
MAXTERRAINS, MAXTERRAINS,
NOTERRAIN = (terrain_t) - 1 NOTERRAIN = (terrain_t) - 1
}; };

View File

@ -26,6 +26,7 @@
#include <modules/xmas2000.h> #include <modules/xmas2000.h>
#include <modules/xmas2001.h> #include <modules/xmas2001.h>
#include <modules/museum.h> #include <modules/museum.h>
#include <items/questkeys.h>
/* gamecode includes */ /* gamecode includes */
#include <creation.h> #include <creation.h>
@ -2725,6 +2726,26 @@ guard_conversion(void)
return 0; return 0;
} }
static int
questportal_init(void)
{
region *r1 = findregion(43,-39);
region *r2 = findregion(44,-39);
border *bo;
unit *u;
if(r1 == NULL || r2 == NULL) return 0;
bo = new_border(&bt_questportal, r1, r2);
bo->data = (void *)3;
u = findunit(atoi36("L0sc"));
if(u) i_change(&u->items, &it_questkey1, 1);
u = findunit(atoi36("xi7m"));
if(u) i_change(&u->items, &it_questkey2, 1);
return 0;
}
void void
korrektur(void) korrektur(void)
{ {
@ -2775,6 +2796,7 @@ korrektur(void)
do_once("orc2", orc_conversion2()); do_once("orc2", orc_conversion2());
do_once("witm", warn_items()); do_once("witm", warn_items());
do_once("guac", guard_conversion()); do_once("guac", guard_conversion());
do_once("qpoi", questportal_init());
warn_password(); warn_password();
/* seems something fishy is going on, do this just /* seems something fishy is going on, do this just

View File

@ -7466,5 +7466,34 @@
<text locale="en">"$unit($unit) in $region($region) becomes a lycantrope."</text> <text locale="en">"$unit($unit) in $region($region) becomes a lycantrope."</text>
</message> </message>
<message name="questportal_lock" section="events">
<type>
<arg name="region" type="region"></arg>
<arg name="unit" type="unit"></arg>
<arg name="key" type="int"></arg>
</type>
<text locale="de">"$unit($unit) verschließt eines der Schlösser in $region($region) mit $if($eq($key,1),"dem Achatenen Schlüssel","dem Saphirnen Schlüssel")."</text>
<text locale="de">"$unit($unit) locks one of the locks in $region($region) with $if($eq($key,1),"the Agate Key","the Sapphire Key")."</text>
</message>
<message name="questportal_unlock" section="events">
<type>
<arg name="region" type="region"></arg>
<arg name="unit" type="unit"></arg>
<arg name="key" type="int"></arg>
</type>
<text locale="de">"$unit($unit) öffnet eines der Schlösser in $region($region) mit $if($eq($key,1),"dem Achatenen Schlüssel","dem Saphirnen Schlüssel")."</text>
<text locale="de">"$unit($unit) unlocks one of the locks in $region($region) with $if($eq($key,1),"the Agate Key","the Sapphire Key")."</text>
</message>
<message name="use_questkey_wrongregion" section="events">
<type>
<arg name="region" type="region"></arg>
<arg name="unit" type="unit"></arg>
<arg name="command" type="string"></arg>
</type>
<text locale="de">"$unit($unit) in $region($region): '$command' - Hier ist kein passendes Schloss."</text>
<text locale="en">"$unit($unit) in $region($region): '$command' - No fitting lock can be found here."</text>
</message>
</messages> </messages>

View File

@ -344,6 +344,9 @@
<string name="corridor1"> <string name="corridor1">
<text locale="de">Gang</text> <text locale="de">Gang</text>
</string> </string>
<string name="wall1">
<text locale="de">Wand</text>
</string>
<string name="magicstorm"> <string name="magicstorm">
<text locale="de">Magischer Sturm</text> <text locale="de">Magischer Sturm</text>
</string> </string>
@ -405,6 +408,9 @@
<string name="corridor1_trail"> <string name="corridor1_trail">
<text locale="de">die %s</text> <text locale="de">die %s</text>
</string> </string>
<string name="wall1_trail">
<text locale="de">eine mächtige Mauer</text>
</string>
<string name="magicstorm_trail"> <string name="magicstorm_trail">
<text locale="de">ein %s</text> <text locale="de">ein %s</text>
</string> </string>
@ -1171,6 +1177,22 @@
<string name="lebkuchenherz_p"> <string name="lebkuchenherz_p">
<text locale="de">Lebkuchenherzen mit der Aufschrift 'Erz und Stein, das ist fein'</text> <text locale="de">Lebkuchenherzen mit der Aufschrift 'Erz und Stein, das ist fein'</text>
</string> </string>
<string name="questkey1">
<text locale="de">Achatener Schlüssel</text>
<text locale="en">agate key</text>
</string>
<string name="questkey1_p">
<text locale="de">Achatene Schlüssel</text>
<text locale="en">agate keys</text>
</string>
<string name="questkey2">
<text locale="de">Saphirner Schlüssel</text>
<text locale="en">sapphire key</text>
</string>
<string name="questkey2_p">
<text locale="de">Saphirne Schlüssel</text>
<text locale="en">sapphire keys</text>
</string>
<comment>herb singular</comment> <comment>herb singular</comment>
<string name="h0"> <string name="h0">