Browse Source

Move to point message variable naming and handler cleanup

feature-workorder
FatBoy-DOTC 1 year ago
parent
commit
003b939d33
  1. 2
      src/engine/devcmd/cmds/SetSubRaceCmd.java
  2. 20
      src/engine/gameManager/MovementManager.java
  3. 6
      src/engine/mobileAI/utilities/MovementUtilities.java
  4. 2
      src/engine/net/client/ClientMessagePump.java
  5. 28
      src/engine/net/client/handlers/MoveToPointHandler.java
  6. 111
      src/engine/net/client/msg/MoveToPointMsg.java
  7. 2
      src/engine/objects/PlayerCharacter.java

2
src/engine/devcmd/cmds/SetSubRaceCmd.java

@ -159,7 +159,7 @@ public class SetSubRaceCmd extends AbstractDevCmd { @@ -159,7 +159,7 @@ public class SetSubRaceCmd extends AbstractDevCmd {
// pum.setEffectID(token);
// pum.setSourceType(pc.getObjectType().ordinal());
// pum.setSourceID(pc.getObjectUUID());
// pum.setTargetType(pc.getObjectType().ordinal());
// pum.setStartLocType(pc.getObjectType().ordinal());
// pum.setTargetID(pc.getObjectUUID());
// pum.setNumTrains(40);
// pum.setDuration(-1);

20
src/engine/gameManager/MovementManager.java

@ -116,8 +116,8 @@ public enum MovementManager { @@ -116,8 +116,8 @@ public enum MovementManager {
// if inside a building, convert both locations from the building local reference frame to the world reference frame
if (msg.getTargetID() > 0) {
Building building = BuildingManager.getBuildingFromCache(msg.getTargetID());
if (msg.getInBuildingUUID() > 0) {
Building building = BuildingManager.getBuildingFromCache(msg.getInBuildingUUID());
if (building != null) {
Vector3fImmutable convertLocEnd = new Vector3fImmutable(ZoneManager.convertLocalToWorld(building, endLocation));
@ -128,8 +128,8 @@ public enum MovementManager { @@ -128,8 +128,8 @@ public enum MovementManager {
// }
// else {
toMove.setInBuilding(msg.getInBuilding());
toMove.setInFloorID(msg.getUnknown01());
toMove.setInBuildingID(msg.getTargetID());
toMove.setInFloorID(msg.getInBuildingFloor());
toMove.setInBuildingID(msg.getInBuildingUUID());
msg.setStartCoord(ZoneManager.convertWorldToLocal(building, toMove.getLoc()));
if (toMove.getObjectType() == GameObjectType.PlayerCharacter) {
@ -174,9 +174,9 @@ public enum MovementManager { @@ -174,9 +174,9 @@ public enum MovementManager {
msg.setStartCoord(ZoneManager.convertWorldToLocal(Regions.GetBuildingForRegion(toMove.region), toMove.getLoc()));
msg.setEndCoord(ZoneManager.convertWorldToLocal(regionBuilding, endLocation));
msg.setInBuilding(toMove.region.level);
msg.setUnknown01(toMove.region.room);
msg.setTargetType(GameObjectType.Building.ordinal());
msg.setTargetID(regionBuilding.getObjectUUID());
msg.setInBuildingFloor(toMove.region.room);
msg.setStartLocType(GameObjectType.Building.ordinal());
msg.setInBuildingUUID(regionBuilding.getObjectUUID());
}
} else {
@ -185,8 +185,8 @@ public enum MovementManager { @@ -185,8 +185,8 @@ public enum MovementManager {
toMove.setInBuilding(-1);
msg.setStartCoord(toMove.getLoc());
msg.setEndCoord(endLocation);
msg.setTargetType(0);
msg.setTargetID(0);
msg.setStartLocType(0);
msg.setInBuildingUUID(0);
}
//checks sync between character and server, if out of sync, teleport player to original position and return.
@ -233,7 +233,7 @@ public enum MovementManager { @@ -233,7 +233,7 @@ public enum MovementManager {
toMove.cancelOnMove();
//cancel any attacks for manual move.
if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) && msg.getUnknown02() == 0)
if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) && msg.getInitiatedFromAttack() == 0)
toMove.setCombatTarget(null);

6
src/engine/mobileAI/utilities/MovementUtilities.java

@ -244,10 +244,10 @@ public class MovementUtilities { @@ -244,10 +244,10 @@ public class MovementUtilities {
msg.setSourceID(agent.getObjectUUID());
msg.setStartCoord(startLoc);
msg.setEndCoord(endLoc);
msg.setUnknown01(-1);
msg.setInBuildingFloor(-1);
msg.setInBuilding(-1);
msg.setTargetType(0);
msg.setTargetID(0);
msg.setStartLocType(0);
msg.setInBuildingUUID(0);
try {

2
src/engine/net/client/ClientMessagePump.java

@ -643,7 +643,7 @@ public class ClientMessagePump implements NetMsgHandler { @@ -643,7 +643,7 @@ public class ClientMessagePump implements NetMsgHandler {
moveMsg.setStartCoord(sourcePlayer.getLoc());
moveMsg.setEndCoord(sourcePlayer.getLoc());
moveMsg.setInBuilding(-1);
moveMsg.setUnknown01(-1);
moveMsg.setInBuildingFloor(-1);
dispatch = Dispatch.borrow(sourcePlayer, moveMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);

28
src/engine/net/client/handlers/MoveToPointHandler.java

@ -32,37 +32,31 @@ public class MoveToPointHandler extends AbstractClientMsgHandler { @@ -32,37 +32,31 @@ public class MoveToPointHandler extends AbstractClientMsgHandler {
PlayerCharacter pc = (origin != null) ? (origin.getPlayerCharacter()) : null;
if (pc == null)
return false;
if(pc.combatTarget == null){
MovementManager.movement(msg, pc);
return true;
} else{
if (msg.getInitiatedFromAttack() == 1) {
//move message was initiated by an attack message
Enum.GameObjectType combatTargetType = pc.combatTarget.getObjectType();
if(combatTargetType.equals(Enum.GameObjectType.NPC)){
if (combatTargetType.equals(Enum.GameObjectType.NPC)) {
msg.clearTarget();
pc.setCombatTarget(null);
origin.sendMsg(msg);
}
if(combatTargetType.equals(Enum.GameObjectType.Mob) || combatTargetType.equals(Enum.GameObjectType.PlayerCharacter)){
MovementManager.movement(msg, pc);
return true;
} else if(combatTargetType.equals(Enum.GameObjectType.Building)) {
} else if (combatTargetType.equals(Enum.GameObjectType.Building)) {
Building targetBuilding = BuildingManager.getBuilding(pc.combatTarget.getObjectUUID());
if (targetBuilding != null) {
if (targetBuilding.isVulnerable() && targetBuilding.getRank() > -1) {
MovementManager.movement(msg, pc);
return true;
} else{
if (!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0) {
msg.clearTarget();
pc.setCombatTarget(null);
origin.sendMsg(msg);
}
}
}
}
msg.setEndCoord(pc.loc);
origin.sendMsg(msg);
return true;
}
MovementManager.movement(msg, pc);
return true;
}
}

111
src/engine/net/client/msg/MoveToPointMsg.java

@ -10,6 +10,7 @@ @@ -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; @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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;
}
}

2
src/engine/objects/PlayerCharacter.java

@ -5353,7 +5353,7 @@ public class PlayerCharacter extends AbstractCharacter { @@ -5353,7 +5353,7 @@ public class PlayerCharacter extends AbstractCharacter {
moveToMsg.setStartCoord(this.getLoc());
moveToMsg.setEndCoord(endLoc);
moveToMsg.setInBuilding(-1);
moveToMsg.setUnknown01(-1);
moveToMsg.setInBuildingFloor(-1);
moveToMsg.setSourceType(GameObjectType.PlayerCharacter.ordinal());
moveToMsg.setSourceID(this.getObjectUUID());

Loading…
Cancel
Save