public override void Handle(GameSession session, PacketReader packet)
    {
        packet.ReadInt(); // ?

        // Liftable: 00 00 00 00 00
        // SendBreakable
        // Self
        Player  player  = session.Player;
        Account account = player.Account;

        session.EnterField(player);
        session.Send(StatPacket.SetStats(player.FieldPlayer));
        session.Send(StatPointPacket.WriteTotalStatPoints(player));
        session.Send(StatPointPacket.WriteTotalStatPoints(player)); // This packet is sent twice on GMS, not sure why
        session.Send(StatPointPacket.WriteStatPointDistribution(player));

        if (account.IsVip())
        {
            session.Send(BuffPacket.SendBuff(0,
                                             new(100000014, player.FieldPlayer.ObjectId, player.FieldPlayer.ObjectId, 1, (int)account.VIPExpiration, 1)));
            session.Send(PremiumClubPacket.ActivatePremium(player.FieldPlayer, account.VIPExpiration));
        }

        session.Send(EmotePacket.LoadEmotes(player));
        session.Send(ChatStickerPacket.LoadChatSticker(player));

        session.Send(HomeCommandPacket.LoadHome(player));
        session.Send(ResponseCubePacket.DecorationScore(account.Home));
        session.Send(ResponseCubePacket.LoadHome(player.FieldPlayer.ObjectId, player.Account.Home));
        session.Send(ResponseCubePacket.ReturnMap(player.ReturnMapId));
        session.Send(LapenshardPacket.Load(player.Inventory.LapenshardStorage));

        IEnumerable <Cube> cubes = session.FieldManager.State.Cubes.Values
                                   .Where(x => x.Value.PlotNumber == 1 && x.Value.Item.HousingCategory is ItemHousingCategory.Farming or ItemHousingCategory.Ranching)
                                   .Select(x => x.Value);

        foreach (Cube cube in cubes)
        {
            session.Send(FunctionCubePacket.UpdateFunctionCube(cube.CoordF.ToByte(), 2, 1));
        }

        if (player.Party is not null)
        {
            session.Send(PartyPacket.UpdatePlayer(player));
        }

        session.Send(KeyTablePacket.SendHotbars(player.GameOptions));

        List <GameEvent> gameEvents = DatabaseManager.Events.FindAll();

        session.Send(GameEventPacket.Load(gameEvents));

        TrophyManager.OnMapEntered(player, player.MapId);
    }
        public override void Handle(GameSession session, PacketReader packet)
        {
            packet.ReadInt(); // ?

            // Liftable: 00 00 00 00 00
            // SendBreakable
            // Self
            session.EnterField(session.Player.MapId);
            session.Send(StatPacket.SetStats(session.FieldPlayer));
            session.Send(StatPointPacket.WriteTotalStatPoints(session.Player));
            foreach (MasteryExp mastery in session.Player.Levels.MasteryExp)
            {
                session.Send(MasteryPacket.SetExp(mastery.Type, mastery.CurrentExp));
            }
            if (session.Player.IsVip())
            {
                session.Send(PremiumClubPacket.ActivatePremium(session.FieldPlayer, session.Player.VIPExpiration));
            }
            session.Send(EmotePacket.LoadEmotes(session.Player));
            session.Send(ChatStickerPacket.LoadChatSticker(session.Player));
            session.Send(ResponseCubePacket.LoadHome(session.FieldPlayer));

            // Normally skill layout would be loaded from a database
            QuickSlot arrowStream  = QuickSlot.From(10500001);
            QuickSlot arrowBarrage = QuickSlot.From(10500011);
            QuickSlot eagleGlide   = QuickSlot.From(10500151);
            QuickSlot testSkill    = QuickSlot.From(10500153);

            if (session.Player.GameOptions.TryGetHotbar(0, out Hotbar mainHotbar))
            {
                /*
                 * mainHotbar.MoveQuickSlot(4, arrowStream);
                 * mainHotbar.MoveQuickSlot(5, arrowBarrage);
                 * mainHotbar.MoveQuickSlot(6, eagleGlide);
                 * mainHotbar.MoveQuickSlot(7, testSkill);
                 */
                session.Send(KeyTablePacket.SendHotbars(session.Player.GameOptions));
            }

            session.Send(GameEventPacket.Load());
        }
