コード例 #1
0
        /// <summary>
        /// Get Attack Event Data (to use only on Attack Event Script)
        /// </summary>
        /// <returns></returns>
        public static AttackEventData GetAttackEventData()
        {
            string          sFunc = "GetAttackEventData";
            AttackEventData data  = new AttackEventData();

            NWNXCore.NWNX_CallFunction(NWNX_Damage, sFunc);

            data.Target       = NWNXCore.NWNX_GetReturnValueObject(NWNX_Damage, sFunc);
            data.Bludgeoning  = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.Pierce       = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.Slash        = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.Magical      = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.Acid         = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.Cold         = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.Divine       = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.Electrical   = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.Fire         = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.Negative     = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.Positive     = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.Sonic        = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.Base         = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.AttackNumber = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.AttackResult = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.AttackType   = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);
            data.SneakAttack  = NWNXCore.NWNX_GetReturnValueInt(NWNX_Damage, sFunc);

            return(data);
        }
コード例 #2
0
        /// <summary>
        /// Get an AdministrationOption value
        /// </summary>
        /// <param name="option"></param>
        /// <returns></returns>
        public static int GetPlayOption(AdministrationOption option)
        {
            NWNXCore.NWNX_PushArgumentInt("NWNX_Administration", "GET_PLAY_OPTION", (int)option);
            NWNXCore.NWNX_CallFunction("NWNX_Administration", "GET_PLAY_OPTION");

            return(NWNXCore.NWNX_GetReturnValueInt("NWNX_Administration", "GET_PLAY_OPTION"));
        }
コード例 #3
0
        /// <summary>
        /// Starts displaying a timing bar.
        /// Will run a script at the end of the timing bar, if specified.
        /// </summary>
        /// <param name="creature">The creature who will see the timing bar.</param>
        /// <param name="seconds">How long the timing bar should come on screen.</param>
        /// <param name="script">The script to run at the end of the timing bar.</param>
        public static void StartGuiTimingBar(NWGameObject creature, float seconds, string script)
        {
            // only one timing bar at a time!
            if (_.GetLocalInt(creature, "NWNX_PLAYER_GUI_TIMING_ACTIVE") == 1)
            {
                return;
            }

            string sFunc = "StartGuiTimingBar";

            NWNXCore.NWNX_PushArgumentFloat(NWNX_Player, sFunc, seconds);
            NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, creature);

            NWNXCore.NWNX_CallFunction(NWNX_Player, sFunc);

            int id = _.GetLocalInt(creature, "NWNX_PLAYER_GUI_TIMING_ID") + 1;

            _.SetLocalInt(creature, "NWNX_PLAYER_GUI_TIMING_ACTIVE", id);
            _.SetLocalInt(creature, "NWNX_PLAYER_GUI_TIMING_ID", id);

            _.DelayCommand(seconds, () =>
            {
                StopGuiTimingBar(creature, script, -1);
            });
        }
