Anvil
Loading...
Searching...
No Matches
Anvil.API.NwPlayer Class Referencesealed

A player client connected to the server. More...

+ Inheritance diagram for Anvil.API.NwPlayer:
+ Collaboration diagram for Anvil.API.NwPlayer:

Public Member Functions

async Task ActionExamine (NwGameObject target)
 Shows an examine dialog for the specified target.
 
async Task ActionStartConversation (NwGameObject converseWith, string dialogResRef="", bool isPrivate=false, bool playHello=true)
 Starts a conversation with another object, typically a creature.
 
int AddCustomJournalEntry (JournalEntry entryData, bool silentUpdate=false)
 Adds/updates a journal entry.
 
void AddHenchmen (NwCreature henchmen)
 Attaches the specified creature to the player as a henchmen.
 
void AddJournalQuestEntry (string categoryTag, int entryId, bool allPartyMembers=true, bool allowOverrideHigher=false)
 Adds an entry to the player's journal.
 
void AddLoopingVisualEffect (NwGameObject gameObject, VisualEffectTableEntry visualEffect)
 Adds the specified visual effect to an object, but only visible to this player.
 
void AddToParty (NwPlayer partyLeader)
 Adds the player to the specified party leader's party.
 
void ApplyInstantVisualEffectToObject (VfxType visualEffect, NwGameObject target)
 Plays the specified "instant" VFX (Com*, FNF*, IMP*) on the target for this player only.
 
void AttachCamera (NwGameObject target, bool findCleanView=false)
 Attaches this player's camera to the specified game object. The object must be in the same area, and within visible distance.
 
void BootPlayer (string reason="")
 Boots the player from the server.
 
void CancelTargetMode ()
 Cancels any cursor targeting mode the player is currently in.
 
void ClearLoopingVisualEffects (NwGameObject gameObject)
 Clears looping visual effects on the specified object visible only to this player.
 
void ClearObjectNameOverride (NwGameObject gameObject)
 Clears an override name for the specified object.
 
void ClearPlayerNameOverride (bool clearAll=false)
 Clears an overridden player character name.
 
void ClearPlayerNameOverride (NwPlayer observer)
 Clears an overridden player character name for a specific observer.
 
void ClearTextureOverride (string texName)
 Removes the override for the specified texture, reverting to the original texture.
 
async Task Delete (string kickMessage, bool preserveBackup=true)
 Immediately kicks the player and deletes their character file (.bic).
 
void DestroySQLDatabase ()
 Immediately destroys the database attached to this player, clearing out all data and schema.
This operation is immediate and irreversible, even when inside a transaction or running query.
Existing active/prepared sqlqueries will remain functional, but any references to stored data or schema members will be invalidated.
 
void DisplayFloatingTextStringOnCreature (NwCreature target, string text)
 
void DMPossessCreature (NwCreature creature, bool impersonate=false)
 If this player is a DM, causes them to possess the specified creature.
 
void EnterCutsceneMode (bool allowLeftClick=false)
 Enters "Cutscene" mode, disabling GUI and camera controls for the player and marking them as plot object (invulnerable).
See Effect.CutsceneGhost, and other Cutscene* effects for hiding and controlling the player creature during cutscene mode.
 
void EnterTargetMode (Action< ModuleEvents.OnPlayerTarget > handler, TargetModeSettings? settings=null)
 Triggers the player to enter cursor targeting mode, invoking the specified handler once the player selects something.
 
bool Equals (NwPlayer? other)
 
override bool Equals (object? obj)
 
void ExitCutsceneMode ()
 Exits "Cutscene" mode, restoring standard GUI and camera controls to the player, and restoring their plot flag.
 
void ExportCharacter ()
 Forces the player's character to saved and exported to its respective directory (LocalVault, ServerVault, etc).
 
void FadeFromBlack (float fadeSpeed)
 Fades the screen for a given player from black to regular screen.
 
void FadeToBlack (float fadeSpeed)
 Fades the screen for a given player from a regular screen to black.
 
void FloatingTextString (string message, bool broadcastToParty=true, bool chatWindow=true)
 Briefly displays a floating text message above the player's head.
 
void FloatingTextStrRef (int strRef, bool broadcastToParty=true, bool chatWindow=true)
 Briefly displays a floating text message above the player's head using the specified string reference.
 
void ForceAreaReload ()
 Forces this player to reload their current area.
 
void ForceExamine (NwGameObject target)
 Forces the player to examine the specified game object.
Works on NwCreature, NwPlaceable, NwItem and NwDoor.
Does nothing for other object types.
 
unsafe? byte[] GetAreaExplorationState (NwArea? area)
 Gets this player's area exploration state for the specified area.
 
GetCampaignVariable< T > (string campaign, string name)
 Gets the specified campaign variable for the player.
 
int GetDeviceProperty (PlayerDeviceProperty property)
 Gets the specified device property/capability as advertised by the client.
 
override int GetHashCode ()
 
JournalEntryGetJournalEntry (string questTag)
 Gets an existing journal entry with the specified quest tag.
 
List< VisualEffectTableEntry >? GetLoopingVisualEffects (NwGameObject gameObject)
 Gets a list of visual effects for the specified object visible only to this player.
 
string? GetObjectNameOverride (NwGameObject gameObject)
 Gets the current name override set for the specified object.
 
Dictionary< NwPlayer, PlayerNameOverride > GetOverridesForObserver (bool includeGlobal=false)
 Gets a list of all name overrides for the specified observer.
 
VisibilityMode GetPersonalVisibilityOverride (NwGameObject target)
 Gets the visiblity override for the specified object for this player.
 
PlayerNameOverride? GetPlayerNameOverride (NwPlayer? observer=null)
 Gets the current name override set for the specified player.
 
void GiveXp (int xPAmount)
 Gives the specified XP to the player, adjusted by any multiclass penalty.
 
void LockCameraDirection (bool isLocked=true)
 Locks the player's camera direction to its current direction, or unlocks the player's camera direction to enable it to move freely again.
 
