@ -116,7 +116,7 @@ public class ItemFactory {
				@@ -116,7 +116,7 @@ public class ItemFactory {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        city . transactionLock . writeLock ( ) . lock ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        try  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            Warehouse  cityWarehouse  =  city . getWarehouse ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            Warehouse  cityWarehouse  =  city . warehouse ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( cityWarehouse  ! =  null  & &  forge . assetIsProtected ( ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                useWarehouse  =  true ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -163,7 +163,7 @@ public class ItemFactory {
				@@ -163,7 +163,7 @@ public class ItemFactory {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                if  ( overdraft  >  0 )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    if  ( ! Warehouse . withdraw ( cityWarehouse ,  npc ,  Enum . ResourceType . GOLD ,  overdraft ,  true ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        Logger . error ( "Warehouse With UID of  "  +  cityWarehouse . UID   +  " Failed to Create Item."  +  template . item_base_name ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        Logger . error ( "Warehouse for city  "  +  cityWarehouse . city . getName ( )   +  " Failed to Create Item."  +  template . item_base_name ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -431,8 +431,7 @@ public class ItemFactory {
				@@ -431,8 +431,7 @@ public class ItemFactory {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( overdraft  >  0  & &  useWarehouse )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                if  ( ! Warehouse . withdraw ( cityWarehouse ,  npc ,  Enum . ResourceType . GOLD ,  overdraft ,  true ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    //ChatManager.chatGuildError(pc, "Failed to create Item");
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    Logger . error ( "Warehouse With UID of "  +  cityWarehouse . UID  +  " Failed to Create Item."  +  template . item_base_name ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    Logger . error ( "Warehouse for city "  +  cityWarehouse . city . getName ( )  +  " Failed to Create Item."  +  template . item_base_name ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -460,7 +459,7 @@ public class ItemFactory {
				@@ -460,7 +459,7 @@ public class ItemFactory {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    if  ( ! Warehouse . withdraw ( cityWarehouse ,  npc ,  ibResources ,  amount ,  true ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        //ChatManager.chatGuildError(pc, "Failed to create Item");
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        Logger . error ( "Warehouse With UID of  "  +  cityWarehouse . UID   +  " Failed to Create Item."  +  template . item_base_name ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        Logger . error ( "Warehouse for city  "  +  cityWarehouse . city . getName ( )   +  " Failed to Create Item."  +  template . item_base_name ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                }   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -484,7 +483,7 @@ public class ItemFactory {
				@@ -484,7 +483,7 @@ public class ItemFactory {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    if  ( ! Warehouse . withdraw ( cityWarehouse ,  npc ,  ibResources ,  amount ,  true ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        //ChatManager.chatGuildError(pc, "Failed to create Item");
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        Logger . error ( "Warehouse With UID of  "  +  cityWarehouse . UID   +  " Failed to Create Item."  +  template . item_base_name ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        Logger . error ( "Warehouse for city  "  +  cityWarehouse . city . getName ( )   +  " Failed to Create Item."  +  template . item_base_name ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                }   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -538,7 +537,7 @@ public class ItemFactory {
				@@ -538,7 +537,7 @@ public class ItemFactory {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( overdraft  >  0 )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                if  ( ! Warehouse . withdraw ( cityWarehouse ,  npc ,  Enum . ResourceType . GOLD ,  overdraft ,  true ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    //ChatManager.chatGuildError(pc, "Failed to create Item");
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    Logger . error ( "Warehouse With UID of  "  +  cityWarehouse . UID   +  " Failed to Create Item."  +  template . item_base_name ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    Logger . error ( "Warehouse for city  "  +  cityWarehouse . city . getName ( )   +  " Failed to Create Item."  +  template . item_base_name ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -547,7 +546,7 @@ public class ItemFactory {
				@@ -547,7 +546,7 @@ public class ItemFactory {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( galvorAmount  >  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                if  ( ! Warehouse . withdraw ( cityWarehouse ,  npc ,  Enum . ResourceType . GALVOR ,  galvorAmount ,  true ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    ErrorPopupMsg . sendErrorMsg ( pc ,  "Failed to withdraw Galvor from warehouse!"  +  template . item_base_name ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    Logger . error ( "Warehouse with UID of "  +  cityWarehouse . getObjectUUID ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    Logger . error ( "Warehouse for city  "  +  cityWarehouse . city . getName ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -555,7 +554,7 @@ public class ItemFactory {
				@@ -555,7 +554,7 @@ public class ItemFactory {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( wormwoodAmount  >  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                if  ( ! Warehouse . withdraw ( cityWarehouse ,  npc ,  Enum . ResourceType . WORMWOOD ,  wormwoodAmount ,  true ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    ErrorPopupMsg . sendErrorMsg ( pc ,  "Failed to withdraw Wormwood from warehouse!"  +  template . item_base_name ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    Logger . error ( "Warehouse with UID of "  +  cityWarehouse . getObjectUUID ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    Logger . error ( "Warehouse for city  "  +  cityWarehouse . city . getName ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -790,7 +789,7 @@ public class ItemFactory {
				@@ -790,7 +789,7 @@ public class ItemFactory {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        try  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            Warehouse  cityWarehouse  =  city . getWarehouse ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            Warehouse  cityWarehouse  =  city . warehouse ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( cityWarehouse  ! =  null  & &  forge . assetIsProtected ( ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                useWarehouse  =  true ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -916,12 +915,12 @@ public class ItemFactory {
				@@ -916,12 +915,12 @@ public class ItemFactory {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                if  ( overdraft  >  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    if  ( pc  ! =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        if  ( ! Warehouse . withdraw ( cityWarehouse ,  pc ,  Enum . ResourceType . GOLD ,  overdraft ,  false ,  true ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            Logger . error ( "Warehouse with UID of "  +  cityWarehouse . getObjectUUID ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            Logger . error ( "Warehouse for city  "  +  cityWarehouse . city . getName ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    }  else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        if  ( ! Warehouse . withdraw ( cityWarehouse ,  npc ,  Enum . ResourceType . GOLD ,  overdraft ,  true ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            Logger . error ( "Warehouse with UID of "  +  cityWarehouse . getObjectUUID ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            Logger . error ( "Warehouse for city  "  +  cityWarehouse . city . getName ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    }   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -967,12 +966,12 @@ public class ItemFactory {
				@@ -967,12 +966,12 @@ public class ItemFactory {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    if  ( pc  ! =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        if  ( ! Warehouse . withdraw ( cityWarehouse ,  pc ,  Enum . ResourceType . GOLD ,  overdraft ,  false ,  true ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            Logger . error ( "Warehouse with UID of "  +  cityWarehouse . getObjectUUID ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            Logger . error ( "Warehouse for city  "  +  cityWarehouse . city . getName ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    }  else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        if  ( ! Warehouse . withdraw ( cityWarehouse ,  npc ,  Enum . ResourceType . GOLD ,  overdraft ,  true ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            Logger . error ( "Warehouse with UID of "  +  cityWarehouse . getObjectUUID ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            Logger . error ( "Warehouse for city  "  +  cityWarehouse . city . getName ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    }   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -983,7 +982,7 @@ public class ItemFactory {
				@@ -983,7 +982,7 @@ public class ItemFactory {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                //ChatManager.chatGuildInfo(pc, "Withdrawing " + galvorAmount + " galvor from warehouse");
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                if  ( ! Warehouse . withdraw ( cityWarehouse ,  npc ,  Enum . ResourceType . GALVOR ,  galvorAmount ,  true ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    ErrorPopupMsg . sendErrorMsg ( pc ,  "Failed to withdraw Galvor from warehouse!"  +  template . item_base_name ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    Logger . error ( "Warehouse with UID of "  +  cityWarehouse . getObjectUUID ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    Logger . error ( "Warehouse for city  "  +  cityWarehouse . city . getName ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -992,7 +991,7 @@ public class ItemFactory {
				@@ -992,7 +991,7 @@ public class ItemFactory {
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                //ChatManager.chatGuildInfo(pc, "Withdrawing " + wormwoodAmount + " wormwood from warehouse");
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                if  ( ! Warehouse . withdraw ( cityWarehouse ,  npc ,  Enum . ResourceType . WORMWOOD ,  wormwoodAmount ,  true ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    ErrorPopupMsg . sendErrorMsg ( pc ,  "Failed to withdraw Wormwood from warehouse for "  +  template . item_base_name ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    Logger . error ( "Warehouse with UID of "  +  cityWarehouse . getObjectUUID ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    Logger . error ( "Warehouse for city  "  +  cityWarehouse . city . getName ( )  +  "Failed to Withdrawl " ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    return  null ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                }