Duplicate region field removed and inlined.

This commit is contained in:
2023-04-29 12:33:21 -04:00
parent de38c8727a
commit e554171e22
16 changed files with 95 additions and 101 deletions
@@ -44,7 +44,7 @@ public class ChangeAltitudeHandler extends AbstractClientMsgHandler {
if (pc.isSwimming())
return false;
if (pc.getRegion() != null && !pc.getRegion().isOutside())
if (pc.region != null && !pc.region.isOutside())
return false;
@@ -79,7 +79,7 @@ public class ChangeAltitudeHandler extends AbstractClientMsgHandler {
pc.landingRegion = null;
if (pc.getAltitude() == 0){
Regions upRegion = pc.getRegion();
Regions upRegion = pc.region;
if (upRegion != null){
float startAlt = 0;
Building regionBuilding = Regions.GetBuildingForRegion(upRegion);
@@ -74,8 +74,8 @@ public class LoadCharacterMsg extends ClientNetMsg {
NPC npc = (NPC) absChar;
if (npc.region != null) {
writer.putInt(npc.getRegion().getLevel());
writer.putInt(npc.getRegion().getRoom());
writer.putInt(npc.region.getLevel());
writer.putInt(npc.region.getRoom());
} else {
writer.putInt(-1);
writer.putInt(-1);
@@ -85,7 +85,7 @@ public class LoadCharacterMsg extends ClientNetMsg {
} else if (absChar != null) {
if (absChar.getObjectType().equals(GameObjectType.PlayerCharacter)) {
Regions region = absChar.getRegion();
Regions region = absChar.region;
if (region == null) {
writer.putInt(-1);
@@ -102,7 +102,7 @@ public class LoadCharacterMsg extends ClientNetMsg {
}
}
else if (absChar.getObjectType().equals(GameObjectType.Mob)){
Regions region = absChar.getRegion();
Regions region = absChar.region;
if (region == null){
writer.putInt(-1);
@@ -74,18 +74,18 @@ public class SendOwnPlayerMsg extends ClientNetMsg {
*/
@Override
protected void _serialize(ByteBufferWriter writer) {
Regions region = this.ch.getRegion();
Regions region = this.ch.region;
//region loading seralization. serialzes building level and floor. -1 = not in building.
if (region == null){
if (region == null) {
writer.putInt(-1);
writer.putInt(-1);
}else{
} else {
Building regionBuilding = Regions.GetBuildingForRegion(region);
if (regionBuilding == null){
if (regionBuilding == null) {
writer.putInt(-1);
writer.putInt(-1);
}else{
} else {
writer.putInt(region.getLevel());
writer.putInt(region.getRoom());
}
@@ -42,21 +42,20 @@ public class TeleportToPointMsg extends ClientNetMsg {
if (targetID != 0){
this.targetType = GameObjectType.Building.ordinal();
this.targetUUID = (int) targetID;
}else{
} else {
this.targetType = 0;
this.targetUUID = 0;
}
this.unknown01 = unknown01;
this.unknown02 = unknown02;
if (ago.getRegion() != null){
if (ago.region != null) {
this.targetType = GameObjectType.Building.ordinal();
this.targetUUID = ago.getRegion().parentBuildingID;
this.unknown01 = ago.getRegion().level;
this.unknown02 = ago.getRegion().room;
this.targetUUID = ago.region.parentBuildingID;
this.unknown01 = ago.region.level;
this.unknown02 = ago.region.room;
}
}