Browse Source

Bugfix in slotting blueprint buildings

master
MagicBot 2 years ago
parent
commit
7ef338be1d
  1. 14
      src/engine/gameManager/BuildingManager.java
  2. 1
      src/engine/objects/Mob.java
  3. 12
      src/engine/objects/NPC.java

14
src/engine/gameManager/BuildingManager.java

@ -450,7 +450,7 @@ public enum BuildingManager { @@ -450,7 +450,7 @@ public enum BuildingManager {
}
public static synchronized boolean addHireling(Building building, PlayerCharacter contractOwner, Vector3fImmutable NpcLoc, Zone zone, Contract NpcID, Item item) {
public static synchronized boolean addHireling(Building building, PlayerCharacter contractOwner, Vector3fImmutable NpcLoc, Zone zone, Contract contractID, Item item) {
int rank = 1;
@ -460,7 +460,7 @@ public enum BuildingManager { @@ -460,7 +460,7 @@ public enum BuildingManager {
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
return false;
String pirateName = NPC.getPirateName(NpcID.getMobbaseID());
String pirateName = NPC.getPirateName(contractID.getMobbaseID());
if (item.getChargesRemaining() > 0)
rank = item.getChargesRemaining() * 10;
@ -469,9 +469,9 @@ public enum BuildingManager { @@ -469,9 +469,9 @@ public enum BuildingManager {
Mob mob = null;
NPC npc = null;
if (NPC.ISGuardCaptain(NpcID.getContractID())) {
if (NPC.ISGuardCaptain(contractID.getContractID())) {
mob = Mob.createMob( NpcID.getMobbaseID(), NpcLoc, contractOwner.getGuild(), true, zone, building, NpcID.getContractID());
mob = Mob.createMob( contractID.getMobbaseID(), NpcLoc, contractOwner.getGuild(), true, zone, building, contractID.getContractID());
if (mob == null)
return false;
@ -480,13 +480,12 @@ public enum BuildingManager { @@ -480,13 +480,12 @@ public enum BuildingManager {
mob.setPlayerGuard(true);
mob.setParentZone(zone);
return true;
} else {
npc = NPC.createNPC( pirateName, NpcID.getObjectUUID(), NpcLoc, contractOwner.getGuild(), false, zone, (short) rank, false, building);
}
npc = NPC.createNPC( pirateName, contractID.getObjectUUID(), NpcLoc, contractOwner.getGuild(), false, zone, (short) rank, false, building);
if (npc == null)
return false;
npc.setBindLoc(NpcLoc.x - zone.getAbsX(), NpcLoc.y - zone.getAbsY(), NpcLoc.z - zone.getAbsZ());
npc.setBuilding(building);
@ -499,7 +498,6 @@ public enum BuildingManager { @@ -499,7 +498,6 @@ public enum BuildingManager {
return true;
}
}
public static boolean IsWallPiece(Building building) {

1
src/engine/objects/Mob.java

@ -940,7 +940,6 @@ public class Mob extends AbstractIntelligenceAgent { @@ -940,7 +940,6 @@ public class Mob extends AbstractIntelligenceAgent {
this.parentZone = zone;
}
if ( this.building != null) {
Vector3fImmutable localLoc = new Vector3fImmutable(this.statLat,this.statAlt,this.statLon);

12
src/engine/objects/NPC.java

@ -348,15 +348,13 @@ public class NPC extends AbstractCharacter { @@ -348,15 +348,13 @@ public class NPC extends AbstractCharacter {
this.setHealth(this.healthMax);
this.mana.set(this.manaMax);
this.stamina.set(this.staminaMax);
//this.firstName = this.minionMobBase.getFirstName();
//this.lastName = "";
//this.level = (short)(this.minionMobBase.getLevel());
}
//add this npc to building
if (this.building != null && this.loadID != 0) {
if (building.getBlueprint() != null){
if (this.building != null) {
if (building.getBlueprint() != null) {
int maxSlots;
maxSlots = building.getBlueprint().getSlotsForRank(this.building.getRank());
@ -368,8 +366,7 @@ public class NPC extends AbstractCharacter { @@ -368,8 +366,7 @@ public class NPC extends AbstractCharacter {
break;
}
}
//npc created by an admin without a blueprint, just default max slot size to 10.
}else{
} else {
int maxSlots = 10;
@ -1094,6 +1091,7 @@ public class NPC extends AbstractCharacter { @@ -1094,6 +1091,7 @@ public class NPC extends AbstractCharacter {
// *** Refactor : this has a useInit flag that can be removed
public static NPC createNPC(String name, int contractID, Vector3fImmutable spawn, Guild guild, boolean isMob, Zone parent, short level, boolean useInit, Building building) {
NPC npcWithoutID = new NPC(name, (short) 0, (short) 0, (short) 0, (short) 0,
(short) 0, (short) 1, 0, false, false, false, spawn, spawn, Vector3fImmutable.ZERO,
(short) 1, (short) 1, (short) 1, guild, (byte) 0, 0, isMob, building, contractID, parent);

Loading…
Cancel
Save