Browse Source

NPC and mob regions

master
FatBoy-DOTC 2 years ago
parent
commit
1169f44041
  1. 16
      src/engine/net/client/msg/LoadCharacterMsg.java
  2. 2
      src/engine/objects/Mob.java
  3. 1
      src/engine/objects/NPC.java

16
src/engine/net/client/msg/LoadCharacterMsg.java

@ -102,6 +102,22 @@ public class LoadCharacterMsg extends ClientNetMsg { @@ -102,6 +102,22 @@ public class LoadCharacterMsg extends ClientNetMsg {
writer.putInt(region.getRoom());
}
}
else if (absChar.getObjectType().equals(GameObjectType.Mob)){
Regions Mobregion = absChar.getRegion();
if (region == null){
writer.putInt(-1);
writer.putInt(-1);
}else{
Building regionBuilding = Regions.GetBuildingForRegion(Mobregion);
if (regionBuilding == null){
writer.putInt(-1);
writer.putInt(-1);
}else{
writer.putInt(region.getLevel());
writer.putInt(region.getRoom());
}
}
//TODO below is Mob Region Serialization, not implemented. default to -1, which is ground.
}else {

2
src/engine/objects/Mob.java

@ -1152,11 +1152,13 @@ public class Mob extends AbstractIntelligenceAgent { @@ -1152,11 +1152,13 @@ public class Mob extends AbstractIntelligenceAgent {
if (newLoc.equals(this.getEndLoc())) {
this.stopMovement(newLoc);
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
return;
//Next upda
}
setLoc(newLoc);
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
//Next update will be end Loc, lets stop him here.
}

1
src/engine/objects/NPC.java

@ -1222,6 +1222,7 @@ public class NPC extends AbstractCharacter { @@ -1222,6 +1222,7 @@ public class NPC extends AbstractCharacter {
}catch (Exception e){
Logger.error( e.getMessage());
}
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
}
public void removeFromZone() {

Loading…
Cancel
Save