コード例 #4
0
        /// <summary>
        /// Gets the player's quickbar slot info
        /// </summary>
        /// <param name="player"></param>
        /// <param name="slot"></param>
        /// <returns></returns>
        public static QuickBarSlot GetQuickBarSlot(NWGameObject player, int slot)
        {
            string       sFunc = "GetQuickBarSlot";
            QuickBarSlot qbs   = new QuickBarSlot();

            NWNXCore.NWNX_PushArgumentInt(NWNX_Player, sFunc, slot);
            NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, player);
            NWNXCore.NWNX_CallFunction(NWNX_Player, sFunc);

            qbs.Associate     = (NWNXCore.NWNX_GetReturnValueObject(NWNX_Player, sFunc));
            qbs.AssociateType = NWNXCore.NWNX_GetReturnValueInt(NWNX_Player, sFunc);
            qbs.DomainLevel   = NWNXCore.NWNX_GetReturnValueInt(NWNX_Player, sFunc);
            qbs.MetaType      = NWNXCore.NWNX_GetReturnValueInt(NWNX_Player, sFunc);
            qbs.INTParam1     = NWNXCore.NWNX_GetReturnValueInt(NWNX_Player, sFunc);
            qbs.ToolTip       = NWNXCore.NWNX_GetReturnValueString(NWNX_Player, sFunc);
            qbs.CommandLine   = NWNXCore.NWNX_GetReturnValueString(NWNX_Player, sFunc);
            qbs.CommandLabel  = NWNXCore.NWNX_GetReturnValueString(NWNX_Player, sFunc);
            qbs.Resref        = NWNXCore.NWNX_GetReturnValueString(NWNX_Player, sFunc);
            qbs.MultiClass    = NWNXCore.NWNX_GetReturnValueInt(NWNX_Player, sFunc);
            qbs.ObjectType    = (QuickBarSlotType)NWNXCore.NWNX_GetReturnValueInt(NWNX_Player, sFunc);
            qbs.SecondaryItem = (NWNXCore.NWNX_GetReturnValueObject(NWNX_Player, sFunc));
            qbs.Item          = (NWNXCore.NWNX_GetReturnValueObject(NWNX_Player, sFunc));

            return(qbs);
        }
コード例 #5
0
        /// <summary>
        /// Stops displaying a timing bar.
        /// Runs a script if specified.
        /// </summary>
        /// <param name="creature">The creature's timing bar to stop.</param>
        /// <param name="script">The script to run once ended.</param>
        /// <param name="id">ID number of this timing bar.</param>
        public static void StopGuiTimingBar(NWGameObject creature, string script, int id)
        {
            int activeId = _.GetLocalInt(creature, "NWNX_PLAYER_GUI_TIMING_ACTIVE");

            // Either the timing event was never started, or it already finished.
            if (activeId == 0)
            {
                return;
            }

            // If id != -1, we ended up here through DelayCommand. Make sure it's for the right ID
            if (id != -1 && id != activeId)
            {
                return;
            }

            _.DeleteLocalInt(creature, "NWNX_PLAYER_GUI_TIMING_ACTIVE");

            string sFunc = "StopGuiTimingBar";

            NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, creature);
            NWNXCore.NWNX_CallFunction(NWNX_Player, sFunc);

            if (!string.IsNullOrWhiteSpace(script))
            {
                _.ExecuteScript(script, creature);
            }
        }
コード例 #6
0
        public static void SetDevastatingCriticalEventScript(string sScript)
        {
            string sFunc = "SetDevastatingCriticalEventScript";

            NWNXCore.NWNX_PushArgumentString(NWNX_Weapon, sFunc, sScript);

            NWNXCore.NWNX_CallFunction(NWNX_Weapon, sFunc);
        }
コード例 #7
0
        /// <summary>
        /// Get the name of the .bic file associated with the player's character.
        /// </summary>
        /// <param name="player"></param>
        /// <returns></returns>
        public static string GetBicFileName(NWGameObject player)
        {
            string sFunc = "GetBicFileName";

            NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, player);
            NWNXCore.NWNX_CallFunction(NWNX_Player, sFunc);
            return(NWNXCore.NWNX_GetReturnValueString(NWNX_Player, sFunc));
        }
コード例 #8
0
        /// <summary>
        /// Set the PVP setting of area
        /// </summary>
        /// <param name="area"></param>
        /// <param name="pvpSetting"></param>
        public static void SetPVPSetting(NWGameObject area, AreaPVPSetting pvpSetting)
        {
            string sFunc = "SetPVPSetting";

            NWNXCore.NWNX_PushArgumentInt(NWNX_Area, sFunc, (int)pvpSetting);
            NWNXCore.NWNX_PushArgumentObject(NWNX_Area, sFunc, area);
            NWNXCore.NWNX_CallFunction(NWNX_Area, sFunc);
        }