Example #3
0
        public override void Handle(GameSession session, PacketReader packet)
        {
            packet.ReadInt(); // ?

            // Liftable: 00 00 00 00 00
            // SendBreakable
            // Self
            Player  player  = session.Player;
            Account account = player.Account;

            session.EnterField(player);
            session.Send(StatPacket.SetStats(session.FieldPlayer));
            session.Send(StatPointPacket.WriteTotalStatPoints(player));
            if (account.IsVip())
            {
                session.Send(BuffPacket.SendBuff(0, new Status(100000014, session.FieldPlayer.ObjectId, session.FieldPlayer.ObjectId, 1, (int)account.VIPExpiration, 1)));
                session.Send(PremiumClubPacket.ActivatePremium(session.FieldPlayer, account.VIPExpiration));
            }
            session.Send(EmotePacket.LoadEmotes(player));
            session.Send(ChatStickerPacket.LoadChatSticker(player));

            session.Send(HomeCommandPacket.LoadHome(player));
            session.Send(ResponseCubePacket.DecorationScore(account.Home));
            session.Send(ResponseCubePacket.LoadHome(session.FieldPlayer));
            session.Send(ResponseCubePacket.ReturnMap(player.ReturnMapId));
            if (player.Party != null)
            {
                session.Send(PartyPacket.UpdatePlayer(player));
            }

            session.Send(KeyTablePacket.SendHotbars(player.GameOptions));

            List <GameEvent> gameEvents = DatabaseManager.Events.FindAll();

            session.Send(GameEventPacket.Load(gameEvents));
        }
        public override void Handle(GameSession session, PacketReader packet)
        {
            packet.ReadInt(); // ?

            // Liftable: 00 00 00 00 00
            // SendBreakable
            // Self
            session.EnterField(session.Player.MapId);
            session.Send(StatPacket.SetStats(session.FieldPlayer));
            session.Send(StatPointPacket.WriteTotalStatPoints(session.Player));
            session.Send(EmotePacket.LoadEmotes(session.Player));
            session.Send(ChatStickerPacket.LoadChatSticker(session.Player));

            // Normally skill layout would be loaded from a database
            QuickSlot arrowStream  = QuickSlot.From(10500001);
            QuickSlot arrowBarrage = QuickSlot.From(10500011);
            QuickSlot eagleGlide   = QuickSlot.From(10500151);
            QuickSlot testSkill    = QuickSlot.From(10500153);

            if (session.Player.GameOptions.TryGetHotbar(0, out Hotbar mainHotbar))
            {
                /*
                 * mainHotbar.MoveQuickSlot(4, arrowStream);
                 * mainHotbar.MoveQuickSlot(5, arrowBarrage);
                 * mainHotbar.MoveQuickSlot(6, eagleGlide);
                 * mainHotbar.MoveQuickSlot(7, testSkill);
                 */
                session.Send(KeyTablePacket.SendHotbars(session.Player.GameOptions));
            }

            // Add catalysts for testing

            Item item = new Item(40100001)
            {
                Amount = 99999
            };
            Item item2 = new Item(40100001)
            {
                Amount = 90000
            };
            Item item3 = new Item(20302228)
            {
                Amount = 1
            };

            InventoryController.Add(session, item, true);
            InventoryController.Add(session, item2, true);
            InventoryController.Add(session, item3, true);

            //Add mail for testing
            //System mail without any item
            Mail sysMail = new Mail
                           (
                101,
                session.Player.CharacterId,
                "50000002",
                "",
                "",
                0,
                DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
                null
                           );

            // System mail with an item
            List <Item> items = new List <Item>
            {
                new Item(40100001) // 20302228
                {
                    CreationTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
                    Owner        = session.Player,
                    Amount       = 10000
                }
            };
            Mail sysItemMail = new Mail
                               (
                101,
                session.Player.CharacterId,
                "53000042",
                "",
                "",
                0,
                DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
                items
                               );

            // Regular mail
            Mail regMail = new Mail
                           (
                1,
                session.Player.CharacterId,
                session.Player.Name,
                "Test Title",
                "Test Body",
                0,
                DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
                null
                           );

            session.Player.Mailbox.AddOrUpdate(sysItemMail);
            session.Player.Mailbox.AddOrUpdate(sysMail);
            session.Player.Mailbox.AddOrUpdate(regMail);
        }
