@ -128,6 +128,16 @@ public class Warehouse extends AbstractWorldObject {
}
}
public static void warehouseDeposit ( MerchantMsg msg , PlayerCharacter player , NPC npc , ClientConnection origin ) {
public static void warehouseDeposit ( MerchantMsg msg , PlayerCharacter player , NPC npc , ClientConnection origin ) {
Building warehouseBuilding = npc . getBuilding ( ) ;
if ( warehouseBuilding = = null ) {
return ;
}
player . getTimestamps ( ) . put ( "lastDepositWarehouse" , System . currentTimeMillis ( ) ) ;
player . depositingWarehouse = true ;
player . warehouseBuilding = warehouseBuilding ;
player . getCharItemManager ( ) . updateLock = true ;
Item resource = Item . getFromCache ( msg . getItemID ( ) ) ;
Item resource = Item . getFromCache ( msg . getItemID ( ) ) ;
if ( resource = = null ) {
if ( resource = = null ) {
@ -141,29 +151,21 @@ public class Warehouse extends AbstractWorldObject {
return ;
return ;
}
}
Building warehouseBuilding = npc . getBuilding ( ) ;
if ( warehouseBuilding = = null ) {
return ;
}
Warehouse warehouse = warehouseByBuildingUUID . get ( warehouseBuilding . getObjectUUID ( ) ) ;
Warehouse warehouse = warehouseByBuildingUUID . get ( warehouseBuilding . getObjectUUID ( ) ) ;
if ( warehouse = = null ) {
if ( warehouse = = null ) {
return ;
return ;
}
}
if ( ! warehouse . deposit ( player , resource , depositAmount , true , true ) ) {
if ( ! warehouse . deposit ( player , resource , depositAmount , true , true ) ) {
// Optional: Uncomment these lines for debugging/logging purposes.
// ChatManager.chatGuildError(player, "Failed to deposit " + resource.getItemBase().getName() + ".");
// Logger.debug("OpenWindow", player.getName() + " Failed to deposit Item with ID " + resource.getObjectUUID() + " from Warehouse With ID = " + warehouseBuilding.getObjectUUID());
return ;
return ;
}
}
ViewResourcesMessage vrm = new ViewResourcesMessage ( player ) ;
//ViewResourcesMessage vrm = new ViewResourcesMessage(player);
vrm . setGuild ( player . getGuild ( ) ) ;
//vrm.setGuild(player.getGuild());
vrm . setWarehouseBuilding ( warehouseBuilding ) ;
//vrm.setWarehouseBuilding(warehouseBuilding);
vrm . configure ( ) ;
//vrm.configure();
Dispatch dispatch = Dispatch . borrow ( player , vrm ) ;
//Dispatch dispatch = Dispatch.borrow(player, vrm);
DispatchMessage . dispatchMsgDispatch ( dispatch , Enum . DispatchChannel . SECONDARY ) ;
//DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
}
}
public static void warehouseWithdraw ( MerchantMsg msg , PlayerCharacter player , NPC npc , ClientConnection origin ) {
public static void warehouseWithdraw ( MerchantMsg msg , PlayerCharacter player , NPC npc , ClientConnection origin ) {