Table of Contents

Class Player

Namespace
AO
Assembly
CoreAssembly.dll

The Player component. You may extend this class to add your own functionality to the player.

public class Player : Component
Inheritance
Player
Inherited Members
Extension Methods

Examples

public class MyPlayer : Player
{
    public override void Start() {}
    public override void Update() {}
}

Fields

AbilityInstances

public List<Ability> AbilityInstances

Field Value

List<Ability>

Agent

public Movement_Agent Agent

Field Value

Movement_Agent

BlockEmoteReasons

public List<string> BlockEmoteReasons

Field Value

List<string>

CurrentTargettingAbility

public Ability CurrentTargettingAbility

Field Value

Ability

CurrentTargettingAbilityIndex

public int CurrentTargettingAbilityIndex

Field Value

int

CurrentTargettingCurrentlySelections

public List<Player> CurrentTargettingCurrentlySelections

Field Value

List<Player>

CurrentTargettingDirection

public Vector2 CurrentTargettingDirection

Field Value

Vector2

CurrentTargettingMagnitude

public float CurrentTargettingMagnitude

Field Value

float

DefaultInventory

public Inventory DefaultInventory

Field Value

Inventory

Effects

public List<AEffect> Effects

Field Value

List<AEffect>

FootstepOverride

public string[] FootstepOverride

Field Value

string[]

MaxAbilitiesInDefaultUI

public const int MaxAbilitiesInDefaultUI = 6

Field Value

int

TargettingEffect

public AEffect TargettingEffect

Field Value

AEffect

Properties

ActiveEffect

The current ActiveEffect on the player, if any. There may only be one active effect on a player, adding another will cancel the existing one.

public AEffect ActiveEffect { get; }

Property Value

AEffect

DisableDirectionalFlipping

Override this if you would like to disable the directional flipping of the player

public virtual bool DisableDirectionalFlipping { get; }

Property Value

bool

DoOverrideStateMachineMovingVariable

public bool DoOverrideStateMachineMovingVariable { get; set; }

Property Value

bool

FinalNameRect

public Rect FinalNameRect { get; set; }

Property Value

Rect

FullNameplateRect

public Rect FullNameplateRect { get; set; }

Property Value

Rect

HasActiveEffect

public bool HasActiveEffect { get; }

Property Value

bool

InputOverride

public Vector2 InputOverride { get; set; }

Property Value

Vector2

InputThisFrame

public Vector2 InputThisFrame { get; set; }

Property Value

Vector2

IsAdmin

Is the Player an All Out admin.

public bool IsAdmin { get; }

Property Value

bool

IsLocal

public bool IsLocal { get; set; }

Property Value

bool

IsVIP

public bool IsVIP { get; }

Property Value

bool

IsValidTarget

Checks player effects for any IsValidTarget == false.

public bool IsValidTarget { get; }

Property Value

bool

LastInputs

public Vector2 LastInputs { get; set; }

Property Value

Vector2

MovementKind

The movement kind of the player. Override this to change how the player moves. Kinds: Default: WASD movement MoveToMouse: Constantly move towards the mouse

public virtual Player.PlayerMovementKind MovementKind { get; }

Property Value

Player.PlayerMovementKind

Name

The name of the player

public string Name { get; }

Property Value

string

NameOffset

Y offset of the players name.

public float NameOffset { get; set; }

Property Value

float

SpineAnimator

The animator of the player. Lovingly referred to as the "Schleem"

public Spine_Animator SpineAnimator { get; }

Property Value

Spine_Animator

StateMachineMovingVariableValue

public bool StateMachineMovingVariableValue { get; set; }

Property Value

bool

UserId

The user id of the player

public string UserId { get; }

Property Value

string

VolumeForLocalPlayer

public float VolumeForLocalPlayer { get; set; }

Property Value

float

Methods

ActivateAbility(Type, int)

public bool ActivateAbility(Type abilityType, int abilityIndex)

Parameters

abilityType Type
abilityIndex int

Returns

bool

ActivateAbility<T>(int)

public bool ActivateAbility<T>(int abilityIndex)

Parameters

abilityIndex int

Returns

bool

Type Parameters

T

AddDisableMovementInputReason(string)

Add a reason to disable movement input for the player. The players controls will be disabled if there are one or more reasons.

public void AddDisableMovementInputReason(string reason)

