Move to point message variable naming and handler cleanup

This commit is contained in:
2023-09-10 19:37:46 -05:00
parent 9989cbff24
commit 003b939d33
7 changed files with 84 additions and 89 deletions
+56 -55
View File
@@ -10,6 +10,7 @@
package engine.net.client.msg;
import engine.Enum.GameObjectType;
import engine.gameManager.BuildingManager;
import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable;
import engine.net.AbstractConnection;
@@ -21,19 +22,19 @@ import engine.objects.Building;
public class MoveToPointMsg extends ClientNetMsg {
private int sourceType;
private int sourceID;
private float startLat;
private float startLon;
private float startAlt;
private float endLat;
private float endLon;
private float endAlt;
private int targetType;
private int targetID;
private int inBuilding; // 0=true, -1=false 0/1/2 = floor you are on
private int unknown01;
private byte unknown02;
private int sourceType; //ordinal of the character type that sent this message 54=PlayerCharacter
private int sourceID; // uuid of the source character of this message
private float startLat; //start loc of move message (offset if inside a building not world loc)
private float startLon; //start loc of move message (offset if inside a building not world loc)
private float startAlt; //start loc of move message (offset if inside a building not world loc)
private float endLat; //end loc of move message (offset if inside a building not world loc)
private float endLon; //end loc of move message (offset if inside a building not world loc)
private float endAlt; //end loc of move message (offset if inside a building not world loc)
private int startLocType; // enum ordinal of the object player is inside 0=nothing 8=building
private int inBuildingUUID; // uuid of the building character is currently inside
private int inBuilding; // is inside a building 0=true -1=false
private int inBuildingFloor; // floor of building character is currently in -1=not inside building 0/1/2/3 = floor number
private byte initiatedByAttack; // move message sent as a result of move to target to attack 0=false 1=true
private byte unknown03;
/**
@@ -54,11 +55,11 @@ public class MoveToPointMsg extends ClientNetMsg {
this.endLat = msg.endLat;
this.endLon = msg.endLon;
this.endAlt = msg.endAlt;
this.targetType = msg.targetType;
this.targetID = msg.targetID;
this.startLocType = msg.startLocType;
this.inBuildingUUID = msg.inBuildingUUID;
this.inBuilding = msg.inBuilding;
this.unknown01 = msg.unknown01;
this.unknown02 = msg.unknown02;
this.inBuildingFloor = msg.inBuildingFloor;
this.initiatedByAttack = msg.initiatedByAttack;
this.unknown03 = msg.unknown03;
}
@@ -73,11 +74,11 @@ public class MoveToPointMsg extends ClientNetMsg {
this.endLat = building.getLoc().x;
this.endLon = building.getLoc().z;
this.endAlt = building.getLoc().y;
this.targetType = 0;
this.targetID = 0;
this.startLocType = 0;
this.inBuildingUUID = 0;
this.inBuilding = -1;
this.unknown01 = -1;
this.unknown02 = 0;
this.inBuildingFloor = -1;
this.initiatedByAttack = 0;
this.unknown03 = 0;
}
@@ -108,11 +109,11 @@ public class MoveToPointMsg extends ClientNetMsg {
writer.putFloat(this.endAlt);
writer.putFloat(this.endLon);
writer.putInt(this.targetType);
writer.putInt(this.targetID);
writer.putInt(this.startLocType);
writer.putInt(this.inBuildingUUID);
writer.putInt(this.inBuilding);
writer.putInt(this.unknown01);
writer.putInt(this.inBuildingFloor);
writer.put((byte) 0);
writer.put((byte) 0);
@@ -135,13 +136,13 @@ public class MoveToPointMsg extends ClientNetMsg {
this.endAlt = reader.getFloat();
this.endLon = reader.getFloat();
this.targetType = reader.getInt();
this.targetID = reader.getInt();
this.startLocType = reader.getInt();
this.inBuildingUUID = reader.getInt();
this.inBuilding = reader.getInt();
this.unknown01 = reader.getInt();
this.inBuildingFloor = reader.getInt();
this.unknown02 = reader.get();
this.initiatedByAttack = reader.get();
this.unknown03 = reader.get();
}
@@ -209,20 +210,20 @@ public class MoveToPointMsg extends ClientNetMsg {
this.endAlt = value;
}
public int getTargetType() {
return this.targetType;
public int getStartLocType() {
return this.startLocType;
}
public void setTargetType(int value) {
this.targetType = value;
public void setStartLocType(int value) {
this.startLocType = value;
}
public int getTargetID() {
return this.targetID;
public int getInBuildingUUID() {
return this.inBuildingUUID;
}
public void setTargetID(int value) {
this.targetID = value;
public void setInBuildingUUID(int value) {
this.inBuildingUUID = value;
}
public int getInBuilding() {
@@ -233,12 +234,8 @@ public class MoveToPointMsg extends ClientNetMsg {
this.inBuilding = value;
}
public int getUnknown01() {
return this.unknown01;
}
public void setUnknown01(int value) {
this.unknown01 = value;
public void setInBuildingFloor(int value) {
this.inBuildingFloor = value;
}
public void setStartCoord(Vector3fImmutable value) {
@@ -254,8 +251,8 @@ public class MoveToPointMsg extends ClientNetMsg {
}
public void clearTarget() {
this.targetType = 0;
this.targetID = 0;
this.startLocType = 0;
this.inBuildingUUID = 0;
}
public void setPlayer(AbstractCharacter ac) {
@@ -263,10 +260,10 @@ public class MoveToPointMsg extends ClientNetMsg {
this.sourceID = ac.getObjectUUID();
this.setStartCoord(ac.getLoc());
this.setEndCoord(ac.getEndLoc());
this.targetType = 0;
this.targetID = 0;
this.startLocType = 0;
this.inBuildingUUID = 0;
this.inBuilding = ac.getInBuilding();
this.unknown01 = ac.getInFloorID();
this.inBuildingFloor = ac.getInFloorID();
}
@@ -274,10 +271,10 @@ public class MoveToPointMsg extends ClientNetMsg {
if (target == null) {
this.setStartCoord(ac.getLoc());
this.setEndCoord(ac.getEndLoc());
this.targetType = 0;
this.targetID = 0;
this.startLocType = 0;
this.inBuildingUUID = 0;
this.inBuilding = -1;
this.unknown01 = -1;
this.inBuildingFloor = -1;
} else {
Vector3fImmutable convertLocStart = ZoneManager.convertWorldToLocal(target, ac.getLoc());
Vector3fImmutable convertLocEnd = convertLocStart;
@@ -286,10 +283,10 @@ public class MoveToPointMsg extends ClientNetMsg {
this.setStartCoord(convertLocStart);
this.setEndCoord(convertLocEnd);
this.targetType = GameObjectType.Building.ordinal();
this.targetID = target.getObjectUUID();
this.startLocType = GameObjectType.Building.ordinal();
this.inBuildingUUID = target.getObjectUUID();
this.inBuilding = ac.getInBuilding();
this.unknown01 = ac.getInFloorID();
this.inBuildingFloor = ac.getInFloorID();
}
}
@@ -298,7 +295,11 @@ public class MoveToPointMsg extends ClientNetMsg {
return unknown03;
}
public int getUnknown02() {
return unknown02;
public int getInitiatedFromAttack() {
return initiatedByAttack;
}
public int getInBuildingFloor() {
return this.inBuildingFloor;
}
}