public async Task HandlePlayerLogin(CMSG_PLAYER_LOGIN pkt)
 {
     if (!IsAuthedRealmSession())
     {
         return;
     }
     await Account.PlayerLogin(pkt);
 }
Beispiel #2
0
        public static PacketProcessResult HandlePlayerLogin(PacketProcessor p)
        {
            CMSG_PLAYER_LOGIN pkt = new CMSG_PLAYER_LOGIN();

            pkt.Read(p.CurrentPacket);

            p.ClientConnection.CurrentSession.HandlePlayerLogin(pkt);

            return(PacketProcessResult.Processed);
        }
Beispiel #3
0
        public async Task PlayerLogin(CMSG_PLAYER_LOGIN pkt)
        {
            if (State.ActivePlayer != 0)
            {
                await KickActivePlayer();
            }

            var player = GrainFactory.GetGrain <IPlayer>(pkt.GUID.ToInt64());
            var valid  = await player.IsValid();

            var player_account = await player.GetAccount();

            //just a quick sanity check for edited packets
            if (!valid || player_account != this.GetPrimaryKeyString())
            {
                return;
            }

            await player.Login();

            State.ActivePlayer = await player.GetGUID();
        }
Beispiel #4
0
        public static async Task OnPlayerLogin(WorldClient client, byte[] data)
        {
            var request   = new CMSG_PLAYER_LOGIN(data);
            var character = client.User.Characters.Single(x => x.ID == request.CharacterID);

            client.Log($"Player logged in with char {character.Name}");

            await client.SendPacket(new SMSG_LOGIN_VERIFY_WORLD(character));

            await client.SendPacket(new SMSG_ACCOUNT_DATA_TIMES());

            await client.SendPacket(new SMSG_MESSAGECHAT(character.ID, "Hello World"));

            await client.SendPacket(new SMSG_MESSAGECHAT(character.ID, "World Hello"));

            await client.SendPacket(new SMSG_SET_REST_START());

            await client.SendPacket(new SMSG_BINDPOINTUPDATE(character));

            await client.SendPacket(new SMSG_TUTORIAL_FLAGS());

            await client.SendPacket(new SMSG_LOGIN_SETTIMESPEED());

            await client.SendPacket(new SMSG_INITIAL_SPELLS());

            await client.SendPacket(new SMSG_ACTION_BUTTONS());

            await client.SendPacket(new SMSG_INITIALIZE_FACTIONS());

            // TODO: SMSG_TRIGGER_CINEMATIC (Human_ID = 81??)

            await client.SendPacket(new SMSG_CORPSE_RECLAIM_DELAY());

            await client.SendPacket(new SMSG_INIT_WORLD_STATES());

            await client.SendPacket(SMSG_UPDATE_OBJECT.CreateOwnPlayerObject(character, out var player));

            client.Player = player;
        }
Beispiel #5
0
    public static async Task OnPlayerLogin(PacketHandlerContext c)
    {
        var request   = new CMSG_PLAYER_LOGIN(c.Packet);
        var character = c.GetCharacter(request.CharacterID);
        var account   = c.AccountService.GetAccount(c.Client.Identifier);

        // Login with a deleted character or a character from another account.
        // TODO: Split for different log messages.
        if (character is null || !account.Characters.Contains(character.Id))
        {
            c.Client.Log(
                $"{account.Identifier} tried to login with a deleted character or a character from another account.",
                LogLevel.Warning);
            return;
        }

        c.Client.Log($"Player logged in with char {character.Name}");

        if (c.IsTBC())
        {
            await c.SendPacket <MSG_SET_DUNGEON_DIFFICULTY>();
        }

        await c.Client.SendPacket(new SMSG_LOGIN_VERIFY_WORLD(character));

        await c.SendPacket <SMSG_ACCOUNT_DATA_TIMES>();

        if (c.IsTBC())
        {
            await c.SendPacket <SMSG_FEATURE_SYSTEM_STATUS>();
        }

        await c.Client.SendPacket(new SMSG_EXPECTED_SPAM_RECORDS(Enumerable.Empty <string>()));

        if (c.IsVanilla())
        {
            await c.Client.SendPacket(new SMSG_MESSAGECHAT(character.Id, MessageOfTheDay));
        }
        else if (c.IsTBC())
        {
            await c.Client.SendPacket(new SMSG_MOTD(MessageOfTheDay));
        }

        // await args.Client.SendPacket(new SMSG_NAME_QUERY_RESPONSE(character, args.Client.Build));
        // if (GUILD) -> SMSG_GUILD_EVENT

        if (character.Stats.Life == 0)
        {
            await c.SendPacket <SMSG_CORPSE_RECLAIM_DELAY>();
        }

        await c.SendPacket <SMSG_SET_REST_START>();

        await c.Client.SendPacket(new SMSG_BINDPOINTUPDATE(character));

        await c.SendPacket <SMSG_TUTORIAL_FLAGS>();

        if (c.IsTBC())
        {
            await c.SendPacket <SMSG_INSTANCE_DIFFICULTY>();
        }

        await c.Client.SendPacket(new SMSG_INITIAL_SPELLS(character.Spells));

        // SMSG_SEND_UNLEARN_SPELLS
        await c.Client.SendPacket(new SMSG_ACTION_BUTTONS(character.ActionBar));

        await c.Client.SendPacket(new SMSG_INITIALIZE_FACTIONS(ClientBuild.Vanilla)); // BUG??

        await c.SendPacket <SMSG_LOGIN_SETTIMESPEED>();

        // await args.Client.SendPacket(new SMSG_TRIGGER_CINEMATIC(CinematicID.NightElf));

        c.Client.CharacterId = character.Id;
        await c.Client.SendPacket(SMSG_UPDATE_OBJECT.CreateOwnPlayerObject(character, c.Client.Build, out var player));

        c.Client.Player = player;

        // TODO: Implement for TBC
        if (c.IsVanilla())
        {
            // Initially spawn all creatures
            foreach (var unit in c.World.Creatures)
            {
                // TODO: Add range check
                await c.Client.SendPacket(SMSG_UPDATE_OBJECT_VANILLA.CreateUnit(unit));
            }
        }

        await c.World.SpawnPlayer(character, c.Client.Build);

        // if (GROUP) -> SMSG_GROUP_LIST
        // if Vanilla
        //     SMSG_FRIEND_LIST
        //     SMSG_IGNORE_LIST
        // if TBC
        //     SMSG_CONTACT_LIST

        if (c.IsTBC())
        {
            await c.SendPacket <SMSG_TIME_SYNC_REQ>();
        }

        // SMSG_ITEM_ENCHANT_TIME_UPDATE
        // SMSG_ITEM_TIME_UPDATE
        // SMSG_FRIEND_STATUS
    }