コード例 #9
0
        /// <summary>
        /// Set the shadow opacity of area
        /// shadowOpacity = 0-100
        /// </summary>
        /// <param name="area"></param>
        /// <param name="shadowOpacity"></param>
        public static void SetShadowOpacity(NWGameObject area, int shadowOpacity)
        {
            string sFunc = "SetShadowOpacity";

            NWNXCore.NWNX_PushArgumentInt(NWNX_Area, sFunc, shadowOpacity);
            NWNXCore.NWNX_PushArgumentObject(NWNX_Area, sFunc, area);
            NWNXCore.NWNX_CallFunction(NWNX_Area, sFunc);
        }
コード例 #10
0
        /// <summary>
        /// Set the day/night cycle of area
        /// </summary>
        /// <param name="area"></param>
        /// <param name="type"></param>
        public static void SetDayNightCycle(NWGameObject area, AreaDayNightCycle type)
        {
            string sFunc = "SetDayNightCycle";

            NWNXCore.NWNX_PushArgumentInt(NWNX_Area, sFunc, (int)type);
            NWNXCore.NWNX_PushArgumentObject(NWNX_Area, sFunc, area);
            NWNXCore.NWNX_CallFunction(NWNX_Area, sFunc);
        }
コード例 #11
0
        /// <summary>
        /// Set the wind power in area
        /// windPower = 0-2
        /// </summary>
        /// <param name="area"></param>
        /// <param name="windPower"></param>
        public static void SetWindPower(NWGameObject area, int windPower)
        {
            string sFunc = "SetWindPower";

            NWNXCore.NWNX_PushArgumentInt(NWNX_Area, sFunc, windPower);
            NWNXCore.NWNX_PushArgumentObject(NWNX_Area, sFunc, area);
            NWNXCore.NWNX_CallFunction(NWNX_Area, sFunc);
        }
コード例 #12
0
        /// <summary>
        /// Set the fog clip distance in area
        /// </summary>
        /// <param name="area"></param>
        /// <param name="distance"></param>
        public static void SetFogClipDistance(NWGameObject area, float distance)
        {
            string sFunc = "SetFogClipDistance";

            NWNXCore.NWNX_PushArgumentFloat(NWNX_Area, sFunc, distance);
            NWNXCore.NWNX_PushArgumentObject(NWNX_Area, sFunc, area);
            NWNXCore.NWNX_CallFunction(NWNX_Area, sFunc);
        }
コード例 #13
0
        /// <summary>
        /// Set whether resting is allowed in area
        /// true: Resting not allowed
        /// false: Resting allowed
        /// </summary>
        /// <param name="area"></param>
        /// <param name="bNoRestingAllowed"></param>
        public static void SetNoRestingAllowed(NWGameObject area, bool bNoRestingAllowed)
        {
            string sFunc = "SetNoRestingAllowed";

            NWNXCore.NWNX_PushArgumentInt(NWNX_Area, sFunc, bNoRestingAllowed ? 1 : 0);
            NWNXCore.NWNX_PushArgumentObject(NWNX_Area, sFunc, area);
            NWNXCore.NWNX_CallFunction(NWNX_Area, sFunc);
        }
コード例 #14
0
        /// <summary>
        /// Set the listen modifer of area
        /// </summary>
        /// <param name="area"></param>
        /// <param name="listenModifier"></param>
        public static void SetAreaListenModifier(NWGameObject area, int listenModifier)
        {
            string sFunc = "SetAreaListenModifier";

            NWNXCore.NWNX_PushArgumentInt(NWNX_Area, sFunc, listenModifier);
            NWNXCore.NWNX_PushArgumentObject(NWNX_Area, sFunc, area);
            NWNXCore.NWNX_CallFunction(NWNX_Area, sFunc);
        }
