Anvil
Anvil.API.NwModule Class Reference

The root container object for all areas and module entities. More...

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

Public Member Functions

void AddJournalQuestEntry (string categoryTag, int entryId, bool allowOverrideHigher=false)
 Adds an entry to the journal of all players in the module.
See NwPlayer.AddJournalQuestEntry to add a journal entry to a specific player/party. More...
 
void ClearTextureOverride (string texName)
 Removes the override for the specified texture, reverting to the original texture. More...
 
void DestroyCampaignDatabase (string campaign)
 Deletes the entire campaign database, if it exists. More...
 
void EndGame (string endMovie)
 Ends the current running game, plays the specified movie then returns all players to the main menu. More...
 
void ExportAllCharacters ()
 Forces all players who are currently game to have their characters exported to their respective directories i.e. LocalVault/ServerVault/ etc. More...
 
GetCampaignVariable< T > (string campaign, string name)
 Gets the specified global campaign variable. More...
 
IEnumerable< NwObjectGetLastCreatedObjects ()
 Gets the last objects that were created in the module. Use LINQ to skip or limit the query. More...
 
NwWaypointGetWaypointByTag (string tag)
 Finds the specified waypoint with the given tag. More...
 
void MoveObjectToLimbo (NwGameObject gameObject)
 Moves the specified NwGameObject from its current location/owner to limbo. More...
 
override? Guid PeekUUID ()
 Attempts to get the UUID of this object, if assigned. More...
 
SQLQuery PrepareCampaignSQLQuery (string database, string query)
 Sets up a SQL Query for the specified campaign database.
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.
More...
 
SQLQuery PrepareSQLQuery (string query)
 Sets up a SQL Query for this module.
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.
More...
 
void RefreshClientObjects (NwGameObject gameObject)
 Causes all players in the module to refresh client object information about the specified game object. More...
 
void SendMessageToAllDMs (string message)
 
void SendMessageToAllDMs (string message, Color color)
 Broadcasts a message to the DM channel, sending a message to all DMs on the server. More...
 
void SetTextureOverride (string oldTexName, string newName)
 Makes all online PCs load a new texture instead of another. More...
 
- Public Member Functions inherited from Anvil.API.NwObject
async Task AddActionToQueue (System.Action action)
 Inserts the function call aCommand into the Action Queue, ensuring the calling object will perform actions in a particular order. More...
 
async Task ClearActionQueue (bool clearCombatState=false)
 Clear all the object's actions. More...
 
void ClearEventSubscriptions ()
 Clears any event subscriptions associated with this object. More...
 
bool Equals (NwObject? other)
 
override bool Equals (object? obj)
 
void ForceRefreshUUID ()
 
string GetEventScript (EventScriptType eventType)
 Gets the script assigned to run for the specified object event. More...
 
override int GetHashCode ()
 
GetObjectVariable< T > (string name)
 Gets the specified object variable for this object. More...
 
bool IsEventLocked (EventScriptType eventType)
 Gets a value indicating whether the event script can be modified for the specified event. More...
 
Json SerializeToJson (bool saveObjectState)
 Serializes this game object to a json representation More...
 
void SetEventScript (EventScriptType eventType, string? script)
 Sets the script to be run on the specified object event. More...
 
async Task SpeakString (string message, TalkVolume talkVolume=TalkVolume.Talk, bool queueAsAction=false)
 Instructs this object to speak. More...
 
override string ToString ()
 The ID of this object as a string. Can be used in StringExtensions.ParseObject while the object is alive.
This cannot be used across server restarts. See UUID for a persistent unique identifier. More...
 
bool TryGetUUID (out Guid uid)
 Attempts to get the UUID for this object, assigning a new ID if it does not already exist.
More...
 
async Task WaitForObjectContext ()
 Notifies then awaits for this object to become the current active object for the purpose of implicitly assigned values (e.g. effect creators).
If the current active object is already this object, then the code runs immediately. Otherwise, it will be run with all other closures.
This is the async equivalent of AssignCommand in NWScript. More...
 

Static Public Member Functions

static implicit operator CNWSModule? (NwModule? module)
 
- Static Public Member Functions inherited from Anvil.API.NwObject
static IEnumerable< T > FindObjectsOfType< T > ()
 Locates all objects of the specified type. More...
 
static IEnumerable< NwObjectFindObjectsWithTag (params string[] tags)
 Locates all objects of that have the specified tag. More...
 
static IEnumerable< T > FindObjectsWithTag< T > (params string[] tags)
 Locates all objects of the specified type that have the specified tag. More...
 
static implicit operator uint (NwObject? gameObject)
 