void LockCameraDistance (bool isLocked=true)
 Locks the player's camera distance to its current distance setting, or unlocks the player's camera distance.
 
void LockCameraPitch (bool isLocked=true)
 Locks the player's camera pitch to its current pitch setting, or unlocks the player's camera pitch.
 
void NightToDay (TimeSpan delayTransitionTime=default)
 Changes the current Day/Night cycle for the player to daylight.
 
void OpenInventory ()
 Instructs the player to open their inventory.
 
void OpenInventory (NwCreature target)
 Opens the specified creatures inventory, and shows it to the player.

 
void OpenInventory (NwPlaceable target)
 Forces the player to open the inventory of the specified placeable.
 
void PlaySound (string sound, NwGameObject? target=null)
 Plays the specified sound at the target in the current area for this player only.
 
void PopUpDeathPanel (bool respawnButton=true, bool waitForHelp=true, int helpStringRef=0, string helpString="")
 Displays a death panel that can turn off the "Respawn" or "Wait for Help" buttons.
The "Wait for Help" button is only enabled when the game is running in multiplayer mode.
By default if helpString isn't specified, the value used is "Choose an option below.<br/> Respawning will incur a penalty of 50 XP per level of your character and the loss of 10% of your gold."
(strref 66219 single player, 6600 for multiplayer).

 
void PopUpGUIPanel (GUIPanel panel=GUIPanel.Death)
 Displays a GUI panel to a player.
 
void PostString (string message, int xPos, int yPos, ScreenAnchor anchor, float life, Color? start=null, Color? end=null, int id=0, string font="")
 Displays a message on the player's screen.
The message is always displayed on top of whatever is on the screen, including UI elements.
 
SQLQuery PrepareSQLQuery (string query)
 Sets up a SQL Query for this player.
This will NOT run the query; only make it available for parameter binding.
To run the query, you need to call SQLQuery.Execute even if you do not expect result data.

 
unsafe void RefreshClientObject (NwGameObject gameObject)
 Causes this player to refresh the client object associated with the given game object.
 
void RefreshPlayerClientObject ()
 Causes this player to refresh the player client object associated with their current controlled creature.
 
void RemoveFromCurrentParty ()
 Removes the player from their current party.
 
async Task RestoreCameraFacing ()
 Restores the camera mode and facing to what they where when StoreCameraFacing was last called.
RestoreCameraFacing can only be used once, and must correspond to a previous call to StoreCameraFacing.
 
void SeekAudioStream (AudioStreamIdentifier streamIdentifier, float seekOffset)
 Seeks the audio stream with the specified identifier to a new position on the currently playing audio track.
 
void SendServerMessage (string message)
 
void SendServerMessage (string message, Color color)
 Sends a server message to the player.
 
void SendToServer (string ipAddress="", string password="", string waypointTag="", bool seamless=false)
 Sends the player to a new server, where the player's character will connect and log in.
 
byte?[] Serialize (bool stripPCFlags=false)
 
void SetAreaExplorationState (NwArea area, bool explored)
 Sets whether the player has explored an area.
 
unsafe void SetAreaExplorationState (NwArea area, byte[] newState)
 Sets this player's area exploration state for the specified area.
 
void SetAudioStreamPaused (AudioStreamIdentifier streamIdentifier, bool paused, TimeSpan fadeTime=default)
 Pauses/Unpauses the audio stream on the specified identifier.
 
void SetAudioStreamVolume (AudioStreamIdentifier streamIdentifier, float volume=1.0f, TimeSpan fadeTime=default)
 Changes the volume of the audio stream with the specified identifier.
 
async Task SetCameraFacing (float direction, float pitch=-1.0f, float distance=-1.0f, CameraTransitionType transitionType=CameraTransitionType.Snap)
 Changes the direction the player's camera is facing.
 
void SetCameraLimits (float minPitch=-1.0f, float maxPitch=-1.0f, float minDist=-1.0f, float maxDist=-1.0f)
 Sets camera limits that override any client configuration.
A value of -1 means to use the client limits.
 
void SetCutsceneMode (bool inCutscene=true, bool leftClickEnabled=false)
 Toggles the CutsceneMode state for the player.
 
void SetGuiPanelDisabled (GUIPanel panel, bool disabled, NwGameObject? targetObject=null)
 Disable a specific gui panel for this player.
Will close the GUI panel if it is currently open.
Will fire a GuiEventType.DisabledPanelAttemptOpen event for some panels if a player attempts to open them while disabled.
 
void SetObjectNameOverride (NwGameObject gameObject, string name)
 Sets an override name for a specific game object, as visible from this player.
Supports placeables, doors, items and creatures.
 
void SetPCReputation (bool like, NwPlayer target)
 Sets if the player should like, or unlike the specified player.
 
void SetPersonalVisibilityOverride (NwGameObject target, VisibilityMode visibilityMode)
 Sets the visiblity override for the specified object for this player.
 
void SetPlayerNameOverride (PlayerNameOverride nameOverride)
 Sets an override player character name and community name on the player list for all players. Is not persistent.
 
void SetPlayerNameOverride (PlayerNameOverride nameOverride, NwPlayer observer)
 Sets an override player character name and community name on the player list as observed by a specific player. Is not persistent.
 
void SetShaderUniform (ShaderUniform uniform, float value)
 Sets a global shader uniform for this player.
These uniforms are not used by the base game and are reserved for module-specific scripting.
You need to add custom shaders that will make use of them.
In multiplayer, these need to be reapplied when a player rejoins.
 
void SetShaderUniform (ShaderUniform uniform, int value)
 Sets a global shader uniform for this player.
These uniforms are not used by the base game and are reserved for module-specific scripting.
You need to add custom shaders that will make use of them.
In multiplayer, these need to be reapplied when a player rejoins.
 
void SetShaderUniform (ShaderUniform uniform, Vector4 value)
 Sets a global shader uniform for this player.
These uniforms are not used by the base game and are reserved for module-specific scripting.
You need to add custom shaders that will make use of them.
In multiplayer, these need to be reapplied when a player rejoins.
 
void SetSpellTargetingData (TargetingData data)
 Sets a spell targeting data override for this player.
 
