/** * Copyright (c) ©2005 Sony Online Entertainment Inc. * All Rights Reserved * * Title: support library for the doctor bag * @author $Author: Brandon Reinhart$ * @version $Revision: #1 $ */ //------------------------------------------------ // Includes //------------------------------------------------ include library.prose; include library.utils; //------------------------------------------------ // Constants //------------------------------------------------ const int MAX_MEDS = 25; // Limit to how many meds can be in the bag. const int HEALING_RANGE = 0; const int HEALING_AREA = 1; const int HEALING_DOT_POWER = 2; const int HEALING_DOT_POTENCY = 3; const int HEALING_DOT_ATTRIBUTE = 4; const int HEALING_DOT_DURATION = 5; const string_id SID_MEDICINE_STORED = new string_id( "doctor_bag", "medicine_stored" ); const string_id SID_MEDICINE_REMOVED = new string_id( "doctor_bag", "medicine_removed" ); //------------------------------------------------ // isDoctorBag //------------------------------------------------ boolean isDoctorBag( obj_id object ) { return hasObjVar( object, "doctor_bag" ); } //------------------------------------------------ // hasDoctorBag // // Returns true if the player has a doctor bag in their inventory. //------------------------------------------------ boolean hasDoctorBag( obj_id player ) { return ( null != getDoctorBag( player ) ); } //------------------------------------------------ // getDoctorBag // // Returns true if the player has at least one doctor bag in their inventory. //------------------------------------------------ obj_id getDoctorBag( obj_id player ) { // Search the player's inventory for at least one doctor bag. obj_id pInv = utils.getInventoryContainer( player ); if ( pInv == null ) return null; obj_id[] contents = utils.getContents( pInv, true ); if ( contents == null ) return null; for ( int i=0; i= MAX_MEDS ) { // Send a message saying the bag is full. return false; } // Add it to the first empty slot. int free_index = -1; for ( int i=0; i