@ -7,7 +7,6 @@ import engine.Enum.ProfitType;
import engine.exception.MsgSendException ;
import engine.exception.MsgSendException ;
import engine.gameManager.BuildingManager ;
import engine.gameManager.BuildingManager ;
import engine.gameManager.DbManager ;
import engine.gameManager.DbManager ;
import engine.gameManager.NPCManager ;
import engine.gameManager.SessionManager ;
import engine.gameManager.SessionManager ;
import engine.math.FastMath ;
import engine.math.FastMath ;
import engine.math.Vector3fImmutable ;
import engine.math.Vector3fImmutable ;
@ -37,7 +36,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
super ( OrderNPCMsg . class ) ;
super ( OrderNPCMsg . class ) ;
}
}
public static void processRedeedHireling ( Mob hireling , Building building , ClientConnection origin ) {
public static void processRedeedHireling ( AbstractCharacter hireling , Building building , ClientConnection origin ) {
PlayerCharacter player ;
PlayerCharacter player ;
Contract contract ;
Contract contract ;
@ -48,7 +47,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
player = SessionManager . getPlayerCharacter ( origin ) ;
player = SessionManager . getPlayerCharacter ( origin ) ;
itemMan = player . getCharItemManager ( ) ;
itemMan = player . getCharItemManager ( ) ;
contract = hireling . getContract ( ) ;
contract = hireling . contract ;
if ( ! player . getCharItemManager ( ) . hasRoomInventory ( ( short ) 1 ) ) {
if ( ! player . getCharItemManager ( ) . hasRoomInventory ( ( short ) 1 ) ) {
ErrorPopupMsg . sendErrorPopup ( player , 21 ) ;
ErrorPopupMsg . sendErrorPopup ( player , 21 ) ;
@ -277,28 +276,6 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
}
}
}
}
private static synchronized void processRedeedNPC ( AbstractCharacter abstractCharacter , Building building , ClientConnection origin ) {
// Member variable declaration
switch ( abstractCharacter . getObjectType ( ) ) {
case NPC :
NPC npc = ( NPC ) abstractCharacter ;
Building cityBuilding = npc . getBuilding ( ) ;
if ( cityBuilding = = null )
return ;
BuildingManager . processRedeedNPC ( npc , npc . building , origin ) ;
break ;
case Mob :
Mob mob = ( Mob ) abstractCharacter ;
processRedeedHireling ( mob , mob . building , origin ) ;
break ;
}
}
private static boolean AddPatrolPoints ( int buildingID , ArrayList < Vector3fImmutable > patrolPoints ) {
private static boolean AddPatrolPoints ( int buildingID , ArrayList < Vector3fImmutable > patrolPoints ) {
Building building = BuildingManager . getBuildingFromCache ( buildingID ) ;
Building building = BuildingManager . getBuildingFromCache ( buildingID ) ;
@ -489,7 +466,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
if ( BuildingManager . PlayerCanControlNotOwner ( building , player ) = = false )
if ( BuildingManager . PlayerCanControlNotOwner ( building , player ) = = false )
return true ;
return true ;
processRedeedNPC ( npc , building , origin ) ;
processRedeedHireling ( npc , building , origin ) ;
return true ;
return true ;
//MB TODO HANDLE all profits.
//MB TODO HANDLE all profits.
case 7 :
case 7 :
@ -557,10 +534,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
if ( building . getHirelings ( ) . containsKey ( mob ) = = false )
if ( building . getHirelings ( ) . containsKey ( mob ) = = false )
return true ;
return true ;
if ( NPCManager . removeMobileFromBuilding ( mob , building ) = = false ) {
BuildingManager . removeHireling ( building , mob ) ;
PlaceAssetMsg . sendPlaceAssetError ( player . getClientConnection ( ) , 1 , "A Serious error has occurred. Please post details for to ensure transaction integrity" ) ;
return true ;
}
ManageCityAssetsMsg manageCityAssetsMsg = new ManageCityAssetsMsg ( ) ;
ManageCityAssetsMsg manageCityAssetsMsg = new ManageCityAssetsMsg ( ) ;
manageCityAssetsMsg . actionType = SVR_CLOSE_WINDOW ;
manageCityAssetsMsg . actionType = SVR_CLOSE_WINDOW ;
@ -595,7 +569,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
if ( BuildingManager . PlayerCanControlNotOwner ( building , player ) = = false )
if ( BuildingManager . PlayerCanControlNotOwner ( building , player ) = = false )
return true ;
return true ;
processRedeedNPC ( mob , building , origin ) ;
processRedeedHireling ( mob , building , origin ) ;
return true ;
return true ;
//MB TODO HANDLE all profits.
//MB TODO HANDLE all profits.
case 7 :
case 7 :