Class WeatherUpdater

java.lang.Object
games.stendhal.server.core.rp.WeatherUpdater
All Implemented Interfaces:
TurnListener

public class WeatherUpdater extends Object implements TurnListener
Manager for zones with changing weather.
  • Field Details

    • WEATHER_KEYWORD

      public static final String WEATHER_KEYWORD
      The keyword used by the weather adjustments parser.
      See Also:
      Constant Field Values
  • Method Details

    • get

      public static WeatherUpdater get()
      Get the WeatherUpdater instance.
      Returns:
      singleton instance
    • manageAttributes

      public void manageAttributes(ZoneAttributes attr, String desc)
      Make a zone weather managed by the weather updater. Modifiers to the default weather can be described in form "varying(rain=value1, temperature=value2, fog=value3)", where any or all of the modifiers can be omitted, and their order does not matter. Description parameter "varying" is interpreted as "varying()", that is, no weather modifiers.
      The values are interpreted so that:
      • One step of rain corresponds to adding about 5% to rain probability
      • One step of temperature corresponds roughly to one month of time difference (compared to coldest month).
      • One step of fog corresponds to adding about 5% to fog probability
      Negative values are interpreted as corresponding decreases. Note that rain and especially fog have low probabilities to begin with, so they get easily turned off completely.
      If a modifier is specified more than once, the last one takes effect.
      Parameters:
      attr - Attributes of the zone
      desc - The weather attribute value specified for the zone. This is used to determine any zone specific modifiers
    • onTurnReached

      public final void onTurnReached(int currentTurn)
      Description copied from interface: TurnListener
      This method is called when the turn number is reached.
      Specified by:
      onTurnReached in interface TurnListener
      Parameters:
      currentTurn - current turn number