swskills.c
swrots/src/swskills.c · 190.1 KB
From the archive swrots.tgz
Download the archive « Back to the archive contents
#include <math.h>
#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "mud.h"
void add_reinforcements args( ( CHAR_DATA *ch ) );
ch_ret one_hit args( ( CHAR_DATA *ch, CHAR_DATA *victim, int dt ) );
int xp_compute ( CHAR_DATA *ch , CHAR_DATA *victim );
ROOM_INDEX_DATA *generate_exit( ROOM_INDEX_DATA *in_room, EXIT_DATA **pexit );
int ris_save( CHAR_DATA *ch, int chance, int ris );
void explode_emissile args( ( CHAR_DATA *ch, ROOM_INDEX_DATA *proom, int mindam, int maxdam, bool incendiary) );
CHAR_DATA *get_char_room_mp( CHAR_DATA *ch, char *argument );
/* from shops.c */
CHAR_DATA * find_keeper args( ( CHAR_DATA *ch ) );
extern int top_affect;
const char * sector_name [SECT_MAX] =
{
"inside", "city", "field", "forest", "hills", "mountain", "water swim", "water noswim",
"underwater", "air", "desert", "unknown", "ocean floor", "underground",
"scrub", "rocky", "savanna", "tundra", "glacial", "rainforest", "jungle",
"swamp", "wetlands", "brush", "steppe", "farmland", "volcanic"
};
void do_makeblade( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
int level, chance, charge;
bool checktool, checkdura, checkbatt, checkoven;
OBJ_DATA *obj;
OBJ_INDEX_DATA *pObjIndex;
int vnum;
AFFECT_DATA *paf;
AFFECT_DATA *paf2;
strcpy( arg , argument );
switch( ch->substate )
{
default:
if ( arg[0] == '\0' )
{
send_to_char( "&RUsage: Makeblade <name>\n\r&w", ch);
return;
}
checktool = FALSE;
checkdura = FALSE;
checkbatt = FALSE;
checkoven = 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_DURASTEEL)
checkdura = TRUE;
if (obj->item_type == ITEM_BATTERY)
checkbatt = TRUE;
if (obj->item_type == ITEM_OVEN)
checkoven = TRUE;
}
if ( !checktool )
{
send_to_char( "&RYou need toolkit to make a vibro-blade.\n\r", ch);
return;
}
if ( !checkdura )
{
send_to_char( "&RYou need something to make it out of.\n\r", ch);
return;
}
if ( !checkbatt )
{
send_to_char( "&RYou need a power source for your blade.\n\r", ch);
return;
}
if ( !checkoven )
{
send_to_char( "&RYou need a small furnace to heat the metal.\n\r", ch);
return;
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0);
if ( number_percent( ) < chance )
{
send_to_char( "&GYou begin the long process of crafting a vibroblade.\n\r", ch);
act( AT_PLAIN, "$n takes $s tools and a small oven and begins to work on something.", ch,
NULL, argument , TO_ROOM );
add_timer ( ch , TIMER_DO_FUN , 25 , do_makeblade , 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);
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) (0);
vnum = 66;
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;
checkdura = FALSE;
checkbatt = FALSE;
checkoven = FALSE;
for ( obj = ch->last_carrying; obj; obj = obj->prev_content )
{
if (obj->item_type == ITEM_TOOLKIT)
checktool = TRUE;
if (obj->item_type == ITEM_OVEN)
checkoven = TRUE;
if (obj->item_type == ITEM_DURASTEEL && checkdura == FALSE)
{
checkdura = TRUE;
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
}
if (obj->item_type == ITEM_BATTERY && checkbatt == FALSE )
{
charge = UMAX( 5, obj->value[0] );
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checkbatt = TRUE;
}
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0) ;
if ( number_percent( ) > chance*2 || ( !checktool ) || ( !checkdura ) || ( !checkbatt ) || ( !checkoven ) )
{
send_to_char( "&RYou activate your newly created vibroblade.\n\r", ch);
send_to_char( "&RIt hums softly for a few seconds then begins to shake violently.\n\r", ch);
send_to_char( "&RIt finally shatters breaking apart into a dozen pieces.\n\r", ch);
return;
}
obj = create_object( pObjIndex, level );
obj->item_type = ITEM_WEAPON;
SET_BIT( obj->wear_flags, ITEM_WIELD );
SET_BIT( obj->wear_flags, ITEM_TAKE );
obj->level = level;
obj->weight = 3;
STRFREE( obj->name );
strcpy( buf, arg );
strcat( buf, " vibro-blade blade " );
strcat( buf, remand(buf));
obj->name = STRALLOC( buf );
strcpy( buf, arg );
STRFREE( obj->short_descr );
obj->short_descr = STRALLOC( buf );
STRFREE( obj->description );
strcat( buf, " was left here." );
obj->description = STRALLOC( buf );
CREATE( paf, AFFECT_DATA, 1 );
paf->type = -1;
paf->duration = -1;
paf->location = get_atype( "backstab" );
paf->modifier = level/3;
paf->bitvector = 0;
paf->next = NULL;
LINK( paf, obj->first_affect, obj->last_affect, next, prev );
++top_affect;
CREATE( paf2, AFFECT_DATA, 1 );
paf2->type = -1;
paf2->duration = -1;
paf2->location = get_atype( "hitroll" );
paf2->modifier = -2;
paf2->bitvector = 0;
paf2->next = NULL;
LINK( paf2, obj->first_affect, obj->last_affect, next, prev );
++top_affect;
obj->value[0] = INIT_WEAPON_CONDITION;
obj->value[1] = (int) (level/10+15); /* min dmg */
obj->value[2] = (int) (level/5+20); /* max dmg */
obj->value[3] = WEAPON_VIBRO;
obj->value[4] = charge;
obj->value[5] = charge;
obj->cost = obj->value[2]*10;
obj = obj_to_char( obj, ch );
send_to_char( "&GYou finish your work and hold up your newly created blade.&w\n\r", ch);
act( AT_PLAIN, "$n finishes crafting a vibro-blade.", ch,
NULL, argument , TO_ROOM );
return;
}
void do_makeblaster( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
int level, chance;
bool checktool, checkdura, checkbatt, checkoven, checkcond, checkcirc, checkammo;
OBJ_DATA *obj;
OBJ_INDEX_DATA *pObjIndex;
int vnum, power, scope, ammo;
AFFECT_DATA *paf;
AFFECT_DATA *paf2;
strcpy( arg , argument );
switch( ch->substate )
{
default:
if ( arg[0] == '\0' )
{
send_to_char( "&RUsage: Makeblaster <name>\n\r&w", ch);
return;
}
checktool = FALSE;
checkdura = FALSE;
checkbatt = FALSE;
checkoven = FALSE;
checkcond = FALSE;
checkcirc = 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_DURAPLAST)
checkdura = TRUE;
if (obj->item_type == ITEM_BATTERY)
checkbatt = TRUE;
if (obj->item_type == ITEM_OVEN)
checkoven = TRUE;
if (obj->item_type == ITEM_CIRCUIT)
checkcirc = TRUE;
if (obj->item_type == ITEM_SUPERCONDUCTOR)
checkcond = TRUE;
}
if ( !checktool )
{
send_to_char( "&RYou need toolkit to make a blaster.\n\r", ch);
return;
}
if ( !checkdura )
{
send_to_char( "&RYou need something to make it out of.\n\r", ch);
return;
}
if ( !checkbatt )
{
send_to_char( "&RYou need a power source for your blaster.\n\r", ch);
return;
}
if ( !checkoven )
{
send_to_char( "&RYou need a small furnace to heat the plastics.\n\r", ch);
return;
}
if ( !checkcirc )
{
send_to_char( "&RYou need a small circuit board to control the firing mechanism.\n\r", ch);
return;
}
if ( !checkcond )
{
send_to_char( "&RYou still need a small superconductor.\n\r", ch);
return;
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0);
if ( number_percent( ) < chance )
{
send_to_char( "&GYou begin the long process of making a blaster.\n\r", ch);
act( AT_PLAIN, "$n takes $s tools and a small oven and begins to work on something.", ch,
NULL, argument , TO_ROOM );
add_timer ( ch , TIMER_DO_FUN , 25 , do_makeblaster , 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);
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) (0);
vnum = 50;
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;
}
checkammo= FALSE;
checktool = FALSE;
checkdura = FALSE;
checkbatt = FALSE;
checkoven = FALSE;
checkcond = FALSE;
checkcirc = FALSE;
power = 0;
scope = 0;
ammo = 0;
for ( obj = ch->last_carrying; obj; obj = obj->prev_content )
{
if (obj->item_type == ITEM_TOOLKIT)
checktool = TRUE;
if (obj->item_type == ITEM_OVEN)
checkoven = TRUE;
if (obj->item_type == ITEM_DURAPLAST && checkdura == FALSE)
{
checkdura = TRUE;
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
}
if (obj->item_type == ITEM_AMMO && checkammo == FALSE)
{
ammo = obj->value[0];
checkammo = TRUE;
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
}
if (obj->item_type == ITEM_BATTERY && checkbatt == FALSE)
{
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checkbatt = TRUE;
}
if (obj->item_type == ITEM_LENS && scope == 0)
{
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
scope++;
}
if (obj->item_type == ITEM_SUPERCONDUCTOR && power<2)
{
power++;
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checkcond = TRUE;
}
if (obj->item_type == ITEM_CIRCUIT && checkcirc == FALSE)
{
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checkcirc = TRUE;
}
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0) ;
if ( number_percent( ) > chance*2 || ( !checktool ) || ( !checkdura ) || ( !checkbatt ) || ( !checkoven ) || ( !checkcond ) || ( !checkcirc) )
{
send_to_char( "&RYou hold up your new blaster and aim at a leftover piece of plastic.\n\r", ch);
send_to_char( "&RYou slowly squeeze the trigger hoping for the best...\n\r", ch);
send_to_char( "&RYour blaster backfires destroying your weapon and burning your hand.\n\r", ch);
return;
}
obj = create_object( pObjIndex, level );
obj->item_type = ITEM_WEAPON;
SET_BIT( obj->wear_flags, ITEM_WIELD );
SET_BIT( obj->wear_flags, ITEM_TAKE );
obj->level = level;
obj->weight = 2+level/10;
STRFREE( obj->name );
strcpy( buf , arg );
strcat( buf , " blaster ");
strcat( buf, remand(buf));
obj->name = STRALLOC( buf );
strcpy( buf, arg );
STRFREE( obj->short_descr );
obj->short_descr = STRALLOC( buf );
STRFREE( obj->description );
strcat( buf, " was carelessly misplaced here." );
obj->description = STRALLOC( buf );
CREATE( paf, AFFECT_DATA, 1 );
paf->type = -1;
paf->duration = -1;
paf->location = get_atype( "hitroll" );
paf->modifier = URANGE( 0, 1+scope, level/30 );
paf->bitvector = 0;
paf->next = NULL;
LINK( paf, obj->first_affect, obj->last_affect, next, prev );
++top_affect;
CREATE( paf2, AFFECT_DATA, 1 );
paf2->type = -1;
paf2->duration = -1;
paf2->location = get_atype( "damroll" );
paf2->modifier = URANGE( 0, power, level/30);
paf2->bitvector = 0;
paf2->next = NULL;
LINK( paf2, obj->first_affect, obj->last_affect, next, prev );
++top_affect;
obj->value[0] = INIT_WEAPON_CONDITION; /* condition */
obj->value[1] = (int) (level/10+15); /* min dmg */
obj->value[2] = (int) (level/5+25); /* max dmg */
obj->value[3] = WEAPON_BLASTER;
obj->value[4] = ammo;
obj->value[5] = 2000;
obj->cost = obj->value[2]*50;
obj = obj_to_char( obj, ch );
send_to_char( "&GYou finish your work and hold up your newly created blaster.&w\n\r", ch);
act( AT_PLAIN, "$n finishes making $s new blaster.", ch,
NULL, argument , TO_ROOM );
return;
}
void do_makelightsaber( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
int chance, color;
bool checktool, checkdura, checkbatt,
checkoven, checkcond, checkcirc, checklens, checkgems, checkmirr,
dex_bonus;
OBJ_DATA *obj;
OBJ_INDEX_DATA *pObjIndex;
int vnum, level, gems, charge, gemtype;
int hitroll, mindam, maxdam;
int cry1, cry2, cry3;
AFFECT_DATA *paf;
AFFECT_DATA *paf2;
strcpy( arg, argument );
switch( ch->substate )
{
default:
checktool = FALSE;
checkdura = FALSE;
checkbatt = FALSE;
checkoven = FALSE;
checkcond = FALSE;
checkcirc = FALSE;
checklens = FALSE;
checkgems = FALSE;
checkmirr = FALSE;
if ( !IS_SET( ch->in_room->room_flags, ROOM_SAFE ) || !IS_SET( ch->in_room->room_flags, ROOM_SILENCE ))
{
send_to_char( "&RYou need to be in a quiet peaceful place to craft a lightsaber.\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_LENS)
checklens = TRUE;
if (obj->item_type == ITEM_CRYSTAL)
checkgems = TRUE;
if (obj->item_type == ITEM_MIRROR)
checkmirr = TRUE;
if (obj->item_type == ITEM_DURAPLAST || obj->item_type == ITEM_DURASTEEL )
checkdura = TRUE;
if (obj->item_type == ITEM_BATTERY)
checkbatt = TRUE;
if (obj->item_type == ITEM_OVEN)
checkoven = TRUE;
if (obj->item_type == ITEM_CIRCUIT)
checkcirc = TRUE;
if (obj->item_type == ITEM_SUPERCONDUCTOR)
checkcond = TRUE;
}
if ( !checktool )
{
send_to_char( "&RYou need toolkit to make a lightsaber.\n\r", ch);
return;
}
if ( !checkdura )
{
send_to_char( "&RYou need something to make it out of.\n\r", ch);
return;
}
if ( !checkbatt )
{
send_to_char( "&RYou need a power source for your lightsaber.\n\r", ch);
return;
}
if ( !checkoven )
{
send_to_char( "&RYou need a small furnace to heat and shape the components.\n\r", ch);
return;
}
if ( !checkcirc )
{
send_to_char( "&RYou need a small circuit board.\n\r", ch);
return;
}
if ( !checkcond )
{
send_to_char( "&RYou still need a small superconductor for your lightsaber.\n\r", ch);
return;
}
if ( !checklens )
{
send_to_char( "&RYou still need a lens to focus the beam.\n\r", ch);
return;
}
if ( !checkgems )
{
send_to_char( "&RLightsabers require 1 to 3 gems to work properly.\n\r", ch);
return;
}
if ( !checkmirr )
{
send_to_char( "&RYou need a high intesity reflective cup to create a lightsaber.\n\r", ch);
return;
}
chance = IS_NPC(ch) ? ch->top_level
: (ch->skill_level[CRAFT_LIGHTSABER] + stat_table[get_curr_int(ch)].mod + number_range(1, 20) );
if ( 20 < chance )
{
send_to_char( "&bYou begin the difficult task of crafting a personal lightsaber.&w\n\r", ch);
act( AT_BLUE, "$n takes $s tools and a small oven and begins to work on something.", ch,
NULL, argument , TO_ROOM );
add_timer ( ch , TIMER_DO_FUN , 25 , do_makelightsaber , 1 );
ch->dest_buf = str_dup(arg);
return;
}
send_to_char("&RYou can't seem to figure out how to construct a lightsaber.&w\n\r",ch);
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 : ch->top_level;
vnum = 72;
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;
checkdura = FALSE;
checkbatt = FALSE;
checkoven = FALSE;
checkcond = FALSE;
checkcirc = FALSE;
checklens = FALSE;
checkgems = FALSE;
checkmirr = FALSE;
dex_bonus = FALSE;
gems = 0;
charge = 0;
gemtype =0;
mindam = 0;
hitroll = 1;
maxdam = 0;
cry1 = -1;
cry2 = -1;
cry3 = -1;
gemtype = -1;
for ( obj = ch->last_carrying; obj; obj = obj->prev_content )
{
if (obj->item_type == ITEM_TOOLKIT)
checktool = TRUE;
if (obj->item_type == ITEM_OVEN)
checkoven = TRUE;
if ( (obj->item_type == ITEM_DURAPLAST || obj->item_type == ITEM_DURASTEEL) && checkdura == FALSE)
{
checkdura = TRUE;
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
}
if (obj->item_type == ITEM_DURASTEEL && checkdura == FALSE)
{
checkdura = TRUE;
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
}
if (obj->item_type == ITEM_BATTERY && checkbatt == FALSE)
{
charge = UMIN(obj->value[1], 10);
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checkbatt = TRUE;
}
if (obj->item_type == ITEM_SUPERCONDUCTOR && checkcond == FALSE)
{
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checkcond = 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_LENS && checklens == FALSE)
{
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checklens = TRUE;
}
if (obj->item_type == ITEM_MIRROR && checkmirr == FALSE)
{
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checkmirr = TRUE;
}
if (obj->item_type == ITEM_CRYSTAL && gems < 3)
{
if( obj->value[0] == cry1 || obj->value[0] == cry2 || obj->value[0] == cry3 )
continue;
if( gemtype >= 0 && ( obj->value[0] == CRYSTAL_BLUE || obj->value[0] == CRYSTAL_GREEN || obj->value[0] == CRYSTAL_PURPLE || obj->value[0] == CRYSTAL_RED || obj->value[0] == CRYSTAL_YELLOW ) )
continue;
if( obj->value[0] == CRYSTAL_OPILA && IS_SET(obj->extra_flags, ITEM_IMP_CRITICAL) )
continue;
if( obj->value[0] == CRYSTAL_BONDAR && IS_SET(obj->extra_flags, ITEM_STUN ) )
continue;
if( IS_SET(obj->extra_flags, ITEM_IMBUED) )
{
gems++;
if( cry1 != -1 )
{
if( cry2 == -1 )
cry2 = obj->value[0];
else
cry3 = obj->value[0];
}
else
cry1 = obj->value[0];
if( obj->value[0] >= CRYSTAL_BLUE && obj->value[0] <= CRYSTAL_YELLOW )
gemtype = obj->value[0];
if( obj->value[0] == CRYSTAL_OPILA )
SET_BIT( obj->extra_flags, ITEM_IMP_CRITICAL );
if( obj->value[0] == CRYSTAL_SIGIL )
{
mindam += 1;
maxdam += 6;
}
else if( obj->value[0] == CRYSTAL_BONDAR )
SET_BIT( obj->extra_flags, ITEM_STUN );
else if( obj->value[0] == CRYSTAL_PHOND )
{
mindam += 1;
maxdam += 10;
}
else if( obj->value[0] == CRYSTAL_SOLARI )
{
hitroll += 5;
mindam += 5;
}
else if( obj->value[0] == CRYSTAL_DAMIND )
{
hitroll += 2;
maxdam += 2;
}
else if( obj->value[0] == CRYSTAL_JENRUAX )
hitroll += 2;
else if( obj->value[0] == CRYSTAL_UPARI )
maxdam += 5;
else if( obj->value[0] == CRYSTAL_ERALAM )
{
mindam += 3;
maxdam += 3;
}
else if( obj->value[0] == CRYSTAL_RUBAT )
hitroll += 1;
else if( obj->value[0] == CRYSTAL_SAPITH )
{
hitroll += 4;
dex_bonus = TRUE;
}
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checkgems = TRUE;
}
}
}
chance = IS_NPC(ch) ? ch->top_level
: ( number_range(1, 20) + ch->skill_level[CRAFT_LIGHTSABER] + stat_table[get_curr_int(ch)].mod );
if( !checkgems )
{
send_to_char( "&RYou either lack crystals or else they are not imbued.&w\n\r", ch );
return;
}
if( gemtype < 0 )
{
send_to_char( "&RAfter creating your lightsaber you attempt to ignite it, but nothing happens.&w\n\r", ch );
send_to_char( "&RPerhaps you'll remember to use a color-defining crystal next time.&w\n\r", ch );
return;
}
if ( 20 > chance || ( !checktool ) || ( !checkdura ) || ( !checkbatt ) || ( !checkoven )
|| ( !checkmirr ) || ( !checklens ) || ( !checkgems ) || ( !checkcond ) || ( !checkcirc) )
{
send_to_char( "&RAfter creating your lightsaber you stand back and admire it in awe.&w\n\r", ch );
send_to_char( "&RYou reach and ignite it, but nothing happens.&w\n\r", ch );
return;
}
obj = create_object( pObjIndex, level );
obj->item_type = ITEM_WEAPON;
SET_BIT( obj->wear_flags, ITEM_WIELD );
SET_BIT( obj->wear_flags, ITEM_TAKE );
obj->level = level;
obj->weight = 5;
STRFREE( obj->name );
obj->name = STRALLOC( "lightsaber saber" );
color = gemtype;
if( color == CRYSTAL_BLUE )
sprintf( buf, "&wa &bblue&w bladed lightsaber" );
else if( color == CRYSTAL_GREEN )
sprintf( buf, "&wa &ggreen&w bladed lightsaber" );
else if( color == CRYSTAL_YELLOW )
sprintf( buf, "&wa &Yyellow&w bladed lightsaber" );
else if( color == CRYSTAL_PURPLE )
sprintf( buf, "&wa &Ppurple&w bladed lightsaber" );
else if( color == CRYSTAL_RED )
sprintf( buf, "&wa &Rred&w bladed lightsaber" );
STRFREE( obj->short_descr );
obj->short_descr = STRALLOC( buf );
STRFREE( obj->description );
strcat( buf, " was carelessly misplaced here." );
obj->description = STRALLOC( buf );
STRFREE( obj->action_desc );
strcpy( buf, arg );
strcat( buf, " ignites with a hum and a soft glow." );
obj->action_desc = STRALLOC( buf );
CREATE( paf, AFFECT_DATA, 1 );
paf->type = -1;
paf->duration = -1;
paf->location = get_atype( "hitroll" );
paf->modifier = hitroll;
paf->bitvector = 0;
paf->next = NULL;
LINK( paf, obj->first_affect, obj->last_affect, next, prev );
++top_affect;
if( dex_bonus )
{
CREATE( paf2, AFFECT_DATA, 1 );
paf2->type = -1;
paf2->duration = -1;
paf2->location = APPLY_DEX;
paf2->modifier = 4;
paf2->bitvector = 0;
paf2->next = NULL;
LINK( paf2, obj->first_affect, obj->last_affect, next, prev );
++top_affect;
}
obj->value[0] = INIT_WEAPON_CONDITION; /* condition */
obj->value[1] = ( 2 + mindam );
obj->value[2] = ( 16 + maxdam );
obj->value[3] = WEAPON_LIGHTSABER;
obj->value[4] = charge;
obj->value[5] = charge;
obj->cost = 0;
obj = obj_to_char( obj, ch );
send_to_char( "&GYou finish your work and hold up your newly created lightsaber.&w\n\r", ch);
act( AT_PLAIN, "$n finishes making $s new lightsaber.", ch,
NULL, argument , TO_ROOM );
return;
}
void do_makespice( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
int chance;
OBJ_DATA *obj;
switch( ch->substate )
{
default:
strcpy( arg, argument );
if ( arg[0] == '\0' )
{
send_to_char( "&RFrom what?\n\r&w", ch);
return;
}
if ( !IS_SET( ch->in_room->room_flags, ROOM_REFINERY ) )
{
send_to_char( "&RYou need to be in a refinery to create drugs from spice.\n\r", ch);
return;
}
if ( ms_find_obj(ch) )
return;
if ( ( obj = get_obj_carry( ch, arg ) ) == NULL )
{
send_to_char( "&RYou do not have that item.\n\r&w", ch );
return;
}
if ( obj->item_type != ITEM_RAWSPICE )
{
send_to_char( "&RYou can't make a drug out of that\n\r&w",ch);
return;
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0);
if ( number_percent( ) < chance )
{
send_to_char( "&GYou begin the long process of refining spice into a drug.\n\r", ch);
act( AT_PLAIN, "$n begins working on something.", ch,
NULL, argument , TO_ROOM );
add_timer ( ch , TIMER_DO_FUN , 10 , do_makespice , 1 );
ch->dest_buf = str_dup(arg);
return;
}
send_to_char("&RYou can't figure out what to do with the stuff.\n\r",ch);
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 distracted and are unable to finish your work.\n\r&w", ch);
return;
}
ch->substate = SUB_NONE;
if ( ( obj = get_obj_carry( ch, arg ) ) == NULL )
{
send_to_char( "You seem to have lost your spice!\n\r", ch );
return;
}
if ( obj->item_type != ITEM_RAWSPICE )
{
send_to_char( "&RYou get your tools mixed up and can't finish your work.\n\r&w",ch);
return;
}
obj->value[1] = URANGE (10, obj->value[1], ( IS_NPC(ch) ? ch->top_level
: (int) (0) ) +10);
strcpy( buf, obj->name );
STRFREE( obj->name );
strcat( buf, " drug spice " );
strcat( buf, remand(buf));
obj->name = STRALLOC( buf );
strcpy( buf, "a drug made from " );
strcat( buf, obj->short_descr );
STRFREE( obj->short_descr );
obj->short_descr = STRALLOC( buf );
strcat( buf, " was foolishly left lying around here." );
STRFREE( obj->description );
obj->description = STRALLOC( buf );
obj->item_type = ITEM_SPICE;
send_to_char( "&GYou finish your work.\n\r", ch);
act( AT_PLAIN, "$n finishes $s work.", ch,
NULL, argument , TO_ROOM );
obj->cost += obj->value[1]*10;
return;
}
void do_makegrenade( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
int level, chance, strength, weight;
bool checktool, checkdrink, checkbatt, checkchem, checkcirc;
OBJ_DATA *obj;
OBJ_INDEX_DATA *pObjIndex;
int vnum;
strcpy( arg , argument );
switch( ch->substate )
{
default:
if ( arg[0] == '\0' )
{
send_to_char( "&RUsage: Makegrenade <name>\n\r&w", ch);
return;
}
checktool = FALSE;
checkdrink = FALSE;
checkbatt = FALSE;
checkchem = FALSE;
checkcirc = 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_DRINK_CON && obj->value[1] == 0 )
checkdrink = 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 ( !checktool )
{
send_to_char( "&RYou need toolkit to make a grenade.\n\r", ch);
return;
}
if ( !checkdrink )
{
send_to_char( "&RYou will need an empty drink container to mix and hold the chemicals.\n\r", ch);
return;
}
if ( !checkbatt )
{
send_to_char( "&RYou need a small battery for the timer.\n\r", ch);
return;
}
if ( !checkcirc )
{
send_to_char( "&RYou need a small circuit for the timer.\n\r", ch);
return;
}
if ( !checkchem )
{
send_to_char( "&RSome explosive chemicals would come in handy!\n\r", ch);
return;
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0);
if ( number_percent( ) < chance )
{
send_to_char( "&GYou begin the long process of making a grenade.\n\r", ch);
act( AT_PLAIN, "$n takes $s tools and a drink container and begins to work on something.", ch,
NULL, argument , TO_ROOM );
add_timer ( ch , TIMER_DO_FUN , 25 , do_makegrenade , 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);
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) (0);
vnum = 71;
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;
checkdrink = 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_DRINK_CON && checkdrink == FALSE && obj->value[1] == 0 )
{
checkdrink = TRUE;
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
}
if (obj->item_type == ITEM_BATTERY && checkbatt == FALSE)
{
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checkbatt = TRUE;
}
if (obj->item_type == ITEM_CHEMICAL)
{
strength = URANGE( 10, obj->value[0], level * 5 );
weight = obj->weight;
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;
}
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0) ;
if ( number_percent( ) > chance*2 || ( !checktool ) || ( !checkdrink ) || ( !checkbatt ) || ( !checkchem ) || ( !checkcirc) )
{
send_to_char( "&RJust as you are about to finish your work,\n\ryour newly created grenade explodes in your hands...doh!\n\r", ch);
return;
}
obj = create_object( pObjIndex, level );
obj->item_type = ITEM_GRENADE;
SET_BIT( obj->wear_flags, ITEM_HOLD );
SET_BIT( obj->wear_flags, ITEM_TAKE );
obj->level = level;
obj->weight = weight;
STRFREE( obj->name );
strcpy( buf , arg );
strcat( buf , " grenade ");
strcat( buf, remand(buf));
obj->name = STRALLOC( buf );
strcpy( buf, arg );
STRFREE( obj->short_descr );
obj->short_descr = STRALLOC( buf );
STRFREE( obj->description );
strcat( buf, " was carelessly misplaced here." );
obj->description = STRALLOC( buf );
obj->value[0] = strength*2;
obj->value[1] = strength*3;
obj->cost = obj->value[1]*5;
obj = obj_to_char( obj, ch );
send_to_char( "&GYou finish your work and hold up your newly created grenade.&w\n\r", ch);
act( AT_PLAIN, "$n finishes making $s new grenade.", ch,
NULL, argument , TO_ROOM );
return;
}
void do_makelandmine( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
int level, chance, strength, weight;
bool checktool, checkdrink, checkbatt, checkchem, checkcirc;
OBJ_DATA *obj;
OBJ_INDEX_DATA *pObjIndex;
int vnum;
strcpy( arg , argument );
switch( ch->substate )
{
default:
if ( arg[0] == '\0' )
{
send_to_char( "&RUsage: Makelandmine <name>\n\r&w", ch);
return;
}
checktool = FALSE;
checkdrink = FALSE;
checkbatt = FALSE;
checkchem = FALSE;
checkcirc = 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_DRINK_CON && obj->value[1] == 0 )
checkdrink = 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 ( !checktool )
{
send_to_char( "&RYou need toolkit to make a landmine.\n\r", ch);
return;
}
if ( !checkdrink )
{
send_to_char( "&RYou will need an empty drink container to mix and hold the chemicals.\n\r", ch);
return;
}
if ( !checkbatt )
{
send_to_char( "&RYou need a small battery for the detonator.\n\r", ch);
return;
}
if ( !checkcirc )
{
send_to_char( "&RYou need a small circuit for the detonator.\n\r", ch);
return;
}
if ( !checkchem )
{
send_to_char( "&RSome explosive chemicals would come in handy!\n\r", ch);
return;
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0);
if ( number_percent( ) < chance )
{
send_to_char( "&GYou begin the long process of making a landmine.\n\r", ch);
act( AT_PLAIN, "$n takes $s tools and a drink container and begins to work on something.", ch,
NULL, argument , TO_ROOM );
add_timer ( ch , TIMER_DO_FUN , 25 , do_makelandmine , 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);
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) (0);
vnum = 70;
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;
checkdrink = 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_DRINK_CON && checkdrink == FALSE && obj->value[1] == 0 )
{
checkdrink = TRUE;
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
}
if (obj->item_type == ITEM_BATTERY && checkbatt == FALSE)
{
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checkbatt = TRUE;
}
if (obj->item_type == ITEM_CHEMICAL)
{
strength = URANGE( 10, obj->value[0], level * 5 );
weight = obj->weight;
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;
}
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0) ;
if ( number_percent( ) > chance*2 || ( !checktool ) || ( !checkdrink ) || ( !checkbatt ) || ( !checkchem ) || ( !checkcirc) )
{
send_to_char( "&RJust as you are about to finish your work,\n\ryour newly created landmine explodes in your hands...doh!\n\r", ch);
return;
}
obj = create_object( pObjIndex, level );
obj->item_type = ITEM_LANDMINE;
SET_BIT( obj->wear_flags, ITEM_HOLD );
SET_BIT( obj->wear_flags, ITEM_TAKE );
obj->level = level;
obj->weight = weight;
STRFREE( obj->name );
strcpy( buf , arg );
strcat( buf , " landmine ");
strcat( buf, remand(buf));
obj->name = STRALLOC( buf );
strcpy( buf, arg );
STRFREE( obj->short_descr );
obj->short_descr = STRALLOC( buf );
STRFREE( obj->description );
strcat( buf, " was carelessly misplaced here." );
obj->description = STRALLOC( buf );
obj->value[0] = strength/2;
obj->value[1] = strength;
obj->cost = obj->value[1]*5;
obj = obj_to_char( obj, ch );
send_to_char( "&GYou finish your work and hold up your newly created landmine.&w\n\r", ch);
act( AT_PLAIN, "$n finishes making $s new landmine.", ch,
NULL, argument , TO_ROOM );
return;
}
void do_makelight( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
int level, chance, strength;
bool checktool, checkbatt, checkchem, checkcirc, checklens;
OBJ_DATA *obj;
OBJ_INDEX_DATA *pObjIndex;
int vnum;
strcpy( arg , argument );
switch( ch->substate )
{
default:
if ( arg[0] == '\0' )
{
send_to_char( "&RUsage: Makeflashlight <name>\n\r&w", ch);
return;
}
checktool = FALSE;
checkbatt = FALSE;
checkchem = FALSE;
checkcirc = FALSE;
checklens = 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_LENS)
checklens = TRUE;
}
if ( !checktool )
{
send_to_char( "&RYou need toolkit to make a light.\n\r", ch);
return;
}
if ( !checklens )
{
send_to_char( "&RYou need a lens to make a light.\n\r", ch);
return;
}
if ( !checkbatt )
{
send_to_char( "&RYou need a battery for the light 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 to light would come in handy!\n\r", ch);
return;
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0);
if ( number_percent( ) < chance )
{
send_to_char( "&GYou begin the long process of making a light.\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 , 10 , do_makelight , 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);
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) (0);
vnum = 65;
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;
checklens = 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_LENS && checklens == FALSE)
{
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checklens = TRUE;
}
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0) ;
if ( number_percent( ) > chance*2 || ( !checktool ) || ( !checklens ) || ( !checkbatt ) || ( !checkchem ) || ( !checkcirc) )
{
send_to_char( "&RJust as you are about to finish your work,\n\ryour newly created light explodes in your hands...doh!\n\r", ch);
return;
}
obj = create_object( pObjIndex, level );
obj->item_type = ITEM_LIGHT;
SET_BIT( obj->wear_flags, ITEM_TAKE );
obj->level = level;
obj->weight = 3;
STRFREE( obj->name );
strcpy( buf , arg );
strcat( buf , " light ");
strcat( buf, remand(buf));
obj->name = STRALLOC( buf );
strcpy( buf, arg );
STRFREE( obj->short_descr );
obj->short_descr = STRALLOC( buf );
STRFREE( obj->description );
strcat( buf, " was carelessly misplaced here." );
obj->description = STRALLOC( buf );
obj->value[2] = strength;
obj->cost = obj->value[2];
obj = obj_to_char( obj, ch );
send_to_char( "&GYou finish your work and hold up your newly created light.&w\n\r", ch);
act( AT_PLAIN, "$n finishes making $s new light.", ch,
NULL, argument , TO_ROOM );
return;
}
void do_makejewelry( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
int level, chance;
bool checktool, checkoven, checkmetal;
OBJ_DATA *obj;
OBJ_DATA *metal;
AFFECT_DATA *paf;
int value, cost;
argument = one_argument( argument, arg );
strcpy ( arg2, argument);
if ( !str_cmp( arg, "body" )
|| !str_cmp( arg, "head" )
|| !str_cmp( arg, "legs" )
|| !str_cmp( arg, "arms" )
|| !str_cmp( arg, "about" )
|| !str_cmp( arg, "eyes" )
|| !str_cmp( arg, "waist" )
|| !str_cmp( arg, "hold" )
|| !str_cmp( arg, "feet" )
|| !str_cmp( arg, "hands" ))
{
send_to_char( "&RYou cannot make jewelry for that body part.\n\r&w", ch);
send_to_char( "&RTry MAKEARMOR.\n\r&w", ch);
return;
}
if ( !str_cmp( arg, "shield" ) )
{
send_to_char( "&RYou cannot make jewelry worn as a shield.\n\r&w", ch);
send_to_char( "&RTry MAKESHIELD.\n\r&w", ch);
return;
}
if ( !str_cmp( arg, "wield" ) )
{
send_to_char( "&RAre you going to fight with your jewelry?\n\r&w", ch);
send_to_char( "&RTry MAKEBLADE...\n\r&w", ch);
return;
}
if ( !str_cmp( arg, "holster1")
|| !str_cmp( arg, "holster2") )
{
send_to_char( "&RYou can't use jewelry there.&w\n\r", ch);
send_to_char( "&RTry MAKECONTAINER...\n\r&w", ch);
return;
}
switch( ch->substate )
{
default:
if ( arg2[0] == '\0' )
{
send_to_char( "&RUsage: Makejewelry <wearloc> <name>\n\r&w", ch);
return;
}
checktool = FALSE;
checkoven = 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_OVEN)
checkoven = TRUE;
if (obj->item_type == ITEM_RARE_METAL)
checkmetal = TRUE;
}
if ( !checktool )
{
send_to_char( "&RYou need a toolkit.\n\r", ch);
return;
}
if ( !checkoven )
{
send_to_char( "&RYou need an oven.\n\r", ch);
return;
}
if ( !checkmetal )
{
send_to_char( "&RYou need some precious metal.\n\r", ch);
return;
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0);
if ( number_percent( ) < chance )
{
send_to_char( "&GYou begin the long process of creating some jewelry.\n\r", ch);
act( AT_PLAIN, "$n takes $s toolkit and some metal and begins to work.", ch,
NULL, argument , TO_ROOM );
add_timer ( ch , TIMER_DO_FUN , 15 , do_makejewelry , 1 );
ch->dest_buf = str_dup(arg);
ch->dest_buf_2 = str_dup(arg2);
return;
}
send_to_char("&RYou can't figure out what to do.\n\r",ch);
return;
case 1:
if ( !ch->dest_buf )
return;
if ( !ch->dest_buf_2 )
return;
strcpy(arg, ch->dest_buf);
DISPOSE( ch->dest_buf);
strcpy(arg2, ch->dest_buf_2);
DISPOSE( ch->dest_buf_2);
break;
case SUB_TIMER_DO_ABORT:
DISPOSE( ch->dest_buf );
DISPOSE( ch->dest_buf_2 );
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) (0);
checkmetal = FALSE;
checkoven = FALSE;
checktool = FALSE;
value=0;
cost=0;
for ( obj = ch->last_carrying; obj; obj = obj->prev_content )
{
if (obj->item_type == ITEM_TOOLKIT)
checktool = TRUE;
if (obj->item_type == ITEM_OVEN)
checkoven = TRUE;
if (obj->item_type == ITEM_RARE_METAL && checkmetal == FALSE)
{
checkmetal = TRUE;
separate_obj( obj );
obj_from_char( obj );
metal = obj;
}
if (obj->item_type == ITEM_CRYSTAL)
{
cost += obj->cost;
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
}
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0) ;
if ( number_percent( ) > chance*2 || ( !checkoven ) || ( !checktool ) || ( !checkmetal ) )
{
send_to_char( "&RYou hold up your newly created jewelry.\n\r", ch);
send_to_char( "&RIt suddenly dawns upon you that you have created the most useless\n\r", ch);
send_to_char( "&Rpiece of junk you've ever seen. You quickly hide your mistake...\n\r", ch);
return;
}
obj = metal;
obj->item_type = ITEM_ARMOR;
SET_BIT( obj->wear_flags, ITEM_TAKE );
value = get_wflag( arg );
if ( value < 0 || value > 31 )
SET_BIT( obj->wear_flags, ITEM_WEAR_NECK );
else
SET_BIT( obj->wear_flags, 1 << value );
obj->level = level;
STRFREE( obj->name );
sprintf( buf, "%s ", arg2);
strcat( buf, remand(buf));
obj->name = STRALLOC( buf );
strcpy( buf, arg2 );
STRFREE( obj->short_descr );
obj->short_descr = STRALLOC( buf );
STRFREE( obj->description );
strcat( buf, " was dropped here." );
// Create stat bonuses for Jewelry - Tawnos
CREATE( paf, AFFECT_DATA, 1 );
paf->type = -1;
paf->duration = -1;
// Use smaller if check to minimize redundant code.
if( IS_SET( obj->wear_flags, ITEM_WEAR_FINGER ) )
{
if(number_bits(1) == 0)
paf->location = get_atype( "hitroll" );
else
paf->location = get_atype( "damroll" );
paf->modifier = number_bits(1)+1;
}
else if( IS_SET( obj->wear_flags, ITEM_WEAR_EARS ) )
{
if(number_bits(1) == 0)
paf->location = get_atype( "intelligence" );
else
paf->location = get_atype( "wisdom" );
paf->modifier = number_bits(1)+1;
}
else if( IS_SET( obj->wear_flags, ITEM_WEAR_NECK ) )
{
if(number_bits(1) == 0)
paf->location = get_atype( "charisma" );
else
paf->location = get_atype( "luck" );
paf->modifier = 1;
}
else if( IS_SET( obj->wear_flags, ITEM_WEAR_WRIST ) )
{
if(number_bits(1) == 0)
paf->location = get_atype( "strength" );
else
paf->location = get_atype( "dexterity" );
paf->modifier = 1;
}
else
{
paf->location = get_atype("strength");
paf->modifier = 1;
}
paf->bitvector = 0;
paf->next = NULL;
LINK( paf, obj->first_affect, obj->last_affect, next, prev );
++top_affect;
// End stat bonuses.
obj->description = STRALLOC( buf );
obj->value[1] = metal->value[1];
obj->value[0] = obj->value[1];
obj->cost *= 10;
obj->cost += cost;
obj = obj_to_char( obj, ch );
send_to_char( "&GYou finish your work and hold up your newly created jewelry.&w\n\r", ch);
act( AT_PLAIN, "$n finishes sewing some new jewelry.", ch,
NULL, argument , TO_ROOM );
return;
}
void do_makearmor( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
int level, chance;
bool checksew, checkfab;
OBJ_DATA *obj;
OBJ_DATA *material;
int value;
argument = one_argument( argument, arg );
strcpy ( arg2, argument);
if ( !str_cmp( arg, "eyes" )
|| !str_cmp( arg, "ears" )
|| !str_cmp( arg, "finger" )
|| !str_cmp( arg, "neck" )
|| !str_cmp( arg, "wrist" ) )
{
send_to_char( "&RYou cannot make clothing for that body part.\n\r&w", ch);
send_to_char( "&RTry MAKEJEWELRY.\n\r&w", ch);
return;
}
if ( !str_cmp( arg, "shield" ) )
{
send_to_char( "&RYou cannot make clothing worn as a shield.\n\r&w", ch);
send_to_char( "&RTry MAKESHIELD.\n\r&w", ch);
return;
}
if ( !str_cmp( arg, "wield" ) )
{
send_to_char( "&RAre you going to fight with your clothing?\n\r&w", ch);
send_to_char( "&RTry MAKEBLADE...\n\r&w", ch);
return;
}
if ( !str_cmp( arg, "holster1")
|| !str_cmp( arg, "holster2") )
{
send_to_char( "&RYou can't use armor there.&w\n\r", ch);
send_to_char( "&RTry MAKECONTAINER...\n\r&w", ch);
return;
}
switch( ch->substate )
{
default:
if ( arg2[0] == '\0' )
{
send_to_char( "&RUsage: Makearmor <wearloc> <name>\n\r&w", ch);
return;
}
checksew = FALSE;
checkfab = 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_FABRIC)
checkfab = TRUE;
if (obj->item_type == ITEM_THREAD)
checksew = TRUE;
}
if ( !checkfab )
{
send_to_char( "&RYou need some sort of fabric or material.\n\r", ch);
return;
}
if ( !checksew )
{
send_to_char( "&RYou need a needle and some thread.\n\r", ch);
return;
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0);
if ( number_percent( ) < chance )
{
send_to_char( "&GYou begin the long process of creating some armor.\n\r", ch);
act( AT_PLAIN, "$n takes $s sewing kit and some material and begins to work.", ch,
NULL, argument , TO_ROOM );
add_timer ( ch , TIMER_DO_FUN , 15 , do_makearmor , 1 );
ch->dest_buf = str_dup(arg);
ch->dest_buf_2 = str_dup(arg2);
return;
}
send_to_char("&RYou can't figure out what to do.\n\r",ch);
return;
case 1:
if ( !ch->dest_buf )
return;
if ( !ch->dest_buf_2 )
return;
strcpy(arg, ch->dest_buf);
DISPOSE( ch->dest_buf);
strcpy(arg2, ch->dest_buf_2);
DISPOSE( ch->dest_buf_2);
break;
case SUB_TIMER_DO_ABORT:
DISPOSE( ch->dest_buf );
DISPOSE( ch->dest_buf_2 );
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) (0);
checksew = FALSE;
checkfab = FALSE;
for ( obj = ch->last_carrying; obj; obj = obj->prev_content )
{
if (obj->item_type == ITEM_THREAD)
checksew = TRUE;
if (obj->item_type == ITEM_FABRIC && checkfab == FALSE)
{
checkfab = TRUE;
separate_obj( obj );
obj_from_char( obj );
material = obj;
}
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0) ;
if ( number_percent( ) > chance*2 || ( !checkfab ) || ( !checksew ) )
{
send_to_char( "&RYou hold up your newly created armor.\n\r", ch);
send_to_char( "&RIt suddenly dawns upon you that you have created the most useless\n\r", ch);
send_to_char( "&Rgarment you've ever seen. You quickly hide your mistake...\n\r", ch);
return;
}
obj = material;
obj->item_type = ITEM_ARMOR;
SET_BIT( obj->wear_flags, ITEM_TAKE );
value = get_wflag( arg );
if ( value < 0 || value > 31 )
SET_BIT( obj->wear_flags, ITEM_WEAR_BODY );
else
SET_BIT( obj->wear_flags, 1 << value );
obj->level = level;
STRFREE( obj->name );
sprintf(buf, "%s ", arg2);
strcat( buf, remand(buf));
obj->name = STRALLOC( buf );
strcpy( buf, arg2 );
STRFREE( obj->short_descr );
obj->short_descr = STRALLOC( buf );
STRFREE( obj->description );
strcat( buf, " was dropped here." );
obj->description = STRALLOC( buf );
obj->value[0] = obj->value[1];
obj->cost *= 10;
obj = obj_to_char( obj, ch );
send_to_char( "&GYou finish your work and hold up your newly created garment.&w\n\r", ch);
act( AT_PLAIN, "$n finishes sewing some new armor.", ch,
NULL, argument , TO_ROOM );
return;
}
void do_makecomlink( CHAR_DATA *ch, char *argument)
{
char arg[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
int chance;
bool checktool, checkgem, checkbatt, checkcirc;
OBJ_DATA *obj;
OBJ_INDEX_DATA *pObjIndex;
int vnum;
argument = one_argument( argument, arg );
strcpy ( arg2, argument);
switch( ch->substate )
{
default:
if ( arg2[0] == '\0' )
{
send_to_char( "&RUsage: Makecomlink <wearloc> <name>\n\r&w", ch);
send_to_char( "&RAvailable wearlocs: hold, wrist, ears&w\n\r", ch);
return;
}
checktool = FALSE;
checkgem = FALSE;
checkbatt = FALSE;
checkcirc = 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_CRYSTAL)
checkgem = TRUE;
if (obj->item_type == ITEM_BATTERY)
checkbatt = TRUE;
if (obj->item_type == ITEM_CIRCUIT)
checkcirc = TRUE;
}
if ( !checktool )
{
send_to_char( "&RYou need toolkit to make a comlink.\n\r", ch);
return;
}
if ( !checkgem )
{
send_to_char( "&RYou need a small crystal.\n\r", ch);
return;
}
if ( !checkbatt )
{
send_to_char( "&RYou need a power source for your comlink.\n\r", ch);
return;
}
if ( !checkcirc )
{
send_to_char( "&RYou need a small circuit.\n\r", ch);
return;
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0);
if ( number_percent( ) < chance )
{
send_to_char( "&GYou begin the long process of making a comlink.\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 , 10 , do_makecomlink , 1 );
ch->dest_buf = str_dup(arg);
ch->dest_buf_2 = str_dup(arg2);
return;
}
send_to_char("&RYou can't figure out how to fit the parts together.\n\r",ch);
return;
case 1:
if ( !ch->dest_buf )
return;
strcpy(arg, ch->dest_buf);
DISPOSE( ch->dest_buf);
strcpy(arg2, ch->dest_buf_2);
DISPOSE( ch->dest_buf_2);
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;
vnum = 64;
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;
checkgem = FALSE;
checkbatt = 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_CRYSTAL && checkgem == FALSE)
{
checkgem = TRUE;
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
}
if (obj->item_type == ITEM_CIRCUIT && checkcirc == FALSE)
{
checkcirc = TRUE;
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
}
if (obj->item_type == ITEM_BATTERY && checkbatt == FALSE )
{
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checkbatt = TRUE;
}
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0) ;
if ( number_percent( ) > chance*2 || ( !checktool ) || ( !checkcirc ) || ( !checkbatt ) || ( !checkgem ) )
{
send_to_char( "&RYou hold up your newly created comlink....\n\r", ch);
send_to_char( "&Rand it falls apart in your hands.\n\r", ch);
return;
}
obj = create_object( pObjIndex, ch->top_level );
obj->item_type = ITEM_COMLINK;
if (arg==NULL || !str_cmp(arg, "hold" ))
SET_BIT( obj->wear_flags, ITEM_HOLD );
if ( !str_cmp(arg, "ears"))
{
SET_BIT( obj->wear_flags, ITEM_WEAR_EARS );
REMOVE_BIT( obj->wear_flags, ITEM_HOLD);
}
if ( !str_cmp(arg, "wrist"))
{
SET_BIT( obj->wear_flags, ITEM_WEAR_WRIST );
REMOVE_BIT( obj->wear_flags, ITEM_HOLD);
}
SET_BIT( obj->wear_flags, ITEM_TAKE );
obj->weight = 3;
STRFREE( obj->name );
strcpy( buf, arg2 );
strcat( buf, " comlink " );
strcat( buf, remand(buf));
obj->name = STRALLOC( buf );
strcpy( buf, arg2 );
STRFREE( obj->short_descr );
obj->short_descr = STRALLOC( buf );
STRFREE( obj->description );
strcat( buf, " was left here." );
obj->description = STRALLOC( buf );
obj->cost = 50;
obj = obj_to_char( obj, ch );
send_to_char( "&GYou finish your work and hold up your newly created comlink.&w\n\r", ch);
act( AT_PLAIN, "$n finishes crafting a comlink.", ch,
NULL, argument , TO_ROOM );
return;
}
void do_makeshield( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
int chance;
bool checktool, checkbatt, checkcond, checkcirc, checkgems;
OBJ_DATA *obj;
OBJ_INDEX_DATA *pObjIndex;
int vnum, level, charge, gemtype;
strcpy( arg, argument );
switch( ch->substate )
{
default:
if ( arg[0] == '\0' )
{
send_to_char( "&RUsage: Makeshield <name>\n\r&w", ch);
return;
}
checktool = FALSE;
checkbatt = FALSE;
checkcond = FALSE;
checkcirc = FALSE;
checkgems = FALSE;
if ( !IS_SET( ch->in_room->room_flags, ROOM_FACTORY ) )
{
send_to_char( "&RYou need to be in a workshop.\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_CRYSTAL)
checkgems = TRUE;
if (obj->item_type == ITEM_BATTERY)
checkbatt = TRUE;
if (obj->item_type == ITEM_CIRCUIT)
checkcirc = TRUE;
if (obj->item_type == ITEM_SUPERCONDUCTOR)
checkcond = TRUE;
}
if ( !checktool )
{
send_to_char( "&RYou need toolkit to make an energy shield.\n\r", ch);
return;
}
if ( !checkbatt )
{
send_to_char( "&RYou need a power source for your energy shield.\n\r", ch);
return;
}
if ( !checkcirc )
{
send_to_char( "&RYou need a small circuit board.\n\r", ch);
return;
}
if ( !checkcond )
{
send_to_char( "&RYou still need a small superconductor for your energy shield.\n\r", ch);
return;
}
if ( !checkgems )
{
send_to_char( "&RYou need a small crystal.\n\r", ch);
return;
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0);
if ( number_percent( ) < chance )
{
send_to_char( "&GYou begin the long process of crafting an energy shield.\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 , 20 , do_makeshield , 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);
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) (0);
vnum = 28;
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;
checkbatt = FALSE;
checkcond = FALSE;
checkcirc = FALSE;
checkgems = FALSE;
charge = 0;
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)
{
charge = UMIN(obj->value[1], 10);
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checkbatt = TRUE;
}
if (obj->item_type == ITEM_SUPERCONDUCTOR && checkcond == FALSE)
{
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checkcond = 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_CRYSTAL && checkgems == FALSE)
{
gemtype = obj->value[0];
separate_obj( obj );
obj_from_char( obj );
extract_obj( obj );
checkgems = TRUE;
}
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0) ;
if ( number_percent( ) > chance*2 || ( !checktool ) || ( !checkbatt )
|| ( !checkgems ) || ( !checkcond ) || ( !checkcirc) )
{
send_to_char( "&RYou hold up your new energy shield and press the switch hoping for the best.\n\r", ch);
send_to_char( "&RInstead of a field of energy being created, smoke starts pouring from the device.\n\r", ch);
send_to_char( "&RYou drop the hot device and watch as it melts on away on the floor.\n\r", ch);
return;
}
obj = create_object( pObjIndex, level );
obj->item_type = ITEM_ARMOR;
SET_BIT( obj->wear_flags, ITEM_WIELD );
SET_BIT( obj->wear_flags, ITEM_WEAR_SHIELD );
obj->level = level;
obj->weight = 2;
STRFREE( obj->name );
obj->name = STRALLOC( "energy shield" );
strcpy( buf, arg );
STRFREE( obj->short_descr );
obj->short_descr = STRALLOC( buf );
STRFREE( obj->description );
strcat( buf, " was carelessly misplaced here." );
obj->description = STRALLOC( buf );
obj->value[0] = (int) (level/10+gemtype*10); /* condition */
obj->value[1] = (int) (level/10+gemtype*10); /* armor */
obj->value[4] = charge;
obj->value[5] = charge;
obj->cost = obj->value[2]*100;
obj = obj_to_char( obj, ch );
send_to_char( "&GYou finish your work and hold up your newly created energy shield.&w\n\r", ch);
act( AT_PLAIN, "$n finishes making $s new energy shield.", ch,
NULL, argument , TO_ROOM );
return;
}
void do_makecontainer( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
int level, chance;
bool checksew, checkfab;
OBJ_DATA *obj;
OBJ_DATA *material;
int value;
argument = one_argument( argument, arg );
strcpy( arg2 , argument );
if ( !str_cmp( arg, "eyes" )
|| !str_cmp( arg, "ears" )
|| !str_cmp( arg, "finger" )
|| !str_cmp( arg, "neck" )
|| !str_cmp( arg, "wrist" ) )
{
send_to_char( "&RYou cannot make a container for that body part.\n\r&w", ch);
send_to_char( "&RTry MAKEJEWELRY.\n\r&w", ch);
return;
}
if ( !str_cmp( arg, "feet" )
|| !str_cmp( arg, "hands" ) )
{
send_to_char( "&RYou cannot make a container for that body part.\n\r&w", ch);
send_to_char( "&RTry MAKEARMOR.\n\r&w", ch);
return;
}
if ( !str_cmp( arg, "shield" ) )
{
send_to_char( "&RYou cannot make a container a shield.\n\r&w", ch);
send_to_char( "&RTry MAKESHIELD.\n\r&w", ch);
return;
}
if ( !str_cmp( arg, "wield" ) )
{
send_to_char( "&RAre you going to fight with a container?\n\r&w", ch);
send_to_char( "&RTry MAKEBLADE...\n\r&w", ch);
return;
}
switch( ch->substate )
{
default:
if ( arg2[0] == '\0' )
{
send_to_char( "&RUsage: Makecontainer <wearloc> <name>\n\r&w", ch);
return;
}
checksew = FALSE;
checkfab = 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_FABRIC)
checkfab = TRUE;
if (obj->item_type == ITEM_THREAD)
checksew = TRUE;
}
if ( !checkfab )
{
send_to_char( "&RYou need some sort of fabric or material.\n\r", ch);
return;
}
if ( !checksew )
{
send_to_char( "&RYou need a needle and some thread.\n\r", ch);
return;
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0);
if ( number_percent( ) < chance )
{
send_to_char( "&GYou begin the long process of creating a bag.\n\r", ch);
act( AT_PLAIN, "$n takes $s sewing kit and some material and begins to work.", ch,
NULL, argument , TO_ROOM );
add_timer ( ch , TIMER_DO_FUN , 10 , do_makecontainer , 1 );
ch->dest_buf = str_dup(arg);
ch->dest_buf_2 = str_dup(arg2);
return;
}
send_to_char("&RYou can't figure out what to do.\n\r",ch);
return;
case 1:
if ( !ch->dest_buf )
return;
if ( !ch->dest_buf_2 )
return;
strcpy(arg, ch->dest_buf);
DISPOSE( ch->dest_buf);
strcpy(arg2, ch->dest_buf_2);
DISPOSE( ch->dest_buf_2);
break;
case SUB_TIMER_DO_ABORT:
DISPOSE( ch->dest_buf );
DISPOSE( ch->dest_buf_2 );
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) (0);
checksew = FALSE;
checkfab = FALSE;
for ( obj = ch->last_carrying; obj; obj = obj->prev_content )
{
if (obj->item_type == ITEM_THREAD)
checksew = TRUE;
if (obj->item_type == ITEM_FABRIC && checkfab == FALSE)
{
checkfab = TRUE;
separate_obj( obj );
obj_from_char( obj );
material = obj;
}
}
chance = IS_NPC(ch) ? ch->top_level
: (int) (0) ;
if ( number_percent( ) > chance*2 || ( !checkfab ) || ( !checksew ) )
{
send_to_char( "&RYou hold up your newly created container.\n\r", ch);
send_to_char( "&RIt suddenly dawns upon you that you have created the most useless\n\r", ch);
send_to_char( "&Rcontainer you've ever seen. You quickly hide your mistake...\n\r", ch);
return;
}
obj = material;
obj->item_type = ITEM_CONTAINER;
SET_BIT( obj->wear_flags, ITEM_TAKE );
value = get_wflag( arg );
if ( value < 0 || value > 31 )
SET_BIT( obj->wear_flags, ITEM_HOLD );
else
SET_BIT( obj->wear_flags, 1 << value );
obj->level = level;
STRFREE( obj->name );
strcpy( buf, arg2 );
strcat( buf, " ");
strcat( buf, remand(buf));
obj->name = STRALLOC( buf );
strcpy( buf, arg2 );
STRFREE( obj->short_descr );
obj->short_descr = STRALLOC( buf );
STRFREE( obj->description );
strcat( buf, " was dropped here." );
obj->description = STRALLOC( buf );
obj->value[0] = level;
obj->value[1] = 0;
obj->value[2] = 0;
obj->value[3] = 10;
obj->cost *= 2;
obj = obj_to_char( obj, ch );
send_to_char( "&GYou finish your work and hold up your newly created container.&w\n\r", ch);
act( AT_PLAIN, "$n finishes sewing a new container.", ch,
NULL, argument , TO_ROOM );
return;
}
void do_gemcutting( CHAR_DATA *ch, char *argument )
{
send_to_char( "&RSorry, this skill isn't finished yet :(\n\r", ch);
}
void do_reinforcements( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
int chance, credits;
if ( IS_NPC( ch ) || !ch->pcdata )
return;
strcpy( arg, argument );
switch( ch->substate )
{
default:
if ( ch->backup_wait )
{
send_to_char( "&RYour reinforcements are already on the way.\n\r", ch );
return;
}
if ( !ch->pcdata->clan )
{
send_to_char( "&RYou need to be a member of an organization before you can call for reinforcements.\n\r", ch );
return;
}
if ( ch->gold < 5000 )
{
ch_printf( ch, "&RYou dont have enough credits to send for reinforcements.\n\r" );
return;
}
chance = (int) (0);
if ( number_percent( ) < chance )
{
send_to_char( "&GYou begin making the call for reinforcements.\n\r", ch);
act( AT_PLAIN, "$n begins issuing orders int $s comlink.", ch,
NULL, argument , TO_ROOM );
add_timer ( ch , TIMER_DO_FUN , 1 , do_reinforcements , 1 );
ch->dest_buf = str_dup(arg);
return;
}
send_to_char("&RYou call for reinforcements but nobody answers.\n\r",ch);
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 before you can finish your call.\n\r", ch);
return;
}
ch->substate = SUB_NONE;
send_to_char( "&GYour reinforcements are on the way.\n\r", ch);
credits = 5000;
ch_printf( ch, "It cost you %d credits.\n\r", credits);
ch->gold -= UMIN( credits , ch->gold );
if ( nifty_is_name( "empire" , ch->pcdata->clan->name ) )
ch->backup_mob = MOB_VNUM_STORMTROOPER;
else if ( nifty_is_name( "republic" , ch->pcdata->clan->name ) )
ch->backup_mob = MOB_VNUM_NR_TROOPER;
else
ch->backup_mob = MOB_VNUM_MERCINARY;
ch->backup_wait = number_range(1,2);
}
void do_postguard( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
int chance, credits;
if ( IS_NPC( ch ) || !ch->pcdata )
return;
strcpy( arg, argument );
switch( ch->substate )
{
default:
if ( ch->backup_wait )
{
send_to_char( "&RYou already have backup coming.\n\r", ch );
return;
}
if ( !ch->pcdata->clan )
{
send_to_char( "&RYou need to be a member of an organization before you can call for a guard.\n\r", ch );
return;
}
if ( ch->gold < 3000 )
{
ch_printf( ch, "&RYou dont have enough credits.\n\r", ch );
return;
}
chance = (int) (0);
if ( number_percent( ) < chance )
{
send_to_char( "&GYou begin making the call for reinforcements.\n\r", ch);
act( AT_PLAIN, "$n begins issuing orders int $s comlink.", ch,
NULL, argument , TO_ROOM );
add_timer ( ch , TIMER_DO_FUN , 1 , do_postguard , 1 );
ch->dest_buf = str_dup(arg);
return;
}
send_to_char("&RYou call for a guard but nobody answers.\n\r",ch);
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 before you can finish your call.\n\r", ch);
return;
}
ch->substate = SUB_NONE;
send_to_char( "&GYour guard is on the way.\n\r", ch);
credits = 3000;
ch_printf( ch, "It cost you %d credits.\n\r", credits);
ch->gold -= UMIN( credits , ch->gold );
if ( nifty_is_name( "empire" , ch->pcdata->clan->name ) )
ch->backup_mob = MOB_VNUM_IMP_GUARD;
else if ( nifty_is_name( "republic" , ch->pcdata->clan->name ) )
ch->backup_mob = MOB_VNUM_NR_GUARD;
else
ch->backup_mob = MOB_VNUM_BOUNCER;
ch->backup_wait = 1;
}
void add_reinforcements( CHAR_DATA *ch )
{
MOB_INDEX_DATA * pMobIndex;
OBJ_DATA * blaster;
OBJ_INDEX_DATA * pObjIndex;
int max=1;
if ( ( pMobIndex = get_mob_index( ch->backup_mob ) ) == NULL )
return;
if ( ch->backup_mob == MOB_VNUM_STORMTROOPER ||
ch->backup_mob == MOB_VNUM_NR_TROOPER ||
ch->backup_mob == MOB_VNUM_MERCINARY ||
ch->backup_mob == MOB_VNUM_IMP_FORCES ||
ch->backup_mob == MOB_VNUM_NR_FORCES ||
ch->backup_mob == MOB_VNUM_MERC_FORCES )
{
CHAR_DATA * mob[3];
int mob_cnt;
send_to_char( "Your reinforcements have arrived.\n\r", ch );
if( ch->backup_mob == MOB_VNUM_STORMTROOPER || ch->backup_mob ==
MOB_VNUM_NR_TROOPER || ch->backup_mob == MOB_VNUM_MERCINARY )
max=3;
for ( mob_cnt = 0 ; mob_cnt < max ; mob_cnt++ )
{
int ability;
mob[mob_cnt] = create_mobile( pMobIndex );
char_to_room( mob[mob_cnt], ch->in_room );
act( AT_IMMORT, "$N has arrived.", ch, NULL, mob[mob_cnt], TO_ROOM );
mob[mob_cnt]->top_level = ch->top_level;
for ( ability = 0 ; ability < MAX_ABILITY ; ability++ )
mob[mob_cnt]->skill_level[ability] = mob[mob_cnt]->top_level;
mob[mob_cnt]->hit = mob[mob_cnt]->top_level*15;
mob[mob_cnt]->max_hit = mob[mob_cnt]->hit;
mob[mob_cnt]->armor = 100- mob[mob_cnt]->top_level*2.5;
mob[mob_cnt]->damroll = mob[mob_cnt]->top_level/5;
mob[mob_cnt]->hitroll = mob[mob_cnt]->top_level/5;
if ( ( pObjIndex = get_obj_index( OBJ_VNUM_BLASTECH_E11 ) ) != NULL )
{
blaster = create_object( pObjIndex, mob[mob_cnt]->top_level );
obj_to_char( blaster, mob[mob_cnt] );
equip_char( mob[mob_cnt], blaster, WEAR_WIELD );
}
if ( mob[mob_cnt]->master )
stop_follower( mob[mob_cnt] );
add_follower( mob[mob_cnt], ch );
SET_BIT( mob[mob_cnt]->affected_by, AFF_CHARM );
do_setblaster( mob[mob_cnt] , "full" );
}
}
else
{
CHAR_DATA *mob;
int ability;
mob = create_mobile( pMobIndex );
char_to_room( mob, ch->in_room );
if ( ch->pcdata && ch->pcdata->clan )
{
char tmpbuf[MAX_STRING_LENGTH];
//STRFREE( mob->name );
//mob->name = STRALLOC( ch->pcdata->clan->name );
sprintf( tmpbuf , "(%s) %s" , ch->pcdata->clan->name , mob->long_descr );
STRFREE( mob->long_descr );
mob->long_descr = STRALLOC( tmpbuf );
}
act( AT_IMMORT, "$N has arrived.", ch, NULL, mob, TO_ROOM );
send_to_char( "Your guard has arrived.\n\r", ch );
mob->top_level = ch->top_level;
for ( ability = 0 ; ability < MAX_ABILITY ; ability++ )
mob->skill_level[ability] = mob->top_level;
mob->hit = mob->top_level*15;
mob->max_hit = mob->hit;
mob->armor = 100- mob->top_level*2.5;
mob->damroll = mob->top_level/5;
mob->hitroll = mob->top_level/5;
if ( ( pObjIndex = get_obj_index( OBJ_VNUM_BLASTECH_E11 ) ) != NULL )
{
blaster = create_object( pObjIndex, mob->top_level );
obj_to_char( blaster, mob );
equip_char( mob, blaster, WEAR_WIELD );
}
/* for making this more accurate in the future */
if ( mob->mob_clan )
STRFREE ( mob->mob_clan );
if ( ch->pcdata && ch->pcdata->clan )
mob->mob_clan = STRALLOC( ch->pcdata->clan->name );
}
}
void do_torture( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
int chance, dam;
bool fail;
if ( IS_NPC(ch) && IS_AFFECTED( ch, AFF_CHARM ) )
{
send_to_char( "You can't do that right now.\n\r", ch );
return;
}
one_argument( argument, arg );
if ( ch->mount )
{
send_to_char( "You can't get close enough while mounted.\n\r", ch );
return;
}
if ( arg[0] == '\0' )
{
send_to_char( "Torture 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 ( victim == ch )
{
send_to_char( "Are you masacistic or what...\n\r", ch );
return;
}
if ( !IS_AWAKE(victim) )
{
send_to_char( "You need to wake them first.\n\r", ch );
return;
}
if ( is_safe( ch, victim ) )
return;
if ( victim->fighting )
{
send_to_char( "You can't torture someone whos in combat.\n\r", ch );
return;
}
ch->alignment = ch->alignment -= 100;
ch->alignment = URANGE( -1000, ch->alignment, 1000 );
WAIT_STATE( ch, PULSE_PER_SECOND*2 );
fail = FALSE;
chance = ris_save( victim, 0, RIS_PARALYSIS );
if ( chance == 1000 )
fail = TRUE;
else
fail = saves_para_petri( chance, victim );
if ( !IS_NPC(ch) && !IS_NPC(victim) )
chance = sysdata.stun_plr_vs_plr;
else
chance = sysdata.stun_regular;
if ( ( !fail
&& ( IS_NPC(ch)
|| (number_percent( ) + chance) < 0 ) ) || ((!IS_NPC(victim)) && (IS_SET(victim->pcdata->act2, ACT_BOUND))))
{
WAIT_STATE( ch, 2 * PULSE_VIOLENCE );
WAIT_STATE( victim, PULSE_VIOLENCE );
act( AT_SKILL, "$N slowly tortures you. The pain is excruciating.", victim, NULL, ch, TO_CHAR );
act( AT_SKILL, "You torture $N, leaving $M screaming in pain.", ch, NULL, victim, TO_CHAR );
act( AT_SKILL, "$n tortures $N, leaving $M screaming in agony!", ch, NULL, victim, TO_NOTVICT );
dam = dice( 1, 4 );
dam = URANGE( 0, victim->max_hit-10, dam );
victim->hit -= dam;
victim->max_hit -= dam;
ch_printf( victim, "You lose %d permanent hit points." ,dam);
ch_printf( ch, "They lose %d permanent hit points." , dam);
}
else
{
act( AT_SKILL, "$N tries to cut off your finger!", victim, NULL, ch, TO_CHAR );
act( AT_SKILL, "You mess up big time.", ch, NULL, victim, TO_CHAR );
act( AT_SKILL, "$n tries to painfully torture $N.", ch, NULL, victim, TO_NOTVICT );
WAIT_STATE( ch, 2 * PULSE_VIOLENCE );
global_retcode = multi_hit( victim, ch, TYPE_UNDEFINED );
}
return;
}
void do_disguise( CHAR_DATA *ch, char *argument )
{
int chance;
if ( IS_NPC(ch) )
return;
if ( IS_SET( ch->pcdata->flags, PCFLAG_NOTITLE ))
{
send_to_char( "You try but the Force resists you.\n\r", ch );
return;
}
if ( argument[0] == '\0' )
{
send_to_char( "Syntax: disguise <disguise|clear>\n\r", ch );
return;
}
if ( !str_cmp(argument, "clear") )
{
STRFREE(ch->pcdata->disguise);
ch->pcdata->disguise = STRALLOC( "" );
send_to_char( "Disguise cleared.\n\r", ch);
return;
}
chance = (int) (0);
if ( number_percent( ) > chance )
{
send_to_char( "You try to disguise yourself but fail.\n\r", ch );
return;
}
if(strlen(argument) > 40)
argument[40] = '\0';
smash_tilde( argument );
STRFREE( ch->pcdata->disguise );
ch->pcdata->disguise = STRALLOC( argument );
send_to_char( "Ok.\n\r", ch );
}
void do_deception( CHAR_DATA *ch, char *argument )
{
int chance;
if ( IS_NPC(ch) )
return;
if ( IS_SET( ch->pcdata->flags, PCFLAG_NOTITLE ))
{
send_to_char( "You try but the Force resists you.\n\r", ch );
return;
}
if ( argument[0] == '\0' )
{
send_to_char( "Syntax: deception <name|clear>\n\r", ch );
return;
}
if ( !str_cmp(argument, "clear") )
{
STRFREE(ch->pcdata->disguise);
ch->pcdata->disguise = STRALLOC( "" );
send_to_char( "You cease your deception.\n\r", ch);
return;
}
chance = (int) (0);
if ( number_percent( ) > chance )
{
send_to_char( "You fail to deceive others.\n\r", ch );
return;
}
if(strlen(argument) > 40)
argument[40] = '\0';
smash_tilde( argument );
STRFREE( ch->pcdata->disguise );
ch->pcdata->disguise = STRALLOC( argument );
send_to_char( "Ok.\n\r", ch );
}
void do_mine( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
bool shovel;
sh_int move;
one_argument( argument, arg );
Showing the first 100 KB of 190.1 KB. Download the archive for the full file.