static bool operator!= (NwObject? left, NwObject? right)
 
static bool operator== (NwObject? left, NwObject? right)
 

Static Public Attributes

static readonly NwModule Instance = new NwModule(LowLevel.ServerExoApp.GetModule())
 

Properties

int AbilityPenaltyLimit [get, set]
 Gets or sets the max possible ability score penalty from temporary effects/items (Default: 30). More...
 
IEnumerable< NwAreaAreas [get]
 Gets all active areas in the module. More...
 
int AttackBonusLimit [get, set]
 Gets or sets the max possible attack bonus from temporary effects/items (Default: 20). More...
 
int DamageBonusLimit [get, set]
 Gets or sets the max possible damage bonus from temporary effects/items (Default: 100). More...
 
GameDifficulty GameDifficulty [get]
 Gets the current server difficulty setting. More...
 
int GetAbilityBonusLimit [get, set]
 Gets or sets the max possible ability score bonus from temporary effects/items (Default: 12). More...
 
bool IsDawn [get]
 Gets a value indicating whether it is currently dawn. More...
 
bool IsDay [get]
 Gets a value indicating whether it is currently day. More...
 
bool IsDusk [get]
 Gets a value indicating whether it is currently dusk. More...
 
bool IsNight [get]
 Gets a value indicating whether it is currently night. More...
 
IEnumerable< NwGameObjectLimboGameObjects [get]
 Gets all objects currently stored in limbo. More...
 
int MaxHenchmen [get, set]
 Gets or sets the maximum number of henchmen. More...
 
Action< ModuleEvents.OnAcquireItemOnAcquireItem
 
Action< ModuleEvents.OnActivateItemOnActivateItem
 
Action< OnAssociateAddOnAssociateAdd
 
Action< OnAssociateRemoveOnAssociateRemove
 
Action< OnBarterEndOnBarterEnd
 
Action< OnBarterStartOnBarterStart
 
Action< OnCalendarTimeChangeOnCalendarTimeChange
 
Action< OnChatMessageSendOnChatMessageSend
 
Action< OnCheckEffectImmunityOnCheckEffectImmunity
 
Action< OnClientConnectOnClientConnect
 
Action< OnClientDisconnectOnClientDisconnect
 
Action< ModuleEvents.OnClientEnterOnClientEnter
 
Action< ModuleEvents.OnClientLeaveOnClientLeave
 
Action< OnClientLevelUpBeginOnClientLevelUpBegin
 
Action< OnCombatDRBrokenOnCombatDRBroken
 
Action< OnCombatModeToggleOnCombatModeToggle
 
Action< OnCombatRoundStartOnCombatRoundStart
 
Action< OnCombatStatusChangeOnCombatStatusChange
 
Action< OnCreatureAttackOnCreatureAttack
 
Action< OnCreatureCheckProficienciesOnCreatureCheckProficiencies
 
Action< OnCreatureDamageOnCreatureDamage
 
Action< ModuleEvents.OnCutsceneAbortOnCutsceneAbort
 
Action< OnDebugPlayVisualEffectOnDebugPlayVisualEffect
 
Action< OnDebugRunScriptOnDebugRunScript
 
Action< OnDebugRunScriptChunkOnDebugRunScriptChunk
 
Action< OnDetectModeUpdateOnDetectModeUpdate
 
Action< OnDisarmWeaponOnDisarmWeapon
 
Action< OnDispelMagicApplyOnDispelMagicApply
 
Action< OnDMAppearOnDMAppear
 
Action< OnDMChangeDifficultyOnDMChangeDifficulty
 
Action< OnDMDisableTrapOnDMDisableTrap
 
Action< OnDMDisappearOnDMDisappear
 
Action< OnDMDumpLocalsOnDMDumpLocals
 
Action< OnDMForceRestOnDMForceRest
 
Action< OnDMGetFactionReputationOnDMGetFactionReputation
 
Action< OnDMGetVariableOnDMGetVariable
 
Action< OnDMGiveAlignmentOnDMGiveAlignment
 
Action< OnDMGiveGoldOnDMGiveGold
 
Action< OnDMGiveItemOnDMGiveItem
 
Action< OnDMGiveLevelOnDMGiveLevel
 
Action< OnDMGiveXPOnDMGiveXP
 
Action< OnDMGoToOnDMGoTo
 
Action< OnDMHealOnDMHeal
 
Action< OnDMJumpAllPlayersToPointOnDMJumpAllPlayersToPoint
 
Action< OnDMJumpTargetToPointOnDMJumpTargetToPoint [get]
 
