forked from MagicBane/Server
Tower captains don't use slot 1.
This commit is contained in:
+26
-19
@@ -353,19 +353,18 @@ public class NPC extends AbstractCharacter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add this npc to building hireling list if not there yet.
|
// Add this npc to building hireling list if not there yet.
|
||||||
// For some reason the mob is initialized twice when
|
// For some reason the npc is created and initialized twice when
|
||||||
// createMobWithNoID() is called.
|
// createMobWithNoID() is called.
|
||||||
|
|
||||||
if (this.building != null &&
|
if (this.building != null &&
|
||||||
this.loadID == 0) {
|
this.loadID == 0) {
|
||||||
|
|
||||||
int maxSlots = 10;
|
// Artillery Tower Captains use a hardcoded slot not first available
|
||||||
|
|
||||||
for (int slot = 1; slot < maxSlots + 1; slot++)
|
if (this.contract != null && this.contract.getContractID() == 650)
|
||||||
if (!this.building.getHirelings().containsValue(slot)) {
|
this.building.getHirelings().put(this, 2);
|
||||||
this.building.getHirelings().put(this, slot);
|
else
|
||||||
break;
|
slotMobInBuilding();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO set these correctly later
|
//TODO set these correctly later
|
||||||
@@ -383,6 +382,16 @@ public class NPC extends AbstractCharacter {
|
|||||||
this.charItemManager.load();
|
this.charItemManager.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void slotMobInBuilding() {
|
||||||
|
int maxSlots = 10;
|
||||||
|
|
||||||
|
for (int slot = 1; slot < maxSlots + 1; slot++)
|
||||||
|
if (!this.building.getHirelings().containsValue(slot)) {
|
||||||
|
this.building.getHirelings().put(this, slot);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static NPC getFromCache(int id) {
|
public static NPC getFromCache(int id) {
|
||||||
return (NPC) DbManager.getFromCache(GameObjectType.NPC, id);
|
return (NPC) DbManager.getFromCache(GameObjectType.NPC, id);
|
||||||
}
|
}
|
||||||
@@ -891,13 +900,15 @@ public class NPC extends AbstractCharacter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setParentZone(Zone zone) {
|
public void setParentZone(Zone zone) {
|
||||||
if (ConfigManager.serverType.equals(ServerType.LOGINSERVER)) {
|
|
||||||
|
if (ConfigManager.serverType.equals(ServerType.LOGINSERVER))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (this.contract == null)
|
if (this.contract == null)
|
||||||
return;
|
return;
|
||||||
//update ZoneManager's zone building list
|
|
||||||
|
//update ZoneManager's zone mpc set
|
||||||
|
|
||||||
if (zone != null) {
|
if (zone != null) {
|
||||||
if (this.parentZone != null) {
|
if (this.parentZone != null) {
|
||||||
if (zone.getObjectUUID() != this.parentZone.getObjectUUID()) {
|
if (zone.getObjectUUID() != this.parentZone.getObjectUUID()) {
|
||||||
@@ -925,8 +936,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
Vector3fImmutable slotLocation = Vector3fImmutable.ZERO;
|
Vector3fImmutable slotLocation = Vector3fImmutable.ZERO;
|
||||||
|
|
||||||
if (buildingModel != null){
|
if (buildingModel != null){
|
||||||
|
|
||||||
|
|
||||||
int putSlot;
|
int putSlot;
|
||||||
BuildingLocation buildingLocation = null;
|
BuildingLocation buildingLocation = null;
|
||||||
|
|
||||||
@@ -935,8 +945,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
putSlot = this.slot;
|
putSlot = this.slot;
|
||||||
else
|
else
|
||||||
putSlot = NPC.getBuildingSlot(this);
|
putSlot = NPC.getBuildingSlot(this);
|
||||||
|
|
||||||
|
|
||||||
buildingLocation = buildingModel.getSlotLocation(putSlot);
|
buildingLocation = buildingModel.getSlotLocation(putSlot);
|
||||||
|
|
||||||
if (buildingLocation != null){
|
if (buildingLocation != null){
|
||||||
@@ -951,8 +960,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Vector3fImmutable buildingWorldLoc = ZoneManager.convertLocalToWorld(this.building, slotLocation);
|
Vector3fImmutable buildingWorldLoc = ZoneManager.convertLocalToWorld(this.building, slotLocation);
|
||||||
|
|
||||||
//Set floor and level here after building World Location.
|
//Set floor and level here after building World Location.
|
||||||
@@ -961,8 +969,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
|
|
||||||
|
|
||||||
if (this.region != null){
|
if (this.region != null){
|
||||||
|
|
||||||
|
|
||||||
this.buildingFloor = region.getRoom();
|
this.buildingFloor = region.getRoom();
|
||||||
this.buildingLevel = region.getLevel();
|
this.buildingLevel = region.getLevel();
|
||||||
this.inBuildingLoc = ZoneManager.convertWorldToLocal(building, this.getLoc());
|
this.inBuildingLoc = ZoneManager.convertWorldToLocal(building, this.getLoc());
|
||||||
|
|||||||
Reference in New Issue
Block a user