Proficiency GetProficiency(ProficiencyFlags flags) { Proficiency result; if (IsProficiencyForbidden(flags)) { result = Proficiency.Forbidden; } else if (IsProficiencyExpert(flags)) { result = Proficiency.Expert; } else { result = Proficiency.Normal; } return(result); }
/// <summary> /// Determines if a proficiency type is forbidden. /// </summary> /// <param name="flags">ProficiencyFlags to test.</param> /// <returns>True if proficiency is forbidden.</returns> public bool IsProficiencyForbidden(ProficiencyFlags flags) { return(((ForbiddenProficiencies & flags) == flags) ? true : false); }
/// <summary> /// Determines if a proficiency type is expert. /// </summary> /// <param name="flags">ProficiencyFlags to test.</param> /// <returns>True if proficiency is forbidden.</returns> public bool IsProficiencyExpert(ProficiencyFlags flags) { return(((ExpertProficiencies & flags) == flags) ? true : false); }
/// <summary> /// Reads RawData into structured data. /// </summary> public void StructureData(CFGData cfg) { this.Name = cfg.Name; this.Strength = cfg.Attributes[0]; this.Intelligence = cfg.Attributes[1]; this.Willpower = cfg.Attributes[2]; this.Agility = cfg.Attributes[3]; this.Endurance = cfg.Attributes[4]; this.Personality = cfg.Attributes[5]; this.Speed = cfg.Attributes[6]; this.Luck = cfg.Attributes[7]; this.PrimarySkill1 = (Skills)cfg.PrimarySkill1; this.PrimarySkill2 = (Skills)cfg.PrimarySkill2; this.PrimarySkill3 = (Skills)cfg.PrimarySkill3; this.MajorSkill1 = (Skills)cfg.MajorSkill1; this.MajorSkill2 = (Skills)cfg.MajorSkill2; this.MajorSkill3 = (Skills)cfg.MajorSkill3; this.MinorSkill1 = (Skills)cfg.MinorSkill1; this.MinorSkill2 = (Skills)cfg.MinorSkill2; this.MinorSkill3 = (Skills)cfg.MinorSkill3; this.MinorSkill4 = (Skills)cfg.MinorSkill4; this.MinorSkill5 = (Skills)cfg.MinorSkill5; this.MinorSkill6 = (Skills)cfg.MinorSkill6; this.HitPointsPerLevel = cfg.HitPointsPerLevel; float value = (cfg.AdvancementMultiplier >> 16) + ((cfg.AdvancementMultiplier & 0xffff)) / 65536f; try { this.AdvancementMultiplier = float.Parse(string.Format("{0:0.00}", value), NumberStyles.Float, CultureInfo.InvariantCulture); } catch { this.AdvancementMultiplier = value; } this.Paralysis = GetTolerance(cfg, EffectFlags.Paralysis); this.Magic = GetTolerance(cfg, EffectFlags.Magic); this.Poison = GetTolerance(cfg, EffectFlags.Poison); this.Fire = GetTolerance(cfg, EffectFlags.Fire); this.Frost = GetTolerance(cfg, EffectFlags.Frost); this.Shock = GetTolerance(cfg, EffectFlags.Shock); this.Disease = GetTolerance(cfg, EffectFlags.Disease); this.ForbiddenMaterials = (MaterialFlags)cfg.ForbiddenMaterialsFlags; this.ForbiddenShields = (ShieldFlags)((cfg.WeaponArmorShieldsBitfield >> 9) & 0x0f); this.ForbiddenArmors = (ArmorFlags)((cfg.WeaponArmorShieldsBitfield >> 6) & 0x07); this.ForbiddenProficiencies = (ProficiencyFlags)(cfg.WeaponArmorShieldsBitfield & 0x3f); this.ExpertProficiencies = (ProficiencyFlags)((cfg.WeaponArmorShieldsBitfield >> 16) & 0x3f); this.ShortBlades = GetProficiency(ProficiencyFlags.ShortBlades); this.LongBlades = GetProficiency(ProficiencyFlags.LongBlades); this.HandToHand = GetProficiency(ProficiencyFlags.HandToHand); this.Axes = GetProficiency(ProficiencyFlags.Axes); this.BluntWeapons = GetProficiency(ProficiencyFlags.BluntWeapons); this.MissileWeapons = GetProficiency(ProficiencyFlags.MissileWeapons); this.SpellPointMultiplier = GetSpellPointMultiplier(cfg); this.SpellPointMultiplierValue = GetSpellPointMultiplierValue(this.SpellPointMultiplier); this.DarknessPoweredMagery = (DarknessMageryFlags)((cfg.AbilityFlagsAndSpellPointsBitfield & 0x300) >> 8); this.LightPoweredMagery = (LightMageryFlags)((cfg.AbilityFlagsAndSpellPointsBitfield & 0x00C0) >> 6); this.SpellAbsorption = (SpellAbsorptionFlags)cfg.SpellAbsorptionFlags; this.NoRegenSpellPoints = HasSpecialAbility(cfg, SpecialAbilityFlags.NoRegenSpellPoints); this.AcuteHearing = HasSpecialAbility(cfg, SpecialAbilityFlags.AcuteHearing); this.Athleticism = HasSpecialAbility(cfg, SpecialAbilityFlags.Athleticism); this.AdrenalineRush = HasSpecialAbility(cfg, SpecialAbilityFlags.AdrenalineRush); this.Regeneration = (RegenerationFlags)cfg.Regeneration; this.RapidHealing = (RapidHealingFlags)cfg.RapidHealing; this.DamageFromSunlight = HasSpecialAbility(cfg, SpecialAbilityFlags.SunDamage); this.DamageFromHolyPlaces = HasSpecialAbility(cfg, SpecialAbilityFlags.HolyDamage); this.UndeadAttackModifier = GetAttackModifier(cfg, EnemyGroups.Undead); this.DaedraAttackModifier = GetAttackModifier(cfg, EnemyGroups.Daedra); this.HumanoidAttackModifier = GetAttackModifier(cfg, EnemyGroups.Humanoid); this.AnimalsAttackModifier = GetAttackModifier(cfg, EnemyGroups.Animals); }
Proficiency GetProficiency(ProficiencyFlags flags) { Proficiency result; if (IsProficiencyForbidden(flags)) result = Proficiency.Forbidden; else if (IsProficiencyExpert(flags)) result = Proficiency.Expert; else result = Proficiency.Normal; return result; }
/// <summary> /// Reads RawData into structured data. /// </summary> public void StructureData(CFGData cfg) { this.Name = cfg.Name; this.Strength = cfg.Attributes[0]; this.Intelligence = cfg.Attributes[1]; this.Willpower = cfg.Attributes[2]; this.Agility = cfg.Attributes[3]; this.Endurance = cfg.Attributes[4]; this.Personality = cfg.Attributes[5]; this.Speed = cfg.Attributes[6]; this.Luck = cfg.Attributes[7]; this.PrimarySkill1 = (Skills)cfg.PrimarySkill1; this.PrimarySkill2 = (Skills)cfg.PrimarySkill2; this.PrimarySkill3 = (Skills)cfg.PrimarySkill3; this.MajorSkill1 = (Skills)cfg.MajorSkill1; this.MajorSkill2 = (Skills)cfg.MajorSkill2; this.MajorSkill3 = (Skills)cfg.MajorSkill3; this.MinorSkill1 = (Skills)cfg.MinorSkill1; this.MinorSkill2 = (Skills)cfg.MinorSkill2; this.MinorSkill3 = (Skills)cfg.MinorSkill3; this.MinorSkill4 = (Skills)cfg.MinorSkill4; this.MinorSkill5 = (Skills)cfg.MinorSkill5; this.MinorSkill6 = (Skills)cfg.MinorSkill6; this.HitPointsPerLevelOrMonsterLevel = cfg.HitPointsPerLevelOrMonsterLevel; float value = (cfg.AdvancementMultiplier >> 16) + ((cfg.AdvancementMultiplier & 0xffff)) / 65536f; try { this.AdvancementMultiplier = float.Parse(string.Format("{0:0.00}", value), NumberStyles.Float, CultureInfo.InvariantCulture); } catch { this.AdvancementMultiplier = value; } this.Paralysis = GetTolerance(cfg, EffectFlags.Paralysis); this.Magic = GetTolerance(cfg, EffectFlags.Magic); this.Poison = GetTolerance(cfg, EffectFlags.Poison); this.Fire = GetTolerance(cfg, EffectFlags.Fire); this.Frost = GetTolerance(cfg, EffectFlags.Frost); this.Shock = GetTolerance(cfg, EffectFlags.Shock); this.Disease = GetTolerance(cfg, EffectFlags.Disease); this.ForbiddenMaterials = (MaterialFlags)cfg.ForbiddenMaterialsFlags; this.ForbiddenShields = (ShieldFlags)((cfg.WeaponArmorShieldsBitfield >> 9) & 0x0f); this.ForbiddenArmors = (ArmorFlags)((cfg.WeaponArmorShieldsBitfield >> 6) & 0x07); this.ForbiddenProficiencies = (ProficiencyFlags)(cfg.WeaponArmorShieldsBitfield & 0x3f); this.ExpertProficiencies = (ProficiencyFlags)((cfg.WeaponArmorShieldsBitfield >> 16) & 0x3f); this.ShortBlades = GetProficiency(ProficiencyFlags.ShortBlades); this.LongBlades = GetProficiency(ProficiencyFlags.LongBlades); this.HandToHand = GetProficiency(ProficiencyFlags.HandToHand); this.Axes = GetProficiency(ProficiencyFlags.Axes); this.BluntWeapons = GetProficiency(ProficiencyFlags.BluntWeapons); this.MissileWeapons = GetProficiency(ProficiencyFlags.MissileWeapons); this.SpellPointMultiplier = GetSpellPointMultiplier(cfg); this.SpellPointMultiplierValue = GetSpellPointMultiplierValue(this.SpellPointMultiplier); this.DarknessPoweredMagery = (DarknessMageryFlags)((cfg.AbilityFlagsAndSpellPointsBitfield & 0x300) >> 8); this.LightPoweredMagery = (LightMageryFlags)((cfg.AbilityFlagsAndSpellPointsBitfield & 0x00C0) >> 6); this.SpellAbsorption = (SpellAbsorptionFlags)cfg.SpellAbsorptionFlags; this.NoRegenSpellPoints = HasSpecialAbility(cfg, SpecialAbilityFlags.NoRegenSpellPoints); this.AcuteHearing = HasSpecialAbility(cfg, SpecialAbilityFlags.AcuteHearing); this.Athleticism = HasSpecialAbility(cfg, SpecialAbilityFlags.Athleticism); this.AdrenalineRush = HasSpecialAbility(cfg, SpecialAbilityFlags.AdrenalineRush); this.Regeneration = (RegenerationFlags)cfg.Regeneration; this.RapidHealing = (RapidHealingFlags)cfg.RapidHealing; this.DamageFromSunlight = HasSpecialAbility(cfg, SpecialAbilityFlags.SunDamage); this.DamageFromHolyPlaces = HasSpecialAbility(cfg, SpecialAbilityFlags.HolyDamage); this.UndeadAttackModifier = GetAttackModifier(cfg, EnemyGroups.Undead); this.DaedraAttackModifier = GetAttackModifier(cfg, EnemyGroups.Daedra); this.HumanoidAttackModifier = GetAttackModifier(cfg, EnemyGroups.Humanoid); this.AnimalsAttackModifier = GetAttackModifier(cfg, EnemyGroups.Animals); }
/// <summary> /// Determines if a proficiency type is forbidden. /// </summary> /// <param name="flags">ProficiencyFlags to test.</param> /// <returns>True if proficiency is forbidden.</returns> public bool IsProficiencyForbidden(ProficiencyFlags flags) { return ((ForbiddenProficiencies & flags) == flags) ? true : false; }
/// <summary> /// Determines if a proficiency type is expert. /// </summary> /// <param name="flags">ProficiencyFlags to test.</param> /// <returns>True if proficiency is forbidden.</returns> public bool IsProficiencyExpert(ProficiencyFlags flags) { return ((ExpertProficiencies & flags) == flags) ? true : false; }