Browse Source

Contact npcs/mobs have derived locations. 0x0 in cache data.

master
MagicBot 2 years ago
parent
commit
cfb4f38d15
  1. 14
      src/engine/gameManager/BuildingManager.java
  2. 7
      src/engine/net/client/handlers/ActivateNPCMsgHandler.java

14
src/engine/gameManager/BuildingManager.java

@ -479,7 +479,7 @@ public enum BuildingManager {
} }
public static synchronized boolean addHireling(Building building, PlayerCharacter contractOwner, Vector3fImmutable NpcLoc, Zone zone, Contract contract, Item item) { public static synchronized boolean addHireling(Building building, PlayerCharacter contractOwner, Zone zone, Contract contract, Item item) {
int rank = 1; int rank = 1;
@ -500,7 +500,7 @@ public enum BuildingManager {
if (NPC.ISWallArcher(contract)) { if (NPC.ISWallArcher(contract)) {
mob = Mob.createMob( contract.getMobbaseID(), NpcLoc, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank * 10); mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank * 10);
if (mob == null) if (mob == null)
return false; return false;
@ -511,9 +511,10 @@ public enum BuildingManager {
MovementManager.translocate(mob, mob.getBindLoc(), mob.region); MovementManager.translocate(mob, mob.getBindLoc(), mob.region);
return true; return true;
} }
if (NPC.ISGuardCaptain(contract.getContractID())) { if (NPC.ISGuardCaptain(contract.getContractID())) {
mob = Mob.createMob(contract.getMobbaseID(), NpcLoc, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank); mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
if (mob == null) if (mob == null)
return false; return false;
@ -523,12 +524,7 @@ public enum BuildingManager {
return true; return true;
} }
// NPC in a Building derives position from slot npc = NPC.createNPC(pirateName, contract.getObjectUUID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), false, zone, (short) rank, false, building);
if (building != null)
NpcLoc = Vector3fImmutable.ZERO;
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;

7
src/engine/net/client/handlers/ActivateNPCMsgHandler.java

@ -4,7 +4,6 @@ import engine.Enum;
import engine.Enum.ItemType; import engine.Enum.ItemType;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.*; import engine.gameManager.*;
import engine.math.Vector3fImmutable;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
@ -79,8 +78,6 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size()) if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
return false; return false;
Vector3fImmutable NpcLoc = new Vector3fImmutable(building.getLoc());
Item contractItem = Item.getFromCache(msg.getContractItem()); Item contractItem = Item.getFromCache(msg.getContractItem());
if (contractItem == null) if (contractItem == null)
@ -93,7 +90,7 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
itemMan = player.getCharItemManager(); itemMan = player.getCharItemManager();
zone = ZoneManager.findSmallestZone(NpcLoc); zone = ZoneManager.findSmallestZone(building.getLoc());
if (zone == null) if (zone == null)
return false; return false;
@ -108,7 +105,7 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
if (contract.canSlotinBuilding(building) == false) if (contract.canSlotinBuilding(building) == false)
return false; return false;
if (!BuildingManager.addHireling(building, player, NpcLoc, zone, contract, contractItem)) if (!BuildingManager.addHireling(building, player, zone, contract, contractItem))
return false; return false;
itemMan.delete(contractItem); itemMan.delete(contractItem);

Loading…
Cancel
Save