/// <summary> /// Equip a char with an object. /// </summary> /// <param name="obj">The object.</param> /// <param name="iWear">The equipment slot to place the object on.</param> public void EquipObject( ref Object obj, ObjTemplate.WearLocation iWear ) { int aff; if( obj == null ) return; if( Object.GetEquipmentOnCharacter( this, iWear ) ) { string buf = String.Format( "CharData.EquipObject(): {0} already equipped at slot {1}.", Name, iWear ); Log.Error( buf, 0 ); return; } if( ( obj.HasFlag( ObjTemplate.ITEM_ANTI_EVIL ) && IsEvil() ) || ( obj.HasFlag( ObjTemplate.ITEM_ANTI_GOOD ) && IsGood() ) || ( obj.HasFlag( ObjTemplate.ITEM_ANTI_NEUTRAL ) && IsNeutral() ) ) { SocketConnection.Act( "You are zapped by $p&n and drop it.", this, obj, null, SocketConnection.MessageTarget.character ); SocketConnection.Act( "$n&n is zapped by $p&n and drops it.", this, obj, null, SocketConnection.MessageTarget.room ); obj.RemoveFromChar(); obj.AddToRoom( InRoom ); return; } ArmorPoints -= Object.GetArmorClassModifer( obj, iWear ); obj.WearLocation = iWear; CarryNumber--; foreach (Affect affect in obj.ObjIndexData.Affected) { ApplyAffectModifiers(affect, true); } foreach (Affect affect in obj.Affected) { ApplyAffectModifiers(affect, true); } if (obj.ItemType == ObjTemplate.ObjectType.light && obj.Values[2] != 0 && InRoom) { ++InRoom.Light; } for( aff = 0; aff < Limits.NUM_AFFECT_VECTORS; aff++ ) AffectedBy[ aff ] = AffectedBy[ aff ] | obj.AffectedBy[ aff ]; if (!IsNPC() && Socket.Terminal == SocketConnection.TerminalType.TERMINAL_ENHANCED) { Command.Equipment(this, new string[] { "" } ); } return; }