Beispiel #1
0
        protected override void HandleAppPacket(AppPacket packet)
        {
            WriteLine($"Foo? {(WorldOp) packet.Opcode}");
            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));
                Send(AppPacket.Create(WorldOp.WorldClientReady));
                break;

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

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

            case WorldOp.LogServer:
                UnityEngine.Debug.Log("World: ApproveWorld");
                break;

            case WorldOp.ApproveWorld:
                UnityEngine.Debug.Log("World: ApproveWorld");
                break;

            case WorldOp.EnterWorld:
                UnityEngine.Debug.Log("World: EnterWorld");
                break;

            case WorldOp.ExpansionInfo:
                UnityEngine.Debug.Log("World: ExpansionInfo");
                break;

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

            case WorldOp.MessageOfTheDay:
                MOTD?.Invoke(this, Encoding.ASCII.GetString(packet.Data));
                UnityEngine.Debug.Log("World: MOTD");
                break;

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

            case WorldOp.SetChatServer:
                UnityEngine.Debug.Log("World: SetChatServer");
                break;

            case WorldOp.SetChatServer2:
                ChatServerList?.Invoke(this, packet.Data);
                UnityEngine.Debug.Log("World: SetChatSErver2");
                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));
                UnityEngine.Debug.Log("World: ApproveWorld/WorldClientReady");
                break;

            case WorldOp.ApproveName:
                CharacterCreateNameApproval?.Invoke(this, packet.Data[0]);
                UnityEngine.Debug.Log("World: ApproveName");
                break;

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