Class SBFClient

All Implemented Interfaces:
IClient

public class SBFClient extends AbstractClient
This is the game client for Strategic BattleForce games, as one would think.
  • Constructor Details

    • SBFClient

      public SBFClient(String name, String host, int port)
      Construct a client which will try to connect. If the connection fails, it will alert the player, free resources and hide the frame.
      Parameters:
      name - the player name for this client
      host - the hostname
      port - the host port
  • Method Details

    • getGame

      public SBFGame getGame()
      Description copied from interface: IClient
      Returns the game of this client as a game-type independent IGame. Note that the game object is only updated, not replaced and a reference to it can therefore be kept.
      Returns:
      The game of this client
    • isMyTurn

      public boolean isMyTurn()
      Returns:
      True when the currently active turn is a turn for the local player
    • handleGameSpecificPacket

      protected boolean handleGameSpecificPacket(Packet packet)
      Description copied from class: AbstractClient
      Handles any Packets that are specific to the game type (TW, AS...). When implementing this, make sure that this doesn't do duplicate actions with AbstractClient.handleGameIndependentPacket(Packet) - but packets may be handled in both methods (all packets traverse both methods).

      When making changes, do not forget to update Precognition which is a Client clone but unfortunately not a subclass.

      Specified by:
      handleGameSpecificPacket in class AbstractClient
      Parameters:
      packet - The packet to handle
      Returns:
      True when the packet has been handled
    • receiveEntities

      protected void receiveEntities(Packet packet) throws InvalidPacketDataException
      Loads the entities from the data in the net command.
      Throws:
      InvalidPacketDataException
    • cacheImgTag

      protected void cacheImgTag(InGameObject unit)
      Hashtable for storing img tags containing base64Text src.
    • moveUnit

      public void moveUnit(SBFMovePath movePath)
    • sendAttackData

      public void sendAttackData(List<EntityAction> attacks, int formationId)