Exemplo n.º 1
0
        protected override void HandleSessionResponse(Packet packet)
        {
            Send(packet);

            var data = new byte[464];
            var str  = $"{accountID}\0{sessionKey}";

            Array.Copy(Encoding.ASCII.GetBytes(str), data, str.Length);
            Send(AppPacket.Create(WorldOp.SendLoginInfo, data));
        }
Exemplo n.º 2
0
 public void Login(string username, string password)
 {
     cryptoBlob = Encrypt(username, password);
     if (triedOnce)
     {
         Send(AppPacket.Create(LoginOp.Login, new Login(), cryptoBlob));
     }
     else
     {
         SendSessionRequest();
     }
 }
Exemplo n.º 3
0
        public void UpdatePosition(Tuple <float, float, float, float> Position)
        {
            var update = new ClientPlayerPositionUpdate();

            update.ID       = playerSpawnId;
            update.Sequence = updateSequence++;
            update.X        = Position.Item1;
            update.Y        = Position.Item2;
            update.Sub1     = new ClientUpdatePositionSub1();
            update.Z        = Position.Item3;
            update.Sub2     = new ClientUpdatePositionSub2(0, (ushort)(Position.Item4 * 8f * 255f));
            Send(AppPacket.Create(ZoneOp.ClientUpdate, update));
        }
Exemplo n.º 4
0
        protected override void HandleAppPacket(AppPacket packet)
        {
            Hexdump(packet.Data);

            switch ((LoginOp)packet.Opcode)
            {
            case LoginOp.ChatMessage:
                Send(AppPacket.Create(LoginOp.Login, new Login(), cryptoBlob));
                break;

            case LoginOp.LoginAccepted:
                if (packet.Data.Length < 80)
                {
                    LoginSuccess?.Invoke(this, false);
                }
                else
                {
                    var dec = Decrypt(packet.Data, 10);
                    var rep = new LoginReply(dec);
                    accountID  = rep.AcctID;
                    sessionKey = rep.Key;
                    LoginSuccess?.Invoke(this, true);
                }
                break;

            case LoginOp.ServerListResponse:
                var header = packet.Get <ServerListHeader>();
                ServerList?.Invoke(this, header.Servers);
                break;

            case LoginOp.PlayEverquestResponse:
                var resp = packet.Get <PlayResponse>();

                if (!resp.Allowed)
                {
                    UnityEngine.Debug.LogError("Response flagged Allowed false");
                    curPlay = null;
                }

                PlaySuccess?.Invoke(this, curPlay);
                break;

            default:
                UnityEngine.Debug.Log($"Unhandled packet in LoginStream: {(LoginOp) packet.Opcode} (0x{packet.Opcode:X04})");
                Hexdump(packet.Data);
                break;
            }
        }
Exemplo n.º 5
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;
            }
        }
Exemplo n.º 6
0
 public void RequestServerList()
 {
     Send(AppPacket.Create(LoginOp.ServerListRequest));
 }
Exemplo n.º 7
0
 public void EnterWorld(string name, bool tutorial, bool goHome)
 {
     Send(AppPacket.Create(WorldOp.EnterWorld, new EnterWorld(name, tutorial, goHome)));
 }