Parameters

reason string

AddEffectCommon(Player, Type, float?, Action<AEffect>)

Adds an effect to the player.

public AEffect AddEffectCommon(Player caster, Type effectType, float? duration = null, Action<AEffect> preInit = null)

Parameters

caster Player

[Optional] The player who cast the effect.

effectType Type

The type of effect to add.

duration float?

[Optional] The duration of the effect. If null, the effect's default duration will be used, and if that is not set then the effect will be permanent.

preInit Action<AEffect>

[Optional] A callback to run before the effect is initialized.

Returns

AEffect

The added effect.

AddEffectWithNoCeremony(Type)

public AEffect AddEffectWithNoCeremony(Type effectType)

Parameters

effectType Type

Returns

AEffect

AddEffect<T>(Player, float?, Action<T>)

Adds an effect to the player. If the effect is an active effect, it will cancel the existing active effect.

public T AddEffect<T>(Player caster = null, float? duration = null, Action<T> preInit = null) where T : AEffect

Parameters

caster Player

[Optional] The player who cast the effect.

duration float?

[Optional] The duration of the effect. If null, the effect's default duration will be used, and if that is not set then the effect will be permanent.

preInit Action<T>

[Optional] A callback to run before the effect is initialized.

Returns

T

The added effect.

Type Parameters

T

The type of effect to add.

AddEmoteBlockReason(string)

Add a reason that disallow emoting.

public void AddEmoteBlockReason(string reason)

Parameters

reason string

AddFreezeReason(string)

Add a reason to freeze the players movement. The player will not be able to move if there are one or move freeze reasons.

public void AddFreezeReason(string reason)

Parameters

reason string

AddInvisibilityReason(string)

Add a reason to make the player invisible. The player will not be visible if there are one or more invisibility reasons.

public void AddInvisibilityReason(string reason)

Parameters

reason string

AddJoystickDisableReason(string)

Hides the joystick.

public void AddJoystickDisableReason(string reason)

Parameters

reason string

AddNameInvisibilityReason(string)

Add a reason to make the players name invisible. The players name will not be visible if there are one or more name invisibility reasons.

public void AddNameInvisibilityReason(string reason)

Parameters

reason string

AddStat(string, long, Texture)

public void AddStat(string name, long startingValue, Texture icon)

Parameters

name string
startingValue long
icon Texture

CalculatePlayerVelocity(Vector2, Vector2, float)

Override this to change how player velocity is calculated. This is called every frame, and how the return value differs from the current velocity is remembered and taken into account during resimulations (client-side prediction).

[Obsolete("Use Movement_Agent.CustomVelocityCallback instead.")]
public virtual Vector2 CalculatePlayerVelocity(Vector2 currentVelocity, Vector2 input, float deltaTime)

Parameters

currentVelocity Vector2
input Vector2
deltaTime float

Returns

Vector2

CanUseAbility(Ability)

Returns whether a player is allowed to use an ability. Used in conjunction with Ability.CanUse().

public virtual bool CanUseAbility(Ability ability)

Parameters

ability Ability

Returns

bool

ClearAllEffects()

Removes all effects from the player, including the active effect.

public void ClearAllEffects()

DefaultPlayerVelocityCalculation(Vector2, Vector2, float, float)

This is the default function used to calculare player velocity. Useful to use if you want to retain default movement in some cases when overriding AO.Player.CalculatePlayerVelocity

public Vector2 DefaultPlayerVelocityCalculation(Vector2 currentVelocity, Vector2 input, float deltaTime, float accelerationMultiplier)

Parameters

currentVelocity Vector2
input Vector2
deltaTime float
accelerationMultiplier float

Returns

Vector2

DrawCircleAimingIndicator(Vector2)

public static void DrawCircleAimingIndicator(Vector2 position)

Parameters

position Vector2

DrawDefaultAbilityUI(AbilityDrawOptions)

public Player.AbilityDrawResult DrawDefaultAbilityUI(Player.AbilityDrawOptions opt)

Parameters

opt Player.AbilityDrawOptions

Returns

Player.AbilityDrawResult

DrawLineAimingIndicator(Vector2)

public void DrawLineAimingIndicator(Vector2 dir)

Parameters

dir Vector2

DrawLineAimingIndicator(Vector2, Vector2)