void SetTextureOverride (string oldTexName, string newTexName)
 Makes ControlledCreature PC load a new texture instead of another.
 
void ShowVisualEffect (VfxType effectType, Vector3 position)
 Plays the specified VFX at the target position in the current area for this player only.
 
void StartAudioStream (AudioStreamIdentifier streamIdentifier, string resRef, bool looping=false, TimeSpan fadeTime=default, float seekOffset=-1f, float volume=1f)
 Assign one of the available audio streams to play a specific file. This mechanism can be used
to replace regular music playback, and synchronize it between clients.
 
void StopAudioStream (AudioStreamIdentifier streamIdentifier, TimeSpan fadeTime=default)
 Stops the audio stream playing on the specified identifier.
 
void StopFade ()
 Removes any current fading effects or black screen from the monitor of the player.
 
async Task StoreCameraFacing ()
 Stores (bookmarks) the camera's facing and position so it can be restored later with RestoreCameraFacing.

 
bool TryCreateNuiWindow (NuiWindow window, out NuiWindowToken token, string windowId="")
 Create a NUI window for this player.
 
bool TryEnterTargetMode (Action< ModuleEvents.OnPlayerTarget > handler, TargetModeSettings? settings=null)
 Attempts to get this player to enter cursor targeting mode, invoking the specified handler once the player selects something.
If the player is already in targeting mode, the existing handler will not be cleared.
 
void UnlockAchievement (string achievementId, int lastValue=0, int currentValue=0, int maxValue=0)
 Unlock an achievement for the player who must be logged in.
 
void UnpossessCreature ()
 If this player is possessing a creature, instructs them to unpossess them.
 
async Task UpdateCharacterSheet ()
 Refreshes the player's character sheet.
 
void Vibrate (VibratorMotor motor, float strength, TimeSpan duration)
 Vibrates the player's device or controller. Does nothing if vibration is not supported.
 

Static Public Member Functions

static implicit operator CNWSPlayer? (NwPlayer? player)
 
static bool operator!= (NwPlayer? left, NwPlayer? right)
 
static bool operator== (NwPlayer? left, NwPlayer? right)
 

Properties

string BicFileName [get]
 Gets the name of the player's .bic file.
 
CameraFlag CameraFlags [set]
 Sets camera settings that override any client configuration settings.
 
float CameraHeight [set]
 Sets the camera height for this player.
 
string CDKey [get]
 Gets the public part of the CD key that the player used when logging in.
 
Version ClientVersion [get]
 Gets the player's client version (Major + Minor + Build).
 
string ClientVersionCommitSha1 [get]
 Gets the player's client version, as a Sha1 commit hash.
 
NwCreatureControlledCreature [get]
 Gets the creature this player is currently controlling.
This will return the player's current possessed creature (familiar, DM possession), otherwise their player character if they are currently not possessing a creature.
 
float CutsceneCameraMoveRate [get, set]
 Gets or sets the movement rate factor for the cutscene camera following ControlledCreature 'camera man'.
 
string IPAddress [get]
 Gets the connecting IP address for the player.
 
bool IsConnected [get]
 Gets if this player is connected and playing (true), or if this player is still on character selection or connecting (false).
 
bool IsConnectionRelayed [get]
 Gets a value indicating whether the player has connected to the server over a relay (instead of directly).
 
bool IsDM [get]
 Gets a value indicating whether the player is a Dungeon Master.
 
bool IsInCursorTargetMode [get]
 Gets if this player is in cursor targeting mode.
NOTE! Only works if the player entered target mode using TryEnterTargetMode.
 
bool IsInCutsceneMode [get]
 Gets a value indicating whether ControlledCreature creature is currently in "Cutscene" mode.
 
bool IsPlayerDM [get, set]
 Gets or sets whether the player has DM privileges gained through a player login (as opposed to the DM client).
 
bool IsValid [get]
 Gets a value indicating whether this NwPlayer object is valid.
Returns false after the player disconnects from the server.
 
PlayerLanguage Language [get]
 Gets the language configured by this player.
 
int Latency [get]
 Gets the last latency/"ping" result for this player. Results are updated every 6000 milliseconds.
Returns 0 for unsupported clients.
 
int LatencyAverage [get]
 Gets this player's smoothed/average latency. This is a moving calculation that may change in future game releases.
Returns 0 for unsupported clients.
 
NwCreatureLoginCreature [get]
 Gets the original creature that this player logged in with.
 
IEnumerable< NwPlayerPartyMembers [get]
 Gets all players in this player's party (including themself).
Associates are not included. Use LoginCreature.Faction.GetMembers() for a list of all party members, including associate creatures.
 
PlayerPlatform Platform [get]
 Gets the platform this player is currently playing from.
 
uint PlayerId [get]
 Gets the unique numeric ID of this player.
 
string PlayerName [get]
 Gets the player's login name.
 
TimeSpan? RestDurationOverride [get, set]
 Gets or sets a custom rest duration for this player.
Null indicates that no override is set. Assign null to use the default rest duration.
 
LocationSpawnLocation [get, set]
 Gets or sets the location that this player will spawn at when logging in to the server.
 

Events

Action< OnBarterEndOnBarterEnd [add, remove]
 
Action< OnBarterStartOnBarterStart [add, remove]
 
Action< OnClientDisconnectOnClientDisconnect [add, remove]
 
Action< ModuleEvents.OnClientEnterOnClientEnter [add, remove]
 
Action< ModuleEvents.OnClientLeaveOnClientLeave [add, remove]
 
Action< OnClientLevelUpBeginOnClientLevelUpBegin [add, remove]
 
Action< OnCombatStatusChangeOnCombatStatusChange [add, remove]
 
Action< ModuleEvents.OnCutsceneAbortOnCutsceneAbort [add, remove]
 
Action< OnDMAppear > OnDMAppear [add, remove]
 
Action< OnDMChangeDifficultyOnDMChangeDifficulty [add, remove]
 
Action< OnDMDisableTrap > OnDMDisableTrap [add, remove]
 
