Example #1
0
void do_afk ( CHAR_DATA *ch, char *argument)
{
    // unswitched mobs can't be afk
    if (IS_UNSWITCHED_MOB(ch)) {
	send_to_char("No.\n\r", ch);
        return;
    }

    if (!IS_NULLSTR(argument)) {
    // so you can change your afk message without turning afk off
	REMOVE_BIT(ch->act, PLR_AFK);
    }

    if (IS_SET(ch->act, PLR_AFK)) {
       act("$n has returned from being AFK.",ch,NULL,NULL,NULL,NULL,TO_ROOM,SENSE_SIGHT);
       send_to_char("AFK mode removed.\n\r", ch);
       REMOVE_BIT(ch->act, PLR_AFK);
    } else {
	if(IS_NULLSTR(argument)) {
	    act("$n has gone AFK.",ch,NULL,NULL,NULL,NULL,TO_ROOM,SENSE_SIGHT);
	    send_to_char( "You are now in AFK mode.\n\r", ch);
	} else {
	    act("$n has gone AFK ($t).",ch,NULL,NULL,argument,NULL,TO_ROOM,SENSE_SIGHT);
	    send_to_char( "You are now in AFK mode.\n\r", ch);
	}
	SET_BIT(ch->act, PLR_AFK);
    }
}
Example #2
0
void confirm_material(const char *name) {
	MAT_TYPE *mat, *mat_next;
	
	if(IS_NULLSTR(name))
		return;
	
	// materials that are '0' are NULL
	if(is_number(name))
		return;
	
	for(mat = mat_list; mat; mat = mat_next) {
		mat_next = mat->next;

		if(IS_NULLSTR(mat->name))
			continue;

		if(!str_cmp(mat->name, name))
			return;
	}
	
	matValue++;
	mat = new_mat();

	mat->name = str_dup(name);
	mat->assignedValue = matValue;

	mat->next = mat_list;
	mat_list = mat;

	return;
}
Example #3
0
ConfigBlock *
configblock_new (Config * c, const gchar * tag)
{
    /* No NULL tags. */
    if (IS_NULLSTR (tag)) return NULL;
    return configblock_object_init (c, tag);
}
Example #4
0
/* does aliasing and other fun stuff */
void substitute_alias(DESCRIPTOR_DATA *d, char *argument)
{
	CHAR_DATA *ch;
	char buf[MSL]={'\0'};
	char prefix[MAX_INPUT_LENGTH],name[MAX_INPUT_LENGTH];
	char *point;
	int alias;

	ch = d->original ? d->original : d->character;

	/* check for prefix */
	if (!IS_NULLSTR(ch->prefix) && str_prefix("prefix",argument))
	{
		if (strlen(ch->prefix) + strlen(argument) > MAX_INPUT_LENGTH)
			send_to_char("Line to long, prefix not processed.\r\n",ch);
		else
		{
			sprintf(prefix,"%s %s",ch->prefix,argument);
			argument = prefix;
		}
	}

	if (IS_NPC(ch) || ch->pcdata->alias[0] == NULL
		||	!str_prefix("alias",argument) || !str_prefix("una",argument) 
		||  !str_prefix("prefix",argument)) 
	{
		interpret(d->character,argument);
		return;
	}

	strcpy(buf,argument);

	for (alias = 0; alias < MAX_ALIAS; alias++)	 /* go through the aliases */
	{
		if (ch->pcdata->alias[alias] == NULL)
			break;

		if (!str_prefix(ch->pcdata->alias[alias],argument))
		{
			point = one_argument(argument,name);
			if (!strcmp(ch->pcdata->alias[alias],name))
			{
				buf[0] = '\0';
				strcat(buf,ch->pcdata->alias_sub[alias]);
				strcat(buf," ");
				strcat(buf,point);

				if (strlen(buf) > MAX_INPUT_LENGTH - 1)
				{
					send_to_char(
						"Alias substitution too long. Truncated.\r\n",ch);
					buf[MAX_INPUT_LENGTH -1] = '\0';
				}
				break;
			}
		}
	}
	interpret(d->character,buf);
}
void mpedit( CHAR_DATA *ch, char *argument)
{
    MPROG_CODE *pMcode;
    char arg[MAX_INPUT_LENGTH]={'\0'};
    char command[MAX_INPUT_LENGTH]={'\0'};
    int cmd = 0;
    AREA_DATA *ad;

    smash_tilde(argument);
    strncpy(arg, argument, sizeof(arg));
    argument = one_argument( argument, command);

    EDIT_MPCODE(ch, pMcode);

    if (pMcode)
    {
	ad = get_vnum_area( pMcode->vnum );

	if ( ad == NULL ) /* ??? */
	{
		edit_done(ch);
		return;
	}

	if ( !IS_BUILDER(ch, ad) )
	{
		send_to_char("MPEdit: Insufficient security to modify code.\n\r", ch);
		edit_done(ch);
		return;
	}
    }

    if (IS_NULLSTR(command))
    {
        mpedit_show(ch, argument);
        return;
    }

    if (!str_cmp(command, "done") )
    {
        edit_done(ch);
        return;
    }

    for (cmd = 0; mpedit_table[cmd].name != NULL; cmd++)
    {
	if (!str_prefix(command, mpedit_table[cmd].name) )
	{
		if ((*mpedit_table[cmd].olc_fun) (ch, argument) && pMcode)
			if ((ad = get_vnum_area(pMcode->vnum)) != NULL)
				SET_BIT(ad->area_flags, AREA_CHANGED);
		return;
	}
    }

    interpret(ch, arg);

    return;
}
Example #6
0
MAT_TYPE *find_mat(const char *name) {
	MAT_TYPE *mat, *mat_next;
	
	if(IS_NULLSTR(name))
		return NULL;
	
	for(mat = mat_list; mat; mat = mat_next) {
		mat_next = mat->next;
		
		if(IS_NULLSTR(mat->name))
			continue;
		
		if(!str_cmp(mat->name, name))
			return mat;
	}
	return NULL;
}
Example #7
0
ConfigVector *
configvector_new (ConfigRow * row, const gchar * tag)
{
    ASSERT (row != NULL);

    /* No NULL Tags. */
    if (IS_NULLSTR (tag)) return NULL;
    return configvector_object_init (row, tag);
}
void do_mpedit(CHAR_DATA *ch, char *argument)
{
    MPROG_CODE *pMcode;
    char command[MAX_INPUT_LENGTH]={'\0'};

    argument = one_argument(argument, command);

    if( is_number(command) )
    {
	int vnum = atoi(command);
	AREA_DATA *ad;

	if ( (pMcode = get_mprog_index(vnum)) == NULL )
	{
		send_to_char("MPEdit : That vnum does not exist.\n\r",ch);
		return;
	}

	ad = get_vnum_area(vnum);

	if ( ad == NULL )
	{
		send_to_char( "MPEdit : That vnum has not been assigned to an area.\n\r", ch );
		return;
	}

	if ( !IS_BUILDER(ch, ad) )
	{
		send_to_char("MPEdit : You do not have access to that area.\n\r", ch );
		return;
	}

	ch->desc->pEdit		= (void *)pMcode;
	ch->desc->editor	= ED_MPCODE;

	return;
    }

    if ( !str_cmp(command, "create") )
    {
	if (IS_NULLSTR(argument))
	{
		send_to_char( "Syntax : mpedit create [vnum]\n\r", ch );
		return;
	}

	mpedit_create(ch, argument);
	return;
    }

    send_to_char( "Syntax : mpedit [vnum]\n\r", ch );
    send_to_char( "         mpedit create [vnum]\n\r", ch );

    return;
}
Example #9
0
static ConfigPair *
configpair_object_init (ConfigRow * row,
                        const gchar * key,
                        const gchar * value)
{
    ASSERT (row != NULL);
    ASSERT (!IS_NULLSTR (key));

    ConfigPair * pair = NEW (ConfigPair);

    /* Members */
    pair->row = row;
    pair->key = g_strdup (key);
    pair->next = NULL;
    pair->value = (!IS_NULLSTR (value)) ? g_strdup (value) : g_strdup ("");

    /* Methods */
    pair->destroy = configpair_method_destroy;

    DOUBLE_LINK (row->pair_head, row->pair_tail, pair);
    return pair;
}
Example #10
0
void save_group( FILE *fp, struct group_type *group )
{
	int i;

	fprintf( fp, "%s~\n", CHECKNULLSTR(group->name) );

	for ( i = 0; i < MAX_CLASS; ++i )
		fprintf( fp, "%d ", group->rating[i] );
	fprintf( fp, "\n" );
	
	for ( i = 0; i < MAX_IN_GROUP && !IS_NULLSTR(group->spells[i]); ++i )
		fprintf( fp, "%s~\n", CHECKNULLSTR(group->spells[i]) );

	fprintf( fp, "End~\n\n" );
}
Example #11
0
static ConfigBlock *
config_method_get_block (Config * cfg, const gchar * block)
{
    ASSERT (cfg != NULL);

    if (!IS_NULLSTR (block))
    {
        ITERATE_BEGIN (ConfigBlock, cfg->block_head);
        {
            if (!strcmp (it->tag, block))
                return it;
        }
        ITERATE_END ();
    }
    return NULL;
}
Example #12
0
static ConfigRow *
configblock_method_get_row (ConfigBlock * block, const gchar * row)
{
    ASSERT (block != NULL);

    if (!IS_NULLSTR (row))
    {
        ITERATE_BEGIN (ConfigRow, block->row_head);
        {
            if (!strcmp (it->tag, row))
                return it;
        }
        ITERATE_END ();
    }
    return NULL;
}
Example #13
0
static ConfigPair *
configrow_method_get_pair (ConfigRow * row, const gchar * key)
{
    ASSERT (row != NULL);

    if (!IS_NULLSTR (key))
    {
        ITERATE_BEGIN (ConfigPair, row->pair_head);
        {
            if (!strcmp (it->key, key))
                return it;
        }
        ITERATE_END();
    }
    return NULL;
}
Example #14
0
static gint
config_method_save (Config * c, const gchar * filename)
{
    ASSERT (c != NULL);

    if (IS_NULLSTR (filename)) return FALSE;

    FILE * fp = NULL;
    if ((fp = fopen (filename, "w")) == NULL)
    {
        /* STUB: log me? */
        return FALSE;
    }

    FCLOSE (fp);
    return TRUE;
}
Example #15
0
/* Area Interpreter, called by do_aedit. */
void matedit( CHAR_DATA *ch, char *argument )
{
    MAT_TYPE *pMat;
    char command[MAX_INPUT_LENGTH];
    char arg[MAX_INPUT_LENGTH];
    int  cmd;

    EDIT_MAT(ch, pMat);
    smash_tilde( argument );
    strcpy( arg, argument );
    argument = one_argument( argument, command );

    if ( !str_cmp(command, "done") )
    {
    	// save our materials
    	save_materials();
    	send_to_char("Materials Saved to disk.\n\r", ch);
		edit_done( ch );
		return;
    }

    if ( IS_NULLSTR(command) )
    {
		matedit_show( ch, argument );
		return;
    }

    /* Search Table and Dispatch Command. */
    for ( cmd = 0; matedit_table[cmd].name != NULL; cmd++ )
    {
	if ( !str_prefix( command, matedit_table[cmd].name ) )
	{
	    if ( (*matedit_table[cmd].olc_fun) ( ch, argument ) )
	    {
			return;
	    }
	    else
			return;
	}
    }

    /* Default to Standard Interpreter. */
    interpret( ch, arg );
    return;
}
Example #16
0
void do_backstab( CHAR_DATA *ch, char *argument )
{
	char arg[MIL]={'\0'};
	CHAR_DATA *victim;
	/*OBJ_DATA *obj;*/

	one_argument( argument, arg );

	if (IS_NULLSTR(arg))
	{
		send_to_char("Backstab whom?\n\r",ch);
		return;
	}

	if (ch->fighting != NULL)
	{
		send_to_char("You're facing the wrong end.\n\r",ch);
		return;
	}

	else if ((victim = get_char_room(ch,arg)) == NULL)
	{
		send_to_char("They aren't here.\n\r",ch);
		return;
	}

	if ( victim == ch )
	{
		send_to_char( "How can you sneak up on yourself?\n\r", ch );
		return;
	}

	WAIT_STATE( ch, skill_table[gsn_backstab].beats );
	if ( number_percent( ) < get_skill(ch,gsn_backstab)
			|| ( get_skill(ch,gsn_backstab) >= 2 && !IS_AWAKE(victim) ) )
	{
		multi_hit( ch, victim, gsn_backstab );
	}
	else
	{
		damage( ch, victim, 0, gsn_backstab,DAM_NONE,TRUE,0,-1);
	}

	return;
}
Example #17
0
void do_gedit(CHAR_DATA *ch, char *argument)
{
    struct group_type *pGroup;
    char command[MSL];
    int group;

    if ( IS_NPC(ch) )
    	return;

    if ( IS_NULLSTR(argument) )
    {
    	send_to_char( "Sintaxis : GEdit [grupo]\n\r", ch );
    	return;
    }

    if (ch->pcdata->security < 5)
    {
    	send_to_char( "GEdit : Insuficiente seguridad para editar grupos.\n\r", ch );
    	return;
    }

    argument	= one_argument( argument, command );

/*  if ( !str_cmp( command, "new" ) )
    {
	if ( gedit_new(ch, argument) )
		save_groups();
	return;
    } */

    if ( (group = group_lookup(command)) == -1 )
    {
    	send_to_char( "GEdit : Grupo no existe.\n\r", ch );
    	return;
    }

    pGroup = &group_table[group];

    ch->desc->pEdit=(void *)pGroup;
    ch->desc->editor= ED_GROUP;

    return;
}
Example #18
0
static Config *
config_object_init (const gchar * filename)
{
    Config * c = NEW (Config);

    /* Members */
    c->filename = (!IS_NULLSTR (filename)) ? g_strdup (filename) : g_strdup ("");
    c->block_head = c->block_tail = NULL;

    /* Methods */
    c->open = config_method_open;
    c->save = config_method_save;
    c->load = config_method_load;
    c->close = config_method_destroy;
    c->get_vector = config_method_get_vector;
    c->get_row = config_method_get_row;
    c->get_block = config_method_get_block;
    c->get_pair = config_method_get_pair;

    return c;
}
Example #19
0
static ConfigRow *
configrow_object_init (ConfigBlock * block, const gchar * tag)
{
    if (IS_NULLSTR (tag)) return NULL;

    ConfigRow * row = NEW (ConfigRow);

    /* Members */
    row->block = block;
    row->tag = g_strdup (tag);
    row->next = NULL;
    row->vector_head = row->vector_tail = NULL;
    row->pair_head = row->pair_tail = NULL;

    /* Methods */
    row->parse = configrow_method_parse;
    row->destroy = configrow_method_destroy;
    row->get_pair = configrow_method_get_pair;
    row->get_vector = configrow_method_get_vector;

    SINGLE_LINK (ConfigRow, block->row_head, block->row_tail, row);
    return row;
}
Example #20
0
/* Entry point for editing obj_index_data. */
void do_matedit( CHAR_DATA *ch, char *argument )
{
    char arg1[MSL]={'\0'};

    if ( IS_NPC(ch) )
	return;

    argument = one_argument( argument, arg1 );

    if ( find_mat(arg1) )
    {
	ch->desc->pEdit = (void *)find_mat(arg1);
	ch->desc->editor = ED_MAT;
	return;
    }
    else
    {
	if ( !str_cmp( arg1, "create" ) )
	{
		if(find_mat(argument)) {
			send_to_char("That material already exists!\n\r", ch);
			return;
		}
	    if ( IS_NULLSTR(argument))
	    {
		send_to_char( "Syntax:  edit material create [name]\n\r", ch );
		return;
	    }

		matedit_create(ch, argument);
	    return;
	}
    }

    send_to_char( "MATEdit:  There is no default material to edit.\n\r", ch );
    return;
}
Example #21
0
static ConfigVector *
configrow_method_get_vector (ConfigRow * row, const gchar * key)
{
    ASSERT (row != NULL);

    if (!IS_NULLSTR (key))
    {
        ConfigPair * pair = row->get_pair (row, key);
        if (IS_NULL (pair))
            return NULL;

        /* If we have already parsed it there is no reason to do it
        	a second time. Check existing linked list and return the
        	pointer if we have already allocated it. */
        ITERATE_BEGIN (ConfigVector, row->vector_head);
        {
            if (!strcmp (it->tag, key))
                return it;
        }
        ITERATE_END();

        ConfigVector * vec = configvector_new (row, pair->key);
        gchar buf[1024];
        gchar * p = NULL;
        gchar * q = pair->value;
        gchar * r = pair->value + strlen (pair->value);

        do {
            p = parse (q,&buf[0],1024,',');
            vec->add (vec, trim (&buf[0]));
            q = p + 1;
        } while (q < r);
        return vec;
    }
    return NULL;
}
Example #22
0
void do_slay( CHAR_DATA *ch, char *argument )
{
	CHAR_DATA *victim;
	char arg[MIL]={'\0'};

	one_argument( argument, arg );
	if ( IS_NULLSTR(arg) )
	{
		send_to_char( "Slay whom?\n\r", ch );
		return;
	}

	if ( ( victim = get_char_room( ch, arg ) ) == NULL )
	{
		send_to_char( "They aren't here.\n\r", ch );
		return;
	}

	if ( ch == victim )
	{
		send_to_char( "Suicide is a mortal sin.\n\r", ch );
		return;
	}

	if ( !IS_NPC(victim) && victim->trust >= get_trust(ch) )
	{
		send_to_char( "You failed.\n\r", ch );
		return;
	}

	act( "You slay $M in cold blood!",  ch, NULL, victim, TO_CHAR, 1 );
	act( "$n slays you in cold blood!", ch, NULL, victim, TO_VICT, 1 );
	act( "$n slays $N in cold blood!",  victim, NULL, ch, TO_NOTVICT, 0 );
	raw_kill( victim, TRUE );
	return;
}
Example #23
0
static gint
config_method_open (Config * c)
{
    ASSERT (c != NULL);

    if (IS_NULLSTR (c->filename))
        return FALSE;

    FILE * fp = NULL;
    if ((fp = fopen (c->filename, "r")) == NULL)
    {
        /* STUB: log this? */
        return FALSE;
    }

    gint result = c->load (c, fp);
    if (result == FALSE)
    {
        /* STUB: log me? */
    }

    FCLOSE (fp);
    return result;
}
Example #24
0
void do_heal(CHAR_DATA *ch, char *argument)
{
	CHAR_DATA *mob;
	char arg[MIL]={'\0'};
	int cost = 0;
	int sn = 0;
	SPELL_FUN *spell;
	char *words;	

	/* check for healer */
	for ( mob = ch->in_room->people; mob; mob = mob->next_in_room )
	{
		if ( IS_NPC(mob) && IS_SET(mob->act, ACT_IS_HEALER) )
			break;
	}
	
	if ( mob == NULL )
	{
		send_to_char( "You can't do that here.\n\r", ch );
		return;
	}

	one_argument(argument,arg);

	if (IS_NULLSTR(arg))
	{
		/* display price list */
		act("$N says 'I offer the following spells:'",ch,NULL,mob,TO_CHAR);
		send_to_char("  light: cure light wounds      10 gold\n\r",ch);
		send_to_char("  serious: cure serious wounds  15 gold\n\r",ch);
		send_to_char("  critic: cure critical wounds  25 gold\n\r",ch);
		send_to_char("  heal: healing spell	      50 gold\n\r",ch);
		send_to_char("  blind: cure blindness         20 gold\n\r",ch);
		send_to_char("  disease: cure disease         15 gold\n\r",ch);
		send_to_char("  poison:  cure poison	      25 gold\n\r",ch); 
		send_to_char("  uncurse: remove curse	      50 gold\n\r",ch);
		send_to_char("  refresh: restore movement      5 gold\n\r",ch);
		send_to_char("  mana:  restore mana	      10 gold\n\r",ch);
		send_to_char(" Type heal <type> to be healed.\n\r",ch);
		return;
	}

	if (!str_prefix(arg,"light"))
	{
		spell = spell_cure_light;
		sn    = skill_lookup("cure light");
		words = "judicandus dies";
		cost  = 1000;
	}

	else if (!str_prefix(arg,"serious"))
	{
		spell = spell_cure_serious;
		sn    = skill_lookup("cure serious");
		words = "judicandus gzfuajg";
		cost  = 1600;
	}

	else if (!str_prefix(arg,"critical"))
	{
		spell = spell_cure_critical;
		sn    = skill_lookup("cure critical");
		words = "judicandus qfuhuqar";
		cost  = 2500;
	}

	else if (!str_prefix(arg,"heal"))
	{
		spell = spell_heal;
		sn = skill_lookup("heal");
		words = "pzar";
		cost  = 5000;
	}

	else if (!str_prefix(arg,"blindness"))
	{
		spell = spell_cure_blindness;
		sn    = skill_lookup("cure blindness");
		words = "judicandus noselacri";		
		cost  = 2000;
	}

	else if (!str_prefix(arg,"disease"))
	{
		spell = spell_cure_disease;
		sn    = skill_lookup("cure disease");
		words = "judicandus eugzagz";
		cost = 1500;
	}

	else if (!str_prefix(arg,"poison"))
	{
		spell = spell_cure_poison;
		sn    = skill_lookup("cure poison");
		words = "judicandus sausabru";
		cost  = 2500;
	}

	else if (!str_prefix(arg,"uncurse") || !str_prefix(arg,"curse"))
	{
		spell = spell_remove_curse; 
		sn    = skill_lookup("remove curse");
		words = "candussido judifgz";
		cost  = 5000;
	}

	else if (!str_prefix(arg,"mana") || !str_prefix(arg,"energize"))
	{
		spell = NULL;
		sn = -1;
		words = "energizer";
		cost = 1000;
	}


	else if (!str_prefix(arg,"refresh") || !str_prefix(arg,"moves"))
	{
		spell =  spell_refresh;
		sn    = skill_lookup("refresh");
		words = "candusima"; 
		cost  = 500;
	}

	else 
	{
		act("$N says 'Type 'heal' for a list of spells.'", ch,NULL,mob,TO_CHAR);
		return;
	}

	if (cost > (ch->gold * 100 + ch->silver))
	{
		act("$N says 'You do not have enough gold for my services.'", ch,NULL,mob,TO_CHAR);
		return;
	}

	WAIT_STATE(ch,PULSE_VIOLENCE);

	deduct_cost(ch,cost);
	mob->gold += cost / 100;
	mob->silver += cost % 100;
	act("$n utters the words '$T'.",mob,NULL,words,TO_ROOM);

	if (spell == NULL)  /* restore mana trap...kinda hackish */
	{
		ch->mana += dice(2,8) + mob->level / 3;
		ch->mana = UMIN(ch->mana,ch->max_mana);
		send_to_char("A warm glow passes through you.\n\r",ch);
		return;
	}

	if (sn == -1)
		return;

	spell(sn,mob->level,mob,ch,TARGET_CHAR);
}
Example #25
0
/*****************************************************************************
 *	do_redit
 *
 *	entry level function into the room editor
 *****************************************************************************/