Example #5
0
    public override void Handle(GameSession session, PacketReader packet)
    {
        packet.ReadInt(); // ?

        // Liftable: 00 00 00 00 00
        // SendBreakable
        // Self
        Player  player  = session.Player;
        Account account = player.Account;

        session.EnterField(player);
        session.Send(StatPacket.SetStats(player.FieldPlayer));
        session.Send(StatPointPacket.WriteTotalStatPoints(player));
        session.Send(StatPointPacket.WriteTotalStatPoints(player)); // This packet is sent twice on GMS, not sure why
        session.Send(StatPointPacket.WriteStatPointDistribution(player));
        session.Send(SkillPointPacket.ExtraSkillPoints(player));

        if (player.ActivePet is not null)
        {
            player.ActivePet.SetMetadataValues();
            Pet pet = session.FieldManager.RequestPet(player.ActivePet, player.FieldPlayer);
            if (pet is not null)
            {
                player.FieldPlayer.ActivePet = pet;

                session.Send(ResponsePetPacket.LoadPetSettings(pet));
                session.Send(NoticePacket.Notice(SystemNotice.PetSummonOn, NoticeType.Chat | NoticeType.FastText));
            }
        }

        if (account.IsVip())
        {
            session.Send(BuffPacket.SendBuff(0,
                                             new(100000014, player.FieldPlayer.ObjectId, player.FieldPlayer.ObjectId, 1, (int)account.VIPExpiration, 1)));
            session.Send(PremiumClubPacket.ActivatePremium(player.FieldPlayer, account.VIPExpiration));
        }

        session.Send(EmotePacket.LoadEmotes(player));
        session.Send(MacroPacket.LoadControls(player.Macros));
        session.Send(ChatStickerPacket.LoadChatSticker(player));

        session.Send(ResponseCubePacket.DecorationScore(account.Home));
        session.Send(ResponseCubePacket.LoadHome(player.FieldPlayer.ObjectId, player.Account.Home));
        session.Send(ResponseCubePacket.ReturnMap(player.ReturnMapId));
        session.Send(LapenshardPacket.Load(player.Inventory.LapenshardStorage));

        IEnumerable <Cube> cubes = session.FieldManager.State.Cubes.Values
                                   .Where(x => x.Value.PlotNumber == 1 && x.Value.Item.HousingCategory is ItemHousingCategory.Farming or ItemHousingCategory.Ranching)
                                   .Select(x => x.Value);

        foreach (Cube cube in cubes)
        {
            session.Send(FunctionCubePacket.UpdateFunctionCube(cube.CoordF.ToByte(), 2, 1));
        }

        if (player.Party is not null)
        {
            session.Send(PartyPacket.UpdatePlayer(player));
        }

        GlobalEvent globalEvent = GameServer.GlobalEventManager.GetCurrentEvent();

        if (globalEvent is not null && !MapMetadataStorage.MapIsInstancedOnly(player.MapId))
        {
            session.Send(GlobalPortalPacket.Notice(globalEvent));
        }

        FieldWar fieldWar = GameServer.FieldWarManager.CurrentFieldWar;

        if (fieldWar is not null && !MapMetadataStorage.MapIsInstancedOnly(player.MapId) && fieldWar.MapId != player.MapId)
        {
            session.Send(FieldWarPacket.LegionPopup(fieldWar.Id, fieldWar.EntryClosureTime.ToUnixTimeSeconds()));
        }

        session.Send(KeyTablePacket.SendHotbars(player.GameOptions));

        TrophyManager.OnMapEntered(player, player.MapId);

        QuestManager.OnMapEnter(player, player.MapId);

        player.InitializeEffects();
    }