Skip to main content

CCitadelPlayerPawn

Deadlock hero pawn. The in-game physical representation of a player. Provides currency, abilities, movement state, stamina, and eye angles.

public sealed class CCitadelPlayerPawn : CBasePlayerPawn

Namespace: DeadworksManaged.Api
Inherits / implements: CBasePlayerPawn
Source: Entities/CCitadelPlayerPawn.cs#L7

Properties​

CCitadelPlayerPawn.Controller​

Signature

public new CCitadelPlayerController? Controller { get; }

Source: Entities/CCitadelPlayerPawn.cs#L11

CCitadelPlayerPawn.PlayerData​

Signature

public PlayerDataGlobal? PlayerData { get; }

Source: Entities/CCitadelPlayerPawn.cs#L20

CCitadelPlayerPawn.AbilityComponent​

Signature

public CCitadelAbilityComponent AbilityComponent { get; }

Source: Entities/CCitadelPlayerPawn.cs#L23

CCitadelPlayerPawn.HeroComponent​

Signature

public CCitadelHeroComponent HeroComponent { get; }

Source: Entities/CCitadelPlayerPawn.cs#L26

CCitadelPlayerPawn.HeroID​

Signature

public Heroes HeroID { get; }

Source: Entities/CCitadelPlayerPawn.cs#L28

CCitadelPlayerPawn.InRegenerationZone​

Signature

public bool InRegenerationZone { get; }

Source: Entities/CCitadelPlayerPawn.cs#L31

CCitadelPlayerPawn.EyeAngles​

Networked eye angles (quantized to 11 bits, ~0.18 precision). Use ViewAngles for raw precision.

Signature

public Vector3 EyeAngles { get; }

Source: Entities/CCitadelPlayerPawn.cs#L35

CCitadelPlayerPawn.EyePosition​

Eye position (AbsOrigin + ViewOffset). This is where the camera sits.

Signature

public unsafe Vector3 EyePosition { get; }

Source: Entities/CCitadelPlayerPawn.cs#L39

CCitadelPlayerPawn.CameraAngles​

Which way the player's camera is facing. Save this to restore their view later with TeleportWithView.

Signature

public Vector3 CameraAngles { get; }

Source: Entities/CCitadelPlayerPawn.cs#L54

CCitadelPlayerPawn.ViewAngles​

Raw server-side view angles from CUserCmd (v_angle). Full float precision, no quantization.

Signature

public unsafe Vector3 ViewAngles { get; }

Source: Entities/CCitadelPlayerPawn.cs#L57

CCitadelPlayerPawn.Level​

Signature

public int Level { get; set; }

Source: Entities/CCitadelPlayerPawn.cs#L66

CCitadelPlayerPawn.RespawnTime​

Signature

public float RespawnTime { get; set; }

Source: Entities/CCitadelPlayerPawn.cs#L69

Methods​

CCitadelPlayerPawn.GetCurrency()​

Signature

public int GetCurrency(ECurrencyType type)

Source: Entities/CCitadelPlayerPawn.cs#L72

CCitadelPlayerPawn.SetCurrency()​

Signature

public void SetCurrency(ECurrencyType type, int value)

Source: Entities/CCitadelPlayerPawn.cs#L73

CCitadelPlayerPawn.TeleportWithView()​

Moves this hero to position and turns the player's camera to face angles. The hero arrives standing still instead of keeping their old speed.

Signature

public void TeleportWithView(Vector3 position, Vector3 angles)

Example Saving a checkpoint and sending the player back to it later:

var savedPos = pawn.Position;
var savedView = pawn.CameraAngles;
// ...
pawn.TeleportWithView(savedPos, savedView);

Source: Entities/CCitadelPlayerPawn.cs#L88

CCitadelPlayerPawn.ModifyCurrency()​

Adds or removes currency from this pawn (e.g. gold, ability points). Use negative amount to spend.

Signature

