Class GroundContainer

java.lang.Object
games.stendhal.client.gui.GroundContainer
All Implemented Interfaces:
Inspector, MouseListener, MouseMotionListener, MouseWheelListener, EventListener

public class GroundContainer extends Object implements Inspector, MouseListener, MouseMotionListener, MouseWheelListener
Mouse handler for the game screen floor.
  • Constructor Details

    • GroundContainer

      public GroundContainer(StendhalClient client, IGameScreen gameScreen, JComponent canvas)
      Create a new GroundContainer.
      Parameters:
      client - client
      gameScreen - screen corresponding to the ground
      canvas - The component to place popup menus
  • Method Details

    • mouseMoved

      public void mouseMoved(MouseEvent e)
      Specified by:
      mouseMoved in interface MouseMotionListener
    • createAndSendMoveToAction

      public void createAndSendMoveToAction(Point2D point, boolean doubleClick)
      Send a move to command to the server.
      Parameters:
      point - destination
      doubleClick - true if the action was created with a double click, false otherwise
    • calculateZoneChangeDirection

      public Direction calculateZoneChangeDirection(Point2D point)
      Calculates whether the click was close enough to a zone border to trigger a zone change.
      Parameters:
      point - click point in world coordinates
      Returns:
      Direction of the zone to change to, null if no zone change should happen
    • dropEntity

      public void dropEntity(IEntity entity, int amount, Point point)
      Drop an entity to the container.
      Parameters:
      entity - dropped entity
      amount - number of entities dropped
      point - dropping location
    • mouseWheelMoved

      public void mouseWheelMoved(MouseWheelEvent e)
      Specified by:
      mouseWheelMoved in interface MouseWheelListener
    • inspectMe

      public SlotWindow inspectMe(IEntity suspect, RPSlot content, SlotWindow container, int width, int height)
      Specified by:
      inspectMe in interface Inspector
    • getScreen

      public IGameScreen getScreen()
      Get the screen corresponding to the ground container.
      Returns:
      screen
    • getCanvas

      public JComponent getCanvas()
      Get the JComponent of the container.
      Returns:
      component
    • getClient

      public StendhalClient getClient()
      Get the client.
      Returns:
      client
    • setNewMouseHandlerState

      public void setNewMouseHandlerState(GroundContainerMouseState newState)
      Set the mouse handler state for the ground.
      Parameters:
      newState - new mouse state
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      Specified by:
      mouseDragged in interface MouseMotionListener
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
    • mousePressed

      public void mousePressed(MouseEvent e)
      Remembers whether the client was active on last mouse down.
      Specified by:
      mousePressed in interface MouseListener
      Parameters:
      e - event
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      Specified by:
      mouseExited in interface MouseListener