コード例 #1
0
    private static void HandleChatEmoticonAdd(GameSession session, Item item)
    {
        long expiration = long.MaxValue;

        if (item.Function.ChatEmoticonAdd.Duration > 0)
        {
            expiration = item.Function.ChatEmoticonAdd.Duration + TimeInfo.Now();
        }

        // sticker exists and no expiration
        if (session.Player.ChatSticker.Any(p => p.GroupId == item.Function.ChatEmoticonAdd.Id && p.Expiration == long.MaxValue))
        {
            return;
        }

        // Add time if the sticker is already in the list
        ChatSticker sticker = session.Player.ChatSticker.FirstOrDefault(p => p.GroupId == item.Function.ChatEmoticonAdd.Id);

        if (sticker is not null && sticker.Expiration != long.MaxValue)
        {
            expiration += sticker.Expiration - TimeInfo.Now();
        }

        session.Send(ChatStickerPacket.AddSticker(item.Id, item.Function.ChatEmoticonAdd.Id, expiration));
        session.Player.ChatSticker.Add(new((byte)item.Function.ChatEmoticonAdd.Id, expiration));
        session.Player.Inventory.ConsumeItem(session, item.Uid, 1);
    }
コード例 #2
0
    public override void Execute(GameCommandTrigger trigger)
    {
        Player player = trigger.Session.Player;

        player.Levels.SetLevel(90);
        player.Levels.SetPrestigeLevel(100);
        player.Wallet.Meso.SetAmount(10000000000);   // 10B
        player.Account.Meret.SetAmount(10000000000); // 10B

        // Stickers
        for (int i = 1; i < 7; i++)
        {
            if (player.ChatSticker.Any(x => x.GroupId == i))
            {
                continue;
            }

            trigger.Session.Send(ChatStickerPacket.AddSticker(21100000 + i, i));
            player.ChatSticker.Add(new((byte)i, 9223372036854775807));
        }

        List <int> emotes = SkillMetadataStorage.GetEmotes();

        foreach (int emoteId in emotes)
        {
            // Broken emotes
            if (emoteId is >= 90200032 and <= 90200036)
            {
                continue;
            }

            if (player.Emotes.Contains(emoteId))
            {
                continue;
            }

            player.Emotes.Add(emoteId);

            trigger.Session.Send(EmotePacket.LearnEmote(emoteId));
        }

        List <TitleMetadata> titles = TitleMetadataStorage.GetAll();

        foreach (TitleMetadata title in titles)
        {
            int titleId = title.Id;
            if (player.Titles.Contains(titleId))
            {
                continue;
            }

            player.Titles.Add(titleId);

            trigger.Session.Send(UserEnvPacket.AddTitle(titleId));
        }

        DatabaseManager.Characters.Update(player);
        trigger.Session.Send(NoticePacket.Notice("Done!", NoticeType.Chat));
    }
コード例 #3
0
        public override void Execute(GameCommandTrigger trigger)
        {
            Player player = trigger.Session.Player;

            // Stickers
            for (int i = 1; i < 7; i++)
            {
                if (player.ChatSticker.Any(x => x.GroupId == i))
                {
                    continue;
                }
                trigger.Session.Send(ChatStickerPacket.AddSticker(21100000 + i, i, 9223372036854775807));
                player.ChatSticker.Add(new ChatSticker((byte)i, 9223372036854775807));
            }

            // Emotes
            for (int i = 1; i < 146; i++)
            {
                int emoteId = 90200000 + i;
                if (player.Emotes.Contains(emoteId))
                {
                    continue;
                }
                player.Emotes.Add(emoteId);

                trigger.Session.Send(EmotePacket.LearnEmote(emoteId));
            }

            // Titles
            for (int i = 1; i < 854; i++)
            {
                int titleId = 10000000 + i;
                if (player.Titles.Contains(titleId))
                {
                    continue;
                }
                player.Titles.Add(titleId);

                trigger.Session.Send(UserEnvPacket.AddTitle(titleId));
            }

            DatabaseManager.Characters.Update(player);
            trigger.Session.Send(NoticePacket.Notice("Done!", NoticeType.Chat));
        }
