- XE-Belohnungen. Muss getestet werden.

This commit is contained in:
Christian Schlittchen 2002-04-27 19:40:31 +00:00
parent ced9653fa6
commit c2aba8357f
9 changed files with 189 additions and 6 deletions

View File

@ -516,7 +516,7 @@ give_peasants(int n, const item_type * itype, unit * src)
}
}
void
void
give_item(int want, const item_type * itype, unit * src, unit * dest, const char * cmd)
{
short error = 0;
@ -791,7 +791,7 @@ giveunit(region * r, unit * u, unit * u2, strlist * S)
}
}
static void
static void
dogive(region * r, unit * u, strlist * S, boolean liefere, int mode)
/*
* mode=0: give to any units

View File

@ -73,6 +73,8 @@
#include <sql.h>
#include <util/message.h>
#include <modules/xecmd.h>
#ifdef AT_OPTION
/* attributes includes */
#include <attributes/option.h>
@ -3533,8 +3535,11 @@ processorders (void)
puts(" - Monster fressen und vertreiben Bauern");
monsters_kill_peasants();
puts(" - Zufallsereignisse");
puts(" - random events");
randomevents();
puts(" - newspaper commands");
xecmd();
puts(" - regeneration (healing & aura)");
monthly_healing();

View File

@ -155,7 +155,10 @@ const char *parameters[MAXPARAMS] =
"TRÄNKE",
"GRUPPE",
"PARTEITARNUNG",
"BÄUME"
"BÄUME",
"XEPOTION",
"XEBALLOON",
"XELAEN"
};
@ -232,7 +235,8 @@ const char *keywords[MAXKEYWORDS] =
"PRÄFIX",
"SYNONYM",
"PFLANZEN",
"WERWESEN"
"WERWESEN",
"XONTORMIA"
};
const char *report_options[MAX_MSG] =

View File

@ -438,6 +438,7 @@ enum {
K_SYNONYM,
K_PFLANZE,
K_WEREWOLF,
K_XE,
MAXKEYWORDS,
NOKEYWORD = (keyword_t) - 1
};
@ -504,6 +505,9 @@ enum {
P_GROUP,
P_FACTIONSTEALTH,
P_TREES,
P_XEPOTION,
P_XEBALLOON,
P_XELAEN,
MAXPARAMS,
NOPARAM = (param_t) - 1
};

115
src/common/modules/xecmd.c Normal file
View File

@ -0,0 +1,115 @@
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea-pbem.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2001 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.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 <faction.h>
#include <unit.h>
#include <item.h>
#include <items/xerewards.h>
#include "xecmd.h"
/* kernel includes */
#include <item.h>
#include <unit.h>
#include <region.h>
#include <ship.h>
#include <base36.h>
#include <stdlib.h>
attrib_type at_xontormiaexpress = {
"xontormiaexpress",
DEFAULT_INIT,
DEFAULT_FINALIZE,
DEFAULT_AGE,
DEFAULT_WRITE,
DEFAULT_READ,
ATF_UNIQUE
};
static void
xe_givelaen(unit *u, char *cmd)
{
unit *u2 =getunitg(u->region, u->faction);
if(!u2) {
cmistake(u, strdup(cmd), 63, MSG_EVENT);
return;
}
i_change(&u2->items, olditemtype[I_LAEN], 5);
}
static void
xe_givepotion(unit *u, char *cmd)
{
unit *u2 =getunitg(u->region, u->faction);
if(!u2) {
cmistake(u, strdup(cmd), 63, MSG_EVENT);
return;
}
i_change(&u2->items, &it_skillpotion, 1);
}
static void
xe_giveballon(unit *u, char *cmd)
{
unit *u2 =getunitg(u->region, u->faction);
ship *sh;
if(!u2) {
cmistake(u, strdup(cmd), 63, MSG_EVENT);
return;
}
sh = new_ship(st_find("balloon"),u2->region);
sh->size = 5;
set_string(&sh->name,"Xontormia-Ballon");
addlist(&u2->region->ships, sh);
leave(u2->region, u2);
u2->ship = sh;
fset(u2, FL_OWNER);
}
void
xecmd(void)
{
faction *f;
for(f=factions; f; f=f->next) {
if(a_find(f->attribs, &at_xontormiaexpress)) {
unit *u;
for(u=f->units; u; u=u->nextF) {
strlist *S;
for(S=u->orders; S; S=S->next) {
if(findkeyword(igetstrtoken(S->s),f->locale) == K_XE) {
switch(findparam(getstrtoken(),f->locale)) {
case P_XEPOTION:
xe_givepotion(u, S->s);
break;
case P_XEBALLOON:
xe_giveballon(u, S->s);
break;
case P_XELAEN:
xe_givelaen(u, S->s);
break;
}
}
}
}
}
}
}

View File

@ -0,0 +1,20 @@
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea-pbem.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2001 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#ifndef XECMD_H
#define XECMD_H
extern attrib_type at_xontormiaexpress;
void xecmd(void);
#endif

View File

@ -26,6 +26,7 @@
#include <modules/xmas2000.h>
#include <modules/xmas2001.h>
#include <modules/museum.h>
#include <modules/xecmd.h>
#include <items/questkeys.h>
/* gamecode includes */
@ -2746,6 +2747,18 @@ questportal_init(void)
return 0;
}
static int
xe_init(void)
{
faction *f = findfaction(atoi36("a5q"));
if(f) {
a_add(&f->attribs, a_new(&at_xontormiaexpress));
}
return 0;
}
void
korrektur(void)
{
@ -2797,6 +2810,7 @@ korrektur(void)
do_once("witm", warn_items());
do_once("guac", guard_conversion());
do_once("qpoi", questportal_init());
do_once("xini", xe_init());
warn_password();
/* seems something fishy is going on, do this just

View File

@ -1383,8 +1383,19 @@ showunits(region * r)
} else {
s = strchr(pointer->s, '(');
if (s) {
char idbuf[12];
int i = 0;
s++;
f = atoi36(s);
while(*s != ')') {
idbuf[i] = *s;
i++; s++;
assert(i<=11);
}
idbuf[i] = '\0';
f = atoi36(idbuf);
x = findunit(f, r);
if (x && modify_unit(r, findunit(f, r))) {
for (pline = 0, tmp = eh; tmp != pointer; tmp = tmp->next)

View File

@ -1551,6 +1551,16 @@
<string name="ZAUBER">
<text locale="de">ZAUBER</text>
</string>
<string name="XEPOTION">
<text locale="de">XETRANK</text>
</string>
<string name="XEBALLOON">
<text locale="de">XEBALLON</text>
</string>
<string name="XELAEN">
<text locale="de">XELAEN</text>
</string>
<comment>Talente:</comment>
<string name="sk_alchemy">