1 | /* |
1 | /* |
2 | * static char *rcsid_skills_c = |
2 | * static char *rcsid_skills_c = |
3 | * "$Id: skills.c,v 1.3 2006/06/06 23:32:27 root Exp $"; |
3 | * "$Id: skills.c,v 1.5 2006/07/01 21:04:42 root Exp $"; |
4 | */ |
4 | */ |
5 | /* |
5 | /* |
6 | CrossFire, A Multiplayer game for X-windows |
6 | CrossFire, A Multiplayer game for X-windows |
7 | |
7 | |
8 | Copyright (C) 2003 Mark Wedel & Crossfire Development Team |
8 | Copyright (C) 2003 Mark Wedel & Crossfire Development Team |
… | |
… | |
295 | } |
295 | } |
296 | |
296 | |
297 | // reduce monster experience by experience we gained, as to |
297 | // reduce monster experience by experience we gained, as to |
298 | // limit the amount of exp that can be gained by stealing from monsters |
298 | // limit the amount of exp that can be gained by stealing from monsters |
299 | // (jessies gave ~20,000,000 exp otherwise. |
299 | // (jessies gave ~20,000,000 exp otherwise. |
300 | int exp = MIN (tmp->stats.exp, calc_skill_exp (op,tmp, skill)); |
300 | int exp = calc_skill_exp (op, tmp, skill); |
|
|
301 | exp = MIN (tmp->stats.exp, exp); |
301 | tmp->stats.exp -= exp; |
302 | tmp->stats.exp -= exp; |
302 | return exp; |
303 | return exp; |
303 | } |
304 | } |
304 | } |
305 | } |
305 | return 0; |
306 | return 0; |
… | |
… | |
1117 | /* write_note() - this routine allows players to inscribe messages in |
1118 | /* write_note() - this routine allows players to inscribe messages in |
1118 | * ordinary 'books' (anything that is type BOOK). b.t. |
1119 | * ordinary 'books' (anything that is type BOOK). b.t. |
1119 | */ |
1120 | */ |
1120 | |
1121 | |
1121 | static int write_note(object *pl, object *item, const char *msg, object *skill) { |
1122 | static int write_note(object *pl, object *item, const char *msg, object *skill) { |
1122 | char buf[BOOK_BUF]; |
1123 | char buf[1024]; |
1123 | object *newBook = NULL; |
1124 | object *newBook = NULL; |
1124 | |
1125 | |
1125 | /* a pair of sanity checks */ |
1126 | /* a pair of sanity checks */ |
1126 | if(!item||item->type!=BOOK) return 0; |
1127 | if(!item||item->type!=BOOK) return 0; |
1127 | |
1128 | |
… | |
… | |
1139 | /* Lauwenmark: Handle for plugin book writing (trigger) event */ |
1140 | /* Lauwenmark: Handle for plugin book writing (trigger) event */ |
1140 | if (execute_event(item, EVENT_TRIGGER,pl,NULL,msg,SCRIPT_FIX_ALL)!=0) |
1141 | if (execute_event(item, EVENT_TRIGGER,pl,NULL,msg,SCRIPT_FIX_ALL)!=0) |
1141 | return strlen(msg); |
1142 | return strlen(msg); |
1142 | |
1143 | |
1143 | buf[0] = 0; |
1144 | buf[0] = 0; |
1144 | if(!book_overflow(item->msg,msg,BOOK_BUF)) { /* add msg string to book */ |
1145 | if(!book_overflow(item->msg,msg,sizeof (buf))) { /* add msg string to book */ |
1145 | if(item->msg) |
1146 | if(item->msg) |
1146 | strcpy(buf,item->msg); |
1147 | strcpy(buf,item->msg); |
1147 | |
1148 | |
1148 | strcat(buf,msg); |
1149 | strcat(buf,msg); |
1149 | strcat(buf,"\n"); /* new msg needs a LF */ |
1150 | strcat(buf,"\n"); /* new msg needs a LF */ |