ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/skills.c
(Generate patch)

Comparing deliantra/server/server/skills.c (file contents):
Revision 1.5 by root, Sat Jul 1 21:04:42 2006 UTC vs.
Revision 1.6 by elmex, Thu Aug 10 12:45:23 2006 UTC

1/* 1/*
2 * static char *rcsid_skills_c = 2 * static char *rcsid_skills_c =
3 * "$Id: skills.c,v 1.5 2006/07/01 21:04:42 root Exp $"; 3 * "$Id: skills.c,v 1.6 2006/08/10 12:45:23 elmex 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
621/* Helper function for do_skill_ident, so that we can loop 621/* Helper function for do_skill_ident, so that we can loop
622 * over inventory AND objects on the ground conveniently. 622 * over inventory AND objects on the ground conveniently.
623 */ 623 */
624int do_skill_ident2(object *tmp,object *pl, int obj_class, object *skill) 624int do_skill_ident2(object *tmp,object *pl, int obj_class, object *skill)
625{ 625{
626 int success=0,chance, ip; 626 int success = 0, chance;
627 int skill_value = skill->level * pl->stats.Int?pl->stats.Int:10; 627 int skill_value = skill->level * pl->stats.Int ? pl->stats.Int : 10;
628 628
629 if(!QUERY_FLAG(tmp,FLAG_IDENTIFIED) && !QUERY_FLAG(tmp,FLAG_NO_SKILL_IDENT) 629 if (!QUERY_FLAG (tmp,FLAG_IDENTIFIED) && !QUERY_FLAG (tmp,FLAG_NO_SKILL_IDENT)
630 && need_identify(tmp) && !tmp->invisible && tmp->type==obj_class) { 630 && need_identify (tmp) && !tmp->invisible && tmp->type == obj_class)
631 ip = tmp->magic; 631 {
632 if (tmp->item_power > ip) ip=tmp->item_power;
633
634 chance = die_roll(3, 10, pl, PREFER_LOW)-3 + 632 chance = die_roll(3, 10, pl, PREFER_LOW) - 3
635 rndm(0, (tmp->magic ? tmp->magic*5 : 1)-1); 633 + rndm (0, (tmp->magic ? tmp->magic * 5 : 1) - 1);
634
636 if(skill_value >= chance) { 635 if (skill_value >= chance)
637 identify(tmp); 636 {
637 identify(tmp);
638
638 if (pl->type==PLAYER) { 639 if (pl->type==PLAYER)
639 new_draw_info_format(NDI_UNIQUE, 0, pl, 640 {
640 "You identify %s.", long_desc(tmp, pl)); 641 new_draw_info_format (NDI_UNIQUE, 0, pl, "You identify %s.", long_desc (tmp, pl));
642
641 if (tmp->msg) { 643 if (tmp->msg)
644 {
642 new_draw_info(NDI_UNIQUE, 0,pl, "The item has a story:"); 645 new_draw_info(NDI_UNIQUE, 0,pl, "The item has a story:");
643 new_draw_info(NDI_UNIQUE, 0,pl, tmp->msg); 646 new_draw_info(NDI_UNIQUE, 0,pl, tmp->msg);
647 }
648
649 /* identify will take care of updating the item if it is in the players inventory. IF on map, do it here */
650 if (tmp->map)
651 esrv_send_item (pl, tmp);
644 } 652 }
645 /* identify will take care of updating the item if
646 * it is in the players inventory. IF on map, do it
647 * here
648 */
649 if (tmp->map)
650 esrv_send_item(pl, tmp);
651 }
652 success += calc_skill_exp(pl,tmp, skill); 653 success += calc_skill_exp(pl,tmp, skill);
653 } else
654 SET_FLAG(tmp, FLAG_NO_SKILL_IDENT);
655 } 654 }
655 else
656 SET_FLAG (tmp, FLAG_NO_SKILL_IDENT);
657 }
658
656 return success; 659 return success;
657} 660}
658 661
659/* do_skill_ident() - workhorse for skill_ident() -b.t. 662/* do_skill_ident() - workhorse for skill_ident() -b.t.
660 */ 663 */
661static int do_skill_ident(object *pl, int obj_class, object *skill) { 664static int do_skill_ident(object *pl, int obj_class, object *skill) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines