<commit_before>using System;

using ACE.Entity.Enum;
using ACE.Server.WorldObjects;

namespace ACE.Server.Network.Enum
{
    [Flags]
    public enum ResistMask
    {
        ResistSlash         = 0x1,
        ResistPierce        = 0x2,
        ResistBludgeon      = 0x4,
        ResistFire          = 0x8,
        ResistCold          = 0x10,
        ResistAcid          = 0x20,
        ResistElectric      = 0x40,
        ResistHealthBoost   = 0x80,
        ResistStaminaDrain  = 0x100,
        ResistStaminaBoost  = 0x200,
        ResistManaDrain     = 0x400,
        ResistManaBoost     = 0x800,
        ManaConversionMod   = 0x1000,
        ElementalDamageMod  = 0x2000,
        ResistNether        = 0x4000
    };

    public static class ResistMaskHelper
    {
        public static ResistMask GetHighlightMask(WorldObject wielder, WorldObject weapon = null)
        {
            ResistMask highlightMask = 0;

            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;
        }

        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;<commit_msg>fix missing buff colors from wand appraisal (#3685)<commit_after>using System;

using ACE.Entity.Enum;
using ACE.Server.WorldObjects;

namespace ACE.Server.Network.Enum
{
    [Flags]
    public enum ResistMask
    {
        ResistSlash         = 0x1,
        ResistPierce        = 0x2,
        ResistBludgeon      = 0x4,
        ResistFire          = 0x8,
        ResistCold          = 0x10,
        ResistAcid          = 0x20,
        ResistElectric      = 0x40,
        ResistHealthBoost   = 0x80,
        ResistStaminaDrain  = 0x100,
        ResistStaminaBoost  = 0x200,
        ResistManaDrain     = 0x400,
        ResistManaBoost     = 0x800,
        ManaConversionMod   = 0x1000,
        ElementalDamageMod  = 0x2000,
        ResistNether        = 0x4000
    };

    public static class ResistMaskHelper
    {
        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;
        }

        public static ResistMask GetColorMask(WorldObject weapon)
        {
            ResistMask colorMask = 0;

            var wielder = weapon.Wielder;

            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;
{'fraction_non_alphanumeric': 0.08112488083889419, 'fraction_numerical': 0.02001906577693041, 'mean_word_length': 2.000858123569794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5618759', 'n_tokens_mistral': 3410, 'n_tokens_neox': 3062, 'n_words': 436}