Mod API Reference:FogMod

From Warzone Wiki
Jump to navigation Jump to search

FogMod is a class for modifying Fog in a Warzone classic game. It can set for any specific players, or all players, the fog level of territories, between three different fog levels:

  • WL.StandingFogLevel.Visible: Both the owner of the territory and the armies/structures are visible.
  • WL.StandingFogLevel.OwnerOnly: Only the owner of the territory is visible. Its armies/structures are hidden.
  • WL.StandingFogLevel.Fogged: Both the owner of the territory and its armies/structures are hidden.

To add or remove a FogMod from a game, you should assign it to a GameOrderEvent.

Properties

  • ID Guid: Automatically generated and guaranteed to be unique for every FogMod instance created.
  • Message string: A user-friendly message explaining to the player why this fog is being applied here. Currently, this message is not displayed to the player anywhere. However, in a future update to the Warzone client it may be displayed.
  • FogLevel StandingFogLevel (enum): Should be either WL.StandingFogLevel.Visible, WL.StandingFogLevel.OwnerOnly, or WL.StandingFogLevel.Fogged. See above for the definitions of these.
  • Priority integer: Priority affects how the FogMod interacts with other fog-affecting systems in Warzone. If multiple FogMod instances affects the same player and territory (either from the same mod or different mods), the FogMod with a higher priority will override the FogMod with a lower priority. If they're identical priorities, it's undefined which one will override the other.
    • In addition, the priority range determines how the FogMod interacts with existing Warzone mechanics, based on the following rules:
    • Priority is >= 9000: The FogMod will always change the territory visibility.
    • Priority is 6000 - 8999: The FogMod will not affect the player's own territories or the player's teammates territories (your own territories and teammates territories are always visible, like normal)
    • Priority is 3000 - 7999: The FogMod will also not affect a territory that's being made visible by a special unit.
    • Priority is < 3000: The FogMod will also not affect any territory that's being made visible by a spy, recon, or surveillance cards.
  • Territories HashSet<TerritoryID>: A list of the territory IDs that will receive the new fog level.
  • PlayersAffectedOpt HashSet<PlayerID>: A list of the player IDs that will see the new fog level. Nil means to affect all players, even spectators.

Functions

Caution when using High Priroities

Mod developers must take extreme caution when using a FogMod with a priority value of 9000 or above combined with the Foggy or OwnerOnly visibility levels. With these combined, it's possible to cause a players own territories be hidden from themselves. If not used carefully, it would cause the player be unable to commit their armies which would cause them to get booted.

For example, if a player controls all of South America for +4 income, and a FogMod hides Brazil from that player, the player's client will think they don't control the South America bonus and won't provide them with the extra 4 armies, whereas the Warzone server will think they do control South America and reject the player's orders for not deploying the extra 4 armies.

One way to work around this issue is to ensure your mod never hides a player's own territories from themselves, either by using priority < 9000 or by only targeting territories the player doesn't own themselves. Another solution could be to enforce that your mod only works in commerce mode, since commerce mode allows players to under-deploy which would not cause the player to get booted, but still deprive the player of their bonus's income.

If a FogMod sets a player's own territory to OwnerOnly with a priority value of 9000 or above, the player won't be able to see the armies on their own territory, but they will be able to see they control it. In this case, the player won't be able to deploy to that territory, but this restriction is only enforced by the Warzone client and not by the server. This means a sneaky player could hack their client to bypass this restriction. If you intend to use this to stop deployments, you should also cancel the deployment order on the server.