/* vi: set ts=2: +-------------------+ Christian Schlittchen | | Enno Rehling | Eressea PBEM host | Katja Zedel | (c) 1998 - 2003 | Henning Peters | | Ingo Wilken +-------------------+ Stefan Reich This program may not be used, modified or distributed without prior permission by the authors of Eressea. */ #include #include #ifdef XECMD_MODULE #include "xecmd.h" #include #include "xecmd.h" /* kernel includes */ #include #include #include #include #include #include #include /* libc includes */ #include #include #include attrib_type at_xontormiaexpress = { "xontormiaexpress", DEFAULT_INIT, DEFAULT_FINALIZE, DEFAULT_AGE, DEFAULT_WRITE, DEFAULT_READ, ATF_UNIQUE }; static void xe_givelaen(unit *u, struct order * ord) { unit *u2 =getunitg(u->region, u->faction); if(!u2) { cmistake(u, ord, 63, MSG_EVENT); return; } i_change(&u2->items, olditemtype[I_LAEN], 5); } static void xe_givepotion(unit *u, struct order *ord) { unit *u2 =getunitg(u->region, u->faction); if(!u2) { cmistake(u, ord, 63, MSG_EVENT); return; } i_change(&u2->items, &it_skillpotion, 1); } static void xe_giveballon(unit *u, struct order *ord) { unit *u2 =getunitg(u->region, u->faction); ship *sh; if(!u2) { cmistake(u, ord, 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, UFL_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) { order * ord; for (ord=u->orders; ord; ord=ord->next) { if (get_keyword(ord) == K_XE) { init_tokens(ord); skip_token(); switch(findparam(getstrtoken(),f->locale)) { case P_XEPOTION: xe_givepotion(u, ord); break; case P_XEBALLOON: xe_giveballon(u, ord); break; case P_XELAEN: xe_givelaen(u, ord); break; } } } } } } } #endif