Exemplo n.º 8
0
        protected override void HandleAppPacket(AppPacket packet)
        {
            switch ((ZoneOp)packet.Opcode)
            {
            case ZoneOp.PlayerProfile:
                var player = packet.Get <PlayerProfile>();
                //WriteLine(player);
                break;

            case ZoneOp.CharInventory:
                var inventory = packet.Get <CharInventory>();
                //WriteLine(inventory);
                break;

            case ZoneOp.TimeOfDay:
                var timeofday = packet.Get <TimeOfDay>();
                //WriteLine(timeofday);
                break;

            case ZoneOp.TaskActivity:
                var activity = packet.Get <TaskActivity>();
                //WriteLine(activity);
                break;

            case ZoneOp.TaskDescription:
                var desc = packet.Get <TaskDescription>();
                //WriteLine(desc);
                break;

            case ZoneOp.CompletedTasks:
                var comp = packet.Get <CompletedTasks>();
                //WriteLine(comp);
                break;

            case ZoneOp.XTargetResponse:
                var xt = packet.Get <XTarget>();
                //WriteLine(xt);
                break;

            case ZoneOp.Weather:
                var weather = packet.Get <Weather>();
                //WriteLine(weather);

                if (entering)
                {
                    Send(AppPacket.Create(ZoneOp.ReqNewZone));
                }
                break;

            case ZoneOp.TributeTimer:
                var timer = packet.Get <TributeTimer>();
                //WriteLine(timer);
                break;

            case ZoneOp.TributeUpdate:
                var update = packet.Get <TributeInfo>();
                //WriteLine(update);
                break;

            case ZoneOp.ZoneEntry:
                var mob = packet.Get <Spawn>();
                //WriteLine(mob);
                break;

            case ZoneOp.NewZone:
                Send(AppPacket.Create(ZoneOp.ReqClientSpawn));

                break;

            case ZoneOp.SendExpZonein:
                if (packet.Data.Length == 0)
                {
                    Send(AppPacket.Create(ZoneOp.ClientReady));
                    entering = false;
                }
                break;

            case ZoneOp.SendFindableNPCs:
                var npc = packet.Get <FindableNPC>();
                //WriteLine(npc);
                break;

            case ZoneOp.ClientUpdate:
                break;

            case ZoneOp.HPUpdate:
                break;

            default:
                WriteLine($"Unhandled packet in ZoneStream: {(ZoneOp) packet.Opcode} (0x{packet.Opcode:X04})");
                Hexdump(packet.Data);
                break;
            }
        }
Exemplo n.º 9
0
        protected override void HandleAppPacket(AppPacket packet)
        {
            //WriteLine($"Zone app packet: {(ZoneOp) packet.Opcode}");
            switch ((ZoneOp)packet.Opcode)
            {
            case ZoneOp.PlayerProfile:
                var player = packet.Get <PlayerProfile>();
                //WriteLine(player);
                break;

            case ZoneOp.TimeOfDay:
                var timeofday = packet.Get <TimeOfDay>();
                //WriteLine(timeofday);
                break;

            case ZoneOp.TaskActivity:
                // XXX: Handle short activities!
                //var activity = packet.Get<TaskActivity>();
                //WriteLine(activity);
                break;

            case ZoneOp.TaskDescription:
                var desc = packet.Get <TaskDescription>();
                //WriteLine(desc);
                break;

            case ZoneOp.CompletedTasks:
                var comp = packet.Get <CompletedTasks>();
                //WriteLine(comp);
                break;

            case ZoneOp.XTargetResponse:
                var xt = packet.Get <XTarget>();
                //WriteLine(xt);
                break;

            case ZoneOp.Weather:
                var weather = packet.Get <Weather>();
                //WriteLine(weather);

                if (entering)
                {
                    Send(AppPacket.Create(ZoneOp.ReqNewZone));
                }
                break;

            case ZoneOp.TributeTimer:
                var timer = packet.Get <TributeTimer>();
                //WriteLine(timer);
                break;

            case ZoneOp.TributeUpdate:
                var update = packet.Get <TributeInfo>();
                //WriteLine(update);
                break;

            case ZoneOp.ZoneEntry:
                var mob = packet.Get <Spawn>();
                if (mob.Name == charName)
                {
                    playerSpawnId = (ushort)mob.SpawnID;
                }
                Spawned(this, mob);
                break;

            case ZoneOp.NewZone:
                Send(AppPacket.Create(ZoneOp.ReqClientSpawn));
                break;

            case ZoneOp.SendExpZonein:
                if (entering)
                {
                    Send(AppPacket.Create(ZoneOp.ClientReady));
                    entering = false;
                }
                break;

            case ZoneOp.CharInventory:
                break;

            case ZoneOp.SendFindableNPCs:
                var npc = packet.Get <FindableNPC>();
                //WriteLine(npc);
                break;

            case ZoneOp.ClientUpdate:
                var pu = packet.Get <PlayerPositionUpdate>();
                PositionUpdated?.Invoke(this, pu);
                break;

            case ZoneOp.HPUpdate:
                break;

            default:
                //WriteLine($"Unhandled packet in ZoneStream: {(ZoneOp) packet.Opcode} (0x{packet.Opcode:X04})");
                //Hexdump(packet.Data);
                break;
            }
        }
