Browse Source

Bugfix in slotting blueprint buildings

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

32
src/engine/gameManager/BuildingManager.java

@ -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; 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(NpcID.getMobbaseID()); String pirateName = NPC.getPirateName(contractID.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 = null; Mob mob = null;
NPC npc = 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) if (mob == null)
return false; return false;
@ -480,25 +480,23 @@ public enum BuildingManager {
mob.setPlayerGuard(true); mob.setPlayerGuard(true);
mob.setParentZone(zone); mob.setParentZone(zone);
return true; 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;
if (npc == null)
return false;
npc.setBindLoc(NpcLoc.x - zone.getAbsX(), NpcLoc.y - zone.getAbsY(), NpcLoc.z - zone.getAbsZ()); npc.setBindLoc(NpcLoc.x - zone.getAbsX(), NpcLoc.y - zone.getAbsY(), NpcLoc.z - zone.getAbsZ());
npc.setBuilding(building); npc.setBuilding(building);
npc.setParentZone(zone); npc.setParentZone(zone);
if (NPC.GetNPCProfits(npc) == null) if (NPC.GetNPCProfits(npc) == null)
NPCProfits.CreateProfits(npc); NPCProfits.CreateProfits(npc);
WorldGrid.addObject(npc, contractOwner); WorldGrid.addObject(npc, contractOwner);
return true; return true;
}
} }
public static boolean IsWallPiece(Building building) { public static boolean IsWallPiece(Building building) {

1
src/engine/objects/Mob.java

@ -940,7 +940,6 @@ public class Mob extends AbstractIntelligenceAgent {
this.parentZone = zone; this.parentZone = zone;
} }
if ( this.building != null) { if ( this.building != null) {
Vector3fImmutable localLoc = new Vector3fImmutable(this.statLat,this.statAlt,this.statLon); 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 {
this.setHealth(this.healthMax); this.setHealth(this.healthMax);
this.mana.set(this.manaMax); this.mana.set(this.manaMax);
this.stamina.set(this.staminaMax); this.stamina.set(this.staminaMax);
//this.firstName = this.minionMobBase.getFirstName();
//this.lastName = "";
//this.level = (short)(this.minionMobBase.getLevel());
} }
//add this npc to building //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; int maxSlots;
maxSlots = building.getBlueprint().getSlotsForRank(this.building.getRank()); maxSlots = building.getBlueprint().getSlotsForRank(this.building.getRank());
@ -368,8 +366,7 @@ public class NPC extends AbstractCharacter {
break; break;
} }
} }
//npc created by an admin without a blueprint, just default max slot size to 10. } else {
}else{
int maxSlots = 10; int maxSlots = 10;
@ -1094,6 +1091,7 @@ public class NPC extends AbstractCharacter {
// *** Refactor : this has a useInit flag that can be removed // *** 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) { 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, 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) 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); (short) 1, (short) 1, (short) 1, guild, (byte) 0, 0, isMob, building, contractID, parent);

Loading…
Cancel
Save