Action< OnDMDisappear > OnDMDisappear [add, remove]
 
Action< OnDMDumpLocalsOnDMDumpLocals [add, remove]
 
Action< OnDMForceRest > OnDMForceRest [add, remove]
 
Action< OnDMGetFactionReputation > OnDMGetFactionReputation [add, remove]
 
Action< OnDMGetVariable > OnDMGetVariable [add, remove]
 
Action< OnDMGiveAlignmentOnDMGiveAlignment [add, remove]
 
Action< OnDMGiveGold > OnDMGiveGold [add, remove]
 
Action< OnDMGiveItemOnDMGiveItem [add, remove]
 
Action< OnDMGiveLevel > OnDMGiveLevel [add, remove]
 
Action< OnDMGiveXP > OnDMGiveXP [add, remove]
 
Action< OnDMGoTo > OnDMGoTo [add, remove]
 
Action< OnDMHeal > OnDMHeal [add, remove]
 
Action< OnDMJumpAllPlayersToPoint > OnDMJumpAllPlayersToPoint [add, remove]
 
Action< OnDMJumpTargetToPointOnDMJumpTargetToPoint [add, remove]
 
Action< OnDMJumpToPoint > OnDMJumpToPoint [add, remove]
 
Action< OnDMKill > OnDMKill [add, remove]
 
Action< OnDMLimbo > OnDMLimbo [add, remove]
 
Action< OnDMPlayerDMLoginOnDMPlayerDMLogin [add, remove]
 
Action< OnDMPlayerDMLogout > OnDMPlayerDMLogout [add, remove]
 
Action< OnDMPossess > OnDMPossess [add, remove]
 
Action< OnDMPossessFullPower > OnDMPossessFullPower [add, remove]
 
Action< OnDMSetDate > OnDMSetDate [add, remove]
 
Action< OnDMSetFaction > OnDMSetFaction [add, remove]
 
Action< OnDMSetFactionReputation > OnDMSetFactionReputation [add, remove]
 
Action< OnDMSetStat > OnDMSetStat [add, remove]
 
Action< OnDMSetTime > OnDMSetTime [add, remove]
 
Action< OnDMSetVariable > OnDMSetVariable [add, remove]
 
Action< OnDMSpawnObjectOnDMSpawnObject [add, remove]
 
Action< OnDMSpawnTrapOnObjectOnDMSpawnTrapOnObject [add, remove]
 
Action< OnDMTakeItem > OnDMTakeItem [add, remove]
 
Action< OnDMToggleAI > OnDMToggleAI [add, remove]
 
Action< OnDMToggleImmortal > OnDMToggleImmortal [add, remove]
 
Action< OnDMToggleInvulnerable > OnDMToggleInvulnerable [add, remove]
 
Action< OnDMToggleLock > OnDMToggleLock [add, remove]
 
Action< OnDMViewInventoryOnDMViewInventory [add, remove]
 
Action< OnExamineObjectOnExamineObject [add, remove]
 
Action< OnExamineTrapOnExamineTrap [add, remove]
 
Action< OnMapPinAddPinOnMapPinAddPin [add, remove]
 
Action< OnMapPinChangePinOnMapPinChangePin [add, remove]
 
Action< OnMapPinDestroyPinOnMapPinDestroyPin [add, remove]
 
Action< ModuleEvents.OnNuiEventOnNuiEvent [add, remove]
 
Action< OnPartyEventOnPartyEvent [add, remove]
 
Action< ModuleEvents.OnPlayerChatOnPlayerChat [add, remove]
 
Action< ModuleEvents.OnPlayerDeathOnPlayerDeath [add, remove]
 
Action< ModuleEvents.OnPlayerDyingOnPlayerDying [add, remove]
 
Action< ModuleEvents.OnPlayerEquipItemOnPlayerEquipItem [add, remove]
 
Action< ModuleEvents.OnPlayerGuiEventOnPlayerGuiEvent [add, remove]
 
Action< ModuleEvents.OnPlayerLevelUpOnPlayerLevelUp [add, remove]
 
Action< OnPlayerQuickChatOnPlayerQuickChat [add, remove]
 
Action< ModuleEvents.OnPlayerRespawnOnPlayerRespawn [add, remove]
 
Action< ModuleEvents.OnPlayerRestOnPlayerRest [add, remove]
 
Action< ModuleEvents.OnPlayerTargetOnPlayerTarget [add, remove]
 
Action< ModuleEvents.OnPlayerTileActionOnPlayerTileAction [add, remove]
 
Action< ModuleEvents.OnPlayerUnequipItemOnPlayerUnequipItem [add, remove]
 
Action< OnServerCharacterSaveOnServerCharacterSave [add, remove]
 
Action< OnServerSendAreaOnServerSendArea [add, remove]
 

Detailed Description

A player client connected to the server.

Member Function Documentation

◆ ActionExamine()

async Task Anvil.API.NwPlayer.ActionExamine ( NwGameObject target)
inline

Shows an examine dialog for the specified target.

Parameters
targetThe target to examine.

◆ ActionStartConversation()

async Task Anvil.API.NwPlayer.ActionStartConversation ( NwGameObject converseWith,
string dialogResRef = "",
bool isPrivate = false,
bool playHello = true )
inline

Starts a conversation with another object, typically a creature.

Parameters
converseWithThe target object to converse with.
dialogResRefThe dialogue to start. If ControlledCreature is unset, the target's own dialogue file will be used.
isPrivateWhether ControlledCreature dialogue should be visible to all nearby players, or visible to the player only.
playHelloWhether the hello/greeting should be played once the dialogue starts.

◆ AddCustomJournalEntry()

int Anvil.API.NwPlayer.AddCustomJournalEntry ( JournalEntry entryData,
bool silentUpdate = false )
inline

Adds/updates a journal entry.

Parameters
entryDataThe new/updated journal entry.
silentUpdatefalse = Notify player via sound effects and feedback message, true = Suppress sound effects and feedback message
Returns
A positive number to indicate the new amount of journal entries on the player, -1 on an error.

◆ AddHenchmen()

