예제 #1
0
        public void LearnSkill(Player player, int skillId)
        {
            Skill skill = Data.Data.Skills[skillId];

            if (skill == null)
            {
                Log.Warn("LearnSkill: skill data not found");
                return;
            }

            if (player.GetLevel() < skill.Level)
            {
                Log.Warn("LearnSkill: player level < skill Level");
                return;
            }

            if (player.GetJobLevel() < skill.JobLevel)
            {
                Log.Warn("LearnSkill: player Job level < skill Job Level");
                return;
            }

            if (skill.Job != (int)player.PlayerData.Class)
            {
                Log.Warn("LearnSkill: player Job < skill Job");
                return;
            }

            if (player.SkillPoint < skill.LearnExp && (player.PlayerData.Class != PlayerClass.Hanbi && skill.Id != 1000101))
            {
                Log.Warn("LearnSkill: player SkillPoint < skill LearnExp");
                return;
            }

            if ((player.PlayerData.Class != PlayerClass.Hanbi && skill.Id != 1000101))
                player.SkillPoint -= skill.LearnExp;

            switch ((SkillType)skill.Type)
            {
                case SkillType.Basic:
                    player.Skills.AddSkill(skill.Id, 1);
                    break;
                case SkillType.Passive:
                    player.PassiveSkills.AddSkill(skill.Id, 1);
                    break;
                case SkillType.Ascension:
                    player.AscensionSkills.AddSkill(skill.Id, 1);
                    break;
            }

            DataBaseSkill.AddPlayerSkill(player, skill.Id, 1, (SkillType)skill.Type, skill.Index);
        }
예제 #2
0
        private bool CanDress(Player player, StorageItem item, bool sendErrors = false)
        {
            if (player.PlayerData.Class != (PlayerClass)item.ItemTemplate.Class)
            {
                if(sendErrors)
                    new SpChatMessage(player, "Can't Equip!!", ChatType.House, true).Send(player.Connection);

                return false;
            }

            if (item.ItemTemplate.Level > player.GetLevel() && item.ItemTemplate.JobLevel > player.GetJobLevel())
            {
                if (sendErrors)
                    new SpChatMessage(player, "Can't Equip!!", ChatType.House, true).Send(player.Connection);

                return false;
            }

            return true;
        }