Example #1
0
        public override void Execute(GameCommandTrigger trigger)
        {
            int id = trigger.Get <int>("id");

            if (SkillMetadataStorage.GetSkill(id) == null)
            {
                trigger.Session.SendNotice($"No skill found with id: {id}");
                return;
            }

            short level = trigger.Get <short>("level") <= 10 && trigger.Get <short>("level") != 0 ? trigger.Get <short>("level") : (short)1;
            // The Status packet needs this in miliseconds, we are converting them here for the user to just input the actual seconds.
            int duration = trigger.Get <int>("duration") <= 3600 && trigger.Get <int>("duration") != 0 ? trigger.Get <int>("duration") * 1000 : 10000;
            int stacks   = trigger.Get <int>("stacks") == 0 ? 1 : trigger.Get <int>("stacks");

            SkillCast skillCast = new SkillCast(id, level);

            if (skillCast.IsBuffToOwner() || skillCast.IsBuffToEntity() || skillCast.IsBuffShield() || skillCast.IsGM() || skillCast.IsGlobal() || skillCast.IsHealFromBuff())
            {
                Status status = new Status(skillCast, trigger.Session.FieldPlayer.ObjectId, trigger.Session.FieldPlayer.ObjectId, stacks);
                StatusHandler.Handle(trigger.Session, status);
                return;
            }

            trigger.Session.SendNotice($"Skill with id: {id} is not a buff to the owner.");
        }
        public override void Handle(GameSession session, PacketReader packet)
        {
            byte function = packet.ReadByte();

            if (function == 0)
            {
                // This count seems to increase for each skill used
                int counter = packet.ReadInt();
                // objectId for climb, 13641 (0x3549 for swim dash)
                int objectId   = packet.ReadInt();
                int clientTime = packet.ReadInt();
                int skillId    = packet.ReadInt();
                packet.ReadShort();                                // 1
                session.Player.Animation = (byte)packet.ReadInt(); // Animation
                int clientTick = packet.ReadInt();
                packet.ReadLong();                                 // 0

                if (SkillMetadataStorage.GetSkill(skillId).State == "gosGlide")
                {
                    session.Player.OnAirMount = true;
                }

                // TODO: Broadcast this to all field players
            }
        }
Example #3
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));
    }
Example #4
0
 public SkillTab(Job job)
 {
     Id       = 0x000032DF995949B9; // temporary hard coded id
     Name     = "Build";
     Skills   = SkillMetadataStorage.GetJobSkills(job);
     Order    = SkillTreeOrdered.GetListOrdered(job);
     SkillJob = AddOnDictionary();
 }
Example #5
0
    public void GainExp(long amount)
    {
        if (amount <= 0 || !ExpMetadataStorage.LevelExist((short)(Level + 1)))
        {
            return;
        }

        long newExp = Exp + amount + RestExp;

        if (RestExp > 0)
        {
            RestExp -= amount;
        }
        else
        {
            RestExp = 0;
        }

        bool hasLeveledUp = false;

        while (newExp >= ExpMetadataStorage.GetExpToLevel(Level))
        {
            newExp -= ExpMetadataStorage.GetExpToLevel(Level);
            if (LevelUp())
            {
                hasLeveledUp = true;
                continue;
            }

            newExp = 0;
            break;
        }

        Exp = newExp;
        Session.Send(ExperiencePacket.ExpUp(amount, newExp, RestExp));

        if (!hasLeveledUp)
        {
            return;
        }

        Session.FieldManager.BroadcastPacket(RevivalConfirmPacket.Send(FieldPlayer.ObjectId, 0));
        Session.FieldManager.BroadcastPacket(LevelUpPacket.LevelUp(FieldPlayer.ObjectId, Level));
        Session.FieldManager.BroadcastPacket(FieldObjectPacket.UpdateCharacterLevel(Player));

        // Find all new skills for current level
        HashSet <int> newSkillIds = SkillMetadataStorage.GetJobSkills(Player.Job)
                                    .Where(x => x.SkillLevels.First().SkillUpgrade.LevelRequired == Level)
                                    .Select(x => x.SkillId).ToHashSet();

        Session.FieldManager.BroadcastPacket(JobPacket.UpdateSkillTab(FieldPlayer, newSkillIds));

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

        Session.Send(KeyTablePacket.SendFullOptions(Player.GameOptions));
        DatabaseManager.Characters.Update(Player);
    }
