Exemple #1
0
void invite_accept (CHAR_DATA *ch, char *argument)
{
	CLAN_DATA	*clan;
	char		buf [MAX_STRING_LENGTH];
	char		clan_name [MAX_STRING_LENGTH];

	if ( !ch->delay_who || !*ch->delay_who )
		return;

	ch->delay = 0;

	strcpy (clan_name, ch->delay_who);
	mem_free (ch->delay_who);
	ch->delay_who = NULL;

	if ( !is_he_here (ch, ch->delay_ch, 1) ) {
		send_to_char ("Too late.\n", ch);
		return;
	}

	add_clan (ch, clan_name, CLAN_MEMBER);

	act ("$N accepts your invitation.", FALSE, ch->delay_ch, 0, ch, TO_CHAR);

	clan = get_clandef (clan_name);

	snprintf (buf, MAX_STRING_LENGTH,  "You have been initiated into %s.",
				  clan ? clan->literal : clan_name);

	act (buf, FALSE, ch, 0, 0, TO_CHAR);
}
Exemple #2
0
static struct clan *get_clan(struct clan_array *array, struct player *player)
{
	unsigned i;
	struct clan clan = CLAN_ZERO;

	assert(array != NULL);
	assert(player != NULL);

	if (!strcmp(player->clan, "00"))
		return NULL;

	/* Search for clan, and if not found, add it */
	for (i = 0; i < array->length; i++)
		if (!strcmp(array->clans[i].name, player->clan))
			return &array->clans[i];

