--- deliantra/server/server/skills.c 2006/03/15 14:05:38 1.1.1.2 +++ deliantra/server/server/skills.c 2006/08/13 17:16:04 1.7 @@ -119,10 +119,17 @@ new_draw_info(NDI_UNIQUE, 0, who, "You can't steal from the dungeon master!\n"); return 0; } +#ifdef PROHIBIT_PLAYERKILL + if(op->type == PLAYER && who->type == PLAYER && (who->contr->peaceful || op->contr->peaceful)) { + new_draw_info(NDI_UNIQUE, 0, who, "You can't steal from other players!\n"); + return 0; + } +#else if(op->type == PLAYER && who->type == PLAYER && settings.no_player_stealing) { new_draw_info(NDI_UNIQUE, 0, who, "You can't steal from other players!\n"); return 0; } +#endif /* Ok then, go thru their inventory, stealing */ @@ -287,7 +294,13 @@ return 0; } - return (calc_skill_exp(op,tmp, skill)); + // reduce monster experience by experience we gained, as to + // limit the amount of exp that can be gained by stealing from monsters + // (jessies gave ~20,000,000 exp otherwise. + int exp = calc_skill_exp (op, tmp, skill); + exp = MIN (tmp->stats.exp, exp); + tmp->stats.exp -= exp; + return exp; } } return 0; @@ -610,37 +623,40 @@ */ int do_skill_ident2(object *tmp,object *pl, int obj_class, object *skill) { - int success=0,chance, ip; - int skill_value = skill->level * pl->stats.Int?pl->stats.Int:10; + int success = 0, chance; + int skill_value = skill->level * pl->stats.Int ? pl->stats.Int : 10; - if(!QUERY_FLAG(tmp,FLAG_IDENTIFIED) && !QUERY_FLAG(tmp,FLAG_NO_SKILL_IDENT) - && need_identify(tmp) && !tmp->invisible && tmp->type==obj_class) { - ip = tmp->magic; - if (tmp->item_power > ip) ip=tmp->item_power; - - chance = die_roll(3, 10, pl, PREFER_LOW)-3 + - rndm(0, (tmp->magic ? tmp->magic*5 : 1)-1); - if(skill_value >= chance) { - identify(tmp); - if (pl->type==PLAYER) { - new_draw_info_format(NDI_UNIQUE, 0, pl, - "You identify %s.", long_desc(tmp, pl)); - if (tmp->msg) { - new_draw_info(NDI_UNIQUE, 0,pl, "The item has a story:"); - new_draw_info(NDI_UNIQUE, 0,pl, tmp->msg); - } - /* identify will take care of updating the item if - * it is in the players inventory. IF on map, do it - * here - */ - if (tmp->map) - esrv_send_item(pl, tmp); - } - success += calc_skill_exp(pl,tmp, skill); - } else - SET_FLAG(tmp, FLAG_NO_SKILL_IDENT); - } - return success; + if (!QUERY_FLAG (tmp,FLAG_IDENTIFIED) && !QUERY_FLAG (tmp,FLAG_NO_SKILL_IDENT) + && need_identify (tmp) && !tmp->invisible && tmp->type == obj_class) + { + chance = die_roll(3, 10, pl, PREFER_LOW) - 3 + + rndm (0, (tmp->magic ? tmp->magic * 5 : 1) - 1); + + if (skill_value >= chance) + { + identify(tmp); + + if (pl->type==PLAYER) + { + new_draw_info_format (NDI_UNIQUE, 0, pl, "You identify %s.", long_desc (tmp, pl)); + + if (tmp->msg) + { + new_draw_info(NDI_UNIQUE, 0,pl, "The item has a story:"); + new_draw_info(NDI_UNIQUE, 0,pl, tmp->msg); + } + + /* identify will take care of updating the item if it is in the players inventory. IF on map, do it here */ + if (tmp->map) + esrv_send_item (pl, tmp); + } + success += calc_skill_exp(pl,tmp, skill); + } + else + SET_FLAG (tmp, FLAG_NO_SKILL_IDENT); + } + + return success; } /* do_skill_ident() - workhorse for skill_ident() -b.t. @@ -1107,7 +1123,7 @@ */ static int write_note(object *pl, object *item, const char *msg, object *skill) { - char buf[BOOK_BUF]; + char buf[1024]; object *newBook = NULL; /* a pair of sanity checks */ @@ -1129,7 +1145,7 @@ return strlen(msg); buf[0] = 0; - if(!book_overflow(item->msg,msg,BOOK_BUF)) { /* add msg string to book */ + if(!book_overflow(item->msg,msg,sizeof (buf))) { /* add msg string to book */ if(item->msg) strcpy(buf,item->msg);