forked from MagicBane/Server
Update; mobile offsets within buildings.
This commit is contained in:
+34
-20
@@ -804,7 +804,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
int slot;
|
int slot;
|
||||||
Vector3fImmutable slotLocation;
|
Vector3fImmutable slotLocation;
|
||||||
|
|
||||||
if (ConfigManager.serverType.equals(ServerType.LOGINSERVER)) return;
|
if (ConfigManager.serverType.equals(ServerType.LOGINSERVER))
|
||||||
|
return;
|
||||||
|
|
||||||
// Configure parent zone adding this NPC to the
|
// Configure parent zone adding this NPC to the
|
||||||
// zone collection
|
// zone collection
|
||||||
@@ -822,27 +823,39 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
|
|
||||||
// Handle Mobiles within buildings
|
// Handle Mobiles within buildings
|
||||||
|
|
||||||
if (this.building != null && this.contract != null) {
|
if (this.building != null) {
|
||||||
|
|
||||||
// Get next available slot for this Mobile and then
|
// Mobiles inside buildings are offset from it not the zone
|
||||||
// add it to the building's hireling list
|
|
||||||
|
|
||||||
slot = BuildingManager.getAvailableSlot(building);
|
this.bindLoc = new Vector3fImmutable(this.statLat, this.statAlt, this.statLon);
|
||||||
|
this.bindLoc = this.building.getLoc().add(this.bindLoc);
|
||||||
|
this.loc = new Vector3fImmutable(bindLoc);
|
||||||
|
this.endLoc = new Vector3fImmutable(bindLoc);
|
||||||
|
|
||||||
if (slot == -1) Logger.error("No available slot for Mobile: " + this.getObjectUUID());
|
if (this.contract != null) {
|
||||||
|
|
||||||
building.getHirelings().put(this, slot);
|
// Get next available slot for this Mobile and then
|
||||||
|
// add it to the building's hireling list
|
||||||
|
|
||||||
// Override bind and location for this npc derived
|
slot = BuildingManager.getAvailableSlot(building);
|
||||||
// from BuildingManager slot location data.
|
|
||||||
|
|
||||||
slotLocation = BuildingManager.getSlotLocation(building, slot);
|
if (slot == -1)
|
||||||
|
Logger.error("No available slot for Mobile: " + this.getObjectUUID());
|
||||||
|
|
||||||
this.bindLoc = building.getLoc().add(slotLocation);
|
building.getHirelings().put(this, slot);
|
||||||
this.loc = building.getLoc().add(slotLocation);
|
|
||||||
this.endLoc = bindLoc;
|
|
||||||
|
|
||||||
// Configure region and floor/level for this Mobile
|
// Override bind and location for this Mobile derived
|
||||||
|
// from BuildingManager slot location data.
|
||||||
|
|
||||||
|
slotLocation = BuildingManager.getSlotLocation(building, slot);
|
||||||
|
|
||||||
|
this.bindLoc = building.getLoc().add(slotLocation);
|
||||||
|
this.loc = building.getLoc().add(slotLocation);
|
||||||
|
this.endLoc = bindLoc;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configure building region and floor/level for this Mobile
|
||||||
|
|
||||||
this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z);
|
this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z);
|
||||||
}
|
}
|
||||||
@@ -856,15 +869,16 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
this.mana.set(this.manaMax);
|
this.mana.set(this.manaMax);
|
||||||
this.stamina.set(this.staminaMax);
|
this.stamina.set(this.staminaMax);
|
||||||
|
|
||||||
if (!this.nameOverride.isEmpty()) this.firstName = this.nameOverride;
|
if (!this.nameOverride.isEmpty())
|
||||||
else this.firstName = this.mobBase.getFirstName();
|
this.firstName = this.nameOverride;
|
||||||
|
else
|
||||||
|
this.firstName = this.mobBase.getFirstName();
|
||||||
|
|
||||||
if (isPet) {
|
if (isPet)
|
||||||
this.setObjectTypeMask(MBServerStatics.MASK_PET | this.getTypeMasks());
|
this.setObjectTypeMask(MBServerStatics.MASK_PET | this.getTypeMasks());
|
||||||
if (ConfigManager.serverType.equals(ServerType.LOGINSERVER)) this.setLoc(this.getLoc());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.contract == null) this.level = (short) this.mobBase.getLevel();
|
if (this.contract == null)
|
||||||
|
this.level = (short) this.mobBase.getLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
//set bonuses
|
//set bonuses
|
||||||
|
|||||||
Reference in New Issue
Block a user