forked from MagicBane/Server
Refactored isWallArcher().
This commit is contained in:
@@ -450,7 +450,7 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized boolean addHireling(Building building, PlayerCharacter contractOwner, Vector3fImmutable NpcLoc, Zone zone, Contract contractID, Item item) {
|
public static synchronized boolean addHireling(Building building, PlayerCharacter contractOwner, Vector3fImmutable NpcLoc, Zone zone, Contract contract, Item item) {
|
||||||
|
|
||||||
int rank = 1;
|
int rank = 1;
|
||||||
|
|
||||||
@@ -460,7 +460,7 @@ public enum BuildingManager {
|
|||||||
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
String pirateName = NPC.getPirateName(contractID.getMobbaseID());
|
String pirateName = NPC.getPirateName(contract.getMobbaseID());
|
||||||
|
|
||||||
if (item.getChargesRemaining() > 0)
|
if (item.getChargesRemaining() > 0)
|
||||||
rank = item.getChargesRemaining() * 10;
|
rank = item.getChargesRemaining() * 10;
|
||||||
@@ -469,9 +469,9 @@ public enum BuildingManager {
|
|||||||
Mob mob;
|
Mob mob;
|
||||||
NPC npc;
|
NPC npc;
|
||||||
|
|
||||||
if (NPC.ISWallArcher(contractID.getContractID())) {
|
if (NPC.ISWallArcher(contract)) {
|
||||||
|
|
||||||
mob = Mob.createMob( contractID.getMobbaseID(), NpcLoc, contractOwner.getGuild(), true, zone, building, contractID.getContractID(), pirateName, rank * 10);
|
mob = Mob.createMob( contract.getMobbaseID(), NpcLoc, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank * 10);
|
||||||
|
|
||||||
if (mob == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
@@ -482,9 +482,9 @@ public enum BuildingManager {
|
|||||||
MovementManager.translocate(mob,mob.getBindLoc(),mob.getRegion());
|
MovementManager.translocate(mob,mob.getBindLoc(),mob.getRegion());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (NPC.ISGuardCaptain(contractID.getContractID())) {
|
if (NPC.ISGuardCaptain(contract.getContractID())) {
|
||||||
|
|
||||||
mob = Mob.createMob( contractID.getMobbaseID(), NpcLoc, contractOwner.getGuild(), true, zone, building, contractID.getContractID(), pirateName, rank);
|
mob = Mob.createMob( contract.getMobbaseID(), NpcLoc, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||||
|
|
||||||
if (mob == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
@@ -494,7 +494,7 @@ public enum BuildingManager {
|
|||||||
mob.setParentZone(zone);
|
mob.setParentZone(zone);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
npc = NPC.createNPC( pirateName, contractID.getObjectUUID(), NpcLoc, contractOwner.getGuild(), false, zone, (short) rank, false, building);
|
npc = NPC.createNPC( pirateName, contract.getObjectUUID(), NpcLoc, contractOwner.getGuild(), false, zone, (short) rank, false, building);
|
||||||
|
|
||||||
if (npc == null)
|
if (npc == null)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1903,7 +1903,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
if (this.BehaviourType == null)
|
if (this.BehaviourType == null)
|
||||||
this.BehaviourType = this.getMobBase().fsm;
|
this.BehaviourType = this.getMobBase().fsm;
|
||||||
|
|
||||||
if (this.isPlayerGuard() && this.contract != null) if (NPC.ISWallArcher(this.getContract().getContractID()))
|
if (this.isPlayerGuard() && this.contract != null) if (NPC.ISWallArcher(this.getContract()))
|
||||||
this.BehaviourType = MobBehaviourType.GuardWallArcher;
|
this.BehaviourType = MobBehaviourType.GuardWallArcher;
|
||||||
else this.BehaviourType = MobBehaviourType.GuardCaptain;
|
else this.BehaviourType = MobBehaviourType.GuardCaptain;
|
||||||
|
|
||||||
|
|||||||
@@ -289,23 +289,15 @@ public class NPC extends AbstractCharacter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean ISWallArcher(int contractID) {
|
public static boolean ISWallArcher(Contract contract) {
|
||||||
//838, 950, 1051, 1181, 1251, 1351, 1451, 1501, 1526, 1551, 980101,
|
|
||||||
switch(contractID) {
|
if (contract == null)
|
||||||
case 838:
|
|
||||||
case 950:
|
|
||||||
case 1051:
|
|
||||||
case 1181:
|
|
||||||
case 1251:
|
|
||||||
case 1351:
|
|
||||||
case 1451:
|
|
||||||
case 150:
|
|
||||||
case 1526:
|
|
||||||
case 1551:
|
|
||||||
case 980101:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
//838, 950, 1051, 1181, 1251, 1351, 1451, 1501, 1526, 1551, 980101,
|
||||||
|
|
||||||
|
return contract.getAllowedBuildings().contains(BuildingGroup.WALLCORNER) ||
|
||||||
|
contract.getAllowedBuildings().contains(BuildingGroup.WALLSTRAIGHTTOWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
//This method restarts an upgrade timer when a building is loaded from the database.
|
//This method restarts an upgrade timer when a building is loaded from the database.
|
||||||
|
|||||||
Reference in New Issue
Block a user