Example #1
0
        private static bool HandleRunScriptChunkEvent(CNWSMessage message, NwPlayer?player)
        {
            int    offset      = 0;
            string scriptChunk = message.PeekMessageString(offset);

            offset += scriptChunk.Length + 4;

            uint oidTarget = message.PeekMessage <uint>(offset);

            if (oidTarget == NwObject.Invalid)
            {
                oidTarget = player?.ControlledCreature;
            }

            offset += sizeof(uint);
            bool wrapIntoMain = (message.PeekMessage <int>(offset) & 0x10).ToBool();

            OnDebugRunScriptChunk eventData = ProcessEvent(new OnDebugRunScriptChunk
            {
                Player       = player,
                ScriptChunk  = scriptChunk,
                Target       = (oidTarget & 0x7FFFFFFF).ToNwObject(),
                WrapIntoMain = wrapIntoMain,
            });

            return(!eventData.Skip);
        }
Example #2
0
            private static int OnHandleMapPinSetMapPinAtMessage(void *pMessage, void *pPlayer)
            {
                CNWSMessage message = CNWSMessage.FromPointer(pMessage);
                CNWSPlayer  player  = CNWSPlayer.FromPointer(pPlayer);

                if (player == null)
                {
                    return(Hook.CallOriginal(pMessage, pPlayer));
                }

                // Coordinates
                int   offset = 0;
                float x      = message.PeekMessage <float>(offset);

                offset += sizeof(float);
                float y = message.PeekMessage <float>(offset);

                offset += sizeof(float);
                float z = message.PeekMessage <float>(offset);

                offset += sizeof(float);

                // Note
                string note = message.PeekMessageString(offset);

                OnMapPinAddPin eventData = ProcessEvent(new OnMapPinAddPin
                {
                    Player   = player.ToNwPlayer() !,
                    Position = new Vector3(x, y, z),
                    Note     = note,
                });
Example #3
0
        private static bool HandleRunScriptEvent(CNWSMessage message, NwPlayer?player)
        {
            int    offset     = 0;
            string scriptName = message.PeekMessageString(offset);

            offset += scriptName.Length + 4;

            uint oidTarget = player?.Player.SatisfiesBuild(8193, 14).ToBool() == true?message.PeekMessage <uint>(offset) : NwObject.Invalid;

            if (oidTarget == NwObject.Invalid)
            {
                oidTarget = player?.ControlledCreature;
            }

            OnDebugRunScript eventData = new OnDebugRunScript
            {
                Player     = player,
                ScriptName = scriptName,
                Target     = (oidTarget & 0x7FFFFFFF).ToNwObject(),
            };

            return(!eventData.Skip);
        }