Example #1
0
/*								-Thoric
 * Display your current exp, level, and surrounding level exp requirements
 */
void do_level( CHAR_DATA * ch, const char *argument )
{
	char buf[MAX_STRING_LENGTH];
	char buf2[MAX_STRING_LENGTH];
	int x, lowlvl, hilvl;

	if ( ch->level == 1 )
		lowlvl = 1;
	else
		lowlvl = UMAX( 2, ch->level - 5 );
	hilvl = URANGE( ch->level, ch->level + 5, MAX_LEVEL );
	set_char_color( AT_SCORE, ch );
	ch_printf( ch, "\r\nExperience required, levels %d to %d:\r\n______________________________________________\r\n\r\n", lowlvl, hilvl );
	snprintf( buf, MAX_STRING_LENGTH, " exp  (Current: %12s)", num_punct( ch->exp ) );
	snprintf( buf2, MAX_STRING_LENGTH, " exp  (Needed:  %12s)", num_punct( exp_level( ch, ch->level + 1 ) - ch->exp ) );
	for ( x = lowlvl; x <= hilvl; x++ )
		ch_printf( ch, " (%2d) %12s%s\r\n", x, num_punct( exp_level( ch, x ) ), ( x == ch->level ) ? buf : ( x == ch->level + 1 ) ? buf2 : " exp" );
	send_to_char( "______________________________________________\r\n", ch );
}
Example #2
0
/*								-Thoric
 * Display your current exp, level, and surrounding level exp requirements
 */
void do_level( CHAR_DATA * ch, const char *argument )
{
   int ability;

   for( ability = 0; ability < MAX_ABILITY; ability++ )
      if( ability != FORCE_ABILITY || ch->skill_level[FORCE_ABILITY] > 1 )
         ch_printf( ch, "%-15s   Level: %-3d   Max: %-3d   Exp: %-10ld   Next: %-10ld\r\n",
                    ability_name[ability], ch->skill_level[ability], max_level( ch, ability ), ch->experience[ability],
                    exp_level( ch->skill_level[ability] + 1 ) );
      else
         ch_printf( ch, "%-15s   Level: %-3d   Max: ???   Exp: ???          Next: ???\r\n",
                    ability_name[ability], ch->skill_level[ability], ch->experience[ability] );
}
Example #3
0
void do_sell( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];
    char arg[MAX_INPUT_LENGTH];
    CHAR_DATA *keeper;
    OBJ_DATA *obj;
    int cost;

    one_argument( argument, arg );

    if ( arg[0] == '\0' )
    {
	send_to_char( "Sell what?\n\r", ch );
	return;
    }

    if ( ( keeper = find_keeper( ch ) ) == NULL )
	return;

    if ( ( obj = get_obj_carry( ch, arg ) ) == NULL )
    {
	act( AT_TELL, "$n tells you 'You don't have that item.'", keeper, NULL, ch, TO_VICT );
	ch->reply = keeper;
	return;
    }
    /* Bug report and solution thanks to [email protected] */
    if ( !can_see_obj( keeper, obj) ) 
    {
        send_to_char("What are you trying to sell me? I don't buy thin air!\n\r", ch );
        return;
    }


    if ( !can_drop_obj( ch, obj ) )
    {
	send_to_char( "You can't let go of it!\n\r", ch );
	return;
    }

    if ( obj->timer > 0 )
    {
	act( AT_TELL, "$n tells you, '$p is depreciating in value too quickly...'", keeper, obj, ch, TO_VICT );
	return;
    }

    if ( ( cost = get_cost( ch, keeper, obj, FALSE ) ) <= 0 )
    {
	act( AT_ACTION, "$n looks uninterested in $p.", keeper, obj, ch, TO_VICT );
	return;
    }

    if ( cost > keeper->gold )
    {
	act( AT_TELL, "$n makes a credit transaction.", keeper, obj, ch, TO_VICT );
        lower_economy( ch->in_room->area, cost-keeper->gold );
    }
    
    separate_obj( obj );
    act( AT_ACTION, "$n sells $p.", ch, obj, NULL, TO_ROOM );
    sprintf( buf, "You sell $p for %d credit%s.",
	cost, cost == 1 ? "" : "s" );
    act( AT_ACTION, buf, ch, obj, NULL, TO_CHAR );
    ch->gold     += cost;
    keeper->gold -= cost;
    if ( keeper->gold < 0 )
	keeper->gold = 0;

    if ( obj->item_type == ITEM_TRASH )
	extract_obj( obj );
    else  if ( IS_SET( obj->extra_flags , ITEM_CONTRABAND) )
   {
       long ch_exp;
       
       ch_exp = UMIN( obj->cost*10 , ( exp_level( ch->skill_level[SMUGGLING_ABILITY]+1) - exp_level( ch->skill_level[SMUGGLING_ABILITY])  ) / 10  );
       ch_printf( ch, "You receive %ld smuggling experience for unloading your contraband.\n\r " , ch_exp );
       gain_exp( ch, ch_exp , SMUGGLING_ABILITY );
       if ( obj->item_type == ITEM_SPICE || obj->item_type == ITEM_RAWSPICE )
	 extract_obj( obj );
       else
       {
         REMOVE_BIT( obj->extra_flags , ITEM_CONTRABAND );
         obj_from_char( obj );
         obj_to_char( obj, keeper );
       }
   }
    else if ( obj->item_type == ITEM_SPICE || obj->item_type == ITEM_RAWSPICE )
	extract_obj( obj );
    else
    {
	obj_from_char( obj );
	obj_to_char( obj, keeper );
    }

    return;
}
Example #4
0
/*
 * New score command by Haus
 */
