public static void SetDevastatingCriticalEventScript(string sScript) { string sFunc = "SetDevastatingCriticalEventScript"; NWNXCore.NWNX_PushArgumentString(NWNX_Weapon, sFunc, sScript); NWNXCore.NWNX_CallFunction(NWNX_Weapon, sFunc); }
// Restore an item's appearance with the value returned by GetEntireItemAppearance(). public static void RestoreItemAppearance(NWGameObject oItem, string sApp) { string sFunc = "RestoreItemAppearance"; NWNXCore.NWNX_PushArgumentString(NWNX_Item, sFunc, sApp); NWNXCore.NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem); NWNXCore.NWNX_CallFunction(NWNX_Item, sFunc); }
// Sends a chat message. Channel is a NWNX_* constant. // If no target is provided, then it broadcasts to all eligible targets. // Returns TRUE if successful, FALSE otherwise. public static int SendMessage(int channel, string message, NWGameObject sender, NWGameObject target) { NWNXCore.NWNX_PushArgumentObject("NWNX_Chat", "SEND_MESSAGE", target); NWNXCore.NWNX_PushArgumentObject("NWNX_Chat", "SEND_MESSAGE", sender); NWNXCore.NWNX_PushArgumentString("NWNX_Chat", "SEND_MESSAGE", message); NWNXCore.NWNX_PushArgumentInt("NWNX_Chat", "SEND_MESSAGE", channel); NWNXCore.NWNX_CallFunction("NWNX_Chat", "SEND_MESSAGE"); return(NWNXCore.NWNX_GetReturnValueInt("NWNX_Chat", "SEND_MESSAGE")); }
/// <summary> /// Set player's area exploration state (str is an encoded string obtained with NWNX_Player_GetAreaExplorationState) /// </summary> /// <param name="player">The player object</param> /// <param name="area">The area</param> /// <param name="str">The encoded exploration state string</param> public static void SetAreaExplorationState(NWGameObject player, NWGameObject area, string str) { string sFunc = "SetAreaExplorationState"; NWNXCore.NWNX_PushArgumentString(NWNX_Player, sFunc, str); NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, area); NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, player); NWNXCore.NWNX_CallFunction(NWNX_Player, sFunc); }
/// <summary> /// Override the name of placeable for player only /// "" to clear the override /// </summary> /// <param name="player">The player object</param> /// <param name="placeable">The placeable object</param> /// <param name="name">The new name to use</param> public static void SetPlaceableNameOverride(NWGameObject player, NWGameObject placeable, string name) { string sFunc = "SetPlaceableNameOverride"; NWNXCore.NWNX_PushArgumentString(NWNX_Player, sFunc, name); NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, placeable); NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, player); NWNXCore.NWNX_CallFunction(NWNX_Player, sFunc); }
/// <summary> /// Gets whether a quest has been completed by a player /// Returns -1 if they don't have the journal entry /// </summary> /// <param name="player">The player object</param> /// <param name="sQuestName">The name of the quest</param> /// <returns></returns> public static int GetQuestCompleted(NWGameObject player, string sQuestName) { string sFunc = "GetQuestCompleted"; NWNXCore.NWNX_PushArgumentString(NWNX_Player, sFunc, sQuestName); NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, player); NWNXCore.NWNX_CallFunction(NWNX_Player, sFunc); return(NWNXCore.NWNX_GetReturnValueInt(NWNX_Player, sFunc)); }
/// <summary> /// Sets the current DM password. May be set to an empty string. /// </summary> /// <param name="password"></param> public static void SetDMPassword(string password) { if (password == null) { password = string.Empty; } NWNXCore.NWNX_PushArgumentString("NWNX_Administration", "SET_DM_PASSWORD", password); NWNXCore.NWNX_CallFunction("NWNX_Administration", "SET_DM_PASSWORD"); }
/// <summary> /// Play a sound at the location of target for the given player only /// If target is OBJECT_INVALID the sound will play at the location of the player /// </summary> /// <param name="player"></param> /// <param name="sound"></param> /// <param name="target"></param> public static void PlaySound(NWGameObject player, string sound, NWGameObject target) { string sFunc = "PlaySound"; NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, target); NWNXCore.NWNX_PushArgumentString(NWNX_Player, sFunc, sound); NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, player); NWNXCore.NWNX_CallFunction(NWNX_Player, sFunc); }
/// <summary> /// Set a script with optional data that runs when an effect expires /// Only works for TEMPORARY and PERMANENT effects applied to an object /// Note: OBJECT_SELF in the script is the object the effect is applied to /// </summary> /// <param name="e"></param> /// <param name="script"></param> /// <param name="data"></param> /// <returns></returns> public static Effect SetEffectExpiredScript(Effect e, string script, string data = "") { string sFunc = "SetEffectExpiredScript"; NWNXCore.NWNX_PushArgumentString(NWNX_Effect, sFunc, data); NWNXCore.NWNX_PushArgumentString(NWNX_Effect, sFunc, script); NWNXCore.NWNX_PushArgumentEffect(NWNX_Effect, sFunc, e); NWNXCore.NWNX_CallFunction(NWNX_Effect, sFunc); return(NWNXCore.NWNX_GetReturnValueEffect(NWNX_Effect, sFunc)); }
public static void PushPerfScope(string name, string tag0_tag = "", string tag0_value = "") { NWNXCore.NWNX_PushArgumentString("NWNX_Profiler", "PUSH_PERF_SCOPE", name); if (tag0_value != "" && tag0_tag != "") { NWNXCore.NWNX_PushArgumentString("NWNX_Profiler", "PUSH_PERF_SCOPE", tag0_value); NWNXCore.NWNX_PushArgumentString("NWNX_Profiler", "PUSH_PERF_SCOPE", tag0_tag); } NWNXCore.NWNX_CallFunction("NWNX_Profiler", "PUSH_PERF_SCOPE"); }
/// <summary> /// Convert unpacked effect structure to native type /// </summary> /// <param name="effect"></param> /// <returns></returns> public static Effect PackEffect(EffectUnpacked effect) { string sFunc = "PackEffect"; NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.EffectID); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.Type); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.SubType); NWNXCore.NWNX_PushArgumentFloat(NWNX_Effect, sFunc, effect.Duration); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.ExpiryCalendarDay); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.ExpiryTimeOfDay); NWNXCore.NWNX_PushArgumentObject(NWNX_Effect, sFunc, effect.Creator); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.SpellID); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.Expose); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.ShowIcon); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.CasterLevel); NWNXCore.NWNX_PushArgumentEffect(NWNX_Effect, sFunc, effect.LinkLeft); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.LinkLeftValid); NWNXCore.NWNX_PushArgumentEffect(NWNX_Effect, sFunc, effect.LinkRight); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.LinkRightValid); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.NumIntegers); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam0); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam1); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam2); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam3); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam4); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam5); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam6); NWNXCore.NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam7); NWNXCore.NWNX_PushArgumentFloat(NWNX_Effect, sFunc, effect.fParam0); NWNXCore.NWNX_PushArgumentFloat(NWNX_Effect, sFunc, effect.fParam1); NWNXCore.NWNX_PushArgumentFloat(NWNX_Effect, sFunc, effect.fParam2); NWNXCore.NWNX_PushArgumentFloat(NWNX_Effect, sFunc, effect.fParam3); NWNXCore.NWNX_PushArgumentString(NWNX_Effect, sFunc, effect.sParam0); NWNXCore.NWNX_PushArgumentString(NWNX_Effect, sFunc, effect.sParam1); NWNXCore.NWNX_PushArgumentString(NWNX_Effect, sFunc, effect.sParam2); NWNXCore.NWNX_PushArgumentString(NWNX_Effect, sFunc, effect.sParam3); NWNXCore.NWNX_PushArgumentString(NWNX_Effect, sFunc, effect.sParam4); NWNXCore.NWNX_PushArgumentString(NWNX_Effect, sFunc, effect.sParam5); NWNXCore.NWNX_PushArgumentObject(NWNX_Effect, sFunc, effect.oParam0); NWNXCore.NWNX_PushArgumentObject(NWNX_Effect, sFunc, effect.oParam1); NWNXCore.NWNX_PushArgumentObject(NWNX_Effect, sFunc, effect.oParam2); NWNXCore.NWNX_PushArgumentObject(NWNX_Effect, sFunc, effect.oParam3); NWNXCore.NWNX_PushArgumentString(NWNX_Effect, sFunc, effect.Tag); NWNXCore.NWNX_CallFunction(NWNX_Effect, sFunc); return(NWNXCore.NWNX_GetReturnValueEffect(NWNX_Effect, sFunc)); }
/// <summary> /// Push a timing metric scope - note that every push must be matched by a corresponding pop. /// /// A timing metric contains the following information. /// ```c /// { /// metricName: [name], // Mandatory, from user code /// metricFields: { time, nanoseconds }, // Automatically captured by the push/pop pair /// metricTags: { [tag0_tag], [tag0_value] } // Optional, from user code, can be used to /// filter metrics based on some category or, /// constant e.g. objectType or area /// } /// ``` /// /// If you don't understand how this works and you wish to use it, you should research /// the Metrics system (see Metrics.hpp) as well as googling about how InfluxDB stores metrics /// It's possible to have more than one tag pair per metric, It is just limited /// to one arbitrarily here. You can edit the prototype to include more and the C++ /// code will cope with it correctly. /// </summary> /// <param name="name">The name to use for your metric</param> /// <param name="tag0_tag">An optional tag to filter your metrics</param> /// <param name="tag0_value">The tag's value for which to filter.</param> public static void PushPerfScope(string name, string tag0_tag = "", string tag0_value = "") { var sFunc = "PushPerfScope"; NWNXCore.NWNX_PushArgumentString(name); if (tag0_value != "" && tag0_tag != "") { NWNXCore.NWNX_PushArgumentString(tag0_value); NWNXCore.NWNX_PushArgumentString(tag0_tag); } NWNXCore.NWNX_CallFunction(PLUGIN_NAME, sFunc); }
/// <summary> /// Create and returns a transition (square shaped of specified size) at a location /// Valid object types for the target are DOOR or WAYPOINT. /// If a tag is specified the returning object will have that tag /// </summary> /// <param name="area"></param> /// <param name="target"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="z"></param> /// <param name="size"></param> /// <param name="tag"></param> /// <returns></returns> public static NWGameObject CreateTransition(NWGameObject area, NWGameObject target, float x, float y, float z, float size = 2.0f, string tag = "") { string sFunc = "CreateTransition"; NWNXCore.NWNX_PushArgumentString(NWNX_Area, sFunc, tag); NWNXCore.NWNX_PushArgumentFloat(NWNX_Area, sFunc, size); NWNXCore.NWNX_PushArgumentFloat(NWNX_Area, sFunc, z); NWNXCore.NWNX_PushArgumentFloat(NWNX_Area, sFunc, y); NWNXCore.NWNX_PushArgumentFloat(NWNX_Area, sFunc, x); NWNXCore.NWNX_PushArgumentObject(NWNX_Area, sFunc, target); NWNXCore.NWNX_PushArgumentObject(NWNX_Area, sFunc, area); NWNXCore.NWNX_CallFunction(NWNX_Area, sFunc); return(NWNXCore.NWNX_GetReturnValueObject(NWNX_Area, sFunc)); }
/// <summary> /// Set Attack Event Script /// If oOwner is OBJECT_INVALID, this sets the script globally for all creatures /// If oOwner is valid, it will set it only for that creature. /// </summary> /// <param name="sScript"></param> /// <param name="oOwner"></param> public static void SetAttackEventScript(string sScript, NWGameObject oOwner = null) { if (oOwner == null) { oOwner = new NWGameObject(); } string sFunc = "SetEventScript"; NWNXCore.NWNX_PushArgumentObject(NWNX_Damage, sFunc, oOwner); NWNXCore.NWNX_PushArgumentString(NWNX_Damage, sFunc, sScript); NWNXCore.NWNX_PushArgumentString(NWNX_Damage, sFunc, "ATTACK"); NWNXCore.NWNX_CallFunction(NWNX_Damage, sFunc); }
/// <summary> /// Sets a player's quickbar slot /// </summary> /// <param name="player"></param> /// <param name="slot"></param> /// <param name="qbs"></param> public static void SetQuickBarSlot(NWGameObject player, int slot, QuickBarSlot qbs) { string sFunc = "SetQuickBarSlot"; NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, qbs.Item); NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, qbs.SecondaryItem); NWNXCore.NWNX_PushArgumentInt(NWNX_Player, sFunc, (int)qbs.ObjectType); NWNXCore.NWNX_PushArgumentInt(NWNX_Player, sFunc, qbs.MultiClass); NWNXCore.NWNX_PushArgumentString(NWNX_Player, sFunc, qbs.Resref); NWNXCore.NWNX_PushArgumentString(NWNX_Player, sFunc, qbs.CommandLabel); NWNXCore.NWNX_PushArgumentString(NWNX_Player, sFunc, qbs.CommandLine); NWNXCore.NWNX_PushArgumentString(NWNX_Player, sFunc, qbs.ToolTip); NWNXCore.NWNX_PushArgumentInt(NWNX_Player, sFunc, qbs.INTParam1); NWNXCore.NWNX_PushArgumentInt(NWNX_Player, sFunc, qbs.MetaType); NWNXCore.NWNX_PushArgumentInt(NWNX_Player, sFunc, qbs.DomainLevel); NWNXCore.NWNX_PushArgumentInt(NWNX_Player, sFunc, qbs.AssociateType); NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, qbs.Associate); NWNXCore.NWNX_PushArgumentInt(NWNX_Player, sFunc, slot); NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, player); NWNXCore.NWNX_CallFunction(NWNX_Player, sFunc); }
/// <summary> /// Removes a banned CD key. /// </summary> /// <param name="key"></param> public static void RemoveBannedCDKey(string key) { NWNXCore.NWNX_PushArgumentString("NWNX_Administration", "REMOVE_BANNED_CDKEY", key); NWNXCore.NWNX_CallFunction("NWNX_Administration", "REMOVE_BANNED_CDKEY"); }
/// <summary> /// Sets the module's name as shown in the server list. /// </summary> /// <param name="name"></param> public static void SetModuleName(string name) { NWNXCore.NWNX_PushArgumentString("NWNX_Administration", "SET_MODULE_NAME", name); NWNXCore.NWNX_CallFunction("NWNX_Administration", "SET_MODULE_NAME"); }
// Registers the script which receives all chat messages. // If a script was previously registered, this one will take over. public static void RegisterChatScript(string script) { NWNXCore.NWNX_PushArgumentString("NWNX_Chat", "REGISTER_CHAT_SCRIPT", script); NWNXCore.NWNX_CallFunction("NWNX_Chat", "REGISTER_CHAT_SCRIPT"); }
/// <summary> /// Sets the server's name as shown in the server list. /// </summary> /// <param name="name"></param> public static void SetServerName(string name) { NWNXCore.NWNX_PushArgumentString("NWNX_Administration", "SET_SERVER_NAME", name); NWNXCore.NWNX_CallFunction("NWNX_Administration", "SET_SERVER_NAME"); }
/// <summary> /// Delete the temporary user resource data (TURD) of a playerName + characterName /// </summary> /// <param name="playerName">Name of the player's user account</param> /// <param name="characterName">Name of the character</param> public static void DeleteTURD(string playerName, string characterName) { NWNXCore.NWNX_PushArgumentString("NWNX_Administration", "DELETE_TURD", characterName); NWNXCore.NWNX_PushArgumentString("NWNX_Administration", "DELETE_TURD", playerName); NWNXCore.NWNX_CallFunction("NWNX_Administration", "DELETE_TURD"); }
/// <summary> /// Removes a banned IP address. /// </summary> /// <param name="ip"></param> public static void RemoveBannedIP(string ip) { NWNXCore.NWNX_PushArgumentString("NWNX_Administration", "REMOVE_BANNED_IP", ip); NWNXCore.NWNX_CallFunction("NWNX_Administration", "REMOVE_BANNED_IP"); }
/// <summary> /// Removes a banned player name. /// </summary> /// <param name="playername"></param> public static void RemoveBannedPlayerName(string playername) { NWNXCore.NWNX_PushArgumentString("NWNX_Administration", "REMOVE_BANNED_PLAYER_NAME", playername); NWNXCore.NWNX_CallFunction("NWNX_Administration", "REMOVE_BANNED_PLAYER_NAME"); }