void show_channels(struct char_data *ch)
{
    send_to_char("CHANNEL        STATUS\n\r", ch);
    send_to_char("```&---------------------``\n\r", ch);

    send_to_char("\n\r", ch);
    if (character_has_comm(ch, COMM_AFK))
	send_to_char("You are ```!A```@F```OK``.\n\r", ch);

    if (character_has_comm(ch, COMM_BUSY))
	send_to_char("You are Busy.\n\r", ch);

    if (character_has_comm(ch, COMM_CODING))
	send_to_char("You are `@Coding``.\n\r", ch);

    if (character_has_comm(ch, COMM_BUILD))
	send_to_char("You are `3Building``.\n\r", ch);

    if (ch->lines != PAGELEN) {
	if (ch->lines > 0)
	    printf_to_char(ch, "You display %d lines of scroll.\n\r", ch->lines + 2);
	else
	    send_to_char("Scroll buffering is off.\n\r", ch);
    }

    if (ch->prompt != NULL)
	printf_to_char(ch, "Your current prompt is: %s\n\r", ch->prompt);

    return;
}
Beispiel #2
0
void do_done(CHAR_DATA * ch, char * thedir)
{
CHAR_DATA *rch;
if(!ch->infight)
{
printf_to_char(ch,"You're not in a fight.");
return;
}

if(!TURN(ch))
{
printf_to_char(ch,"It's not your turn.");
return;
}
   
    check_winner(ch->in_room);
    
    for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
    {  
         printf_to_char(rch,"%s ends %s turn.\n",fcn(ch), ch->sex ? "his" : "her");
         do_map(rch,"forced");
         rch->AT++;
    }
       ch->AT = 0;

advance_turn(ch); 
}
Beispiel #3
0
void join_org(CHAR_DATA *ch, ORGANIZATION *pRlg )
{	if(IS_NPC(ch) )
		return;
	if(ch->pcdata->organization )
	{	printf_to_char(ch, "You must denounce your organization to %s first.\n\r",ch->pcdata->organization->name );
		return;
	}
	
	ch->pcdata->organization = pRlg;
	printf_to_char(ch, "You now find solace in %s.\n\r", pRlg->name );
	ch->pcdata->rank = 0;
}
Beispiel #4
0
void check_winner(ROOM_INDEX_DATA *ro)
{
bool found=FALSE;
int redct = 0;
int bluect = 0;
int greenct = 0;
int nonect = 0;
int total = 0;
CHAR_DATA *rch;

    for (rch = ro->people; rch != NULL; rch = rch->next_in_room)
    {
    if(rch == NULL)
    continue;

    if(rch->infight)
    {
if(TURN(rch))
found=TRUE;    
    total++;
    if(rch->team == TEAM_BLUE) 
    bluect++;
    else if(rch->team == TEAM_RED) 
    redct++;
    else if(rch->team == TEAM_GREEN) 
    greenct++;
    else if(rch->team == TEAM_NONE) 
    nonect++;
    }
    }

if(total == 1
|| bluect == total || greenct == total || redct == total)
{
    for (rch = ro->people; rch != NULL; rch = rch->next_in_room)
    {
    if(rch->infight)
    {
    printf_to_char(rch,"\n\r{Y* * * B A T T L E  C O M P L E T E * * *\n\r{x");
    printf_to_char(rch,"{B      Uh, you won... and stuff.         \n\r{x");
    rch->infight = FALSE;
    rch->mposy = 0;
    rch->team = 0;
    rch->in_room->turn=NULL;
    rch->mposx = 0;
    }
    }
}
}   
Beispiel #5
0
void channels_show(struct char_data *sender)
{
    int i;
    bool enabled;
    bool denied;
    unsigned long flag;


    printf_to_char(sender, "%-14s%-7s\n\r", "CHANNEL", "STATUS");
    send_to_char("```&---------------------``\n\r", sender);

    for (i = 0; (flag = channels[i].flag) != 0; i++) {
	denied = (IS_SET(sender->channels_denied, flag));
	enabled = (IS_SET(sender->channels_enabled, flag));
	printf_to_char(sender, "%-14s%-7s\n\r", channels[i].name, denied ? "--" : (enabled ? "`#ON" : "`1OFF"));
    }
}
Beispiel #6
0
void advance_turn(CHAR_DATA * ch)
{
CHAR_DATA *rch;
int q=0;

for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
    {
if(rch->infight)
q++;    
}
if(q<1);
return;

    check_winner(ch->in_room);

q = 0;
    for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
    {  
    if(rch == NULL || !rch->infight)
    continue;
    do_map(rch,"forced");
    }

ch->in_room->next = NULL;
while(ch->in_room->next == NULL)
{
    for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
    {
    if(rch == NULL || !rch->infight)
    continue;
    
    if(rch->ATToCast < rch->AT)
    {
    say_spell (rch, rch->SnToCast);
    tile_spell(rch, rch->SnToCast);
    rch->ATToCast = 0;
    rch->SnToCast = 0;
    rch->casting = FALSE;
    rch->CastTargY = 0;
    rch->CastTargX = 0;   
    }

    rch->AT += rch->speed;
    if(rch->AT >= 100)
    {
    rch->AT = 100;
    ch->in_room->turn = rch;
    break;
    }
    }
}

    ch->in_room->turn->MoveLeft = ch->in_room->turn->base_move;
    ch->in_room->turn->AttackLeft = 1;

    printf_to_char(rch,"%s's turn.\n",fcn(ch->in_room->turn));

}
Beispiel #7
0
void do_fdisp (CHAR_DATA * ch, char *argument)
{
    if (colorstrlen (argument) > 1)
    return;
if(strlen(argument) == 0)
return;

    strcpy(ch->fdisp,argument);     
    printf_to_char(ch,"You will be seen as : [ %s ]",ch->fdisp);
}
Beispiel #8
0
void channels_toggle(struct char_data *sender, const CHANNEL_DEFINITION const *channel)
{
    bool now_on;

    if (CHAN_DENIED(sender, channel->flag)) {
	printf_to_char(sender, "You may not access the %s channel.", channel->name);
	return;
    }

    if (CHAN_ENABLED(sender, channel->flag)) {
	now_on = false;
	DISABLE_CHAN(sender, channel->flag);
    } else {
	now_on = true;
	ENABLE_CHAN(sender, channel->flag);
    }

    printf_to_char(sender, "%s is now %s.\n\r", channel->name, now_on ? "ON" : "OFF");
}
Beispiel #9
0
void do_initiate(CHAR_DATA *ch, char *argument )
{	char arg[MSL], arg2[MSL], arg3[MSL];
	CHAR_DATA *victim;

	if(IS_NPC(ch ) )
		return;

	argument = one_argument(argument, arg  );
	argument = one_argument(argument, arg2 );
	argument = one_argument(argument, arg3 );
	if(!HAS_ORGANIZATION(ch) )
	{	send_to_char("But you aren't organized!\n\r",ch);
		return;
	}
	if(ch->pcdata->rank < RANK_PRIEST )
	{	send_to_char("You can't initiate people!\n\r",ch);
		return;
	}

	if(arg[0] == '\0' )
	{	send_to_char("Syntax: Initiate <person>\n\r",ch);
		return;
	}

	if(ch->pcdata->rank < RANK_PRIEST )
	{	send_to_char("You can't initiate people!\n\r",ch);
		return;
	}

	if(!IS_IMMORTAL(ch) )
	{	if( ( victim = get_char_room(ch, NULL, arg ) ) == NULL )
		{	send_to_char("They aren't here.\n\r",ch);
			return;
		}
	}
	else
	{	if( ( victim = get_char_world(ch, arg ) ) == NULL )
		{	send_to_char("They aren't here.\n\r", ch);
			return;
		}
	}
	if(IS_NPC(victim) )
	{	send_to_char("Not on NPC's.\n\r",ch);
		return;
	}
	if(arg2[0] == '\0' )
	{	if( HAS_ORGANIZATION(victim) )
		{	send_to_char("They are already in an organization!\n\r",ch);
			return;
		}
		printf_to_char(ch, "They have been initiated.\n\r" );
		join_org(victim, ch->pcdata->organization );
	}
	return;
}
Beispiel #10
0
void denounce_org(CHAR_DATA *ch, bool force )
{
//	int rank, sn;
	if(IS_NPC(ch) )
		return;

	if(!ch->pcdata->organization )
	{	send_to_char("You cannot denounce your organization when you do not have one!\n\r",ch);
		return;
	}

	if(!force)
		printf_to_char(ch, "You denounce %s as your organization.\n\r", ch->pcdata->organization->name );
	else
		printf_to_char(ch, "You have been expunged!\n\r" );

	ch->pcdata->organization = NULL;
	ch->pcdata->rank = 0;
	return;
}
Beispiel #11
0
void announce_move(CHAR_DATA * ch, char * thedir)
{
CHAR_DATA *rch;

ch->MoveLeft--;
   
     for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
    {   
         printf_to_char(rch,"%s moves %s.{x\n",fcn(ch),thedir);
//	 do_map(rch,"forced");
    }
}
Beispiel #12
0
void channels_permission(struct char_data *grantor, struct char_data *grantee, bool granted, const CHANNEL_DEFINITION const *channel)
{
    static char buf[MAX_INPUT_LENGTH];

    DENY_NPC(grantor);

    if (IS_NPC(grantee)) {
	send_to_char("Not on NPC's.\n\r", grantor);
	return;
    }

    if (get_trust(grantee) >= get_trust(grantor)) {
	send_to_char("You failed.\n\r", grantor);
	return;
    }


    if (granted) {
	if (!CHAN_DENIED(grantee, channel->flag)) {
	    printf_to_char(grantor, "%s is already granted channel %s.\n\r", capitalize(grantee->name), channel->name);
	    return;
	}
	GRANT_CHAN(grantee, channel->flag);
    } else {
	if (CHAN_DENIED(grantee, channel->flag)) {
	    printf_to_char(grantor, "%s is already denied channel %s.\n\r", capitalize(grantee->name), channel->name);
	    return;
	}
	DENY_CHAN(grantee, channel->flag);
    }

    printf_to_char(grantee, "You have been %s access to channel %s.\n\r", granted ? "granted": "denied", channel->name);
    printf_to_char(grantor, "Channel access %s to %s.", granted ? "granted": "denied", capitalize(grantee->name));
    (void)snprintf(buf, MAX_INPUT_LENGTH, "$N %s %s to %s.", granted ? "grants" : "denies", channel->name, grantee->name);
    wiznet(buf, grantor, NULL, WIZ_PENALTIES, WIZ_SECURE, 0);
}
void look_room(struct char_data *ch, struct room_index_data *in_room) {
    if (!validate_look(ch)) {
	return;
    }

    if (in_room == NULL) {
	send_to_char("NOWHERE.", ch);
	return;
    }

    if (room_is_dark(ch, in_room) && !IS_SET(ch->act, PLR_HOLYLIGHT)) {
	send_to_char("It is pitch ```8black...`` \n\r", ch);
	show_char_to_char(in_room->people, ch);
	return;
    }


    send_to_char(in_room->name, ch);
    if ((IS_IMMORTAL(ch) && (IS_NPC(ch) || IS_SET(ch->act, PLR_HOLYLIGHT))) || IS_BUILDER(ch, in_room->area)) {
	printf_to_char(ch, " [`1Room `!%d``]", in_room->vnum);
    }

    send_to_char("\n\r", ch);
    if ((!IS_NPC(ch) && !IS_SET(ch->comm, COMM_BRIEF))) {
	send_to_char("  ", ch);
	send_to_char(in_room->description, ch);
    }

    send_to_char("\n\r", ch);

    if ((is_affected(ch, gsp_detect_magic) || IS_SET(ch->act, PLR_HOLYLIGHT))) {
	struct affect_data *paf;
	for (paf = in_room->affected; paf != NULL; paf = paf->next) {
	    send_to_char(room_affect(paf), ch);
	}
	send_to_char("\n\r", ch);
    }

    if (!IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOEXIT))
	do_exits(ch, "auto");

    if (is_affected_room(in_room, gsp_faerie_fog))
	send_to_char("There is a `Ppurple haze`` floating throughout the room.\n\r", ch);

    show_list_to_char(in_room->contents, ch, false, false);
    show_char_to_char(in_room->people, ch);
    return;
}
void look_object(struct char_data *ch, struct gameobject *obj, const char *argument) {
    struct gameobject *portal;
    struct room_index_data *location;

    if (!validate_look(ch)) {
	return;
    }

    switch (obj->item_type) {
	default:
	    send_to_char("That is not a container.\n\r", ch);
	    break;

	case ITEM_DRINK_CON:
	    if (obj->value[1] == 0) {
		send_to_char("It is empty.\n\r", ch);
	    } else {
		printf_to_char(ch, "It's %sfilled with  a %s liquid.\n\r",
			obj->value[1] < obj->value[0] / 4
			? "less than half-" :
			obj->value[1] < 3 * obj->value[0] / 4
			? "about half-" : "more than half-",
			liq_table[obj->value[2]].liq_color);
	    }
	    break;

	case ITEM_CONTAINER:
	case ITEM_CORPSE_NPC:
	case ITEM_CORPSE_PC:
	    if (IS_SET(obj->value[1], CONT_CLOSED)) {
		send_to_char("It is closed.\n\r", ch);
	    } else {
		act("$p holds```8:``", ch, obj, NULL, TO_CHAR);
		show_list_to_char(obj->contains, ch, true, true);
	    }
	    break;
	case ITEM_PORTAL:
	    portal = get_obj_list(ch, argument, ch->in_room->contents);
	    if (portal != NULL) {
		location = get_room_index(portal->value[3]);
		if (location == NULL) {
		    send_to_char("It looks very empty..\n\r", ch);
		} else {
		    send_to_char(location->name, ch);
		    send_to_char("\n\r", ch);
		    if (!IS_SET(location->room_flags, ROOM_INDOORS))
			print_weather(ch);
		    else
			send_to_char("You can not discern weather conditions beyond this portal.\n\r", ch);
		    if (!IS_NPC(ch) && !IS_SET(ch->comm, COMM_BRIEF)) {
			send_to_char(location->description, ch);
		    }
		    send_to_char("\n\r", ch);

		    if (!IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOEXIT)) {
			char showexit[100];

			sprintf(showexit, "%ld exits auto", location->vnum);
			do_at(ch, showexit);
		    }

		    show_list_to_char(location->contents, ch, false, false);
		    show_char_to_char(location->people, ch);
		}
	    }
	    break;
    }
}
void look_extras(struct char_data *ch, const char *name, const int number) {
    struct gameobject *obj;
    int count;
    char *pdesc;

    if (!validate_look(ch)) {
	return;
    }

    count = 0;
    for (obj = ch->carrying; obj != NULL; obj = obj->next_content) {
	if (can_see_obj(ch, obj)) {
	    /* player can see object */

	    pdesc = get_extra_descr(name, obj->extra_descr);
	    if (pdesc != NULL) {
		if (++count == number) {
		    send_to_char(pdesc, ch);
		    return;
		} else {
		    continue;
		}
	    }

	    pdesc = get_extra_descr(name, obj->objprototype->extra_descr);
	    if (pdesc != NULL) {
		if (++count == number) {
		    send_to_char(pdesc, ch);
		    return;
		} else {
		    continue;
		}
	    }
	    if (is_name(name, object_name_get(obj))) {
		if (++count == number) {
		    send_to_char(obj->description, ch);
		    send_to_char("\n\r", ch);
		    return;
		}
	    }
	}
    }

    for (obj = ch->in_room->contents; obj != NULL; obj = obj->next_content) {
	if (can_see_obj(ch, obj)) {
	    pdesc = get_extra_descr(name, obj->extra_descr);
	    if (pdesc != NULL) {
		if (++count == number) {
		    send_to_char(pdesc, ch);
		    return;
		}
	    }

	    pdesc = get_extra_descr(name, obj->objprototype->extra_descr);
	    if (pdesc != NULL) {
		if (++count == number) {
		    send_to_char(pdesc, ch);
		    return;
		}
	    }
	}

	if (is_name(name, object_name_get(obj))) {
	    if (++count == number) {
		send_to_char(obj->description, ch);
		send_to_char("\n\r", ch);
		return;
	    }
	}
    }

    pdesc = get_extra_descr(name, ch->in_room->extra_descr);
    if (pdesc != NULL) {
	if (++count == number) {
	    send_to_char(pdesc, ch);
	    return;
	}
    }

    if (count == 0) {
	send_to_char("You don't see that here.", ch);
	return;
    }

    if (count > 0 && count != number) {
	if (count == 1)
	    printf_to_char(ch, "You only see one %s here.\n\r", name);
	else
	    printf_to_char(ch, "You only see %d of those here.\n\r", count);

	return;
    }

}
Beispiel #16
0
void command_channel(struct char_data *ch, const char *argument) {
    static char arg1[MAX_INPUT_LENGTH];
    static char arg2[MAX_INPUT_LENGTH];
    const CHANNEL_DEFINITION const *channel;

    if (argument[0] == '\0') {
        channels_show(ch);
        return;
    }


    switch (argument[0]) {
        case '~': /* toggly-woggly */
        case '-': /* deny */
        case '+': /* grant */
        {
            /** EX1: channel ~ say */
            /** EX2: channel ~say */
            /** EX3: channel -say foobar */
            
            char operation = argument[0];
            const char *chanName;
            struct char_data *victim;

            if (argument[1] != '\0') {
                /** EX2, chanName = "say" */
                chanName = argument+1;
            } else {
                /** EX1, chanName = arg1 = "say", argument = "\0" */
                argument = one_argument(argument, arg1);
                if (arg1[0] == '\0') {
                    send_to_char("Please specify a channel.", ch);
                    return;
                }
                chanName = arg1;
            }

            channel = channels_parse(chanName);
            if (channel == NULL) {
                printf_to_char(ch, "There is no such channel: %s.", chanName);
                return;
            }

            switch (operation) {
            case '~':
                channels_toggle(ch, channel);
                break;
            case '-':
            case '+':
                (void)one_argument(argument, arg2);
                if (arg2[0] == '\0') {
                    send_to_char("Please specify a grantee.", ch);
                    return;
                }
                if ((victim = get_char_world(ch, arg2)) == NULL) {
                    printf_to_char(ch, "There is no such grantee: %s.", arg2);
                    return;
                }
                channels_permission(ch, victim, operation == '+', channel);
                break;
            }
            return;
        }
        default:
        {
            struct char_data *target = NULL;

            if (argument[0] == '\0') {
                /** TODO - automatic "current channel" */
                send_to_char("Please specify a channel.", ch);
                return;
            }

            argument = one_argument(argument, arg1);
            channel = channels_parse(arg1);
            if (channel == NULL) {
                printf_to_char(ch, "There is no such channel: %s.", arg1);
                return;
            }

            switch (channel->target_requirement) {
                case CHANNEL_TARGET_NONE:
                    break;
                case CHANNEL_TARGET_OPTIONAL:
                {
                    if (argument[0] == '-') {
                        argument = one_argument(argument, arg2);
                        if ((target = get_char_world(ch, arg2+1)) == NULL) {
                            printf_to_char(ch, "There is no such character: %s.", arg2);
                            return;
                        }
                    }
                    break;
                }
                case CHANNEL_TARGET_REQUIRED:
                {
                    if (argument[0] == '-') {
                        argument = one_argument(argument, arg2);
                        if ((target = get_char_world(ch, arg2+1)) == NULL) {
                            printf_to_char(ch, "There is no such character: %s.", arg2);
                            return;
                        }
                    } else {
                        printf_to_char(ch, "You must specify a receiver for channel: %s.", channel->name);
                        return;
                    }
                    break;
                }
            }

            broadcast_channel(ch, channel, target, argument);
            break;
        }
    }
}
Beispiel #17
0
void log_string( int type, const char *fmt, ... )
{
   DESCRIPTOR_DATA *d;
   va_list args;
   char *strtime;
   char buf[45];
   char bufew[2 * MSL];
   char bufee[2 * MSL];
   FILE *log_file;
   buf[0] = '\0';

   log_file = NULL;

   // Get the wanted text
   va_start( args, fmt );
   vsprintf( bufew, fmt, args );
   va_end( args );

   if( type & LOG_CRIT )
   {
      xprintf( buf, "../log/%s.critical", get_curdate(  ) );
      log_file = fopen( buf, "a" );
      strtime = ctime( &current_time );
      strtime[strlen( strtime ) - 1] = '\0';
      fprintf( log_file, "%s :: %s\n", strtime, bash_color( bufew ) );
      fflush( log_file );
      fclose( log_file );
      for( d = descriptor_list; d != NULL; d = d->next )
         if( d->connected == CON_PLAYING && IS_IMMORTAL( d->character ) )
            printf_to_char( d->character, "Critical: %s\n\r", bufew );
      xprintf( bufee, "Critical: %s", bufew );
   }
   if( type & LOG_ERR )
   {
      xprintf( buf, "../log/%s.error", get_curdate(  ) );
      log_file = fopen( buf, "a" );
      strtime = ctime( &current_time );
      strtime[strlen( strtime ) - 1] = '\0';
      fprintf( log_file, "%s :: %s\n", strtime, bash_color( bufew ) );
      fprintf( stderr, "%s :: %s\n", strtime, bash_color( bufew ) );
      fflush( log_file );
      fclose( log_file );
      xprintf( bufee, "Error: %s", bufew );
   }
   if( type & LOG_BUG )
   {
      xprintf( buf, "../log/%s.bug", get_curdate(  ) );
      log_file = fopen( buf, "a" );
      strtime = ctime( &current_time );
      strtime[strlen( strtime ) - 1] = '\0';
      fprintf( log_file, "%s :: %s\n", strtime, bash_color( bufew ) );
      fflush( log_file );
      fclose( log_file );
      xprintf( bufee, "Bug: %s", bufew );
      log_string2( bufee );
   }
   if( type & LOG_SECURITY )
   {
      xprintf( buf, "../log/%s.security", get_curdate(  ) );
      log_file = fopen( buf, "a" );
      strtime = ctime( &current_time );
      strtime[strlen( strtime ) - 1] = '\0';
      fprintf( log_file, "%s :: %s\n", strtime, bash_color( bufew ) );
      fflush( log_file );
      fclose( log_file );
      xprintf( bufee, "Security: %s", bufew );
   }
   if( type & LOG_CONNECT )
   {
      xprintf( buf, "../log/%s.connect", get_curdate(  ) );
      log_file = fopen( buf, "a" );
      strtime = ctime( &current_time );
      strtime[strlen( strtime ) - 1] = '\0';
      fprintf( log_file, "%s :: %s\n", strtime, bash_color( bufew ) );
      fflush( log_file );
      fclose( log_file );
      xprintf( bufee, "Connect: %s", bufew );
   }
   if( type & LOG_GAME )
   {
      xprintf( buf, "../log/%s.game", get_curdate(  ) );
      log_file = fopen( buf, "a" );
      strtime = ctime( &current_time );
      strtime[strlen( strtime ) - 1] = '\0';
      fprintf( log_file, "%s :: %s\n", strtime, bash_color( bufew ) );
      fprintf( stderr, "%s :: %s\n", strtime, bash_color( bufew ) );
      fflush( log_file );
      fclose( log_file );
      xprintf( bufee, "Game: %s", bufew );
   }
   if( type & LOG_COMMAND )
   {
      xprintf( buf, "../log/%s.comm", get_curdate(  ) );
      log_file = fopen( buf, "a" );
      strtime = ctime( &current_time );
      strtime[strlen( strtime ) - 1] = '\0';
      fprintf( log_file, "%s :: %s\n", strtime, bash_color( bufew ) );
      fflush( log_file );
      fclose( log_file );
      xprintf( bufee, "Command: %s", bufew );
   }
   wiznet(bufee,NULL,NULL, WIZ_DEBUG, 0, 7);
}
Beispiel #18
0
void fmap (CHAR_DATA * ch, bool forced, bool range, char *argument)
{
char buf1[70];
char buf2[70];
char buf3[70];
int i,j;
int total = 0;
CHAR_DATA * fighters[16];
int fightcount = 0;
CHAR_DATA *rch;
int theturn = 0;

if(!ch->in_room->map.init)
{
ch->in_room->map.init = TRUE;
generate_random_terrain(ch->in_room);
}   

if (IS_SET (ch->comm, COMM_NOMAP) && forced == TRUE)
return;

    for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
    {
    if(rch->infight)
        {
        if(TURN(rch))
        theturn = 1;
        fighters[fightcount] = rch;
        fightcount++;
        }
     }

printf_to_char(ch,"\n\r%s",echo_off_str);

printf_to_char(ch," {y 0123456789abcdefghijklmnop{x\n\r");
printf_to_char(ch," ----------------------------  |-----------------------------------------------|\n\r");
for(i=0;i<16;i++)
{
char buf2[MSL];
printf_to_char(ch,"{W%c|{x",gridname[i]);
for(j=0;j<26;j++)
{
total += parse_room(ch,i,j,range);
}
if(i < fightcount)
{

sprintf(buf2," %s{x{w{W - %s%-19s {C %3dAT %5dHP %5dMP{W",fighters[i]->fdisp,get_t_color(fighters[i]),fcn(fighters[i]),fighters[i]->AT,fighters[i]->hit,fighters[i]->mana);
}
else
sprintf(buf2,"{x%47s{x"," ");
printf_to_char(ch,"{W|%c |%s|\n\r",gridname[i],buf2);
}

if(ch->in_room->turn != NULL)
{
char buf7[40];
CHAR_DATA *rch = ch->in_room->turn;

if(rch->level > 99)
sprintf(buf7,"{gL{W**{c ---{bexp{W             | PA MA BR FA MV JM SP |");
else
sprintf(buf7,"{gL{R%2d{c %3d{bexp{W             | PA MA BR FA MV JM SP |",rch->level,((rch->level + 1) * 100) - rch->exp);
 
sprintf(buf1," %s%-23s{W|{r%4d{c/{r%4d{RHP {g%3d{c/{g%3d{GMP{W |",get_t_color(rch),fcn(rch),rch->hit,rch->max_hit,rch->mana,rch->max_mana);
sprintf(buf2," %s",buf7);
sprintf(buf3,"                        | %2d %2d %2d %2d %2d %2d %2d {W|",rch->PhysAttack,rch->MagAttack,
rch->Brave,rch->Faith,rch->MoveLeft,rch->jump,rch->speed);
printf_to_char(ch," {W----------------------------  |-----------------------------------------------|\n\r");
printf_to_char(ch," |{y0123456789abcdefghijklmnop{W|  |%-44s",buf1);
//parse_room(ch,(rch->mposy - 1),(rch->mposx - 1),FALSE);
//parse_room(ch,(rch->mposy - 1),rch->mposx,FALSE);
//parse_room(ch,(rch->mposy - 1),(rch->mposx + 1),FALSE);
printf_to_char(ch,"{W\n\r");
printf_to_char(ch," {W----------------------------  |%-44s",buf2);
//parse_room(ch,rch->mposy,(rch->mposx - 1),FALSE);
//parse_room(ch,rch->mposy,rch->mposx,FALSE);
//parse_room(ch,rch->mposy,(rch->mposx + 1),FALSE);
printf_to_char(ch,"{W\n\r");
printf_to_char(ch," {W|%-26s|  |%-44s",ch->in_room->name,buf3);
//parse_room(ch,(rch->mposy + 1),(rch->mposx - 1),FALSE);
//parse_room(ch,(rch->mposy + 1),rch->mposx,FALSE);
//parse_room(ch,(rch->mposy + 1),(rch->mposx + 1),FALSE);
printf_to_char(ch,"{W\n\r");
}


printf_to_char(ch," ----------------------------  |-----------------------------------------------|\n\r");



check_winner(ch->in_room);
printf_to_char(ch,"%s", echo_on_str);

}
Beispiel #19
0
void do_rescind(CHAR_DATA *ch, char *argument )
{	CHAR_DATA *victim;

	char arg[MSL];

	if(IS_NPC(ch) )
		return;
	if(!HAS_ORGANIZATION(ch) )
	{	send_to_char("You aren't organized.\n\r",ch);
		return;
	}
	if( ch->pcdata->rank < RANK_PRIEST )
	{	send_to_char("You cannot rescind peoples ranks!\n\r",ch );
		return;
	}
	one_argument(argument, arg );

	if(arg[0] == '\0' )
	{	send_to_char("Syntax: rescind <person>\n\r",ch);
		return;
	}
	if(!IS_IMMORTAL(ch) )
	{	if( ( victim = get_char_room(ch, NULL, arg) )  == NULL )
		{	send_to_char("They aren't here.\n\r",ch);
			return;
		}
	}
	else
	{	if( ( victim = get_char_world(ch, arg) ) == NULL )
		{	send_to_char("They aren't here.\n\r",ch);
			return;
		}
		
	}
	if(IS_NPC(victim) )
	{	send_to_char("Not on NPC's.\n\r",ch);
		return;
	}
	if(!HAS_ORGANIZATION(victim) )
	{	send_to_char("They aren't organized.\n\r",ch);
		return;
	}
	if(!IS_SAME_ORGANIZATION(ch, victim) && ch->pcdata->rank != RANK_GOD  )
	{	send_to_char("They aren't in your organization!\n\r",ch); 
		return; 
	}

	if( ch->pcdata->rank <= victim->pcdata->rank )
	{	send_to_char("You cannot rescind their rank!\n\r", ch );
		return;
	}

	if(!IS_IMMORTAL(ch) && ch->pcdata->rank <= RANK_PRIEST && victim->pcdata->rank >= RANK_BISHOP )
	{	send_to_char("You cannot rescind their rank.\n\r",ch);
		return;
	}

	if(victim->pcdata->rank == RANK_INITIATE )
	{	send_to_char("They cannot get any lower!\n\r",ch);
		return;
	}
	--victim->pcdata->rank;
	act_new(victim->pcdata->organization->dmt_msg,ch, NULL, victim, TO_VICT, POS_SLEEPING );
	printf_to_char(ch, "You have lowered their rank to %s.\n\r", orgrank_table[victim->pcdata->rank].name );
	return;
}
Beispiel #20
0
void do_scan( CHAR_DATA *ch, char *argument )
{
    EXIT_DATA       *pexit;
    ROOM_INDEX_DATA *room;
    ROOM_INDEX_DATA *in_room;
    DESCRIPTOR_DATA * d;
    extern char *const dir_name[];
    char buf[ MAX_STRING_LENGTH ];
    char exitname[ MAX_STRING_LENGTH ];
    int lookdoor, door, iter;
    int distance, max_dist;
    int mob_count, mob_count_new;
    bool darkness = FALSE;
    const char *dir_long_name[] = { "pó³noc", "wschód", "po³udnie", "zachód", "góra", "dó³" };
    lookdoor = -1;
    door = -1;

    if ( !IS_NPC( ch ) && ch->pcdata->mind_in )
    {
        in_room = ch->pcdata->mind_in;
    }
    else
    {
        if ( !check_blind( ch ) )
        {
            return ;
        }
        in_room = ch->in_room;
    }

    if ( argument[0] != '\0' )
    {
        if ( IS_AFFECTED( ch, AFF_MAZE ) )
        {
            send_to_char("Nie bardzo wiesz w która stronê popatrzeæ.\n\r", ch);
            return;
        }

        //wieza obserwacyjna
        if( !str_prefix( argument, "around" ) )
        {
            if ( !EXT_IS_SET( ch->in_room->room_flags, ROOM_WATCH_TOWER ) )
            {
                send_to_char( "Musisz byæ na szczycie wie¿y obserwacyjnej.\n\r", ch );
                return;
            }

            if ( ch->position != POS_STANDING )
            {
                send_to_char( "Najpierw wstañ.\n\r", ch );
                return;
            }

            send_to_char( "Ze szczytu wie¿y ogl±dasz uwa¿nie ca³± okolicê.\n\r", ch );
            act( "Stoj±c na szczycie wie¿y $n uwa¿nie omiata wzrokiem ca³± okolicê.", ch, NULL, NULL, TO_ROOM );

            for ( d = descriptor_list; d != NULL; d = d->next )
            {
                if ( !d->character || d->connected < 0 )
                {
                    continue;
                }
                if( d->connected != CON_PLAYING || d->character == ch || d->character->in_room == NULL )
                {
                    continue;
                }
                if ( !SAME_AREA( d->character->in_room->area, ch->in_room->area ) || !SAME_AREA_PART( d->character, ch ) )
                {
                    continue;
                }
                if ( !can_see( ch, d->character ) )
                {
                    continue;
                }
                if ( EXT_IS_SET( d->character->in_room->room_flags, ROOM_INDOORS ) || IS_SET( sector_table[ d->character->in_room->sector_type ].flag, SECT_NOWEATHER ) )
                {
                    continue;
                }
                if ( ch->in_room == d->character->in_room )
                {
                    continue;
                }
                print_char( ch, "{x%s - Widzisz tam {C%s{x.\n\r", d->character->in_room->name, d->character->name4 );
            }
            return;
        }
        door = get_door( ch, argument );
        if ( door >= 0 && check_vname( ch, door, FALSE ) )
        {
            send_to_char("W ktorym kierunku chcesz siê rozejrzeæ?\n\r", ch);
            return;
        }
        if ( door < 0 )
        {
            door = -1;
            for ( iter = 0; iter <= 5; iter++ )
            {
                if ( ( pexit = in_room->exit[iter] ) != NULL &&   !str_prefix( argument, pexit->vName ) &&  !( (IS_SET(pexit->exit_info, EX_SECRET) || IS_SET(pexit->exit_info, EX_HIDDEN))&& !IS_AFFECTED(ch,AFF_DETECT_HIDDEN) ) )
                {
                    door = iter;
                    break;
                }
            }
        }
        if ( door < 0 || in_room->exit[door] == NULL )
        {
            send_to_char("W ktorym kierunku chcesz siê rozejrzeæ?\n\r", ch);
            return;
        }
        lookdoor = door;
        door = -1;
    }
    if ( lookdoor < 0 )
    {
        if ( IS_NPC( ch ) || !ch->pcdata->mind_in )
        {
            act("$n rozgl±da siê dooko³a.", ch, NULL, NULL, TO_ROOM);
        }
        send_to_char("Rozgl±daj±c siê dooko³a widzisz:\n\r", ch);
        sprintf( buf, "{CTutaj{x\n\r" );
        mob_count = 0;
        mob_count_new = scan_room (ch, in_room, buf, 0);
        if ( mob_count_new < 0 )
        {
            send_to_char( "{CTutaj{x{c - nieprzenikniona ciemno¶æ.{x\n\r", ch );
            darkness = TRUE;
        }
        else
        {
            mob_count += mob_count_new;
        }
        strcat(buf, "{x");
        if ( mob_count > 0 )
        {
            send_to_char ( buf, ch );
        }
        else
        {
            if ( mob_count == 0 && !darkness)
            {
                send_to_char( "{CTutaj{x{c - nikogo nie ma.{x\n\r", ch );
            }
        }
    }
    darkness = FALSE;

    if ( !IS_NPC( ch ) && !EXT_IS_SET( ch->act, PLR_HOLYLIGHT ) )
    {
        if ( room_is_dark(ch, in_room) && !IS_AFFECTED(ch, AFF_INFRARED) )
        {
            send_to_char("Jest tutaj zbyt ciemno aby powiedzieæ co¶ o okolicy.\n\r", ch);
            return;
        }
    }
    for ( door = 0; door < MAX_DIR; door++ )
    {
        room = in_room;
        if ( lookdoor >= 0 && door != lookdoor )
        {
            continue;
        }
        if ( ( pexit = room->exit[door] ) == NULL )
        {
            continue;
        }
        if ( lookdoor >= 0 || !( ( IS_SET(pexit->exit_info, EX_SECRET) && !IS_SET(pexit->exit_info, EX_HIDDEN) ) || ( IS_SET(pexit->exit_info, EX_HIDDEN) && !IS_AFFECTED(ch,AFF_DETECT_HIDDEN) ) ) )
        {
            if ( pexit )
            {
                if ( pexit->vName && pexit->vName[0] != '\0' )
                {
                    sprintf( exitname, "%s", pexit->vName );
                }
                else
                {
                    if ( IS_AFFECTED( ch, AFF_MAZE ) )
                    {
                        sprintf ( exitname, "%s", capitalize( dir_long_name[ number_range( 0, 5 ) ] ) );
                    }
                    else
                    {
                        sprintf( exitname, "%s", capitalize( dir_name[door] ) );
                    }
                }
            }
            else
            {
                exitname[0] = '\0';
            }
            if ( !room_is_dark( ch, in_room ) )
            {
                if ( IS_SET( pexit->exit_info, EX_HIDDEN ) )
                {
                    sprintf( buf, "{C%s{x{c - kto¶ stara³ siê ukryæ to przej¶cie.{x\n\r", exitname );
                    send_to_char( buf, ch );
                    continue;
                }
                else if ( IS_SET( pexit->exit_info, EX_CLOSED ) && !IS_AFFECTED(ch, AFF_PIERCING_SIGHT) )
                {
                    if ( pexit->biernik != NULL && pexit->biernik[ 0 ] != '\0' && pexit->biernik[ 0 ] != ' ' )
                    {
                        if( !pexit->liczba_mnoga )
                        {
                            sprintf( buf, "{C%s{x{c - nic nie widzisz przez zamkniêt± %s.{x\n\r", exitname, pexit->biernik );
                        }
                        else
                        {
                            sprintf( buf, "{C%s{x{c - nic nie widzisz przez zamkniête %s.{x\n\r", exitname, pexit->biernik );
                        }
                        send_to_char( buf, ch );
                    }
                    else
                    {
                        sprintf( buf, "{C%s{x{c - nic nie widzisz przez zamkniête drzwi.{x\n\r", exitname );
                        send_to_char( buf, ch );
                    }
                    continue;
                }
                else if ( IS_SET( pexit->exit_info, EX_WALL_OF_MIST ) && !IS_AFFECTED(ch, AFF_PIERCING_SIGHT) )
                {
                    sprintf( buf, "{C%s{x{c - ¶ciana mg³y zas³ania ci widoczno¶æ.{x\n\r", exitname );
                    send_to_char( buf, ch );
                    continue;
                }
            }

            buf[0] = '\0';
            mob_count = 0;
            max_dist = (lookdoor < 0)? 2:4;

            /**
             * imorovmen range for elfs
             * http://forum.mud.pl/viewtopic.php?t=5457
             */
            if(!str_cmp( race_table[ GET_RACE(ch) ].name, "elf" ))
            {
                max_dist += number_range(0, 2);
            }
            for ( distance = 1 ; distance < max_dist; distance++ )
            {
                pexit = room->exit[door];
                if ( !pexit || !pexit->u1.to_room || ( IS_SET( pexit->exit_info, EX_CLOSED ) && !IS_AFFECTED(ch, AFF_PIERCING_SIGHT) ) || ( IS_SET( pexit->exit_info, EX_WALL_OF_MIST ) && !IS_AFFECTED(ch, AFF_PIERCING_SIGHT) ))
                {
                    break;
                }
                darkness = FALSE;
                mob_count_new = scan_room ( ch, pexit->u1.to_room, buf, distance);
                if (  mob_count_new < 0)
                {
                    printf_to_char( ch, "{C%s{x{c - panuje tam nieprzenikniona ciemno¶æ.{x\n\r", exitname );
                    darkness = TRUE;
                }
                else
                {
                    mob_count += mob_count_new;
                }

                room = pexit->u1.to_room;
            }
            strcat(buf, "{x");

            if ( mob_count > 0 && !darkness )
            {
                if ( room_is_dark( ch, in_room ) )
                {
                    printf_to_char( ch, "{C%s{x{c - widaæ tam chyba kogo¶.{x\n\r", exitname );
                }
                else
                {
                    print_char( ch, "{C%s{x\n\r", exitname );
                    send_to_char ( buf, ch );
                }
            }
            else if ( !room_is_dark( ch, in_room ) && !darkness )
            {
                if ( mob_count == 0 && in_room->exit[door])
                {
                    printf_to_char( ch, "{C%s{x{c - nikogo tam nie widaæ.{x\n\r", exitname );
                }
            }
            darkness = FALSE;
        }
    }

    if ( room_is_dark( ch, in_room ) )
    {
        send_to_char("\n\rJest tutaj zbyt ciemno aby powiedzieæ co¶ dok³adniej o okolicy.\n\r", ch);
        return;
    }
    return;
}
Beispiel #21
0
void do_test (CHAR_DATA * ch, char *argument)
{
printf_to_char(ch,"east : %d, south : %d, west : %d, north : %d\n",hdif(ch,DIR_EAST),hdif(ch,DIR_SOUTH),hdif(ch,DIR_WEST),hdif(ch,DIR_NORTH));
}
Beispiel #22
0
void move_char (CHAR_DATA * ch, int door, bool follow)
{
    CHAR_DATA *fch;
    CHAR_DATA *fch_next;
    ROOM_INDEX_DATA *in_room;
    ROOM_INDEX_DATA *to_room;
    EXIT_DATA *pexit;

  
    if(ch->infight)
    {
    if(!TURN(ch))
    {
    printf_to_char(ch,"It's not your turn.\n");
    return;
    }

    refresh(ch->in_room);


    if(ch->MoveLeft == 0)
    {
    printf_to_char(ch,"You have no moves left.\n");
    return;
    }
    
    switch(door)
    {
    case DIR_EAST:
    if(find_char_xy(ch,ch->mposx+1,ch->mposy) == NULL)
    {
    if(hdif(ch,DIR_EAST) > ch->jump || hdif(ch,DIR_EAST) < -(ch->jump) || ch->mposx > 24) 
    {
    printf_to_char(ch,"You can't jump that high.\n");
    return;
    }
    ch->mposx++;
    ch->in_room->map.index[ch->mposy][ch->mposx].occupied = FALSE;
    ch->in_room->map.index[ch->mposy][ch->mposx+1].occupied = TRUE;
    announce_move(ch,"east");
    }
    else
    printf_to_char(ch,"Somebody's in the way.\n");
    break;
    case DIR_WEST:
    if(find_char_xy(ch,ch->mposx-1,ch->mposy) == NULL)
    {
    if(hdif(ch,DIR_WEST) > (ch->jump) || hdif(ch,DIR_WEST) < -(ch->jump) || ch->mposx < 1) 
    {
    printf_to_char(ch,"You can't jump that high.\n");
    return;
    }
    ch->in_room->map.index[ch->mposy][ch->mposx].occupied = FALSE;
    ch->in_room->map.index[ch->mposy][ch->mposx-1].occupied = TRUE;
    ch->mposx--;
    announce_move(ch,"west");
    }
    else
    printf_to_char(ch,"Somebody's in the way.\n");
    break;
    case DIR_NORTH:
    if(hdif(ch,DIR_NORTH) > (ch->jump) || hdif(ch,DIR_NORTH) < -(ch->jump) || ch->mposy < 1) 
    {
    printf_to_char(ch,"You can't jump that high.\n");
    return;
    }
    if(find_char_xy(ch,ch->mposx,ch->mposy-1) == NULL)
    {
    ch->in_room->map.index[ch->mposy][ch->mposx].occupied = FALSE;
    ch->in_room->map.index[ch->mposy-1][ch->mposx].occupied = TRUE;
    ch->mposy--;
    announce_move(ch,"north");
    }
    else
    printf_to_char(ch,"Somebody's in the way.\n");
    break;
    case DIR_SOUTH:
    if(hdif(ch,DIR_SOUTH) > (ch->jump) || hdif(ch,DIR_SOUTH) < -(ch->jump) || ch->mposy > 14) 
    {
    printf_to_char(ch,"You can't jump that high.\n");
    return;
    }
    if(find_char_xy(ch,ch->mposx,ch->mposy+1) == NULL)
    {
    ch->in_room->map.index[ch->mposy][ch->mposx].occupied = FALSE;
    ch->in_room->map.index[ch->mposy+1][ch->mposx].occupied = TRUE;
    ch->mposy++;
    announce_move(ch,"south");
    }
    else
    printf_to_char(ch,"Somebody's in the way.\n");
    break;
    }

return;
}


    if (door < 0 || door > 5)
    {
        bug ("Do_move: bad door %d.", door);
        return;
    }

    /*
     * Exit trigger, if activated, bail out. Only PCs are triggered.
     */

    in_room = ch->in_room;
    if ((pexit = in_room->exit[door]) == NULL
        || (to_room = pexit->u1.to_room) == NULL
        || !can_see_room (ch, pexit->u1.to_room))
    {
        send_to_char ("Alas, you cannot go that way.\n\r", ch);
        return;
    }

    if (IS_SET (pexit->exit_info, EX_CLOSED)
            || IS_SET (pexit->exit_info, EX_NOPASS))
    {
        act ("The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR);
        return;
    }

    if (!is_room_owner (ch, to_room) && room_is_private (to_room))
    {
        send_to_char ("That room is private right now.\n\r", ch);
        return;
    }

    if ( ch->invis_level < LEVEL_HERO)
        act ("$n leaves $T.", ch, NULL, dir_name[door], TO_ROOM);


    char_from_room (ch);
    char_to_room (ch, to_room);


    if ( ch->invis_level < LEVEL_HERO)
        act ("$n has arrived.", ch, NULL, NULL, TO_ROOM);

    do_function (ch, &do_look, "auto");

    if (in_room == to_room)        /* no circular follows */
        return;

    for (fch = in_room->people; fch != NULL; fch = fch_next)
    {
        fch_next = fch->next_in_room;

        if (fch->master == ch && fch->position == POS_STANDING
            && can_see_room (fch, to_room))
        {

            if (IS_SET (ch->in_room->room_flags, ROOM_LAW)
                && (IS_NPC (fch) && IS_SET (fch->act, ACT_AGGRESSIVE)))
            {
                act ("You can't bring $N into the city.",
                     ch, NULL, fch, TO_CHAR);
                act ("You aren't allowed in the city.",
                     fch, NULL, NULL, TO_CHAR);
                continue;
            }

            act ("You follow $N.", fch, NULL, ch, TO_CHAR);
            move_char (fch, door, TRUE);
        }
    }

    /* 
     * If someone is following the char, these triggers get activated
     * for the followers before the char, but it's safer this way...
     */
   // if(number_range(1,10) > 2)
 //   gen_random_battle(ch);

    return;
}
Beispiel #23
0
void broadcast_shout(const CHANNEL_DEFINITION const *channel, struct char_data *sender, const char *argument)
{
    struct descriptor_iterator_filter playing_filter = { .must_playing = true, .skip_character = sender };
    struct descriptor_data *d;
    struct descriptor_data *dpending;
    struct char_data *actual;
    struct char_data *receiver;

    act_new("`1You shout '`!$T`1'``", sender, NULL, argument, TO_CHAR, POS_DEAD, channel->mob_trigger);
    dpending = descriptor_iterator_start(&playing_filter);
    while ((d = dpending) != NULL) {
	dpending = descriptor_iterator(d, &playing_filter);
	actual = CH(d);
	receiver = d->character;

	if (receiver->in_room != NULL && receiver->in_room->area == sender->in_room->area && CHAN_ENABLED(actual, channel->flag) && !CHAN_DENIED(actual, channel->flag)) {
	    act_new("`1$n shouts '`!$t`1'``", sender, argument, receiver, TO_VICT, channel->receiver_position, false);
	}
    }
}

void broadcast_global(const CHANNEL_DEFINITION const *channel, struct char_data *sender, const char *argument)
{
    static char buf[2*MAX_INPUT_LENGTH];
    struct descriptor_iterator_filter playing_filter = { .must_playing = true, .skip_character = sender };
    struct descriptor_data *dpending;
    struct descriptor_data *d;
    struct char_data *actual;

    (void)snprintf(buf, 2 * MAX_INPUT_LENGTH, "``$n %s: %s``", channel->print_name, argument);
    if (sender != NULL) {
	act_new("$n `2I`8M`2P`8:`` $t``", sender, argument, NULL, TO_CHAR, POS_DEAD, channel->mob_trigger);
    }
    dpending = descriptor_iterator_start(&playing_filter);
    while ((d = dpending) != NULL) {
	dpending = descriptor_iterator(d, &playing_filter);
	actual = CH(d);

	(void)snprintf(buf, 2 * MAX_INPUT_LENGTH, "``$t %s: %s``", channel->print_name, argument);
	if (CHAN_ENABLED(actual, channel->flag) && !CHAN_DENIED(actual, channel->flag)) {
	    act_new(buf, sender, argument, d->character, TO_VICT, channel->receiver_position, false);
	}
    }
}

void broadcast_say(const CHANNEL_DEFINITION const *channel, struct char_data *sender, const char *argument)
{
#define VERBSIZE 20
    static char buf[2*MAX_INPUT_LENGTH];
    static char verb[VERBSIZE];
    int len = strlen(argument);
    int puncpos = len - 1;
    int puncpos2 = len - 2;

    switch (puncpos)
    {
	case '!':
	    {
		if (puncpos2 >= 0) {
		    switch (argument[puncpos2])
		    {
			case '!': snprintf(verb, VERBSIZE, "%s", "shout"); break;
			case '?': snprintf(verb, VERBSIZE, "%s", "angrily demand"); break;
			default: snprintf(verb, VERBSIZE, "%s", "exclaim"); break;
		    }
		} else {
		    snprintf(verb, VERBSIZE, "%s", "exclaim");
		}
		break;
	    }
	case '?':
	    {
		if (puncpos2 >= 0) {
		    switch (argument[puncpos2])
		    {
			case '?': snprintf(verb, VERBSIZE, "%s", "in confusion, ask"); break;
			case '!': snprintf(verb, VERBSIZE, "%s", "angrily demand"); break;
			default: snprintf(verb, VERBSIZE, "%s", "ask"); break;
		    }
		} else {
		    snprintf(verb, VERBSIZE, "%s", "ask");
		}
		break;
	    }
	default: snprintf(verb, VERBSIZE, "%s", "say"); break;
    }

    (void)snprintf(buf, 2 * MAX_INPUT_LENGTH, "`7You %s '`s$T`7'``", verb);
    act_new(buf, sender, NULL, argument, TO_CHAR, POS_RESTING, channel->mob_trigger);

    (void)snprintf(buf, 2 * MAX_INPUT_LENGTH, "`7$n %ss '`s$T`7'``", verb);
    act_new(buf, sender, NULL, argument, TO_ROOM, channel->receiver_position, false);
}

void broadcast_emote(const CHANNEL_DEFINITION const *channel, struct char_data *sender, const char *argument)
{
    act_new("$n $T", sender, NULL, emote_parse(argument), TO_CHAR, POS_RESTING, channel->mob_trigger);
    act_new("$n $T", sender, NULL, emote_parse(argument), TO_ROOM, channel->receiver_position, false);
}

void broadcast_pmote(const CHANNEL_DEFINITION const *channel, struct char_data *sender, const char *argument)
{
    struct char_data *vch;
    char *letter;
    char *name;
    char last[MAX_INPUT_LENGTH];
    char temp[MAX_STRING_LENGTH];
    int matches = 0;

    act_new("$n $t", sender, argument, NULL, TO_CHAR, POS_DEAD, channel->mob_trigger);

    for (vch = sender->in_room->people; vch != NULL; vch = vch->next_in_room) {
	if (vch->desc == NULL || vch == sender)
	    continue;

	if ((letter = strstr(argument, vch->name)) == NULL) {
	    act_new("$N $t", vch, argument, sender, TO_CHAR, channel->receiver_position, false);
	    continue;
	}

	strcpy(temp, argument);
	temp[strlen(argument) - strlen(letter)] = '\0';
	last[0] = '\0';
	name = vch->name;

	for (; *letter != '\0'; letter++) {
	    if (*letter == '\'' && matches == (int)strlen(vch->name)) {
		strcat(temp, "r");
		continue;
	    }

	    if (*letter == 's' && matches == (int)strlen(vch->name)) {
		matches = 0;
		continue;
	    }

	    if (matches == (int)strlen(vch->name))
		matches = 0;

	    if (*letter == *name) {
		matches++;
		name++;
		if (matches == (int)strlen(vch->name)) {
		    strcat(temp, "you");
		    last[0] = '\0';
		    name = vch->name;
		    continue;
		}
		strncat(last, letter, 1);
		continue;
	    }

	    matches = 0;
	    strcat(temp, last);
	    strncat(temp, letter, 1);
	    last[0] = '\0';
	    name = vch->name;
	}

	act_new("$N $t", vch, temp, sender, TO_CHAR, channel->receiver_position, false);
    }
}

void broadcast_smote(const CHANNEL_DEFINITION const *channel, struct char_data *sender, const char *argument)
{
    struct char_data *vch;
    char *letter;
    char *name;
    char last[MAX_INPUT_LENGTH];
    char temp[MAX_STRING_LENGTH];
    int matches = 0;

    if (strstr(argument, sender->name) == NULL) {
	send_to_char("You must include your name in an smote.\n\r", sender);
	return;
    }

    printf_to_char(sender, "%s\n\r", argument);

    for (vch = sender->in_room->people; vch != NULL; vch = vch->next_in_room) {
	if (vch->desc == NULL || vch == sender)
	    continue;

	if ((letter = strstr(argument, vch->name)) == NULL) {
	    printf_to_char(vch, "%s\n\r", argument);
	    continue;
	}

	strcpy(temp, argument);
	temp[strlen(argument) - strlen(letter)] = '\0';
	last[0] = '\0';
	name = vch->name;

	for (; *letter != '\0'; letter++) {
	    if (*letter == '\'' && matches == (int)strlen(vch->name)) {
		strcat(temp, "r");
		continue;
	    }

	    if (*letter == 's' && matches == (int)strlen(vch->name)) {
		matches = 0;
		continue;
	    }

	    if (matches == (int)strlen(vch->name))
		matches = 0;

	    if (*letter == *name) {
		matches++;
		name++;

		if (matches == (int)strlen(vch->name)) {
		    strcat(temp, "you");
		    last[0] = '\0';
		    name = vch->name;
		    continue;
		}

		strncat(last, letter, 1);
		continue;
	    }

	    matches = 0;
	    strcat(temp, last);
	    strncat(temp, letter, 1);
	    last[0] = '\0';
	    name = vch->name;
	}

	printf_to_char(vch, "%s\n\r", temp);
    }
}

void broadcast_reply(const CHANNEL_DEFINITION const *channel, struct char_data *sender, const char *argument)
{
    struct char_data *whom;

    if ((whom = sender->reply) == NULL) {
	send_to_char("They aren't here.\n\r", sender);
	return;
    }

    if (send_tell(sender, whom, argument)) {
	whom->reply = sender;
    }

    return;
}

void broadcast_gtell(const CHANNEL_DEFINITION const *channel, struct char_data *sender, const char *argument)
{
    struct char_data *gch;

    for (gch = char_list; gch != NULL; gch = gch->next) {
	if (is_same_group(gch, sender)) {
	    printf_to_char(gch, "```5%s tells the group '```P%s```5'``\n\r", sender->name, argument);
	}
    }
}


/***
 * Targetted Broadcasters
 */

void broadcast_sayto(const CHANNEL_DEFINITION const *channel, struct char_data *sender, struct char_data *whom, const char *argument)
{
    struct descriptor_iterator_filter playing_filter = { .must_playing = true, .skip_character = sender };
    struct descriptor_data *d;
    struct descriptor_data *dpending;

    if (IS_SET(whom->comm, COMM_AFK) && IS_NPC(whom)) {
	act("$E is `!A`@F`OK``, and is unable to pay attention.", sender, NULL, whom, TO_CHAR);
	return;
    }

    printf_to_char(sender, "``You say to %s '`P%s``'\n\r", whom->name, argument);
    printf_to_char(whom, "``%s says to you '`P%s``'\n\r", sender->name, argument);

    dpending = descriptor_iterator_start(&playing_filter);
    while ((d = dpending) != NULL) {
	dpending = descriptor_iterator(d, &playing_filter);
	if (d->character->in_room == sender->in_room
		&& d->character->position != POS_SLEEPING
		&& d->character != whom) {
	    printf_to_char(d->character, "%s says to %s, '`P%s``'.\n\r", PERS(sender, d->character), PERS(whom, d->character), argument);
	}
    }
}

void broadcast_tell(const CHANNEL_DEFINITION const *channel, struct char_data *sender, struct char_data *whom, const char *argument)
{
    if (send_tell(sender, whom, argument)) {
	whom->reply = sender;
	if (!IS_NPC(sender) && IS_NPC(whom) && HAS_TRIGGER(whom, TRIG_SPEECH)) {
	    mp_act_trigger(argument, whom, sender, NULL, NULL, TRIG_SPEECH);
	}
    }
}


/***
 * Util
 */

bool is_ignoring(struct char_data *sender, struct char_data *receiver)
{
    int pos;
    bool found = false;

    if (IS_NPC(receiver)) {
	return false;
    }

    for (pos = 0; pos < MAX_IGNORE; pos++) {
	if (receiver->pcdata->ignore[pos] == NULL) {
	    break;
	}
	if (!str_cmp(sender->name, receiver->pcdata->ignore[pos])) {
	    found = true;
	    break;
	}
    }
    return found;
}

bool send_tell(struct char_data *sender, struct char_data *whom, const char* argument)
{
    static char buf[MAX_STRING_LENGTH];

    if (!IS_IMMORTAL(whom) && !IS_AWAKE(sender)) {
	send_to_char("In your dreams, or what?\n\r", sender);
	return false;
    }

    if (IS_SET(whom->comm, COMM_AFK)) {
	if (IS_NPC(whom)) {
	    act("$E is ```!A```@F```OK``, and not receiving tells.", sender, NULL, whom, TO_CHAR);
	    return false;
	}

	act("$E is ```!A```@F```OK``, but your tell will go through when $E returns.", sender, NULL, whom, TO_CHAR);
	(void)snprintf(buf, 2 * MAX_INPUT_LENGTH, "```@%s tells you '`t%s```@'``\n\r", PERS(sender, whom), argument);
	buf[0] = UPPER(buf[0]);
	add_buf(whom->pcdata->buffer, buf);
	return true;
    }

    if (whom->desc == NULL && !IS_NPC(whom)) {
	act("$N seems to have misplaced $S link...try again later.", sender, NULL, whom, TO_CHAR);
	(void)snprintf(buf, 2 * MAX_INPUT_LENGTH, "```@%s tells you '`t%s```@'``\n\r", PERS(sender, whom), argument);
	buf[0] = UPPER(buf[0]);
	add_buf(whom->pcdata->buffer, buf);
	return true;
    }


    act_new("`@You tell $N '`r$t`@'``", sender, argument, whom, TO_CHAR, POS_DEAD, false);
    act_new("`@$n tells you '`r$t`@'``", sender, argument, whom, TO_VICT, POS_DEAD, false);
    return true;
}

char *emote_parse(const char *argument)
{
    static char target[MAX_STRING_LENGTH];
    char buf[MAX_STRING_LENGTH];
    int i = 0, arg_len = 0;
    int flag = false;

    /* Reset target each time before use */
    memset(target, 0x00, sizeof(target));
    arg_len = (int)strlen(argument);
    for (i = 0; i < arg_len; i++) {
	if (argument[i] == '"' && flag == false) {
	    flag = true;
	    (void)snprintf(buf, MAX_STRING_LENGTH, "%c", argument[i]);
	    strcat(target, buf);
	    strcat(target, "`P");
	    continue;
	} else if (argument[i] == '"' && flag == true) {
	    flag = false;
	    strcat(target, "``");
	    (void)snprintf(buf, MAX_STRING_LENGTH, "%c", argument[i]);
	    strcat(target, buf);
	    continue;
	} else {
	    (void)snprintf(buf, MAX_STRING_LENGTH, "%c", argument[i]);
	    strcat(target, buf);
	}
    }
    if (flag) {
	strcat(target, "``");
	(void)snprintf(buf, MAX_STRING_LENGTH, "%c", '"');
	strcat(target, buf);
    }
    return target;
}
Beispiel #24
0
void do_attack (CHAR_DATA * ch, char *argument)
{
char arg[MSL];
CHAR_DATA *victim;
int dir;
if(!TURN(ch))
{
printf_to_char(ch,"It's not your turn.");
return;
}

if(ch->AttackLeft < 1)
{
printf_to_char(ch,"You've already attacked.");
return;
}

argument = one_argument (argument, arg);

if (!strcmp (arg, "north"))
{
dir = DIR_NORTH;
victim = find_char_map(ch,DIR_SOUTH);
}
else if (!strcmp (arg, "east"))
{
dir = DIR_EAST;
victim = find_char_map(ch,DIR_EAST);
}
else if (!strcmp (arg, "south"))
{
dir = DIR_SOUTH;
victim = find_char_map(ch,DIR_NORTH);
}
else if (!strcmp (arg, "west"))
{
dir = DIR_WEST;
victim = find_char_map(ch,DIR_WEST);
}
else
{

victim = get_char_room (ch, arg);

if(victim == NULL)
{
printf_to_char(ch,"Not here.\n");
return;
}

if(!can_hit_t(ch,victim->mposy,victim->mposx))
{
printf_to_char(ch,"Out of range.\n");
return;
}

}

if(victim == NULL)
{
printf_to_char(ch,"Nobody there.\n");
return;
}

if(victim->team == ch->team && IS_NPC(ch) && victim->team != TEAM_NONE)
return;


  if(UMAX(ch->in_room->map.index[ch->mposx][ch->mposy].height,ch->in_room->map.index[victim->mposx][victim->mposy].height) - UMIN(ch->in_room->map.index[ch->mposx][ch->mposy].height,ch->in_room->map.index[victim->mposx][victim->mposy].height) > 1)
  {
  send_to_char("Too high/low to attack.",ch);
  return;
  }

ch->AttackLeft--;

    if(skill_lookup("hamedo") == victim->reaction_num && number_range(1,100) < 31)
    f_multi_hit( victim, ch, TYPE_UNDEFINED );
    else 
    {
    f_multi_hit( ch, victim, TYPE_UNDEFINED );
    handle_reaction(ch,victim);
    }
}
Beispiel #25
0
int parse_room(CHAR_DATA *ch, int x, int y,bool range)
{
CHAR_DATA *rch;
    
char rang[3];

    if(can_hit_t(ch,x,y) && range) 
    sprintf(rang,"{)");
    else    
    strcpy(rang,"");

    for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
    {
 	if(rch->mposy == x && rch->mposx == y && rch->infight)
	{
	 printf_to_char(ch,"{!%s%s{x",rang,rch->fdisp);
	 return 1; 
	}

    }

    
switch(ch->in_room->map.index[x][y].height)
{
case -99:
printf_to_char(ch," ");
break;
case 0:
printf_to_char(ch,"%s.",rang);
break;
case 1:
printf_to_char(ch,"{w%s1{x",rang);
break;
case 2:
printf_to_char(ch,"{b%s2{x",rang);
break;
case 3:
printf_to_char(ch,"{c%s3{x",rang);
break;
case 4:
printf_to_char(ch,"{g%s4{x",rang);
break;
case 5:
printf_to_char(ch,"{m%s5{x",rang);
break;
case 6:
printf_to_char(ch,"{y%s6{x",rang);
break;
case 7:
default:
printf_to_char(ch,"{r%s7{x",rang);
break;

}
printf_to_char(ch,"{x");
return 0;
}
Beispiel #26
0
void do_sedit (CHAR_DATA *ch, char *argument)
{
	char cmd[MAX_INPUT_LENGTH], social[MAX_INPUT_LENGTH];
	char buf[MAX_STRING_LENGTH];
	int iSocial;
	
	smash_tilde (argument);
	
	argument = one_argument (argument,cmd);
	argument = one_argument (argument,social);
	
	if (!cmd[0])
	{
		send_to_char ("Huh? Type HELP SEDIT to see syntax.\n\r",ch);
		return;
	}
		
	if (!social[0])
	{
		send_to_char ("What social do you want to operate on?\n\r",ch);
		return;
	}
	
	iSocial = social_lookup (social);
	
	if (str_cmp(cmd,"new") && (iSocial == -1))
	{
		send_to_char ("No such social exists.\n\r",ch);
		return;
	}

	if (!str_cmp(cmd, "delete")) /* Remove a social */
	{
		int i,j;
		struct social_type *new_table = malloc (sizeof(struct social_type) * maxSocial);
		
		if (!new_table)
		{
			send_to_char ("Memory allocation failed. Brace for impact...\n\r",ch);
			return;
		}
		
		/* Copy all elements of old table into new table, except the deleted social */
		for (i = 0, j = 0; i < maxSocial+1; i++)
			if (i != iSocial) /* copy, increase only if copied */
			{
				new_table[j] = social_table[i];
				j++;
			}
	
		free (social_table);
		social_table = new_table;
		
		maxSocial--; /* Important :() */
		
		send_to_char ("That social is history now.\n\r",ch);
				
	}
	
	else if (!str_cmp(cmd, "new")) /* Create a new social */
	{
		struct social_type *new_table;
		
		if (iSocial != -1)
		{
			send_to_char ("A social with that name already exists\n\r",ch);
			return;
		}
		
		/* reallocate the table */
		/* Note that the table contains maxSocial socials PLUS one empty spot! */
		
		maxSocial++;
		new_table = realloc (social_table, sizeof(struct social_type) * (maxSocial + 1));
		
		if (!new_table) /* realloc failed */
		{
			send_to_char ("Memory allocation failed. Brace for impact.\n\r",ch);
			return;
		}
		
		social_table = new_table;
		
		strcpy(social_table[maxSocial-1].name, str_dup (social));
		social_table[maxSocial-1].char_no_arg = str_dup ("");
		social_table[maxSocial-1].others_no_arg = str_dup ("");
		social_table[maxSocial-1].char_found = str_dup ("");
		social_table[maxSocial-1].others_found = str_dup ("");
		social_table[maxSocial-1].vict_found = str_dup ("");
		social_table[maxSocial-1].char_auto = str_dup ("");
		social_table[maxSocial-1].others_auto = str_dup ("");
		
		strcpy(social_table[maxSocial].name, str_dup ("")); /* 'terminating' empty string */
		
		send_to_char ("New social added.\n\r",ch);
			
	}
	
	else if (!str_cmp(cmd, "show")) /* Show a certain social */
	{
		sprintf (buf, "Social: %s\n\r"
		              "(cnoarg) No argument given, character sees:\n\r"
		              "%s\n\r\n\r"
		              "(onoarg) No argument given, others see:\n\r"
		              "%s\n\r\n\r"
		              "(cfound) Target found, character sees:\n\r"
		              "%s\n\r\n\r"
		              "(ofound) Target found, others see:\n\r"
		              "%s\n\r\n\r"
		              "(vfound) Target found, victim sees:\n\r"
		              "%s\n\r\n\r"
		              "(cself) Target is character himself:\n\r"
		              "%s\n\r\n\r"
		              "(oself) Target is character himself, others see:\n\r"
		              "%s\n\r",
		              
		              social_table[iSocial].name,
		              social_table[iSocial].char_no_arg,
		              social_table[iSocial].others_no_arg,
		              social_table[iSocial].char_found,
		              social_table[iSocial].others_found,
		              social_table[iSocial].vict_found,
		              social_table[iSocial].char_auto,
		              social_table[iSocial].others_auto);

		send_to_char (buf,ch);		          
		return; /* return right away, do not save the table */
	}
	
	else if (!str_cmp(cmd, "cnoarg")) /* Set that argument */
	{
		free_string (social_table[iSocial].char_no_arg);
		social_table[iSocial].char_no_arg = str_dup(argument);		

		if (!argument[0])
			send_to_char ("Character will now see nothing when this social is used without arguments.\n\r",ch);
		else
			printf_to_char (ch,"New message is now:\n\r%s\n\r", argument);
	}
	
	else if (!str_cmp(cmd, "onoarg"))
	{
		free_string (social_table[iSocial].others_no_arg);
		social_table[iSocial].others_no_arg = str_dup(argument);		

		if (!argument[0])
			send_to_char ("Others will now see nothing when this social is used without arguments.\n\r",ch);
		else
			printf_to_char (ch,"New message is now:\n\r%s\n\r", argument);
			
	}
	
	else if (!str_cmp(cmd, "cfound"))
	{
		free_string (social_table[iSocial].char_found);
		social_table[iSocial].char_found = str_dup(argument);		

		if (!argument[0])
			send_to_char ("The character will now see nothing when a target is found.\n\r",ch);
		else
			printf_to_char (ch,"New message is now:\n\r%s\n\r", argument);
			
	}
	
	else if (!str_cmp(cmd, "ofound"))
	{
		free_string (social_table[iSocial].others_found);
		social_table[iSocial].others_found = str_dup(argument);		

		if (!argument[0])
			send_to_char ("Others will now see nothing when a target is found.\n\r",ch);
		else
			printf_to_char (ch,"New message is now:\n\r%s\n\r", argument);
			
	}
	
	else if (!str_cmp(cmd, "vfound"))
	{
		free_string (social_table[iSocial].vict_found);
		social_table[iSocial].vict_found = str_dup(argument);		

		if (!argument[0])
			send_to_char ("Victim will now see nothing when a target is found.\n\r",ch);
		else
			printf_to_char (ch,"New message is now:\n\r%s\n\r", argument);
	}
	
	else if (!str_cmp(cmd, "cself"))
	{
		free_string (social_table[iSocial].char_auto);
		social_table[iSocial].char_auto = str_dup(argument);		

		if (!argument[0])
			send_to_char ("Character will now see nothing when targetting self.\n\r",ch);
		else
			printf_to_char (ch,"New message is now:\n\r%s\n\r", argument);

	}
	
	else if (!str_cmp(cmd, "oself"))
	{
		free_string (social_table[iSocial].others_auto);
		social_table[iSocial].others_auto = str_dup(argument);		

		if (!argument[0])
			send_to_char ("Others will now see nothing when character targets self.\n\r",ch);
		else
			printf_to_char (ch,"New message is now:\n\r%s\n\r", argument);
	}
	
	else
	{
		send_to_char ("Huh? Try HELP SEDIT.\n\r",ch);
		return;
	}
	
	/* We have done something. update social table */
	
	save_social_table();
}
Beispiel #27
0
void do_exalt(CHAR_DATA *ch, char *argument )
{	CHAR_DATA *victim;
	char arg[MSL];

	if(IS_NPC(ch) )
		return;

	if(!HAS_ORGANIZATION(ch) )
	{	send_to_char("You aren't organized.\n\r",ch);
		return;
	}
	if( ch->pcdata->rank < RANK_PRIEST )
	{	send_to_char("You cannot exalt people!\n\r",ch );
		return;
	}
	one_argument(argument, arg );

	if(arg[0] == '\0' )
	{	send_to_char("Syntax: Exalt <person>\n\r",ch);
		return;
	}
	if(!IS_IMMORTAL(ch) )
	{	if( ( victim = get_char_room(ch, NULL, arg) )  == NULL )
		{	send_to_char("They aren't here.\n\r",ch);
			return;
		}
	}
	else
	{	if( ( victim = get_char_world(ch, arg) ) == NULL )
		{	send_to_char("They aren't here.\n\r",ch);
			return;
		}
	}
	if(IS_NPC(victim) )
	{	send_to_char("Not on NPC's.\n\r",ch);
		return;
	}
	if(!HAS_ORGANIZATION(victim) )
	{	send_to_char("They aren't organized.\n\r",ch);
		return;
	}

    if(!IS_SAME_ORGANIZATION(ch, victim) && ch->pcdata->rank != RANK_GOD  )
	{	send_to_char("They aren't in your organization!\n\r",ch); 
		return; 
	}

	if( ch->pcdata->rank <= victim->pcdata->rank )
	{	send_to_char("You cannot exalt them.\n\r", ch );
		return;
	}

	if(!IS_IMMORTAL(ch) && ch->pcdata->rank <= RANK_PRIEST && victim->pcdata->rank >= RANK_BISHOP )
	{	send_to_char("You cannot exalt them.\n\r",ch);
		return;
	}

	if(victim->pcdata->rank == RANK_DEITY && ch->pcdata->rank != RANK_GOD )
	{	send_to_char("You cannot exalt to God Rank.\n\r",ch);
		return;
	}
	if(victim->pcdata->rank == RANK_GOD )
	{	send_to_char("They cannot get any higher!\n\r",ch);
		return;
	}

	victim->pcdata->rank++;
	printf_to_char(ch, "%s has been exalted to %s.\n\r", victim->name, orgrank_table[victim->pcdata->rank].name );
	act_new(victim->pcdata->organization->pmt_msg, victim, NULL, NULL, TO_CHAR, POS_SLEEPING);
	return;
}