#include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "mud.h" #define CTRL_R "" char update_char[400]; void do_afk (CHAR_DATA * ch, char *argy) { DEFINE_COMMAND ("afk", do_afk, POSITION_DEAD, 0, LOG_NORMAL, "This command logs you as away from the keyboard.") send_to_char ("You have been flagged as AFK. Typing any input will turn this off.\n\r", ch); send_to_char ("If you are away for too long, your character *will* autosave and autoquit.\n\r", ch); ch->timer = 50; return; } void info_remort (CHAR_DATA * ch, char * argy) { send_to_char("This command does not actually remort your character.\n\r", ch); send_to_char("It checks to see if you have the requirements for remorting.\n\r", ch); send_to_char("Type remort requirements to see the requrements for remorting.\n\r", ch); send_to_char("Type REMORT REMORT to actually remort your character.\n\r", ch); } void do_resistance (CHAR_DATA * ch, char *argy) { int i; int counter = 0; char buf[SML_LENGTH]; char arg1[SML_LENGTH]; char arg2[SML_LENGTH]; bool found = FALSE; DEFINE_COMMAND ("resistance", do_resistance, POSITION_DEAD, 0, LOG_NORMAL, "This command lets you buy resistances and list what ones are available.") if (IS_MOB(ch)) return; if (!str_cmp(argy, "costs") || !str_cmp(argy, "cost") || !str_cmp(argy, "list")) { for (i = 0; affect_flags1[i].flagname > 0; i++) { if (resist_costs[i] > 0) { sprintf(buf, "%-15s: %3d ", affect_flags1[i].how_it_appears, resist_costs[i]); if (++counter % 3 == 0) strcat(buf, "\n\r"); send_to_char(buf, ch); } } send_to_char("\n\r", ch); return; } argy = one_argy(argy, arg1); argy = one_argy(argy, arg2); if (!str_cmp(arg1, "buy") && argy != "") { for (i = 0; affect_flags1[i].flagname > 0; i++) { if (!str_cmp(arg2, affect_flags1[i].what_you_type)) { found = TRUE; if(resist_costs[i] > 0) { if (ch->pcdata->resist_points >= resist_costs[i]) { if (IS_SET(ch->pcdata->nat_aff[PROT], affect_flags1[i].flagname)) { send_to_char("You already have this. Bonk. Bonk.\n\r", ch); return; } ch->pcdata->nat_aff[PROT] |= affect_flags1[i].flagname; ch->aff[PROT] |= ch->pcdata->nat_aff[PROT]; ch->pcdata->resist_points -= resist_costs[i]; sprintf (buf, "You are now the proud new owner of resist %s!\n\r", affect_flags1[i].what_you_type); send_to_char(buf, ch); return; } else { sprintf(buf, "The %s resistance costs %d resistance points and you only have %d.\n\r", affect_flags1[i].what_you_type, resist_costs[i], ch->pcdata->resist_points); send_to_char(buf, ch); return; } } else { sprintf(buf, "You cannot buy resistance to %s.\n\r", affect_flags1[i].what_you_type); send_to_char(buf, ch); return; } } } if (!found) { send_to_char("That resistance does not seem to exist. Type resist list to see a list of all the things which you can get.\n\r", ch); return; } return; } if (!str_cmp(arg1, "remove") && argy != "") { for (i = 0; affect_flags1[i].flagname > 0; i++) { if (!str_cmp(arg2, affect_flags1[i].what_you_type)) { found = TRUE; if(resist_costs[i] == 0) { send_to_char("You cannot remove a resistance you can't buy.\n\r", ch); return; } if (IS_SET(race_info[ch->pcdata->race].aff[PROT], affect_flags1[i].flagname)) { send_to_char("The Angel of Proactive Cheater Stopping (tm) swoops down and pummels you into submission for trying to get rid of a resistance that is natural to your race.", ch); ch->hit = 1; ch->move = 1; return; } if (IS_SET(align_info[ch->pcdata->alignment].aff[PROT], affect_flags1[i].flagname)) { send_to_char("You can't get rid of something that is natural to your alignment. :P", ch); return; } if (!IS_SET(ch->pcdata->nat_aff[PROT], affect_flags1[i].flagname)) { send_to_char("You don't have this resistance.\n\r", ch); return; } if (ch->pcdata->bank < 1000*resist_costs[i] *resist_costs[i]) { sprintf(buf, "You need %d coins in the bank to get rid of this resistance.\n\r", (1000*resist_costs[i]*resist_costs[i])); send_to_char(buf, ch); return; } if (ch->pcdata->warpoints < (10*resist_costs[i]*resist_costs[i])) { sprintf(buf, "You need %d warpoints to get rid of this resistance.\n\r", (10*resist_costs[i]*resist_costs[i])); send_to_char(buf, ch); return; } ch->pcdata->warpoints -= (10*resist_costs[i]*resist_costs[i]); ch->pcdata->bank -= 1000*resist_costs[i] *resist_costs[i]; ch->pcdata->resist_points += resist_costs[i]; REMOVE_BIT(ch->pcdata->nat_aff[PROT], affect_flags1[i].flagname); sprintf(buf, "Ok, you just got rid or the %s resistance.\n\r", affect_flags1[i].what_you_type); send_to_char(buf, ch); fix_char(ch); return; } } if (!found) { send_to_char("Unkown resistance. Type resistance list to see a list of all of them.\n\r", ch); return; } return; } send_to_char("Resistance list/cost/costs\n\rResistance buy <resistance_name>\n\rResistance remove <resistance name>\n\r", ch); return; } void show_remort_requirements(CHAR_DATA * ch, char *argy) { char buf[500]; int remort = 0; for (remort = 0; remort < pow.max_remorts; ++remort) { if((remort == ch->pcdata->remort_times)) sprintf(buf,"-->"); else sprintf(buf, " "); send_to_char(buf, ch); sprintf(buf, "Remort: %2d, Lvl: %2d, Wps Req: %5d, Kps Req: %5d\n\r", (remort+1), pow.remort_req[remort][0],pow.remort_req[remort][1], pow.remort_req[remort][2]); send_to_char(buf, ch); if ((remort == ch->pcdata->remort_times)) { sprintf(buf, "-->You are level %d, you have %ld warpoints, and have %d killpoints.\n\r", LEVEL(ch), ch->pcdata->warpoints, ch->pcdata->killpoints); send_to_char(buf, ch); } } if (ch->pcdata->remort_times >= pow.max_remorts) send_to_char("You have the maximum number of remorts.\n\r", ch); return; } void do_raceinfo (CHAR_DATA *ch, char *argy) { char buf[SML_LENGTH]; int j; int iRace; SPELL_DATA *spl; char buf1[SML_LENGTH]; DEFINE_COMMAND("raceinfo", do_raceinfo, POSITION_DEAD, 0, LOG_NORMAL, "This command lists the basic information about the races in the game.") if (IS_MOB (ch)) return; if (!str_cmp(argy, "all") || argy[0] == '\0' || argy == "" || argy == "" || argy[0] == '\0' || !str_cmp(argy, "blank")) { sprintf (buf, " Name "); for (j = 0; j < 5; j++) { sprintf (buf1, "%4s", stat_short_name[j]); strcat (buf, buf1); } strcat (buf, " Sk/Sp/Pf Specials\n\r"); send_to_char (buf, ch); for(iRace = 0; iRace < RACE_COUNT; iRace++) { if (str_cmp(race_info[iRace].name, "Blank") && ((race_info[iRace].restart_race == FALSE) || (pow.remorts_for_restart > 0 && ch->pcdata->remort_times >= pow.remorts_for_restart/2 && ch->pcdata->remort_times >= 1))) { sprintf(buf,"[%2d]\x1b[1;37m %12s: \x1b[1;37m", (iRace+1),race_info[iRace].name); for (j = 0; j < 5; j++) { sprintf (buf1, "%3d ", race_info[iRace].limits[j]); strcat (buf, buf1); } sprintf (buf1, "\x1b[1;31m%2d/%-2d/%-2d\x1b[0;37m ", race_info[iRace].max_slots[0], race_info[iRace].max_slots[1], race_info[iRace].max_slots[2]); strcat (buf,buf1); send_to_char(buf, ch); if (race_info[iRace].aff[HURT]) { send_to_char (natural_hurts (race_info[iRace].aff[HURT]), ch); } if (race_info[iRace].aff[PROT]) { send_to_char (natural_protects (race_info[iRace].aff[PROT]), ch); } if (race_info[iRace].aff[AFF]) { send_to_char (natural_affects (race_info[iRace].aff[AFF]), ch); } if (race_info[iRace].aff[DET]) { send_to_char (natural_detects (race_info[iRace].aff[DET]), ch); } if (race_info[iRace].nat_augments != 0) { sprintf(buf, "%s", augmentss (race_info[iRace].nat_augments)); send_to_char(buf, ch); } send_to_char("\x1b[0;37m\n\r", ch); } } return; } for (iRace = 0; iRace < RACE_COUNT; iRace++) { if (!str_cmp(argy, race_info[iRace].name) && str_cmp(argy, "blank") && (race_info[iRace].restart_race == FALSE || (pow.remorts_for_restart >0 && ch->pcdata->remort_times >= pow.remorts_for_restart/2 && ch->pcdata->remort_times > 0))) break; } if (is_number(argy)) iRace = atoi(argy)-1; if (iRace >= -1 && iRace < (RACE_COUNT-1) && str_cmp(race_info[iRace].name,"blank")) { do_help (ch, (char *) race_info[iRace].name); send_to_char ("--------------------------------------------------------------------------\n\r", ch); sprintf (buf, "People of this race usually range in height from %d'%d\" to %d' %d\".\n\r", race_info[iRace].height_min / 12, race_info[iRace].height_min % 12, race_info[iRace].height_max / 12, race_info[iRace].height_max % 12); send_to_char(buf, ch); sprintf (buf, "Max Skills: \x1B[1;32m%d\x1B[0;37m. Max Spells:\x1B[1;32m%d\x1B[0;37m. Max Profs:\x1B[1;32m%d\x1B[0;37m.\n\r", race_info[iRace].max_slots[0], race_info[iRace].max_slots[1], race_info[iRace].max_slots[2]); send_to_char(buf, ch); if (pow.show_race_select_info || ch->pcdata->level > 0) { int i; sprintf (buf, "Natural Armor Bonus:\x1B[1;34m%d\x1B[0;37m.\n\rStat limits: \x1B[1;35m", race_info[iRace].natarmor); for (i = 0; i < NUM_STATS; i++) { sprintf(buf, "%s: %d ", stat_short_name[i], race_info[iRace].limits[i]); send_to_char(buf, ch); } send_to_char("\x1b[0;37m\n\r", ch); if (race_info[iRace].aff[HURT]) { send_to_char ("\x1B[0;37mNatural Hurts: ", ch); send_to_char (natural_hurts (race_info[iRace].aff[HURT]), ch); send_to_char (".\n\r", ch); } if (race_info[iRace].aff[PROT]) { send_to_char ("\x1B[0;37mNatural Protects: ", ch); send_to_char (natural_protects (race_info[iRace].aff[PROT]), ch); send_to_char (".\n\r", ch); } if (race_info[iRace].aff[AFF]) { send_to_char ("\x1B[0;37mNatural Affects: ", ch); send_to_char (natural_affects (race_info[iRace].aff[AFF]), ch); send_to_char (".\n\r", ch); } if (race_info[iRace].aff[DET]) { send_to_char ("\x1B[0;37mNatural Detects: ", ch); send_to_char (natural_detects (race_info[iRace].aff[DET]), ch); send_to_char (".\n\r", ch); } sprintf (buf, "\x1B[0mNatural Enhancements: \x1B[1;36m%s\x1B[0;37m.\n\r", augmentss (race_info[iRace].nat_augments)); send_to_char(buf, ch); if (race_info[iRace].regen_hit_percent != 100) { sprintf (buf, "\x1B[0;37mHitpoint regeneration is \x1B[1;37m%d\x1B[0;37m percent of normal.\n\r", race_info[iRace].regen_hit_percent); send_to_char(buf, ch); } if (race_info[iRace].regen_move_percent != 100) { sprintf (buf, "Movement regeneration is \x1B[1;37m%d\x1B[0;37m percent of normal.\n\r", race_info[iRace].regen_move_percent); send_to_char(buf, ch); } if (race_info[iRace].attack_spell_percent != 100) { sprintf (buf, "This race casts attack spells at \x1B[1;37m%d\x1B[0;37m percent of normal power.\n\r", race_info[iRace].attack_spell_percent); send_to_char(buf, ch); } if (race_info[iRace].combat_damage_bonus != 0) { sprintf (buf, "This race has a natural attack power %s of \x1B[1;37m%d\x1B[0;37m.\n\r", (race_info[iRace].combat_damage_bonus > 0 ? "bonus" : "penalty"), race_info[iRace].combat_damage_bonus); send_to_char(buf, ch); } if (race_info[iRace].backstab_percent != 100) { sprintf (buf, "This race backstabs at \x1B[1;37m%d\x1B[0;37m percent of normal.\n\r", race_info[iRace].backstab_percent); send_to_char(buf, ch); } if (race_info[iRace].heal_percent != 100) { sprintf (buf, "This race casts healing spells at \x1B[1;37m%d\x1B[0;37m percent of normal power.\n\r", race_info[iRace].heal_percent); send_to_char(buf, ch); } if (race_info[iRace].hps_bonus != 0) { sprintf (buf, "This race %s a %s \x1B[1;37m%d\x1B[0;37m hit points gained per level.\n\r", (race_info[iRace].hps_bonus > 0 ? "gains" : "has"), (race_info[iRace].hps_bonus > 0 ? "bonus" : "penalty"), (race_info[iRace].hps_bonus)); send_to_char(buf, ch); } if (race_info[iRace].mana_percent != 100) { sprintf (buf, "This race stores \x1B[1;37m%d\x1B[0;37m percent of the normal amount of mana.\n\r", race_info[iRace].mana_percent); send_to_char(buf, ch); } for (i = 0; i < 3; i ++) { if (race_info[iRace].nat_skills[i] > 0) { if ((spl = skill_lookup (NULL,race_info[iRace].nat_skills[i])) != NULL) { sprintf(buf, "This race can use %s naturally.\n\r", spl->spell_name); send_to_char(buf, ch); } } } } send_to_char ("--------------------------------------------------------------------------\n\r", ch); } else { send_to_char("raceinfo or raceinfo <racename> or raceinfo <race_number>.\n\r", ch); } return; } void do_alignmentinfo (CHAR_DATA *ch, char *argy) { char buf[SML_LENGTH]; int Align, i, j; SPELL_DATA *spl; char buf1[SML_LENGTH]; DEFINE_COMMAND("aligninfo", do_alignmentinfo, POSITION_DEAD, 0, LOG_NORMAL, "This command lists the basic information about the alignments in the game.") if (IS_MOB (ch)) return; if (!str_cmp(argy, "all") || argy[0] == '\0' || argy == "" || argy == "" || argy[0] == '\0' || !str_cmp(argy, "blank")) { send_to_char(" Bonuses to all of the following above and beyond racial bonuses:", ch); sprintf (buf, " Name "); for (j = 0; j < NUM_STATS; j++) { sprintf (buf1, "%4s", stat_short_name[j]); strcat (buf,buf1); } strcat (buf, "Sk/Sp/Pf Specials\n\r"); send_to_char (buf, ch); for(Align = 0; Align < NUM_ALIGN; Align++) { if (str_cmp(race_info[Align].name, "Blank")) { sprintf(buf,"[%2d]\x1b[1;37m %12s: \x1b[1;37m", (Align+1),align_info[Align].name); for (j = 0; j < NUM_STATS; j++) { sprintf (buf1, "%3d ", align_info[Align].limits[j]); strcat (buf, buf1); } sprintf (buf1, "\x1b[1;31m%2d/%-2d/%-2d\x1b[0;37m ", align_info[Align].max_slots[0], align_info[Align].max_slots[1], align_info[Align].max_slots[2]); strcat (buf, buf1); } send_to_char(buf, ch); if (align_info[Align].aff[HURT]) { send_to_char (natural_hurts (align_info[Align].aff[HURT]), ch); } if (align_info[Align].aff[PROT]) { send_to_char (natural_protects (align_info[Align].aff[PROT]), ch); } if (align_info[Align].aff[AFF]) { send_to_char (natural_affects (align_info[Align].aff[AFF]), ch); } if (align_info[Align].aff[DET]) { send_to_char (natural_detects (align_info[Align].aff[DET]), ch); } if (align_info[Align].nat_augments != 0) { sprintf(buf, "%s", augmentss (align_info[Align].nat_augments)); send_to_char(buf, ch); } send_to_char("\x1b[0;37m\n\r", ch); } return; } for (Align = 0; Align < NUM_ALIGN; Align++) { if (!str_cmp(argy, align_info[Align].name) && str_cmp(argy, "blank")) break; } if (is_number(argy)) Align = atoi(argy); if (Align >= 0 && Align < (NUM_ALIGN) && str_cmp(align_info[Align].name,"blank")) { do_help (ch, (char *) align_info[Align].name); send_to_char ("--------------------------------------------------------------------------\n\r", ch); sprintf (buf, "Skill %s: \x1B[1;32m%d\x1B[0;37m. Spell %s:\x1B[1;32m%d\x1B[0;37m. Profs %s:\x1B[1;32m%d\x1B[0;37m. \n\r", (align_info[Align].max_slots[0] > 0 ? "Bonus" : "Penalty"),align_info[Align].max_slots[0], (align_info[Align].max_slots[1] > 0 ? "Bonus" : "Penalty"),align_info[Align].max_slots[1], (align_info[Align].max_slots[2] > 0 ? "Bonus" : "Penalty"),align_info[Align].max_slots[2]); send_to_char(buf, ch); sprintf (buf, "Natural Armor Bonus:\x1B[1;34m%d\x1B[0;37m.\n\rStat Limit Modifiers:", align_info[Align].natarmor); for (i = 0; i < NUM_STATS; i++) { if (align_info[Align].limits[i] != 0) { sprintf(buf, "%s: %d ", stat_short_name[i], align_info[Align].limits[i]); send_to_char(buf, ch); } } send_to_char("\x1b[0;37m\n\r", ch); if (align_info[Align].aff[HURT]) { send_to_char ("Natural Hurts: ", ch); send_to_char (natural_hurts (align_info[Align].aff[HURT]), ch); send_to_char (".\n\r", ch); } if (align_info[Align].aff[PROT]) { send_to_char ("Natural Protects: ", ch); send_to_char (natural_protects (align_info[Align].aff[PROT]), ch); send_to_char (".\n\r", ch); } if (align_info[Align].aff[AFF]) { send_to_char ("Natural Affects: ", ch); send_to_char (natural_affects (align_info[Align].aff[AFF]), ch); send_to_char (".\n\r", ch); } if (align_info[Align].aff[DET]) { send_to_char ("Natural Detects: ", ch); send_to_char (natural_detects (align_info[Align].aff[DET]), ch); send_to_char (".\n\r", ch); } sprintf (buf, "Natural Enhancements: \x1B[1;36m%s\x1B[0;37m.\n\r", augmentss (align_info[Align].nat_augments)); send_to_char(buf, ch); if (align_info[Align].regen_hit_percent != 0) { sprintf (buf, "Hitpoint regeneration %s is \x1B[1;37m%d\x1B[0;37m percent from normal.\n\r", (align_info[Align].regen_hit_percent > 0 ? "bonus" : "penalty"), align_info[Align].regen_hit_percent); send_to_char(buf, ch); } if (align_info[Align].regen_move_percent != 0) { sprintf (buf, "Movement regeneration %s is \x1B[1;37m%d\x1B[0;37m percent from normal.\n\r", (align_info[Align].regen_move_percent > 0 ? "bonus" : "penalty"),align_info[Align].regen_move_percent); send_to_char(buf, ch); } if (align_info[Align].attack_spell_percent != 00) { sprintf (buf, "Attack spell %s is \x1B[1;37m%d\x1B[0;37m from normal.\n\r", (align_info[Align].attack_spell_percent > 0 ? "bonus" : "penalty"),align_info[Align].attack_spell_percent); send_to_char(buf, ch); } if (align_info[Align].combat_damage_bonus != 0) { sprintf (buf, "This alignment has a natural attack power %s of \x1B[1;37m%d\x1B[0;37m from normal.\n\r", (align_info[Align].combat_damage_bonus > 0 ? "bonus" : "penalty"), align_info[Align].combat_damage_bonus); send_to_char(buf, ch); } if (align_info[Align].backstab_percent != 0) { sprintf (buf, "Backstab %s of \x1B[1;37m%d\x1B[0;37m from normal.\n\r", (align_info[Align].backstab_percent > 0 ? "bonus" : "penalty"), align_info[Align].backstab_percent); send_to_char(buf, ch); } if (align_info[Align].heal_percent != 0) { sprintf (buf, "Healing spell %s is \x1B[1;37m%d\x1B[0;37m percent from normal.\n\r", (align_info[Align].heal_percent > 0 ? "bonus" : "penalty"),align_info[Align].heal_percent); send_to_char(buf, ch); } if (align_info[Align].hps_bonus != 0) { sprintf (buf, "This race %s a %s \x1B[1;37m%d\x1B[0;37m hit points gained per level.\n\r", (align_info[Align].hps_bonus > 0 ? "gains" : "has"), (align_info[Align].hps_bonus > 0 ? "bonus" : "penalty"), (align_info[Align].hps_bonus)); send_to_char(buf, ch); } if (align_info[Align].mana_percent != 0) { sprintf (buf, "This race stores \x1B[1;37m%d\x1B[0;37m percent %s mana than normal.\n\r", align_info[Align].mana_percent, (align_info[Align].mana_percent > 0 ? "more" : "less")); send_to_char(buf, ch); } for (i = 0; i < 3; i ++) { if (align_info[Align].nat_skills[i] > 0) { if ((spl = skill_lookup (NULL,align_info[Align].nat_skills[i])) != NULL) { sprintf(buf, "This alignment can use %s naturally.\n\r", spl->spell_name); send_to_char(buf, ch); } } } send_to_char ("--------------------------------------------------------------------------\n\r", ch); } else { send_to_char("aligninfo or aligninfo <alignname> or aligninfo <align_number>.\n\r", ch); } return; } void do_remort (CHAR_DATA * ch, char * argy) { char buf[SML_LENGTH]; int remort = 0; bool ready = TRUE; DEFINE_COMMAND ("remort", do_remort, POSITION_DEAD, 0, LOG_NORMAL, "This command transfers worthy players to the remort room where they can TRANSFORM.") if (IS_MOB(ch)) return; if(ch->position !=POSITION_STANDING) { send_to_char("You must be standing to remort!!!\n\r", ch); return; } if (argy == "" || argy == '\0' || !str_cmp(argy, "help")) { info_remort(ch, argy); return; } if (!str_cmp (argy, "requirements") || !str_cmp(argy, "cost") || !str_cmp(argy, "costs")) { show_remort_requirements (ch, argy); return; } if (str_cmp (argy, "remort")) { info_remort(ch, ""); return; } if (ch->in_room->vnum != REMORT_ROOM) { send_to_char("You are not in the proper place to remort!\n\r", ch); return; } remort = ch->pcdata->remort_times; if (LEVEL(ch) < pow.remort_req[remort][0]) { send_to_char("You need to gain more levels before you can remort!\n\r", ch); ready = FALSE; } if (ch->pcdata->warpoints < pow.remort_req[remort][1]) { send_to_char("You need to pkill more before we will allow you to remort!\n\r", ch); ready = FALSE; } if (ch->pcdata->killpoints < pow.remort_req[remort][2]) { send_to_char("You need to kill more tough monsters before you can remort!\n\r", ch); ready = FALSE; } if (!ready) return; char_from_room(ch); if (pow.remort_in_room > 0 && get_room_index(pow.remort_in_room) != NULL) char_to_room(ch, get_room_index(pow.remort_in_room)); { CHAR_DATA *sch; sch=create_mobile(get_mob_index(1)); char_to_room(sch,get_room_index(1)); sprintf(buf, "We, the immortals, decree that %s is fit to be reborn!\n\r", NAME(ch)); do_echo(sch, buf); extract_char(sch, TRUE); } ch->pcdata->warpoints -= pow.remort_req[remort][1]; ch->pcdata->killpoints -= pow.remort_req[remort][3]; } void do_choosesides (CHAR_DATA * ch, char *argy) { int num; char buf[200]; DEFINE_COMMAND ("choosesides", do_choosesides, POSITION_DEAD, 0, LOG_NORMAL, "This command is the one that lets newbies choose sides.") if (IS_MOB(ch)) return; if (pow.choose_in_room > 0 && (!ch->in_room || ch->in_room->vnum != pow.choose_in_room)) { send_to_char("You are not in the room of choosing. When you are ready, you will be automatically taken there.\n\r", ch); return; } if (is_number(argy)) { num = atoi(argy); if (num > 0 && num < NUM_ALIGN) { sprintf(buf, "\n\r\n\r\n\r\x1b[1;31m Ok, you choose side %d.\n\r\n\r\n\r", num); send_to_char(buf, ch); alignswitch(ch, num); char_from_room(ch); char_to_room(ch, get_room_index(100+num)); return; } } sprintf(buf, "Please type aligninfo and choose a number from 1 to %d.\n\r", (NUM_ALIGN-1)); send_to_char(buf, ch); return; } void write_playerbase_to_file (void) { FILE *fff; char write_one_line[500]; PLAYERBASE_DATA *playerbase; int tps, np, rp, average_level, level_tot; tps = 0; np = 0; rp = 0; average_level = 0; level_tot = 0; if ((fff = fopen ("player.txt", "w+")) == NULL) { fprintf (stderr, "The write failed! Bad news!! VERY bad news!!!!\n\r"); return; } for (playerbase = playerbase_zero; playerbase != NULL; playerbase = playerbase->next) { if (playerbase->player_level != -1) { tps++; if(playerbase->player_level <= pow.level_to_choose && playerbase->player_remort_times == 0) np++; if (playerbase->player_remort_times > 0) rp++; level_tot += (playerbase->player_level); sprintf (write_one_line, "%-17s R: %d Lvl: %3d Last_on: %4ld hrs NoD: %s\n", playerbase->player_name, (playerbase->player_remort_times), (playerbase->player_level), ((current_time - playerbase->player_last_login) / 3600), (playerbase->player_nodelete ? "y" : "n")); fprintf (fff, write_one_line); } } if (tps == 0) average_level = 0; else average_level = level_tot / tps; fprintf (fff, "Total Playerbase size: %d. Max Playerbase size: Unlimited.\n\r", tps); fprintf (fff, "Newbies: %d. Remorted players: %d. Average Lvl: %d.\n\r", np, rp, average_level); fclose (fff); return; } void do_players (CHAR_DATA * ch, char *argy) { int num_total, level_total, average_level; int average_lev[NUM_ALIGN]; int level_tot[NUM_ALIGN]; int num_tot[NUM_ALIGN]; int num_remorts[NUM_ALIGN][pow.max_remorts+1]; int maximum_remorts[NUM_ALIGN]; int i, jj; PLAYERBASE_DATA *playerbase; DEFINE_COMMAND ("pb", do_players, POSITION_DEAD, 0, LOG_NORMAL, "This command lists the playerbase size, and gives some general info.") num_total = 0; level_total = 0; average_level = 0; for (jj = 0; jj < NUM_ALIGN; jj++) { average_lev[jj] = 0; level_tot[jj] = 0; num_tot[jj] = 0; maximum_remorts[jj] = 0; for (i = 0; i < (pow.max_remorts+1); i++) { num_remorts[jj][i] = 0; } } if (!str_cmp (argy, "file") && ch->pcdata->level == MAX_LEVEL) write_playerbase_to_file (); for (playerbase = playerbase_zero; playerbase != NULL; playerbase = playerbase->next) { if (playerbase->player_level > 99) continue; num_total++; level_total += playerbase->player_level; level_tot[playerbase->player_align] += playerbase->player_level; num_tot[playerbase->player_align]++; if (playerbase->player_remort_times < pow.max_remorts+1 && playerbase->player_remort_times >= 0) num_remorts[playerbase->player_align][playerbase->player_remort_times]++; if (playerbase->player_remort_times > maximum_remorts[playerbase->player_align]) maximum_remorts[playerbase->player_align] = playerbase->player_remort_times; } if (num_total == 0) average_level = 0; else average_level = level_total / num_total; for (jj = 0; jj < NUM_ALIGN; jj++) { if (num_tot[jj] == 0) average_lev[jj] = 0; else average_lev [jj] = level_tot[jj]/num_tot[jj]; } sprintf (update_char, "Total Playerbase size: \x1B[1;37m%d\x1B[0m. Average Playerbase Level: \x1b[1;37m%d\x1b[0;37m.\n\r", num_total, average_level); send_to_char (update_char, ch); for (jj = 0; jj < NUM_ALIGN; jj ++) { if (num_tot[jj] > 0) { sprintf(update_char, "Total members of %s: %d, Average Level: %d, Max Remort: %d\n\r", align_info[jj].name, num_tot[jj], average_lev[jj],maximum_remorts[jj]); send_to_char(update_char, ch); } } if (!str_cmp(argy, "full") && LEVEL(ch) == MAX_LEVEL) { for (i=0; i < (pow.max_remorts+1); i++) { update_char[0] = '\0'; for (jj = 0; jj < NUM_ALIGN; jj++) { sprintf(update_char, "%4d", num_remorts[jj][i]); send_to_char(update_char,ch); } send_to_char("\n\r", ch); } } return; } void do_pdelete (CHAR_DATA * ch, char *argy) { PLAYERBASE_DATA *playerbase; CHAR_DATA *ccc; DEFINE_COMMAND ("pdelete", do_pdelete, POSITION_DEAD, MAX_LEVEL, LOG_ALWAYS, "This command is used to delete characters.") if (IS_MOB (ch)) return; if (argy == "" || argy[0] == '\0') { send_to_char ("Syntax is PDELETE <playername>.\n\r", ch); return; } ccc = get_char_world (ch, argy); if (ccc != NULL && IS_PLAYER (ccc)) { do_delete (ccc, "character forever"); } for (playerbase = playerbase_zero; playerbase != NULL; playerbase = playerbase->next) { if (!str_cmp (argy, playerbase->player_name)) { sprintf (update_char, "%s%s.cor", PLAYER_DIR, playerbase->player_name); unlink (update_char); sprintf (update_char, "%s%s", PLAYER_DIR, playerbase->player_name); unlink (update_char); /* sprintf(update_char,"rm \"%s%s\" &",PLAYER_DIR,jumble_name(playerbase->player_name,FALSE)); system(update_char); */ playerbase->player_level = -1; send_to_char ("Character deleted!\n\r", ch); save_playerbase (); return; } } send_to_char ("Player not found.\n\r", ch); return; } void do_nodelete (CHAR_DATA * ch, char *argy) { PLAYERBASE_DATA *playerbase; DEFINE_COMMAND ("z_nodelete", do_nodelete, POSITION_DEAD, MAX_LEVEL, LOG_ALWAYS, "This toggles a no delete flag on/off for a given player.") if (argy == "" || argy[0] == '\0') { char line[3][17]; char outbuf[200]; line[0][0] = '\0'; line[1][0] = '\0'; line[2][0] = '\0'; send_to_char ("Syntax is NODELETE <charname>.\n\r", ch); send_to_char ("\n\rCurrent no_delete flags on:\n\r", ch); for (playerbase = playerbase_zero; playerbase != NULL; playerbase = playerbase->next) { if (playerbase->player_level == -1) continue; if (playerbase->player_nodelete) { if (line[0][0] == '\0') strcpy (line[0], playerbase->player_name); else if (line[1][0] == '\0') strcpy (line[1], playerbase->player_name); else if (line[2][0] == '\0') strcpy (line[2], playerbase->player_name); else { sprintf (outbuf, "%17s %17s %17s\n\r", line[0], line[1], line[2]); send_to_char (outbuf, ch); strcpy (line[0], playerbase->player_name); line[1][0] = '\0'; line[2][0] = '\0'; } } } sprintf (outbuf, "%17s %17s %17s\n\r", (line[0][0] == '\0' ? " " : line[0]), (line[1][0] == '\0' ? " " : line[1]), (line[2][0] == '\0' ? " " : line[2])); send_to_char (outbuf, ch); return; } for (playerbase = playerbase_zero; playerbase != NULL; playerbase = playerbase->next) { if (!str_cmp (argy, playerbase->player_name)) { if (playerbase->player_nodelete) { send_to_char ("PLAYER NOW CAN BE DELETED AFTER INACTIVITY!\n\r", ch); playerbase->player_nodelete = FALSE; save_playerbase (); return; } else { send_to_char ("Player is now safe from inactivity deletion.\n\r", ch); playerbase->player_nodelete = TRUE; save_playerbase (); return; } } } send_to_char ("I could not find that player in the database.\n\r", ch); return; } void show_remort (CHAR_DATA * ch) { char buf[STD_LENGTH]; int i; if (IS_MOB (ch)) return; send_to_char ("You should read help Transform first, before you go any further.\n\r", ch); send_to_char ("\n\rThe correct syntax for transforming is:\n\r", ch); sprintf (buf, "Transform" ); if (pow.stats_per_remort > 0) { for (i = 0; i < pow.stats_per_remort; i++) { strcat (buf, "<\x1b[1;37mstat\x1b[0;37m> "); } send_to_char (buf, ch); sprintf (buf , "where <\x1b[1;37mstat\x1b[0;37m> is one of "); for (i = 0; i < NUM_STATS; i++) { strcat (buf, stat_short_name[i]); } strcat (buf, "\n\r"); send_to_char (buf, ch); if (pow.remorts_for_restart > 0 && ch->pcdata->remort_times >= pow.remorts_for_restart/2) { sprintf (buf, "\n\n\rIf this will be remort %d for you coming up, then you may restart your character by typing transform <racename> which will reset your race to the new race you choose, but it will also essentially delete your character.\n\r", pow.remorts_for_restart); send_to_char (buf, ch); } } return; } void show_donate (CHAR_DATA * ch) { send_to_char ("You should read help Donate first, before continuing.\n\r", ch); send_to_char ("The proper syntax is:\n\n\r", ch); send_to_char ("Donate <amount> <warpoints/gold> <city/clan>.\n\n\r", ch); send_to_char ("You must donate at least 100 gold or warpoints each time.\n\r", ch); return; }