Example #1
0
        public GameMessagePrivateUpdateVital(Session session, Entity.Enum.Ability ability, uint ranks, uint baseValue, uint totalInvestment, uint currentValue) : base(GameMessageOpcode.PrivateUpdateVital)
        {
            // TODO We shouldn't be passing session. Insetad, we should pass the value after session.UpdateSkillSequence++.

            Vital vital;

            switch (ability)
            {
            case Entity.Enum.Ability.Health:
                vital = Vital.Health;
                break;

            case Entity.Enum.Ability.Stamina:
                vital = Vital.Stamina;
                break;

            case Entity.Enum.Ability.Mana:
                vital = Vital.Mana;
                break;

            default:
                throw new ArgumentException("invalid ability specified");
            }

            Writer.Write(session.UpdateAttributeSequence++);
            Writer.Write((uint)vital);
            Writer.Write(ranks);
            Writer.Write(baseValue);
            Writer.Write(totalInvestment);
            Writer.Write(currentValue);
        }
        public GameEventPrivateUpdateAbility(Session session, Entity.Enum.Ability ability, uint ranks, uint baseValue, uint totalInvestment)
            : base(session)
        {
            switch (ability)
            {
            case Entity.Enum.Ability.Strength:
                networkAbility = Ability.Strength;
                break;

            case Entity.Enum.Ability.Endurance:
                networkAbility = Ability.Endurance;
                break;

            case Entity.Enum.Ability.Coordination:
                networkAbility = Ability.Coordination;
                break;

            case Entity.Enum.Ability.Quickness:
                networkAbility = Ability.Quickness;
                break;

            case Entity.Enum.Ability.Focus:
                networkAbility = Ability.Focus;
                break;

            case Entity.Enum.Ability.Self:
                networkAbility = Ability.Self;
                break;
            }

            this.ranks           = ranks;
            this.baseValue       = baseValue;
            this.totalInvestment = totalInvestment;
        }
        public override void Read()
        {
            var networkAbility = (Network.Ability)fragment.Payload.ReadUInt32();

            switch (networkAbility)
            {
            case Ability.Strength:
                ability = Entity.Enum.Ability.Strength;
                break;

            case Ability.Endurance:
                ability = Entity.Enum.Ability.Endurance;
                break;

            case Ability.Coordination:
                ability = Entity.Enum.Ability.Coordination;
                break;

            case Ability.Quickness:
                ability = Entity.Enum.Ability.Quickness;
                break;

            case Ability.Focus:
                ability = Entity.Enum.Ability.Focus;
                break;

            case Ability.Self:
                ability = Entity.Enum.Ability.Self;
                break;

            case Ability.Undefined:
                return;
            }
            xpSpent = fragment.Payload.ReadUInt32();
        }
Example #4
0
        public GameEventPrivateUpdateVital(Session session, Entity.Enum.Ability vital, uint ranks, uint baseValue, uint totalInvestment, uint currentValue)
            : base(session)
        {
            switch (vital)
            {
            case Entity.Enum.Ability.Health:
                this.vital = Vital.Health;
                break;

            case Entity.Enum.Ability.Stamina:
                this.vital = Vital.Stamina;
                break;

            case Entity.Enum.Ability.Mana:
                this.vital = Vital.Mana;
                break;

            default:
                throw new ArgumentException("invalid vital specified");
            }
            this.ranks           = ranks;
            this.baseValue       = baseValue;
            this.totalInvestment = totalInvestment;
            this.currentValue    = currentValue;
        }
Example #5
0
        public GameMessagePrivateUpdateAbility(Session session, Entity.Enum.Ability ability, uint ranks, uint baseValue, uint totalInvestment)
            : base(GameMessageOpcode.PrivateUpdateAttribute, GameMessageGroup.Group09)
        {
            // TODO We shouldn't be passing session. Insetad, we should pass the value after session.UpdateSkillSequence++.

            PropertyAttribute networkAbility;

            switch (ability)
            {
            case Entity.Enum.Ability.Strength:
                networkAbility = PropertyAttribute.Strength;
                break;

            case Entity.Enum.Ability.Endurance:
                networkAbility = PropertyAttribute.Endurance;
                break;

            case Entity.Enum.Ability.Coordination:
                networkAbility = PropertyAttribute.Coordination;
                break;

            case Entity.Enum.Ability.Quickness:
                networkAbility = PropertyAttribute.Quickness;
                break;

            case Entity.Enum.Ability.Focus:
                networkAbility = PropertyAttribute.Focus;
                break;

            case Entity.Enum.Ability.Self:
                networkAbility = PropertyAttribute.Self;
                break;

            default:
                throw new ArgumentException("invalid ability specified");
            }

            Writer.Write(session.Player.Sequences.GetNextSequence(Sequence.SequenceType.PrivateUpdateAttribute));
            Writer.Write((uint)networkAbility);
            Writer.Write(ranks);
            Writer.Write(baseValue);
            Writer.Write(totalInvestment);
        }
Example #6
0
        public static void Handle(ClientMessage message, Session session)
        {
            Entity.Enum.Ability ability = Entity.Enum.Ability.None;
            var networkAbility          = (Ability)message.Payload.ReadUInt32();

            switch (networkAbility)
            {
            case Ability.Strength:
                ability = Entity.Enum.Ability.Strength;
                break;

            case Ability.Endurance:
                ability = Entity.Enum.Ability.Endurance;
                break;

            case Ability.Coordination:
                ability = Entity.Enum.Ability.Coordination;
                break;

            case Ability.Quickness:
                ability = Entity.Enum.Ability.Quickness;
                break;

            case Ability.Focus:
                ability = Entity.Enum.Ability.Focus;
                break;

            case Ability.Self:
                ability = Entity.Enum.Ability.Self;
                break;

            case Ability.Undefined:
                return;
            }
            var xpSpent = message.Payload.ReadUInt32();

            session.Player.SpendXp(ability, xpSpent);
        }
Example #7
0
        public override void Handle()
        {
            Entity.Enum.Ability ability = Entity.Enum.Ability.None;
            switch (vital)
            {
            case Vital.MaxHealth:
                ability = Entity.Enum.Ability.Health;
                break;

            case Vital.MaxStamina:
                ability = Entity.Enum.Ability.Stamina;
                break;

            case Vital.MaxMana:
                ability = Entity.Enum.Ability.Mana;
                break;

            default:
                ChatPacket.SendSystemMessage(session, $"Unable to Handle GameActionRaiseVital for vital {vital}");
                return;
            }
            session.Player.SpendXp(ability, xpSpent);
        }
Example #8
0
 public GameMessagePrivateUpdateVital(Session session, Entity.Enum.Ability ability, CreatureVital cv) :
     this(session, ability, cv.Ranks, cv.Base, cv.ExperienceSpent, cv.Current)
 {
 }