public void ModifyCurrency(ECurrencyType type, int amount, ECurrencySource source, bool silent = false, bool forceGain = false, bool spendOnly = false)

Source: Entities/CCitadelPlayerPawn.cs#L94

CCitadelPlayerPawn.ResetHero()​

Full pawn-level hero reset: clears loadout, removes items, re-adds starting abilities from VData, resets level.

Signature

public void ResetHero(bool resetAbilities = true)

Source: Entities/CCitadelPlayerPawn.cs#L104

CCitadelPlayerPawn.SwapOrReset()​

Ensures this pawn is on hero with a fresh ability loadout. Swaps via CCitadelPlayerController.SelectHero if currently on a different hero (queues the async GC swap), or calls ResetHero if already on that hero (synchronous teardown + re-init). If onReady is supplied it is registered via OnceHeroInitialized and runs once the new ability slots are populated server-side - synchronously inside this call for the same-hero path, or later (when OnHeroLoaded lands) for the async path.

Signature

public void SwapOrReset(Heroes hero, Action? onReady = null)

Source: Entities/CCitadelPlayerPawn.cs#L118

CCitadelPlayerPawn.OnceHeroInitialized()​

Runs action the next time the server populates this pawn's abilities — i.e. after CCitadelPlayerController.SelectHero settles, after ResetHero, on initial spawn, or after the resethero command. Fires exactly once. Multiple registrations are queued and dispatched in order.

Signature

public void OnceHeroInitialized(Action action)

Notes The action runs synchronously inside the native InitializeHeroOnPawn return path. For the same-hero ResetHero case this means re-entrantly during the C# call.

Source: Entities/CCitadelPlayerPawn.cs#L142

CCitadelPlayerPawn.ResetAbilityCooldown()​

Makes the ability in slot ready to use again straight away, like CCitadelBaseAbility.ResetCooldown. Returns false if the slot is empty.

Signature

public bool ResetAbilityCooldown(EAbilitySlot slot)

Source: Entities/CCitadelPlayerPawn.cs#L172

CCitadelPlayerPawn.ResetAllAbilityCooldowns()​

Makes all of this hero's abilities ready to use again straight away, like CCitadelBaseAbility.ResetCooldown. Unlike the Refresher item, this also covers items, innates and weapons, not just the hero's abilities and ultimate.

Signature

public void ResetAllAbilityCooldowns()

Source: Entities/CCitadelPlayerPawn.cs#L184

CCitadelPlayerPawn.RemoveAbility()​

Removes an ability from this pawn by internal ability name. Returns true on success.

Signature

public bool RemoveAbility(string abilityName)
public bool RemoveAbility(CCitadelBaseAbility ability)

Source: Entities/CCitadelPlayerPawn.cs#L192, Entities/CCitadelPlayerPawn.cs#L200

CCitadelPlayerPawn.AddAbility()​

Adds an ability to this pawn by internal ability name into the given slot. Returns the new ability entity, or null on failure.

Signature

public CBaseEntity? AddAbility(string abilityName, ushort slot)

Source: Entities/CCitadelPlayerPawn.cs#L205

CCitadelPlayerPawn.AddItem()​

Gives an item to this pawn by internal item name (e.g. "upgrade_sprint_booster").

Items that have to be imbued (Echo Shard, Mystic Reverb, ...) are granted unattached by this overload and do nothing until imbued - use AddItem for those.

Internal item name. Should the enhanced version of the item be given Returns the new item entity, or null on failure.

Signature

public CCitadelBaseAbility? AddItem(string itemName, bool enhanced = false)
public CCitadelBaseAbility? AddItem(string itemName, EAbilitySlot imbueSlot, bool enhanced = false)

Source: Entities/CCitadelPlayerPawn.cs#L224, Entities/CCitadelPlayerPawn.cs#L251

CCitadelPlayerPawn.TryAddItem()​

AddItem with a reason on failure. item is non-null only when the result is ImbueResult.Success.

Signature

