score.c
src/score.c · 17.3 KB
From the archive cyhawk_mud.tar.gz
Download the archive « Back to the archive contents
#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include "merc.h"
#include "interp.h"
#include "magic.h"
#include "recycle.h"
#include "tables.h"
#include "lookup.h"
#include "religion.h"
#include "player.h"
#include "faction.h"
#define ptc printf_to_char
char * word_health (CHAR_DATA * ch);
char * word_magic (CHAR_DATA * ch);
char * alignment_lookup (CHAR_DATA * ch, bool short_align);
char * word_armorclass (CHAR_DATA * ch, bool number);
void display_faction (CHAR_DATA * ch);
char * score_stats (int stat_value);
/*
* do_score()
*
* Le Score Command
*/
void do_score(CHAR_DATA * ch, char *argument)
{
if (ch->religion)
ptc(ch, "You are %s %s%s, %s of %s\n\r", ch->name, ch->last_name, ch->pcdata->title, religionr_table[ch->rank].name, religion_table[ch->religion].name_of_church);
else
ptc(ch, "You are %s %s%s\n\r", ch->name, ch->last_name, ch->pcdata->title);
ptc(ch, ".-----------------------------------------------------------------------------.\n\r");
ptc(ch, "| Race: {G%-10s{g Class: {G%-10s{g Level: {G%-3d{g |\n\r", race_table[ch->race].name, class_table[ch->class].name, ch->level);
ptc(ch, "| Sex: {G%-10s{g Alignment: {G%-10s{g Age: {G%-3d{g |\n\r", ch->sex == 0 ? "sexless" : ch->sex == 1 ? "male" : "female", alignment_lookup(ch, TRUE), get_age (ch));
ptc(ch, "| Voice: {G%-10s{g Eye Color: {G%-10s{g Hair Color: {G%-17s{g |\n\r", voice_table[ch->voice].name, eye_table[ch->eye].name, hair_table[ch->hair].name);
ptc(ch, "| Height: {G%-10s{g Weight: {G%-10s{g Birthsign: {G%-17s{g |\n\r", height_table[ch->height].name, weight_table[ch->weight].name, return_birthsign(ch->birthsign));
//ptc(ch, "| Concept: {G%-10s{g Archtype: {G%-10s{g Essence: {G%-10s{g |\n\r", "Fix", "Fix", "Fix");
if (IS_SET(ch->comm, COMM_FULLSCORE))
{
ptc(ch, "'-----------------------------------------------------------------------------.\n\r");
do_stats(ch, "");
return;
}
else
{
ptc(ch, "'-----------------------------------------------------------------------------'\n\r");
ptc(ch, " %s (%d)\n\r", word_armorclass(ch, FALSE), ch->armor_class);
ptc(ch, " %s\n\r", word_health(ch));
ptc(ch, " %s\n\r", word_magic(ch));
display_faction(ch);
ptc(ch, "\n\n\t Other information availible via the '{Rstats{x' command.\n\r");
return;
}
}
/*
* do_stats()
*
* The numbers
*/
/*
.-----------------------------------------------------------------------------.
| Hit points: {G%-4d{g/{G%-4d{x Health: ++++% Items Carried: {G%-3d{g/{G%-3d{g |
| Mana Points: {G%-4d{g/{G%-4d{x Focus: ++++% Weight Carried: {G%-3d{g/{G%-3d{g |
| Move Poions: {G%-4d{g/{G%-4d{x Endurance: ++++% Practices: {G%-3d{g |
|-----------------------------------------------------------------------------|
| Strength: {G%-2d{g({G%-2d{g) Force: {G%-2d{g Armor Class: {G%-3d{g |
| Intelligence: {G%-2d{g({G%-2d{g) Intuition: {G%-2d{g Base Atk Bonus: {G%-3d{g |
| Wisdom: {G%-2d{g({G%-2d{g) Luck: {G%-2d{g Base Hit Bonus: {G%-3d{g |
| Dexterity: {G%-2d{g({G%-2d{g) Speed: {G%-2d{g Wimpy: {G%-4d{g |
| Constitution: {G%-2d{g({G%-2d{g) Resilience: {G%-2d{g Base Saves: {G%-3d{g |
| Charisma: {G%-2d{g({G%-2d{g) Command: {G%-2d{g Size: {G%-7s{g |
|-----------------------------------------------------------------------------|
| Total Exp: {G%-12d{g Exp TNL: {G%-11s{g |
| Quest Points: {G%-12d{g Bounty Pnts:%-11d{g |
| Banked Gold: {G%-12d{g Gold: {G%-11s{g Silver: {G%-7s{g |
'-----------------------------------------------------------------------------'
*/
void do_stats(CHAR_DATA * ch, char *argument)
{
if (!IS_SET(ch->comm, COMM_FULLSCORE))
{
if (ch->religion)
ptc(ch, "You are %s%s, %s of %s\n\r", ch->name, ch->pcdata->title, religionr_table[ch->rank].name, religion_table[ch->religion].name_of_church);
else
ptc(ch, "You are %s%s\n\r", ch->name, ch->pcdata->title);
ptc(ch, ".-----------------------------------------------------------------------------.\n\r");
}
ptc(ch, "| Hit points: {G%-4d{g/{G%-4d{x Health: {G%-3d{g%s Items Carried: {G%-3d{g/{G%-3d{g |\n\r", ch->hit, ch->max_hit, ch->regen[0], "%", ch->carry_number, can_carry_n (ch));
ptc(ch, "| Mana Points: {G%-4d{g/{G%-4d{x Focus: {G%-3d{g%s Weight Carried: {G%-3d{g/{G%-3d{g |\n\r", ch->mana, ch->max_mana, ch->regen[1], "%", get_carry_weight (ch) / 10, can_carry_w (ch) / 10);
ptc(ch, "| Move Poions: {G%-4d{g/{G%-4d{x Endurance: {G%-3d{g%s Practices: {G%-3d{g |\n\r", ch->move, ch->max_move, ch->regen[2], "%", ch->practice);
ptc(ch, "|-----------------------------------------------------------------------------|\n\r");
ptc(ch, "| Strength: %-13s{g Force: %-11s{g Armor Class: {G%-6d{g |\n\r", score_stats(get_curr_stat (ch, STAT_STR)), score_stats(ch->multis[0]), ch->armor_class);
ptc(ch, "| Intelligence: %-13s{g Intuition: %-11s{g Base Atk Bonus: {G%-6d{g |\n\r", score_stats(get_curr_stat (ch, STAT_INT)), score_stats(ch->multis[1]), GET_DAMROLL(ch));
ptc(ch, "| Wisdom: %-13s{g Luck: %-11s{g Base Hit Bonus: {G%-6d{g |\n\r", score_stats(get_curr_stat (ch, STAT_WIS)), score_stats(ch->multis[2]), GET_HITROLL(ch));
ptc(ch, "| Dexterity: %-13s{g Speed: %-11s{g Wimpy: {G%-6d{g |\n\r", score_stats(get_curr_stat (ch, STAT_DEX)), score_stats(ch->multis[3]), ch->wimpy);
ptc(ch, "| Constitution: %-13s{g Resilience: %-11s{g Base Saves: {G%-6d{g |\n\r", score_stats(get_curr_stat (ch, STAT_CON)), score_stats(ch->multis[4]), ch->saving_throw);
ptc(ch, "| Charisma: %-13s{g Command: %-11s{g Size: {G%-7s{g |\n\r", score_stats(get_curr_stat (ch, STAT_CHA)), score_stats(ch->multis[5]), size_table[ch->size].name);
ptc(ch, "|-----------------------------------------------------------------------------|\n\r");
ptc(ch, "| Total Exp: {G%-12d{g Exp TNL: {G%-11d{g Base Attack: {G%-4d{g |\n\r", ch->exp, exp_needed_to_level(ch), ch->base_attack);
ptc(ch, "| Quest Points: {G%-12d{g Bounty: {G%-11d{g |\n\r", ch->quest_curr, ch->bountypnts);
ptc(ch, "| Banked Gold: {G%-12d{g Gold: {G%-11d{g Silver: {G%-7d{g |\n\r", ch->bank, ch->gold, ch->silver);
ptc(ch, "'-----------------------------------------------------------------------------'\n\r");
if (IS_SET(ch->comm, COMM_FULLSCORE))
{
ptc(ch, " %s (%d)\n\r", word_armorclass(ch, FALSE), ch->armor_class);
ptc(ch, " %s\n\r", word_health(ch));
ptc(ch, " %s\n\r", word_magic(ch));
display_faction(ch);
return;
}
return;
}
/*
* word_health()
*
* Returns health num to some words, used for score
*/
char * word_health(CHAR_DATA * ch)
{
int percent = 0;
static char wound[MSL];
wound[0] = '\0';
if (ch->max_hit > 0)
percent = ch->hit * 100 / ch->max_hit;
else
percent = -1;
if (percent >= 100)
strcat (wound, "You are perfectly healthy.");
else if (percent >= 90)
strcat (wound, "You have few scratchs.");
else if (percent >= 75)
strcat (wound, "You have a few wounds and bruises.");
else if (percent >= 50)
strcat (wound, "You are pretty badly bruised.");
else if (percent >= 30)
strcat (wound, "You have some heavy wounds.");
else if (percent >= 15)
strcat (wound, "You are extremely hurt.");
else if (percent >= 0)
strcat (wound, "You are nearly dead.");
else
strcat (wound, "You are bleeding to death.");
if (IS_AFFECTED(ch, AFF_BLIND))
strcat(wound, " You are blind.");
if (IS_AFFECTED(ch, AFF_POISON))
strcat(wound, " You are poisoned.");
if (IS_AFFECTED(ch, AFF_CURSE))
strcat(wound, " You are cursed.");
if (IS_AFFECTED(ch, AFF_PLAGUE))
strcat(wound, " You have contracted the plague");
if (IS_SET(ch->affected2_by, AFF2_DIEASE))
strcat(wound, " You have contracted a diease");
if (IS_SET(ch->affected2_by, AFF2_LEPROSY))
strcat(wound, " You have contracted Leprosy");
return wound;
}
/*
* word_magic()
*
* Returns health num to some words, used for score
*/
char * word_magic(CHAR_DATA * ch)
{
int percent = 0;
static char wound[MSL];
wound[0] = '\0';
if (ch->max_hit > 0)
percent = ch->mana * 100 / ch->max_mana;
else
percent = -1;
if (percent >= 100)
strcat (wound, "Your magic reserves are overflowing.");
else if (percent >= 90)
strcat (wound, "Your magical powers are only slightly phased.");
else if (percent >= 75)
strcat (wound, "Your magical reserves are weakening.");
else if (percent >= 50)
strcat (wound, "Your magical reserves feel drained.");
else if (percent >= 30)
strcat (wound, "Your magical powers are heavily drained.");
else if (percent >= 15)
strcat (wound, "You feel almost out of touch with your magical reserves.");
else if (percent >= 0)
strcat (wound, "You are almost completely drained of magical energies.");
else
strcat (wound, "You are totaly drained of magical powers.");
return wound;
}
char * word_armorclass (CHAR_DATA * ch, bool number)
{
static char buf[MSL];
buf[0] = '\0';
if (number)
{
sprintf(buf, "%d", ch->armor_class);
return buf;
}
if (ch->armor_class >= 10)
strcat(buf, "You are completely unarmored.");
else if (ch->armor_class >= 8)
strcat(buf, "You are barely protected.");
else if (ch->armor_class >= 6)
strcat(buf, "You are slightly armored.");
else if (ch->armor_class >= 4)
strcat(buf, "You are somewhat armored.");
else if (ch->armor_class >= 2)
strcat(buf, "You are protected.");
else if (ch->armor_class >= 0)
strcat(buf, "You are well-armored.");
else if (ch->armor_class >= -2)
strcat(buf, "You are very well armored.");
else if (ch->armor_class >= -4)
strcat(buf, "You are heavily armored.");
else if (ch->armor_class >= -6)
strcat(buf, "You are superbly armored.");
else if (ch->armor_class >= -8)
strcat(buf, "You are nearly invulnerable.");
else if (ch->armor_class >= -10)
strcat(buf, "You are divinely armored.");
else
strcat(buf, "You are nearly completely protected.");
return buf;
}
char * score_stats(int stat_value)
{
if (stat_value <= 0)
return "{rpitiful{x ";
else if (stat_value <= 10)
return "{rpathetic{x ";
else if (stat_value <= 20)
return "{Rvery weak{x ";
else if (stat_value <= 30)
return "{Rweak{x ";
else if (stat_value <= 40)
return "{ybelow average{x";
else if (stat_value <= 50)
return "{yaverage{x ";
else if (stat_value <= 60)
return "{Yabove average{x";
else if (stat_value <= 70)
return "{Ygood{x ";
else if (stat_value <= 80)
return "{gvery good{x ";
else if (stat_value <= 90)
return "{gsuperb{x ";
else if (stat_value <= 100)
return "{Gexcellent{x ";
else
return "{Gexcellent{x ";
}
/*
* alignment_lookup()
*
* -5 to 5
* Returns short or long version of alignment
*/
char * alignment_lookup(CHAR_DATA * ch, bool short_align)
{
static char align[MSL];
align[0] = '\0';
if (ch->align_lc == 1 && ch->align_ge == 1)
{
if (short_align)
strcat(align, "TN");
else
strcat(align, "True Neutral");
return align;
}
/* Lawful/Chaotic */
switch(ch->align_lc)
{ default:
case 1:
if (short_align)
strcat(align, "N");
else
strcat(align, "Neutral");
break;
case 0:
if (short_align)
strcat(align, "C");
else
strcat(align, "Chaotic");
break;
case 2:
if (short_align)
strcat(align, "L");
else
strcat(align, "Lawful");
break;
}
/* Evil/Good */
switch(ch->align_ge)
{ default:
case 1:
if (short_align)
strcat(align, "N");
else
strcat(align, "neutral");
break;
case 0:
if (short_align)
strcat(align, "E");
else
strcat(align, " evil");
break;
case 2:
if (short_align)
strcat(align, "G");
else
strcat(align, " good");
break;
}
return align;
}
void display_faction(CHAR_DATA * ch)
{
int x;
for (x = 0; faction_table[x].name != NULL; x++)
{
if (ch->faction[x] == 0)
continue;
ptc(ch, " You are a %s of %s\n\r",
faction_table[x].ranks[ch->faction[x]],
faction_table[x].display_name);
}
return;
}
/*
============================================================================
Thri Kantifaski is new to KoTL
----------------------------------------------------------------------------
You are single
============================================================================
| [Character Information] | [Attributes] |
| EXP TNL - 1016 Role Play XP - 0 | Transform: No |
| Level - 11 Hours Played - 0 | Str: Decent Agi: Average |
| Life Points - 220 Gender - Male | Int: Decent Cha: Average |
| Race - Wild elf Class - Mage | Wis: Decent Luk: Average |
| Curr Stance - None Stance Skill - 0 | Dex: Average Led: Average |
| Gold - 54 Silver - 5520 | Con: Decent Pec: Decent |
| Bank Gold - 0 Bank Silver - 0 ---------------------------
| Wimpy - 0 Carry ( 24/102 ) Spec ( 2/36 ) Wgt ( 785/1715 ) |
----------------------------------------------------------------------------
| [Kingdom & Religion] |
| Group Rank KTime TNL: Exp Time RPExp Ban Plgd |
| Murkwood Peasant 0 3535 10 0 No 0 |
| None none 0 0 10 500 No 0 |
| Align: Neutral Order: Neutral Faithpray: 0 |
----------------------------------------------------------------------------
| [Armor Class] |
| Slash Defense: [*---------] Pierce Defense: [*---------] |
| Magic Defense: [*---------] Bash Defense: [*---------] |
----------------------------------------------------------------------------
| [Offensive Ability] |
| Attack Power: [**=-------] Attack Accuracy: [**=-------] |
----------------------------------------------------------------------------
| [Combat Statistics] |
| Mobs Players Spars Duels Bloodsworn |
| Wins : 60 0 0 0 0 |
| Losses: 0 0 0 0 0 |
----------------------------------------------------------------------------
| [Mana Pools] |
| Black: 78/78 Grey: 104/104 White: 85/85 |
| Wind: 0/0 Water: 0/0 Fire: 0/0 |
| Spirit: 0/0 Earth: 0/0 Colorless: 139/139 |
----------------------------------------------------------------------------
| [Quest Tokens] | [BloodQuest] |
| Onyx: 0 Emerald: 40 Sapphire: 0 | Pts: 0 |
| Ruby: 0 Crystal: 0 Topaz: 0 | |
| Turquoise: 0 Diamond: 0 Amethyst: 0 | |
----------------------------------------------------------------------------
| News: 43 | Note: 21 | Idea: 46 | RP: 12 | Story: 46 | Brtr: 8 | Fun : 11 |
----------------------------------------------------------------------------
*/