@ -46,7 +46,7 @@ public class CharacterItemManager {
				@@ -46,7 +46,7 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  final  ConcurrentHashMap < Integer ,  Integer >  itemIDtoType  =  new  ConcurrentHashMap < > ( MBServerStatics . CHM_INIT_CAP ,  MBServerStatics . CHM_LOAD ,  MBServerStatics . CHM_THREAD_LOW ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    // Mapping of all items equipped in this Manager
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    // Key = Item Slot
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  final  ConcurrentHashMap < Integer ,  Item >  equipped  =  new  ConcurrentHashMap < > ( MBServerStatics . CHM_INIT_CAP ,  MBServerStatics . CHM_LOAD ,  MBServerStatics . CHM_THREAD_LOW ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  final  ConcurrentHashMap < Enum . EquipSlotType ,  Item >  equipped  =  new  ConcurrentHashMap < > ( MBServerStatics . CHM_INIT_CAP ,  MBServerStatics . CHM_LOAD ,  MBServerStatics . CHM_THREAD_LOW ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  final  HashSet < Item >  inventory  =  new  HashSet < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  final  HashSet < Item >  bank  =  new  HashSet < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  final  HashSet < Item >  vault  =  new  HashSet < > ( ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -186,8 +186,8 @@ public class CharacterItemManager {
				@@ -186,8 +186,8 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            switch  ( i . containerType )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                case  EQUIPPED :   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    if  ( this . equipped . containsValue ( i )  = =  false )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        this . equipped . put ( ( int )  i . g etE quipSlot( ) ,  i ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        addEquipOrder ( ( int )  i . getEquipSlot ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        this . equipped . put ( i . equipSlot ,  i ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        addEquipOrder ( i . equipSlot . ordinal ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    break ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                case  BANK :   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -235,7 +235,7 @@ public class CharacterItemManager {
				@@ -235,7 +235,7 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            switch  ( i . containerType )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                case  EQUIPPED :   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    if  ( this . equipped . containsValue ( i )  = =  false )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        this . equipped . put ( ( int )  i . g etE quipSlot( ) ,  i ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        this . equipped . put ( i . equipSlot ,  i ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    break ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                case  BANK :   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    if  ( i . getItemBase ( ) . getType ( ) . equals ( ItemType . GOLD ) )   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -927,13 +927,11 @@ public class CharacterItemManager {
				@@ -927,13 +927,11 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  true ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        byte  slot  =  i . getEquipSlot ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( this . doesCharOwnThisItem ( i . getObjectUUID ( ) )  = =  false )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // remove it from other lists:
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . remItemFromLists ( i ,  slot ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . remItemFromLists ( i ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . itemIDtoType . remove ( i . getObjectUUID ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        calculateWeights ( ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -962,13 +960,11 @@ public class CharacterItemManager {
				@@ -962,13 +960,11 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                return  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        byte  slot  =  i . getEquipSlot ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( this . doesCharOwnThisItem ( i . getObjectUUID ( ) )  = =  false  & &  this . absCharacter . getObjectType ( )  ! =  GameObjectType . Mob  & &  ( i . containerType  ! =  Enum . ItemContainerType . FORGE ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // remove it from other lists:
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . remItemFromLists ( i ,  slot ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . remItemFromLists ( i ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . itemIDtoType . remove ( i . getObjectUUID ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        i . junk ( ) ;   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -993,7 +989,6 @@ public class CharacterItemManager {
				@@ -993,7 +989,6 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        boolean  fromEquip  =  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        synchronized  ( this )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            byte  slot  =  i . getEquipSlot ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            //Skip if NOT in vault.
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( i . containerType  ! =  Enum . ItemContainerType . VAULT )   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1019,7 +1014,7 @@ public class CharacterItemManager {
				@@ -1019,7 +1014,7 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                return  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // remove it from other lists:
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            this . remItemFromLists ( i ,  slot ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            this . remItemFromLists ( i ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // add to Inventory
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            this . inventory . add ( i ) ;   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1040,7 +1035,6 @@ public class CharacterItemManager {
				@@ -1040,7 +1035,6 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  synchronized  boolean  moveItemToBank ( Item  i )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        byte  slot  =  i . getEquipSlot ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( this . doesCharOwnThisItem ( i . getObjectUUID ( ) )  = =  false )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  false ;   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1057,7 +1051,7 @@ public class CharacterItemManager {
				@@ -1057,7 +1051,7 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // remove it from other lists:
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . remItemFromLists ( i ,  slot ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . remItemFromLists ( i ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // add to Bank
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . bank . add ( i ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1186,7 +1180,6 @@ public class CharacterItemManager {
				@@ -1186,7 +1180,6 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  synchronized  boolean  moveItemToVault ( Item  i )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        byte  slot  =  i . getEquipSlot ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //		if (this.doesCharOwnThisItem(i.getObjectUUID()) == false)
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //			return false;
   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1203,7 +1196,7 @@ public class CharacterItemManager {
				@@ -1203,7 +1196,7 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  false ;  // NPC's dont have vaults!
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // remove it from other lists:
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . remItemFromLists ( i ,  slot ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . remItemFromLists ( i ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // add to Vault
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        i . addToCache ( ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1276,13 +1269,14 @@ public class CharacterItemManager {
				@@ -1276,13 +1269,14 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  boolean  equipItem ( Item  i ,  byte  slot )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        synchronized  ( this )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            byte  curSlot  =  i . getEquipSlot ( ) ;  // Should be 0
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( this . doesCharOwnThisItem ( i . getObjectUUID ( ) )  = =  false  & &  this . absCharacter . getObjectType ( )  ! =  GameObjectType . Mob )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                Logger . error ( "Doesnt own item" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                return  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            Enum . EquipSlotType  equipSlot  =  Enum . EquipSlotType . values ( ) [ slot ] ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // Item must be in inventory to equip
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( ! this . inventory . contains ( i )  & &  this . absCharacter . getObjectType ( )  ! =  GameObjectType . Mob )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                return  false ;   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1290,7 +1284,7 @@ public class CharacterItemManager {
				@@ -1290,7 +1284,7 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // make sure player can equip item
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( i . getItemBase ( )  = =  null )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                return  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( ! i . getItemBase ( ) . canEquip ( s lot,  this ,  absCharacter ,  i )  & &  this . absCharacter . getObjectType ( )  ! =  GameObjectType . Mob )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( ! i . getItemBase ( ) . canEquip ( equipS lot,  this ,  absCharacter ,  i )  & &  this . absCharacter . getObjectType ( )  ! =  GameObjectType . Mob )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                return  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // check to see if item is already there.
   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1314,13 +1308,14 @@ public class CharacterItemManager {
				@@ -1314,13 +1308,14 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                return  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // remove it from other lists:
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            this . remItemFromLists ( i ,  slot ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            this . remItemFromLists ( i ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // add to Equipped
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            this . equipped . put ( ( int )  slot ,  i ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            this . equipped . put ( Enum . EquipSlotType . values ( ) [ slot ] ,  i ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            i . addToCache ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            addEquipOrder ( i . ge tEquipSlot ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            addEquipOrder ( slo t) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            //calculateWeights();
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1697,9 +1692,9 @@ public class CharacterItemManager {
				@@ -1697,9 +1692,9 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  lootItem ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  synchronized  void  remItemFromLists ( Item  i ,  byte  slot )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  synchronized  void  remItemFromLists ( Item  i )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . equipped . remove ( ( int )  s lot) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . equipped . remove ( i . equipS lot) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . vault . remove ( i ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . bank . remove ( i ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . inventory . remove ( i ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1858,9 +1853,9 @@ public class CharacterItemManager {
				@@ -1858,9 +1853,9 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        for  ( int   slot  :  this . equipped . keySet ( ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        for  ( Enum . EquipSlotType   slot  :  this . equipped . keySet ( ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( slot  = =  MBServerStatics . SLOT_HAIRSTYLE   | |  slot  = =  MBServerStatics . SLOT_BEARDSTYLE )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( slot  = =  Enum . EquipSlotType . HAIR   | |  slot  = =  Enum . EquipSlotType . BEARD )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                continue ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            Item  item  =  this . equipped . get ( slot ) ;   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1872,7 +1867,7 @@ public class CharacterItemManager {
				@@ -1872,7 +1867,7 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( ! ItemTemplate . validForSkills ( item ,  pc . getSkills ( ) ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                this . forceToInventory ( slot ,  item ,  pc ,  initialized ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                this . forceToInventory ( slot . ordinal ( ) ,  item ,  pc ,  initialized ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                pc . applyBonuses ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1886,7 +1881,7 @@ public class CharacterItemManager {
				@@ -1886,7 +1881,7 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return  the  equipped   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  ConcurrentHashMap < Integer ,  Item >  getEquipped ( )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  ConcurrentHashMap < Enum . EquipSlotType ,  Item >  getEquipped ( )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        synchronized  ( this . equipped )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  new  ConcurrentHashMap < > ( this . equipped ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1902,9 +1897,9 @@ public class CharacterItemManager {
				@@ -1902,9 +1897,9 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                if  ( ret . size ( )  ! =  this . equipped . size ( ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    //missed adding some items, figure out what.
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    for  ( int   slot  :  this . equipped . keySet ( ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        if  ( ! ( this . equipOrder . contains ( slot ) ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            this . equipOrder . add ( slot ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    for  ( Enum . EquipSlotType   slot  :  this . equipped . keySet ( ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        if  ( ! ( this . equipOrder . contains ( slot . ordinal ( ) ) ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            this . equipOrder . add ( slot . ordinal ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            ret . add ( this . equipped . get ( slot ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    }   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1913,7 +1908,7 @@ public class CharacterItemManager {
				@@ -1913,7 +1908,7 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  ret ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  Item  getEquipped ( int   slot )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  Item  getEquipped ( Enum . EquipSlotType   slot )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        synchronized  ( this . equipped )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  this . equipped . get ( slot ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2282,7 +2277,7 @@ public class CharacterItemManager {
				@@ -2282,7 +2277,7 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // remove it from other lists:
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . remItemFromLists ( item ,  ( byte )  slot ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . remItemFromLists ( item ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // add to Inventory
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . inventory . add ( item ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2444,10 +2439,13 @@ public class CharacterItemManager {
				@@ -2444,10 +2439,13 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //verify the item is equipped by this player
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        int  slot  =  item . getEquipSlot ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Enum . EquipSlotType  slot  =  item . equipSlot ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( ! this . equipped . containsKey ( slot ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Item  verify  =  this . equipped . get ( slot ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( verify  = =  null  | |  item . getObjectUUID ( )  ! =  verify . getObjectUUID ( ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2481,7 +2479,7 @@ public class CharacterItemManager {
				@@ -2481,7 +2479,7 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //send damage item msg to client
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        PlayerCharacter  pc  =  ( PlayerCharacter )  this . absCharacter ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        ItemHealthUpdateMsg  itemHealthUpdateMsg  =  new  ItemHealthUpdateMsg ( slot ,  ( float )  dur ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        ItemHealthUpdateMsg  itemHealthUpdateMsg  =  new  ItemHealthUpdateMsg ( slot . ordinal ( ) ,  ( float )  dur ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Dispatch  dispatch  =  Dispatch . borrow ( pc ,  itemHealthUpdateMsg ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        DispatchMessage . dispatchMsgDispatch ( dispatch ,  Enum . DispatchChannel . SECONDARY ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -2490,26 +2488,18 @@ public class CharacterItemManager {
				@@ -2490,26 +2488,18 @@ public class CharacterItemManager {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    //Damage a random piece of armor a specified amount
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  void  damageRandomArmor ( int  amount )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        ArrayList < Item >  armor  =  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( this . equipped . containsKey ( MBServerStatics . SLOT_OFFHAND ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            Item  item  =  this . equipped . get ( MBServerStatics . SLOT_OFFHAND ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( this . equipped . containsKey ( Enum . EquipSlotType . LHELD ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            Item  item  =  this . equipped . get ( Enum . EquipSlotType . LHELD ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            ItemBase  ib  =  item . getItemBase ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( ib . isShield ( ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                armor . add ( item ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( this . equipped . containsKey ( MBServerStatics . SLOT_HELMET ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            armor . add ( this . equipped . get ( MBServerStatics . SLOT_HELMET ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( this . equipped . containsKey ( MBServerStatics . SLOT_CHEST ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            armor . add ( this . equipped . get ( MBServerStatics . SLOT_CHEST ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( this . equipped . containsKey ( MBServerStatics . SLOT_ARMS ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            armor . add ( this . equipped . get ( MBServerStatics . SLOT_ARMS ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( this . equipped . containsKey ( MBServerStatics . SLOT_GLOVES ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            armor . add ( this . equipped . get ( MBServerStatics . SLOT_GLOVES ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( this . equipped . containsKey ( MBServerStatics . SLOT_GLOVES ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            armor . add ( this . equipped . get ( MBServerStatics . SLOT_GLOVES ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( this . equipped . containsKey ( MBServerStatics . SLOT_LEGGINGS ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            armor . add ( this . equipped . get ( MBServerStatics . SLOT_LEGGINGS ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( this . equipped . containsKey ( MBServerStatics . SLOT_FEET ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            armor . add ( this . equipped . get ( MBServerStatics . SLOT_FEET ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        for  ( Item  equipment  :  this . equipped . values ( ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( equipment . template . item_type . equals ( ItemType . ARMOR ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                armor . add ( equipment ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( armor . isEmpty ( ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return ;  //nothing to damage