void Anvil.API.NwPlayer.AddHenchmen ( NwCreature henchmen)
inline

Attaches the specified creature to the player as a henchmen.

Parameters
henchmenThe henchmen to attach to the player.

◆ AddJournalQuestEntry()

void Anvil.API.NwPlayer.AddJournalQuestEntry ( string categoryTag,
int entryId,
bool allPartyMembers = true,
bool allowOverrideHigher = false )
inline

Adds an entry to the player's journal.

Parameters
categoryTagThe tag of the Journal category (case-sensitive).
entryIdThe ID of the Journal entry.
allPartyMembersIf true, ControlledCreature entry is added to all players in the player's party.
allowOverrideHigherIf true, disables the default restriction that requires journal entry numbers to increase.

◆ AddLoopingVisualEffect()

void Anvil.API.NwPlayer.AddLoopingVisualEffect ( NwGameObject gameObject,
VisualEffectTableEntry visualEffect )
inline

Adds the specified visual effect to an object, but only visible to this player.

Parameters
gameObjectThe game object to apply the effect to.
visualEffectThe visual effect to apply.

◆ AddToParty()

void Anvil.API.NwPlayer.AddToParty ( NwPlayer partyLeader)
inline

Adds the player to the specified party leader's party.

Parameters
partyLeaderThe party leader of the party to join.

◆ ApplyInstantVisualEffectToObject()

void Anvil.API.NwPlayer.ApplyInstantVisualEffectToObject ( VfxType visualEffect,
NwGameObject target )
inline

Plays the specified "instant" VFX (Com*, FNF*, IMP*) on the target for this player only.

Parameters
visualEffectThe effect to play.
targetThe target object to play the effect upon.

◆ AttachCamera()

void Anvil.API.NwPlayer.AttachCamera ( NwGameObject target,
bool findCleanView = false )
inline

Attaches this player's camera to the specified game object. The object must be in the same area, and within visible distance.

Parameters
targetThe target object.
findCleanViewIf true, the client will attempt to find a camera position where the target is in view.

◆ BootPlayer()

void Anvil.API.NwPlayer.BootPlayer ( string reason = "")
inline

Boots the player from the server.

Parameters
reasonAn optional message to show to the player.

◆ ClearLoopingVisualEffects()

void Anvil.API.NwPlayer.ClearLoopingVisualEffects ( NwGameObject gameObject)
inline

Clears looping visual effects on the specified object visible only to this player.

Parameters
gameObjectThe object to clear visual effects form.

◆ ClearObjectNameOverride()

void Anvil.API.NwPlayer.ClearObjectNameOverride ( NwGameObject gameObject)
inline

Clears an override name for the specified object.

Parameters
gameObjectThe object whose overriden name will be cleared.

◆ ClearPlayerNameOverride() [1/2]

void Anvil.API.NwPlayer.ClearPlayerNameOverride ( bool clearAll = false)
inline

Clears an overridden player character name.

Parameters
clearAllIf true, both global and any personal overrides will be cleared for that target player.

◆ ClearPlayerNameOverride() [2/2]

void Anvil.API.NwPlayer.ClearPlayerNameOverride ( NwPlayer observer)
inline

Clears an overridden player character name for a specific observer.

Parameters
observerThe observer whose overriden name of target is being cleared.

◆ ClearTextureOverride()

void Anvil.API.NwPlayer.ClearTextureOverride ( string texName)
inline

Removes the override for the specified texture, reverting to the original texture.

Parameters
texNameThe name of the original texture.

◆ Delete()

async Task Anvil.API.NwPlayer.Delete ( string kickMessage,
bool preserveBackup = true )
inline

Immediately kicks the player and deletes their character file (.bic).

Parameters
kickMessageThe kick message to show to the player.
preserveBackupIf true, instead of being deleted it will be renamed to be hidden from the character list, but remain in the vault directory.

◆ DMPossessCreature()

void Anvil.API.NwPlayer.DMPossessCreature ( NwCreature creature,
bool impersonate = false )
inline

If this player is a DM, causes them to possess the specified creature.

Parameters
creature
impersonateTrue if the DM should retain their full powers during possession, false if they get the creature's powers.
Exceptions
InvalidOperationExceptionThrown if the player is not a DM, or the creature is already possessed by another player.

◆ EnterCutsceneMode()

void Anvil.API.NwPlayer.EnterCutsceneMode ( bool allowLeftClick = false)
inline

Enters "Cutscene" mode, disabling GUI and camera controls for the player and marking them as plot object (invulnerable).
See Effect.CutsceneGhost, and other Cutscene* effects for hiding and controlling the player creature during cutscene mode.

Parameters
allowLeftClickIf true, allows the player to interact with the game world using the left mouse button only. Otherwise, prevents all interactions.

◆ EnterTargetMode()

void Anvil.API.NwPlayer.EnterTargetMode ( Action< ModuleEvents.OnPlayerTarget > handler,
TargetModeSettings? settings = null )
inline

Triggers the player to enter cursor targeting mode, invoking the specified handler once the player selects something.

Parameters
handlerThe lamda/method to invoke once this player selects something.
settingsDisplay and behaviour options for the target mode.

◆ FadeFromBlack()

void Anvil.API.NwPlayer.FadeFromBlack ( float fadeSpeed)
inline

Fades the screen for a given player from black to regular screen.

Parameters
fadeSpeedDetermines how fast the fade occurs.

◆ FadeToBlack()

void Anvil.API.NwPlayer.FadeToBlack ( float fadeSpeed)
inline

Fades the screen for a given player from a regular screen to black.

Parameters
fadeSpeedDetermines how fast the fade occurs.

◆ FloatingTextString()

void Anvil.API.NwPlayer.FloatingTextString ( string message,
bool broadcastToParty = true,
bool chatWindow = true )
inline

Briefly displays a floating text message above the player's head.

Parameters
messageThe message to display.
broadcastToPartyIf true, shows the floating message to all players in the same party.
chatWindowIf true, the floating text will be shown in the player's chat window.

◆ FloatingTextStrRef()

