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.BotBrain​

The bot's brain, or null if this hero isn't a bot's.

Signature

public CCitadelPlayerBotNPCBrain? BotBrain { get; }

Source: Entities/CCitadelPlayerPawn.cs#L23

CCitadelPlayerPawn.BotLane​

Lane the bot pushes, or LaneColor.Invalid for none.

Signature

public LaneColor BotLane { get; }

Source: Entities/CCitadelPlayerPawn.cs#L31

CCitadelPlayerPawn.BotDifficulty​

The bot's difficulty, or null if this hero isn't a bot's.

Signature

public BotDifficulty? BotDifficulty { get; }

Source: Entities/CCitadelPlayerPawn.cs#L42

CCitadelPlayerPawn.AbilityComponent​

Signature

public CCitadelAbilityComponent AbilityComponent { get; }

Source: Entities/CCitadelPlayerPawn.cs#L50

CCitadelPlayerPawn.HeroComponent​

Signature

public CCitadelHeroComponent HeroComponent { get; }

Source: Entities/CCitadelPlayerPawn.cs#L53

CCitadelPlayerPawn.HeroID​

Signature

public Heroes HeroID { get; }

Source: Entities/CCitadelPlayerPawn.cs#L55

CCitadelPlayerPawn.InRegenerationZone​

Signature

public bool InRegenerationZone { get; }

Source: Entities/CCitadelPlayerPawn.cs#L58

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#L62

CCitadelPlayerPawn.EyePosition​

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

Signature

public unsafe Vector3 EyePosition { get; }

Source: Entities/CCitadelPlayerPawn.cs#L66

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#L81

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#L84

CCitadelPlayerPawn.Level​

Signature

public int Level { get; set; }

Source: Entities/CCitadelPlayerPawn.cs#L93

CCitadelPlayerPawn.RespawnTime​

Signature

public float RespawnTime { get; set; }

Source: Entities/CCitadelPlayerPawn.cs#L96

Methods​

CCitadelPlayerPawn.SetBotLane()​

Sets the lane the bot pushes while Bots.AiEnabled is on. Returns false if this hero isn't a bot's.

Signature

public bool SetBotLane(LaneColor lane)

Notes CCitadelPlayerController.AssignedLane may not update. Read BotLane instead.

Source: Entities/CCitadelPlayerPawn.cs#L37

CCitadelPlayerPawn.GetCurrency()​

Signature

public int GetCurrency(ECurrencyType type)

Source: Entities/CCitadelPlayerPawn.cs#L99

CCitadelPlayerPawn.SetCurrency()​

Signature

public void SetCurrency(ECurrencyType type, int value)

Source: Entities/CCitadelPlayerPawn.cs#L100

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#L115

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#L121

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#L131

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#L145

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#L169

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#L199

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#L211

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#L219, Entities/CCitadelPlayerPawn.cs#L227

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#L232

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.

Signature

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

Parameters

  • itemName: Internal item name.
  • enhanced: Should the enhanced version of the item be given
  • corrupted: Should the corrupted version of the item be given. Items without a corrupted version are unaffected.

Returns The new item entity, or null on failure.

Source: Entities/CCitadelPlayerPawn.cs#L252, Entities/CCitadelPlayerPawn.cs#L265, Entities/CCitadelPlayerPawn.cs#L284, Entities/CCitadelPlayerPawn.cs#L291

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, bool corrupted = false)
public ImbueResult TryAddItem(string itemName, EAbilitySlot imbueSlot, out CCitadelBaseAbility? item, bool enhanced)

Source: Entities/CCitadelPlayerPawn.cs#L297, Entities/CCitadelPlayerPawn.cs#L324

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#L332, Entities/CCitadelPlayerPawn.cs#L342

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#L358

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#L369

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#L374

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#L379

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#L384

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#L389

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#L394

CCitadelPlayerPawn.GetStamina()​

Current stamina value (m_flCurrentValue on m_ResourceStamina).

Signature

public float GetStamina()

Source: Entities/CCitadelPlayerPawn.cs#L399

CCitadelPlayerPawn.SetStamina()​

Helper to set stamina properly.

Signature

public void SetStamina(float value)

Source: Entities/CCitadelPlayerPawn.cs#L402

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#L417