public ImbueResult TryAddItem(string itemName, EAbilitySlot imbueSlot, out CCitadelBaseAbility? item, bool enhanced = false)

Source: Entities/CCitadelPlayerPawn.cs#L260

CCitadelPlayerPawn.ImbueItem()​

Imbues an item this pawn already owns into the ability in slot. Imbuing into an ability the item is already imbued into is a no-op that reports ImbueResult.Success.

Signature

public ImbueResult ImbueItem(string itemName, EAbilitySlot slot)
public ImbueResult ImbueItem(CCitadelBaseAbility item, EAbilitySlot slot)

Source: Entities/CCitadelPlayerPawn.cs#L290, Entities/CCitadelPlayerPawn.cs#L300

CCitadelPlayerPawn.CanImbue()​

True when itemName can be imbued into the ability this pawn has in slot. False for non-imbuable items, empty slots and pairings the game rejects (an ultimate-restricted item aimed at the ultimate, an active item aimed at a passive).

Signature

public bool CanImbue(string itemName, EAbilitySlot slot)

Source: Entities/CCitadelPlayerPawn.cs#L316

CCitadelPlayerPawn.RemoveItem()​

Removes an item from this pawn by name, using the ability removal path. This bypasses sell checks and does not refund gold - it directly removes the item entity from the ability component, slot table, and network state. Returns true on success.

Signature

public bool RemoveItem(string itemName)

Source: Entities/CCitadelPlayerPawn.cs#L327

CCitadelPlayerPawn.ExecuteAbilityBySlot()​

Executes the ability in the given slot on this pawn's ability component.

Signature

public int ExecuteAbilityBySlot(EAbilitySlot slot, bool altCast = false, byte flags = 0)

Source: Entities/CCitadelPlayerPawn.cs#L332

CCitadelPlayerPawn.ExecuteAbilityByID()​

Executes an ability by its runtime ability ID on this pawn's ability component.

Signature

public int ExecuteAbilityByID(int abilityID, bool altCast = false, byte flags = 0)

Source: Entities/CCitadelPlayerPawn.cs#L337

CCitadelPlayerPawn.ExecuteAbility()​

Executes a specific ability entity on this pawn's ability component.

Signature

public int ExecuteAbility(CBaseEntity ability, bool altCast = false, byte flags = 0)

Source: Entities/CCitadelPlayerPawn.cs#L342

CCitadelPlayerPawn.GetAbilityBySlot()​

Gets the ability entity in the given slot from this pawn's ability component.

Signature

public CBaseEntity? GetAbilityBySlot(EAbilitySlot slot)

Source: Entities/CCitadelPlayerPawn.cs#L347

CCitadelPlayerPawn.ToggleActivate()​

Activates or deactivates an ability on this pawn (toggle). This is the actual activation path for most abilities.

Signature

public void ToggleActivate(CBaseEntity ability, bool activate = true)

Source: Entities/CCitadelPlayerPawn.cs#L352

CCitadelPlayerPawn.GetStamina()​

Current stamina value (m_flCurrentValue on m_ResourceStamina).

Signature

public float GetStamina()

Source: Entities/CCitadelPlayerPawn.cs#L357

CCitadelPlayerPawn.SetStamina()​

Helper to set stamina properly.

Signature

public void SetStamina(float value)

Source: Entities/CCitadelPlayerPawn.cs#L360

CCitadelPlayerPawn.SellItem()​

Sells an item from this pawn by internal item name. This always refunds gold (at normal or full sell price) and will fail for items that cannot be sold. Internal item name (e.g. "upgrade_sprint_booster"). If true, skips partial sell-back tracking (item treated as fully refunded). If true, forces the item to sell at full sell price even if conditions aren't met. Returns true on success, false if the item was not found or cannot be sold.

Signature

public bool SellItem(string itemName, bool fullRefund = false, bool forceSellPrice = false)

Source: Entities/CCitadelPlayerPawn.cs#L375