Class ArenaTeamRegistry
Who is on which team in each arena scene, and whether that arena is currently live.
public static class ArenaTeamRegistry
- Inheritance
-
ArenaTeamRegistry
- Inherited Members
Remarks
The team primitive. Arenas cannot use parties for sides — a party is capped well below an 8v8 team — and cannot use factions, because two guildmates or two members of the same faction must be able to fight each other in an arena. So the alliance between two characters standing in an arena scene is decided here, before faction, party or guild are consulted: same team is ally, different team is enemy, and while the match is not live — gathering, counting down, or over — everybody in it is an ally so nobody can be hit before the start or after the end.
Keyed by Unity scene handle, like DungeonDifficultyRegistry, because that is the one thing a character and the thing checking it both know. The server publishes from the match rows; the client publishes from the match state broadcast, so its predicted targeting agrees with the server. A handle is reused after its scene unloads, so an entry is removed when the scene is, not left behind.
Methods
Clear()
Forgets everything. For server restarts and client disconnects.
public static void Clear()
GetTeam(int, long)
The team a character is on in a scene, or -1.
public static int GetTeam(int sceneHandle, long characterID)
Parameters
Returns
GetTeamColor(int, int)
The colour of a team in a scene: the published one, else the default palette's.
public static Color GetTeamColor(int sceneHandle, int team)
Parameters
Returns
- Color
IsArena(int)
Whether a scene hosts an arena match this registry knows about.
public static bool IsArena(int sceneHandle)
Parameters
sceneHandleint
Returns
IsLive(int)
Whether play is on in a scene.
public static bool IsLive(int sceneHandle)
Parameters
sceneHandleint
Returns
Publish(int, IReadOnlyDictionary<long, int>, bool)
Records or replaces the roster for a scene.
public static void Publish(int sceneHandle, IReadOnlyDictionary<long, int> teamByCharacter, bool live)
Parameters
sceneHandleintScene the arena runs in.
teamByCharacterIReadOnlyDictionary<long, int>Character to team index.
liveboolWhether play is on.
Publish(int, IReadOnlyDictionary<long, int>, bool, Color[])
Records or replaces the roster for a scene, with the colours its teams are drawn in.
public static void Publish(int sceneHandle, IReadOnlyDictionary<long, int> teamByCharacter, bool live, Color[] teamColors)
Parameters
sceneHandleintScene the arena runs in.
teamByCharacterIReadOnlyDictionary<long, int>Character to team index.
liveboolWhether play is on.
teamColorsColor[]Colour per team, or null to keep the previous colours or the default palette.
SetLive(int, bool)
Turns play on or off for a scene without changing its roster.
public static void SetLive(int sceneHandle, bool live)
Parameters
TryGetTeamColor(ICharacter, out Color)
The colour a character is drawn in because of the team they sit on, when they stand in an arena and hold a seat.
public static bool TryGetTeamColor(ICharacter character, out Color color)
Parameters
characterICharactercolorColor
Returns
Remarks
Consulted by the alliance colour, so nameplates and target frames show team colours inside an arena without knowing what an arena is. Spectators and strangers have no seat and fall through to the ordinary colouring.
TryResolveAlliance(ICharacter, ICharacter, out FactionAllianceLevel)
Decides the alliance between two characters when at least one stands in an arena.
public static bool TryResolveAlliance(ICharacter a, ICharacter b, out FactionAllianceLevel level)
Parameters
aICharacterbICharacterlevelFactionAllianceLevel
Returns
- bool
True when the arena decided it; false to fall through to faction rules.
Remarks
- Neither in an arena scene: not decided here.
- In different scenes, or only one of them seated: they cannot fight; ally.
- Match not live: ally, so nothing lands before the start or after the end.
- Same team: ally. Different team: enemy.
Unpublish(int)
Forgets a scene's arena.
public static void Unpublish(int sceneHandle)
Parameters
sceneHandleint