#include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "mud.h" void check_ranking_data (CHAR_DATA * ch) { int k, i; int old_slot[RANKING_INFO]; int new_slot[RANKING_INFO]; float char_info[RANKING_INFO]; bool already_on_ranking[RANKING_INFO]; if (IS_MOB (ch)) return; /* if (LEVEL(ch) > 90) return; */ /* +----------------------------------------------------------------------+ */ /* | Reset all ranking values to 0.0 | */ /* +----------------------------------------------------------------------+ */ for (i = 0; i < RANKING_INFO; i++) char_info[i] = 0.0; /* +----------------------------------------------------------------------+ */ /* | Distribute all ranking values | */ /* +----------------------------------------------------------------------+ */ char_info[0] = rating (ch); if (ch->pcdata->pkills > 4) { char_info[1] = (float) ch->pcdata->total_wps; char_info[2] = (float) ch->pcdata->pkills; char_info[3] = (float) ((float) ch->pcdata->pklevels / (float) ch->pcdata->pkills); if (ch->pcdata->pkhelpers > 1) char_info[4] = (float) ((float) ch->pcdata->pkills / (float) ch->pcdata->pkhelpers); if (ch->pcdata->pklevels > 1) char_info[5] = (float) ((float) ch->pcdata->pkills / (float) ch->pcdata->pklevels); char_info[6] = (float) ((float) ch->pcdata->pkhelpers/ (float) ch->pcdata->pkills); } if (ch->pcdata->pkilled >=1) { char_info[7] = (float) ((float) ch->pcdata->pkers / (float) ch->pcdata->pkilled); char_info[8] = (float) ((float) ch->pcdata->pkilled); } char_info[9] = ((ch->pcdata->played) + (((int) (current_time - ch->pcdata->logon)))) / 3600; /* +----------------------------------------------------------------------+ */ /* | Distribute false slot values | */ /* +----------------------------------------------------------------------+ */ for (k = 0; k < RANKING_INFO; k++) { old_slot[k] = -1; already_on_ranking[k] = FALSE; new_slot[k] = -1; } /* +----------------------------------------------------------------------+ */ /* | Check if character is already on ranking | */ /* +----------------------------------------------------------------------+ */ for (i = 0; i < RANKING_INFO; i++) { for (k = 0; k < MAX_RANKING_DATA; k++) { if (!str_cmp (capitalize (NAME (ch)), ranking_data[k][i].name)) { already_on_ranking[i] = TRUE; old_slot[i] = k; } } } /* +----------------------------------------------------------------------+ */ /* | Sort new ranking order | */ /* +----------------------------------------------------------------------+ */ for (i = 0; i < RANKING_INFO; i++) { if (already_on_ranking[i] && (old_slot[i] <= (MAX_RANKING_DATA-2)) && (old_slot[i] >= 0)) { for (k = old_slot[i]; k <= (MAX_RANKING_DATA -2); k++) { if (k > (MAX_RANKING_DATA-2)) break; ranking_data[k][i].name[0] = '\0'; strcpy (ranking_data[k][i].name, ranking_data[k+1][i].name); ranking_data[k][i].value = ranking_data[k+1][i].value; ranking_data[k][i].alignment = ranking_data[k+1][i].alignment; } ranking_data[MAX_RANKING_DATA-1][i].name[0] = '\0'; strcpy (ranking_data[MAX_RANKING_DATA-1][i].name, "<free-slot>"); ranking_data[MAX_RANKING_DATA-1][i].value = 0.0; ranking_data[MAX_RANKING_DATA-1][i].alignment = FALSE; } } for (i = 0; i < RANKING_INFO; i++) { if (char_info[i] > 0) { for (k=0; k < MAX_RANKING_DATA; k++) { if (char_info[i] > ranking_data[k][i].value) { new_slot[i] = k; break; } } } else new_slot[i] = -1; } for (i = 0; i < RANKING_INFO;i ++) { if ((new_slot[i] >=0) && (new_slot[i] < (MAX_RANKING_DATA-1))) { for (k = (MAX_RANKING_DATA -1); k > new_slot[i]; k--) { ranking_data[k][i].name[0] = '\0'; strcpy (ranking_data[k][i].name, ranking_data[k-1][i].name); ranking_data[k][i].value = ranking_data[k-1][i].value; ranking_data[k][i].alignment = ranking_data[k-1][i].alignment; } ranking_data[new_slot[i]][i].name[0] = '\0'; strcpy (ranking_data[new_slot[i]][i].name, capitalize (NAME (ch))); ranking_data[new_slot[i]][i].alignment = ch->pcdata->alignment; ranking_data[new_slot[i]][i].value = char_info[i]; } } return; } /* +----------------------------------------------------------------------+ */ /* | Save ranking into ranking.dat | */ /* +----------------------------------------------------------------------+ */ void save_ranking (void) { FILE *fp; int k, i; if ((fp = fopen ("ranking.dat", "w")) == NULL) { fprintf (stderr, "Error on ranking write.\n"); exit (2); } for (k = 0; k < MAX_RANKING_DATA; k++) { for (i=0; i < RANKING_INFO; i++) { int tempval; fprintf (fp, "%s\n", ranking_data[k][i].name); tempval = (long) (10000*ranking_data[k][i].value); fprintf (fp, "%d\n", tempval); fprintf (fp, "%d\n", ranking_data[k][i].alignment); } } fprintf (fp, "\nEND\n"); fclose (fp); return; } /* +----------------------------------------------------------------------+ */ /* | Load ranking from ranking.dat | */ /* +----------------------------------------------------------------------+ */ void load_ranking (void) { FILE *fp; int k, i; if ((fp = fopen ("ranking.dat", "r")) == NULL) { for (k = 0; k < MAX_RANKING_DATA; k++) { for (i=0; i < RANKING_INFO; i++) { strcpy (ranking_data[k][i].name, "<free-slot>"); ranking_data[k][i].value = 0.0; ranking_data[k][i].alignment = TRUE; } } save_ranking (); return; } for (k = 0; k < MAX_RANKING_DATA; k++) { for (i=0; i < RANKING_INFO; i++) { int tempval; strcpy (ranking_data[k][i].name, fread_word (fp)); tempval = fread_number (fp); ranking_data[k][i].value = (float) ((float) tempval/ (float) 10000); ranking_data[k][i].alignment = fread_number (fp); } } fclose (fp); return; } /* +----------------------------------------------------------------------+ */ /* | Link "rating" command do do_ranking procedure | */ /* +----------------------------------------------------------------------+ */ void do_rating (CHAR_DATA * ch, char *argy) { DEFINE_COMMAND ("rating", do_rating, POSITION_SLEEPING, 0, LOG_NORMAL, "Shows you your current rating.") if (IS_MOB (ch)) return; do_ranking (ch, "1"); return; } /* +----------------------------------------------------------------------+ */ /* | Link "topkiller" command do do_ranking procedure | */ /* +----------------------------------------------------------------------+ */ void do_topkiller (CHAR_DATA * ch, char *argy) { DEFINE_COMMAND ("topkiller", do_topkiller, POSITION_SLEEPING, 0, LOG_NORMAL, "Shows the top PKillers.") if (IS_MOB (ch)) return; do_ranking (ch, "2"); return; } /* +----------------------------------------------------------------------+ */ /* | Ranking command, check for ranking data in ranking.dat and list the | */ /* | information by rank. | */ /* +----------------------------------------------------------------------+ */ void do_ranking (CHAR_DATA * ch, char *argy) { char buf[STD_LENGTH]; char subbuf[SML_LENGTH]; char endbuf[SML_LENGTH]; char argone[SML_LENGTH]; int ranking_type; int location = 0; DEFINE_COMMAND ("ranking", do_ranking, POSITION_SLEEPING, 0, LOG_NORMAL, "Shows the pkstat info.") if (IS_MOB (ch)) return; if (number_range(1,10) == 5) save_ranking(); check_ranking_data (ch); if (!str_cmp (argy, "reset") && LEVEL(ch) == MAX_LEVEL) { for (location = 0; location < MAX_RANKING_DATA; location++) { for (ranking_type = 0; ranking_type < RANKING_INFO; ranking_type++) { strcpy(ranking_data[location][ranking_type].name, "<free-slot>"); ranking_data[location][ranking_type].alignment = 0; ranking_data[location][ranking_type].value = 0.0; } } save_ranking (); send_to_char("Resetting Rankings.\n\r", ch); return; } argy = one_argy(argy, argone); /* +----------------------------------------------------------------------+ */ /* Display ranking menu is argone == null */ /* +----------------------------------------------------------------------+ */ if (argone == NULL || argone[0] == '\0' || argone == "") { sprintf(buf, "\n\r\x1b[0;33m+----------------------------------------------------------------------------+\n\r"); strcat (buf, "| \x1b[1;37mRANKINGS \x1b[0;33m|\n\r"); strcat (buf, "+----------------------------------------------------------------------------+\n\r"); strcat (buf, "\x1b[0;33m| |\n\r"); strcat (buf, "| \x1b[1;30m[\x1b[0m1\x1b[1;30m]\x1b[0m Strongest players \x1b[1;30m[\x1b[0m5\x1b[1;30m]\x1b[0m Best average group size to pkill \x1b[0;33m|\n\r"); strcat (buf, "| \x1b[1;30m[\x1b[0m2\x1b[1;30m]\x1b[0m Best player killers \x1b[1;30m[\x1b[0m6\x1b[1;30m]\x1b[0m Newbie killing player killers \x1b[0;33m|\n\r"); strcat (buf, "| \x1b[1;30m[\x1b[0m3\x1b[1;30m]\x1b[0m Players with the most pkills \x1b[1;30m[\x1b[0m7\x1b[1;30m]\x1b[0m Biggest average group size to pk \x1b[0;33m|\n\r"); strcat (buf, "| \x1b[1;30m[\x1b[0m4\x1b[1;30m]\x1b[0m Best average of victim level \x1b[1;30m[\x1b[0m8\x1b[1;30m]\x1b[0m Best average number of opponents \x1b[0;33m|\n\r"); if (LEVEL (ch) == MAX_LEVEL) { strcat (buf, "| \x1b[1;30m[\x1b[0m9\x1b[1;30m]\x1b[0m Total times pkilled \x1b[1;30m[\x1b[0m10\x1b[1;30m]\x1b[0m Most time spent online \x1b[0;33m|\n\r"); } strcat (buf, "| |\n\r"); strcat (buf, "+----------------------------------------------------------------------------+\x1b[0m\n\r"); send_to_char (buf, ch); return; } /* +----------------------------------------------------------------------+ */ /* If you feel like making these different for each of the choices below, */ /* then by all means do so. Just reset them within the places where the */ /* "i" is chosen. */ /* +----------------------------------------------------------------------+ */ if (is_number(argone) && (atoi(argone) > 0 && atoi(argone) <= RANKING_INFO)) { if (!str_cmp(argone, "1")) { ranking_type = 0; send_to_char("\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r",ch); send_to_char("\x1b[1;37m The strongest people on the mud:\n\r",ch); send_to_char("\x1b[1;31m------------------------------------------------------------------------------\n\r\n\r",ch); sprintf(endbuf, "\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r"); sprintf(buf, "\x1b[0;31mYour rating is: \x1b[0m%d\x1b[31m.\x1b[0m\n\r", rating(ch)); strcat (endbuf, buf); buf[0] = '\0'; } else if (!str_cmp(argone, "2")) { ranking_type = 1; send_to_char("\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r",ch); send_to_char("\x1b[1;37m The people with the most total warpoints:\n\r",ch); send_to_char("\x1b[1;31m------------------------------------------------------------------------------\n\r\n\r",ch); sprintf(endbuf, "\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r"); sprintf(buf, "\x1b[0;31mYour total number of warpoints is: \x1b[0m%ld\x1b[31m.\x1b[0m\n\r", ch->pcdata->warpoints); strcat (endbuf, buf); buf[0] = '\0'; } else if (!str_cmp(argone, "3")) { ranking_type = 2; send_to_char("\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r",ch); send_to_char("\x1b[1;37m The people with the highest number of pkill victims:\n\r",ch); send_to_char("\x1b[1;31m------------------------------------------------------------------------------\n\r\n\r",ch); sprintf(endbuf, "\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r"); sprintf(buf, "\x1b[0;31mYour total number of pkills victims is: \x1b[0m%d\x1b[31m.\x1b[0m\n\r", ch->pcdata->pkills); strcat (endbuf, buf); buf[0] = '\0'; } else if (!str_cmp(argone, "4")) { ranking_type = 3; send_to_char("\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r",ch); send_to_char("\x1b[1;37m Average level of pkill victims:\n\r",ch); send_to_char("\x1b[1;31m------------------------------------------------------------------------------\n\r\n\r",ch); sprintf(endbuf, "\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r"); sprintf(buf, "\x1b[0;31mThe average level of your pkill victims is: \x1b[0m%2.4f\x1b[31m.\x1b[0m\n\r", (float) ((float)ch->pcdata->pklevels)/((float) (UMAX(ch->pcdata->pkills, 1)))); strcat (endbuf, buf); buf[0] = '\0'; } else if (!str_cmp(argone, "5")) { ranking_type = 4; send_to_char("\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r",ch); send_to_char("\x1b[1;37m The people who have the smallest group size when they pkill:\n\r",ch); send_to_char("\x1b[1;31m------------------------------------------------------------------------------\n\r\n\r",ch); sprintf(endbuf, "\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r"); sprintf(buf, "\x1b[0;31mYour average groupsize when you pkill someone is: \x1b[0m%2.4f\x1b[31m.\x1b[0m\n\r", (float) ((float)ch->pcdata->pkhelpers)/((float) (UMAX(ch->pcdata->pkills, 1)))); strcat (endbuf, buf); buf[0] = '\0'; } else if (!str_cmp(argone, "6")) { ranking_type = 5; send_to_char("\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r",ch); send_to_char("\x1b[1;37m The people who pkill low level victims:\n\r",ch); send_to_char("\x1b[1;31m------------------------------------------------------------------------------\n\r\n\r",ch); sprintf(endbuf, "\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r"); sprintf(buf, "\x1b[0;31mYour average level of pkill victims is: \x1b[0m%2.4f\x1b[31m.\x1b[0m\n\r", (float) ((float)ch->pcdata->pklevels)/((float) (UMAX(ch->pcdata->pkills, 1)))); strcat (endbuf, buf); buf[0] = '\0'; } else if (!str_cmp(argone, "7")) { ranking_type = 6; send_to_char("\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r",ch); send_to_char("\x1b[1;37m The people who pkill in the bigest groups:\n\r",ch); send_to_char("\x1b[1;31m------------------------------------------------------------------------------\n\r\n\r",ch); sprintf(endbuf, "\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r"); sprintf(buf, "\x1b[0;31mYour average groupsize when you pkill someone is: \x1b[0m%2.4f\x1b[31m.\x1b[0m\n\r", (float) ((float)ch->pcdata->pkhelpers)/((float) (UMAX(ch->pcdata->pkills, 1)))); strcat (endbuf, buf); buf[0] = '\0'; } else if (!str_cmp(argone, "8")) { ranking_type = 7; send_to_char("\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r",ch); send_to_char("\x1b[1;37m The people who need the most opponents to kill them.\n\r",ch); send_to_char("\x1b[1;31m------------------------------------------------------------------------------\n\r\n\r",ch); sprintf(endbuf, "\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r"); sprintf(buf, "\x1b[0;31mYou require : \x1b[0m%2.4f\x1b[31m people to kill you on average.\x1b[0m\n\r", (float) ((float)ch->pcdata->pkers)/((float) (UMAX(ch->pcdata->pkilled, 1)))); strcat (endbuf, buf); buf[0] = '\0'; } else if (!str_cmp(argone, "9") && LEVEL(ch) == MAX_LEVEL) { ranking_type = 8; send_to_char("\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r",ch); send_to_char("\x1b[1;37m The people who have been pkilled the most.\n\r",ch); send_to_char("\x1b[1;31m------------------------------------------------------------------------------\n\r\n\r",ch); sprintf(endbuf, "\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r"); sprintf(buf, "\x1b[0;31mYour total number of times you have been pkilled is: \x1b[0m%d\x1b[31m.\x1b[0m\n\r", ch->pcdata->pkilled); strcat (endbuf, buf); buf[0] = '\0'; } else if (!str_cmp(argone, "10") && LEVEL(ch) == MAX_LEVEL) { ranking_type = 9; send_to_char("\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r",ch); send_to_char("\x1b[1;37m Most time on since beginning of the game.\n\r",ch); send_to_char("\x1b[1;31m------------------------------------------------------------------------------\n\r\n\r",ch); sprintf(endbuf, "\n\r\x1b[1;31m------------------------------------------------------------------------------\n\r"); sprintf(buf, "\x1b[0;31mYour amount of online time in hours on your character: \x1b[0m%ld\x1b[31m.\x1b[0m\n\r", ((ch->pcdata->played) + (((int) (current_time - ch->pcdata->logon)))) / 3600); strcat (endbuf, buf); buf[0] = '\0'; } else { send_to_char("Syntax: ranking <topic-number>.\n\r", ch); return; } } else { send_to_char("Syntax: ranking <topic-number>.\n\r", ch); return; } for (location = 0; location < MAX_RANKING_DATA; location++) { sprintf (subbuf, "\x1b[1;3%dm*\x1b[1;37m%-2d %-15s \x1b[0m%50d\x1b[0m\n\r", ranking_data[location][ranking_type].alignment, location + 1, ranking_data[location][ranking_type].name, (int) ranking_data[location][ranking_type].value); strcat (buf, subbuf); } strcat (buf, endbuf); send_to_char (buf, ch); return; } void do_trophy (CHAR_DATA * ch, char *argy) { bool foundy; char buffy[500]; int i; DEFINE_COMMAND ("trophy", do_trophy, POSITION_SLEEPING, 0, LOG_NORMAL, "Shows your mob or pkill trophy.") if (IS_MOB (ch)) return; foundy = FALSE; hugebuf_o[0] = '\0'; sprintf(hugebuf_o, "\x1B[1;34m[\x1B[30mTrophy of Kills\x1B[34m]\x1B[1;37m\n\r\n\r"); for (i = 0; i < MAX_TROPHY; i++) { if ((ch->pcdata->trophy_name[i] != '\0') && (ch->pcdata->trophy_level[i] >=1) && (ch->pcdata->trophy_times[i] >=1)) { foundy = TRUE; sprintf (buffy, "\x1b[0;31m[\x1b[1;36m*%2d\x1b[0;31m]\x1b[0;37m You have killed \x1b[1;36m%s\x1b[0;37m, the level %d %s %s who has %d remorts.\n\r", ch->pcdata->trophy_times[i], ch->pcdata->trophy_name[i], ch->pcdata->trophy_level[i], align_info[ch->pcdata->trophy_alignment[i]].name, race_info[ch->pcdata->trophy_race[i]].name, ch->pcdata->trophy_remorts[i]); strcat(hugebuf_o, buffy); } } if (!foundy) { strcat(hugebuf_o, "\n\rNone.\n\r"); } strcat(hugebuf_o, "\x1b[0;37m\n\r"); page_to_char(hugebuf_o, ch); return; } void check_add_trophy (CHAR_DATA * ch, CHAR_DATA * victim, int same_align, int diff_align) { int i, k; float warpoints_mult = 1.0; float level_mult = 1.0; float groupsize_mult = 1.0; float remorts_mult = 1.0; int temptimes = 0; float same = (float) same_align; float diff = (float) diff_align; if (IS_MOB (ch) || IS_MOB (victim)) return; /* JRAJRA */ ch->pcdata->online_spot->pk_since_locate++; level_mult = (float) (((float)LEVEL (victim)))/((float)(LEVEL (ch))); if (level_mult > 2) level_mult = 2; if (level_mult < .2) level_mult = .2; groupsize_mult = diff/same; if (groupsize_mult >= 1.5) groupsize_mult = 1.5; if (groupsize_mult < .05) groupsize_mult = .05; remorts_mult =(float)((float)(5+victim->pcdata->remort_times))/((float)(5+ch->pcdata->remort_times)); if (remorts_mult > 2) remorts_mult = 2; if (remorts_mult < .3) remorts_mult = .3; warpoints_mult = level_mult * groupsize_mult * remorts_mult; if (warpoints_mult < .03) warpoints_mult = .03; if (warpoints_mult > 1.5) warpoints_mult = 1.5; ch->pcdata->warpoints +=(int)((warpoints_mult*((float)LEVEL(victim)))); ch->pcdata->total_wps +=(int)((warpoints_mult*((float)LEVEL(victim)))); if (LEVEL (victim) > 59 && victim->pcdata->remort_times > 7) { ch->pcdata->total_wps += 1; ch->pcdata->warpoints += 1; } check_ranking_data (ch); check_ranking_data (victim); /* Remove the name from the list if it's already there. We do this by seeing if the name appears on the list, and if so, we remove the name by moving all the other data up. Then, the last slot is made "empty". */ for (i = 0; i < MAX_TROPHY; i++) { if (ch->pcdata->trophy_name[i][0] == '\0') break; if (!str_cmp (RNAME (victim), ch->pcdata->trophy_name[i])) { temptimes = ch->pcdata->trophy_times[i]; if (i < MAX_TROPHY -1) { for (k = i; k < (MAX_TROPHY - 1); k++) { strcpy(ch->pcdata->trophy_name[k], ch->pcdata->trophy_name[k+1]); ch->pcdata->trophy_times[k] = ch->pcdata->trophy_times[k+1]; ch->pcdata->trophy_level[k] = ch->pcdata->trophy_level[k+1]; ch->pcdata->trophy_remorts[k] = ch->pcdata->trophy_remorts[k+1]; ch->pcdata->trophy_alignment[k] = ch->pcdata->trophy_alignment[k+1]; ch->pcdata->trophy_race[k] = ch->pcdata->trophy_race[k+1]; } } ch->pcdata->trophy_name[MAX_TROPHY -1][0] = '\0'; ch->pcdata->trophy_times[MAX_TROPHY -1] = 0; ch->pcdata->trophy_level[MAX_TROPHY -1] = 0; ch->pcdata->trophy_alignment[MAX_TROPHY -1] = 0; ch->pcdata->trophy_remorts[MAX_TROPHY -1] = 0; ch->pcdata->trophy_race[MAX_TROPHY -1] = 0; break; } } temptimes++; /* Now we see where to add the new trophy. */ for (i = 0; i < MAX_TROPHY; i++) { /* If the slot we are looking that is either smaller than the victim's remorts or same remorts and lower level, */ if ((ch->pcdata->trophy_remorts[i] < victim->pcdata->remort_times) || (ch->pcdata->trophy_remorts[i] == victim->pcdata->remort_times && ch->pcdata->trophy_level[i] < LEVEL(victim))) { /* If the new slot is not the very very last one... */ if (i < MAX_TROPHY -1) { /* You move all the other trophies down the list to make room for the new one. */ for (k = MAX_TROPHY-1; k > i; k--) { strcpy(ch->pcdata->trophy_name[k], ch->pcdata->trophy_name[k-1]); ch->pcdata->trophy_times[k] = ch->pcdata->trophy_times[k-1]; ch->pcdata->trophy_level[k] = ch->pcdata->trophy_level[k-1]; ch->pcdata->trophy_remorts[k] = ch->pcdata->trophy_remorts[k-1]; ch->pcdata->trophy_alignment[k] = ch->pcdata->trophy_alignment[k-1]; ch->pcdata->trophy_race[k] = ch->pcdata->trophy_race[k-1]; } } /* Then you add the new trophy into the correct spot, saving the old number of times killed, if necessary. */ strcpy( ch->pcdata->trophy_name[i], RNAME(victim)); ch->pcdata->trophy_times[i] = temptimes; ch->pcdata->trophy_level[i] = LEVEL(victim); ch->pcdata->trophy_alignment[i] = victim->pcdata->alignment; ch->pcdata->trophy_remorts[i] = victim->pcdata->remort_times; ch->pcdata->trophy_race[i] = victim->pcdata->race; break; } } return; } void sort_trophy (CHAR_DATA *ch, char *argy) { int i,k; int templev; int tempnum; char tempname[20]; for (k = 0; k < (MAX_TROPHY - 1); k++) { if ((ch->pcdata->trophy_level[k] > 0) && (ch->pcdata->trophy_times[k] > 0) && (ch->pcdata->trophy_name[k][0] != '\0')) for (i = (k+1); i < MAX_TROPHY; i++) { if ((ch->pcdata->trophy_level[k]) < (ch->pcdata->trophy_level[i])) { templev = ch->pcdata->trophy_level[i]; ch->pcdata->trophy_level[i] = ch->pcdata->trophy_level[k]; ch->pcdata->trophy_level[k] = templev; tempnum = ch->pcdata->trophy_times[i]; ch->pcdata->trophy_times[i] = ch->pcdata->trophy_times[k]; ch->pcdata->trophy_times[k] = tempnum; strcpy(tempname, ch->pcdata->trophy_name[i]); strcpy(ch->pcdata->trophy_name[i], ch->pcdata->trophy_name[k]); strcpy(ch->pcdata->trophy_name[k], tempname); } } } return; }