1 | /* |
1 | /* |
2 | * static char *rcsid_skill_util_c = |
2 | * static char *rcsid_skill_util_c = |
3 | * "$Id: skill_util.c,v 1.1 2006/02/03 07:14:37 root Exp $"; |
3 | * "$Id: skill_util.c,v 1.2 2006/04/29 13:44:15 pippijn Exp $"; |
4 | */ |
4 | */ |
5 | /* |
5 | /* |
6 | CrossFire, A Multiplayer game for X-windows |
6 | CrossFire, A Multiplayer game for X-windows |
7 | |
7 | |
8 | Copryight (C) 2002 Mark Wedel & Crossfire Development Team |
8 | Copryight (C) 2002 Mark Wedel & Crossfire Development Team |
… | |
… | |
649 | void show_skills(object *op, const char* search) { |
649 | void show_skills(object *op, const char* search) { |
650 | object *tmp=NULL; |
650 | object *tmp=NULL; |
651 | char buf[MAX_BUF]; |
651 | char buf[MAX_BUF]; |
652 | const char *cp; |
652 | const char *cp; |
653 | int i,num_skills_found=0; |
653 | int i,num_skills_found=0; |
654 | static char *periods="........................................"; |
654 | static const char *const periods = "........................................"; |
655 | /* Need to have a pointer and use strdup for qsort to work properly */ |
655 | /* Need to have a pointer and use strdup for qsort to work properly */ |
656 | char skills[NUM_SKILLS][MAX_BUF]; |
656 | char skills[NUM_SKILLS][MAX_BUF]; |
657 | |
657 | |
658 | |
658 | |
659 | for (tmp=op->inv; tmp!=NULL; tmp=tmp->below) { |
659 | for (tmp=op->inv; tmp!=NULL; tmp=tmp->below) { |
660 | if (tmp->type == SKILL) {
|
660 | if (tmp->type == SKILL) { |
661 | if ( search && strstr(tmp->name,search)==NULL ) continue; |
661 | if ( search && strstr(tmp->name,search)==NULL ) continue; |
662 | /* Basically want to fill this out to 40 spaces with periods */ |
662 | /* Basically want to fill this out to 40 spaces with periods */ |
663 | sprintf(buf,"%s%s", tmp->name, periods); |
663 | sprintf(buf,"%s%s", tmp->name, periods); |
664 | buf[40] = 0; |
664 | buf[40] = 0; |
665 | |
665 | |
666 | if (settings.use_permanent_experience) { |
666 | if (settings.permanent_exp_ratio) { |
667 | #ifdef WIN32 |
667 | #ifdef WIN32 |
668 | sprintf(skills[num_skills_found++],"%slvl:%3d (xp:%I64d/%I64d/%d%%)", |
668 | sprintf(skills[num_skills_found++],"%slvl:%3d (xp:%I64d/%I64d/%d%%)", |
669 | buf,tmp->level, |
669 | buf,tmp->level, |
670 | tmp->stats.exp, |
670 | tmp->stats.exp, |
671 | level_exp(tmp->level+1, op->expmul), |
671 | level_exp(tmp->level+1, op->expmul), |
… | |
… | |
718 | cp = determine_god(op); |
718 | cp = determine_god(op); |
719 | new_draw_info_format(NDI_UNIQUE, 0, op, |
719 | new_draw_info_format(NDI_UNIQUE, 0, op, |
720 | "You worship %s.", cp?cp:"no god at current time"); |
720 | "You worship %s.", cp?cp:"no god at current time"); |
721 | |
721 | |
722 | new_draw_info_format(NDI_UNIQUE,0,op, "Your equipped item power is %d out of %d\n", |
722 | new_draw_info_format(NDI_UNIQUE,0,op, "Your equipped item power is %d out of %d\n", |
723 | op->contr->item_power, op->level); |
723 | op->contr->item_power, (int) (op->level * settings.item_power_factor)); |
724 | } |
724 | } |
725 | |
725 | |
726 | /* use_skill() - similar to invoke command, it executes the skill in the |
726 | /* use_skill() - similar to invoke command, it executes the skill in the |
727 | * direction that the user is facing. Returns false if we are unable to |
727 | * direction that the user is facing. Returns false if we are unable to |
728 | * change to the requested skill, or were unable to use the skill properly. |
728 | * change to the requested skill, or were unable to use the skill properly. |