Exemplo n.º 10
0
 public void SendCharacterCreate(CharCreate charCreate)
 {
     Send(AppPacket.Create(WorldOp.CharacterCreate, charCreate));
 }
Exemplo n.º 11
0
 public void SendNameApproval(NameApproval nameApproval)
 {
     Send(AppPacket.Create(WorldOp.ApproveName, nameApproval));
 }
Exemplo n.º 12
0
        protected override void HandleAppPacket(AppPacket packet)
        {
            try
            {
                // UnityEngine.Debug.Log($"Got packet { (ZoneOp)packet.Opcode} (0x{ packet.Opcode:X04}");
                switch ((ZoneOp)packet.Opcode)
                {
                case ZoneOp.PlayerProfile:
                    var player = packet.Get <PlayerProfile>();
                    UnityEngine.Debug.Log("Profile:" + player);
                    break;

                case ZoneOp.CharInventory:
                    //  var inventory = packet.Get<CharInventory>();
                    //  UnityEngine.Debug.Log("Inventory: "+inventory);
                    break;

                case ZoneOp.TimeOfDay:
                    //  var timeofday = packet.Get<TimeOfDay>();
                    //  UnityEngine.Debug.Log(timeofday);
                    break;

                case ZoneOp.TaskActivity:
                    //  var activity = packet.Get<TaskActivity>();
                    //    UnityEngine.Debug.Log(activity);
                    break;

                case ZoneOp.TaskDescription:
                    //  var desc = packet.Get<TaskDescription>();
                    //    UnityEngine.Debug.Log(desc);
                    break;

                case ZoneOp.CompletedTasks:
                    //  var comp = packet.Get<CompletedTasks>();
                    //   UnityEngine.Debug.Log(comp);
                    break;

                case ZoneOp.XTargetResponse:
                    // var xt = packet.Get<XTarget>();
                    //   UnityEngine.Debug.Log(xt);
                    break;

                case ZoneOp.Weather:
                    // var weather = packet.Get<Weather>();
                    //    UnityEngine.Debug.Log(weather);

                    if (entering)
                    {
                        Send(AppPacket.Create(ZoneOp.ReqNewZone));
                    }
                    break;

                case ZoneOp.TributeTimer:
                    //var timer = packet.Get<TributeTimer>();
                    //   UnityEngine.Debug.Log(timer);
                    break;

                case ZoneOp.TributeUpdate:
                    // var update = packet.Get<TributeInfo>();
                    //   UnityEngine.Debug.Log(update);
                    break;

                case ZoneOp.ZoneEntry:
                    var mob = packet.Get <Spawn>();
                    ZoneEntry.Invoke(this, mob);
                    //UnityEngine.Debug.Log(mob);
                    break;

                case ZoneOp.NewZone:
                    Send(AppPacket.Create(ZoneOp.ReqClientSpawn));

                    break;

                case ZoneOp.SendExpZonein:
                    if (packet.Data.Length == 0)
                    {
                        Send(AppPacket.Create(ZoneOp.ClientReady));
                        entering = false;
                    }
                    break;

                case ZoneOp.SendFindableNPCs:
                    //  var npc = packet.Get<FindableNPC>();
                    //   UnityEngine.Debug.Log(npc);
                    break;

                case ZoneOp.ClientUpdate:
                    UnityEngine.Debug.Log("Sending Client Update");
                    //PlayerPositionUpdateServer.Invoke(this, packet.Get<PlayerPositionUpdateServer>());
                    break;

                case ZoneOp.SpawnAppearance:
                    break;

                case ZoneOp.Stamina:
                    break;

                case ZoneOp.SpecialMesg:
                    break;

                case ZoneOp.Death:
                    break;

                case ZoneOp.DeleteSpawn:
                    DeleteSpawn.Invoke(this, packet.Get <DeleteSpawn>());
                    break;

                case ZoneOp.PlayerStateAdd:
                    break;

                case ZoneOp.PlayerStateRemove:
                    break;

                case ZoneOp.ChannelMessage:
                    UnityEngine.Debug.Log("Got channel message");

                    ChannelMessage.Invoke(this, packet.Get <ChannelMessage>());

                    break;

                case ZoneOp.HPUpdate:
                    SpawnHPUpdate.Invoke(this, packet.Get <SpawnHPUpdate>());
                    break;

                case ZoneOp.ManaUpdate:
                    break;

                case ZoneOp.EnduranceUpdate:
                    break;

                case ZoneOp.SpawnPositionUpdate:
                    SpawnPositionUpdate.Invoke(this, packet.Get <SpawnPositionUpdate>());
                    break;

                case ZoneOp.BuffCreate:
                    break;

                case ZoneOp.AltCurrency:
                    break;

                case ZoneOp.WearChange:
                    break;

                case ZoneOp.GuildMOTD:
                    break;

                case ZoneOp.RaidUpdate:
                    break;

                case ZoneOp.ExpUpdate:
                    break;

                case ZoneOp.WorldObjectsSent:
                    break;

                case 0x0:
                    //This is a catch for an empty OP that happens.. dunno
                    break;

                case ZoneOp.SendAAStats:
                    break;

                case ZoneOp.SendZonepoints:
                    break;

                case ZoneOp.GroundSpawn:
                    break;

                case ZoneOp.SpawnDoor:
                    break;

                default:
                    UnityEngine.Debug.Log($"Unhandled packet in ZoneStream: {(ZoneOp) packet.Opcode} (0x{packet.Opcode:X04})");
                    Hexdump(packet.Data);
                    break;
                }
            }
            catch (Exception e)
            {
                UnityEngine.Debug.LogError($"Failed to process {(ZoneOp) packet.Opcode} (0x{packet.Opcode:X04}):" + e.Message);
            }
        }
