bool give_money( CHAR_DATA * ch, CHAR_DATA * victim, char *argument ) { MONEY_TYPE *transfer = new MONEY_TYPE; char m_number[MSL]; char m_name[MSL]; char outbuf[MSL]; for ( ;; ) { short mn; argument = one_argument( argument, m_number ); if ( m_number[0] == '\0' ) break; argument = one_argument( argument, m_name ); if ( m_name[0] == '\0' ) break; if ( ( ( mn = money_lookup( m_name ) ) < 0 ) || ( !is_number( m_number ) ) ) { snprintf( outbuf, MSL, "%s %s isn't a valid money type!\r\n", m_number, m_name ); send_to_char( outbuf, ch ); join_money( transfer, ch->money ); return FALSE; } if ( ch->money->cash_unit[mn] < atoi( m_number ) ) { snprintf( outbuf, MSL, "You don't have %s %s!\r\n", m_number, m_name ); send_to_char( outbuf, ch ); join_money( transfer, ch->money ); return FALSE; } ch->money->cash_unit[mn] -= atoi( m_number ); transfer->cash_unit[mn] += atoi( m_number ); } if ( ( victim->carry_weight + money_weight( transfer ) ) > can_carry_w( victim ) ) { snprintf( outbuf, MSL, "%s cannot carry that much weight!\r\n", ch->get_name(victim) ); send_to_char( outbuf, ch ); join_money( transfer, ch->money ); return FALSE; } ch->carry_weight -= money_weight( transfer ); victim->carry_weight += money_weight( transfer ); join_money( transfer, victim->money ); return TRUE; }
void get_obj(struct char_data *ch, struct gameobject *obj, struct gameobject *container) { struct char_data *gch; int members; char buffer[100]; if (!CAN_WEAR(obj, ITEM_TAKE)) { send_to_char("You can't take that.\n\r", ch); return; } if ((ch->carry_number + get_obj_number(obj)) > can_carry_n(ch) && (!IS_IMMORTAL(ch))) { act("$d: you can't carry that many items.", ch, NULL, object_name_get(obj), TO_CHAR); return; } if ((ch->carry_weight + get_obj_weight(obj)) > can_carry_w(ch)) { act("$d: you can't carry that much weight.", ch, NULL, object_name_get(obj), TO_CHAR); return; } if (obj->in_room != NULL) { for (gch = obj->in_room->people; gch != NULL; gch = gch->next_in_room) { if (gch->on == obj) { act("$N appears to be using $p.", ch, obj, gch, TO_CHAR); return; } } } if (container != NULL) { if (container->objprototype->vnum == OBJ_VNUM_PIT && get_trust(ch) < obj->level) { send_to_char("You are not powerful enough to use it.\n\r", ch); return; } if (container->objprototype->vnum == OBJ_VNUM_PIT && !CAN_WEAR(container, ITEM_TAKE) && !IS_OBJ_STAT(obj, ITEM_HAD_TIMER)) obj->timer = 0; act_new("You get $p from $P.", ch, obj, container, TO_CHAR, POS_RESTING, true); act_new("$n gets $p from $P.", ch, obj, container, TO_ROOM, POS_RESTING, true); REMOVE_BIT(obj->extra_flags, ITEM_HAD_TIMER); obj_from_obj(obj); } else { act_new("You get $p.", ch, obj, container, TO_CHAR, POS_RESTING, true); act_new("$n gets $p.", ch, obj, container, TO_ROOM, POS_RESTING, true); obj_from_room(obj); } if (obj->item_type == ITEM_MONEY) { ch->silver += obj->value[0]; ch->gold += obj->value[1]; if (IS_SET(ch->act, PLR_AUTOSPLIT)) { members = 0; for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room) if (!IS_AFFECTED(gch, AFF_CHARM) && is_same_group(gch, ch)) members++; if (members > 1 && (obj->value[0] > 1 || obj->value[1])) { sprintf(buffer, "%ld %ld", obj->value[0], obj->value[1]); do_split(ch, buffer); } } extract_obj(obj); } else { obj_to_char(obj, ch); } 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; } }
/* * New score command by Haus */ void do_score( CHAR_DATA* ch, const char* argument ) { char buf[MAX_STRING_LENGTH]; AFFECT_DATA *paf; int iLang; /*const char *suf; short day; day = ch->pcdata->day + 1; if( day > 4 && day < 20 ) suf = "th"; else if( day % 10 == 1 ) suf = "st"; else if( day % 10 == 2 ) suf = "nd"; else if( day % 10 == 3 ) suf = "rd"; else suf = "th"; * - Uncomment this if you want Birthdays dispayed on score for players - Kayle 1/22/08 */ set_pager_color( AT_SCORE, ch ); pager_printf( ch, "\r\nScore for %s%s.\r\n", ch->name, IS_NPC(ch) ? "" : ch->pcdata->title ); if( get_trust( ch ) != ch->level ) pager_printf( ch, "You are trusted at level %d.\r\n", get_trust( ch ) ); send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); /*if( time_info.day == ch->pcdata->day && time_info.month == ch->pcdata->month ) send_to_char( "Today is your birthday!\r\n", ch ); else ch_printf( ch, "Your birthday is: Day of %s, %d%s day in the Month of %s, in the year %d.\r\n", day_name[ch->pcdata->day % sysdata.daysperweek], day, suf, month_name[ch->pcdata->month], ch->pcdata->year ); send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); * - Uncomment this if you want players to see their birthday's on score. - Kayle 1/22/08 */ pager_printf( ch, "LEVEL: %-3d Race : %-10.10s Played: %ld hours\r\n", ch->level, capitalize( get_race( ch ) ), ( long int )GET_TIME_PLAYED( ch ) ); pager_printf( ch, "YEARS: %-6d Class: %-11.11s Log In: %s\r", calculate_age( ch ), capitalize( get_class( ch ) ), ctime( &( ch->logon ) ) ); if( ch->level >= 15 || IS_PKILL( ch ) ) { pager_printf( ch, "STR : %2.2d(%2.2d) HitRoll: %-4d Saved: %s\r", get_curr_str( ch ), ch->perm_str, GET_HITROLL( ch ), ch->save_time ? ctime( &( ch->save_time ) ) : "no save this session\n" ); pager_printf( ch, "INT : %2.2d(%2.2d) DamRoll: %-4d Time: %s\r", get_curr_int( ch ), ch->perm_int, GET_DAMROLL( ch ), ctime( ¤t_time ) ); } else { pager_printf( ch, "STR : %2.2d(%2.2d) Saved: %s\r", get_curr_str( ch ), ch->perm_str, ch->save_time ? ctime( &( ch->save_time ) ) : "no\n" ); pager_printf( ch, "INT : %2.2d(%2.2d) Time: %s\r", get_curr_int( ch ), ch->perm_int, ctime( ¤t_time ) ); } if( GET_AC( ch ) >= 101 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the rags of a beggar" ); else if( GET_AC( ch ) >= 80 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "improper for adventure" ); else if( GET_AC( ch ) >= 55 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "shabby and threadbare" ); else if( GET_AC( ch ) >= 40 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "of poor quality" ); else if( GET_AC( ch ) >= 20 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "scant protection" ); else if( GET_AC( ch ) >= 10 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "that of a knave" ); else if( GET_AC( ch ) >= 0 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "moderately crafted" ); else if( GET_AC( ch ) >= -10 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "well crafted" ); else if( GET_AC( ch ) >= -20 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of squires" ); else if( GET_AC( ch ) >= -40 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "excellently crafted" ); else if( GET_AC( ch ) >= -60 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of knights" ); else if( GET_AC( ch ) >= -80 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of barons" ); else if( GET_AC( ch ) >= -100 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of dukes" ); else if( GET_AC( ch ) >= -200 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of emperors" ); else snprintf( buf, MAX_STRING_LENGTH, "%s", "that of an avatar" ); if( ch->level > 24 ) pager_printf( ch, "WIS : %2.2d(%2.2d) Armor: %4.4d, %s\r\n", get_curr_wis( ch ), ch->perm_wis, GET_AC( ch ), buf ); else pager_printf( ch, "WIS : %2.2d(%2.2d) Armor: %s \r\n", get_curr_wis( ch ), ch->perm_wis, buf ); if( ch->alignment > 900 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "devout" ); else if( ch->alignment > 700 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "noble" ); else if( ch->alignment > 350 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "honorable" ); else if( ch->alignment > 100 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "worthy" ); else if( ch->alignment > -100 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "neutral" ); else if( ch->alignment > -350 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "base" ); else if( ch->alignment > -700 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "evil" ); else if( ch->alignment > -900 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "ignoble" ); else snprintf( buf, MAX_STRING_LENGTH, "%s", "fiendish" ); if( ch->level < 10 ) pager_printf( ch, "DEX : %2.2d(%2.2d) Align: %-20.20s Items: %5.5d (max %5.5d)\r\n", get_curr_dex( ch ), ch->perm_dex, buf, ch->carry_number, can_carry_n( ch ) ); else pager_printf( ch, "DEX : %2.2d(%2.2d) Align: %+4.4d, %-14.14s Items: %5.5d (max %5.5d)\r\n", get_curr_dex( ch ), ch->perm_dex, ch->alignment, buf, ch->carry_number, can_carry_n( ch ) ); switch ( ch->position ) { case POS_DEAD: snprintf( buf, MAX_STRING_LENGTH, "%s", "slowly decomposing" ); break; case POS_MORTAL: snprintf( buf, MAX_STRING_LENGTH, "%s", "mortally wounded" ); break; case POS_INCAP: snprintf( buf, MAX_STRING_LENGTH, "%s", "incapacitated" ); break; case POS_STUNNED: snprintf( buf, MAX_STRING_LENGTH, "%s", "stunned" ); break; case POS_SLEEPING: snprintf( buf, MAX_STRING_LENGTH, "%s", "sleeping" ); break; case POS_RESTING: snprintf( buf, MAX_STRING_LENGTH, "%s", "resting" ); break; case POS_STANDING: snprintf( buf, MAX_STRING_LENGTH, "%s", "standing" ); break; case POS_FIGHTING: snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting" ); break; case POS_EVASIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (evasive)" ); /* Fighting style support -haus */ break; case POS_DEFENSIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (defensive)" ); break; case POS_AGGRESSIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (aggressive)" ); break; case POS_BERSERK: snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (berserk)" ); break; case POS_MOUNTED: snprintf( buf, MAX_STRING_LENGTH, "%s", "mounted" ); break; case POS_SITTING: snprintf( buf, MAX_STRING_LENGTH, "%s", "sitting" ); break; } pager_printf( ch, "CON : %2.2d(%2.2d) Pos'n: %-21.21s Weight: %5.5d (max %7.7d)\r\n", get_curr_con( ch ), ch->perm_con, buf, ch->carry_weight, can_carry_w( ch ) ); /* * Fighting style support -haus */ pager_printf( ch, "CHA : %2.2d(%2.2d) Wimpy: %-5d ", get_curr_cha( ch ), ch->perm_cha, ch->wimpy ); switch ( ch->style ) { case STYLE_EVASIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "evasive" ); break; case STYLE_DEFENSIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "defensive" ); break; case STYLE_AGGRESSIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "aggressive" ); break; case STYLE_BERSERK: snprintf( buf, MAX_STRING_LENGTH, "%s", "berserk" ); break; default: snprintf( buf, MAX_STRING_LENGTH, "%s", "standard" ); break; } pager_printf( ch, "Style: %-10.10s\r\n", buf ); pager_printf( ch, "LCK : %2.2d(%2.2d) \r\n", get_curr_lck( ch ), ch->perm_lck ); pager_printf( ch, "Glory: %4.4d(%4.4d) \r\n", ch->pcdata->quest_curr, ch->pcdata->quest_accum ); pager_printf( ch, "PRACT: %3.3d Hitpoints: %-5d of %5d Pager: (%c) %3d AutoExit(%c)\r\n", ch->practice, ch->hit, ch->max_hit, IS_SET( ch->pcdata->flags, PCFLAG_PAGERON ) ? 'X' : ' ', ch->pcdata->pagerlen, xIS_SET( ch->act, PLR_AUTOEXIT ) ? 'X' : ' ' ); if( IS_VAMPIRE( ch ) ) pager_printf( ch, "XP : %-9d Blood: %-5d of %5d MKills: %-5.5d AutoLoot(%c)\r\n", ch->exp, ch->pcdata->condition[COND_BLOODTHIRST], 10 + ch->level, ch->pcdata->mkills, xIS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ' ); else if( ch->Class == CLASS_WARRIOR ) pager_printf( ch, "XP : %-9d MKills: %-5.5d AutoLoot(%c)\r\n", ch->exp, ch->pcdata->mkills, xIS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ' ); else pager_printf( ch, "XP : %-9d Mana: %-5d of %5d MKills: %-5.5d AutoLoot(%c)\r\n", ch->exp, ch->mana, ch->max_mana, ch->pcdata->mkills, xIS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ' ); pager_printf( ch, "GOLD : %-13s Move: %-5d of %5d Mdeaths: %-5.5d AutoSac (%c)\r\n", num_punct( ch->gold ), ch->move, ch->max_move, ch->pcdata->mdeaths, xIS_SET( ch->act, PLR_AUTOSAC ) ? 'X' : ' ' ); if( !IS_NPC( ch ) && ch->pcdata->condition[COND_DRUNK] > 10 ) send_to_pager( "You are drunk.\r\n", ch ); if( !IS_NPC( ch ) && ch->pcdata->condition[COND_THIRST] == 0 ) send_to_pager( "You are in danger of dehydrating.\r\n", ch ); if( !IS_NPC( ch ) && ch->pcdata->condition[COND_FULL] == 0 ) send_to_pager( "You are starving to death.\r\n", ch ); if( ch->position != POS_SLEEPING ) switch ( ch->mental_state / 10 ) { default: send_to_pager( "You're completely messed up!\r\n", ch ); break; case -10: send_to_pager( "You're barely conscious.\r\n", ch ); break; case -9: send_to_pager( "You can barely keep your eyes open.\r\n", ch ); break; case -8: send_to_pager( "You're extremely drowsy.\r\n", ch ); break; case -7: send_to_pager( "You feel very unmotivated.\r\n", ch ); break; case -6: send_to_pager( "You feel sedated.\r\n", ch ); break; case -5: send_to_pager( "You feel sleepy.\r\n", ch ); break; case -4: send_to_pager( "You feel tired.\r\n", ch ); break; case -3: send_to_pager( "You could use a rest.\r\n", ch ); break; case -2: send_to_pager( "You feel a little under the weather.\r\n", ch ); break; case -1: send_to_pager( "You feel fine.\r\n", ch ); break; case 0: send_to_pager( "You feel great.\r\n", ch ); break; case 1: send_to_pager( "You feel energetic.\r\n", ch ); break; case 2: send_to_pager( "Your mind is racing.\r\n", ch ); break; case 3: send_to_pager( "You can't think straight.\r\n", ch ); break; case 4: send_to_pager( "Your mind is going 100 miles an hour.\r\n", ch ); break; case 5: send_to_pager( "You're high as a kite.\r\n", ch ); break; case 6: send_to_pager( "Your mind and body are slipping apart.\r\n", ch ); break; case 7: send_to_pager( "Reality is slipping away.\r\n", ch ); break; case 8: send_to_pager( "You have no idea what is real, and what is not.\r\n", ch ); break; case 9: send_to_pager( "You feel immortal.\r\n", ch ); break; case 10: send_to_pager( "You are a Supreme Entity.\r\n", ch ); break; } else if( ch->mental_state > 45 ) send_to_pager( "Your sleep is filled with strange and vivid dreams.\r\n", ch ); else if( ch->mental_state > 25 ) send_to_pager( "Your sleep is uneasy.\r\n", ch ); else if( ch->mental_state < -35 ) send_to_pager( "You are deep in a much needed sleep.\r\n", ch ); else if( ch->mental_state < -25 ) send_to_pager( "You are in deep slumber.\r\n", ch ); send_to_pager( "Languages: ", ch ); for( iLang = 0; lang_array[iLang] != LANG_UNKNOWN; iLang++ ) if( knows_language( ch, lang_array[iLang], ch ) || ( IS_NPC( ch ) && ch->speaks == 0 ) ) { if( lang_array[iLang] & ch->speaking || ( IS_NPC( ch ) && !ch->speaking ) ) set_pager_color( AT_RED, ch ); send_to_pager( lang_names[iLang], ch ); send_to_pager( " ", ch ); set_pager_color( AT_SCORE, ch ); } send_to_pager( "\r\n", ch ); if( ch->pcdata->bestowments && ch->pcdata->bestowments[0] != '\0' ) pager_printf( ch, "You are bestowed with the command(s): %s.\r\n", ch->pcdata->bestowments ); if( ch->morph && ch->morph->morph ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); if( IS_IMMORTAL( ch ) ) pager_printf( ch, "Morphed as (%d) %s with a timer of %d.\r\n", ch->morph->morph->vnum, ch->morph->morph->short_desc, ch->morph->timer ); else pager_printf( ch, "You are morphed into a %s.\r\n", ch->morph->morph->short_desc ); send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); } if( CAN_PKILL( ch ) ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); pager_printf( ch, "PKILL DATA: Pkills (%3.3d) Illegal Pkills (%3.3d) Pdeaths (%3.3d)\r\n", ch->pcdata->pkills, ch->pcdata->illegal_pk, ch->pcdata->pdeaths ); } if( ch->pcdata->clan && ch->pcdata->clan->clan_type != CLAN_ORDER && ch->pcdata->clan->clan_type != CLAN_GUILD ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); pager_printf( ch, "CLAN STATS: %-14.14s Clan AvPkills : %-5d Clan NonAvpkills : %-5d\r\n", ch->pcdata->clan->name, ch->pcdata->clan->pkills[6], ( ch->pcdata->clan->pkills[1] + ch->pcdata->clan->pkills[2] + ch->pcdata->clan->pkills[3] + ch->pcdata->clan->pkills[4] + ch->pcdata->clan->pkills[5] ) ); pager_printf( ch, " Clan AvPdeaths: %-5d Clan NonAvpdeaths: %-5d\r\n", ch->pcdata->clan->pdeaths[6], ( ch->pcdata->clan->pdeaths[1] + ch->pcdata->clan->pdeaths[2] + ch->pcdata->clan->pdeaths[3] + ch->pcdata->clan->pdeaths[4] + ch->pcdata->clan->pdeaths[5] ) ); } if( ch->pcdata->deity ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); if( ch->pcdata->favor > 2250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "loved" ); else if( ch->pcdata->favor > 2000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "cherished" ); else if( ch->pcdata->favor > 1750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "honored" ); else if( ch->pcdata->favor > 1500 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "praised" ); else if( ch->pcdata->favor > 1250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "favored" ); else if( ch->pcdata->favor > 1000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "respected" ); else if( ch->pcdata->favor > 750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "liked" ); else if( ch->pcdata->favor > 250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "tolerated" ); else if( ch->pcdata->favor > -250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "ignored" ); else if( ch->pcdata->favor > -750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "shunned" ); else if( ch->pcdata->favor > -1000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "disliked" ); else if( ch->pcdata->favor > -1250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "dishonored" ); else if( ch->pcdata->favor > -1500 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "disowned" ); else if( ch->pcdata->favor > -1750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "abandoned" ); else if( ch->pcdata->favor > -2000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "despised" ); else if( ch->pcdata->favor > -2250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "hated" ); else snprintf( buf, MAX_STRING_LENGTH, "%s", "damned" ); pager_printf( ch, "Deity: %-20s Favor: %s\r\n", ch->pcdata->deity->name, buf ); } if( ch->pcdata->clan && ch->pcdata->clan->clan_type == CLAN_ORDER ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); pager_printf( ch, "Order: %-20s Order Mkills: %-6d Order MDeaths: %-6d\r\n", ch->pcdata->clan->name, ch->pcdata->clan->mkills, ch->pcdata->clan->mdeaths ); } if( ch->pcdata->clan && ch->pcdata->clan->clan_type == CLAN_GUILD ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); pager_printf( ch, "Guild: %-20s Guild Mkills: %-6d Guild MDeaths: %-6d\r\n", ch->pcdata->clan->name, ch->pcdata->clan->mkills, ch->pcdata->clan->mdeaths ); } if( IS_IMMORTAL( ch ) ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); pager_printf( ch, "IMMORTAL DATA: Wizinvis [%s] Wizlevel (%d)\r\n", xIS_SET( ch->act, PLR_WIZINVIS ) ? "X" : " ", ch->pcdata->wizinvis ); pager_printf( ch, "Bamfin: %s %s\r\n", ch->name, ( ch->pcdata->bamfin[0] != '\0' ) ? ch->pcdata->bamfin : "appears in a swirling mist." ); pager_printf( ch, "Bamfout: %s %s\r\n", ch->name, ( ch->pcdata->bamfout[0] != '\0' ) ? ch->pcdata->bamfout : "leaves in a swirling mist." ); /* * Area Loaded info - Scryn 8/11 */ if( ch->pcdata->area ) { pager_printf( ch, "Vnums: Room (%-5.5d - %-5.5d) Object (%-5.5d - %-5.5d) Mob (%-5.5d - %-5.5d)\r\n", ch->pcdata->area->low_r_vnum, ch->pcdata->area->hi_r_vnum, ch->pcdata->area->low_o_vnum, ch->pcdata->area->hi_o_vnum, ch->pcdata->area->low_m_vnum, ch->pcdata->area->hi_m_vnum ); pager_printf( ch, "Area Loaded [%s]\r\n", ( IS_SET( ch->pcdata->area->status, AREA_LOADED ) ) ? "yes" : "no" ); } } if( ch->first_affect ) { int i; SKILLTYPE *sktmp; i = 0; send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); send_to_pager( "AFFECT DATA: ", ch ); for( paf = ch->first_affect; paf; paf = paf->next ) { if( ( sktmp = get_skilltype( paf->type ) ) == NULL ) continue; if( ch->level < 20 ) { pager_printf( ch, "[%-34.34s] ", sktmp->name ); if( i == 0 ) i = 2; if( ( ++i % 3 ) == 0 ) send_to_pager( "\r\n", ch ); } if( ch->level >= 20 ) { if( paf->modifier == 0 ) pager_printf( ch, "[%-24.24s;%5d rds] ", sktmp->name, paf->duration ); else if( paf->modifier > 999 ) pager_printf( ch, "[%-15.15s; %7.7s;%5d rds] ", sktmp->name, tiny_affect_loc_name( paf->location ), paf->duration ); else pager_printf( ch, "[%-11.11s;%+-3.3d %7.7s;%5d rds] ", sktmp->name, paf->modifier, tiny_affect_loc_name( paf->location ), paf->duration ); if( i == 0 ) i = 1; if( ( ++i % 2 ) == 0 ) send_to_pager( "\r\n", ch ); } } } send_to_pager( "\r\n", ch ); return; }
/* * New score command by Haus */ void do_score( CHAR_DATA * ch, const char *argument ) { AFFECT_DATA *paf; int iLang, x; if( IS_NPC( ch ) ) { do_oldscore( ch, argument ); return; } ch_printf( ch, "\r\n&zScore for %s.\r\n", ch->pcdata->title ); if( get_trust( ch ) != ch->top_level ) ch_printf( ch, "You are trusted at level %d.\r\n", get_trust( ch ) ); send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch ); ch_printf( ch, "&r|&zRace &r:&W %-3d&z year old %-10.10s Log In&r:&W %-25.24s&r|\r\n", get_age( ch ), capitalize( get_race( ch ) ), ctime( &( ch->logon ) ) ); ch_printf( ch, "&r|&zHitroll &r: &W%-5d &zDamroll&r:&W %-5d &zSaved &r:&W %-25.24s&r|\r\n", GET_HITROLL( ch ), GET_DAMROLL( ch ), ch->save_time ? ctime( &( ch->save_time ) ) : "no" ); ch_printf( ch, "&r|&zGlobal AC &r: &W%-5d &zEvasion&r: &W%-5d &zTime &r: &W%-25.24s&r|\r\n", GET_ARMOR( ch ), GET_EVASION( ch ), ctime( ¤t_time ) ); ch_printf( ch, "&r|&zAlign &r: &W%-5d &zWimpy &r:&W %-3d &r|\r\n", ch->alignment, ch->wimpy ); send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch ); send_to_char( " &zBarehand Damtypes&r:", ch ); for( x = 0; x < MAX_DAMTYPE; x++ ) if( xIS_SET( ch->damtype, x ) ) ch_printf( ch, " &W%s&r,", d_type[x] ); send_to_char( "\r\n", ch ); ch_printf( ch, " &r&zHit Points&r: &W%d&z of&W %d &z Move&r: &W%d&z of&W %d &z Force&r:&W %d&z of&W %d&z\r\n", ch->hit, ch->max_hit, ch->move, ch->max_move, ch->mana, ch->max_mana ); ch_printf( ch, " &zStr&r: &W%2d &zDex&r:&W %2d &zCon&r: &W%2d &zAgi&r:&W %2d &z Int&r:&W %2d &zWis&r:&W %2d&z Cha&r: &w%2d&z\r\n", get_curr_str( ch ), get_curr_dex( ch ), get_curr_con( ch ), get_curr_agi( ch ), get_curr_int( ch ), get_curr_wis( ch ), get_curr_cha( ch ) ); send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch ); { int ability; for( ability = 0; ability < MAX_ABILITY; ability++ ) { if( ch->skill_level[ability] < 1 ) continue; ch_printf( ch, " &W%-15s &zLevel&r: &W%-3d &zMax&r: &W%-3d &zExp&r: &W%-10ld &zNext&r: &W%-10ld&z\r\n", ability_name[ability], ch->skill_level[ability], max_level( ch, ability ), ch->experience[ability], exp_level( ch->skill_level[ability] + 1 ) ); if( ability == COMBAT_ABILITY ) { for( x = 0; x < MAX_DISCIPLINE; x++ ) if( ch->known_disciplines[x] != NULL ) ch_printf( ch, " - %s%s&g\r\n", is_discipline_set( ch, ch->known_disciplines[x] ) ? "&z" : "&W", ch->known_disciplines[x]->name ); } } } send_to_char( "&r----------------------------------------------------------------------------\r\n", ch ); send_to_char( "&r|&zDamage &zType &r| &zPenetrate &r| &zResist &r| &zPotency &r|\r\n", ch ); send_to_char( "&r----------------------------------------------------------------------------\r\n", ch ); for( x = 0; x < MAX_DAMTYPE; x++ ) ch_printf( ch, "&r|%-19.19s&r: &W%3d &r| &W%3d &r| &W%3d &r|\r\n", d_type_score[x], ch->penetration[x], ch->resistance[x], ch->damtype_potency[x] ); send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch ); ch_printf( ch, "&zCREDITS&r:&W %-10d &zBANK&r: &W%-10d &zPkills&r: &W%-5.5d &zMkills&r:&W %-5.5d\r\n", ch->gold, ch->pcdata->bank, ch->pcdata->pkills, ch->pcdata->mkills ); ch_printf( ch, "&zWeight&r: &W%5.5d &r(&zmax&W %7.7d&r)&z Items&r: &W%5.5d &r(&zmax&W %5.5d&r)\r\n", ch->carry_weight, can_carry_w( ch ), ch->carry_number, can_carry_n( ch ) ); ch_printf( ch, "&zPager&r: &r(&W%c&r)&W %3d &z AutoExit&r(&W%c&r) &z AutoLoot&r(&W%c&r)&z Autosac&r(&W%c&r)\r\n", IS_SET( ch->pcdata->flags, PCFLAG_PAGERON ) ? 'X' : ' ', ch->pcdata->pagerlen, IS_SET( ch->act, PLR_AUTOEXIT ) ? 'X' : ' ', IS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ', IS_SET( ch->act, PLR_AUTOSAC ) ? 'X' : ' ' ); send_to_char( "\r\n&zLanguages&r: ", ch ); for( iLang = 0; lang_array[iLang] != LANG_UNKNOWN; iLang++ ) if( knows_language( ch, lang_array[iLang], ch ) || ( IS_NPC( ch ) && ch->speaks == 0 ) ) { if( lang_array[iLang] & ch->speaking || ( IS_NPC( ch ) && !ch->speaking ) ) set_char_color( AT_RED, ch ); send_to_char( lang_names[iLang], ch ); send_to_char( " ", ch ); set_char_color( AT_SCORE, ch ); } send_to_char( "\r\n", ch ); ch_printf( ch, "&zWANTED ON&r: &W%s\r\n", flag_string( ch->pcdata->wanted_flags, planet_flags ) ); if( ch->pcdata->bestowments && ch->pcdata->bestowments[0] != '\0' ) ch_printf( ch, "&zYou are bestowed with the command&r(&zs&r):&W %s.\r\n", ch->pcdata->bestowments ); if( ch->pcdata->clan ) { send_to_char( "&r----------------------------------------------------------------------------\r\n", ch ); ch_printf( ch, "&zORGANIZATION&r:&W %-35s &zPkills&r/&zDeaths&r: &W%3.3d&r/&W%3.3d", ch->pcdata->clan->name, ch->pcdata->clan->pkills, ch->pcdata->clan->pdeaths ); send_to_char( "\r\n", ch ); } if( IS_IMMORTAL( ch ) ) { send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch ); ch_printf( ch, "IMMORTAL DATA: Wizinvis [%s] Wizlevel (%d)\r\n", IS_SET( ch->act, PLR_WIZINVIS ) ? "X" : " ", ch->pcdata->wizinvis ); ch_printf( ch, "Bamfin: %s\r\n", ( ch->pcdata->bamfin[0] != '\0' ) ? ch->pcdata->bamfin : "%s appears in a swirling mist.", ch->name ); ch_printf( ch, "Bamfout: %s\r\n", ( ch->pcdata->bamfout[0] != '\0' ) ? ch->pcdata->bamfout : "%s leaves in a swirling mist.", ch->name ); /* * Area Loaded info - Scryn 8/11 */ if( ch->pcdata->area ) { ch_printf( ch, "Vnums: Room (%-5.5d - %-5.5d) Object (%-5.5d - %-5.5d) Mob (%-5.5d - %-5.5d)\r\n", ch->pcdata->area->low_r_vnum, ch->pcdata->area->hi_r_vnum, ch->pcdata->area->low_o_vnum, ch->pcdata->area->hi_o_vnum, ch->pcdata->area->low_m_vnum, ch->pcdata->area->hi_m_vnum ); ch_printf( ch, "Area Loaded [%s]\r\n", ( IS_SET( ch->pcdata->area->status, AREA_LOADED ) ) ? "yes" : "no" ); } } if( ch->first_affect ) { int i; const char *skname; i = 0; send_to_char( "&r----------------------------------------------------------------------------&z\r\n", ch ); send_to_char( "&zAFFECT DATA&r:\r\n", ch ); for( paf = ch->first_affect; paf; paf = paf->next ) { skname = paf->from; if( paf->modifier == 0 ) ch_printf( ch, "&r[&W%-63.64s&r;&W%5d &zrds&r]", skname, (int)paf->duration ); else if( paf->modifier > 999 ) ch_printf( ch, "&r[&W%-54.55s&r; &W%7.7s&r;&W%5d &zrds&r]", skname, tiny_affect_loc_name( paf->location ), (int)paf->duration ); else ch_printf( ch, "&r[&W%-51.52s&r;&W%+-3.3d %7.7s&r;%5d &zrds&r]", skname, paf->modifier, tiny_affect_loc_name( paf->location ), (int)paf->duration ); if( i == 0 ) i = 1; if( ( ++i % 1 ) == 0 ) send_to_char( "\r\n", ch ); } } send_to_char( "\r\n&w", ch ); return; }
void do_oldscore( CHAR_DATA * ch, const char *argument ) { AFFECT_DATA *paf; SKILLTYPE *skill; if( IS_AFFECTED( ch, AFF_POSSESS ) ) { send_to_char( "You can't do that in your current state of mind!\r\n", ch ); return; } set_char_color( AT_SCORE, ch ); ch_printf( ch, "You are %s%s, level %d, %d years old (%d hours).\r\n", ch->name, IS_NPC( ch ) ? "" : ch->pcdata->title, ch->top_level, get_age( ch ), ( get_age( ch ) - 17 ) ); if( get_trust( ch ) != ch->top_level ) ch_printf( ch, "You are trusted at level %d.\r\n", get_trust( ch ) ); if( IS_SET( ch->act, ACT_MOBINVIS ) ) ch_printf( ch, "You are mobinvis at level %d.\r\n", ch->mobinvis ); ch_printf( ch, "You have %d/%d hit, %d/%d movement.\r\n", ch->hit, ch->max_hit, ch->move, ch->max_move ); ch_printf( ch, "You are carrying %d/%d items with weight %d/%d kg.\r\n", ch->carry_number, can_carry_n( ch ), ch->carry_weight, can_carry_w( ch ) ); ch_printf( ch, "Str: %d Int: %d Wis: %d Dex: %d Con: %d Cha: %d Lck: ?? Frc: ??\r\n", get_curr_str( ch ), get_curr_int( ch ), get_curr_wis( ch ), get_curr_dex( ch ), get_curr_con( ch ), get_curr_cha( ch ) ); ch_printf( ch, "You have have %d credits.\r\n", ch->gold ); if( !IS_NPC( ch ) ) ch_printf( ch, "You have achieved %d glory during your life, and currently have %d.\r\n", ch->pcdata->quest_accum, ch->pcdata->quest_curr ); ch_printf( ch, "Autoexit: %s Autoloot: %s Autosac: %s Autocred: %s\r\n", ( !IS_NPC( ch ) && IS_SET( ch->act, PLR_AUTOEXIT ) ) ? "yes" : "no", ( !IS_NPC( ch ) && IS_SET( ch->act, PLR_AUTOLOOT ) ) ? "yes" : "no", ( !IS_NPC( ch ) && IS_SET( ch->act, PLR_AUTOSAC ) ) ? "yes" : "no", ( !IS_NPC( ch ) && IS_SET( ch->act, PLR_AUTOGOLD ) ) ? "yes" : "no" ); ch_printf( ch, "Wimpy set to %d hit points.\r\n", ch->wimpy ); if( !IS_NPC( ch ) && ch->pcdata->condition[COND_DRUNK] > 10 ) send_to_char( "You are drunk.\r\n", ch ); if( !IS_NPC( ch ) && ch->pcdata->condition[COND_THIRST] == 0 ) send_to_char( "You are thirsty.\r\n", ch ); if( !IS_NPC( ch ) && ch->pcdata->condition[COND_FULL] == 0 ) send_to_char( "You are hungry.\r\n", ch ); switch ( ch->mental_state / 10 ) { default: send_to_char( "You're completely messed up!\r\n", ch ); break; case -10: send_to_char( "You're barely conscious.\r\n", ch ); break; case -9: send_to_char( "You can barely keep your eyes open.\r\n", ch ); break; case -8: send_to_char( "You're extremely drowsy.\r\n", ch ); break; case -7: send_to_char( "You feel very unmotivated.\r\n", ch ); break; case -6: send_to_char( "You feel sedated.\r\n", ch ); break; case -5: send_to_char( "You feel sleepy.\r\n", ch ); break; case -4: send_to_char( "You feel tired.\r\n", ch ); break; case -3: send_to_char( "You could use a rest.\r\n", ch ); break; case -2: send_to_char( "You feel a little under the weather.\r\n", ch ); break; case -1: send_to_char( "You feel fine.\r\n", ch ); break; case 0: send_to_char( "You feel great.\r\n", ch ); break; case 1: send_to_char( "You feel energetic.\r\n", ch ); break; case 2: send_to_char( "Your mind is racing.\r\n", ch ); break; case 3: send_to_char( "You can't think straight.\r\n", ch ); break; case 4: send_to_char( "Your mind is going 100 miles an hour.\r\n", ch ); break; case 5: send_to_char( "You're high as a kite.\r\n", ch ); break; case 6: send_to_char( "Your mind and body are slipping appart.\r\n", ch ); break; case 7: send_to_char( "Reality is slipping away.\r\n", ch ); break; case 8: send_to_char( "You have no idea what is real, and what is not.\r\n", ch ); break; case 9: send_to_char( "You feel immortal.\r\n", ch ); break; case 10: send_to_char( "You are a Supreme Entity.\r\n", ch ); break; } switch ( ch->position ) { case POS_DEAD: send_to_char( "You are DEAD!!\r\n", ch ); break; case POS_MORTAL: send_to_char( "You are mortally wounded.\r\n", ch ); break; case POS_INCAP: send_to_char( "You are incapacitated.\r\n", ch ); break; case POS_STUNNED: send_to_char( "You are stunned.\r\n", ch ); break; case POS_SLEEPING: send_to_char( "You are sleeping.\r\n", ch ); break; case POS_RESTING: send_to_char( "You are resting.\r\n", ch ); break; case POS_STANDING: send_to_char( "You are standing.\r\n", ch ); break; case POS_FIGHTING: send_to_char( "You are fighting.\r\n", ch ); break; case POS_MOUNTED: send_to_char( "Mounted.\r\n", ch ); break; case POS_SHOVE: send_to_char( "Being shoved.\r\n", ch ); break; case POS_DRAG: send_to_char( "Being dragged.\r\n", ch ); break; } if( ch->top_level >= 25 ) ch_printf( ch, "Evasion: %d. \r\n", GET_EVASION( ch ) ); if( ch->top_level >= 15 ) ch_printf( ch, "Hitroll: %d Damroll: %d.\r\n", GET_HITROLL( ch ), GET_DAMROLL( ch ) ); if( ch->top_level >= 10 ) ch_printf( ch, "Alignment: %d. ", ch->alignment ); send_to_char( "You are ", ch ); if( ch->alignment > 900 ) send_to_char( "angelic.\r\n", ch ); else if( ch->alignment > 700 ) send_to_char( "saintly.\r\n", ch ); else if( ch->alignment > 350 ) send_to_char( "good.\r\n", ch ); else if( ch->alignment > 100 ) send_to_char( "kind.\r\n", ch ); else if( ch->alignment > -100 ) send_to_char( "neutral.\r\n", ch ); else if( ch->alignment > -350 ) send_to_char( "mean.\r\n", ch ); else if( ch->alignment > -700 ) send_to_char( "evil.\r\n", ch ); else if( ch->alignment > -900 ) send_to_char( "demonic.\r\n", ch ); else send_to_char( "satanic.\r\n", ch ); if( ch->first_affect ) { send_to_char( "You are affected by:\r\n", ch ); for( paf = ch->first_affect; paf; paf = paf->next ) if( ( skill = get_skilltype( paf->type ) ) != NULL ) { ch_printf( ch, "Spell: '%s'", skill->name ); if( ch->top_level >= 20 ) ch_printf( ch, " modifies %s by %d for %d rounds", affect_loc_name( paf->location ), paf->modifier, paf->duration ); send_to_char( ".\r\n", ch ); } } if( !IS_NPC( ch ) && IS_IMMORTAL( ch ) ) { ch_printf( ch, "WizInvis level: %d WizInvis is %s\r\n", ch->pcdata->wizinvis, IS_SET( ch->act, PLR_WIZINVIS ) ? "ON" : "OFF" ); if( ch->pcdata->r_range_lo && ch->pcdata->r_range_hi ) ch_printf( ch, "Room Range: %d - %d\r\n", ch->pcdata->r_range_lo, ch->pcdata->r_range_hi ); if( ch->pcdata->o_range_lo && ch->pcdata->o_range_hi ) ch_printf( ch, "Obj Range : %d - %d\r\n", ch->pcdata->o_range_lo, ch->pcdata->o_range_hi ); if( ch->pcdata->m_range_lo && ch->pcdata->m_range_hi ) ch_printf( ch, "Mob Range : %d - %d\r\n", ch->pcdata->m_range_lo, ch->pcdata->m_range_hi ); } return; }
void do_withdraw( CHAR_DATA *ch, char *argument ) { BANK_DATA *bank; CHAR_DATA *banker; char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH]; int type = DEFAULT_CURR; int amount = 0; /* * arg1 == amount * arg2 == currency */ if ( !( banker = find_banker( ch ) ) ) { send_to_char( "You're not in a bank!\r\n", ch ); return; } if ( IS_NPC( ch ) ) { snprintf( buf, MSL, "say Sorry, %s, we don't do business with mobs.", ch->name ); interpret( banker, buf ); return; } if ( argument[0] == '\0' ) { send_to_char( "Syntax: withdraw [amount] [currency]\n", ch ); interpret( banker, ( char * ) "say if you need help type &WHELP BANK&D." ); return; } if ( ch->pcdata->bank == NULL ) { send_to_char( "You don't have any bank account open now.\r\n", ch ); return; } /* * Just to make sure that we are retrieving the latest bank info, not relying on the * stale bank info in pcdata struct */ bank = find_bank( ch->pcdata->bank->name ); if ( !bank ) { send_to_char( "There is no account by that name!\r\n", ch ); return; } argument = one_argument( argument, arg1 ); argument = one_argument( argument, arg2 ); if ( !str_cmp( arg1, "all" ) ) { amount = -1; } else if ( !is_number( arg1 ) ) { send_to_char( "You can only withdraw coins.\r\n", ch ); return; } else { amount = atoi( arg1 ); } if ( arg1 && arg2 ) type = get_currency_type( arg2 ); if ( type == CURR_NONE ) { send_to_char( "You don't have any of that kind of coin.\r\n", ch ); return; } if ( amount <= 0 ) { send_to_char( "You can't do that.\r\n", ch ); return; } if ( money_weight( amount, type ) + ch->carry_weight >= can_carry_w( ch ) ) { send_to_char( "You can't carry that much.\r\n", ch ); return; } if ( type == CURR_BRONZE ) { if ( amount > bank->bronze ) { ch_printf( ch, "You don't have that much %s in the bank.\r\n", curr_types[type] ); return; } bank->bronze -= amount; ch_printf( ch, "This brings your account bronze balance to %d.\r\n", bank->bronze ); } else if ( type == CURR_COPPER ) { if ( amount > bank->copper ) { ch_printf( ch, "You don't have that much %s in the bank.\r\n", curr_types[type] ); return; } bank->copper -= amount; ch_printf( ch, "This brings your account copper balance to %d.\r\n", bank->copper ); } else if ( type == CURR_GOLD ) { if ( amount > bank->gold ) { ch_printf( ch, "You don't have that much %s in the bank.\r\n", curr_types[type] ); return; } bank->gold -= amount; ch_printf( ch, "This brings your account gold balance to %d.\r\n", bank->gold ); } else if ( type == CURR_SILVER ) { if ( amount > bank->silver ) { ch_printf( ch, "You don't have that much %s in the bank.\r\n", curr_types[type] ); return; } bank->silver -= amount; ch_printf( ch, "This brings your account silver balance to %d.\r\n", bank->silver ); } else { send_to_char( "No such currency.\r\n", ch ); return; } GET_MONEY( ch, type ) += amount; ch_printf( ch, "You took %d %s coins from the bank.\r\n", amount, curr_types[type] ); bank->lastused = current_time; save_bank( ); save_char_obj( ch ); return; }
bool get_money_obj( CHAR_DATA * ch, char *argument, OBJ_DATA * obj ) { MONEY_TYPE *transfer = new MONEY_TYPE; short looper; char m_number[MSL]; char m_name[MSL]; char outbuf[MSL]; if ( !str_cmp( "all", argument ) ) { for ( looper = 0; looper < MAX_CURRENCY; looper++ ) { transfer->cash_unit[looper] = obj->money->cash_unit[looper]; obj->money->cash_unit[looper] = 0; } } else { for ( looper = 0; looper < MAX_CURRENCY; looper++ ) { transfer->cash_unit[looper] = 0; } for ( ;; ) { short mn; argument = one_argument( argument, m_number ); if ( m_number[0] == '\0' ) break; argument = one_argument( argument, m_name ); if ( m_name[0] == '\0' ) break; if ( ( ( mn = money_lookup( m_name ) ) < 0 ) || ( !is_number( m_number ) ) ) { snprintf( outbuf, MSL, "%s %s isn't a valid money type!\r\n", m_number, m_name ); send_to_char( outbuf, ch ); join_money( transfer, obj->money ); return FALSE; } if ( obj->money->cash_unit[mn] < atoi( m_number ) ) { /* snprintf( outbuf, MSL, "There isn't that much %s in %s!\r\n", m_name, obj->short_descr ); send_to_char( outbuf, ch ); */ join_money( transfer, obj->money ); return FALSE; } obj->money->cash_unit[mn] -= atoi( m_number ); transfer->cash_unit[mn] += atoi( m_number ); } } if ( money_value( transfer ) <= 0 ) { delete transfer; return FALSE; } if ( ( ch->carry_weight + money_weight( transfer ) ) > can_carry_w( ch ) ) { snprintf( outbuf, MSL, "%s", "You cannot carry that much weight!\r\n" ); send_to_char( outbuf, ch ); join_money( transfer, obj->money ); return FALSE; } ch->carry_weight += money_weight( transfer ); if ( check_charm_aff(ch, CHARM_AFF_GOLD) ) for ( looper = 0; looper < MAX_CURRENCY; looper++ ) transfer->cash_unit[looper] *= ((100 + get_charm_bonus(ch, CHARM_AFF_GOLD)) / 100); snprintf( outbuf, MSL, "You take %s from %s.\r\n", money_string( transfer ), obj->short_descr ); send_to_char( outbuf, ch ); join_money( transfer, ch->money ); return TRUE; }
bool get_money_room( CHAR_DATA * ch, char *argument ) { MONEY_TYPE *transfer = new MONEY_TYPE; short looper; char m_number[MSL]; char m_name[MSL]; char outbuf[MSL]; if ( !str_cmp( "all", argument ) ) { for ( looper = 0; looper < MAX_CURRENCY; looper++ ) { transfer->cash_unit[looper] = ch->in_room->treasure->cash_unit[looper]; ch->in_room->treasure->cash_unit[looper] = 0; } } else { for ( looper = 0; looper < MAX_CURRENCY; looper++ ) { transfer->cash_unit[looper] = 0; } for ( ;; ) { short mn; argument = one_argument( argument, m_number ); if ( m_number[0] == '\0' ) break; argument = one_argument( argument, m_name ); if ( m_name[0] == '\0' ) break; if ( ( ( mn = money_lookup( m_name ) ) < 0 ) || ( !is_number( m_number ) ) ) { snprintf( outbuf, MSL, "%s %s isn't a valid money type!\r\n", m_number, m_name ); send_to_char( outbuf, ch ); join_money( transfer, ch->in_room->treasure ); return FALSE; } if ( ch->in_room->treasure->cash_unit[mn] < atoi( m_number ) ) { /* snprintf( outbuf, MSL, "There isn't that much %s here!\r\n", m_name ); send_to_char( outbuf, ch ); */ join_money( transfer, ch->in_room->treasure ); return FALSE; } ch->in_room->treasure->cash_unit[mn] -= atoi( m_number ); transfer->cash_unit[mn] += atoi( m_number ); } } if ( ( ch->carry_weight + money_weight( transfer ) ) > can_carry_w( ch ) ) { snprintf( outbuf, MSL, "%s", "You cannot carry that much weight!\r\n" ); send_to_char( outbuf, ch ); join_money( transfer, ch->in_room->treasure ); return FALSE; } ch->carry_weight += money_weight( transfer ); if ( money_value( transfer ) <= 0 ) return FALSE; snprintf( outbuf, MSL, "You pick up %s.\r\n", money_string( transfer ) ); send_to_char( outbuf, ch ); join_money( transfer, ch->money ); return TRUE; }
void do_buy( CHAR_DATA * ch, char *argument ) { char arg[MAX_INPUT_LENGTH]; int maxgold = 0; argument = one_argument( argument, arg ); if( arg[0] == '\0' ) { send_to_char( "Buy what?\r\n", ch ); return; } /* in case of different shop types */ { CHAR_DATA *keeper = NULL; OBJ_DATA *obj = NULL; int cost = 0; int noi = 1; /* Number of items */ short 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; } } obj = get_obj_carry( keeper, arg ); if( !obj && arg[0] == '#' ) { int onum = 0, oref = atoi( arg + 1 ); bool ofound = FALSE; 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; } cost = ( get_cost( ch, keeper, obj, TRUE ) * noi ); 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 ) ) { char buf[MAX_STRING_LENGTH]; snprintf( buf, MAX_STRING_LENGTH, "%s", "laugh" ); interpret( keeper, buf ); 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 ) { act( AT_TELL, "$n tells you 'You can't afford to buy $p.'", keeper, obj, ch, TO_VICT ); ch->reply = keeper; return; } if( IS_SET( obj->extra_flags, ITEM_PROTOTYPE ) && IS_IMMORTAL( ch ) ) { 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.\r\n", 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.\r\n", 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 ); } ch->gold -= cost; keeper->gold += cost; if( keeper->gold > maxgold ) { 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 = create_object( obj->pIndexData ); OBJ_DATA *bag = NULL; /* * 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 ) ); /* 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; } }