version 1.179 | | version 1.180 |
---|
| | |
/* | | /* |
* static char *rcsid_player_c = | | * static char *rcsid_player_c = |
* "$Id: player.c,v 1.179 2005/10/07 19:38:49 akirschbaum Exp $"; | | * "$Id: player.c,v 1.180 2005/10/18 16:54:31 gros Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
int key_change_class(object *op, char key) | | int key_change_class(object *op, char key) |
{ | | { |
int tmp_loop; | | int tmp_loop; |
int evtid; | | |
CFParm CFP; | | |
| | |
if(key=='q'||key=='Q') { | | if(key=='q'||key=='Q') { |
remove_ob(op); | | remove_ob(op); |
| | |
esrv_new_player(op->contr, op->weight+op->carrying); | | esrv_new_player(op->contr, op->weight+op->carrying); |
create_treasure(find_treasurelist("starting_wealth"),op, 0, 0, 0); | | create_treasure(find_treasurelist("starting_wealth"),op, 0, 0, 0); |
| | |
/* GROS : Here we handle the BORN global event */ | | /* Lauwenmark : Here we handle the BORN global event */ |
evtid = EVENT_BORN; | | execute_global_event(EVENT_BORN, op); |
CFP.Value[0] = (void *)(&evtid); | | |
CFP.Value[1] = (void *)(op); | | /* Lauwenmark : We then generate a LOGIN event */ |
GlobalEvent(&CFP); | | execute_global_event(EVENT_LOGIN, op->contr, op->contr->socket.host); |
| | |
/* GROS : We then generate a LOGIN event */ | | |
evtid = EVENT_LOGIN; | | |
CFP.Value[0] = (void *)(&evtid); | | |
CFP.Value[1] = (void *)(op->contr); | | |
CFP.Value[2] = (void *)(op->contr->socket.host); | | |
GlobalEvent(&CFP); | | |
op->contr->state=ST_PLAYING; | | op->contr->state=ST_PLAYING; |
| | |
if (op->msg) { | | if (op->msg) { |
| | |
int key_confirm_quit(object *op, char key) | | int key_confirm_quit(object *op, char key) |
{ | | { |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
CFParm CFP; | | |
int evtid; | | |
| | |
if(key!='y'&&key!='Y'&&key!='q'&&key!='Q') { | | if(key!='y'&&key!='Y'&&key!='q'&&key!='Q') { |
op->contr->state=ST_PLAYING; | | op->contr->state=ST_PLAYING; |
| | |
return 1; | | return 1; |
} | | } |
| | |
/* GROS : Here we handle the REMOVE global event */ | | /* Lauwenmark : Here we handle the REMOVE global event */ |
evtid = EVENT_REMOVE; | | execute_global_event(EVENT_REMOVE, op); |
CFP.Value[0] = (void *)(&evtid); | | |
CFP.Value[1] = (void *)(op); | | |
GlobalEvent(&CFP); | | |
terminate_all_pets(op); | | terminate_all_pets(op); |
leave_map(op); | | leave_map(op); |
op->direction=0; | | op->direction=0; |
| | |
int lost_a_stat; | | int lost_a_stat; |
int lose_this_stat; | | int lose_this_stat; |
int this_stat; | | int this_stat; |
int killed_script_rtn; /* GROS: For script return value */ | | int will_kill_again; |
CFParm CFP; | | |
int evtid, will_kill_again; | | |
archetype *at; | | archetype *at; |
object *tmp; | | object *tmp; |
event *evt; | | |
| | |
if(save_life(op)) | | if(save_life(op)) |
return; | | return; |
| | |
| | |
/* create a bodypart-trophy to make the winner happy */ | | /* create a bodypart-trophy to make the winner happy */ |
tmp=arch_to_object(find_archetype("finger")); | | tmp=arch_to_object(find_archetype("finger")); |
if (tmp != NULL) { | | if (tmp != NULL) |
| | { |
sprintf(buf,"%s's finger",op->name); | | sprintf(buf,"%s's finger",op->name); |
tmp->name = add_string(buf); | | tmp->name = add_string(buf); |
sprintf(buf," This finger has been cut off %s\n" | | sprintf(buf," This finger has been cut off %s\n" |
| | |
op->contr->braced=0; | | op->contr->braced=0; |
return; | | return; |
} | | } |
/* GROS: Handle for plugin death event */ | | |
if ((evt = find_event(op, EVENT_DEATH)) != NULL) | | /* Lauwenmark: Handle for plugin death event */ |
{ | | if (execute_event(op, EVENT_DEATH,NULL,NULL,NULL,SCRIPT_FIX_ALL) != 0) |
CFParm* CFR; | | |
int k, l, m; | | |
uint32 n; | | |
k = EVENT_DEATH; | | |
l = SCRIPT_FIX_ALL; | | |
m = 0; | | |
n = 0; | | |
CFP.Value[0] = &k; | | |
CFP.Value[1] = NULL; | | |
CFP.Value[2] = op; | | |
CFP.Value[3] = NULL; | | |
CFP.Value[4] = NULL; | | |
CFP.Value[5] = &n; | | |
CFP.Value[6] = &m; | | |
CFP.Value[7] = &m; | | |
CFP.Value[8] = &l; | | |
CFP.Value[9] = (void*)evt->hook; | | |
CFP.Value[10]= (void*)evt->options; | | |
if (findPlugin(evt->plugin)>=0) | | |
{ | | |
CFR = (PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP); | | |
killed_script_rtn = *(int *)(CFR->Value[0]); | | |
free(CFR); | | |
if (killed_script_rtn) | | |
return; | | return; |
} | | |
} | | |
| | |
/* GROS: Handle for the global death event */ | | /* Lauwenmark: Handle for the global death event */ |
evtid = EVENT_GDEATH; | | execute_global_event(EVENT_PLAYER_DEATH, op); |
CFP.Value[0] = (void *)(&evtid); | | |
CFP.Value[1] = NULL; | | |
CFP.Value[2] = (void *)(op); | | |
GlobalEvent(&CFP); | | |
if(op->stats.food<0) { | | if(op->stats.food<0) { |
if (op->contr->explore) { | | if (op->contr->explore) { |
new_draw_info(NDI_UNIQUE, 0,op,"You would have starved, but you are"); | | new_draw_info(NDI_UNIQUE, 0,op,"You would have starved, but you are"); |