コード例 #15
0
        public static void SetWeaponIsMonkWeapon(int nBaseItem)
        {
            string sFunc = "SetWeaponIsMonkWeapon";

            NWNXCore.NWNX_PushArgumentInt(NWNX_Weapon, sFunc, nBaseItem);

            NWNXCore.NWNX_CallFunction(NWNX_Weapon, sFunc);
        }
コード例 #16
0
        /// <summary>
        /// // Refreshes the players character sheet
        /// Note: You may need to use DelayCommand if you're manipulating values
        /// through nwnx and forcing a UI refresh, 0.5s seemed to be fine
        /// </summary>
        /// <param name="player"></param>
        public static void UpdateCharacterSheet(NWGameObject player)
        {
            string sFunc = "UpdateCharacterSheet";

            NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, player);

            NWNXCore.NWNX_CallFunction(NWNX_Player, sFunc);
        }
コード例 #17
0
        /// <summary>
        /// Get the data set with NWNX_Effect_SetEffectExpiredScript()
        ///
        /// THIS SHOULD ONLY BE CALLED FROM WITHIN A SCRIPT THAT WAS EXECUTED BY SetEffectExpiredScript()
        /// </summary>
        /// <returns></returns>
        public static string GetEffectExpiredData()
        {
            string sFunc = "GetEffectExpiredData";

            NWNXCore.NWNX_CallFunction(NWNX_Effect, sFunc);

            return(NWNXCore.NWNX_GetReturnValueString(NWNX_Effect, sFunc));
        }
コード例 #18
0
        /// <summary>
        /// Get the effect creator of NWNX_Effect_SetEffectExpiredScript()
        /// THIS SHOULD ONLY BE CALLED FROM WITHIN A SCRIPT THAT WAS EXECUTED BY NWNX_Effect_SetEffectExpiredScript()
        /// </summary>
        /// <returns></returns>
        public static NWGameObject GetEffectExpiredCreator()
        {
            string sFunc = "GetEffectExpiredCreator";

            NWNXCore.NWNX_CallFunction(NWNX_Effect, sFunc);

            return(NWNXCore.NWNX_GetReturnValueObject(NWNX_Effect, sFunc));
        }
コード例 #19
0
        // Set oItem's weight. Will not persist through saving.
        public static void SetWeight(NWGameObject oItem, int w)
        {
            string sFunc = "SetWeight";

            NWNXCore.NWNX_PushArgumentInt(NWNX_Item, sFunc, w);
            NWNXCore.NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem);

            NWNXCore.NWNX_CallFunction(NWNX_Item, sFunc);
        }
コード例 #20
0
        // Get oItem's additional value in gold pieces.
        public static int GetAddGoldPieceValue(NWGameObject oItem)
        {
            string sFunc = "GetAddGoldPieceValue";

            NWNXCore.NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem);

            NWNXCore.NWNX_CallFunction(NWNX_Item, sFunc);
            return(NWNXCore.NWNX_GetReturnValueInt(NWNX_Item, sFunc));
        }
コード例 #21
0
        // Set oItem's base item type. This will not be visible until the
        // item is refreshed (e.g. drop and take the item, or logging out
        // and back in).
        public static void SetBaseItemType(NWGameObject oItem, int nBaseItem)
        {
            string sFunc = "SetBaseItemType";

            NWNXCore.NWNX_PushArgumentInt(NWNX_Item, sFunc, nBaseItem);
            NWNXCore.NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem);

            NWNXCore.NWNX_CallFunction(NWNX_Item, sFunc);
        }
コード例 #22
0
        public static int GetBaseArmorClass(NWGameObject oItem)
        {
            string sFunc = "GetBaseArmorClass";

            NWNXCore.NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem);

            NWNXCore.NWNX_CallFunction(NWNX_Item, sFunc);
            return(NWNXCore.NWNX_GetReturnValueInt(NWNX_Item, sFunc));
        }