Action< OnDMJumpToPointOnDMJumpToPoint
 
Action< OnDMKillOnDMKill
 
Action< OnDMLimboOnDMLimbo
 
Action< OnDMPlayerDMLoginOnDMPlayerDMLogin
 
Action< OnDMPlayerDMLogoutOnDMPlayerDMLogout
 
Action< OnDMPossessOnDMPossess
 
Action< OnDMPossessFullPowerOnDMPossessFullPower
 
Action< OnDMSetDateOnDMSetDate
 
Action< OnDMSetFactionOnDMSetFaction
 
Action< OnDMSetFactionReputationOnDMSetFactionReputation
 
Action< OnDMSetStatOnDMSetStat
 
Action< OnDMSetTimeOnDMSetTime
 
Action< OnDMSetVariableOnDMSetVariable
 
Action< OnDMSpawnObjectOnDMSpawnObject
 
Action< OnDMSpawnTrapOnObjectOnDMSpawnTrapOnObject
 
Action< OnDMTakeItemOnDMTakeItem
 
Action< OnDMToggleAIOnDMToggleAI
 
Action< OnDMToggleImmortalOnDMToggleImmortal
 
Action< OnDMToggleInvulnerableOnDMToggleInvulnerable
 
Action< OnDMToggleLockOnDMToggleLock
 
Action< OnDMViewInventoryOnDMViewInventory
 
Action< OnDoListenDetectionOnDoListenDetection
 
Action< OnDoorSetOpenStateOnDoorSetOpenState
 
Action< OnDoSpotDetectionOnDoSpotDetection
 
Action< OnEffectApplyOnEffectApply
 
Action< OnEffectRemoveOnEffectRemove
 
Action< OnExamineObjectOnExamineObject
 
Action< OnExamineTrapOnExamineTrap
 
Action< OnFamiliarPossessOnFamiliarPossess
 
Action< OnFamiliarUnpossessOnFamiliarUnpossess
 
Action< OnHealOnHeal
 
Action< OnHealKitUseOnHealKitUse
 
Action< ModuleEvents.OnHeartbeatOnHeartbeat
 
Action< OnInventoryGoldAddOnInventoryGoldAdd
 
Action< OnInventoryGoldRemoveOnInventoryGoldRemove
 
Action< OnInventoryItemAddOnInventoryItemAdd
 
Action< OnInventoryItemRemoveOnInventoryItemRemove
 
Action< OnItemEquipOnItemEquip
 
Action< OnItemInventoryCloseOnItemInventoryClose
 
Action< OnItemInventoryOpenOnItemInventoryOpen
 
Action< OnItemPayToIdentifyOnItemPayToIdentify
 
Action< OnItemScrollLearnOnItemScrollLearn
 
Action< OnItemUnequipOnItemUnequip
 
Action< OnItemUseOnItemUse
 
Action< OnItemValidateEquipOnItemValidateEquip
 
Action< OnItemValidateUseOnItemValidateUse
 
Action< OnLevelDownOnLevelDown
 
Action< OnLevelUpOnLevelUp
 
Action< OnLevelUpAutomaticOnLevelUpAutomatic
 
Action< OnLoadCharacterFinishOnLoadCharacterFinish
 
Action< OnMapPinAddPinOnMapPinAddPin
 
Action< OnMapPinChangePinOnMapPinChangePin
 
Action< OnMapPinDestroyPinOnMapPinDestroyPin
 
Action< ModuleEvents.OnModuleLoadOnModuleLoad
 
Action< ModuleEvents.OnModuleStartOnModuleStart
 
Action< ModuleEvents.OnNuiEventOnNuiEvent
 
Action< OnObjectUseOnObjectUse
 
Action< OnPartyEventOnPartyEvent
 
Action< ModuleEvents.OnPlayerChatOnPlayerChat
 
Action< ModuleEvents.OnPlayerDeathOnPlayerDeath
 
Action< ModuleEvents.OnPlayerDyingOnPlayerDying
 
Action< ModuleEvents.OnPlayerEquipItemOnPlayerEquipItem
 
Action< ModuleEvents.OnPlayerGuiEventOnPlayerGuiEvent
 
Action< ModuleEvents.OnPlayerLevelUpOnPlayerLevelUp
 
Action< OnPlayerQuickChatOnPlayerQuickChat
 
Action< ModuleEvents.OnPlayerRespawnOnPlayerRespawn
 
Action< ModuleEvents.OnPlayerRestOnPlayerRest
 
Action< ModuleEvents.OnPlayerTargetOnPlayerTarget [get]
 
Action< ModuleEvents.OnPlayerTileActionOnPlayerTileAction
 