	strcpy(clan.name, player->clan);
	return add_clan(array, &clan);
}
Exemple #3
0
void do_clan (CHAR_DATA *ch, char *argument, int cmd)
{
	int					zone;
	int					leader_obj_vnum;
	int					member_obj_vnum;
	int					new_flags;
	int					clan_flags;
	int					num_clans = 0;
	int					i;
	NAME_SWITCH_DATA	*name_switch;
	NAME_SWITCH_DATA	*nsp;
	OBJ_DATA			*obj;
	CLAN_DATA			*clan;
	CLAN_DATA			*delete_clan;
	CHAR_DATA			*edit_mob = NULL;
	CHAR_DATA			*tch;
	char				*p;
	char				buf [MAX_STRING_LENGTH] = {'\0'};
	char				clan_name [MAX_STRING_LENGTH] = {'\0'};
	char				oldname [MAX_STRING_LENGTH] = {'\0'};
	char				newname [MAX_STRING_LENGTH] = {'\0'};
	char				literal [MAX_STRING_LENGTH] = {'\0'};
	char				name [MAX_STRING_LENGTH] = {'\0'};
	char				*the_clans [MAX_CLANS] = {'\0'};

	if ( IS_NPC (ch) ) {
		send_to_char ("Sorry, but you can't do this while switched...\n", ch);
		return;
	}

	if ( !*argument ) {

		send_to_char ("Old clan name   ->  New clan name\n", ch);
		send_to_char ("=============       =============\n", ch);

		if ( !clan_name_switch_list )
			send_to_char ("No clans set to be renamed.\n", ch);

		else {
			for ( nsp = clan_name_switch_list; nsp; nsp = nsp->next ) {
				snprintf (buf, MAX_STRING_LENGTH,  "%-15s     %-15s\n", nsp->old_name, nsp->new_name);
				send_to_char (buf, ch);
			}
		}

		send_to_char ("\nClan Name        Full Clan Name\n", ch);
		send_to_char ("===============  =================================\n",
					  ch);

		for ( clan = clan_list; clan; clan = clan->next ) {
			snprintf (buf, MAX_STRING_LENGTH,  "%-15s  %s\n", clan->name, clan->literal);
			send_to_char (buf, ch);

			if ( clan->zone ) {
				snprintf (buf, MAX_STRING_LENGTH,  "                 Enforcement Zone %d\n",
							  clan->zone);
				send_to_char (buf, ch);
			}

			if ( clan->member_vnum ) {
				obj = vtoo (clan->member_vnum);
				snprintf (buf, MAX_STRING_LENGTH,  "                 Member Object (%05d):  %s\n",
					clan->member_vnum,
					obj ? obj->short_description : "UNDEFINED");
				send_to_char (buf, ch);
			}

			if ( clan->leader_vnum ) {
				obj = vtoo (clan->leader_vnum);
				snprintf (buf, MAX_STRING_LENGTH,  "                 Leader Object (%05d):  %s\n",
					clan->leader_vnum,
					obj ? obj->short_description : "UNDEFINED");
				send_to_char (buf, ch);
			}
		}

		return;
	}

	argument = one_argument (argument, buf);

	if ( !*buf || *buf == '?' ) {
		send_to_char ("Syntax for modifying PCs:\n\n", ch);
		send_to_char ("   clan set <clan-name> [<clan-flags>]\n", ch);
		send_to_char ("   clan remove <clan-name>         (or all)\n", ch);
        send_to_char ("\nSyntax for modifying clan definitions:\n", ch);
		send_to_char ("   clan rename <oldclanname> <newclanname>\n", ch);
		send_to_char ("   clan unrename <oldclanname> <newclanname>\n", ch);
		send_to_char ("   clan register <name> <enforcement zone> <long name> "
					  "[<leader obj>] [<member obj>]\n", ch);
		send_to_char ("   clan unregister <name>\n", ch);
		send_to_char ("   clan list\n", ch);
		send_to_char ("\nThe obj vnums are optional.  Specify zone 0 if no "
					  "enforcement zone.\n\nExamples:\n", ch);
		send_to_char ("  > clan set tashalwatch member leader\n", ch);
		send_to_char ("  > clan remove tashalwatch\n", ch);
		send_to_char ("  > clan register TashalWatch 10 'Tashal Watch'\n", ch);
		send_to_char ("  > clan unregister tashalwatch\n", ch);
		send_to_char ("  > clan rename 10 TashalWatch\n", ch);
		send_to_char ("  > clan unrename 10 TashalWatch\n", ch);
		send_to_char ("  > clan list\n", ch);
		return;
	}

	if ( !str_cmp (buf, "list") ) {

		for ( tch = character_list; tch; tch = tch->next ) {

			if ( tch->deleted )
				continue;

			p = tch->clans;

			if ( !p || !*p )
				continue;

			while ( get_next_clan (&p, clan_name, &clan_flags) ) {

				if ( num_clans > MAX_CLANS )		/* Too many in list */
					break;

				for ( i = 0; i < num_clans; i++ )
					if ( !str_cmp (clan_name, the_clans [i]) )
						break;

				if ( i >= num_clans )
					the_clans [num_clans++] = str_dup (clan_name);
			}

		}

		*b_buf = '\0';

		for ( i = 0; i < num_clans; i++ ) {

			snprintf (b_buf + strlen(b_buf), MAX_STRING_LENGTH, "%-15s", the_clans [i]);

			if ( i % 5 == 4 )
				strcat (b_buf, "\n");
			else
				strcat (b_buf, " ");
		}

		page_string (ch->desc, b_buf);

		return;
	}

	if ( !str_cmp (buf, "set") ||
		 !str_cmp (buf, "remove") ||
		 !str_cmp (buf, "delete") ) {

		if ( (!ch->pc->edit_mob && !ch->pc->edit_player) ||
			(!(edit_mob = vtom (ch->pc->edit_mob)) &&
			!(edit_mob = ch->pc->edit_player)) ) {
			send_to_char ("Start by using the MOBILE command.\n", ch);
			return;
		}
	}

	if ( !str_cmp (buf, "set") ) {

		argument = one_argument (argument, clan_name);

		if ( !*clan_name ) {
			send_to_char ("Expected a clan name after 'add'.\n", ch);
			return;
		}

		new_flags = clan_flags_to_value (argument);

		if ( get_clan (edit_mob, clan_name, &clan_flags) )
			remove_clan (edit_mob, clan_name);

		clan_flags = 0;

		while ( 1 ) {

			argument = one_argument (argument, buf);

			if ( !*buf )
				break;

			if ( !str_cmp (buf, "member") )
				TOGGLE (clan_flags, CLAN_MEMBER)		/* {}'s define     */
			else if ( !str_cmp (buf, "leader") )        /* so no ; needed  */
				TOGGLE (clan_flags, CLAN_LEADER)
			else if ( !str_cmp (buf, "recruit") )
				TOGGLE (clan_flags, CLAN_RECRUIT)
			else if ( !str_cmp (buf, "private") )
				TOGGLE (clan_flags, CLAN_PRIVATE)
			else if ( !str_cmp (buf, "corporal") )
				TOGGLE (clan_flags, CLAN_CORPORAL)
			else if ( !str_cmp (buf, "sergeant") )
				TOGGLE (clan_flags, CLAN_SERGEANT)
			else if ( !str_cmp (buf, "lieutenant") )
				TOGGLE (clan_flags, CLAN_LIEUTENANT)
			else if ( !str_cmp (buf, "captain") )
				TOGGLE (clan_flags, CLAN_CAPTAIN)
			else if ( !str_cmp (buf, "general") )
				TOGGLE (clan_flags, CLAN_GENERAL)
			else if ( !str_cmp (buf, "commander") )
				TOGGLE (clan_flags, CLAN_COMMANDER)
			else if ( !str_cmp (buf, "apprentice") )
				TOGGLE (clan_flags, CLAN_APPRENTICE)
			else if ( !str_cmp (buf, "journeyman") )
				TOGGLE (clan_flags, CLAN_JOURNEYMAN)
			else if ( !str_cmp (buf, "master") )
				TOGGLE (clan_flags, CLAN_MASTER)
			else {
				snprintf (literal, MAX_STRING_LENGTH, "Flag %s is unknown for clans.\n", buf);
				send_to_char (literal, ch);
			}
		}
	
		if ( !clan_flags )
			clan_flags = CLAN_MEMBER;

		add_clan (edit_mob, clan_name, clan_flags);

		if ( edit_mob->mob ) {
			snprintf (buf, MAX_STRING_LENGTH,  "%d mobile(s) in world redefined.\n",
						  redefine_mobiles (edit_mob));
			send_to_char (buf, ch);
		}

		return;		/* Return from n/pc specific uses of clan */
	}
Exemple #4
0
void do_promote (CHAR_DATA *ch, char *argument, int cmd)
{
	int			clan_flags = 0;
	CHAR_DATA	*tch = NULL;
	CLAN_DATA	*clan = NULL;
	char		buf [MAX_STRING_LENGTH] = {'\0'};
	char		clan_name [MAX_STRING_LENGTH] = {'\0'};
	int			flags = 0;
	char		*temp_arg = NULL;

	argument = one_argument (argument, buf);

	if ( !*buf ) {
		send_to_char ("Promote whom?\n\r", ch);
		return;
	}

	if ( !(tch = get_char_room_vis (ch, buf)) ) {
		send_to_char ("Nobody is here by that name.\n", ch);
		return;
	}

	if ( tch == ch ) {
		send_to_char ("Sorry - unfortunately, promotions just don't work that way...\n", ch);
		return;
	}

	argument = one_argument (argument, clan_name);

	if ( !*clan_name ) {
		send_to_char ("Which clan did you wish to make the promotion in?\n", ch);
		return;
	}

	if ( !get_clan_long_short (ch, clan_name, &clan_flags) ) {
		send_to_char ("You are not a member of such a clan.\n", ch);
		return;
	}

	if ( !IS_SET (clan_flags, CLAN_LEADER) && (clan_flags < CLAN_SERGEANT || clan_flags > CLAN_COMMANDER) && !IS_SET (clan_flags, CLAN_MASTER) ) {
		send_to_char ("You are not a leader of that clan.\n", ch);
		return;
	}

		/* Keep clan_name as the short name */

	if ( (clan = get_clandef_long (clan_name)) )
		strcpy (clan_name, clan->name);

	argument = one_argument (argument, buf);

	if ( !(flags = clan_flags_to_value (buf)) ) {
		send_to_char ("I don't recognize the specified rank.\n", ch);
		return;
	}

	if ( clan_flags >= CLAN_SERGEANT && clan_flags <= CLAN_COMMANDER && (flags < CLAN_RECRUIT || flags > CLAN_COMMANDER) ) {
		send_to_char ("You'll need to specify a military rank, e.g. Recruit, Private, etc.\n", ch);
		return;
	}
	
	else if ( clan_flags >= CLAN_APPRENTICE && clan_flags <= CLAN_MASTER && (flags < CLAN_APPRENTICE || flags > CLAN_MASTER) ) {
		send_to_char ("You'll need to specify a guild rank, e.g. Apprentice, Journeyman, etc.\n", ch);
		return;
	}

	if ( flags >= clan_flags ) {
		send_to_char ("You do not have the authority to make this promotion.\n", ch);
		return;
	}

	temp_arg = get_clan_rank_name(flags);
	snprintf (buf, MAX_STRING_LENGTH,  "You promote $N to the rank of %s.", temp_arg);
	act (buf, FALSE, ch, 0, tch, TO_CHAR | TO_ACT_FORMAT);
	
	temp_arg = get_clan_rank_name(flags);
	snprintf (buf, MAX_STRING_LENGTH,  "$n has promoted you to the rank of %s.", temp_arg);
	
	act (buf, FALSE, ch, 0, tch, TO_VICT | TO_ACT_FORMAT);
	act ("$n has promoted $N.", FALSE, ch, 0, tch, TO_NOTVICT | TO_ACT_FORMAT);

	add_clan (tch, clan_name, flags);
	
	return;
}