Example #6
0
    public static Dictionary <int, SkillMetadata> AddOnDictionary(Job job)
    {
        Dictionary <int, SkillMetadata> skillJob = new();

        foreach (SkillMetadata skill in SkillMetadataStorage.GetJobSkills(job))
        {
            skillJob[skill.SkillId] = skill;
        }
        return(skillJob);
    }
Example #7
0
        public override void Execute(GameCommandTrigger trigger)
        {
            int   id    = trigger.Get <int>("id");
            short level = trigger.Get <short>("level") > 0 ? trigger.Get <short>("level") : (short)1;

            if (SkillMetadataStorage.GetSkill(id) == null)
            {
                trigger.Session.SendNotice($"Skill with id: {id} is not defined.");
                return;
            }

            SkillCast             skillCast = new SkillCast(id, level, GuidGenerator.Long(), trigger.Session.ServerTick, trigger.Session.FieldPlayer.ObjectId, trigger.Session.ClientTick);
            CoordF                empty     = CoordF.From(0, 0, 0);
            IFieldObject <Player> player    = trigger.Session.FieldPlayer;

            trigger.Session.FieldManager.BroadcastPacket(SkillUsePacket.SkillUse(skillCast, player.Coord, empty, empty));
        }
Example #8
0
    public override void Execute(GameCommandTrigger trigger)
    {
        GameSession           gameSession = trigger.Session;
        IFieldObject <Player> player      = gameSession.Player.FieldPlayer;

        int   id    = trigger.Get <int>("id");
        short level = trigger.Get <short>("level") > 0 ? trigger.Get <short>("level") : (short)1;

        if (SkillMetadataStorage.GetSkill(id) is null)
        {
            gameSession.SendNotice($"Skill with id: {id} is not defined.");
            return;
        }

        SkillCast skillCast = new(id, level, GuidGenerator.Long(), gameSession.ServerTick, player.ObjectId, gameSession.ClientTick)
        {
            Position  = player.Coord,
            Direction = default,
Example #9
0
 public int GetSpCost() => SkillMetadataStorage.GetSkill(SkillId).SkillLevels.Find(s => s.Level == SkillLevel).Spirit;
Example #10
0
 public double GetDamageRate() => SkillMetadataStorage.GetSkill(SkillId).SkillLevels.Find(x => x.Level == SkillLevel).DamageRate;
Example #11
0
 public static List <SkillMetadata> GetJobFeatureSkills(Job job)
 {
     return(SkillMetadataStorage.GetJobSkills(job));
 }
Example #12
0
 public int GetStaCost() => SkillMetadataStorage.GetSkill(SkillId).SkillLevels.Find(s => s.Level == SkillLevel).Stamina;
Example #13
0
 public ElementId GetElement() => (ElementId)SkillMetadataStorage.GetSkill(SkillId).Element;
Example #14
0
 public DamageTypeId GetSkillDamageType() => (DamageTypeId)SkillMetadataStorage.GetSkill(SkillId).DamageType;
Example #15
0
 public static List <SkillMetadata> GetJobFeatureSkills(Job job) => SkillMetadataStorage.GetJobSkills(job);
Example #16
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));
    }
Example #17
0
 private static Dictionary <int, SkillMetadata> GetSkillsMetadata(Job job)
 {
     return(SkillMetadataStorage.GetJobSkills(job).ToDictionary(x => x.SkillId, x => x));
 }
Example #18
0
 public bool IsSpRecovery() => SkillMetadataStorage.GetSkill(SkillId).IsSpRecovery;
Example #19
0
 public bool IsBuff() => SkillMetadataStorage.GetSkill(SkillId).IsBuff;
 private SkillMetadata GetSkillMetadata() => SkillMetadataStorage.GetSkill(SkillId);
Example #21
0
 private SkillMetadata GetSkillMetadata()
 {
     return(SkillMetadataStorage.GetSkill(SkillId));
 }