コード例 #4
0
        private static void HandleChatEmoticonAdd(GameSession session, Item item)
        {
            long expiration = DateTimeOffset.UtcNow.ToUnixTimeSeconds() + item.Function.ChatEmoticonAdd.Duration + Environment.TickCount;

            if (item.Function.ChatEmoticonAdd.Duration == 0) // if no duration was set, set it to not expire
            {
                expiration = long.MaxValue;
            }

            if (session.Player.ChatSticker.Any(p => p.GroupId == item.Function.ChatEmoticonAdd.Id))
            {
                // TODO: Find reject packet
                return;
            }

            session.Send(ChatStickerPacket.AddSticker(item.Id, item.Function.ChatEmoticonAdd.Id, expiration));
            session.Player.ChatSticker.Add(new((byte)item.Function.ChatEmoticonAdd.Id, expiration));
            InventoryController.Consume(session, item.Uid, 1);
        }
コード例 #5
0
        private static void HandleChatEmoticonAdd(GameSession session /*, PacketReader packet*/, Item item)
        {
            long expiration = DateTimeOffset.UtcNow.ToUnixTimeSeconds() + item.FunctionDuration + AccountStorage.TickCount;

            if (item.FunctionDuration == 0) // if no duration was set, set it to not expire
            {
                expiration = 9223372036854775807;
            }

            if (session.Player.ChatSticker.Any(p => p.GroupId == item.FunctionId))
            {
                // TODO: Find reject packet
                return;
            }

            session.Send(ChatStickerPacket.AddSticker(item.Id, item.FunctionId, expiration));
            session.Player.ChatSticker.Add(new((byte)item.FunctionId, expiration));
            InventoryController.Consume(session, item.Uid, 1);
        }
コード例 #6
0
    public override void Execute(GameCommandTrigger trigger)
    {
        Player player = trigger.Session.Player;

        // Reset stats to default
        player.Stats = new(player.Job);
        player.Stats.AddBaseStats(player, 90);

        trigger.Session.Send(StatPacket.SetStats(player.FieldPlayer));
        trigger.Session.FieldManager.BroadcastPacket(StatPacket.SetStats(player.FieldPlayer), trigger.Session);

        player.Levels.SetLevel(90);
        player.Levels.SetPrestigeLevel(100);
        player.Wallet.Meso.SetAmount(10_000_000_000);                 // 10B
        player.Account.Meret.SetAmount(10_000_000_000);               // 10B

        PremiumClubHandler.ActivatePremium(trigger.Session, 2592000); // 30 days in seconds

        // Stickers
        for (int i = 1; i < 7; i++)
        {
            if (player.ChatSticker.Any(x => x.GroupId == i))
            {
                continue;
            }

            trigger.Session.Send(ChatStickerPacket.AddSticker(21100000 + i, i, long.MaxValue));
            player.ChatSticker.Add(new((byte)i, long.MaxValue));
        }

        List <int> emotes = SkillMetadataStorage.GetEmotes();

        foreach (int emoteId in emotes)
        {
            // Broken emotes
            if (emoteId is >= 90200032 and <= 90200036)
            {
                continue;
            }

            if (player.Emotes.Contains(emoteId))
            {
                continue;
            }

            player.Emotes.Add(emoteId);

            trigger.Session.Send(EmotePacket.LearnEmote(emoteId));
        }

        List <TitleMetadata> titles = TitleMetadataStorage.GetAll();

        foreach (TitleMetadata title in titles)
        {
            int titleId = title.Id;
            if (player.Titles.Contains(titleId))
            {
                continue;
            }

            player.Titles.Add(titleId);

            trigger.Session.Send(UserEnvPacket.AddTitle(titleId));
        }

        DatabaseManager.Characters.Update(player);
        trigger.Session.Send(NoticePacket.Notice("Done!", NoticeType.Chat));
    }