public static void DrawLineAimingIndicator(Vector2 dir, Vector2 worldPosition)

Parameters

dir Vector2
worldPosition Vector2

DrawMovingArrows(Rect, int, float, float)

public static void DrawMovingArrows(Rect rect, int arrowCount, float fadePercent, float fadeOutEnd)

Parameters

rect Rect
arrowCount int
fadePercent float
fadeOutEnd float

GetAbility(Type)

public Ability GetAbility(Type abilityType)

Parameters

abilityType Type

Returns

Ability

GetAbility<T>()

public T GetAbility<T>() where T : Ability

Returns

T

Type Parameters

T

GetDisableDirectionalFlipping()

Get the name of the player

public bool GetDisableDirectionalFlipping()

Returns

bool

GetEffect(Type)

public AEffect GetEffect(Type type)

Parameters

type Type

Returns

AEffect

GetEffect<T>()

Returns the effect of the given type or null if the player does not have an effect of that type.

public T GetEffect<T>() where T : AEffect

Returns

T

Type Parameters

T

GetFacingDirection()

Gets the direction the player is currently facing. True = Right. False = Left.

public bool GetFacingDirection()

Returns

bool

GetFriends()

public Friend[] GetFriends()

Returns

Friend[]

GetFriends_Internal(ulong)

public static extern Friend[] GetFriends_Internal(ulong player_entity_id)

Parameters

player_entity_id ulong

Returns

Friend[]

GetKeybindDown(Keybind)

public bool GetKeybindDown(Keybind id)

Parameters

id Keybind

Returns

bool

GetKeybindHeld(Keybind)

public bool GetKeybindHeld(Keybind id)

Parameters

id Keybind

Returns

bool

GetKeybindSprite(Keybind)

public Texture GetKeybindSprite(Keybind id)

Parameters

id Keybind

Returns

Texture

GetKeybindString(Keybind)

public string GetKeybindString(Keybind id)

Parameters

id Keybind

Returns

string

GetKeybindUp(Keybind)

public bool GetKeybindUp(Keybind id)

Parameters

id Keybind

Returns

bool

GetMousePosition()

Get the mouse position in world space. This may be called on the client and the server.

public Vector2 GetMousePosition()

Returns

Vector2

GetMovementKind()

Get the movement kind of the player

public int GetMovementKind()

Returns

int

GetSortedTargetsForAbility(Ability)

public List<Player> GetSortedTargetsForAbility(Ability ability)

Parameters

ability Ability

Returns

List<Player>

GetSpineInstanceForPlayerList()

public SpineInstance GetSpineInstanceForPlayerList()

Returns

SpineInstance

GetStat(string)

public long GetStat(string name)

Parameters

name string

Returns

long

GetWorldRect()

The world rect of the player positioned at their feet.

public Rect GetWorldRect()

Returns

Rect

GetZOffset()

public float GetZOffset()

Returns

float

HasDisableMovementInputReasons()

Remove a reason to disable movement input.

public bool HasDisableMovementInputReasons()

Returns

bool

HasEffect(Type)

Returns true if the player has an active effect of the given type, or if the player has an effect of the given type.

public bool HasEffect(Type type)

Parameters

type Type

Returns

bool

HasEffect<T>()

Returns true if the player has an active effect of the given type, or if the player has an effect of the given type.

public bool HasEffect<T>() where T : AEffect

Returns

bool

Type Parameters

T

HasFreezeReasons()

Remove a reason to freeze the players movement

public bool HasFreezeReasons()

Returns

bool

HasInvisibilityReasons()

Remove a reason to make the player invisible

public bool HasInvisibilityReasons()

Returns

bool

HasNameInvisibilityReasons()

Remove a reason to make the players name invisible

public bool HasNameInvisibilityReasons()

Returns

bool

IsInputDown(UnifiedInput)

Check if an input is down this frame. This may be called on the client and the server.

public bool IsInputDown(Input.UnifiedInput input)

Parameters

input Input.UnifiedInput

Returns

bool

IsInputHeld(UnifiedInput)

Check if an input is held. This may be called on the client and the server.

public bool IsInputHeld(Input.UnifiedInput input)

Parameters

input Input.UnifiedInput

Returns

bool

IsInputRepeat(UnifiedInput)

Check if an input is repeating. This may be called on the client and the server.

public bool IsInputRepeat(Input.UnifiedInput input)