void Anvil.API.NwPlayer.FloatingTextStrRef ( int strRef,
bool broadcastToParty = true,
bool chatWindow = true )
inline

Briefly displays a floating text message above the player's head using the specified string reference.

Parameters
strRefThe string ref index to use.
broadcastToPartyIf true, shows the floating message to all players in the same party.
chatWindowIf true, the floating text will be shown in the player's chat window.

◆ ForceExamine()

void Anvil.API.NwPlayer.ForceExamine ( NwGameObject target)
inline

Forces the player to examine the specified game object.
Works on NwCreature, NwPlaceable, NwItem and NwDoor.
Does nothing for other object types.

Parameters
targetThe GameObject to examine.

◆ GetAreaExplorationState()

unsafe? byte[] Anvil.API.NwPlayer.GetAreaExplorationState ( NwArea? area)
inline

Gets this player's area exploration state for the specified area.

Parameters
areaThe area to query.
Returns
A byte array representing the tiles explored for the area.

◆ GetCampaignVariable< T >()

T Anvil.API.NwPlayer.GetCampaignVariable< T > ( string campaign,
string name )
inline

Gets the specified campaign variable for the player.

Parameters
campaignThe name of the campaign.
nameThe variable name.
Template Parameters
TThe variable type.
Returns
A CampaignVariable instance for getting/setting the variable's value.
Type Constraints
T :CampaignVariable 
T :new() 

◆ GetDeviceProperty()

int Anvil.API.NwPlayer.GetDeviceProperty ( PlayerDeviceProperty property)
inline

Gets the specified device property/capability as advertised by the client.

Parameters
propertyThe property to query.
Returns
The queried property value, or -1 if:
  • the property was never set by the client,
  • the actual value is -1,
  • the player is running a older build that does not advertise device properties,
  • the player has disabled sending device properties (Options/Game/Privacy).

◆ GetJournalEntry()

JournalEntry? Anvil.API.NwPlayer.GetJournalEntry ( string questTag)
inline

Gets an existing journal entry with the specified quest tag.

Parameters
questTagThe quest tag you wish to get the journal entry for.
Returns
A JournalEntry structure containing the journal entry data, null if an entry with the specified tag cannot be found.

◆ GetLoopingVisualEffects()

List< VisualEffectTableEntry >? Anvil.API.NwPlayer.GetLoopingVisualEffects ( NwGameObject gameObject)
inline

Gets a list of visual effects for the specified object visible only to this player.

Parameters
gameObjectThe game object containing the visual effects.

◆ GetObjectNameOverride()

string? Anvil.API.NwPlayer.GetObjectNameOverride ( NwGameObject gameObject)
inline

Gets the current name override set for the specified object.

Parameters
gameObjectThe game object that has an override name.

◆ GetOverridesForObserver()

Dictionary< NwPlayer, PlayerNameOverride > Anvil.API.NwPlayer.GetOverridesForObserver ( bool includeGlobal = false)
inline

Gets a list of all name overrides for the specified observer.

Parameters
includeGlobalTrue if global overrides should be included in the returned map.
Returns
A dictionary containing the name overrides for the specified observer.

◆ GetPlayerNameOverride()

PlayerNameOverride? Anvil.API.NwPlayer.GetPlayerNameOverride ( NwPlayer? observer = null)
inline

Gets the current name override set for the specified player.

Parameters
observerThe specific observer.

◆ GiveXp()

void Anvil.API.NwPlayer.GiveXp ( int xPAmount)
inline

Gives the specified XP to the player, adjusted by any multiclass penalty.

Parameters
xPAmountAmount of experience to give.

◆ NightToDay()

void Anvil.API.NwPlayer.NightToDay ( TimeSpan delayTransitionTime = default)
inline

Changes the current Day/Night cycle for the player to daylight.

Parameters
delayTransitionTimeTime it takes for the daylight to fade in.

◆ OpenInventory() [1/2]

void Anvil.API.NwPlayer.OpenInventory ( NwCreature target)
inline

Opens the specified creatures inventory, and shows it to the player.

DMs can see any player or creature's inventory. Players can only view their own inventory, or that of a henchmen.

Parameters
targetThe target creature's inventory to view.

◆ OpenInventory() [2/2]

void Anvil.API.NwPlayer.OpenInventory ( NwPlaceable target)
inline

Forces the player to open the inventory of the specified placeable.

Parameters
targetThe placeable inventory to be viewed.

◆ PlaySound()

void Anvil.API.NwPlayer.PlaySound ( string sound,
NwGameObject? target = null )
inline

Plays the specified sound at the target in the current area for this player only.

Parameters
soundThe sound resref.
targetThe target object for the sound to originate. Defaults to the location of the player.

◆ PopUpDeathPanel()

void Anvil.API.NwPlayer.PopUpDeathPanel ( bool respawnButton = true,
bool waitForHelp = true,
int helpStringRef = 0,
string helpString = "" )
inline

Displays a death panel that can turn off the "Respawn" or "Wait for Help" buttons.
The "Wait for Help" button is only enabled when the game is running in multiplayer mode.
By default if helpString isn't specified, the value used is "Choose an option below.<br/> Respawning will incur a penalty of 50 XP per level of your character and the loss of 10% of your gold."
(strref 66219 single player, 6600 for multiplayer).

Parameters
respawnButtonIf true the "Respawn" button will be enabled.
waitForHelpIf true the "Wait For Help" button will be enabled.
helpStringRefString reference to display for hel.
helpStringString to display for help which appears in the top of the panel.

◆ PopUpGUIPanel()

void Anvil.API.NwPlayer.PopUpGUIPanel ( GUIPanel panel = GUIPanel::Death)
inline

Displays a GUI panel to a player.

Parameters
panelThe panel type to display.

◆ PostString()

void Anvil.API.NwPlayer.PostString ( string message,
int xPos,
int yPos,
ScreenAnchor anchor,
float life,
Color? start = null,
Color? end = null,
int id = 0,
string font = "" )
inline

Displays a message on the player's screen.
The message is always displayed on top of whatever is on the screen, including UI elements.

