Exemplo n.º 1
0
 public SkillTab(Job job)
 {
     Id       = 0x000032DF995949B9; // temporary hard coded id
     Name     = "Build";
     Skills   = SkillMetadataStorage.GetJobSkills(job);
     Order    = SkillTreeOrdered.GetListOrdered(job);
     SkillJob = AddOnDictionary();
 }
Exemplo n.º 2
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);
    }
Exemplo n.º 3
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);
    }
Exemplo n.º 4
0
 public static List <SkillMetadata> GetJobFeatureSkills(Job job)
 {
     return(SkillMetadataStorage.GetJobSkills(job));
 }
Exemplo n.º 5
0
 public static List <SkillMetadata> GetJobFeatureSkills(Job job) => SkillMetadataStorage.GetJobSkills(job);
Exemplo n.º 6
0
 private static Dictionary <int, SkillMetadata> GetSkillsMetadata(Job job)
 {
     return(SkillMetadataStorage.GetJobSkills(job).ToDictionary(x => x.SkillId, x => x));
 }