Example #1
0
        protected override void HandleAppPacket(AppPacket packet)
        {
            switch ((WorldOp)packet.Opcode)
            {
            case WorldOp.GuildsList:
                break;

            case WorldOp.LogServer:
            case WorldOp.ApproveWorld:
            case WorldOp.EnterWorld:
            case WorldOp.ExpansionInfo:
                break;

            case WorldOp.SendCharInfo:
                var chars = new CharacterSelect(packet.Data);
                CharacterList?.Invoke(this, chars.Characters);
                break;

            case WorldOp.MessageOfTheDay:
                MOTD?.Invoke(this, Encoding.ASCII.GetString(packet.Data));
                break;

            case WorldOp.ZoneServerInfo:
                var info = packet.Get <ZoneServerInfo>();
                ZoneServer?.Invoke(this, info);
                break;

            default:
                WriteLine($"Unhandled packet in WorldStream: {(WorldOp)packet.Opcode} (0x{packet.Opcode:X04})");
                Hexdump(packet.Data);
                break;
            }
        }
Example #2
0
        protected override void HandleAppPacket(AppPacket packet)
        {
            switch ((WorldOp)packet.Opcode)
            {
            case WorldOp.GuildsList:
                break;

            case WorldOp.LogServer:
            case WorldOp.ApproveWorld:
            case WorldOp.EnterWorld:
            case WorldOp.ExpansionInfo:
                break;

            case WorldOp.SendCharInfo:
                var chars = new CharacterSelect(packet.Data);
                CharacterList?.Invoke(this, chars.Characters);
                break;

            case WorldOp.MessageOfTheDay:
                MOTD?.Invoke(this, Encoding.ASCII.GetString(packet.Data));
                break;

            case WorldOp.ZoneServerInfo:
                var info = packet.Get <ZoneServerInfo>();
                ZoneServer?.Invoke(this, info);
                break;

            case WorldOp.SetChatServer:
            case WorldOp.SetChatServer2:
                ChatServerList?.Invoke(this, packet.Data);
                break;

            case WorldOp.PostEnterWorld:
                // The emu doesn't do anything with ApproveWorld and WorldClientReady so we may be able to just skip them both.
                Send(AppPacket.Create(WorldOp.ApproveWorld, null));
                Send(AppPacket.Create(WorldOp.WorldClientReady, null));
                break;

            case WorldOp.ApproveName:
                CharacterCreateNameApproval?.Invoke(this, packet.Data[0]);
                break;

            default:
                WriteLine($"Unhandled packet in WorldStream: {(WorldOp)packet.Opcode} (0x{packet.Opcode:X04})");
                Hexdump(packet.Data);
                break;
            }
        }