Ejemplo n.º 1
0
        public static void HandlePhaseShift(Packet packet)
        {
            var phaseShift = packet.Holder.PhaseShift = new PacketPhaseShift();

            CoreParsers.MovementHandler.ActivePhases.Clear();

            phaseShift.Client = packet.ReadPackedGuid128("Client");

            // PhaseShiftData
            packet.ReadInt32("PhaseShiftFlags");
            var count = packet.ReadInt32("PhaseShiftCount");

            phaseShift.PersonalGuid = packet.ReadPackedGuid128("PersonalGUID");
            for (var i = 0; i < count; ++i)
            {
                var flags = packet.ReadUInt16E <PhaseFlags>("PhaseFlags", i);
                var id    = packet.ReadUInt16();
                phaseShift.Phases.Add(id);

                if (Settings.UseDBC && DBC.Phase.ContainsKey(id))
                {
                    packet.WriteLine($"[{i}] ID: {id} ({(DBCPhaseFlags)DBC.Phase[id].Flags})");
                }
                else
                {
                    packet.AddValue("ID", id, i);
                }

                CoreParsers.MovementHandler.ActivePhases.Add(id, true);
            }

            if (DBC.Phases.Any())
            {
                foreach (var phaseGroup in DBC.GetPhaseGroups(CoreParsers.MovementHandler.ActivePhases.Keys))
                {
                    packet.WriteLine($"PhaseGroup: { phaseGroup } Phases: { string.Join(" - ", DBC.Phases[phaseGroup]) }");
                }
            }

            var visibleMapIDsCount = packet.ReadInt32("VisibleMapIDsCount") / 2;

            for (var i = 0; i < visibleMapIDsCount; ++i)
            {
                phaseShift.VisibleMaps.Add((uint)packet.ReadInt16 <MapId>("VisibleMapID", i));
            }

            var preloadMapIDCount = packet.ReadInt32("PreloadMapIDsCount") / 2;

            for (var i = 0; i < preloadMapIDCount; ++i)
            {
                phaseShift.PreloadMaps.Add((uint)packet.ReadInt16 <MapId>("PreloadMapID", i));
            }

            var uiWorldMapAreaIDSwapsCount = packet.ReadInt32("UiWorldMapAreaIDSwap") / 2;

            for (var i = 0; i < uiWorldMapAreaIDSwapsCount; ++i)
            {
                phaseShift.UiMapPhase.Add((uint)packet.ReadInt16("UiWorldMapAreaIDSwaps", i));
            }
        }
Ejemplo n.º 2
0
        public static void HandlePhaseShift(Packet packet)
        {
            ActivePhases.Clear();

            packet.ReadPackedGuid128("Client");

            // PhaseShiftData
            packet.ReadInt32("PhaseShiftFlags");
            var count = packet.ReadInt32("PhaseShiftCount");

            packet.ReadPackedGuid128("PersonalGUID");
            for (var i = 0; i < count; ++i)
            {
                var flags = packet.ReadUInt16("PhaseFlags", i);
                var id    = packet.ReadUInt16("Id", i);
                ActivePhases.Add(id);
            }

            if (DBC.Phases.Any())
            {
                foreach (var phaseGroup in DBC.GetPhaseGroups(ActivePhases))
                {
                    packet.WriteLine($"PhaseGroup: { phaseGroup } Phases: { string.Join(" - ", DBC.Phases[phaseGroup]) }");
                }
            }

            var preloadMapIDCount = packet.ReadInt32("PreloadMapIDsCount") / 2;

            for (var i = 0; i < preloadMapIDCount; ++i)
            {
                packet.ReadInt16 <MapId>("PreloadMapID", i);
            }

            var uiWorldMapAreaIDSwapsCount = packet.ReadInt32("UiWorldMapAreaIDSwap") / 2;

            for (var i = 0; i < uiWorldMapAreaIDSwapsCount; ++i)
            {
                packet.ReadInt16 <MapId>("UiWorldMapAreaIDSwaps", i);
            }

            var visibleMapIDsCount = packet.ReadInt32("VisibleMapIDsCount") / 2;

            for (var i = 0; i < visibleMapIDsCount; ++i)
            {
                packet.ReadInt16 <MapId>("VisibleMapID", i);
            }
        }