Exemple #1
0
        /// <summary>
        /// This should be moved back to the ACE project when time permits.
        /// </summary>
        public static Character CreateFromClientFragment(BinaryReader reader, uint accountId)
        {
            Character character = new Character();

            reader.Skip(4);   /* Unknown constant (1) */

            character.Heritage          = reader.ReadUInt32();
            character.Gender            = reader.ReadUInt32();
            character.Appearance        = Appearance.FromNetowrk(reader);
            character.TemplateOption    = reader.ReadUInt32();
            character.Strength.Base     = reader.ReadUInt32();
            character.Endurance.Base    = reader.ReadUInt32();
            character.Coordination.Base = reader.ReadUInt32();
            character.Quickness.Base    = reader.ReadUInt32();
            character.Focus.Base        = reader.ReadUInt32();
            character.Self.Base         = reader.ReadUInt32();
            character.Slot    = reader.ReadUInt32();
            character.ClassId = reader.ReadUInt32();

            // characters start with max vitals
            character.Health.Current  = character.Health.UnbuffedValue;
            character.Stamina.Current = character.Stamina.UnbuffedValue;
            character.Mana.Current    = character.Mana.UnbuffedValue;

            uint numOfSkills = reader.ReadUInt32();

            for (uint i = 0; i < numOfSkills; i++)
            {
                character.AddSkill((Skill)i, (SkillStatus)reader.ReadUInt32(), 0);
            }

            character.Name             = reader.ReadString16L();
            character.StartArea        = reader.ReadUInt32();
            character.IsAdmin          = Convert.ToBoolean(reader.ReadUInt32());
            character.IsEnvoy          = Convert.ToBoolean(reader.ReadUInt32());
            character.TotalSkillPoints = reader.ReadUInt32();

            return(character);
        }
Exemple #2
0
        public static Character CreateFromClientFragment(ClientPacketFragment fragment, uint accountId)
        {
            Character character = new Character();

            fragment.Payload.Skip(4);   /* Unknown constant (1) */

            character.Appearance        = Appearance.FromFragment(fragment);
            character.TemplateOption    = fragment.Payload.ReadUInt32();
            character.Strength.Base     = fragment.Payload.ReadUInt32();
            character.Endurance.Base    = fragment.Payload.ReadUInt32();
            character.Coordination.Base = fragment.Payload.ReadUInt32();
            character.Quickness.Base    = fragment.Payload.ReadUInt32();
            character.Focus.Base        = fragment.Payload.ReadUInt32();
            character.Self.Base         = fragment.Payload.ReadUInt32();
            character.Slot    = fragment.Payload.ReadUInt32();
            character.ClassId = fragment.Payload.ReadUInt32();

            // characters start with max vitals
            character.Health.Current  = character.Health.Value;
            character.Stamina.Current = character.Stamina.Value;
            character.Mana.Current    = character.Mana.Value;

            uint numOfSkills = fragment.Payload.ReadUInt32();

            for (uint i = 0; i < numOfSkills; i++)
            {
                character.AddSkill((Skill)i, (SkillStatus)fragment.Payload.ReadUInt32(), 0);
            }

            character.Name             = fragment.Payload.ReadString16L();
            character.StartArea        = fragment.Payload.ReadUInt32();
            character.IsAdmin          = Convert.ToBoolean(fragment.Payload.ReadUInt32());
            character.IsEnvoy          = Convert.ToBoolean(fragment.Payload.ReadUInt32());
            character.TotalSkillPoints = fragment.Payload.ReadUInt32();

            return(character);
        }
Exemple #3
0
        /// <summary>
        /// This should be moved back to the ACE project when time permits.
        /// </summary>
        public static Character CreateFromClientFragment(BinaryReader reader, uint accountId)
        {
            Character character = new Character();

            reader.Skip(4);   /* Unknown constant (1) */

            character.Heritage                 = reader.ReadUInt32();
            character.Gender                   = reader.ReadUInt32();
            character.Appearance               = Appearance.FromNetowrk(reader);
            character.TemplateOption           = reader.ReadUInt32();
            character.StrengthAbility.Base     = reader.ReadUInt32();
            character.EnduranceAbility.Base    = reader.ReadUInt32();
            character.CoordinationAbility.Base = reader.ReadUInt32();
            character.QuicknessAbility.Base    = reader.ReadUInt32();
            character.FocusAbility.Base        = reader.ReadUInt32();
            character.SelfAbility.Base         = reader.ReadUInt32();
            character.Slot    = reader.ReadUInt32();
            character.ClassId = reader.ReadUInt32();

            // characters start with max vitals
            character.Health.Current  = character.Health.UnbuffedValue;
            character.Stamina.Current = character.Stamina.UnbuffedValue;
            character.Mana.Current    = character.Mana.UnbuffedValue;

            character.TotalSkillCredits     = 52;
            character.AvailableSkillCredits = 52;

            uint               numOfSkills = reader.ReadUInt32();
            Skill              skill;
            SkillStatus        skillStatus;
            SkillCostAttribute skillCost;

            for (uint i = 0; i < numOfSkills; i++)
            {
                skill       = (Skill)i;
                skillCost   = skill.GetCost();
                skillStatus = (SkillStatus)reader.ReadUInt32();
                if (skillStatus == SkillStatus.Specialized)
                {
                    if (skillCost.TrainsFree)
                    {
                        character.AvailableSkillCredits = character.AvailableSkillCredits - skillCost.SpecializationCost;
                    }
                    else
                    {
                        character.AvailableSkillCredits = character.AvailableSkillCredits - skillCost.SpecializationCost - skillCost.TrainingCost;
                    }
                }
                if (skillStatus == SkillStatus.Trained)
                {
                    if (!skillCost.TrainsFree)
                    {
                        character.AvailableSkillCredits = character.AvailableSkillCredits - skillCost.TrainingCost;
                    }
                }
                character.AddSkill(skill, skillStatus, 0, 0);
            }

            character.Name      = reader.ReadString16L();
            character.StartArea = reader.ReadUInt32();
            character.IsAdmin   = Convert.ToBoolean(reader.ReadUInt32());
            character.IsEnvoy   = Convert.ToBoolean(reader.ReadUInt32());
            // character.TotalSkillPoints = reader.ReadUInt32();  // garbage ?

            return(character);
        }