Пример #1
0
        public static byte[] Create(N3Message messageBody)
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return(null);
            }

            int localDynelInstance = N3EngineClient_t.GetClientInst(pEngine);

            messageBody.Identity = new Identity(IdentityType.SimpleChar, localDynelInstance);

            var message = new Message
            {
                Body   = messageBody,
                Header = new Header
                {
                    MessageId  = BitConverter.ToUInt16(new byte[] { 0xFF, 0xFF }, 0),
                    PacketType = messageBody.PacketType,
                    Unknown    = 0x0001,
                    Sender     = localDynelInstance,
                    Receiver   = 0x02
                }
            };

            using (MemoryStream stream = new MemoryStream())
            {
                _serializer.Serialize(stream, message);
                return(stream.ToArray());
            }
        }
Пример #2
0
        private static string GetName()
        {
            IntPtr pPlayfield = N3EngineClient_t.GetPlayfield();

            if (pPlayfield == IntPtr.Zero)
            {
                return(String.Empty);
            }

            return(Marshal.PtrToStringAnsi(N3Playfield_t.GetName(pPlayfield)));
        }
Пример #3
0
        private static unsafe Identity GetModelIdentity()
        {
            IntPtr pPlayfield = N3EngineClient_t.GetPlayfield();

            if (pPlayfield == IntPtr.Zero)
            {
                return(Identity.None);
            }

            return(*N3Playfield_t.GetModelID(pPlayfield));
        }
Пример #4
0
        //TODO: Convert to use n3Playfield_t::GetPlayfieldDynels() to remove dependencies on hard-coded offsets
        internal static unsafe List <IntPtr> GetPlayfieldDynels()
        {
            IntPtr pPlayfield = N3EngineClient_t.GetPlayfield();

            if (pPlayfield == IntPtr.Zero)
            {
                return(new List <IntPtr>());
            }

            return((*(Playfield_MemStruct *)pPlayfield).Dynels.ToList());
        }
Пример #5
0
        internal static IntPtr GetSurface()
        {
            IntPtr pPlayfield = N3EngineClient_t.GetPlayfield();

            if (pPlayfield == IntPtr.Zero)
            {
                return(IntPtr.Zero);
            }

            return(N3Playfield_t.GetSurface(pPlayfield));
        }
Пример #6
0
        private static bool IsBattleStationPF()
        {
            IntPtr pPlayfield = N3EngineClient_t.GetPlayfield();

            if (pPlayfield == IntPtr.Zero)
            {
                return(false);
            }

            return(N3Playfield_t.IsBattleStation(pPlayfield));
        }
Пример #7
0
        public static bool LineOfSight(Vector3 pos1, Vector3 pos2, int zoneCell = 1, bool unknown = false)
        {
            IntPtr pPlayfield = N3EngineClient_t.GetPlayfield();

            if (pPlayfield == IntPtr.Zero)
            {
                return(false);
            }

            return(N3Playfield_t.LineOfSight(pPlayfield, &pos1, &pos2, zoneCell, false));
        }
Пример #8
0
        private static bool IsShadowlandPF()
        {
            IntPtr pPlayfield = N3EngineClient_t.GetPlayfield();

            if (pPlayfield == IntPtr.Zero)
            {
                return(false);
            }

            return(PlayfieldAnarchy_t.IsShadowlandPF(pPlayfield));
        }
Пример #9
0
        private static bool AreVehiclesAllowed()
        {
            IntPtr pPlayfield = N3EngineClient_t.GetPlayfield();

            if (pPlayfield == IntPtr.Zero)
            {
                return(false);
            }

            return(PlayfieldAnarchy_t.AreVehiclesAllowed(pPlayfield));
        }
Пример #10
0
        private static unsafe List <Room> GetRooms()
        {
            IntPtr pPlayfield = N3EngineClient_t.GetPlayfield();

            if (pPlayfield == IntPtr.Zero || !IsDungeon)
            {
                return(new List <Room>());
            }

            return((*N3Playfield_t.GetZones(pPlayfield)).ToList().Select(x => new Room(x)).ToList());
        }
Пример #11
0
        private static unsafe List <Zone> GetZones()
        {
            IntPtr pPlayfield = N3EngineClient_t.GetPlayfield();

            if (pPlayfield == IntPtr.Zero)
            {
                return(new List <Zone>());
            }

            return((*N3Playfield_t.GetZones(pPlayfield)).ToList().Select(x => new Zone(x)).ToList());
        }
Пример #12
0
        private static LocalPlayer GetLocalPlayer()
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return(null);
            }

            IntPtr pLocalPlayer = N3EngineClient_t.GetClientControlDynel(pEngine);

            return(pLocalPlayer == IntPtr.Zero ? null : new LocalPlayer(pLocalPlayer));
        }