示例#1
0
        public void SpendXp(Enum.Ability ability, uint amount)
        {
            uint baseValue   = character.Abilities[ability].Base;
            uint result      = character.Abilities[ability].SpendXp(amount);
            bool isSecondary = (ability == Enum.Ability.Health || ability == Enum.Ability.Stamina || ability == Enum.Ability.Mana);

            if (result > 0u)
            {
                uint            ranks    = character.Abilities[ability].Ranks;
                uint            newValue = character.Abilities[ability].UnbuffedValue;
                var             xpUpdate = new GameEventPrivateUpdatePropertyInt64(Session, PropertyInt64.AvailableExperience, character.AvailableExperience);
                GameEventPacket abilityUpdate;
                if (!isSecondary)
                {
                    abilityUpdate = new GameEventPrivateUpdateAbility(Session, ability, ranks, baseValue, result);
                }
                else
                {
                    abilityUpdate = new GameEventPrivateUpdateVital(Session, ability, ranks, baseValue, result, character.Abilities[ability].Current);
                }

                var soundEvent = new GameEventSound(Session, Network.Enum.Sound.AbilityIncrease, 1f);

                xpUpdate.Send();
                abilityUpdate.Send();
                soundEvent.Send();
                ChatPacket.SendSystemMessage(Session, $"Your base {ability} is now {newValue}!");
            }
            else
            {
                ChatPacket.SendSystemMessage(Session, $"Your attempt to raise {ability} has failed.");
            }
        }
示例#2
0
        public void GrantXp(ulong amount)
        {
            character.GrantXp(amount);
            var xpAvailUpdate = new GameEventPrivateUpdatePropertyInt64(Session, PropertyInt64.AvailableExperience, character.AvailableExperience);
            var xpTotalUpdate = new GameEventPrivateUpdatePropertyInt64(Session, PropertyInt64.TotalExperience, character.TotalExperience);

            xpAvailUpdate.Send();
            xpTotalUpdate.Send();
            ChatPacket.SendSystemMessage(Session, $"{amount} experience granted.");
        }
示例#3
0
        public void SpendXp(Skill skill, uint amount)
        {
            uint baseValue = 0;
            uint result    = character.Skills[skill].SpendXp(amount);

            if (result > 0u)
            {
                uint ranks        = character.Skills[skill].Ranks;
                uint newValue     = character.Skills[skill].UnbuffedValue;
                var  status       = character.Skills[skill].Status;
                var  xpUpdate     = new GameEventPrivateUpdatePropertyInt64(Session, PropertyInt64.AvailableExperience, character.AvailableExperience);
                var  ablityUpdate = new GameEventPrivateUpdateSkill(Session, skill, status, ranks, baseValue, result);
                var  soundEvent   = new GameEventSound(Session, Network.Enum.Sound.AbilityIncrease, 1f);

                xpUpdate.Send();
                ablityUpdate.Send();
                soundEvent.Send();
                ChatPacket.SendSystemMessage(Session, $"Your base {skill} is now {newValue}!");
            }
            else
            {
                ChatPacket.SendSystemMessage(Session, $"Your attempt to raise {skill} has failed.");
            }
        }