Example #1
0
        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);
            }
        }
Example #2
0
        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);
            }
        }
Example #3
0
        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);
                }
            }
        }
Example #4
0
        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);
                }
            }
        }
Example #5
0
        private void BuildCreature(Creature creature)
        {
            CreatureProfile = new CreatureProfile(creature);

            // only creatures?
            ResistHighlight = ResistMaskHelper.GetHighlightMask(creature);
            ResistColor     = ResistMaskHelper.GetColorMask(creature);

            ArmorLevels = new ArmorLevel(creature);
        }
Example #6
0
        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);
            }
        }
Example #7
0
        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);
            }
        }