void do_score( CHAR_DATA * ch, const char *argument )
{
   AFFECT_DATA *paf;
   int iLang, x;

   if( IS_NPC( ch ) )
   {
      do_oldscore( ch, argument );
      return;
   }

   ch_printf( ch, "\r\n&zScore for %s.\r\n", ch->pcdata->title );
   if( get_trust( ch ) != ch->top_level )
      ch_printf( ch, "You are trusted at level %d.\r\n", get_trust( ch ) );

   send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch );
   ch_printf( ch, "&r|&zRace      &r:&W %-3d&z year old %-10.10s      Log In&r:&W %-25.24s&r|\r\n",
              get_age( ch ), capitalize( get_race( ch ) ), ctime( &( ch->logon ) ) );
   ch_printf( ch, "&r|&zHitroll   &r: &W%-5d    &zDamroll&r:&W %-5d      &zSaved &r:&W %-25.24s&r|\r\n",
              GET_HITROLL( ch ), GET_DAMROLL( ch ), ch->save_time ? ctime( &( ch->save_time ) ) : "no" );
   ch_printf( ch, "&r|&zGlobal AC &r: &W%-5d    &zEvasion&r: &W%-5d      &zTime  &r: &W%-25.24s&r|\r\n",
              GET_ARMOR( ch ), GET_EVASION( ch ), ctime( &current_time ) );
   ch_printf( ch, "&r|&zAlign     &r: &W%-5d    &zWimpy  &r:&W %-3d                                         &r|\r\n",
              ch->alignment, ch->wimpy  );
   send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch );
   send_to_char( " &zBarehand Damtypes&r:", ch );
   for( x = 0; x < MAX_DAMTYPE; x++ )
      if( xIS_SET( ch->damtype, x ) )
         ch_printf( ch, " &W%s&r,", d_type[x] );
   send_to_char( "\r\n", ch );
   ch_printf( ch, " &r&zHit Points&r: &W%d&z of&W %d &z    Move&r: &W%d&z of&W %d   &z  Force&r:&W %d&z of&W %d&z\r\n",
                 ch->hit, ch->max_hit, ch->move, ch->max_move, ch->mana, ch->max_mana );

   ch_printf( ch, " &zStr&r: &W%2d  &zDex&r:&W %2d  &zCon&r: &W%2d  &zAgi&r:&W %2d &z Int&r:&W %2d  &zWis&r:&W %2d&z  Cha&r: &w%2d&z\r\n",
              get_curr_str( ch ), get_curr_dex( ch ), get_curr_con( ch ), get_curr_agi( ch ), get_curr_int( ch ), get_curr_wis( ch ),
              get_curr_cha( ch ) );


   send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch );

   {
      int ability;

      for( ability = 0; ability < MAX_ABILITY; ability++ )
      {
          if( ch->skill_level[ability] < 1 )
             continue;
          ch_printf( ch, " &W%-15s   &zLevel&r: &W%-3d   &zMax&r: &W%-3d   &zExp&r: &W%-10ld   &zNext&r: &W%-10ld&z\r\n",
                     ability_name[ability], ch->skill_level[ability], max_level( ch, ability ), ch->experience[ability],
                     exp_level( ch->skill_level[ability] + 1 ) );
          if( ability == COMBAT_ABILITY )
          {
             for( x = 0; x < MAX_DISCIPLINE; x++ )
                if( ch->known_disciplines[x] != NULL )
                   ch_printf( ch, " - %s%s&g\r\n",
                              is_discipline_set( ch, ch->known_disciplines[x] ) ? "&z" : "&W",
                              ch->known_disciplines[x]->name );
          }
      }
   }

   send_to_char( "&r----------------------------------------------------------------------------\r\n", ch );
   send_to_char( "&r|&zDamage &zType      &r|    &zPenetrate     &r|      &zResist      &r|     &zPotency      &r|\r\n", ch );
   send_to_char( "&r----------------------------------------------------------------------------\r\n", ch );
   for( x = 0; x < MAX_DAMTYPE; x++ )
      ch_printf( ch, "&r|%-19.19s&r:       &W%3d        &r|       &W%3d        &r|       &W%3d        &r|\r\n",
             d_type_score[x], ch->penetration[x], ch->resistance[x], ch->damtype_potency[x] );
   send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch );

   ch_printf( ch, "&zCREDITS&r:&W %-10d   &zBANK&r: &W%-10d    &zPkills&r: &W%-5.5d   &zMkills&r:&W %-5.5d\r\n",
              ch->gold, ch->pcdata->bank, ch->pcdata->pkills, ch->pcdata->mkills );

   ch_printf( ch, "&zWeight&r: &W%5.5d &r(&zmax&W %7.7d&r)&z    Items&r: &W%5.5d &r(&zmax&W %5.5d&r)\r\n",
              ch->carry_weight, can_carry_w( ch ), ch->carry_number, can_carry_n( ch ) );

   ch_printf( ch, "&zPager&r: &r(&W%c&r)&W %3d &z  AutoExit&r(&W%c&r) &z AutoLoot&r(&W%c&r)&z  Autosac&r(&W%c&r)\r\n",
              IS_SET( ch->pcdata->flags, PCFLAG_PAGERON ) ? 'X' : ' ',
              ch->pcdata->pagerlen, IS_SET( ch->act, PLR_AUTOEXIT ) ? 'X' : ' ',
              IS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ', IS_SET( ch->act, PLR_AUTOSAC ) ? 'X' : ' ' );

   send_to_char( "\r\n&zLanguages&r: ", ch );
   for( iLang = 0; lang_array[iLang] != LANG_UNKNOWN; iLang++ )
      if( knows_language( ch, lang_array[iLang], ch ) || ( IS_NPC( ch ) && ch->speaks == 0 ) )
      {
         if( lang_array[iLang] & ch->speaking || ( IS_NPC( ch ) && !ch->speaking ) )
            set_char_color( AT_RED, ch );
         send_to_char( lang_names[iLang], ch );
         send_to_char( " ", ch );
         set_char_color( AT_SCORE, ch );
      }

   send_to_char( "\r\n", ch );
   ch_printf( ch, "&zWANTED ON&r: &W%s\r\n", flag_string( ch->pcdata->wanted_flags, planet_flags ) );

   if( ch->pcdata->bestowments && ch->pcdata->bestowments[0] != '\0' )
      ch_printf( ch, "&zYou are bestowed with the command&r(&zs&r):&W %s.\r\n", ch->pcdata->bestowments );

   if( ch->pcdata->clan )
   {
      send_to_char( "&r----------------------------------------------------------------------------\r\n", ch );
      ch_printf( ch, "&zORGANIZATION&r:&W %-35s &zPkills&r/&zDeaths&r: &W%3.3d&r/&W%3.3d",
                 ch->pcdata->clan->name, ch->pcdata->clan->pkills, ch->pcdata->clan->pdeaths );
      send_to_char( "\r\n", ch );
   }
   if( IS_IMMORTAL( ch ) )
   {
      send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch );

      ch_printf( ch, "IMMORTAL DATA:  Wizinvis [%s]  Wizlevel (%d)\r\n",
                 IS_SET( ch->act, PLR_WIZINVIS ) ? "X" : " ", ch->pcdata->wizinvis );

      ch_printf( ch, "Bamfin:  %s\r\n", ( ch->pcdata->bamfin[0] != '\0' )
                 ? ch->pcdata->bamfin : "%s appears in a swirling mist.", ch->name );
      ch_printf( ch, "Bamfout: %s\r\n", ( ch->pcdata->bamfout[0] != '\0' )
                 ? ch->pcdata->bamfout : "%s leaves in a swirling mist.", ch->name );


      /*
       * Area Loaded info - Scryn 8/11
       */
      if( ch->pcdata->area )
      {
         ch_printf( ch, "Vnums:   Room (%-5.5d - %-5.5d)   Object (%-5.5d - %-5.5d)   Mob (%-5.5d - %-5.5d)\r\n",
                    ch->pcdata->area->low_r_vnum, ch->pcdata->area->hi_r_vnum,
                    ch->pcdata->area->low_o_vnum, ch->pcdata->area->hi_o_vnum,
                    ch->pcdata->area->low_m_vnum, ch->pcdata->area->hi_m_vnum );
         ch_printf( ch, "Area Loaded [%s]\r\n", ( IS_SET( ch->pcdata->area->status, AREA_LOADED ) ) ? "yes" : "no" );
      }
   }
   if( ch->first_affect )
   {
      int i;
      const char *skname;

      i = 0;
      send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch );
      send_to_char( "&zAFFECT DATA&r:\r\n", ch );
      for( paf = ch->first_affect; paf; paf = paf->next )
      {
         skname = paf->from;

         if( paf->modifier == 0 )
            ch_printf( ch, "&r[&W%-63.64s&r;&W%5d &zrds&r]", skname, (int)paf->duration );
         else if( paf->modifier > 999 )
            ch_printf( ch, "&r[&W%-54.55s&r; &W%7.7s&r;&W%5d &zrds&r]",
                       skname, tiny_affect_loc_name( paf->location ), (int)paf->duration );
         else
            ch_printf( ch, "&r[&W%-51.52s&r;&W%+-3.3d %7.7s&r;%5d &zrds&r]",
                       skname, paf->modifier, tiny_affect_loc_name( paf->location ), (int)paf->duration );
         if( i == 0 )
            i = 1;
         if( ( ++i % 1 ) == 0 )
            send_to_char( "\r\n", ch );
      }
   }
   send_to_char( "\r\n&w", ch );
   return;
}
Example #5
0
bool spec_customs_spice(CHAR_DATA * ch)
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	OBJ_DATA *obj;
	char buf[MAX_STRING_LENGTH];
	long ch_exp;

	if (!IS_AWAKE(ch) || ch->position == POS_FIGHTING)
		return FALSE;

	for (victim = ch->in_room->first_person; victim; victim = v_next) {
		v_next = victim->next_in_room;

		if (IS_NPC(victim) || victim->position == POS_FIGHTING)
			continue;

		for (obj = victim->last_carrying; obj; obj = obj->prev_content) {
			if (obj->pIndexData->item_type == ITEM_SPICE
			    || obj->pIndexData->item_type == ITEM_RAWSPICE) {
				if (victim != ch && can_see(ch, victim)
				    && can_see_obj(ch, obj)) {
					sprintf(buf,
						"%s is illegal contraband. I'm going to have to confiscate that.",
						obj->short_descr);
					do_say(ch, buf);
					if (obj->wear_loc != WEAR_NONE)
						remove_obj(victim,
							   obj->wear_loc, TRUE);
					separate_obj(obj);
					obj_from_char(obj);
					act(AT_ACTION,
					    "$n confiscates $p from $N.", ch,
					    obj, victim, TO_NOTVICT);
					act(AT_ACTION, "$n takes $p from you.",
					    ch, obj, victim, TO_VICT);
					obj = obj_to_char(obj, ch);
					SET_BIT(obj->extra_flags,
						ITEM_CONTRABAND);
					ch_exp =
					    UMIN(obj->cost * 10,
						 (exp_level
						  (victim->
						   skill_level
						   [SMUGGLING_ABILITY] + 1) -
						  exp_level(victim->
							    skill_level
							    [SMUGGLING_ABILITY])));
					ch_printf(victim,
						  "You lose %ld experience. \n\r",
						  ch_exp);
					gain_exp(victim, 0 - ch_exp,
						 SMUGGLING_ABILITY);
					return TRUE;
				} else if (can_see(ch, victim)
					   && !IS_SET(obj->extra_flags,
						      ITEM_CONTRABAND)) {
					ch_exp =
					    UMIN(obj->cost * 10,
						 (exp_level
						  (victim->
						   skill_level
						   [SMUGGLING_ABILITY] + 1) -
						  exp_level(victim->
							    skill_level
							    [SMUGGLING_ABILITY])));
					ch_printf(victim,
						  "You receive %ld experience for smuggling %s. \n\r",
						  ch_exp, obj->short_descr);
					gain_exp(victim, ch_exp,
						 SMUGGLING_ABILITY);

					act(AT_ACTION,
					    "$n looks at $N suspiciously.", ch,
					    NULL, victim, TO_NOTVICT);
					act(AT_ACTION,
					    "$n look at you suspiciously.", ch,
					    NULL, victim, TO_VICT);
					SET_BIT(obj->extra_flags,
						ITEM_CONTRABAND);
					return TRUE;
				} else
				    if (!IS_SET
					(obj->extra_flags, ITEM_CONTRABAND)) {
					ch_exp =
					    UMIN(obj->cost * 10,
						 (exp_level
						  (victim->
						   skill_level
						   [SMUGGLING_ABILITY] + 1) -
						  exp_level(victim->
							    skill_level
							    [SMUGGLING_ABILITY])));
					ch_printf(victim,
						  "You receive %ld experience for smuggling %s. \n\r",
						  ch_exp, obj->short_descr);
					gain_exp(victim, ch_exp,
						 SMUGGLING_ABILITY);

					SET_BIT(obj->extra_flags,
						ITEM_CONTRABAND);
					return TRUE;
				}
			} else if (obj->item_type == ITEM_CONTAINER) {
				OBJ_DATA *content;

				for (content = obj->first_content; content;
				     content = content->next_content) {
					if (content->pIndexData->item_type ==
					    ITEM_SPICE
					    && !IS_SET(content->extra_flags,
						       ITEM_CONTRABAND)) {
						ch_exp =
						    UMIN(content->cost * 10,
							 (exp_level
							  (victim->
							   skill_level
							   [SMUGGLING_ABILITY] +
							   1) -
							  exp_level(victim->
								    skill_level
								    [SMUGGLING_ABILITY])));
						ch_printf(victim,
							  "You receive %ld experience for smuggling %s.\n\r ",
							  ch_exp,
							  content->short_descr);
						gain_exp(victim, ch_exp,
							 SMUGGLING_ABILITY);
						SET_BIT(content->extra_flags,
							ITEM_CONTRABAND);
						return TRUE;
					}
				}
			}
		}

	}

	return FALSE;
}
Example #6
0
bool spec_customs_weapons(CHAR_DATA * ch)
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	OBJ_DATA *obj;
	BOUNTY_DATA *bounty;
	char buf[MAX_STRING_LENGTH];
	long ch_exp;

	if (!IS_AWAKE(ch) || ch->position == POS_FIGHTING)
		return FALSE;

	for (victim = ch->in_room->first_person; victim; victim = v_next) {
		v_next = victim->next_in_room;

		if (IS_NPC(victim) || victim->position == POS_FIGHTING)
			continue;

		if (victim->pcdata && victim->pcdata->clan
		    && !str_cmp(victim->pcdata->clan->name, ch->mob_clan))
			continue;

		for (obj = victim->last_carrying; obj; obj = obj->prev_content) {
			if (obj->pIndexData->item_type == ITEM_WEAPON) {
				if (victim != ch && can_see(ch, victim)
				    && can_see_obj(ch, obj)) {

					bounty = get_disintigration(ch->name);
					// A large portion of text was removed because of the spammage - Gatz
					if (!IS_NPC(victim)
					    && victim->pcdata->weaponl == 0) {
						/*
						   act( AT_ACTION, "$n looks at $N suspiciously.", ch, NULL, victim, TO_NOTVICT );
						   act( AT_ACTION, "$n look at you suspiciously.",  ch, NULL, victim, TO_VICT  );
						   sprintf( buf , "Oh, you have a weapon license. Move along.");
						   do_say( ch , buf );
						 */
						return;
					}
					// Charm code
					if (!IS_NPC(victim)
					    && victim->pcdata->
					    learned[gsn_negotiate]) {
						if (number_range(0, 5) > 3) {
							learn_from_success(ch,
									   gsn_negotiate);
							return;
						}
					}

					if (victim->pcdata
					    && victim->pcdata->clan
					    &&
					    (!str_cmp
					     (victim->pcdata->clan->name,
					      "ISSP"))
					    && !bounty) {
						/*
						   act( AT_ACTION, "$n looks at $N suspiciously.", ch, NULL, victim, TO_NOTVICT );
						   act( AT_ACTION, "$n look at you suspiciously.",  ch, NULL, victim, TO_VICT  );
						   sprintf( buf , "Oh, you are ISSP! You are allowed to carry weapons.");
						   do_say( ch , buf );
						 */
						return;
					}
					if (victim->pcdata
					    && victim->pcdata->clan
					    &&
					    (!str_cmp
					     (victim->pcdata->clan->name,
					      "RBH"))
					    && !bounty) {
						/*
						   act( AT_ACTION, "$n looks at $N suspiciously.", ch, NULL, victim, TO_NOTVICT );
						   act( AT_ACTION, "$n look at you suspiciously.",  ch, NULL, victim, TO_VICT  );
						   sprintf( buf , "Oh, you are RBH! You are allowed to carry weapons.");
						   do_say( ch , buf );
						 */
						return;
					}

/*
	          sprintf( buf , "Weapons are not allowed for any Non ISSP or RBH, or people without a license to carry a Weapon. I'm going to have to confiscate %s.", obj->short_descr );
                  do_say( ch , buf );
                  if ( obj->wear_loc != WEAR_NONE )
                    remove_obj( victim, obj->wear_loc, TRUE );
                  separate_obj( obj );
    		  obj_from_char( obj );
    		  act( AT_ACTION, "$n confiscates $p from $N.", ch, obj, victim, TO_NOTVICT );
    		  act( AT_ACTION, "$n takes $p from you.",   ch, obj, victim, TO_VICT    );
    		  obj = obj_to_char( obj, ch );  
                SET_BIT( obj->extra_flags , ITEM_CONTRABAND);
                 // ch_exp = UMIN( obj->cost*10 , ( exp_level( victim->skill_level[DIPLOMACY_ABILITY]+1) - exp_level( victim->skill_level[DIPLOMACY_ABILITY])  )  );
                 // ch_printf( victim, "You lose %ld diplomacy experience.\n\r " , ch_exp );
                  gain_exp( victim, 0-ch_exp , DIPLOMACY_ABILITY);
                  return TRUE; */
				} else if (can_see(ch, victim)
					   && !IS_SET(obj->extra_flags,
						      ITEM_CONTRABAND)) {
					ch_exp =
					    UMIN(obj->cost * 10,
						 (exp_level
						  (victim->
						   skill_level
						   [SMUGGLING_ABILITY] + 1) -
						  exp_level(victim->
							    skill_level
							    [SMUGGLING_ABILITY])));
					ch_printf(victim,
						  "You receive %ld experience for smuggling %d.\n\r ",
						  ch_exp, obj->short_descr);
					gain_exp(victim, ch_exp,
						 SMUGGLING_ABILITY);

					act(AT_ACTION,
					    "$n looks at $N suspiciously.", ch,
					    NULL, victim, TO_NOTVICT);
					act(AT_ACTION,
					    "$n look at you suspiciously.", ch,
					    NULL, victim, TO_VICT);
					SET_BIT(obj->extra_flags,
						ITEM_CONTRABAND);
					return TRUE;
				} else
				    if (!IS_SET
					(obj->extra_flags, ITEM_CONTRABAND)) {
					ch_exp =
					    UMIN(obj->cost * 10,
						 (exp_level
						  (victim->
						   skill_level
						   [SMUGGLING_ABILITY] + 1) -
						  exp_level(victim->
							    skill_level
							    [SMUGGLING_ABILITY])));
					ch_printf(victim,
						  "You receive %ld experience for smuggling %s.\n\r ",
						  ch_exp, obj->short_descr);
					gain_exp(victim, ch_exp,
						 SMUGGLING_ABILITY);

					SET_BIT(obj->extra_flags,
						ITEM_CONTRABAND);
					return TRUE;
				}
			} else if (obj->item_type == ITEM_CONTAINER) {
				OBJ_DATA *content;

				for (content = obj->first_content; content;
				     content = content->next_content) {
					if (content->pIndexData->item_type ==
					    ITEM_WEAPON
					    && !IS_SET(content->extra_flags,
						       ITEM_CONTRABAND)) {
						ch_exp =
						    UMIN(content->cost * 10,
							 (exp_level
							  (victim->
							   skill_level
							   [SMUGGLING_ABILITY] +
							   1) -
							  exp_level(victim->
								    skill_level
								    [SMUGGLING_ABILITY])));
						ch_printf(victim,
							  "You receive %ld experience for smuggling %s.\n\r ",
							  ch_exp,
							  content->short_descr);
						gain_exp(victim, ch_exp,
							 SMUGGLING_ABILITY);
						SET_BIT(content->extra_flags,
							ITEM_CONTRABAND);
						return TRUE;
					}
				}
			}
		}

	}

	return FALSE;
}
Example #7
0
void do_makejetpack( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];
    char buf[MAX_STRING_LENGTH];
    int level, chance, strength;
    bool checktool, checkbatt, checkchem, checkcirc, checkmetal;
    OBJ_DATA *obj;
    OBJ_INDEX_DATA *pObjIndex;
    int vnum;

    strcpy( arg , argument );

    switch( ch->substate )
    {
    	default:
    	        if ( arg[0] == '\0' )
                {
                  send_to_char( "&RUsage: Makejetpack <Name>\n\r&w", ch);
                  return;
                }

                checktool  = FALSE;
                checkbatt  = FALSE;
                checkchem  = FALSE;
                checkcirc  = FALSE;
                checkmetal = FALSE;

                if ( !IS_SET( ch->in_room->room_flags, ROOM_FACTORY ) )
                {
                   send_to_char( "&RYou need to be in a factory or workshop to do that.\n\r", ch);
                   return;
                }

                for ( obj = ch->last_carrying; obj; obj = obj->prev_content )
                {
                  if (obj->item_type == ITEM_TOOLKIT)
                    checktool = TRUE;
                  if (obj->item_type == ITEM_BATTERY)
                    checkbatt = TRUE;
                  if (obj->item_type == ITEM_CIRCUIT)
                    checkcirc = TRUE;
                  if (obj->item_type == ITEM_CHEMICAL)
                    checkchem = TRUE;
                  if (obj->item_type == ITEM_RARE_METAL)
                    checkmetal = TRUE;
                }

                if ( !checktool )
                {
                   send_to_char( "&RYou need toolkit to make the Jetpack\n\r", ch);
                   return;
                }

                if ( !checkmetal )
                {
                   send_to_char( "&RYou need a piece metal to craft the Jetpack.\n\r", ch);
                   return;
                }

                if ( !checkbatt )
                {
                   send_to_char( "&RYou need a battery for the mechanism to work.\n\r", ch);
                   return;
                }

                if ( !checkcirc )
                {
                   send_to_char( "&RYou need a small circuit.\n\r", ch);
                   return;
                }

                if ( !checkchem )
                {
                   send_to_char( "&RSome chemicals for the combustion.\n\r", ch);
                   return;
                }

                chance = IS_NPC(ch) ? ch->top_level : (int) (ch->pcdata->learned[gsn_makejetpack]);
                if ( number_percent( ) < chance )
                {
                   send_to_char( "&GYou begin the long process of crafting a Jetpack\n\r", ch);
                   act( AT_PLAIN, "$n takes $s tools and begins to work on something.", ch, NULL, argument , TO_ROOM );
                   add_timer ( ch , TIMER_DO_FUN , 15 , do_makejetpack , 1 );
                   ch->dest_buf   = str_dup(arg);
                   return;
                }
                send_to_char("&RYou can't figure out how to fit the parts together.\n\r",ch);
                learn_from_failure( ch, gsn_makejetpack );
                return;

        case 1:
                if ( !ch->dest_buf )
                 return;
                strcpy(arg, ch->dest_buf);
                DISPOSE( ch->dest_buf);
                break;

        case SUB_TIMER_DO_ABORT:
                DISPOSE( ch->dest_buf );
                ch->substate = SUB_NONE;
                send_to_char("&RYou are interupted and fail to finish your work.\n\r", ch);
                return;
    }

    ch->substate = SUB_NONE;

    level = IS_NPC(ch) ? ch->top_level : (int) (ch->pcdata->learned[gsn_makejetpack]);
    vnum = 88;

    if ( ( pObjIndex = get_obj_index( vnum ) ) == NULL )
    {
         send_to_char( "&RThe item you are trying to create is missing from the database.\n\rPlease inform the administration of this error.\n\r", ch );
         return;
    }

    checktool = FALSE;
    checkmetal = FALSE;
    checkbatt = FALSE;
    checkchem = FALSE;
    checkcirc = FALSE;

    for ( obj = ch->last_carrying; obj; obj = obj->prev_content )
    {
       if (obj->item_type == ITEM_TOOLKIT)
          checktool = TRUE;
       if (obj->item_type == ITEM_BATTERY && checkbatt == FALSE)
       {
          strength = obj->value[0];
          separate_obj( obj );
          obj_from_char( obj );
          extract_obj( obj );
          checkbatt = TRUE;
       }
       if (obj->item_type == ITEM_CHEMICAL)
       {
          separate_obj( obj );
          obj_from_char( obj );
          extract_obj( obj );
          checkchem = TRUE;
       }
       if (obj->item_type == ITEM_CIRCUIT && checkcirc == FALSE)
       {
          separate_obj( obj );
          obj_from_char( obj );
          extract_obj( obj );
          checkcirc = TRUE;
       }
       if (obj->item_type == ITEM_RARE_METAL && checkmetal == FALSE)
       {
          separate_obj( obj );
          obj_from_char( obj );
          extract_obj( obj );
          checkmetal = TRUE;
       }
    }

    chance = IS_NPC(ch) ? ch->top_level : (int) (ch->pcdata->learned[gsn_makejetpack]) ;

    if ( number_percent( ) > chance*2  || ( !checktool ) || ( !checkmetal )
         || ( !checkbatt ) || ( !checkchem ) || ( !checkcirc) )
    {
       send_to_char( "You hit the 'on' switch and watch the Jetpack explode into pieces.", ch);
       learn_from_failure( ch, gsn_makejetpack );
       return;
    }

    obj = create_object( pObjIndex, level );

    obj->item_type = ITEM_ARMOR;
    SET_BIT( obj->wear_flags, ITEM_TAKE );
    SET_BIT( obj->wear_flags, ITEM_WEAR_BACK );
    obj->level = level;
    obj->weight = 1;
    STRFREE( obj->name );
    strcpy( buf , arg );
    obj->name = STRALLOC( buf );
    strcpy( buf, arg );
    STRFREE( obj->short_descr );
    obj->short_descr = STRALLOC( buf );
    STRFREE( obj->description );
    strcat( buf, " was left behind here." );
    obj->description = STRALLOC( buf );

    obj->value[0] = 0;
    obj->value[0] = 0;
    obj->value[0] = 0;
    obj->cost = 5000;

    obj = obj_to_char( obj, ch );

    send_to_char( "&GYou finish your work and hold up your newly created Jetpack.&w\n\r", ch);
    act( AT_PLAIN, "$n finishes making $s new Jetpack.", ch,
         NULL, argument , TO_ROOM );

    {
         long xpgain;

         xpgain = UMIN( obj->cost*100 ,
            ( exp_level(ch->skill_level[ENGINEERING_ABILITY]+1) -
              exp_level(ch->skill_level[ENGINEERING_ABILITY]) ) );
         gain_exp(ch, xpgain, ENGINEERING_ABILITY);
         ch_printf( ch , "You gain %d engineering experience.", xpgain );
    }
        learn_from_success( ch, gsn_makejetpack );
}
Example #8
0
void claim_disintegration( CHAR_DATA * ch, CHAR_DATA * victim )
{
   BOUNTY_DATA *bounty;
   long int bexp;
   char buf[MAX_STRING_LENGTH];
   CLAN_DATA *clan;

   if( IS_NPC( victim ) )
      return;

   bounty = get_disintegration( victim->name );

   if( ch == victim )
   {
      if( bounty != NULL )
         remove_disintegration( bounty );
      return;
   }

   if( bounty && !ch->pcdata )
   {
      remove_disintegration( bounty );
      bounty = NULL;
   }

/* Assassin Experience for Clan Leaders added by Tawnos */

   if( victim->pcdata && victim->pcdata->clan )
   {
      clan = victim->pcdata->clan;

      if( victim->pcdata->clan
          && ( !str_cmp( victim->name, clan->leader ) || !str_cmp( victim->name, clan->number1 )
               || !str_cmp( victim->name, clan->number2 ) ) )
      {
         if( !str_cmp( victim->name, clan->leader ) )
         {
            bexp = ( exp_level( ch->skill_level[ASSASSIN_ABILITY] + 1 ) - exp_level( ch->skill_level[ASSASSIN_ABILITY] ) );
            gain_exp( ch, bexp, ASSASSIN_ABILITY );
            set_char_color( AT_BLOOD, ch );
            ch_printf( ch, "You receive %ld assassin experience for executing a clan leader.\n\r", bexp );
         }
         else if( !str_cmp( victim->name, clan->number1 ) || !str_cmp( victim->name, clan->number2 ) )
         {
            bexp = ( exp_level( ch->skill_level[ASSASSIN_ABILITY] + 1 ) - exp_level( ch->skill_level[ASSASSIN_ABILITY] ) );
            gain_exp( ch, bexp, ASSASSIN_ABILITY );
            set_char_color( AT_BLOOD, ch );
            ch_printf( ch, "You receive %ld assassin experience for executing a prominent clan member.\n\r", bexp );
         }
      }
   }

   if( bounty == NULL )
   {
      if( IS_SET( victim->act, PLR_KILLER ) && !IS_NPC( ch ) )
      {
         bexp =
            URANGE( 1, xp_compute( ch, victim ),
                    ( exp_level( ch->skill_level[HUNTING_ABILITY] + 1 ) - exp_level( ch->skill_level[HUNTING_ABILITY] ) ) );
         gain_exp( ch, bexp, HUNTING_ABILITY );
         set_char_color( AT_BLOOD, ch );
         ch_printf( ch, "You receive %ld hunting experience for executing a wanted killer.\n\r", bexp );
      }
      else if( !IS_NPC( ch ) )
      {
         SET_BIT( ch->act, PLR_KILLER );
         ch_printf( ch, "You are now wanted for the murder of %s.\n\r", victim->name );
      }
      sprintf( buf, "%s is Dead!", victim->name );
      echo_to_all( AT_RED, buf, 0 );
      return;

   }

   ch->gold += bounty->amount;

   bexp =
      URANGE( 1, bounty->amount + xp_compute( ch, victim ),
              ( exp_level( ch->skill_level[HUNTING_ABILITY] + 1 ) - exp_level( ch->skill_level[HUNTING_ABILITY] ) ) );
   gain_exp( ch, bexp, HUNTING_ABILITY );

   set_char_color( AT_BLOOD, ch );
   ch_printf( ch, "You receive %ld experience and %ld credits,\n\r from the bounty on %s\n\r", exp, bounty->amount,
              bounty->target );

   sprintf( buf, "The disintegration bounty on %s has been claimed!", victim->name );
   echo_to_all( AT_RED, buf, 0 );
   sprintf( buf, "%s is Dead!", victim->name );
   echo_to_all( AT_RED, buf, 0 );

   if( !IS_SET( victim->act, PLR_KILLER ) )
      SET_BIT( ch->act, PLR_KILLER );
   remove_disintegration( bounty );
}