Parameters

input Input.UnifiedInput

Returns

bool

IsInputUp(UnifiedInput)

Check if an input is up this frame. This may be called on the client and the server.

public bool IsInputUp(Input.UnifiedInput input)

Parameters

input Input.UnifiedInput

Returns

bool

OnActivatedAbility(Ability)

public virtual void OnActivatedAbility(Ability ability)

Parameters

ability Ability

PlayRandomFootstep()

public void PlayRandomFootstep()

ReadFrameData(StreamReader)

public virtual void ReadFrameData(StreamReader reader)

Parameters

reader StreamReader

RemoveDisableMovementInputReason(string)

Remove a reason to disable movement input.

public bool RemoveDisableMovementInputReason(string reason)

Parameters

reason string

Returns

bool

RemoveEffect(AEffect, bool)

Removes an effect from the player. This will remove the active effect if it matches the given effect.

public bool RemoveEffect(AEffect effect, bool interrupt)

Parameters

effect AEffect
interrupt bool

Returns

bool

RemoveEffect(Type, bool)

Removes an effect from the player. This will remove the active effect if it matches the given type.

public bool RemoveEffect(Type effectType, bool interrupt)

Parameters

effectType Type

The type of effect to remove.

interrupt bool

If true, the effect will be interrupted and its OnEffectEnd method will be called with interrupt=true.

Returns

bool

True if the effect was removed, false if it was not found.

RemoveEffect<T>(bool)

Removes an effect from the player. This will remove the active effect if it matches the given type.

public bool RemoveEffect<T>(bool interrupt) where T : AEffect

Parameters

interrupt bool

Returns

bool

Type Parameters

T

RemoveEmoteBlockReason(string)

Remove a reason that disallow emoting.

public void RemoveEmoteBlockReason(string reason)

Parameters

reason string

RemoveFreezeReason(string)

Remove a reason to freeze the players movement

public bool RemoveFreezeReason(string reason)

Parameters

reason string

Returns

bool

RemoveInvisibilityReason(string)

Remove a reason to make the player invisible

public bool RemoveInvisibilityReason(string reason)

Parameters

reason string

Returns

bool

RemoveJoystickDisableReason(string)

Un-hides the joystick.

public bool RemoveJoystickDisableReason(string reason)

Parameters

reason string

Returns

bool

RemoveNameInvisibilityReason(string)

Remove a reason to make the players name invisible

public bool RemoveNameInvisibilityReason(string reason)

Parameters

reason string

Returns

bool

RemoveStat(string)

public void RemoveStat(string name)

Parameters

name string

SetAimTarget(Vector2)

public void SetAimTarget(Vector2 target)

Parameters

target Vector2

SetChatChannel(int)

public void SetChatChannel(int channel)

Parameters

channel int

SetFacingDirection(bool)

Sets the direction you want the player to face. Should be paired with DisableDirectionalFlipping

public void SetFacingDirection(bool faceRight)

Parameters

faceRight bool

SetMouseIKEnabled(bool)

Set the mouse IK enabled.

public void SetMouseIKEnabled(bool enabled)

Parameters

enabled bool

StopActiveEffect(bool)

Stops the active effect on the player, if any.

public void StopActiveEffect(bool interrupt)

Parameters

interrupt bool

If true, the effect will be interrupted and its OnEffectEnd method will be called with interrupt=true.

StopEffect(AEffect, int, bool)

public void StopEffect(AEffect effect, int index, bool interrupt)

Parameters

effect AEffect
index int
interrupt bool

Teleport(Vector2)

Teleport the player to a position

public void Teleport(Vector2 position)

Parameters

position Vector2

TryGetEffect<T>(out T)

Returns the effect of the given type or null if the player does not have an effect of that type.

public bool TryGetEffect<T>(out T effect) where T : AEffect

Parameters

effect T

Returns

bool

Type Parameters

T

TryLocalSetCurrentTargettingAbility(Ability, int)

public bool TryLocalSetCurrentTargettingAbility(Ability ability, int index)

Parameters

ability Ability
index int

Returns

bool

UpdateStat(string, long)

public void UpdateStat(string name, long val)

Parameters

name string
val long

WriteFrameData(StreamWriter)

public virtual void WriteFrameData(StreamWriter writer)

Parameters

writer StreamWriter