Browse Source

Merge remote-tracking branch 'origin/magicbox1.5' into new-booty-system

master
FatBoy-DOTC 2 years ago
parent
commit
16fb40e104
  1. 17
      src/engine/devcmd/cmds/InfoCmd.java
  2. 29
      src/engine/net/client/msg/LoadCharacterMsg.java
  3. 2
      src/engine/objects/Mob.java
  4. 3
      src/engine/objects/NPC.java

17
src/engine/devcmd/cmds/InfoCmd.java

@ -396,6 +396,10 @@ public class InfoCmd extends AbstractDevCmd {
output += "BuildingID : " + targetNPC.getRegion().parentBuildingID; output += "BuildingID : " + targetNPC.getRegion().parentBuildingID;
output += "building level : " + targetNPC.getRegion().level; output += "building level : " + targetNPC.getRegion().level;
output += "building room : " + targetNPC.getRegion().room; output += "building room : " + targetNPC.getRegion().room;
}else if(targetNPC.getBuilding() != null) {
output += newline;
output += "Building : " + targetNPC.getBuilding();
output += "In BuildingLoc : " + targetNPC.inBuildingLoc;
}else{ }else{
output += newline; output += newline;
output += "No building found."; output += "No building found.";
@ -462,6 +466,19 @@ public class InfoCmd extends AbstractDevCmd {
output += "Parent Zone LoadNum : " + targetMob.getParentZone().getLoadNum(); output += "Parent Zone LoadNum : " + targetMob.getParentZone().getLoadNum();
output += newline; output += newline;
output += "isMoving : " + targetMob.isMoving(); output += "isMoving : " + targetMob.isMoving();
if (targetMob.getRegion() != null){
output += newline;
output += "BuildingID : " + targetMob.getRegion().parentBuildingID;
output += "building level : " + targetMob.getRegion().level;
output += "building room : " + targetMob.getRegion().room;
}else if(targetMob.building != null) {
output += newline;
output += "BuildingID : " + targetMob.building;
output += "In BuildingLoc : " + targetMob.inBuildingLoc;
}else{
output += newline;
output += "No building found.";
}
break; break;
case Item: //intentional passthrough case Item: //intentional passthrough
case MobLoot: case MobLoot:

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

@ -86,22 +86,39 @@ public class LoadCharacterMsg extends ClientNetMsg {
} else if (absChar != null) { } else if (absChar != null) {
if (absChar.getObjectType().equals(GameObjectType.PlayerCharacter)){ if (absChar.getObjectType().equals(GameObjectType.PlayerCharacter)) {
Regions region = absChar.getRegion(); Regions region = absChar.getRegion();
if (region == null){ if (region == null) {
writer.putInt(-1); writer.putInt(-1);
writer.putInt(-1); writer.putInt(-1);
}else{ } else {
Building regionBuilding = Regions.GetBuildingForRegion(region); Building regionBuilding = Regions.GetBuildingForRegion(region);
if (regionBuilding == null){ if (regionBuilding == null) {
writer.putInt(-1); writer.putInt(-1);
writer.putInt(-1); writer.putInt(-1);
}else{ } else {
writer.putInt(region.getLevel()); writer.putInt(region.getLevel());
writer.putInt(region.getRoom()); writer.putInt(region.getRoom());
} }
} }
}
else if (absChar.getObjectType().equals(GameObjectType.Mob)){
Regions region = absChar.getRegion();
if (region == null){
writer.putInt(-1);
writer.putInt(-1);
}else{
Building regionBuilding = Regions.GetBuildingForRegion(region);
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. //TODO below is Mob Region Serialization, not implemented. default to -1, which is ground.
}else { }else {

2
src/engine/objects/Mob.java

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

3
src/engine/objects/NPC.java

@ -1222,6 +1222,7 @@ public class NPC extends AbstractCharacter {
}catch (Exception e){ }catch (Exception e){
Logger.error( e.getMessage()); Logger.error( e.getMessage());
} }
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
} }
public void removeFromZone() { public void removeFromZone() {
@ -1461,7 +1462,7 @@ public class NPC extends AbstractCharacter {
mob.setSpawnTime(10); mob.setSpawnTime(10);
mob.setNpcOwner(this); mob.setNpcOwner(this);
mob.state = STATE.Awake; mob.state = STATE.Awake;
mob.region = AbstractWorldObject.GetRegionByWorldObject(mob);
return mob; return mob;
} }

Loading…
Cancel
Save