@ -128,42 +128,44 @@ 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 ) {
Item resource = Item . getFromCache ( msg . getItemID ( ) ) ;
if ( resource = = null ) {
Building warehouseBuilding = npc . getBuilding ( ) ;
if ( warehouseBuilding = = null ) {
return ;
return ;
}
}
int depositAmount = msg . getAmount ( ) ;
player . getTimestamps ( ) . put ( "lastDepositWarehouse" , System . currentTimeMillis ( ) ) ;
CharacterItemManager itemMan = player . getCharItemManager ( ) ;
player . depositingWarehouse = true ;
player . warehouseBuilding = warehouseBuilding ;
player . getCharItemManager ( ) . updateLock = true ;
Item resource = Item . getFromCache ( msg . getItemID ( ) ) ;
if ( ! itemMan . doesCharOwnThisItem ( resource . getObjectUUID ( ) ) ) {
if ( resource = = null ) {
return ;
return ;
}
}
Building warehouseBuilding = npc . getBuilding ( ) ;
int depositAmount = msg . getAmount ( ) ;
if ( warehouseBuilding = = null ) {
CharacterItemManager itemMan = player . getCharItemManager ( ) ;
return ;
}
Warehouse warehouse = warehouseByBuildingUUID . get ( warehouseBuilding . getObjectUUID ( ) ) ;
if ( ! itemMan . doesCharOwnThisItem ( resource . getObjectUUID ( ) ) ) {
if ( warehouse = = null ) {
return ;
return ;
}
}
if ( ! warehouse . deposit ( player , resource , depositAmount , true , true ) ) {
Warehouse warehouse = warehouseByBuildingUUID . get ( warehouseBuilding . getObjectUUID ( ) ) ;
// Optional: Uncomment these lines for debugging/logging purposes.
if ( warehouse = = null ) {
// ChatManager.chatGuildError(player, "Failed to deposit " + resource.getItemBase().getName() + ".");
return ;
// Logger.debug("OpenWindow", player.getName() + " Failed to deposit Item with ID " + resource.getObjectUUID() + " from Warehouse With ID = " + warehouseBuilding.getObjectUUID());
}
return ;
}
ViewResourcesMessage vrm = new ViewResourcesMessage ( player ) ;
if ( ! warehouse . deposit ( player , resource , depositAmount , true , true ) ) {
vrm . setGuild ( player . getGuild ( ) ) ;
return ;
vrm . setWarehouseBuilding ( warehouseBuilding ) ;
}
vrm . configure ( ) ;
Dispatch dispatch = Dispatch . borrow ( player , vrm ) ;
//ViewResourcesMessage vrm = new ViewResourcesMessage(player);
DispatchMessage . dispatchMsgDispatch ( dispatch , Enum . DispatchChannel . SECONDARY ) ;
//vrm.setGuild(player.getGuild());
//vrm.setWarehouseBuilding(warehouseBuilding);
//vrm.configure();
//Dispatch dispatch = Dispatch.borrow(player, vrm);
//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 ) {