version 1.29 | | version 1.30 |
---|
| | |
/* | | /* |
* static char *rcsid_monster_c = | | * static char *rcsid_monster_c = |
* "$Id: monster.c,v 1.29 2001/08/30 05:17:43 mwedel Exp $"; | | * "$Id: monster.c,v 1.30 2001/10/14 07:57:14 gros Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
int talk_to_npc(object *op, object *npc, char *txt) { | | int talk_to_npc(object *op, object *npc, char *txt) { |
msglang *msgs; | | msglang *msgs; |
int i,j; | | int i,j; |
/* GROS: Guile script handler */ | | object *cobj; |
if(npc->script_say != NULL) | | #ifdef PLUGINS |
| | /* GROS: Handle for plugin say event */ |
| | if(npc->event_hook[EVENT_SAY] != NULL) |
{ | | { |
guile_call_event(op, npc, NULL, 0, txt,0,0,npc->script_say, SCRIPT_FIX_ALL); | | CFParm CFP; |
| | int k, l, m; |
| | k = EVENT_SAY; |
| | l = SCRIPT_FIX_ALL; |
| | m = 0; |
| | CFP.Value[0] = &k; |
| | CFP.Value[1] = op; |
| | CFP.Value[2] = npc; |
| | CFP.Value[3] = NULL; |
| | CFP.Value[4] = txt; |
| | CFP.Value[5] = &m; |
| | CFP.Value[6] = &m; |
| | CFP.Value[7] = &m; |
| | CFP.Value[8] = &l; |
| | CFP.Value[9] = npc->event_hook[k]; |
| | CFP.Value[10]= npc->event_options[k]; |
| | if (findPlugin(npc->event_plugin[k])>=0) |
| | { |
| | ((PlugList[findPlugin(npc->event_plugin[k])].eventfunc) (&CFP)); |
return 0; | | return 0; |
} | | } |
if (npc->script_str_say !=NULL) | | } |
| | /* GROS - Here we let the objects inside inventories hear and answer, too. */ |
| | /* This allows the existence of "intelligent" weapons you can discuss with */ |
| | for(cobj=npc->inv;cobj!=NULL;) |
| | { |
| | if(cobj->event_hook[EVENT_SAY] != NULL) |
| | { |
| | CFParm CFP; |
| | int k, l, m; |
| | k = EVENT_SAY; |
| | l = SCRIPT_FIX_ALL; |
| | m = 0; |
| | CFP.Value[0] = &k; |
| | CFP.Value[1] = op; |
| | CFP.Value[2] = cobj; |
| | CFP.Value[3] = NULL; |
| | CFP.Value[4] = txt; |
| | CFP.Value[5] = &m; |
| | CFP.Value[6] = &m; |
| | CFP.Value[7] = &m; |
| | CFP.Value[8] = &l; |
| | CFP.Value[9] = cobj->event_hook[k]; |
| | CFP.Value[10]= cobj->event_options[k]; |
| | if (findPlugin(cobj->event_plugin[k])>=0) |
{ | | { |
guile_call_event_str(op,npc,NULL,0,txt,0,0,npc->script_str_say, SCRIPT_FIX_ALL); | | ((PlugList[findPlugin(cobj->event_plugin[k])].eventfunc) (&CFP)); |
| | return 0; |
| | } |
| | } |
| | cobj = cobj->below; |
} | | } |
| | |
| | /* GROS: Then we parse the target inventory */ |
| | /*if (npc!=NULL) |
| | for(cobj=npc->inv;cobj!=NULL;cobj=cobj->next) |
| | { |
| | printf("Name is %s\n", cobj->name); |
| | if(npc->event_hook[EVENT_SAY] != NULL) |
| | { |
| | CFParm CFP; |
| | int k, l, m; |
| | k = EVENT_SAY; |
| | l = SCRIPT_FIX_ALL; |
| | m = 0; |
| | CFP.Value[0] = &k; |
| | CFP.Value[1] = op; |
| | CFP.Value[2] = cobj; |
| | CFP.Value[3] = NULL; |
| | CFP.Value[4] = txt; |
| | CFP.Value[5] = &m; |
| | CFP.Value[6] = &m; |
| | CFP.Value[7] = &m; |
| | CFP.Value[8] = &l; |
| | CFP.Value[9] = cobj->event_hook[k]; |
| | CFP.Value[10]= cobj->event_options[k]; |
| | if (findPlugin(cobj->event_plugin[k])>=0) |
| | { |
| | ((PlugList[findPlugin(cobj->event_plugin[k])].eventfunc) (&CFP)); |
| | return 0; |
| | } |
| | } |
| | }*/ |
| | #endif |
if(npc->msg == NULL || *npc->msg != '@') | | if(npc->msg == NULL || *npc->msg != '@') |
return 0; | | return 0; |
if((msgs = parse_message(npc->msg)) == NULL) | | if((msgs = parse_message(npc->msg)) == NULL) |