Exemplo n.º 13
0
 public void SendMessage()
 {
     Send(AppPacket.Create(ZoneOp.ChannelMessage, new ChannelMessage("Shin", "Xuluu", 0, 0, 0, "Hello")));
 }
Exemplo n.º 14
0
 //Camp requests have a 29000ms camp timer
 public void SendCamp()
 {
     Send(AppPacket.Create(ZoneOp.Camp));
 }
Exemplo n.º 15
0
 public void RequestServerList()
 {
     Send(AppPacket.Create(LoginOp.ServerListRequest, new byte[] { 0, 0, 0, 0 }));
 }
Exemplo n.º 16
0
 public void Play(ServerListElement server)
 {
     curPlay = server;
     Send(AppPacket.Create(LoginOp.PlayEverquestRequest, new PlayRequest(5, server.RuntimeID)));
 }
Exemplo n.º 17
0
 public void SendEnterWorld(EnterWorld enterWorld)
 {
     Send(AppPacket.Create(WorldOp.EnterWorld, enterWorld));
 }
Exemplo n.º 18
0
 protected override void HandleSessionResponse(Packet packet)
 {
     Send(AppPacket.Create(LoginOp.SessionReady, new SessionReady()));
 }
Exemplo n.º 19
0
        protected override void HandleSessionResponse(Packet packet)
        {
            Send(packet);

            Send(AppPacket.Create(ZoneOp.ZoneEntry, new ClientZoneEntry(charName)));
        }