Ejemplo n.º 1
0
        public void BuySkill(Player player, int skillId, bool isActive)
        {
            if (!Data.Data.UserSkills[player.TemplateId].ContainsKey(skillId))
            {
                SystemMessages.YouFailedToLearnThatSkill.Send(player);
                return;
            }

            UserSkill skill = Data.Data.UserSkills[player.TemplateId][skillId];

            if (player.GetLevel() < skill.Level)
            {
                SystemMessages.YouFailedToLearnThatSkill.Send(player);
                return;
            }

            if (skill.PrevSkillId != 0 && !player.Skills.Contains(skill.PrevSkillId))
            {
                SystemMessages.YouFailedToLearnThatSkill.Send(player);
                return;
            }

            if (!Communication.Global.StorageService.RemoveMoney(player, player.Inventory, skill.Cost))
            {
                SystemMessages.YouFailedToLearnThatSkill.Send(player);
                return;
            }

            for (int i = 0; i < player.Skills.Count; i++)
            {
                if (player.Skills[i] == skill.PrevSkillId)
                {
                    player.Skills[i] = skillId;
                    PlayerLogic.SkillPurchased(player, skill);
                    return;
                }
            }

            if (player.Skills.Contains(skillId))
                return;
            player.Skills.Add(skillId);
            PlayerLogic.SkillPurchased(player, skill);
        }
Ejemplo n.º 2
0
        public void AddExp(Player player, long value, Npc npc = null)
        {
            value *= GameServer.gameserverConfig.ServerRates;

            //todo rate modifiers
            if (player.GetLevel() >= GameServer.gameserverConfig.LevelCap)
            {
                new SpSystemNotice("Sorry, but now, level cap is " + GameServer.gameserverConfig.LevelCap).Send(player);
                return;
            }

            SetExp(player, player.PlayerExp + value, npc);
        }
Ejemplo n.º 3
0
 public CreatureBaseStats GetBaseStats(Player player)
 {
     return PlayerStats[player.PlayerData.Class][player.GetLevel()];
 }
Ejemplo n.º 4
0
        private bool CanDress(Player player, StorageItem item, bool sendErrors = false)
        {
            if (GetDressSlot(item.ItemId) > 20)
                return false;

            if (item.ItemTemplate.RequiredClassesList.Count > 0
                && !item.ItemTemplate.RequiredClassesList.Contains(player.PlayerData.Class))
            {
                if (sendErrors)
                    SystemMessages.ThatItemIsUnavailableToYourClass.Send(player.Connection);
                return false;
            }

            if (item.ItemTemplate.RequiredLevel > player.GetLevel())
            {
                if (sendErrors)
                    SystemMessages.YouMustBeAHigherLevelToUseThat.Send(player.Connection);
                return false;
            }

            return true;
        }