Action< ModuleEvents.OnPlayerUnequipItemOnPlayerUnequipItem
 
Action< OnServerCharacterSaveOnServerCharacterSave
 
Action< OnServerSendAreaOnServerSendArea
 
Action< OnSpellActionOnSpellAction
 
Action< OnSpellBroadcastOnSpellBroadcast
 
Action< OnSpellCastOnSpellCast
 
Action< OnSpellInterruptOnSpellInterrupt
 
Action< OnSpellSlotClearOnSpellSlotClear
 
Action< OnSpellSlotMemorizeOnSpellSlotMemorize
 
Action< OnStealthModeUpdateOnStealthModeUpdate
 
Action< OnStoreRequestBuyOnStoreRequestBuy
 
Action< OnStoreRequestSellOnStoreRequestSell
 
Action< OnTriggerEnterOnTriggerEnter
 
Action< ModuleEvents.OnUnacquireItemOnUnacquireItem
 
Action< OnUseFeatOnUseFeat
 
Action< ModuleEvents.OnUserDefinedOnUserDefined
 
Action< OnUseSkillOnUseSkill
 
uint PlayerCount [get]
 Gets the current player count. More...
 
IEnumerable< NwPlayerPlayers [get]
 Gets all current online players. More...
 
int SavingThrowBonusLimit [get, set]
 Gets or sets the max possible saving throw bonus from temporary effects/items (Default: 20). More...
 
int SkillBonusLimit [get, set]
 Gets or sets the max possible skill bonus from temporary effects/items (Default: 50). More...
 
Location StartingLocation [get]
 Gets the starting location for new players. More...
 
int XPScale [get, set]
 Gets or sets the XP scale for this module. Must be a value between 0-200. More...
 
- Properties inherited from Anvil.API.NwObject
string Description [get, set]
 Gets or sets the description for this object. More...
 
static EventService EventService = null! [get]
 
bool HasUUID [get]
 Gets a value indicating whether this object has an assigned UUID. More...
 
bool IsValid [get]
 Gets a value indicating whether this is a valid object. More...
 
IEnumerable< ObjectVariableLocalVariables [get]
 Gets all local variables assigned on this object. More...
 
string Name [get, set]
 Gets or sets the name of this object. More...
 
static Lazy< ObjectVisibilityService > ObjectVisibilityService = null! [get]
 
string OriginalDescription [get]
 Gets the original description for this object as defined in the toolset. More...
 
static ResourceManager ResourceManager = null! [get]
 
string ResRef [get]
 Gets the resource reference used to create this object. More...
 
string Tag [get, set]
 Gets or sets the tag for this object. More...
 
Guid UUID [get]
 Gets the globally unique identifier for this object. More...
 
static VirtualMachine VirtualMachine = null! [get]
 

Additional Inherited Members

- Public Attributes inherited from Anvil.API.NwObject
readonly uint ObjectId
 The ID of this object instance. Not persistent, changes after every spawn of the object.
See UUID for a persistent unique ID for objects. More...
 
- Protected Member Functions inherited from Anvil.API.NwObject
 NwObject (ICGameObject gameObject)
 
void AssertObjectValid ()
 

Detailed Description

The root container object for all areas and module entities.

Member Function Documentation

◆ AddJournalQuestEntry()

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

Adds an entry to the journal of all players in the module.
See NwPlayer.AddJournalQuestEntry to add a journal entry to a specific player/party.

Parameters
categoryTagThe tag of the Journal category (case-sensitive).
entryIdThe ID of the Journal entry.
allowOverrideHigherIf true, disables the default restriction that requires journal entry numbers to increase.

◆ ClearTextureOverride()

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

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

Parameters
texNameThe name of the original texture.

◆ DestroyCampaignDatabase()

void Anvil.API.NwModule.DestroyCampaignDatabase ( string  campaign)
inline

Deletes the entire campaign database, if it exists.

Parameters
campaignThe campaign DB to delete.

◆ EndGame()

void Anvil.API.NwModule.EndGame ( string  endMovie)
inline

Ends the current running game, plays the specified movie then returns all players to the main menu.

Parameters
endMovieThe filename of the movie to play, without file extension.

◆ ExportAllCharacters()

void Anvil.API.NwModule.ExportAllCharacters ( )
inline

Forces all players who are currently game to have their characters exported to their respective directories i.e. LocalVault/ServerVault/ etc.

◆ GetCampaignVariable< T >()

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

Gets the specified global campaign variable.

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() 

◆ GetLastCreatedObjects()

IEnumerable<NwObject> Anvil.API.NwModule.GetLastCreatedObjects ( )
inline