void do_redit(struct char_data *ch, const char *argument)
{
    struct room_index_data *room;
    char arg[MAX_STRING_LENGTH];

    if (IS_NPC(ch))
        return;

    argument = one_argument(argument, arg);
    room = ch->in_room;

    if (!str_cmp(arg, "reset")) { /* redit reset */
        if (!IS_BUILDER(ch, room->area)) {
            send_to_char("Insufficient security to edit rooms.\n\r", ch);
            return;
        }

        reset_room(room);
        send_to_char("Room reset.\n\r", ch);

        return;
    } else {
        if (!str_cmp(arg, "create")) {   /* redit create <vnum> */
            if (argument[0] == '\0' || parse_int(argument) == 0) {
                send_to_char("Syntax:  edit room create [vnum]\n\r", ch);
                return;
            }

            if (redit_create(ch, argument)) {
                ch->desc->editor = ED_ROOM;
                char_from_room(ch);
                char_to_room(ch, ch->desc->ed_data);
                SET_BIT(((struct room_index_data *)ch->desc->ed_data)->area->area_flags, AREA_CHANGED);
            }

            return;
        } else if (!str_cmp(arg, "clone")) {
            if (argument[0] == '\0') {
                send_to_char("Syntax:  edit room clone [new vnum] [existing vnum]\n\r", ch);
                return;
            }

            if (redit_create(ch, argument)) {
                argument = one_argument(argument, arg);
                ch->desc->editor = ED_ROOM;

                char_from_room(ch);
                char_to_room(ch, ch->desc->ed_data);

                SET_BIT(((struct room_index_data *)ch->desc->ed_data)->area->area_flags, AREA_CHANGED);
                redit_clone(ch, argument);
            }

            return;
        } else if (!IS_NULLSTR(arg)) {  /* redit <vnum> */
            room = get_room_index(parse_int(arg));

            if (!room) {
                send_to_char("REdit : room does not exist.\n\r", ch);
                return;
            }

            if (!IS_BUILDER(ch, room->area)) {
                send_to_char("REdit : insufficient security to edit rooms.\n\r", ch);
                return;
            }

            char_from_room(ch);
            char_to_room(ch, room);
        }
    }

    if (!IS_BUILDER(ch, room->area)) {
        send_to_char("REdit : Insufficient security to edit rooms.\n\r", ch);
        return;
    }

    ch->desc->ed_data = (void *)room;
    ch->desc->editor = ED_ROOM;

    return;
}
Example #26
0
void ban_site( CHAR_DATA *ch, char *argument )
{
	char date[ 50 ];
	struct tm *btime;
    char buf[ MAX_STRING_LENGTH ], buf2[ MAX_STRING_LENGTH ], buf3[ MAX_STRING_LENGTH ];
    char arg1[ MAX_INPUT_LENGTH ], arg2[ MAX_INPUT_LENGTH ], arg3[ MAX_INPUT_LENGTH ];
    char *name;
    BUFFER *buffer;
    BAN_DATA *pban, *prev;
    bool prefix = FALSE, suffix = FALSE;
    int type;

    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );
    argument = one_argument( argument, arg3 );

    if ( arg1[ 0 ] == '\0' )
    {
        if ( ban_list == NULL )
        {
            send_to_char( "Nie ma ¿adnych banów.\n\r", ch );
            return ;
        }
        buffer = new_buf();

        add_buf( buffer, "{CAdres                                       Kto        Typ{x\n\r" );
        for ( pban = ban_list;pban != NULL;pban = pban->next )
        {
            sprintf( buf2, "%s%s%s",
                     IS_SET( pban->ban_flags, BAN_PREFIX ) ? "*" : "",
                     pban->site,
                     IS_SET( pban->ban_flags, BAN_SUFFIX ) ? "*" : "" );

            btime = localtime( &pban->date_stamp );
            strftime( date, 20, "%d-%m-%Y %H:%M:%S", btime );

            if ( pban->period <= 0 )
                sprintf( buf3, "od %s na sta³e", date );
            else if ( pban->period == 1 )
                sprintf( buf3, "od %s na 1 dzieñ", date );
            else
                sprintf( buf3, "od %s na %d dni", date, pban->period );

            sprintf( buf, "{Y%-40s{x    %-10s %-7s\n\r{CCzas{x: %s\n\r{CPowód{x: %s\n\r",
                     buf2, pban->person,
                     IS_SET( pban->ban_flags, BAN_NEWBIES ) ? "newbies" :
                     IS_SET( pban->ban_flags, BAN_PERMIT ) ? "permit" :
                     IS_SET( pban->ban_flags, BAN_ALL ) ? "all"	: "",
                     buf3,
                     IS_NULLSTR(pban->reason) ? "nie podano" : pban->reason );
            add_buf( buffer, buf );
            if ( pban->next )
            add_buf( buffer, "\n\r" );
        }

        add_buf( buffer, "\n\rDodanie nowego bana:\n\r" );
        add_buf( buffer, "permban [*]<adres>[*] all|newbies|permit <ile dni> [<powod>]\n\r" );
        add_buf( buffer, "- podanie 0 przy liczbie dni oznacza ban na sta³e\n\r" );
        page_to_char( buf_string( buffer ), ch );
        free_buf( buffer );
        return ;
    }

    /* find out what type of ban */
    if ( !str_prefix( arg2, "permit" ) )
        type = BAN_PERMIT;
    else if ( !str_prefix( arg2, "newbies" ) )
        type = BAN_NEWBIES;
    else if ( !str_prefix( arg2, "all" ) )
        type = BAN_ALL;
    else
    {
        send_to_char( "Dopuszczalne typy bana to: all, newbies, permit.\n\r", ch );
        return ;
    }

    name = arg1;

    if ( name[ 0 ] == '*' )
    {
        prefix = TRUE;
        name++;
    }

    if ( name[ strlen( name ) - 1 ] == '*' )
    {
        suffix = TRUE;
        name[ strlen( name ) - 1 ] = '\0';
    }

    if ( strlen( name ) == 0 )
    {
        send_to_char( "Nie poda³e¶ adresu do zbanowania.\n\r", ch );
        return ;
    }

    if ( arg3[0] == '\0' || !is_number( arg3 ) )
    {
        send_to_char( "Podaj liczbê dni przez jak± ma trwaæ ban (0 - ca³y czas).\n\r", ch );
        return;
    }

    prev = NULL;
    for ( pban = ban_list; pban != NULL; prev = pban, pban = pban->next )
    {
        if ( !str_cmp( name, pban->site ) )
        {
            if ( prev == NULL )
                ban_list = pban->next;
            else
                prev->next = pban->next;
            free_ban( pban );
        }
    }

    pban = new_ban();
    pban->site   = str_dup( name );
    pban->person = str_dup( ch->name );
    pban->date_stamp = current_time;
    pban->period = UMAX( 0, atoi( arg3 ) );
    pban->reason = str_dup( argument );

    /* set ban type */
    pban->ban_flags = type;

    if ( prefix )
        SET_BIT( pban->ban_flags, BAN_PREFIX );
    if ( suffix )
        SET_BIT( pban->ban_flags, BAN_SUFFIX );

    pban->next = ban_list;
    ban_list = pban;
    save_bans();
    sprintf( buf, "Adres %s zosta³ dodany do listy banów.\n\r", pban->site );
    send_to_char( buf, ch );
    return ;
}
Example #27
0
void do_trip( CHAR_DATA *ch, char *argument )
{
    char arg[MIL]={'\0'};
    CHAR_DATA *victim;
    int chance;

    one_argument(argument,arg);

    if ( (chance = get_skill(ch,gsn_trip)) == 0
    ||   (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_TRIP))
    ||   (!IS_NPC(ch) 
	  && !(ch->ability[BRAWL].value > 0)))
    {
	send_to_char("Tripping?  What's that?\n\r",ch);
	return;
    }


    if (IS_NULLSTR(arg))
    {
	victim = ch->fighting;
	if (victim == NULL)
	{
	    send_to_char("But you aren't fighting anyone!\n\r",ch);
	    return;
 	}
    }

    else if ((victim = get_char_room(ch,arg)) == NULL)
    {
	send_to_char("They aren't here.\n\r",ch);
	return;
    }
    
    if (IS_AFFECTED(victim,AFF_FLYING))
    {
	act("$S feet aren't on the ground.",ch,NULL,victim,TO_CHAR,1);
	return;
    }

    if (victim->position < P_FIGHT)
    {
	act("$N is already down.",ch,NULL,victim,TO_CHAR,1);
	return;
    }

    if (victim == ch)
    {
	send_to_char("You fall flat on your face!\n\r",ch);
	WAIT_STATE(ch,2 * skill_table[gsn_trip].beats);
	act("$n trips over $s own feet!",ch,NULL,NULL,TO_ROOM,0);
	return;
    }

    if (IS_AFFECTED(ch,AFF_CHARM) && ch->master == victim)
    {
	act("$N is so great though!",ch,NULL,victim,TO_CHAR,1);
	return;
    }

    /* size */
    if (ch->size < victim->size)
        chance += (ch->size - victim->size) * 10;  /* bigger = harder to trip */

    /* dex */
    chance += get_curr_stat(ch,STAT_DEX);
    chance -= get_curr_stat(victim,STAT_DEX) * 3 / 2;

    /* now the attack */
    if (number_percent() < chance)
    {
	act("$n trips you and you go down!",ch,NULL,victim,TO_VICT,1);
	act("You trip $N and $N goes down!",ch,NULL,victim,TO_CHAR,1);
	act("$n trips $N, sending $M to the ground.",
	    ch,NULL,victim,TO_NOTVICT,0);

	DAZE_STATE(victim,2 * PULSE_VIOLENCE);
        WAIT_STATE(ch,skill_table[gsn_trip].beats);
	victim->position = P_REST;
	damage(ch,victim,number_range(2, 2 +  2 * victim->size),gsn_trip,
	    DAM_BASH,TRUE,0,-1);
    }
    else
    {
	damage(ch,victim,0,gsn_trip,DAM_BASH,TRUE,0,1);
	WAIT_STATE(ch,skill_table[gsn_trip].beats*2/3);
    } 
}
Example #28
0
void do_dirt( CHAR_DATA *ch, char *argument )
{
    char arg[MIL]={'\0'};
    CHAR_DATA *victim;
    int chance;

    one_argument(argument,arg);

    if ( (chance = get_skill(ch,gsn_dirt)) == 0
    ||   (IS_NPC(ch) && !IS_SET(ch->off_flags,OFF_KICK_DIRT))
    ||   (!IS_NPC(ch)
    &&    !(ch->ability[BRAWL].value > 0)))
    {
	send_to_char("You get your feet dirty.\n\r",ch);
	return;
    }

    if (IS_NULLSTR(arg))
    {
	victim = ch->fighting;
	if (victim == NULL)
	{
	    send_to_char("But you aren't in combat!\n\r",ch);
	    return;
	}
    }

    else if ((victim = get_char_room(ch,arg)) == NULL)
    {
	send_to_char("They aren't here.\n\r",ch);
	return;
    }

    if (IS_AFFECTED(victim,AFF_BLIND))
    {
	act("$E's already been blinded.",ch,NULL,victim,TO_CHAR,1);
	return;
    }

    if (victim == ch)
    {
	send_to_char("Very funny.\n\r",ch);
	return;
    }

    if (IS_AFFECTED(ch,AFF_CHARM) && ch->master == victim)
    {
	act("But $N is such a good friend!",ch,NULL,victim,TO_CHAR,1);
	return;
    }

    /* dexterity */
    chance += get_curr_stat(ch,STAT_DEX);
    chance -= 2 * get_curr_stat(victim,STAT_DEX);

    /* sloppy hack to prevent false zeroes */
    if (chance % 5 == 0)
	chance += 1;

    /* terrain */

    switch(ch->in_room->sector_type)
    {
	case(SECT_INSIDE):		chance -= 20;	break;
	case(SECT_CITY):		chance -= 10;	break;
	case(SECT_STREET):		chance -= 10;	break;
	case(SECT_FIELD):		chance +=  5;	break;
	case(SECT_FOREST):				break;
	case(SECT_HILLS):				break;
	case(SECT_MOUNTAIN):		chance -= 10;	break;
	case(SECT_WATER_SWIM):		chance  =  0;	break;
	case(SECT_WATER_NOSWIM):	chance  =  0;	break;
	case(SECT_AIR):			chance  =  0;  	break;
	case(SECT_DESERT):		chance += 10;   break;
    }

    if (chance == 0)
    {
	send_to_char("There isn't any dirt to kick.\n\r",ch);
	return;
    }

    /* now the attack */
    if (number_percent() < chance)
    {
	AFFECT_DATA af;
	act("$n is blinded by the dirt in $s eyes!",victim,NULL,NULL,TO_ROOM,0);
	act("$n kicks dirt in your eyes!",ch,NULL,victim,TO_VICT,1);
        damage(ch,victim,number_range(2,5),gsn_dirt,DAM_NONE,FALSE,0,-1);
	send_to_char("You can't see a thing!\n\r",victim);
	WAIT_STATE(ch,skill_table[gsn_dirt].beats);

	af.where	= TO_AFFECTS;
	af.type 	= gsn_dirt;
	af.duration	= 15;
	af.location	= APPLY_PER;
	af.modifier	= -4;
	af.bitvector 	= AFF_BLIND;

	affect_to_char(victim,&af);
    }
    else
    {
	damage(ch,victim,0,gsn_dirt,DAM_NONE,TRUE,0,-1);
	WAIT_STATE(ch,skill_table[gsn_dirt].beats);
    }
}
Example #29
0
void do_bash( CHAR_DATA *ch, char *argument )
{
    char arg[MIL]={'\0'};
    CHAR_DATA *victim;
    int chance = 0;

    one_argument(argument,arg);
 
    if (IS_NULLSTR(arg))
    {
	victim = ch->fighting;
	if (victim == NULL)
	{
	    send_to_char("But you aren't fighting anyone!\n\r",ch);
	    return;
	}
    }

    else if ((victim = get_char_room(ch,arg)) == NULL)
    {
	send_to_char("They aren't here.\n\r",ch);
	return;
    }

    if (victim->position < P_FIGHT)
    {
	act("You'll have to let $M get back up first.",
	    ch,NULL,victim,TO_CHAR,1);
	return;
    }

    if (victim == ch)
    {
	send_to_char("You try to bash your brains out, but fail.\n\r",ch);
	return;
    }

    if (IS_AFFECTED(ch,AFF_CHARM) && ch->master == victim)
    {
	act("But $N is your friend!",ch,NULL,victim,TO_CHAR,1);
	return;
    }

    /* size */
    if (ch->size < victim->size)
	chance += (ch->size - victim->size) * 15;
    else
	chance += (ch->size - victim->size) * 10; 

    /* stats */
    chance += get_curr_stat(ch,STAT_STR);
    chance -= get_curr_stat(victim,STAT_DEX);

    if (!IS_NPC(victim) 
	&& chance < get_skill(victim,gsn_dodge) )
    {	
	chance -= 3 * (get_skill(victim,gsn_dodge) - chance);
    }

    /* now the attack */
    if (number_percent() < chance )
    {
    
	act("$n sends you sprawling with a powerful bash!",
		ch,NULL,victim,TO_VICT,1);
	act("You slam into $N, and send $M flying!",ch,NULL,victim,TO_CHAR,0);
	act("$n sends $N sprawling with a powerful bash.",
		ch,NULL,victim,TO_NOTVICT,0);

	DAZE_STATE(victim, 3 * PULSE_VIOLENCE);
	WAIT_STATE(ch,skill_table[gsn_bash].beats);
	victim->position = P_REST;
	damage(ch,victim,number_range(2,2 + 2 * ch->size + chance/20),gsn_bash,
	    DAM_BASH,FALSE, 0, -1);
	
    }
    else
    {
	damage(ch,victim,0,gsn_bash,DAM_BASH,FALSE, 0, -1);
	act("You fall flat on your face!",
	    ch,NULL,victim,TO_CHAR,1);
	act("$n falls flat on $s face.",
	    ch,NULL,victim,TO_NOTVICT,0);
	act("You evade $n's bash, causing $m to fall flat on $s face.",
	    ch,NULL,victim,TO_VICT,1);
	ch->position = P_REST;
	damage(ch,ch,number_range(2,2 + 2 * ch->size + chance/20),gsn_bash,
	    DAM_BASH,FALSE, 0, -1);
	WAIT_STATE(ch,skill_table[gsn_bash].beats * 3/2); 
    }
}
Example #30
0
/*
 * Duplicates a piece of parchment for a cost at a scribe.
 */
