79 newparty->
passwd[0] =
'\0';
80 newparty->
next = NULL;
83 "You have formed party: %s",
84 "You have formed party: %s",
89 lastparty->
next = newparty;
90 lastparty = lastparty->
next;
92 firstparty = newparty;
112 if (firstparty == NULL) {
113 LOG(
llevError,
"remove_party(): I was asked to remove party %s, but no parties are defined\n",
118 if (pl->
party == target_party)
122 if (target_party == firstparty) {
123 if (lastparty == target_party)
125 firstparty = firstparty->
next;
132 }
else if (target_party == lastparty) {
133 for (tmpparty = firstparty; tmpparty->
next != NULL; tmpparty = tmpparty->
next) {
134 if (tmpparty->
next == target_party) {
135 lastparty = tmpparty;
141 lastparty->
next = NULL;
146 for (tmpparty = firstparty; tmpparty->
next != NULL; tmpparty = tmpparty->
next)
147 if (tmpparty->
next == target_party) {
148 previousparty = tmpparty;
152 previousparty->
next = nextparty;
173 for (party = firstparty; party != NULL; party = next) {
177 if (pl->
party == party)
179 if (player_count == 0)
184 #ifdef PARTY_KILL_LOG
197 void add_kill_to_party(
partylist *party,
const char *killer,
const char *dead,
long exp) {
202 if (party->
kills >= PARTY_KILL_LOG) {
203 pos = PARTY_KILL_LOG-1;
204 for (i = 0; i < PARTY_KILL_LOG-1; i++)
205 memcpy(&(party->party_kills[i]), &(party->party_kills[i+1]),
sizeof(party->party_kills[0]));
210 party->party_kills[pos].exp = exp;
211 strncpy(party->party_kills[pos].killer, killer,
MAX_NAME);
212 strncpy(party->party_kills[pos].dead, dead,
MAX_NAME);
213 party->party_kills[pos].killer[
MAX_NAME] = 0;
214 party->party_kills[pos].dead[
MAX_NAME] = 0;
231 for (tmppartylist = firstparty; tmppartylist != NULL; tmppartylist = tmppartylist->
next) {
261 "You have joined party: %s\n",
262 "You have joined party: %s\n",
270 "You entered the wrong password", NULL);
311 strcpy(party_params,
"say ");
312 strcat(party_params, params);
325 "To form a party type: party form <partyname>. "
326 "To join a party type: party join <partyname> "
327 "If the party has a passwd, it will you prompt you for it. "
328 "For a list of current parties type: party list. "
329 "To leave a party type: party leave "
330 "To change a passwd for a party type: party passwd <password> "
331 "There is an 8 character maximum password length. "
332 "To talk to party members type: party say <msg> "
333 "To see who is in your party: party who "
334 #ifdef PARTY_KILL_LOG
335 "To see what you've killed, type: party kills"
355 if (params == NULL) {
358 "You are not a member of any party. "
359 "For help try: party help", NULL);
363 "You are a member of party %s.",
364 "You are a member of party %s.",
369 if (strcmp(params,
"help") == 0) {
373 #ifdef PARTY_KILL_LOG
374 if (!strncmp(params,
"kills", 5)) {
382 "You are not a member of any party.", NULL);
386 if (!tmpparty->
kills) {
388 "You haven't killed anything yet.", NULL);
391 max = tmpparty->
kills-1;
392 if (max > PARTY_KILL_LOG-1)
393 max = PARTY_KILL_LOG-1;
395 "[fixed]Killed | Killer| Exp\n----------------+----------------+--------"
396 "Killed | Killer| Exp\n----------------+----------------+--------",
400 for (i = 0; i <= max; i++) {
401 exp = tmpparty->party_kills[i].exp;
406 }
else if (exp > 1000) {
412 "[fixed]%16s|%16s|%6.1f%c",
414 tmpparty->party_kills[i].dead,
415 tmpparty->party_kills[i].killer, exp, chr);
423 }
else if (exp > 1000) {
429 "[fixed]----------------+----------------+--------",
430 "----------------+----------------+--------");
432 "Totals: %d kills, %.1f%c exp", tmpparty->
kills,
433 "Totals: %d kills, %.1f%c exp", tmpparty->
kills,
438 if (strncmp(params,
"say ", 4) == 0) {
441 "You are not a member of any party.", NULL);
451 currentparty, params);
455 if (strncmp(params,
"form ", 5) == 0) {
466 for (tmpparty = firstparty; tmpparty != NULL; tmpparty = tmpparty->
next) {
467 if (!strcmp(tmpparty->
partyname, params)) {
469 "The party %s already exists, pick another name",
470 "The party %s already exists, pick another name",
486 if (pl->
party == oldparty)
489 if (player_count == 0)
495 if (strcmp(params,
"leave") == 0) {
498 "You are not a member of any party.", NULL);
503 "You leave party %s.",
504 "You leave party %s.",
506 snprintf(buf,
sizeof(buf),
"%s leaves party %s.", op->
name, currentparty);
511 if (strcmp(params,
"who") == 0) {
514 "You are not a member of any party.", NULL);
521 if (strncmp(params,
"passwd ", 7) == 0) {
528 "You are not a member of a party", NULL);
532 if (strlen(params) > 8) {
534 "The password must not exceed 8 characters", NULL);
539 while (tmplist != NULL) {
541 strcpy(tmplist->
passwd, params);
544 "The password for party %s is %s",
545 "The password for party %s is %s",
548 snprintf(buf,
MAX_BUF,
"Password for party %s is now %s, changed by %s",
553 tmplist = tmplist->
next;
558 if (strcmp(params,
"list") == 0) {
563 if (firstparty == NULL) {
565 "There are no parties active right now", NULL);
570 "[fixed]Party name Leader\n---------- ------",
571 "Party name Leader\n---------- ------");
573 while (tmplist != NULL) {
578 tmplist = tmplist->
next;
583 if (strncmp(params,
"join ", 5) == 0) {
587 if (firstparty == NULL) {
589 "Party: %s does not exist. You must form it first",
590 "Party: %s does not exist. You must form it first",
596 if (firstparty->
next == NULL) {
597 if (strcmp(firstparty->
partyname, params) != 0) {
599 "Party: %s does not exist. You must form it first",
600 "Party: %s does not exist. You must form it first",
606 "You are already in party: %s",
607 "You are already in party: %s",
612 if (firstparty->
passwd[0] ==
'\0') {
615 "You have joined party: %s",
616 "You have joined party: %s",
629 while (tmpparty != NULL) {
630 if (strcmp(tmpparty->
partyname, params) == 0) {
633 "You are already a member of party: %s",
634 "You are already a member of party: %s",
638 if (tmpparty->
passwd[0] ==
'\0') {
644 "You have joined party: %s",
645 "You have joined party: %s",
657 tmpparty = tmpparty->
next;
661 "Party %s does not exist. You must form it first.",
662 "Party %s does not exist. You must form it first.",
696 for (mode = 0; rejoin_modes[mode] != NULL; mode++) {
697 if (strcmp(rejoin_modes[mode], params) == 0) {
704 if (strlen(params) > 50)
707 "invalid mode: %s", NULL, params);
#define MSG_TYPE_COMMUNICATION_PARTY
void receive_party_password(object *op)
#define MSG_TYPE_COMMAND_SUCCESS
#define MSG_TYPE_COMMAND_HELP
static const char * rejoin_modes[]
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
void remove_party(partylist *target_party)
void get_party_password(object *op, partylist *party)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
void obsolete_parties(void)
static void party_help(object *op)
struct party_struct * next
int command_party_rejoin(object *op, char *params)
partylist * form_party(object *op, const char *params)
char * strdup_local(const char *str)
party_rejoin_mode rejoin_party
void replace_unprintable_chars(char *buf)
int snprintf(char *dest, int max, const char *format,...)
int confirm_party_password(object *op)
#define MSG_TYPE_COMMUNICATION
static partylist * lastparty
int command_party(object *op, char *params)
void list_players(object *op, region *reg, partylist *party)
partylist * get_firstparty(void)
EXTERN player * first_player
void LOG(LogLevel logLevel, const char *format,...)
void send_party_message(object *op, char *msg)
partylist * party_to_join
int command_gsay(object *op, char *params)
#define MSG_TYPE_COMMAND_ERROR
static partylist * firstparty