Parameters
messageThe message to print.
xPosThe x coordinate relative to anchor.
yPosThe y coordinate relative to anchor.
anchorThe screen anchor/origin point.
lifeDuration to show ControlledCreature string in seconds.
startThe starting color of ControlledCreature text (default: white).
endThe color of the text to fade to as it nears the end of the lifetime (default: white).
idAn optional numeric ID for ControlledCreature string. If not set to 0, subsequent calls to PostString will remove the text with the same ID.
fontIf specified, the message will be rendered with the specified font instead of the default console font.

◆ PrepareSQLQuery()

SQLQuery Anvil.API.NwPlayer.PrepareSQLQuery ( string query)
inline

Sets up a SQL Query for this player.
This will NOT run the query; only make it available for parameter binding.
To run the query, you need to call SQLQuery.Execute even if you do not expect result data.

Parameters
queryThe query to be prepared.
Returns
A SQLQuery object.

◆ RefreshClientObject()

unsafe void Anvil.API.NwPlayer.RefreshClientObject ( NwGameObject gameObject)
inline

Causes this player to refresh the client object associated with the given game object.

Parameters
gameObjectThe game object to refresh.

◆ SeekAudioStream()

void Anvil.API.NwPlayer.SeekAudioStream ( AudioStreamIdentifier streamIdentifier,
float seekOffset )
inline

Seeks the audio stream with the specified identifier to a new position on the currently playing audio track.

Parameters
streamIdentifierThe stream identifier to update.
seekOffsetThe new position on the audio track

◆ SendServerMessage()

void Anvil.API.NwPlayer.SendServerMessage ( string message,
Color color )
inline

Sends a server message to the player.

Parameters
messageThe message to send.
colorA color to apply to the message.

◆ SendToServer()

void Anvil.API.NwPlayer.SendToServer ( string ipAddress = "",
string password = "",
string waypointTag = "",
bool seamless = false )
inline

Sends the player to a new server, where the player's character will connect and log in.

Parameters
ipAddressDNS name or the IP address + port of the destination server.
passwordThe player password to connect to the destination server.
waypointTagThe custom waypoint tag on the destination server for the player to jump to. Defaults to the module's start location.
seamlessIf true, the player will not be prompted with information about the new server, and they will not be allowed to save a copy of their character (if it is a local vault character).

◆ SetAreaExplorationState() [1/2]

void Anvil.API.NwPlayer.SetAreaExplorationState ( NwArea area,
bool explored )
inline

Sets whether the player has explored an area.

Parameters
areaThe area to explore.
exploredtrue if ControlledCreature area has been explored, otherwise false to (re)hide the map.

◆ SetAreaExplorationState() [2/2]

unsafe void Anvil.API.NwPlayer.SetAreaExplorationState ( NwArea area,
byte[] newState )
inline

Sets this player's area exploration state for the specified area.

Parameters
areaThe area to modify.
newStateA byte array representing the tiles explored for the area, as returned by GetAreaExplorationState.

◆ SetAudioStreamPaused()

void Anvil.API.NwPlayer.SetAudioStreamPaused ( AudioStreamIdentifier streamIdentifier,
bool paused,
TimeSpan fadeTime = default )
inline

Pauses/Unpauses the audio stream on the specified identifier.

Parameters
streamIdentifierThe stream identifier to pause/unpause.
pausedThe new pause state.
fadeTimeThe time to fade out/fade in before pausing/unpausing the stream.

◆ SetAudioStreamVolume()

void Anvil.API.NwPlayer.SetAudioStreamVolume ( AudioStreamIdentifier streamIdentifier,
float volume = 1::0f,
TimeSpan fadeTime = default )
inline

Changes the volume of the audio stream with the specified identifier.

Parameters
streamIdentifierThe stream identifier to receive the new volume level.
volumeThe new volume level (0.0-1.0)
fadeTimeThe time to fade in to the new volume level.

◆ SetCameraFacing()

async Task Anvil.API.NwPlayer.SetCameraFacing ( float direction,
float pitch = -1::0f,
float distance = -1::0f,
CameraTransitionType transitionType = CameraTransitionType::Snap )
inline

Changes the direction the player's camera is facing.

Parameters
directionHorizontal angle from East in degrees. -1 to leave the angle unmodified.
pitchVertical angle of the camera in degrees. -1 to leave the angle unmodified.
distanceDistance (zoom) of the camera. -1 to leave the distance unmodified.
transitionTypeThe transition to use for moving the camera.

◆ SetCutsceneMode()

void Anvil.API.NwPlayer.SetCutsceneMode ( bool inCutscene = true,
bool leftClickEnabled = false )
inline

Toggles the CutsceneMode state for the player.

Parameters
inCutsceneTrue if cutscene mode should be enabled, otherwise false.
leftClickEnabledTrue if ControlledCreature user should be allowed to interact with the game with the left mouse button. False to prevent interaction.

◆ SetGuiPanelDisabled()

void Anvil.API.NwPlayer.SetGuiPanelDisabled ( GUIPanel panel,
bool disabled,
NwGameObject? targetObject = null )
inline

Disable a specific gui panel for this player.
Will close the GUI panel if it is currently open.
Will fire a GuiEventType.DisabledPanelAttemptOpen event for some panels if a player attempts to open them while disabled.

Parameters
panelThe panel type to disable.
disabledTrue to disable the panel, false to re-enable the panel.
targetObjectThe target object (e.g. examined object) where this panel should be disabled.

◆ SetObjectNameOverride()

void Anvil.API.NwPlayer.SetObjectNameOverride ( NwGameObject gameObject,
string name )
inline

Sets an override name for a specific game object, as visible from this player.
Supports placeables, doors, items and creatures.

Parameters
gameObjectThe game object to set a new name for.
nameThe new name of the object.
Exceptions
ArgumentExceptionThrown if gameObject is not a placeable, door, item or creature.

◆ SetPCReputation()

void Anvil.API.NwPlayer.SetPCReputation ( bool like,
NwPlayer target )
inline

Sets if the player should like, or unlike the specified player.

Parameters
liketrue if the player should like the target, false if the player should dislike the target.
targetThe target to like/dislike.

