my code to a point in act_obj.c:
void wear_obj( CHAR_DATA * ch, OBJ_DATA * obj, bool fReplace, short wear_bit )
{
OBJ_DATA *tmpobj = NULL;
short bit, tmp;
int *gsn_ptr = NULL;
separate_obj( obj );
/*if( get_trust( ch ) < obj->level )
*{
* ch_printf( ch, "You must be level %d to use this object.\r\n", obj->level );
* act( AT_ACTION, "$n tries to use $p, but is too inexperienced.", ch, obj, NULL, TO_ROOM );
* return;
*}
*/
if( !IS_IMMORTAL( ch )
&& ( ( IS_OBJ_STAT( obj, ITEM_ANTI_WARRIOR ) && ch->Class == CLASS_WARRIOR )
|| ( IS_OBJ_STAT( obj, ITEM_ANTI_WARRIOR ) && ch->Class == CLASS_SAVAGE )
|| ( IS_OBJ_STAT( obj, ITEM_ANTI_WARRIOR ) && ch->Class == CLASS_PALADIN )
|| ( IS_OBJ_STAT( obj, ITEM_ANTI_MAGE ) && ch->Class == CLASS_MAGE )
|| ( IS_OBJ_STAT( obj, ITEM_ANTI_MAGE ) && ch->Class == CLASS_NEPHANDI )
|| ( IS_OBJ_STAT( obj, ITEM_ANTI_THIEF ) && ch->Class == CLASS_THIEF )
|| ( IS_OBJ_STAT( obj, ITEM_ANTI_VAMPIRE ) && ch->Class == CLASS_VAMPIRE )
|| ( IS_OBJ_STAT( obj, ITEM_ANTI_DRUID ) && ch->Class == CLASS_DRUID )
|| ( IS_OBJ_STAT( obj, ITEM_ANTI_WARRIOR ) && ch->Class == CLASS_RANGER )
|| ( IS_OBJ_STAT( obj, ITEM_ANTI_MAGE ) && ch->Class == CLASS_AUGURER )
|| ( IS_OBJ_STAT( obj, ITEM_ANTI_CLERIC ) && ch->Class == CLASS_CLERIC )
|| ( IS_OBJ_STAT( obj, ITEM_ANTI_GOOD ) && ch->alignment > 350 )
|| ( IS_OBJ_STAT( obj, ITEM_ANTI_NEUTRAL ) && ch->alignment >= -350 && ch->alignment <= 350 )
|| ( IS_OBJ_STAT( obj, ITEM_ANTI_EVIL ) && ch->alignment < -350 ) ) )
{
act( AT_MAGIC, "You are forbidden to use that item.", ch, NULL, NULL, TO_CHAR );
act( AT_ACTION, "$n tries to use $p, but is forbidden to do so.", ch, obj, NULL, TO_ROOM );
return;
}
if( IS_OBJ_STAT( obj, ITEM_PERSONAL ) && str_cmp( ch->name, obj->owner ) )
{
send_to_char( "That item is personalized and belongs to someone else.\r\n", ch );
if( obj->carried_by )
obj_from_char( obj );
obj_to_room( obj, ch->in_room );
return;
}
if( wear_bit > -1 )
{
bit = wear_bit;
if( !CAN_WEAR( obj, 1 << bit ) )
{
if( fReplace )
{
switch ( 1 << bit )
{
case ITEM_HOLD:
send_to_char( "You cannot hold that.\r\n", ch );
break;
case ITEM_WIELD:
case ITEM_MISSILE_WIELD:
switch ( obj->value[4] )
{
default:
*gsn_ptr = -1;
break;
case DAM_HIT:
*gsn_ptr = gsn_daggers;
break;
case DAM_SUCTION:
*gsn_ptr = gsn_swords;
break;
case DAM_BITE:
*gsn_ptr = gsn_greatswords;
break;
case DAM_BLAST:
*gsn_ptr = gsn_hatchets;
break;
case DAM_SLASH:
*gsn_ptr = gsn_greataxes;
break;
case DAM_SLICE:
*gsn_ptr = gsn_maces;
break;
case DAM_PIERCE:
*gsn_ptr = gsn_mauls;
break;
case DAM_STAB:
*gsn_ptr = gsn_polearms;
break;
case DAM_WHIP:
*gsn_ptr = gsn_fists;
break;
case DAM_CLAW:
*gsn_ptr = gsn_staves;
break;
case DAM_POUND:
*gsn_ptr = gsn_wands;
break;
case DAM_CRUSH:
*gsn_ptr = gsn_guns;
break;
case DAM_BOLT:
*gsn_ptr = gsn_bows;
break;
case DAM_ARROW:
*gsn_ptr = gsn_crossbows;
break;
case DAM_DART:
case DAM_STONE:
case DAM_PEA:
*gsn_ptr = gsn_thrown;
break;
}
if (*gns_ptr != NULL)
ch_printf( ch, "gsn_ptr = %d", *gsn_ptr );
if( LEARNED( ch, gsn_ptr ) < 1 )
{
send_to_char( "You have not trained in this form of weaponry.\r\n", ch );
return;
}
}
}
return;
}
}
|