void do_gag( CHAR_DATA * ch, char *argument ) { CHAR_DATA *victim; int schance; if( argument[0] == '\0' ) { send_to_char( "Syntax: Gag <victim>\n\r", ch ); return; } if( ( victim = get_char_room( ch, argument ) ) == NULL ) { send_to_char( "They are not here.\n\r", ch ); return; } if( victim == ch ) { send_to_char( "You can not gag yourself!\n\r", ch ); return; } if( IS_NPC( victim ) ) { send_to_char( "You can only gag players.\n\r", ch ); return; } if( ( victim->position != POS_STUNNED ) && ( victim->position != POS_SLEEPING ) && !IS_SET( victim->pcdata->act2, ACT_BOUND ) ) { send_to_char( "They need to be stunned, asleep, or bound.\n\r", ch ); return; } schance = ( int )( ch->pcdata->learned[gsn_gag] ); if( number_percent( ) < schance ) { act( AT_WHITE, "You quickly place a gag over $N's mouth.", ch, NULL, victim, TO_CHAR ); act( AT_WHITE, "$n roughly puts a gag over your mouth.", ch, NULL, victim, TO_VICT ); act( AT_WHITE, "$n roughly places a gag on $N's mouth.", ch, NULL, victim, TO_NOTVICT ); SET_BIT( victim->pcdata->act2, ACT_GAGGED ); learn_from_success( ch, gsn_gag ); } else { send_to_char( "You look puzzled as you wonder how to put on such a contraption.\n\r", ch ); learn_from_failure( ch, gsn_gag ); } return; }
void do_track( CHAR_DATA* ch, const char* argument) { CHAR_DATA *vict; char arg[MAX_INPUT_LENGTH]; int dir, maxdist; if( !IS_NPC( ch ) && ch->pcdata->learned[gsn_track] <= 0 ) { send_to_char( "You do not know of this skill yet.\r\n", ch ); return; } one_argument( argument, arg ); if( arg[0] == '\0' ) { send_to_char( "Whom are you trying to track?\r\n", ch ); return; } WAIT_STATE( ch, skill_table[gsn_track]->beats ); if( !( vict = get_char_world( ch, arg ) ) ) { send_to_char( "You can't find a trail of anyone like that.\r\n", ch ); return; } maxdist = 100 + ch->level * 30; if( !IS_NPC( ch ) ) maxdist = ( maxdist * LEARNED( ch, gsn_track ) ) / 100; dir = find_first_step( ch->in_room, vict->in_room, maxdist ); switch ( dir ) { case BFS_ERROR: send_to_char( "Hmm... something seems to be wrong.\r\n", ch ); break; case BFS_ALREADY_THERE: send_to_char( "You're already in the same room!\r\n", ch ); break; case BFS_NO_PATH: send_to_char( "You can't sense a trail from here.\r\n", ch ); learn_from_failure( ch, gsn_track ); break; default: ch_printf( ch, "You sense a trail %s from here...\r\n", dir_name[dir] ); learn_from_success( ch, gsn_track ); break; } }
void do_showbugs( CHAR_DATA * ch, char *argument ) { DESCRIPTOR_DATA *d; CHAR_DATA *victim; int schance; char buf2[MAX_STRING_LENGTH]; SHIP_DATA *ship; BUG_DATA *pbug; char buf[MAX_STRING_LENGTH]; schance = number_percent( ) - 20; if( schance > ch->pcdata->learned[gsn_showbugs] ) { send_to_char( "You can't figure out what to do.\n\r", ch ); learn_from_failure( ch, gsn_showbugs ); return; } send_to_char( "Player Planet/Ship Room Name\n\r", ch ); send_to_char( "------ ----------- ---------\n\r", ch ); for( d = first_descriptor; d; d = d->next ) if( ( d->connected == CON_PLAYING || d->connected == CON_EDITING ) && ( victim = d->character ) != NULL ) { for( pbug = victim->first_bug; pbug; pbug = pbug->next_in_bug ) if( !str_cmp( pbug->name, ch->name ) ) { if( victim->in_room->area && victim->in_room->area->planet ) sprintf( buf2, "%s", victim->in_room->area->planet->name ); else if( ( ship = ship_from_room( victim->in_room->vnum ) ) != NULL ) sprintf( buf2, "%s", ship->name ); else sprintf( buf2, "Unknown" ); sprintf( buf, "%-21.21s %-18.18s %s\n\r", PERS( victim, ch ), buf2, victim->in_room->name ); send_to_char( buf, ch ); break; } } learn_from_success( ch, gsn_showbugs ); }
void do_ambush( CHAR_DATA * ch, char *argument ) { CHAR_DATA *victim; int percent; if( argument[0] == '\0' ) { send_to_char( "Syntax: Ambush <victim>\n\r", ch ); return; } if( IS_NPC( ch ) ) { send_to_char( "Only players may use this ability.\n\r", ch ); return; } if( ( victim = get_char_room( ch, argument ) ) == NULL ) { send_to_char( "How can you ambush someone who's not even here.\n\r", ch ); return; } if( ch == victim ) { send_to_char( "How can you possibly ambush yourself?\n\r", ch ); return; } if( ch->position == POS_FIGHTING ) { send_to_char( "You are already fighting someone!\n\r", ch ); return; } if( victim->position == POS_FIGHTING ) { send_to_char( "They are already fighting someone!\n\r", ch ); return; } if( victim->position <= POS_STUNNED ) { send_to_char( "Come now, there's no honor in that!\n\r", ch ); return; } if( !IS_SET( ch->affected_by, AFF_SNEAK ) ) { send_to_char( "You are moving far too loudly to ambush someone!\n\r", ch ); return; } percent = number_percent( ) - ( get_curr_lck( ch ) - 14 ) + ( get_curr_lck( victim ) - 13 ); affect_strip( ch, gsn_sneak ); affect_strip( ch, gsn_silent ); REMOVE_BIT( ch->affected_by, AFF_HIDE ); if( ch->race != RACE_DEFEL ) /* Defel has perm invis */ REMOVE_BIT( ch->affected_by, AFF_INVISIBLE ); if( ch->race != RACE_NOGHRI ) /* Noghri has perm sneak */ REMOVE_BIT( ch->affected_by, AFF_SNEAK ); act( AT_RED, "You jump out from behind $N and attack $M!", ch, NULL, victim, TO_CHAR ); act( AT_RED, "$n jumps out from behind you and attacks you!", ch, NULL, victim, TO_VICT ); act( AT_RED, "$n jumps out from behind $N and attacks $M!", ch, NULL, victim, TO_NOTVICT ); if( !IS_AWAKE( victim ) || percent < ch->pcdata->learned[gsn_ambush] ) { multi_hit( ch, victim, gsn_ambush ); learn_from_success( ch, gsn_ambush ); } else { learn_from_failure( ch, gsn_ambush ); global_retcode = damage( ch, victim, 0, gsn_ambush ); } }
void do_plantbug( CHAR_DATA * ch, char *argument ) { CHAR_DATA *victim; BUG_DATA *pbug; BUG_DATA *cbug; OBJ_DATA *obj; bool checkbug = FALSE; int schance; if( IS_NPC( ch ) ) return; if( ( victim = get_char_room( ch, argument ) ) == NULL ) { send_to_char( "They aren't here.\n\r", ch ); return; } if( IS_NPC( victim ) ) { send_to_char( "You can't bug NPC's!\n\r", ch ); return; } if( IS_IMMORTAL( victim ) ) { send_to_char( "Don't try to plant bugs on immortals.\n\r", ch ); return; } if( in_arena( ch ) ) { send_to_char( "You're here to FIGHT, not spy.\n\r", ch ); return; } if( ch == victim ) { send_to_char( "You can't bug yourself!\n\r", ch ); return; } for( obj = ch->last_carrying; obj; obj = obj->prev_content ) if( obj->item_type == ITEM_BUG ) checkbug = TRUE; if( checkbug == FALSE ) { send_to_char( "You don't have any bugs to plant.\n\r", ch ); return; } for( cbug = victim->first_bug; cbug; cbug = cbug->next_in_bug ) if( !str_cmp( ch->name, cbug->name ) ) { send_to_char( "You have already planted a bug on this person.\n\r", ch ); return; } schance = number_percent( ) - UMIN( 0, ( get_curr_lck( ch ) - 14 ) ) + UMIN( 0, ( get_curr_lck( victim ) - 13 ) ); if( schance < ch->pcdata->learned[gsn_plantbug] ) { act( AT_WHITE, "You carefully reach into $N's pocket and place a bug.", ch, NULL, victim, TO_CHAR ); CREATE( pbug, BUG_DATA, 1 ); pbug->name = ch->name; LINK( pbug, victim->first_bug, victim->last_bug, next_in_bug, prev_in_bug ); learn_from_success( ch, gsn_plantbug ); for( obj = ch->last_carrying; obj; obj = obj->prev_content ) { if( obj->item_type == ITEM_BUG ) { separate_obj( obj ); obj_from_char( obj ); extract_obj( obj ); break; } } return; } else { send_to_char( "&RYou try to find a pocket to plant the bug in but fail!\n\r", ch ); learn_from_failure( ch, gsn_plantbug ); if( number_bits( 0 ) == 0 ) ch_printf( victim, "You feel a slight brush against your pocket to find %s's hand there.\n\r", PERS( ch, victim ) ); return; } }
void do_bind( CHAR_DATA * ch, char *argument ) { OBJ_DATA *obj; OBJ_DATA *tobj; int schance; CHAR_DATA *victim; bool checkbinders = FALSE; if( argument[0] == '\0' ) { send_to_char( "Syntax: Bind <victim>\n\r", ch ); return; } if( ( victim = get_char_room( ch, argument ) ) == NULL ) { send_to_char( "They are not here.\n\r", ch ); return; } if( victim == ch ) { send_to_char( "You can not bind yourself!\n\r", ch ); return; } if( IS_NPC( victim ) ) { send_to_char( "You can only bind players.\n\r", ch ); return; } if( IS_SET( victim->pcdata->act2, ACT_BOUND ) ) { send_to_char( "They've already been bound!\n\r", ch ); return; } for( obj = ch->last_carrying; obj; obj = obj->prev_content ) if( obj->item_type == ITEM_BINDERS ) { checkbinders = TRUE; break; } if( checkbinders == FALSE ) { send_to_char( "You don't have any binders to bind them with.\n\r", ch ); return; } if( victim->position != POS_STUNNED && victim->position != POS_SLEEPING ) { send_to_char( "They need to be stunned or asleep.\n\r", ch ); return; } schance = ( int )( ch->pcdata->learned[gsn_bind] ); if( number_percent( ) < schance ) { separate_obj( obj ); obj_from_char( obj ); obj_to_char( obj, victim ); act( AT_WHITE, "You quickly bind $N's wrists.", ch, NULL, victim, TO_CHAR ); act( AT_WHITE, "$n quickly binds your wrists.", ch, NULL, victim, TO_VICT ); act( AT_WHITE, "$n quickly binds $N's wrists.", ch, NULL, victim, TO_NOTVICT ); tobj = get_eq_char( ch, WEAR_BOTH_WRISTS ); if( tobj ) unequip_char( ch, tobj ); equip_char( victim, obj, WEAR_BOTH_WRISTS ); SET_BIT( victim->pcdata->act2, ACT_BOUND ); learn_from_success( ch, gsn_bind ); } else { send_to_char( "You peer at the binders, curious upon how to use them.\n\r", ch ); learn_from_failure( ch, gsn_bind ); } return; }
void do_buy( CHAR_DATA *ch, char *argument ) { char arg[MAX_INPUT_LENGTH]; int maxgold; bool debit; OBJ_DATA *obj; argument = one_argument( argument, arg ); if ( arg[0] == '\0' ) { send_to_char( "Buy what?\n\r", ch ); return; } if ( IS_SET(ch->in_room->room_flags, ROOM_PET_SHOP) ) { char buf[MAX_STRING_LENGTH]; CHAR_DATA *pet; ROOM_INDEX_DATA *pRoomIndexNext; ROOM_INDEX_DATA *in_room; if ( argument[0] == '\0' ) debit = FALSE; else if ( !str_cmp( "atm", argument ) || !str_cmp( "debit", argument ) ) { bool has_card = FALSE; for ( obj = ch->last_carrying; obj; obj = obj->prev_content ) { if ( obj->item_type == ITEM_DEBIT_CARD ) has_card = TRUE; } if ( has_card == TRUE ) debit = TRUE; else { send_to_char( "You don't even have your card with you!\n\r", ch ); return; } } if ( IS_NPC(ch) ) return; pRoomIndexNext = get_room_index( ch->in_room->vnum + 1 ); if ( !pRoomIndexNext ) { bug( "Do_buy: bad pet shop at vnum %d.", ch->in_room->vnum ); send_to_char( "Sorry, you can't buy that here.\n\r", ch ); return; } in_room = ch->in_room; ch->in_room = pRoomIndexNext; pet = get_char_room( ch, arg ); ch->in_room = in_room; if ( pet == NULL || !IS_NPC( pet ) || !IS_SET(pet->act, ACT_PET) ) { send_to_char( "Sorry, you can't buy that here.\n\r", ch ); return; } if (( ch->gold < 10 * pet->top_level * pet->top_level ) && debit == FALSE) { send_to_char( "You can't afford it.\n\r", ch ); return; } else if ( (ch->pcdata->bank < 10 * pet->top_level * pet->top_level) && debit == TRUE ) { send_to_char( "You dont have enough money in your bank account for it.\n\r", ch ); return; } maxgold = 10 * pet->top_level * pet->top_level; if ( debit == FALSE ) ch->gold -= maxgold; /* this was already here, btw */ else ch->pcdata->bank -= maxgold; boost_economy( ch->in_room->area, maxgold ); pet = create_mobile( pet->pIndexData ); SET_BIT(pet->act, ACT_PET); SET_BIT(pet->affected_by, AFF_CHARM); argument = one_argument( argument, arg ); if ( arg[0] != '\0' ) { sprintf( buf, "%s %s", pet->name, arg ); STRFREE( pet->name ); pet->name = STRALLOC( buf ); } sprintf( buf, "%sA neck tag says 'I belong to %s'.\n\r", pet->description, ch->name ); STRFREE( pet->description ); pet->description = STRALLOC( buf ); char_to_room( pet, ch->in_room ); add_follower( pet, ch ); send_to_char( "Enjoy your pet.\n\r", ch ); act( AT_ACTION, "$n bought $N as a pet.", ch, NULL, pet, TO_ROOM ); return; } else { CHAR_DATA *keeper; int cost; int noi = 1; /* Number of items */ sh_int mnoi = 20; /* Max number of items to be bought at once */ if ( ( keeper = find_keeper( ch ) ) == NULL ) return; maxgold = keeper->top_level * 10; if ( is_number( arg ) ) { noi = atoi( arg ); argument = one_argument( argument, arg ); if ( noi > mnoi ) { act( AT_TELL, "$n tells you 'I don't sell that many items at" " once.'", keeper, NULL, ch, TO_VICT ); ch->reply = keeper; return; } } if ( argument[0] == '\0' ) debit = FALSE; else if ( !str_cmp( "atm", argument ) || !str_cmp( "debit", argument ) ) { bool has_card = FALSE; for ( obj = ch->last_carrying; obj; obj = obj->prev_content ) { if ( obj->item_type == ITEM_DEBIT_CARD ) has_card = TRUE; } if ( has_card == TRUE ) debit = TRUE; else { send_to_char( "You don't even have your card with you!\n\r", ch ); return; } } obj = get_obj_carry( keeper, arg ); if ( !obj && arg[0] == '#' ) { int onum, oref; bool ofound = FALSE; onum =0; oref = atoi(arg+1); for ( obj = keeper->last_carrying; obj; obj = obj->prev_content ) { if ( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj ) ) onum++; if ( onum == oref ) { ofound = TRUE; break; } else if ( onum > oref ) break; } if (!ofound) obj = NULL; } if (keeper->home != NULL && obj->cost > 0) cost= obj->cost; cost = ( get_cost( ch, keeper, obj, TRUE ) * noi ); if( !IS_NPC(ch) && ch->pcdata->learned[gsn_bargain] > 0 && ch->pcdata->learned[gsn_bargain] > number_percent()) { ch_printf(ch,"You are able to bargain from %d credits to %d credits!\n\r", cost, (cost/3)+(cost/2)); cost = (cost/3) + (cost/2); if(number_percent() > 50) learn_from_success(ch, gsn_bargain); } if ( cost <= 0 || !can_see_obj( ch, obj ) ) { act( AT_TELL, "$n tells you 'I don't sell that -- try 'list'.'", keeper, NULL, ch, TO_VICT ); ch->reply = keeper; return; } if ( !IS_OBJ_STAT( obj, ITEM_INVENTORY ) && ( noi > 1 ) ) { interpret( keeper, "laugh" ); act( AT_TELL, "$n tells you 'I don't have enough of those in stock" " to sell more than one at a time.'", keeper, NULL, ch, TO_VICT ); ch->reply = keeper; return; } if ( ch->gold < cost && debit == FALSE) { act( AT_TELL, "$n tells you 'You can't afford to buy $p.'", keeper, obj, ch, TO_VICT ); ch->reply = keeper; return; } if ( ch->pcdata->bank < cost && debit == TRUE) { send_to_char( "You are almost slide your card through, but you remember you don't have enough money!\n\r", ch ); return; } if ( IS_SET(obj->extra_flags, ITEM_PROTOTYPE) && get_trust( ch ) < LEVEL_IMMORTAL ) { act( AT_TELL, "$n tells you 'This is a only a prototype! I can't sell you that...'", keeper, NULL, ch, TO_VICT ); ch->reply = keeper; return; } if ( ch->carry_number + get_obj_number( obj ) > can_carry_n( ch ) ) { send_to_char( "You can't carry that many items.\n\r", ch ); return; } if ( ch->carry_weight + ( get_obj_weight( obj ) * noi ) + (noi > 1 ? 2 : 0) > can_carry_w( ch ) ) { send_to_char( "You can't carry that much weight.\n\r", ch ); return; } if ( noi == 1 ) { if ( !IS_OBJ_STAT( obj, ITEM_INVENTORY ) ) separate_obj( obj ); act( AT_ACTION, "$n buys $p.", ch, obj, NULL, TO_ROOM ); act( AT_ACTION, "You buy $p.", ch, obj, NULL, TO_CHAR ); } else { sprintf( arg, "$n buys %d $p%s.", noi, ( obj->short_descr[strlen(obj->short_descr)-1] == 's' ? "" : "s" ) ); act( AT_ACTION, arg, ch, obj, NULL, TO_ROOM ); sprintf( arg, "You buy %d $p%s.", noi, ( obj->short_descr[strlen(obj->short_descr)-1] == 's' ? "" : "s" ) ); act( AT_ACTION, arg, ch, obj, NULL, TO_CHAR ); act( AT_ACTION, "$N puts them into a bag and hands it to you.", ch, NULL, keeper, TO_CHAR ); } if ( debit == FALSE ) ch->gold -= cost; /* this line was already here, btw */ else if ( debit == TRUE ) ch->pcdata->bank -= cost; keeper->gold += cost; if ( keeper->gold > maxgold ) { boost_economy( keeper->in_room->area, keeper->gold - maxgold/2 ); keeper->gold = maxgold/2; act( AT_ACTION, "$n puts some credits into a large safe.", keeper, NULL, NULL, TO_ROOM ); } if ( IS_OBJ_STAT( obj, ITEM_INVENTORY ) ) { OBJ_DATA *buy_obj, *bag; buy_obj = create_object( obj->pIndexData, obj->level ); /* * Due to grouped objects and carry limitations in SMAUG * The shopkeeper gives you a bag with multiple-buy, * and also, only one object needs be created with a count * set to the number bought. -Thoric */ if ( noi > 1 ) { bag = create_object( get_obj_index( OBJ_VNUM_SHOPPING_BAG ), 1 ); /* perfect size bag ;) */ bag->value[0] = bag->weight + (buy_obj->weight * noi); buy_obj->count = noi; obj->pIndexData->count += (noi - 1); numobjsloaded += (noi - 1); obj_to_obj( buy_obj, bag ); obj_to_char( bag, ch ); } else obj_to_char( buy_obj, ch ); } else { obj_from_char( obj ); obj_to_char( obj, ch ); } return; } }
void do_showmodules( CHAR_DATA *ch, char *argument ){ SHIP_DATA *ship; MODULE_DATA *mod; char buf[MAX_STRING_LENGTH]; char str[MAX_STRING_LENGTH]; int i; long xpgain; int chance; chance = IS_NPC(ch) ? ch->top_level : (int) (ch->pcdata->learned[gsn_showmodules]); if((ship = ship_from_engine(ch->in_room->vnum)) == NULL){ send_to_char("You must be in the engine room of a ship.\n\r", ch); return; } if ( number_percent( ) > chance ){ send_to_char("&RYou fail to find the module control panel.\n\r", ch); learn_from_failure(ch, gsn_showmodules); return; } send_to_char("&z+--------------------------------------+\n\r", ch); send_to_char("&z| &RNum Type Quantity &z|\n\r", ch); send_to_char("&z| &r--- ---- -------- &z|\n\r", ch); i=0; for(mod=ship->first_module;mod;mod=mod->next){ i++; if(mod->affect == AFFECT_PRIMARY) strcpy(str, "Primary Weapon"); if(mod->affect == AFFECT_SECONDARY) strcpy(str, "Secondary Weapon"); if(mod->affect == AFFECT_MISSILE) strcpy(str, "Missile"); if(mod->affect == AFFECT_ROCKET) strcpy(str, "Rocket"); if(mod->affect == AFFECT_TORPEDO) strcpy(str, "Torpedo"); if(mod->affect == AFFECT_HULL) strcpy(str, "Hull"); if(mod->affect == AFFECT_SHIELD) strcpy(str, "Shields"); if(mod->affect == AFFECT_SPEED) strcpy(str, "Speed"); if(mod->affect == AFFECT_HYPER) strcpy(str, "Hyperspeed"); if(mod->affect == AFFECT_ENERGY) strcpy(str, "Energy"); if(mod->affect == AFFECT_MANUEVER) strcpy(str, "Manuever"); if(mod->affect == AFFECT_ALARM) strcpy(str, "Alarm"); if(mod->affect == AFFECT_CHAFF) strcpy(str, "Chaff"); if(mod->affect == AFFECT_SLAVE) strcpy(str, "Slave"); if(mod->affect == AFFECT_TRACTOR) strcpy(str, "TRACTOR"); sprintf(buf, "&z| &P%2d&p) &G&W%-22.22s %-8.8d &z|\n\r", i, str, mod->ammount); send_to_char(buf, ch); } send_to_char("&z+--------------------------------------+\n\r", ch); xpgain = UMAX(100,i * 100); gain_exp(ch, xpgain, TECHNICIAN_ABILITY); ch_printf( ch , " You gain %d experience for being a Technician.\n\r", xpgain ); learn_from_success(ch, gsn_showmodules); }
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 ); }
void do_removebug(CHAR_DATA *ch, char *argument) { CHAR_DATA *victim; char arg[MAX_STRING_LENGTH]; int chance; BUG_DATA *bugs; argument = one_argument( argument, arg ); switch( ch->substate ) { default: if( arg[0] == '\0') { send_to_char("Syntax: removebug <person>\n\r", ch); return; } victim = get_char_room(ch, arg); if(!victim) { send_to_char("They aren't here.\n\r", ch); return; } if( IS_NPC(victim)) { send_to_char("You can only do that to players.\n\r", ch); return; } chance = IS_NPC(ch) ? ch->top_level : (int)(ch->pcdata->learned[gsn_scanbugs]); if(number_percent() < chance + 20) { send_to_char("&w&GYou begin to pick at a bug, trying to remove it without notifying the owner...\n\r", ch); act( AT_PLAIN, "$n takes $s toolkit and begins removing a bug from $N.", ch, NULL, victim, TO_NOTVICT ); act( AT_PLAIN, "$n takes $s toolkit and begins removing a bug from you.", ch, NULL, victim, TO_VICT); add_timer ( ch , TIMER_DO_FUN , 1 , do_removebug , 1 ); ch->dest_buf = str_dup(arg); return; } send_to_char("You look curiously at the bug, unsure of how to remove it.\n\r", ch); learn_from_failure(ch, gsn_removebug); return; case 1: if ( !ch->dest_buf ) return; strcpy(arg, ch->dest_buf); DISPOSE( ch->dest_buf); ch->dest_buf = NULL; break; case SUB_TIMER_DO_ABORT: DISPOSE( ch->dest_buf ); ch->dest_buf = NULL; ch->substate = SUB_NONE; send_to_char("&RYou are interrupted and fail to finish removing the bug.\n\r", ch); return; } ch->substate = SUB_NONE; chance = IS_NPC(ch) ? ch->top_level : (int)(ch->pcdata->learned[gsn_scanbugs]); victim = get_char_room(ch, arg); if(!victim) { send_to_char("Your victim left before you finished removing the bug!\n\r", ch); return; } if ( number_percent( ) > chance*2 || !victim->first_bug) { send_to_char("&w&RYou fiddle with the bug, and suddenly a small beeper goes off...\n\r", ch); send_to_char("&w&RIt appears you've failed.\n\r", ch); learn_from_failure(ch, gsn_scanbugs); return; } if(victim->first_bug) bugs = victim->first_bug; UNLINK(bugs, victim->first_bug, victim->last_bug, next_in_bug, prev_in_bug); STRFREE(bugs->name); DISPOSE(bugs); send_to_char("&w&GWith a satisfying *click*, you detach the bug and smash it.\n\r", ch); learn_from_success( ch, gsn_removebug); { long xpgain; xpgain = (ch->experience[TECHNICIAN_ABILITY]/25); gain_exp(ch, xpgain, TECHNICIAN_ABILITY); ch_printf( ch , "You gain %d technician experience.", xpgain ); } return; }
void do_scanbugs( CHAR_DATA *ch, char *argument ) { CHAR_DATA *victim; char arg[MAX_STRING_LENGTH]; int chance; BUG_DATA *bugs; int i; argument = one_argument( argument, arg ); switch( ch->substate ) { default: if( arg[0] == '\0') { send_to_char("Syntax: checkbugs <person>\n\r", ch); return; } victim = get_char_room(ch, arg); if(!victim) { send_to_char("They aren't here.\n\r", ch); return; } if( IS_NPC(victim)) { send_to_char("You can only do that to players.\n\r", ch); return; } chance = IS_NPC(ch) ? ch->top_level : (int)(ch->pcdata->learned[gsn_scanbugs]); if(number_percent() - 20 < chance) { send_to_char("&w&GScanning...\n\r", ch); act( AT_PLAIN, "$n takes a scanner and begins to scan $N.", ch, NULL, victim, TO_NOTVICT ); act( AT_PLAIN, "$n takes a scanner and begins to scan you for bugs.", ch, NULL, victim, TO_VICT); add_timer ( ch , TIMER_DO_FUN , 10 , do_scanbugs , 1 ); ch->dest_buf = str_dup(arg); return; } send_to_char("You punch random buttons on the scanner, unsure of what you are doing.\n\r", ch); learn_from_failure(ch, gsn_scanbugs); return; case 1: if ( !ch->dest_buf ) return; strcpy(arg, ch->dest_buf); DISPOSE( ch->dest_buf); ch->dest_buf = NULL; break; case SUB_TIMER_DO_ABORT: DISPOSE( ch->dest_buf ); ch->dest_buf = NULL; ch->substate = SUB_NONE; send_to_char("&RYou are interupted and fail to finish scanning.\n\r", ch); return; } ch->substate = SUB_NONE; chance = IS_NPC(ch) ? ch->top_level : (int)(ch->pcdata->learned[gsn_scanbugs]); if ( number_percent( ) > chance*2 + 20) { send_to_char("&w&RYou struggle with the scanner, furious in your ignorance of its abilities.\n\r", ch); learn_from_failure(ch, gsn_scanbugs); return; } victim = get_char_room(ch, arg); if(!victim) { send_to_char("Your victim left before you finished scanning!\n\r", ch); return; } i=0; for(bugs=victim->first_bug;bugs;bugs=bugs->next_in_bug) i++; if(i >= 1) ch_printf(ch, "&w&GScan Complete. %d bugs apparent.\n\r", i); else send_to_char("&w&GScan Complete. No bugs apparent.\n\r", ch); learn_from_success(ch, gsn_scanbugs); { long xpgain; xpgain = (ch->experience[TECHNICIAN_ABILITY]/30); gain_exp(ch, xpgain, TECHNICIAN_ABILITY); ch_printf( ch , "You gain %d technician experience.", xpgain ); } return; }
void do_shipmaintenance(CHAR_DATA *ch, char *argument ) { char arg[MAX_INPUT_LENGTH]; char log_buf[MAX_INPUT_LENGTH]; int chance, change, bombs=0; long xp; SHIP_DATA *ship; OBJ_DATA *obj; int oldbombs; strcpy( arg, argument ); if( (ch->pcdata->learned[gsn_shipmaintenance]) <= 0) { send_to_char("Huh?\n\r", ch); return; } switch( ch->substate ) { default: if ( (ship = ship_from_engine(ch->in_room->vnum)) == NULL ) { send_to_char("&RYou must be in the engine room of a ship to do that!\n\r",ch); return; } chance = IS_NPC(ch) ? ch->top_level : (int) (ch->pcdata->learned[gsn_shipmaintenance]); if ( number_percent( ) < chance ) { send_to_char( "&GYou start performing basic maintenance on your ship...\n\r", ch); act( AT_PLAIN, "$n begins some basic ship maintenance.", ch, NULL, argument , TO_ROOM ); add_timer ( ch , TIMER_DO_FUN , 15 , do_shipmaintenance , 1 ); ch->dest_buf = str_dup(arg); return; } send_to_char("&RYou fail to perform even the most basic of ship maintenance skills.\n\r",ch); learn_from_failure(ch,gsn_shipmaintenance); 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 fail to finish your maintenance.\n\r", ch); return; } ch->substate = SUB_NONE; if ( (ship = ship_from_engine(ch->in_room->vnum)) == NULL ) { return; } change = URANGE( 0 , number_range( (int) ( ch->pcdata->learned[gsn_shipmaintenance] / 2 ) , (int) (ch->pcdata->learned[gsn_shipmaintenance]) ), ( ship->maxhull - ship->hull ) ); ship->hull += change; ship->chaff = ship->maxchaff; ship->missiles = ship->maxmissiles; ship->torpedos = ship->maxtorpedos; ship->rockets = ship->maxrockets; oldbombs = ship->bombs; for(obj = ch->last_carrying; obj; obj = obj->prev_content ) { if(ship->maxbombs - bombs == 0) break; if(obj->item_type == ITEM_SHIPBOMB) { if(ship->bombs > 0 && ship->lowbombstr > 0 && ship->hibombstr > 0) { ship->lowbombstr = (((ship->lowbombstr*ship->bombs)+obj->value[0])/(ship->bombs + 1)); sprintf(log_buf, "Ships lowbombstr is %d", ship->lowbombstr); log_string(log_buf); ship->hibombstr = ((ship->hibombstr * ship->bombs)+(int)obj->value[1])/(ship->bombs + 1); sprintf(log_buf, "Ships hibombstr is %d", ship->hibombstr); log_string(log_buf); } else { ship->lowbombstr = obj->value[0]; ship->hibombstr = obj->value[1]; } if(obj->count > (ship->maxbombs - bombs)) { obj->count -= (ship->maxbombs - bombs); ship->bombs += (ship->maxbombs - bombs); break; } else { ship->bombs += obj->count; obj_from_char(obj); extract_obj(obj); } }//if check }// for loop ch_printf( ch, "&GRepairs complete.. Hull raised %d points, ship weaponry and chaff restocked.\n\r", change ); if(ship->bombs > oldbombs) ch_printf( ch, "&G%d bombs loaded into ship from inventory.\n\r", ship->bombs - oldbombs); act( AT_PLAIN, "$n finishes patching the hull and restocking the ship.", ch, NULL, argument , TO_ROOM ); xp = get_ship_value( ship )/100; ch_printf( ch, "&WYou gain %ld points of technician experience!\n\r", (get_ship_value(ship)/100) ); gain_exp( ch , xp , TECHNICIAN_ABILITY ); learn_from_success( ch, gsn_shipmaintenance ); return; }
/* The effectiveness of the modules can vary depending on the level of the technitian's makemodule skill */ void do_makemodule( CHAR_DATA *ch, char *argument ) { char arg[MAX_INPUT_LENGTH]; int affecttype, affectammount; char name[MAX_STRING_LENGTH]; int level, chance; bool checklens, checkbat, checksuper, checkcircuit, checktool; OBJ_DATA *obj; OBJ_INDEX_DATA *pObjIndex; argument = one_argument( argument, arg ); switch( ch->substate ) { default: if(str_cmp(arg, "hull") && str_cmp( arg, "slave") && str_cmp( arg, "tractor") && str_cmp(arg, "torpedo") && str_cmp(arg, "rocket") && str_cmp(arg, "missile") && str_cmp(arg, "primary") && str_cmp(arg, "secondary") && str_cmp(arg, "shield") && str_cmp(arg, "speed") && str_cmp(arg, "hyperspeed") && str_cmp(arg, "energy") && str_cmp(arg, "manuever") && str_cmp(arg, "chaff") && str_cmp(arg, "alarm")){ send_to_char("Modules may affect the following aspects of the ship:\n\rPrimary, Secondary, Missile, Rocket, Torpedo, Hull, Shield, Speed, Hyperspeed, Energy, Manuever, Slave, Tractor, Chaff, and Alarm.\n\r", ch); return; } checklens = FALSE; checkbat = FALSE; checksuper = FALSE; checkcircuit = FALSE; checktool = 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_LENS) checklens = TRUE; if (obj->item_type == ITEM_BATTERY) checkbat = TRUE; if (obj->item_type == ITEM_SUPERCONDUCTOR) checksuper = TRUE; if (obj->item_type == ITEM_CIRCUIT) checkcircuit = TRUE; if (obj->item_type == ITEM_TOOLKIT) checktool = TRUE; } if ( !checklens ) { send_to_char( "&RYou need a lens to control the energy.\n\r", ch); return; } if ( !checkbat ) { send_to_char( "&RYou need a battery to power the module.\n\r", ch); return; } if ( !checksuper ) { send_to_char( "&RYou need a superconductor to focus the energy.\n\r", ch); return; } if ( !checkcircuit ) { send_to_char( "&RYou need a circuit board to control the module.\n\r", ch); return; } if ( !checktool ) { send_to_char( "&RYou need a toolkit to build the module.\n\r", ch); return; } chance = IS_NPC(ch) ? ch->top_level : (int) (ch->pcdata->learned[gsn_makemodule]); if ( number_percent( ) < chance ) { send_to_char( "&GYou begin the long process of creating a module.\n\r", ch); act( AT_PLAIN, "$n takes $s tools and begins to work.", ch, NULL, argument , TO_ROOM ); add_timer ( ch , TIMER_DO_FUN , 10 , do_makemodule , 1 ); ch->dest_buf = str_dup(arg); return; } send_to_char("&RYou can't figure out what to do.\n\r",ch); learn_from_failure( ch, gsn_makemodule ); 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_makemodule]); if ( ( pObjIndex = get_obj_index( MODULE_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; } checklens = FALSE; checkbat = FALSE; checksuper = FALSE; checkcircuit = FALSE; checktool = FALSE; 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 == FALSE) { checklens = TRUE; separate_obj( obj ); obj_from_char( obj ); } if (obj->item_type == ITEM_BATTERY && checkbat == FALSE) { checkbat = TRUE; separate_obj( obj ); obj_from_char( obj ); } if (obj->item_type == ITEM_SUPERCONDUCTOR && checksuper == FALSE) { checksuper = TRUE; separate_obj( obj ); obj_from_char( obj ); } if (obj->item_type == ITEM_CIRCUIT && checkcircuit == FALSE) { checkcircuit = TRUE; separate_obj( obj ); obj_from_char( obj ); } } chance = IS_NPC(ch) ? ch->top_level : (int) (ch->pcdata->learned[gsn_makemodule]) ; if ( number_percent( ) > chance*2 || ( !checklens ) || ( !checktool ) || ( !checkbat ) || ( !checksuper ) || ( !checkcircuit ) ) { send_to_char( "&RYou hold up your newly created module.\n\r", ch); send_to_char( "&RThe module begins to shake violently turning red hot!\n\r", ch); send_to_char( "&RYou drop it as it begins to burn your hand and then.. It disintigrates!\n\r", ch); learn_from_failure( ch, gsn_makemodule ); return; } if(!str_cmp(arg, "primary")){ affecttype = AFFECT_PRIMARY; affectammount = 1; strcpy(name, "A Primary Weapons Module"); } if(!str_cmp(arg, "secondary")){ affecttype = AFFECT_SECONDARY; affectammount = 1; strcpy(name, "A Secondary Weapons Module"); } if(!str_cmp(arg, "slave")) { affecttype = AFFECT_SLAVE; affectammount = (level / 4); strcpy(name, "A Slave Module"); } if(!str_cmp(arg, "tractor")) { affecttype = AFFECT_TRACTOR; affectammount = 1; strcpy(name, "A Tractor Beam Module"); } if(!str_cmp(arg, "missile")){ affecttype = AFFECT_MISSILE; affectammount = (level / 20); strcpy(name, "A Missile Module"); } if(!str_cmp(arg, "rocket")){ affecttype = AFFECT_ROCKET; affectammount = (level / 20); strcpy(name, "A Rocket Module"); } if(!str_cmp(arg, "torpedo")){ affecttype = AFFECT_TORPEDO; affectammount = (level / 20); strcpy(name, "A Torpedo Module"); } if(!str_cmp(arg, "hull")){ affecttype = AFFECT_HULL; affectammount = (level / 2); strcpy(name, "A Hull Module"); } if(!str_cmp(arg, "shield")){ affecttype = AFFECT_SHIELD; affectammount = (level/5); strcpy(name, "A Shield Module"); } if(!str_cmp(arg, "speed")){ affecttype = AFFECT_SPEED; affectammount = (level / 10); strcpy(name, "A Speed Module"); } if(!str_cmp(arg, "hyperspeed")){ affecttype = AFFECT_HYPER; affectammount = 1; strcpy(name, "A Hyperspeed Module"); } if(!str_cmp(arg, "energy")){ affecttype = AFFECT_ENERGY; affectammount = (level * 5); strcpy(name, "An Energy Module"); } if(!str_cmp(arg, "manuever")){ affecttype = AFFECT_MANUEVER; affectammount = (level / 10); strcpy(name, "A Manuever Module"); } if(!str_cmp(arg, "alarm")) { affecttype = AFFECT_ALARM; affectammount = 1; strcpy(name, "An Alarm Module"); } if(!str_cmp(arg, "chaff")) { affecttype = AFFECT_CHAFF; affectammount = URANGE(1,(level / 33), 3); strcpy(name, "A Chaff Module"); } obj = create_object( pObjIndex, level ); obj->item_type = ITEM_MODULE; SET_BIT( obj->wear_flags, ITEM_TAKE ); obj->level = level; STRFREE( obj->name ); obj->name = STRALLOC( name ); STRFREE( obj->short_descr ); obj->short_descr = STRALLOC( name ); STRFREE( obj->description ); strcat( name, " was dropped here." ); obj->description = STRALLOC( name ); obj->value[0] = affecttype; obj->value[1] = affectammount; obj->value[2] = 0; obj->cost = (level * affecttype * affectammount); obj = obj_to_char( obj, ch ); send_to_char( "&GYou finish your work and hold up your newly created module.&w\n\r", ch); act( AT_PLAIN, "$n finishes creating a new module.", ch, NULL, argument , TO_ROOM ); { long xpgain; xpgain = ((ch->skill_level[TECHNICIAN_ABILITY]+1) * 200); gain_exp(ch, xpgain, TECHNICIAN_ABILITY); ch_printf( ch , "You gain %d technician experience.", xpgain ); } learn_from_success( ch, gsn_makemodule ); }
void do_removemodule( CHAR_DATA *ch, char *argument ) { SHIP_DATA *ship; bool checktool; OBJ_DATA *obj; char arg[MAX_INPUT_LENGTH]; char buf[MAX_INPUT_LENGTH]; MODULE_DATA *mod; int chance; int num,i; strcpy( arg , argument ); checktool = FALSE; switch( ch->substate ) { default: if ( (ship = ship_from_engine(ch->in_room->vnum)) != NULL ) { ship = ship_from_engine(ch->in_room->vnum); } if (!ship) { send_to_char("You need to be in the ships engine room.\n\r", ch); return; } if(arg[0] == '\0' || atoi(arg) == 0) { send_to_char("Remove WHICH module? Use the number next to it on showmodules.\n\r", ch); return; } for ( obj = ch->last_carrying; obj; obj = obj->prev_content ) { if (obj->item_type == ITEM_TOOLKIT) checktool = TRUE; } if ( checktool == FALSE ) { send_to_char("You need a toolkit to remove a module.\n\r", ch); return; } i=0; num = atoi(argument); for(mod=ship->first_module;mod;mod=mod->next) i++; if (i < num || i == 0) { send_to_char("No such module installed.\n\r", ch); return; } chance = IS_NPC(ch) ? ch->top_level : (int) (ch->pcdata->learned[gsn_removemodule]); if ( number_percent( ) < chance ) { strcpy(arg, argument); ch->dest_buf = str_dup(arg); send_to_char( "&GYou begin the long process of removing a module.\n\r", ch); sprintf(buf, "$n takes out $s toolkit and begins to work.\n\r"); act( AT_PLAIN, buf, ch, NULL, argument , TO_ROOM ); add_timer ( ch , TIMER_DO_FUN , 5 , do_removemodule , 1 ); return; } send_to_char("&RYou are unable to figure out what to do.\n\r",ch); learn_from_failure( ch, gsn_removemodule ); 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.\n\r", ch); return; } ch->substate = SUB_NONE; for ( obj = ch->last_carrying; obj; obj = obj->prev_content ) { if (obj->item_type == ITEM_TOOLKIT) checktool = TRUE; } chance = IS_NPC(ch) ? ch->top_level : (int) (ch->pcdata->learned[gsn_removemodule]); ship = ship_from_engine(ch->in_room->vnum); if (!ship){ send_to_char("Error: Something went wrong. Contact an Admin!\n\r", ch); return; } if ( number_percent( ) > chance*2 ) { send_to_char("&RYou finish removing the module and everything's looking good...\n\r", ch); send_to_char("&RThen you realize you removed the hyperdrive energy core. OOPS!\n\r", ch); learn_from_failure( ch, gsn_removemodule ); return; } num = atoi(arg); i=0; for(mod=ship->first_module;mod;mod=mod->next) { i++; if (i == num) { if(mod->affect == AFFECT_PRIMARY) ship->primaryCount-=mod->ammount; if(mod->affect == AFFECT_SECONDARY) ship->secondaryCount-=mod->ammount; if(mod->affect == AFFECT_MISSILE) { ship->maxmissiles-=mod->ammount; ship->missiles=ship->maxmissiles; } if(mod->affect == AFFECT_ROCKET) { ship->maxrockets-=mod->ammount; ship->rockets=ship->maxrockets; } if(mod->affect == AFFECT_TORPEDO) { ship->maxtorpedos-=mod->ammount; ship->torpedos=ship->maxtorpedos; } if(mod->affect == AFFECT_HULL) ship->maxhull-=mod->ammount; if(mod->affect == AFFECT_SHIELD) ship->maxshield-=mod->ammount; if(mod->affect == AFFECT_SPEED) ship->realspeed-=mod->ammount; if(mod->affect == AFFECT_HYPER) ship->hyperspeed+=mod->ammount; if(mod->affect == AFFECT_ENERGY) ship->maxenergy-=mod->ammount; if(mod->affect == AFFECT_MANUEVER) ship->manuever-=mod->ammount; if(mod->affect == AFFECT_ALARM) ship->alarm-=mod->ammount; if(mod->affect == AFFECT_CHAFF) ship->maxchaff-=mod->ammount; if(mod->affect == AFFECT_SLAVE) ship->slave-=mod->ammount; if(mod->affect == AFFECT_TRACTOR) ship->tractorbeam-=mod->ammount; UNLINK(mod, ship->first_module, ship->last_module, next, prev); DISPOSE(mod); save_ship(ship); break; } } send_to_char("You finish removing the module and toss the extra scraps away.\n\r", ch); { long xpgain; xpgain = ((ch->skill_level[TECHNICIAN_ABILITY]+1) * 300); gain_exp(ch, xpgain, TECHNICIAN_ABILITY); ch_printf( ch , " You gain %d experience for being a Technician.\n\r", xpgain ); learn_from_success( ch, gsn_removemodule ) ; } return; }
void do_sharpen( CHAR_DATA * ch, char *argument ) { OBJ_DATA *obj; OBJ_DATA *pobj; char arg[MAX_INPUT_LENGTH]; AFFECT_DATA *paf; int percent; int level; one_argument( argument, arg ); if( arg[0] == '\0' ) { send_to_char( "What do you wish to sharpen?\r\n", ch ); return; } if( ms_find_obj( ch ) ) return; if( !( obj = get_obj_carry( ch, arg ) ) ) { send_to_char( "You do not have that weapon.\r\n", ch ); return; } if( obj->item_type != ITEM_WEAPON ) { send_to_char( "You can't sharpen something that's not a weapon.\r\n", ch ); return; } /* * Let's not allow people to sharpen bludgeons and the like ;) */ /* * small mods to make it more generic.. --Cronel */ if( obj->value[3] != DAM_HIT && obj->value[3] != DAM_SLICE && obj->value[3] != DAM_STAB && obj->value[3] != DAM_SLASH && obj->value[3] != DAM_CLAW && obj->value[3] != DAM_BITE && obj->value[3] != DAM_PIERCE ) { send_to_char( "You can't sharpen that type of weapon!\r\n", ch ); return; } if( obj->value[5] == 1 ) /* see reason below when setting */ { send_to_char( "It is already as sharp as it's going to get.\r\n", ch ); return; } for( pobj = ch->first_carrying; pobj; pobj = pobj->next_content ) { if( pobj->pIndexData->vnum == OBJ_VNUM_SHARPEN ) break; } if( !pobj ) { send_to_char( "You do not have a sharpening stone.\r\n", ch ); return; } WAIT_STATE( ch, skill_table[gsn_sharpen]->beats ); /* * Character must have the dexterity to sharpen the weapon nicely, * * if not, damage weapon */ if( !IS_NPC( ch ) && get_curr_dex( ch ) < 17 ) { separate_obj( obj ); if( obj->value[0] <= 1 ) { act( AT_OBJECT, "$p breaks apart and falls to the ground in pieces!.", ch, obj, NULL, TO_CHAR ); extract_obj( obj ); learn_from_failure( ch, gsn_sharpen ); return; } else { obj->value[0]--; act( AT_GREEN, "You clumsily slip and damage $p!", ch, obj, NULL, TO_CHAR ); return; } } percent = ( number_percent( ) - get_curr_lck( ch ) - 15 ); /* too low a chance to damage? */ separate_obj( pobj ); if( !IS_NPC( ch ) && percent > ch->pcdata->learned[gsn_sharpen] ) { act( AT_OBJECT, "You fail to sharpen $p correctly, damaging the stone.", ch, obj, NULL, TO_CHAR ); if( pobj->value[0] <= 1 ) { act( AT_OBJECT, "The sharpening stone crumbles apart from misuse.", ch, pobj, NULL, TO_CHAR ); extract_obj( pobj ); learn_from_failure( ch, gsn_sharpen ); return; } pobj->value[0]--; learn_from_failure( ch, gsn_sharpen ); return; } level = ch->level; separate_obj( obj ); act( AT_SKILL, "With skill and precision, you sharpen $p to a fine edge.", ch, obj, NULL, TO_CHAR ); act( AT_SKILL, "With skill and precision, $n sharpens $p.", ch, obj, NULL, TO_ROOM ); CREATE( paf, AFFECT_DATA, 1 ); paf->type = -1; paf->duration = -1; paf->location = APPLY_DAMROLL; paf->modifier = level / 10; xCLEAR_BITS( paf->bitvector ); /* changed to ext BVs in upgrade --Cronel */ LINK( paf, obj->first_affect, obj->last_affect, next, prev ); obj->value[5] = 1; /* * originaly a sharpened object flag was used, but took up a BV, * * so I switched to giving it a value5, which is not used in weapons * * besides to check for this */ learn_from_success( ch, gsn_sharpen ); return; }
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; }
//Command Status: Installed, fairly well tested, near completetion. void do_prayer( CHAR_DATA *ch, char *argument ) { char arg[MIL]; AFFECT_DATA af; one_argument( argument, arg ); if ( IS_NPC( ch ) ) return; if ( IS_AFFECTED( ch, AFF_CHARM ) ) return; if ( !arg || arg[0] == '\0' ) { send_to_char( "Syntax: Prayer start\r\nSyntax: Prayer stop\r\n", ch ); return; } if ( !IS_AWAKE( ch ) ) { send_to_char( "You cant pray while asleep.", ch ); return; } if ( ch->position == POS_MEDITATING ) { send_to_char( "You are already meditating!\r\n", ch ); return; } if ( IS_AFFECTED( ch, AFF_PRAYER ) && !str_cmp( arg, "start" ) ) { send_to_char( "But you're already praying.\r\n", ch ); return; } if ( !str_cmp( arg, "start" ) ) { if ( can_use_skill( ch, number_percent( ), gsn_prayer ) ) { if ( ch->fighting ) { send_to_char( "You cannot start a prayer during combat.\r\n", ch ); return; } send_to_char( "You close your eyes and begin to pray.\r\n", ch ); af.type = gsn_prayer; af.location = APPLY_NONE; af.modifier = 0; af.level = ch->level; af.duration = -1; af.bitvector = meb( AFF_PRAYER ); affect_to_char( ch, &af ); learn_from_success( ch, gsn_prayer ); } else { send_to_char( "You can't seem to concentrate enough to properly pray.\r\n", ch ); learn_from_failure( ch, gsn_prayer ); } return; } if ( !str_cmp( arg, "stop" ) ) { if ( !IS_AFFECTED( ch, AFF_PRAYER ) ) { send_to_char( "But you're not praying.\r\n", ch ); return; } if ( ch->position != POS_STANDING ) set_position( ch, POS_STANDING ); send_to_char( "You come to an end in your prayer and slowly open your eyes.\r\n", ch ); affect_strip( ch, gsn_prayer ); xREMOVE_BIT( ch->affected_by, AFF_PRAYER ); return; } }