Gets the last objects that were created in the module. Use LINQ to skip or limit the query.

Returns
An enumerable containing the last created objects.

◆ GetWaypointByTag()

NwWaypoint? Anvil.API.NwModule.GetWaypointByTag ( string  tag)
inline

Finds the specified waypoint with the given tag.

◆ MoveObjectToLimbo()

void Anvil.API.NwModule.MoveObjectToLimbo ( NwGameObject  gameObject)
inline

Moves the specified NwGameObject from its current location/owner to limbo.

Parameters
gameObjectThe game object to move to limbo.

◆ PeekUUID()

override? Guid Anvil.API.NwModule.PeekUUID ( )
inlinevirtual

Attempts to get the UUID of this object, if assigned.

Returns
The UUID if assigned, otherwise no value.

Implements Anvil.API.NwObject.

◆ PrepareCampaignSQLQuery()

SQLQuery Anvil.API.NwModule.PrepareCampaignSQLQuery ( string  database,
string  query 
)
inline

Sets up a SQL Query for the specified campaign database.
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
databaseThe database to be queried.
queryThe query to be prepared.
Returns
A SQLQuery object.

◆ PrepareSQLQuery()

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

Sets up a SQL Query for this module.
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.

◆ RefreshClientObjects()

void Anvil.API.NwModule.RefreshClientObjects ( NwGameObject  gameObject)
inline

Causes all players in the module to refresh client object information about the specified game object.

Parameters
gameObjectThe game object to refresh.

◆ SendMessageToAllDMs()

void Anvil.API.NwModule.SendMessageToAllDMs ( string  message,
Color  color 
)
inline

Broadcasts a message to the DM channel, sending a message to all DMs on the server.

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

◆ SetTextureOverride()

void Anvil.API.NwModule.SetTextureOverride ( string  oldTexName,
string  newName 
)
inline

Makes all online PCs load a new texture instead of another.

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

Property Documentation

◆ AbilityPenaltyLimit

int Anvil.API.NwModule.AbilityPenaltyLimit
getset

Gets or sets the max possible ability score penalty from temporary effects/items (Default: 30).

◆ Areas

IEnumerable<NwArea> Anvil.API.NwModule.Areas
get

Gets all active areas in the module.

◆ AttackBonusLimit

int Anvil.API.NwModule.AttackBonusLimit
getset

Gets or sets the max possible attack bonus from temporary effects/items (Default: 20).

◆ DamageBonusLimit

int Anvil.API.NwModule.DamageBonusLimit
getset

Gets or sets the max possible damage bonus from temporary effects/items (Default: 100).

◆ GameDifficulty

GameDifficulty Anvil.API.NwModule.GameDifficulty
get

Gets the current server difficulty setting.

◆ GetAbilityBonusLimit

int Anvil.API.NwModule.GetAbilityBonusLimit
getset

Gets or sets the max possible ability score bonus from temporary effects/items (Default: 12).

◆ IsDawn

bool Anvil.API.NwModule.IsDawn
get

Gets a value indicating whether it is currently dawn.

◆ IsDay

bool Anvil.API.NwModule.IsDay
get

Gets a value indicating whether it is currently day.

◆ IsDusk

bool Anvil.API.NwModule.IsDusk
get

Gets a value indicating whether it is currently dusk.

◆ IsNight

bool Anvil.API.NwModule.IsNight
get

Gets a value indicating whether it is currently night.

◆ LimboGameObjects

IEnumerable<NwGameObject> Anvil.API.NwModule.LimboGameObjects
get

Gets all objects currently stored in limbo.

◆ MaxHenchmen

int Anvil.API.NwModule.MaxHenchmen
getset

Gets or sets the maximum number of henchmen.

◆ PlayerCount

uint Anvil.API.NwModule.PlayerCount
get

Gets the current player count.

◆ Players

IEnumerable<NwPlayer> Anvil.API.NwModule.Players
get

Gets all current online players.

◆ SavingThrowBonusLimit

int Anvil.API.NwModule.SavingThrowBonusLimit
getset

Gets or sets the max possible saving throw bonus from temporary effects/items (Default: 20).

◆ SkillBonusLimit

int Anvil.API.NwModule.SkillBonusLimit
getset

Gets or sets the max possible skill bonus from temporary effects/items (Default: 50).

◆ StartingLocation

Location Anvil.API.NwModule.StartingLocation
get

Gets the starting location for new players.

◆ XPScale

int Anvil.API.NwModule.XPScale
getset

Gets or sets the XP scale for this module. Must be a value between 0-200.


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