◆ SetPlayerNameOverride() [1/2]

void Anvil.API.NwPlayer.SetPlayerNameOverride ( PlayerNameOverride nameOverride)
inline

Sets an override player character name and community name on the player list for all players. Is not persistent.

Parameters
nameOverrideThe new names for the player.

◆ SetPlayerNameOverride() [2/2]

void Anvil.API.NwPlayer.SetPlayerNameOverride ( PlayerNameOverride nameOverride,
NwPlayer observer )
inline

Sets an override player character name and community name on the player list as observed by a specific player. Is not persistent.

Parameters
nameOverrideThe new names for the player.
observerThe observer to see the new names.

◆ SetShaderUniform() [1/3]

void Anvil.API.NwPlayer.SetShaderUniform ( ShaderUniform uniform,
float value )
inline

Sets a global shader uniform for this player.
These uniforms are not used by the base game and are reserved for module-specific scripting.
You need to add custom shaders that will make use of them.
In multiplayer, these need to be reapplied when a player rejoins.

Parameters
uniformThe uniform to set.
valueThe value to set for the uniform.

◆ SetShaderUniform() [2/3]

void Anvil.API.NwPlayer.SetShaderUniform ( ShaderUniform uniform,
int value )
inline

Sets a global shader uniform for this player.
These uniforms are not used by the base game and are reserved for module-specific scripting.
You need to add custom shaders that will make use of them.
In multiplayer, these need to be reapplied when a player rejoins.

Parameters
uniformThe uniform to set.
valueThe value to set for the uniform.

◆ SetShaderUniform() [3/3]

void Anvil.API.NwPlayer.SetShaderUniform ( ShaderUniform uniform,
Vector4 value )
inline

Sets a global shader uniform for this player.
These uniforms are not used by the base game and are reserved for module-specific scripting.
You need to add custom shaders that will make use of them.
In multiplayer, these need to be reapplied when a player rejoins.

Parameters
uniformThe uniform to set.
valueThe value to set for the uniform.

◆ SetSpellTargetingData()

void Anvil.API.NwPlayer.SetSpellTargetingData ( TargetingData data)
inline

Sets a spell targeting data override for this player.

Parameters
dataThe override to apply.
Exceptions
ArgumentNullExceptionThrown if data.Spell is not specified.

◆ SetTextureOverride()

void Anvil.API.NwPlayer.SetTextureOverride ( string oldTexName,
string newTexName )
inline

Makes ControlledCreature PC load a new texture instead of another.

Parameters
oldTexNameThe existing texture to replace.
newTexNameThe new override texture.

◆ ShowVisualEffect()

void Anvil.API.NwPlayer.ShowVisualEffect ( VfxType effectType,
Vector3 position )
inline

Plays the specified VFX at the target position in the current area for this player only.

Parameters
effectTypeThe effect to play.
positionWhere to play the effect.

◆ StartAudioStream()

void Anvil.API.NwPlayer.StartAudioStream ( AudioStreamIdentifier streamIdentifier,
string resRef,
bool looping = false,
TimeSpan fadeTime = default,
float seekOffset = -1f,
float volume = 1f )
inline

Assign one of the available audio streams to play a specific file. This mechanism can be used
to replace regular music playback, and synchronize it between clients.

Parameters
streamIdentifierThe audio stream/channel to use for playing audio.
resRefThe audio resref to play.
loopingIf the audio should loop.
fadeTimeAn optional fade in time for the audio.
seekOffsetThe offset to seek in the audio track. If this is greater than the length of the track, it will loop back to the start.
volumeThe volume to set on the audio stream.

◆ StopAudioStream()

void Anvil.API.NwPlayer.StopAudioStream ( AudioStreamIdentifier streamIdentifier,
TimeSpan fadeTime = default )
inline

Stops the audio stream playing on the specified identifier.

Parameters
streamIdentifierThe stream identifier to stop.
fadeTimeThe fade out time.

◆ TryCreateNuiWindow()

bool Anvil.API.NwPlayer.TryCreateNuiWindow ( NuiWindow window,
out NuiWindowToken token,
string windowId = "" )
inline

Create a NUI window for this player.

Parameters
windowThe window to create.
tokenThe created player-unique token for this window instance.
windowIdA unique alphanumeric ID identifying this window. Re-creating a window with the same id of one already open will immediately close the old one.
Returns
True if the window was successfully created, otherwise false.

◆ TryEnterTargetMode()

bool Anvil.API.NwPlayer.TryEnterTargetMode ( Action< ModuleEvents.OnPlayerTarget > handler,
TargetModeSettings? settings = null )
inline

Attempts to get this player to enter cursor targeting mode, invoking the specified handler once the player selects something.
If the player is already in targeting mode, the existing handler will not be cleared.

Parameters
handlerThe lamda/method to invoke once this player selects something.
settingsDisplay and behaviour options for the target mode.
Returns
True if the player successfully entered target mode, otherwise false.

◆ UnlockAchievement()

void Anvil.API.NwPlayer.UnlockAchievement ( string achievementId,
int lastValue = 0,
int currentValue = 0,
int maxValue = 0 )
inline

Unlock an achievement for the player who must be logged in.

Parameters
achievementIdThe achievement ID on the remote server.
lastValueThe previous value of the associated achievement stat.
currentValueThe current value of the associated achievement stat.
maxValueThe maximum value of the associate achievement stat.

◆ Vibrate()

void Anvil.API.NwPlayer.Vibrate ( VibratorMotor motor,
float strength,
TimeSpan duration )
inline

Vibrates the player's device or controller. Does nothing if vibration is not supported.

Parameters
motorWhich motors to vibrate.
strengthThe intensity of the vibration.
durationHow long to vibrate for.

Property Documentation

◆ IsInCursorTargetMode

bool Anvil.API.NwPlayer.IsInCursorTargetMode
get

Gets if this player is in cursor targeting mode.
NOTE! Only works if the player entered target mode using TryEnterTargetMode.

Returns
True if this player is attempting to target something.

The documentation for this class was generated from the following files: