Class ServerLobbyHelper

java.lang.Object
megamek.server.ServerLobbyHelper

public class ServerLobbyHelper extends Object
  • Constructor Details

    • ServerLobbyHelper

      public ServerLobbyHelper()
  • Method Details

    • entityUpdateMessage

      public static String entityUpdateMessage(Entity entity, Game game)
      Writes a "Unit XX has been customized" message to the chat. The message is adapted to blind drop conditions.
    • lobbyUnload

      public static HashSet<Entity> lobbyUnload(Game game, Collection<Entity> entities)
      Disembarks and offloads the given entities (removing it from transports and removing transported units from it). Returns a set of entities that received changes. The set may be empty, but not null.

      NOTE: This is a simplified unload that is only valid in the lobby!

    • performC3Disconnect

      public static HashSet<Entity> performC3Disconnect(Game game, Collection<Entity> entities)
      Performs a disconnect from C3 networks for the given entities. This is a simplified version that is only valid in the lobby. Returns a set of entities that received changes.
    • createMultiEntityPacket

      public static Packet createMultiEntityPacket(Collection<Entity> entities)
      Creates a packet for an update for the given entities. Only valid in the lobby.
    • createForcesDeletePacket

      public static Packet createForcesDeletePacket(Collection<Integer> forces)
      Creates a packet detailing a force delete. Only valid in the lobby.
    • receiveForceParent

      public static void receiveForceParent(Packet packet, int connId, Game game, TWGameManager gameManager) throws InvalidPacketDataException
      Handles a force parent packet, attaching the sent forces to a new parent or making the sent forces top-level. This method is intended for use in the lobby!
      Throws:
      InvalidPacketDataException
    • receiveEntitiesAssign

      public static void receiveEntitiesAssign(Packet packet, int connId, Game game, TWGameManager gameManager) throws InvalidPacketDataException
      Handles a force assign full packet, changing the owner of forces and everything in them. This method is intended for use in the lobby!
      Throws:
      InvalidPacketDataException
    • receiveForceAssignFull

      public static void receiveForceAssignFull(Packet packet, int connId, Game game, TWGameManager gameManager) throws InvalidPacketDataException
      Handles a force assign full packet, changing the owner of forces and everything in them. This method is intended for use in the lobby!
      Throws:
      InvalidPacketDataException
    • receiveForceUpdate

      public static void receiveForceUpdate(Packet packet, int connId, Game game, TWGameManager gameManager) throws InvalidPacketDataException
      Handles a force update packet, forwarding a client-side change that only affects forces, not entities: - rename - move subforce/entity up/down (this does not change the entity, only the force) - owner change of only the force (not the entities, only within a team) This method is intended for use in the lobby!
      Throws:
      InvalidPacketDataException
    • receiveLobbyTeamChange

      public static void receiveLobbyTeamChange(Packet packet, int connId, Game game, TWGameManager gameManager) throws InvalidPacketDataException
      Handles a team change, updating units and forces as necessary. This method is intended for use in the lobby!
      Throws:
      InvalidPacketDataException
    • correctLoading

      public static void correctLoading(Game game)
      For all game units, disembarks from carriers and offloads carried units if they are enemies.

      NOTE: This is a simplified unload that is only valid in the lobby!

    • correctTowLinks

      public static void correctTowLinks(Game game)
      For all game units, unhitches trailers whose train has ended up split between opposing players.

      This is the tow counterpart of the disembarking done above. Reassigning one unit of a train to an enemy would otherwise leave the two hitched together, moving as one train across opposing sides.

      NOTE: This is intended for use in the lobby phase!

    • correctC3Connections

      public static void correctC3Connections(Game game)
      For all game units, disconnects from enemy C3 masters / networks

      NOTE: This is intended for use in the lobby phase!

    • receiveAddEntitiesToForce

      public static void receiveAddEntitiesToForce(Packet packet, int connId, Game game, TWGameManager gameManager) throws InvalidPacketDataException
      Handles an add entity to force / remove from force packet, attaching the sent entities to a force or removing them from any force. This method is intended for use in the lobby!
      Throws:
      InvalidPacketDataException
    • receiveForceAdd

      public static void receiveForceAdd(Packet packet, int connId, Game game, TWGameManager gameManager) throws InvalidPacketDataException
      Adds a force with the info from the client. Only valid during the lobby phase.
      Throws:
      InvalidPacketDataException