コード例 #23
0
        // Set oItem's additional value in gold pieces (Total cost = base_value +
        // additional_value). Will persist through saving.
        public static void SetAddGoldPieceValue(NWGameObject oItem, int g)
        {
            string sFunc = "SetAddGoldPieceValue";

            NWNXCore.NWNX_PushArgumentInt(NWNX_Item, sFunc, g);
            NWNXCore.NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem);

            NWNXCore.NWNX_CallFunction(NWNX_Item, sFunc);
        }
コード例 #24
0
        // 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);
        }
コード例 #25
0
        // Return a String containing the entire appearance for oItem which can later be
        // passed to RestoreItemAppearance().
        public static string GetEntireItemAppearance(NWGameObject oItem)
        {
            string sFunc = "GetEntireItemAppearance";

            NWNXCore.NWNX_PushArgumentObject(NWNX_Item, sFunc, oItem);

            NWNXCore.NWNX_CallFunction(NWNX_Item, sFunc);
            return(NWNXCore.NWNX_GetReturnValueString(NWNX_Item, sFunc));
        }
コード例 #26
0
        /// <summary>
        /// Stops the background music for the given player only
        /// </summary>
        /// <param name="player"></param>
        public static void MusicBattleStop(NWGameObject player)
        {
            string sFunc = "PlayBattleMusic";

            NWNXCore.NWNX_PushArgumentInt(NWNX_Player, sFunc, 0); // bool play = FALSE
            NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, player);

            NWNXCore.NWNX_CallFunction(NWNX_Player, sFunc);
        }
コード例 #27
0
 // 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"));
 }
コード例 #28
0
        /// <summary>
        /// Override oPlayer's rest animation to nAnimation
        ///
        /// NOTE: nAnimation does not take ANIMATION_LOOPING_* or ANIMATION_FIREFORGET_* constants
        ///       Use NWNX_Consts_TranslateNWScriptAnimation() in nwnx_consts.nss to get their NWNX equivalent
        ///       -1 to clear the override
        /// </summary>
        /// <param name="oPlayer">The player object</param>
        /// <param name="nAnimation">The rest animation</param>
        public static void SetRestAnimation(NWGameObject oPlayer, int nAnimation)
        {
            string sFunc = "SetRestAnimation";

            NWNXCore.NWNX_PushArgumentInt(NWNX_Player, sFunc, nAnimation);
            NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, oPlayer);

            NWNXCore.NWNX_CallFunction(NWNX_Player, sFunc);
        }
コード例 #29
0
        /// <summary>
        /// Force opens the target object's inventory for the player.
        /// A few notes about this function:
        /// - If the placeable is in a different area than the player, the portrait will not be shown
        /// - The placeable's open/close animations will be played
        /// - Clicking the 'close' button will cause the player to walk to the placeable;
        ///     If the placeable is in a different area, the player will just walk to the edge
        ///     of the current area and stop. This action can be cancelled manually.
        /// - Walking will close the placeable automatically.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="placeable"></param>
        public static void ForcePlaceableInventoryWindow(NWGameObject player, NWGameObject placeable)
        {
            string sFunc = "ForcePlaceableInventoryWindow";

            NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, placeable);
            NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, player);

            NWNXCore.NWNX_CallFunction(NWNX_Player, sFunc);
        }
コード例 #30
0
        /// <summary>
        /// Override player's rest duration
        /// Duration is in milliseconds, 1000 = 1 second
        /// Minimum duration of 10ms
        /// -1 clears the override
        /// </summary>
        /// <param name="player"></param>
        /// <param name="duration"></param>
        public static void SetRestDuration(NWGameObject player, int duration)
        {
            string sFunc = "SetRestDuration";

            NWNXCore.NWNX_PushArgumentInt(NWNX_Player, sFunc, duration);
            NWNXCore.NWNX_PushArgumentObject(NWNX_Player, sFunc, player);

            NWNXCore.NWNX_CallFunction(NWNX_Player, sFunc);
        }