Interface KonquestUpgradeManager


public interface KonquestUpgradeManager
A manager for town upgrades in Konquest.
  • Method Details

    • isEnabled

      boolean isEnabled()
      Check whether town upgrades are enabled from the Konquest configuration.
      Returns:
      True when upgrades are enabled, else false
    • getAvailableUpgrades

      HashMap<KonquestUpgrade,Integer> getAvailableUpgrades(KonquestTown town)
      Provides a list of upgrades available for purchase for the given town. Checks for valid cost and level requirements. Upgrade levels will not be listed if cost is less than 0 (e.g. -1).
      Parameters:
      town - The town to search for available upgrades
      Returns:
      A map of available upgrades and their levels
    • getUpgradeCost

      int getUpgradeCost(KonquestUpgrade upgrade, int level)
      Gets the cost in favor of the given upgrade and level. The given level must be greater than 0 and less than or equal to the upgrade's max level. Upgrade costs are pulled from Konquest configuration.
      Parameters:
      upgrade - The upgrade
      level - The level of the given upgrade
      Returns:
      The cost in favor, or -1 when level is not valid
    • getUpgradePopulation

      int getUpgradePopulation(KonquestUpgrade upgrade, int level)
      Gets the population requirement of the given upgrade and level. The given level must be greater than 0 and less than or equal to the upgrade's max level. Upgrade populations are pulled from Konquest configuration.
      Parameters:
      upgrade - The upgrade
      level - The level of the given upgrade
      Returns:
      The population, or 0 when level is not valid
    • getTownUpgradeLevel

      int getTownUpgradeLevel(KonquestTown town, KonquestUpgrade upgrade)
      Gets the current upgrade level of the given town. Returns 0 if the town does not have the upgrade.
      Parameters:
      town - The town to check
      upgrade - The upgrade
      Returns:
      The level of the upgrade, or 0 if the upgrade is not applied
    • applyTownUpgrade

      boolean applyTownUpgrade(KonquestTown town, KonquestUpgrade upgrade, int level)
      Apply the given upgrade and level to the given town. The given level must be greater than or equal to 0 and less than or equal to the upgrade's max level. Applying a level of 0 will remove the upgrade. The upgrade feature must be enabled in the Konquest configuration.
      Parameters:
      town - The town to upgrade
      upgrade - The upgrade to apply
      level - The level of the upgrade
      Returns:
      True when the upgrade is applied successfully, else false