private void BuildCreature(Creature creature) { CreatureProfile = new CreatureProfile(creature, Success); // only creatures? ResistHighlight = ResistMaskHelper.GetHighlightMask(creature); ResistColor = ResistMaskHelper.GetColorMask(creature); if (Success && (creature is Player || !creature.Attackable)) { ArmorLevels = new ArmorLevel(creature); } AddRatings(creature); if (NPCLooksLikeObject) { var weenie = creature.Weenie ?? DatabaseManager.World.GetCachedWeenie(creature.WeenieClassId); if (!weenie.GetProperty(PropertyInt.EncumbranceVal).HasValue) { PropertiesInt.Remove(PropertyInt.EncumbranceVal); } } else { PropertiesInt.Remove(PropertyInt.EncumbranceVal); } // see notes in CombatPet.Init() if (creature is CombatPet && PropertiesInt.ContainsKey(PropertyInt.Faction1Bits)) { PropertiesInt.Remove(PropertyInt.Faction1Bits); } }
private void BuildCreature(Creature creature) { CreatureProfile = new CreatureProfile(creature, Success); // only creatures? ResistHighlight = ResistMaskHelper.GetHighlightMask(creature); ResistColor = ResistMaskHelper.GetColorMask(creature); if (Success && (creature is Player || !creature.Attackable)) { ArmorLevels = new ArmorLevel(creature); } AddRatings(creature); if (PropertiesInt.ContainsKey(PropertyInt.EncumbranceVal)) { PropertiesInt.Remove(PropertyInt.EncumbranceVal); } // see notes in CombatPet.Init() if (creature is CombatPet && PropertiesInt.ContainsKey(PropertyInt.Faction1Bits)) { PropertiesInt.Remove(PropertyInt.Faction1Bits); } }
private void AddPropertyEnchantments(WorldObject wo, WorldObject wielder) { if (wo == null) { return; } if (PropertiesInt.ContainsKey(PropertyInt.ArmorLevel)) { PropertiesInt[PropertyInt.ArmorLevel] += wo.EnchantmentManager.GetArmorMod(); } if (wo.ItemSkillLimit != null) { PropertiesInt[PropertyInt.AppraisalItemSkill] = (int)wo.ItemSkillLimit; } if (PropertiesFloat.ContainsKey(PropertyFloat.WeaponDefense) && !(wo is Missile) && !(wo is Ammunition)) { var defenseMod = wo.EnchantmentManager.GetDefenseMod(); var auraDefenseMod = wielder != null && wo.IsEnchantable ? wielder.EnchantmentManager.GetDefenseMod() : 0.0f; PropertiesFloat[PropertyFloat.WeaponDefense] += defenseMod + auraDefenseMod; } if (PropertiesFloat.TryGetValue(PropertyFloat.ManaConversionMod, out var manaConvMod)) { if (manaConvMod != 0) { // hermetic link/void var enchantmentMod = ResistMaskHelper.GetManaConversionMod(wielder, wo); if (enchantmentMod != 1.0f) { PropertiesFloat[PropertyFloat.ManaConversionMod] *= enchantmentMod; ResistHighlight = ResistMaskHelper.GetHighlightMask(wielder, wo); ResistColor = ResistMaskHelper.GetColorMask(wielder, wo); } } else if (!PropertyManager.GetBool("show_mana_conv_bonus_0").Item) { PropertiesFloat.Remove(PropertyFloat.ManaConversionMod); } } if (PropertiesFloat.ContainsKey(PropertyFloat.ElementalDamageMod)) { var enchantmentBonus = ResistMaskHelper.GetElementalDamageBonus(wielder, wo); if (enchantmentBonus != 0) { PropertiesFloat[PropertyFloat.ElementalDamageMod] += enchantmentBonus; ResistHighlight = ResistMaskHelper.GetHighlightMask(wielder, wo); ResistColor = ResistMaskHelper.GetColorMask(wielder, wo); } } }
private void AddPropertyEnchantments(WorldObject wo, WorldObject wielder) { if (wo == null) { return; } if (PropertiesInt.ContainsKey(PropertyInt.ArmorLevel)) { PropertiesInt[PropertyInt.ArmorLevel] += wo.EnchantmentManager.GetArmorMod(); } if (wo.ItemSkillLimit != null) { PropertiesInt[PropertyInt.AppraisalItemSkill] = (int)wo.ItemSkillLimit; } if (wielder == null || !wo.IsEnchantable) { return; } if (PropertiesFloat.ContainsKey(PropertyFloat.WeaponDefense) && !(wo is Missile) && !(wo is Ammunition)) { var defenseMod = wo.EnchantmentManager.GetDefenseMod(); var auraDefenseMod = wo.IsEnchantable ? wielder.EnchantmentManager.GetDefenseMod() : 0.0f; PropertiesFloat[PropertyFloat.WeaponDefense] += defenseMod + auraDefenseMod; } if (PropertiesFloat.ContainsKey(PropertyFloat.ManaConversionMod)) { var manaConvMod = wielder.EnchantmentManager.GetManaConvMod(); if (manaConvMod != 1.0f) { PropertiesFloat[PropertyFloat.ManaConversionMod] *= manaConvMod; ResistHighlight = ResistMaskHelper.GetHighlightMask(wielder); ResistColor = ResistMaskHelper.GetColorMask(wielder); } } if (PropertiesFloat.ContainsKey(PropertyFloat.ElementalDamageMod)) { var weaponEnchantments = wo.EnchantmentManager.GetElementalDamageMod(); var wielderEnchantments = wielder.EnchantmentManager.GetElementalDamageMod(); var enchantments = weaponEnchantments + wielderEnchantments; if (enchantments != 0) { PropertiesFloat[PropertyFloat.ElementalDamageMod] += enchantments; ResistHighlight = ResistMaskHelper.GetHighlightMask(wielder, wo); ResistColor = ResistMaskHelper.GetColorMask(wielder, wo); } } }
public static ResistMask GetColorMask(WorldObject wo) { ResistMask colorMask = 0; if (wo.EnchantmentManager.GetResistanceMod(DamageType.Slash) > 1.0f) { colorMask |= ResistMask.ResistSlash; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Pierce) > 1.0f) { colorMask |= ResistMask.ResistPierce; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Bludgeon) > 1.0f) { colorMask |= ResistMask.ResistBludgeon; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Fire) > 1.0f) { colorMask |= ResistMask.ResistFire; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Cold) > 1.0f) { colorMask |= ResistMask.ResistCold; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Electric) > 1.0f) { colorMask |= ResistMask.ResistElectric; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Health) > 1.0f) // ?? { colorMask |= ResistMask.ResistHealthBoost; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Stamina) > 1.0f) { colorMask |= ResistMask.ResistStaminaDrain; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Stamina) > 1.0f) { colorMask |= ResistMask.ResistStaminaBoost; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Mana) > 1.0f) { colorMask |= ResistMask.ResistManaDrain; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Mana) > 1.0f) { colorMask |= ResistMask.ResistManaBoost; } // mana conversion modifier // elemental damage mod if (wo.EnchantmentManager.GetResistanceMod(DamageType.Nether) > 1.0f) { colorMask |= ResistMask.ResistNether; } return(colorMask); }
private void BuildCreature(Creature creature) { CreatureProfile = new CreatureProfile(creature); // only creatures? ResistHighlight = ResistMaskHelper.GetHighlightMask(creature); ResistColor = ResistMaskHelper.GetColorMask(creature); ArmorLevels = new ArmorLevel(creature); }
private void BuildCreature(Creature creature) { CreatureProfile = new CreatureProfile(creature, Success); // only creatures? ResistHighlight = ResistMaskHelper.GetHighlightMask(creature); ResistColor = ResistMaskHelper.GetColorMask(creature); ArmorLevels = new ArmorLevel(creature); AddRatings(creature); if (PropertiesInt.ContainsKey(PropertyInt.EncumbranceVal)) { PropertiesInt.Remove(PropertyInt.EncumbranceVal); } }
public static ResistMask GetHighlightMask(WorldObject weapon) { ResistMask highlightMask = 0; var wielder = weapon.Wielder; if (wielder != null) { if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Slash) != 1.0f) { highlightMask |= ResistMask.ResistSlash; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Pierce) != 1.0f) { highlightMask |= ResistMask.ResistPierce; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Bludgeon) != 1.0f) { highlightMask |= ResistMask.ResistBludgeon; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Fire) != 1.0f) { highlightMask |= ResistMask.ResistFire; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Cold) != 1.0f) { highlightMask |= ResistMask.ResistCold; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Electric) != 1.0f) { highlightMask |= ResistMask.ResistElectric; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Health) != 1.0f) // ?? { highlightMask |= ResistMask.ResistHealthBoost; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Stamina) != 1.0f) { highlightMask |= ResistMask.ResistStaminaDrain; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Stamina) != 1.0f) { highlightMask |= ResistMask.ResistStaminaBoost; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Mana) != 1.0f) { highlightMask |= ResistMask.ResistManaDrain; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Mana) != 1.0f) { highlightMask |= ResistMask.ResistManaBoost; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Nether) != 1.0f) { highlightMask |= ResistMask.ResistNether; } } // ManaConversionMod and ElementalDamageMod are only needed for weapons var manaConversionMod = GetManaConversionMod(weapon); if (manaConversionMod != 1.0f) { highlightMask |= ResistMask.ManaConversionMod; } var elementalDamageMod = GetElementalDamageBonus(weapon); if (elementalDamageMod != 0.0f) { highlightMask |= ResistMask.ElementalDamageMod; } return(highlightMask); }
private void AddPropertyEnchantments(WorldObject wo, WorldObject wielder) { if (wo == null) { return; } if (PropertiesInt.ContainsKey(PropertyInt.ArmorLevel)) { PropertiesInt[PropertyInt.ArmorLevel] += wo.EnchantmentManager.GetArmorMod(); } if (wo.ItemSkillLimit != null) { PropertiesInt[PropertyInt.AppraisalItemSkill] = (int)wo.ItemSkillLimit; } else { PropertiesInt.Remove(PropertyInt.AppraisalItemSkill); } if (PropertiesFloat.ContainsKey(PropertyFloat.WeaponDefense) && !(wo is Missile) && !(wo is Ammunition)) { var defenseMod = wo.EnchantmentManager.GetDefenseMod(); var auraDefenseMod = wielder != null && wo.IsEnchantable ? wielder.EnchantmentManager.GetDefenseMod() : 0.0f; PropertiesFloat[PropertyFloat.WeaponDefense] += defenseMod + auraDefenseMod; } if (PropertiesFloat.TryGetValue(PropertyFloat.ManaConversionMod, out var manaConvMod)) { if (manaConvMod != 0) { // hermetic link/void var enchantmentMod = ResistMaskHelper.GetManaConversionMod(wielder, wo); if (enchantmentMod != 1.0f) { PropertiesFloat[PropertyFloat.ManaConversionMod] *= enchantmentMod; ResistHighlight = ResistMaskHelper.GetHighlightMask(wielder, wo); ResistColor = ResistMaskHelper.GetColorMask(wielder, wo); } } else if (!PropertyManager.GetBool("show_mana_conv_bonus_0").Item) { PropertiesFloat.Remove(PropertyFloat.ManaConversionMod); } } if (PropertiesFloat.ContainsKey(PropertyFloat.ElementalDamageMod)) { var enchantmentBonus = ResistMaskHelper.GetElementalDamageBonus(wielder, wo); if (enchantmentBonus != 0) { PropertiesFloat[PropertyFloat.ElementalDamageMod] += enchantmentBonus; ResistHighlight = ResistMaskHelper.GetHighlightMask(wielder, wo); ResistColor = ResistMaskHelper.GetColorMask(wielder, wo); } } var appraisalLongDescDecoration = AppraisalLongDescDecorations.None; if (wo.ItemWorkmanship > 0) { appraisalLongDescDecoration |= AppraisalLongDescDecorations.PrependWorkmanship; } if (wo.MaterialType > 0) { appraisalLongDescDecoration |= AppraisalLongDescDecorations.PrependMaterial; } if (wo.GemType > 0 && wo.GemCount > 0) { appraisalLongDescDecoration |= AppraisalLongDescDecorations.AppendGemInfo; } if (appraisalLongDescDecoration > 0 && wo.LongDesc != null && wo.LongDesc.StartsWith(wo.Name)) { PropertiesInt[PropertyInt.AppraisalLongDescDecoration] = (int)appraisalLongDescDecoration; } else { PropertiesInt.Remove(PropertyInt.AppraisalLongDescDecoration); } }
public static ResistMask GetHighlightMask(WorldObject wo) { ResistMask highlightMask = 0; if (wo.EnchantmentManager.GetResistanceMod(DamageType.Slash) != 1.0f) { highlightMask |= ResistMask.ResistSlash; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Pierce) != 1.0f) { highlightMask |= ResistMask.ResistPierce; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Bludgeon) != 1.0f) { highlightMask |= ResistMask.ResistBludgeon; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Fire) != 1.0f) { highlightMask |= ResistMask.ResistFire; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Cold) != 1.0f) { highlightMask |= ResistMask.ResistCold; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Electric) != 1.0f) { highlightMask |= ResistMask.ResistElectric; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Health) != 1.0f) // ?? { highlightMask |= ResistMask.ResistHealthBoost; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Stamina) != 1.0f) { highlightMask |= ResistMask.ResistStaminaDrain; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Stamina) != 1.0f) { highlightMask |= ResistMask.ResistStaminaBoost; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Mana) != 1.0f) { highlightMask |= ResistMask.ResistManaDrain; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Mana) != 1.0f) { highlightMask |= ResistMask.ResistManaBoost; } if (wo.EnchantmentManager.GetManaConvMod() != 1.0f) // only for items? { highlightMask |= ResistMask.ManaConversionMod; } if (wo.EnchantmentManager.GetElementalDamageMod() != 0.0f) { highlightMask |= ResistMask.ElementalDamageMod; } if (wo.EnchantmentManager.GetResistanceMod(DamageType.Nether) != 1.0f) { highlightMask |= ResistMask.ResistNether; } return(highlightMask); }
public static ResistMask GetColorMask(WorldObject wielder, WorldObject weapon = null) { ResistMask colorMask = 0; if (wielder != null) { if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Slash) > 1.0f) { colorMask |= ResistMask.ResistSlash; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Pierce) > 1.0f) { colorMask |= ResistMask.ResistPierce; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Bludgeon) > 1.0f) { colorMask |= ResistMask.ResistBludgeon; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Fire) > 1.0f) { colorMask |= ResistMask.ResistFire; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Cold) > 1.0f) { colorMask |= ResistMask.ResistCold; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Electric) > 1.0f) { colorMask |= ResistMask.ResistElectric; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Health) > 1.0f) // ?? { colorMask |= ResistMask.ResistHealthBoost; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Stamina) > 1.0f) { colorMask |= ResistMask.ResistStaminaDrain; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Stamina) > 1.0f) { colorMask |= ResistMask.ResistStaminaBoost; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Mana) > 1.0f) { colorMask |= ResistMask.ResistManaDrain; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Mana) > 1.0f) { colorMask |= ResistMask.ResistManaBoost; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Nether) > 1.0f) { colorMask |= ResistMask.ResistNether; } } // ManaConversionMod and ElementalDamageMod are only needed for weapons var manaConversionMod = GetManaConversionMod(wielder, weapon); if (manaConversionMod > 1.0f) { colorMask |= ResistMask.ManaConversionMod; } var elementalDamageMod = GetElementalDamageBonus(wielder, weapon); if (elementalDamageMod > 0.0f) { colorMask |= ResistMask.ElementalDamageMod; } return(colorMask); }
public static ResistMask GetColorMask(WorldObject wielder, WorldObject weapon = null) { ResistMask colorMask = 0; if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Slash) > 1.0f) { colorMask |= ResistMask.ResistSlash; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Pierce) > 1.0f) { colorMask |= ResistMask.ResistPierce; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Bludgeon) > 1.0f) { colorMask |= ResistMask.ResistBludgeon; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Fire) > 1.0f) { colorMask |= ResistMask.ResistFire; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Cold) > 1.0f) { colorMask |= ResistMask.ResistCold; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Electric) > 1.0f) { colorMask |= ResistMask.ResistElectric; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Health) > 1.0f) // ?? { colorMask |= ResistMask.ResistHealthBoost; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Stamina) > 1.0f) { colorMask |= ResistMask.ResistStaminaDrain; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Stamina) > 1.0f) { colorMask |= ResistMask.ResistStaminaBoost; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Mana) > 1.0f) { colorMask |= ResistMask.ResistManaDrain; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Mana) > 1.0f) { colorMask |= ResistMask.ResistManaBoost; } if (wielder.EnchantmentManager.GetManaConvMod() > 1.0f) // only for items? { colorMask |= ResistMask.ManaConversionMod; } var wielderElementalDamageMod = wielder.EnchantmentManager.GetElementalDamageMod(); var weaponElementalDamageMod = weapon != null?weapon.EnchantmentManager.GetElementalDamageMod() : 0.0f; var elementalDamageMod = wielderElementalDamageMod + weaponElementalDamageMod; if (elementalDamageMod > 0.0f) { colorMask |= ResistMask.ElementalDamageMod; } if (wielder.EnchantmentManager.GetResistanceMod(DamageType.Nether) > 1.0f) { colorMask |= ResistMask.ResistNether; } return(colorMask); }