void do_duplicate(CHAR_DATA *ch, char *argument)
{
    CHAR_DATA *mob;
    OBJ_DATA *obj;
    OBJ_DATA *clone_obj;
    int cost = 1000; // 10 gold

    if ((mob = find_mob_by_act(ch, ACT_SCRIBE)) == NULL)
    {
        send_to_char("You must find a scribe in order to duplicate pieces of parchment.\r\n", ch);
        return;
    }

    // Not with people that can't be seen.. this will depend on the mob.. if the mob has detect hidden
    // or detect invis they will see most people unless they are in another for of non-detect, etc.
    if (!can_see(mob, ch))
    {
        act("{x$N says '{gI don't trade with folks I can't see, please make yourself 'visible'.'{x", ch, NULL, mob, TO_CHAR);
        return;
    }

    // No argument was sent, tell them how much it costs
    if (IS_NULLSTR(argument))
    {
        act("{x$N says '{gI will duplicate a parchment for 10 gold pieces.{x'", ch, NULL, mob, TO_CHAR);
        act("{x$N says '{gYou may ask me to 'duplicate' a specific parchment in your possession.{x'", ch, NULL, mob, TO_CHAR);
        return;
    }

    if (cost > (ch->gold * 100 + ch->silver))
    {
        act("{x$N says '{gI apologize, but you do not appear to have enough wealth for my services.'{x", ch, NULL, mob, TO_CHAR);
        return;
    }

    if ((obj = get_obj_carry(ch, argument, ch)) == NULL)
    {
        act("{x$N says '{gI do not see that you have that item.'{x", ch, NULL, mob, TO_CHAR);
        return;
    }

    // Make sure the item is a piece of parchment.
    if (obj->item_type != ITEM_PARCHMENT)
    {
        act("{x$N says '{gThat is not a piece of parchment.'{x", ch, NULL, mob, TO_CHAR);
        return;
    }

    // Only copy the parchment if it has been written to.
    if (obj->value[1] == FALSE)
    {
        act("{x$N says '{gThat parchment has not been written to yet, please provide one that has.'{x", ch, NULL, mob, TO_CHAR);
        return;
    }

    // Deduct the cost and then clone the parchment.
    deduct_cost(ch, cost);
    mob->gold += cost / 100;
    mob->silver += cost % 100;

    clone_obj = create_object(obj->pIndexData);
    clone_object(obj, clone_obj);
    obj_to_char(clone_obj, ch);

    act("$N dips his quill in ink and begins writing on a piece of parchment.", ch, NULL, mob, TO_ROOM);
    act("$N hands you parchment with the identical text of your original.", ch, NULL, mob, TO_CHAR);

    // A little lag
    WAIT_STATE(ch, PULSE_VIOLENCE);
}