Table of Contents

Class DualSidedFlagService

Namespace
Uncreated.Warfare.Layouts.Flags
Assembly
Uncreated.Warfare.dll
public abstract class DualSidedFlagService : IAttackDefenseDecider, ILayoutHostedService, IFlagRotationService, IFlagListUIProvider, IEventListener<FlagCaptured>, IEventListener<FlagNeutralized>, IEventListener<PlayerEnteredFlagRegion>, IEventListener<PlayerExitedFlagRegion>
Inheritance
DualSidedFlagService
Implements
Inherited Members

Constructors

DualSidedFlagService(IServiceProvider, IConfiguration)

protected DualSidedFlagService(IServiceProvider serviceProvider, IConfiguration config)

Parameters

serviceProvider IServiceProvider
config IConfiguration

Fields

FlagTranslations

protected readonly FlagUITranslations FlagTranslations

Field Value

FlagUITranslations

Layout

protected readonly Layout Layout

Field Value

Layout

Logger

protected readonly ILogger Logger

Field Value

ILogger

ServiceProvider

protected readonly IServiceProvider ServiceProvider

Field Value

IServiceProvider

TeamManager

protected readonly ITeamManager<Team> TeamManager

Field Value

ITeamManager<Team>

Properties

ActiveFlags

public IReadOnlyList<FlagObjective> ActiveFlags { get; }

Property Value

IReadOnlyList<FlagObjective>

Configuration

public IConfiguration Configuration { get; }

Property Value

IConfiguration

DiscoverDistance

Distance from any owned flags that are discovered.

protected virtual int DiscoverDistance { get; }

Property Value

int

EndingTeam

public Team EndingTeam { get; }

Property Value

Team

EndingTeamRegion

public ZoneRegion EndingTeamRegion { get; }

Property Value

ZoneRegion

FlagSettings

protected FlagPhaseSettings FlagSettings { get; }

Property Value

FlagPhaseSettings

GridBehaivor

public virtual ElectricalGridBehaivor GridBehaivor { get; }

Property Value

ElectricalGridBehaivor

IsActive

public bool IsActive { get; }

Property Value

bool

PathingResult

protected IList<Zone>? PathingResult { get; }

Property Value

IList<Zone>

StartingTeam

public Team StartingTeam { get; }

Property Value

Team

StartingTeamRegion

public ZoneRegion StartingTeamRegion { get; }

Property Value

ZoneRegion

ZoneStore

protected ZoneStore ZoneStore { get; }

Property Value

ZoneStore

Methods

CreateFlagObjective(ZoneRegion, int, Team)

protected virtual FlagObjective CreateFlagObjective(ZoneRegion region, int index, Team teamOwner)

Parameters

region ZoneRegion
index int
teamOwner Team

Returns

FlagObjective

Discover(Team, int, bool)

Discover the first n flags for a team from any owned flags.

protected virtual void Discover(Team team, int amount, bool noRaise = false)

Parameters

team Team
amount int
noRaise bool

EnumerateFlagListEntries(LanguageSet)

public IEnumerable<FlagListUIEntry> EnumerateFlagListEntries(LanguageSet set)

Parameters

set LanguageSet

Returns

IEnumerable<FlagListUIEntry>

EnumerateObjectives()

public virtual IEnumerable<FlagObjective> EnumerateObjectives()

Returns

IEnumerable<FlagObjective>

GetContestResult(FlagObjective, IEnumerable<Team>)

Must return a FlagContestState describing the resultant state of the contest caused by players trying to capture it, if any.

The logic of this method should account for all the result cases featured in FlagContestState.ContestState.

This method is called every flag tick (usually a few seconds), as well as on some other occasions, on every active flag in the rotation.

public abstract FlagContestState GetContestResult(FlagObjective flag, IEnumerable<Team> possibleContestingTeams)

Parameters

flag FlagObjective

The flag that is being evaluated.

possibleContestingTeams IEnumerable<Team>

A selection of possible teams who may be contesting the flag.

Returns

FlagContestState

GetFlagListEntry(FlagObjective, in LanguageSet, FlagObjective?)

protected virtual FlagListUIEntry GetFlagListEntry(FlagObjective flag, in LanguageSet set, FlagObjective? displayTeamObjective)

Parameters

flag FlagObjective
set LanguageSet
displayTeamObjective FlagObjective

Returns

FlagListUIEntry

GetObjective(Team)

public abstract FlagObjective? GetObjective(Team team)

Parameters

team Team

Returns

FlagObjective

HandleEvent(PlayerEnteredFlagRegion, IServiceProvider)

public void HandleEvent(PlayerEnteredFlagRegion e, IServiceProvider serviceProvider)

Parameters

e PlayerEnteredFlagRegion
serviceProvider IServiceProvider

HandleEvent(PlayerExitedFlagRegion, IServiceProvider)

public void HandleEvent(PlayerExitedFlagRegion e, IServiceProvider serviceProvider)

Parameters

e PlayerExitedFlagRegion
serviceProvider IServiceProvider

IsAttacking(WarfarePlayer)

If the player is actively attacking the objective.

public bool IsAttacking(WarfarePlayer player)

Parameters

player WarfarePlayer

Returns

bool

IsDefending(WarfarePlayer)

If the player is actively defending the objective.

public bool IsDefending(WarfarePlayer player)

Parameters

player WarfarePlayer

Returns

bool

IsDefenseObjective(FlagObjective, Team)

public bool IsDefenseObjective(FlagObjective flag, Team friendlyTeam)

Parameters

flag FlagObjective
friendlyTeam Team

Returns

bool

IsEnemyObjective(FlagObjective, Team)

public bool IsEnemyObjective(FlagObjective flag, Team friendlyTeam)

Parameters

flag FlagObjective
friendlyTeam Team

Returns

bool

OnFlagCaptured(FlagCaptured)

protected virtual void OnFlagCaptured(FlagCaptured e)

Parameters

e FlagCaptured

OnTick(ILoopTicker, TimeSpan, TimeSpan)

protected virtual void OnTick(ILoopTicker ticker, TimeSpan timeSinceStart, TimeSpan deltaTime)

Parameters

ticker ILoopTicker
timeSinceStart TimeSpan
deltaTime TimeSpan

RecalculateObjectives()

protected abstract void RecalculateObjectives()

SlowTickObjective(FlagObjective, FlagContestState)

protected virtual void SlowTickObjective(FlagObjective flag, FlagContestState contestState)

Parameters

flag FlagObjective
contestState FlagContestState

StartAsync(CancellationToken)

Executes at the beginning of every game.

public virtual UniTask StartAsync(CancellationToken token)

Parameters

token CancellationToken

Returns

UniTask

StopAsync(CancellationToken)

Executes at the end of every game.

public virtual UniTask StopAsync(CancellationToken token)

Parameters

token CancellationToken

Returns

UniTask

TriggerVictory(Team)

protected void TriggerVictory(Team winner)

Parameters

winner Team