private bool HasUsefulAbility(JamGarrisonFollower follower)
        {
            bool hasUsefulAbility = false;

            if (this.m_missionDetailViewForComparer == null)
            {
                return(false);
            }
            MissionMechanic[] mechanics = this.m_missionDetailViewForComparer.get_gameObject().GetComponentsInChildren <MissionMechanic>(true);
            if (mechanics == null)
            {
                return(false);
            }
            for (int i = 0; i < follower.AbilityID.Length; i++)
            {
                GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(follower.AbilityID[i]);
                if (record != null)
                {
                    if ((record.Flags & 1u) == 0u)
                    {
                        StaticDB.garrAbilityEffectDB.EnumRecordsByParentID(record.ID, delegate(GarrAbilityEffectRec garrAbilityEffectRec)
                        {
                            if (garrAbilityEffectRec.GarrMechanicTypeID == 0u)
                            {
                                return(true);
                            }
                            if (garrAbilityEffectRec.AbilityAction != 0u)
                            {
                                return(true);
                            }
                            GarrMechanicTypeRec record2 = StaticDB.garrMechanicTypeDB.GetRecord((int)garrAbilityEffectRec.GarrMechanicTypeID);
                            if (record2 == null)
                            {
                                return(true);
                            }
                            bool flag = false;
                            for (int j = 0; j < mechanics.Length; j++)
                            {
                                if (mechanics[j].m_missionMechanicTypeID == record2.ID)
                                {
                                    flag = true;
                                    break;
                                }
                            }
                            if (!flag)
                            {
                                return(true);
                            }
                            hasUsefulAbility = true;
                            return(false);
                        });
                        if (hasUsefulAbility)
                        {
                            break;
                        }
                    }
                }
            }
            return(hasUsefulAbility);
        }
 private bool HasUsefulAbility(WrapperGarrisonFollower follower)
 {
     if (this.m_missionDetailViewForComparer == null)
     {
         return(false);
     }
     MissionMechanic[] componentsInChildren = this.m_missionDetailViewForComparer.gameObject.GetComponentsInChildren <MissionMechanic>(true);
     if (componentsInChildren == null)
     {
         return(false);
     }
     return((
                from id in follower.AbilityIDs
                select StaticDB.garrAbilityDB.GetRecord(id) into garrAbilityRec
                where (garrAbilityRec == null ? false : (garrAbilityRec.Flags & 1) == 0)
                select garrAbilityRec).SelectMany <GarrAbilityRec, GarrAbilityEffectRec>((GarrAbilityRec garrAbilityRec) => StaticDB.garrAbilityEffectDB.GetRecordsByParentID(garrAbilityRec.ID)).Any <GarrAbilityEffectRec>((GarrAbilityEffectRec garrAbilityEffectRec) => {
         if (garrAbilityEffectRec.GarrMechanicTypeID == 0 || garrAbilityEffectRec.AbilityAction != 0)
         {
             return false;
         }
         GarrMechanicTypeRec record = StaticDB.garrMechanicTypeDB.GetRecord((int)garrAbilityEffectRec.GarrMechanicTypeID);
         if (record == null)
         {
             return false;
         }
         return componentsInChildren.Any <MissionMechanic>((MissionMechanic mechanic) => mechanic.m_missionMechanicTypeID == record.ID);
     }));
 }
Esempio n. 3
0
    public void SetMechanicType(int missionMechanicTypeID, int mechanicAbilityID, bool hideBorder = false)
    {
        this.m_garrAbilityID = mechanicAbilityID;
        GarrMechanicTypeRec record = StaticDB.garrMechanicTypeDB.GetRecord(missionMechanicTypeID);

        if (record != null)
        {
            this.m_missionMechanicIcon.gameObject.SetActive(true);
            this.m_missionMechanicTypeID    = record.ID;
            this.m_counterWithThisAbilityID = MissionMechanic.GetAbilityToCounterMechanicType(missionMechanicTypeID);
            if (this.m_counterWithThisAbilityID != 0)
            {
                GarrAbilityRec record2 = StaticDB.garrAbilityDB.GetRecord(this.m_counterWithThisAbilityID);
                if (record2 != null)
                {
                    Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record2.IconFileDataID);
                    if (sprite != null)
                    {
                        this.m_missionMechanicIcon.sprite = sprite;
                        if (this.m_grayscaleShader != null)
                        {
                            Material material = new Material(this.m_grayscaleShader);
                            this.m_missionMechanicIcon.material = material;
                        }
                    }
                }
            }
        }
        else
        {
            this.m_missionMechanicIcon.gameObject.SetActive(false);
        }
        this.SetCountered(false, false, true);
        this.m_missionMechanicIconBorder.gameObject.SetActive(!hideBorder);
    }
Esempio n. 4
0
        public void InitializeMissionDialog(int missionId, Sprite missionTypeSprite)
        {
            GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(missionId);

            if (record != null)
            {
                GarrMechanicRec record2 = StaticDB.garrMechanicDB.GetRecord(record.EnvGarrMechanicID);
                if (record2 != null)
                {
                    GarrMechanicTypeRec record3 = StaticDB.garrMechanicTypeDB.GetRecord((int)record2.GarrMechanicTypeID);
                    if (record3 != null)
                    {
                        this.m_icon.sprite                 = missionTypeSprite;
                        this.m_missionTypeName.text        = record3.Name;
                        this.m_missionTypeDescription.text = WowTextParser.parser.Parse(record3.Description, 0).Replace("FFFFD200", "FFD200FF");
                    }
                }
            }
        }
Esempio n. 5
0
        public void SetEncounter(int garrEncounterID, int garrMechanicID)
        {
            this.m_missionEncounter.SetEncounter(garrEncounterID, garrMechanicID);
            GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(garrMechanicID);

            if (record == null || record.GarrAbilityID == 0)
            {
                base.gameObject.SetActive(false);
                return;
            }
            this.m_mechanicEffect.SetAbility(record.GarrAbilityID);
            int abilityToCounterMechanicType = MissionMechanic.GetAbilityToCounterMechanicType((int)record.GarrMechanicTypeID);

            this.m_mechanicCounterAbility.SetAbility(abilityToCounterMechanicType);
            GarrMechanicTypeRec record2 = StaticDB.garrMechanicTypeDB.GetRecord((int)record.GarrMechanicTypeID);

            if (record2 == null)
            {
                base.gameObject.SetActive(false);
                return;
            }
            this.m_encounterTypeLabel.text = record2.Name;
        }
Esempio n. 6
0
 private bool HasUsefulAbility(WrapperGarrisonFollower follower)
 {
     if (this.m_missionDetailViewForComparer == null)
     {
         return(false);
     }
     MissionMechanic[] mechanics = this.m_missionDetailViewForComparer.gameObject.GetComponentsInChildren <MissionMechanic>(true);
     if (mechanics == null)
     {
         return(false);
     }
     return((from id in follower.AbilityIDs
             select StaticDB.garrAbilityDB.GetRecord(id) into garrAbilityRec
             where garrAbilityRec != null && (garrAbilityRec.Flags& 1u) == 0u
             select garrAbilityRec).SelectMany((GarrAbilityRec garrAbilityRec) => StaticDB.garrAbilityEffectDB.GetRecordsByParentID(garrAbilityRec.ID)).Any(delegate(GarrAbilityEffectRec garrAbilityEffectRec)
     {
         if (garrAbilityEffectRec.GarrMechanicTypeID == 0u || garrAbilityEffectRec.AbilityAction != 0u)
         {
             return false;
         }
         GarrMechanicTypeRec garrMechanicTypeRec = StaticDB.garrMechanicTypeDB.GetRecord((int)garrAbilityEffectRec.GarrMechanicTypeID);
         return garrMechanicTypeRec != null && mechanics.Any((MissionMechanic mechanic) => mechanic.m_missionMechanicTypeID == garrMechanicTypeRec.ID);
     }));
 }
Esempio n. 7
0
    public void SetFollower(int garrFollowerID)
    {
        this.m_follower        = null;
        this.m_garrFollowerRec = null;
        if (this.m_abilityAreaRootObject != null)
        {
            RectTransform[] componentsInChildren = this.m_abilityAreaRootObject.GetComponentsInChildren <RectTransform>(true);
            if (componentsInChildren != null)
            {
                for (int i = 0; i < componentsInChildren.Length; i++)
                {
                    if (componentsInChildren[i] != null && componentsInChildren[i] != this.m_abilityAreaRootObject.transform)
                    {
                        Object.DestroyImmediate(componentsInChildren[i].gameObject);
                    }
                }
            }
        }
        if (garrFollowerID == 0)
        {
            if (this.m_portraitRingImage != null)
            {
                this.m_portraitRingImage.gameObject.SetActive(false);
            }
            if (this.m_heartPanel != null)
            {
                this.m_heartPanel.SetActive(false);
            }
            this.m_levelBorderImage.gameObject.SetActive(false);
            this.m_levelBorderImage_TitleQuality.gameObject.SetActive(false);
            this.m_portraitImage.gameObject.SetActive(false);
            this.m_qualityColorImage.gameObject.SetActive(false);
            this.m_qualityColorImage_TitleQuality.gameObject.SetActive(false);
            this.m_levelBorderImage.color = Color.white;
            this.m_levelText.gameObject.SetActive(false);
            this.isOccupied = false;
            this.m_portraitFrameImage.enabled = true;
            if (this.currentGarrFollowerID != garrFollowerID)
            {
                AdventureMapPanel.instance.MissionFollowerSlotChanged(this.currentGarrFollowerID, false);
            }
            bool flag = this.currentGarrFollowerID != 0;
            this.currentGarrFollowerID = 0;
            if (flag && this.m_missionDetailView != null)
            {
                this.m_missionDetailView.UpdateMissionStatus();
            }
            if (this.m_disableButtonWhenFollowerAssigned)
            {
                this.m_portraitFrameImage.GetComponent <Image>().enabled = true;
            }
            if (this.m_missionDetailView != null)
            {
                this.m_missionDetailView.NotifyFollowerSlotsChanged();
            }
            return;
        }
        this.m_portraitRingImage.gameObject.SetActive(true);
        this.m_levelBorderImage.gameObject.SetActive(true);
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(garrFollowerID);

        if (record == null)
        {
            return;
        }
        if (record.GarrFollowerTypeID != 4u)
        {
            return;
        }
        MissionMechanic[] mechanics = base.gameObject.transform.parent.parent.parent.gameObject.GetComponentsInChildren <MissionMechanic>(true);
        if (mechanics == null)
        {
            return;
        }
        JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary[garrFollowerID];
        float num = 0f;

        if (this.m_missionDetailView != null)
        {
            num = MissionDetailView.ComputeFollowerBias(jamGarrisonFollower, jamGarrisonFollower.FollowerLevel, (jamGarrisonFollower.ItemLevelWeapon + jamGarrisonFollower.ItemLevelArmor) / 2, this.m_missionDetailView.GetCurrentMissionID());
        }
        if (num == -1f)
        {
            this.m_levelText.color = Color.red;
        }
        else if (num < 0f)
        {
            this.m_levelText.color = new Color(0.9333f, 0.4392f, 0.2117f);
        }
        else
        {
            this.m_levelText.color = Color.white;
        }
        if (this.m_abilityAreaRootObject != null && num > -1f)
        {
            for (int j = 0; j < jamGarrisonFollower.AbilityID.Length; j++)
            {
                GarrAbilityRec garrAbilityRec = StaticDB.garrAbilityDB.GetRecord(jamGarrisonFollower.AbilityID[j]);
                if ((garrAbilityRec.Flags & 1u) == 0u)
                {
                    StaticDB.garrAbilityEffectDB.EnumRecordsByParentID(garrAbilityRec.ID, delegate(GarrAbilityEffectRec garrAbilityEffectRec)
                    {
                        if (garrAbilityEffectRec.GarrMechanicTypeID == 0u)
                        {
                            return(true);
                        }
                        if (garrAbilityEffectRec.AbilityAction != 0u)
                        {
                            return(true);
                        }
                        GarrMechanicTypeRec record2 = StaticDB.garrMechanicTypeDB.GetRecord((int)garrAbilityEffectRec.GarrMechanicTypeID);
                        if (record2 == null)
                        {
                            return(true);
                        }
                        bool flag3 = false;
                        for (int k = 0; k < mechanics.Length; k++)
                        {
                            if (mechanics[k].m_missionMechanicTypeID == record2.ID)
                            {
                                flag3 = true;
                                break;
                            }
                        }
                        if (!flag3)
                        {
                            return(true);
                        }
                        GameObject gameObject = Object.Instantiate <GameObject>(this.m_missionMechanicCounterPrefab);
                        gameObject.transform.SetParent(this.m_abilityAreaRootObject.transform, false);
                        MissionMechanicTypeCounter component = gameObject.GetComponent <MissionMechanicTypeCounter>();
                        component.usedIcon.gameObject.SetActive(false);
                        Sprite sprite2 = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, garrAbilityRec.IconFileDataID);
                        if (sprite2 != null)
                        {
                            component.missionMechanicIcon.sprite = sprite2;
                        }
                        component.countersMissionMechanicTypeID = record2.ID;
                        return(false);
                    });
                }
            }
        }
        this.m_levelText.gameObject.SetActive(true);
        if (jamGarrisonFollower.FollowerLevel < 110)
        {
            this.m_levelText.text = GeneralHelpers.TextOrderString(StaticDB.GetString("LEVEL", null), jamGarrisonFollower.FollowerLevel.ToString());
        }
        else
        {
            this.m_levelText.text = GeneralHelpers.TextOrderString(StaticDB.GetString("ILVL", null), ((jamGarrisonFollower.ItemLevelArmor + jamGarrisonFollower.ItemLevelWeapon) / 2).ToString());
        }
        this.m_portraitImage.gameObject.SetActive(true);
        Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID);

        if (sprite != null)
        {
            this.m_portraitImage.sprite = sprite;
        }
        if (jamGarrisonFollower.Quality == 6)
        {
            this.m_qualityColorImage_TitleQuality.gameObject.SetActive(true);
            this.m_levelBorderImage_TitleQuality.gameObject.SetActive(true);
            this.m_qualityColorImage.gameObject.SetActive(false);
            this.m_levelBorderImage.gameObject.SetActive(false);
        }
        else
        {
            this.m_qualityColorImage_TitleQuality.gameObject.SetActive(false);
            this.m_levelBorderImage_TitleQuality.gameObject.SetActive(false);
            this.m_qualityColorImage.gameObject.SetActive(true);
            this.m_levelBorderImage.gameObject.SetActive(true);
            Color qualityColor = GeneralHelpers.GetQualityColor(jamGarrisonFollower.Quality);
            this.m_qualityColorImage.color = qualityColor;
            this.m_levelBorderImage.color  = qualityColor;
        }
        this.isOccupied = true;
        bool flag2 = (jamGarrisonFollower.Flags & 8) != 0;

        this.m_qualityColorImage.gameObject.SetActive(!flag2);
        this.m_levelBorderImage.gameObject.SetActive(!flag2);
        if (this.m_heartPanel != null)
        {
            this.m_heartPanel.SetActive(flag2);
            if (flag2)
            {
                this.m_garrFollowerRec = record;
                this.m_follower        = jamGarrisonFollower;
            }
        }
        this.m_portraitFrameImage.enabled = !flag2;
        this.currentGarrFollowerID        = garrFollowerID;
        if (this.m_disableButtonWhenFollowerAssigned)
        {
            this.m_portraitFrameImage.GetComponent <Image>().enabled = false;
        }
        if (this.m_missionDetailView != null)
        {
            this.m_missionDetailView.UpdateMissionStatus();
            this.m_missionDetailView.NotifyFollowerSlotsChanged();
        }
    }
Esempio n. 8
0
        public void SetAbility(int garrAbilityID, bool hideCounterInfo = false, bool hideName = false, FollowerDetailView followerDetailView = null)
        {
            this.m_followerDetailView = followerDetailView;
            if (this.m_iconErrorText != null)
            {
                this.m_iconErrorText.gameObject.SetActive(false);
            }
            this.m_garrAbilityID = garrAbilityID;
            GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(this.m_garrAbilityID);

            if (record == null)
            {
                Debug.LogWarning(string.Concat("Invalid garrAbilityID ", this.m_garrAbilityID));
                return;
            }
            this.m_abilityNameText.text = record.Name;
            if (record.IconFileDataID <= 0)
            {
                this.m_abilityIcon.enabled = false;
            }
            else
            {
                Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID);
                if (sprite != null)
                {
                    this.m_abilityIcon.sprite = sprite;
                    if (this.m_grayscaleShader != null)
                    {
                        Material material = new Material(this.m_grayscaleShader);
                        this.m_abilityIcon.material = material;
                    }
                }
                else if (this.m_iconErrorText != null)
                {
                    this.m_iconErrorText.gameObject.SetActive(true);
                    this.m_iconErrorText.text = string.Concat(string.Empty, record.IconFileDataID);
                }
                this.m_abilityIcon.enabled = true;
            }
            this.m_garrAbilityID = record.ID;
            GarrAbilityCategoryRec garrAbilityCategoryRec = StaticDB.garrAbilityCategoryDB.GetRecord((int)record.GarrAbilityCategoryID);

            if (garrAbilityCategoryRec != null)
            {
                this.m_counteredMechanicName.text = garrAbilityCategoryRec.Name;
            }
            if (this.m_counteredMechanicGroup != null)
            {
                if (!hideCounterInfo)
                {
                    this.m_counteredGarrMechanicTypeID = 0;
                    GarrAbilityEffectRec garrAbilityEffectRec1 = StaticDB.garrAbilityEffectDB.GetRecordsByParentID(record.ID).FirstOrDefault <GarrAbilityEffectRec>((GarrAbilityEffectRec garrAbilityEffectRec) => {
                        if (garrAbilityEffectRec.GarrMechanicTypeID == 0)
                        {
                            return(false);
                        }
                        if (garrAbilityEffectRec.AbilityAction != 0)
                        {
                            return(false);
                        }
                        return(StaticDB.garrMechanicTypeDB.GetRecord((int)garrAbilityEffectRec.GarrMechanicTypeID) != null);
                    });
                    if (garrAbilityEffectRec1 != null)
                    {
                        GarrMechanicTypeRec garrMechanicTypeRec = StaticDB.garrMechanicTypeDB.GetRecord((int)garrAbilityEffectRec1.GarrMechanicTypeID);
                        Sprite sprite1 = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, garrMechanicTypeRec.IconFileDataID);
                        if (sprite1 == null)
                        {
                            this.m_counteredMechanicName.text = string.Concat("ERR ", garrMechanicTypeRec.IconFileDataID);
                        }
                        else
                        {
                            this.m_counteredMechanicIcon.sprite = sprite1;
                        }
                        this.m_counteredGarrMechanicTypeID = garrMechanicTypeRec.ID;
                    }
                }
                else
                {
                    this.m_counteredMechanicGroup.SetActive(false);
                }
            }
            this.SetCountered(false, true);
            if (this.m_counteredMechanicGroup != null)
            {
                this.m_counteredMechanicGroup.SetActive(this.m_counteredGarrMechanicTypeID > 0);
            }
            this.m_abilityNameText.gameObject.SetActive(!hideName);
        }
Esempio n. 9
0
    public void SetAbility(int garrAbilityID, bool hideCounterInfo = false, bool hideName = false, FollowerDetailView followerDetailView = null)
    {
        this.m_followerDetailView = followerDetailView;
        if (this.m_iconErrorText != null)
        {
            this.m_iconErrorText.gameObject.SetActive(false);
        }
        this.m_garrAbilityID = garrAbilityID;
        GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(this.m_garrAbilityID);

        if (record == null)
        {
            Debug.LogWarning("Invalid garrAbilityID " + this.m_garrAbilityID);
            return;
        }
        this.m_abilityNameText.text = record.Name;
        if (record.IconFileDataID > 0)
        {
            Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID);
            if (sprite != null)
            {
                this.m_abilityIcon.sprite = sprite;
                if (this.m_grayscaleShader != null)
                {
                    Material material = new Material(this.m_grayscaleShader);
                    this.m_abilityIcon.material = material;
                }
            }
            else if (this.m_iconErrorText != null)
            {
                this.m_iconErrorText.gameObject.SetActive(true);
                this.m_iconErrorText.text = string.Empty + record.IconFileDataID;
            }
            this.m_abilityIcon.enabled = true;
        }
        else
        {
            this.m_abilityIcon.enabled = false;
        }
        this.m_garrAbilityID = record.ID;
        GarrAbilityCategoryRec record2 = StaticDB.garrAbilityCategoryDB.GetRecord((int)record.GarrAbilityCategoryID);

        if (record2 != null)
        {
            this.m_counteredMechanicName.text = record2.Name;
        }
        if (this.m_counteredMechanicGroup != null)
        {
            if (hideCounterInfo)
            {
                this.m_counteredMechanicGroup.SetActive(false);
            }
            else
            {
                this.m_counteredGarrMechanicTypeID = 0;
                StaticDB.garrAbilityEffectDB.EnumRecordsByParentID(record.ID, delegate(GarrAbilityEffectRec garrAbilityEffectRec)
                {
                    if (garrAbilityEffectRec.GarrMechanicTypeID == 0u)
                    {
                        return(true);
                    }
                    if (garrAbilityEffectRec.AbilityAction != 0u)
                    {
                        return(true);
                    }
                    GarrMechanicTypeRec record3 = StaticDB.garrMechanicTypeDB.GetRecord((int)garrAbilityEffectRec.GarrMechanicTypeID);
                    if (record3 == null)
                    {
                        return(true);
                    }
                    Sprite sprite2 = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record3.IconFileDataID);
                    if (sprite2 != null)
                    {
                        this.m_counteredMechanicIcon.sprite = sprite2;
                    }
                    else
                    {
                        this.m_counteredMechanicName.text = "ERR " + record3.IconFileDataID;
                    }
                    this.m_counteredGarrMechanicTypeID = record3.ID;
                    return(false);
                });
            }
        }
        this.SetCountered(false, true);
        if (this.m_counteredMechanicGroup != null)
        {
            this.m_counteredMechanicGroup.SetActive(this.m_counteredGarrMechanicTypeID > 0);
        }
        this.m_abilityNameText.gameObject.SetActive(!hideName);
    }
        public void SetFollower(int garrFollowerID)
        {
            this.m_garrFollowerRec = null;
            if (this.m_abilityAreaRootObject != null)
            {
                RectTransform[] componentsInChildren = this.m_abilityAreaRootObject.GetComponentsInChildren <RectTransform>(true);
                if (componentsInChildren != null)
                {
                    for (int i = 0; i < (int)componentsInChildren.Length; i++)
                    {
                        if (componentsInChildren[i] != null && componentsInChildren[i] != this.m_abilityAreaRootObject.transform)
                        {
                            componentsInChildren[i].gameObject.transform.SetParent(null);
                            UnityEngine.Object.Destroy(componentsInChildren[i].gameObject);
                        }
                    }
                }
            }
            if (garrFollowerID == 0)
            {
                if (this.m_portraitRingImage != null)
                {
                    this.m_portraitRingImage.gameObject.SetActive(false);
                }
                if (this.m_heartPanel != null)
                {
                    this.m_heartPanel.SetActive(false);
                }
                this.m_levelBorderImage.gameObject.SetActive(false);
                this.m_levelBorderImage_TitleQuality.gameObject.SetActive(false);
                this.m_portraitImage.gameObject.SetActive(false);
                this.m_qualityColorImage.gameObject.SetActive(false);
                this.m_levelText.gameObject.SetActive(false);
                this.isOccupied = false;
                this.m_portraitFrameImage.enabled = true;
                if (this.currentGarrFollowerID != garrFollowerID)
                {
                    AdventureMapPanel.instance.MissionFollowerSlotChanged(this.currentGarrFollowerID, false);
                }
                bool flag = this.currentGarrFollowerID != 0;
                this.currentGarrFollowerID = 0;
                if (flag && this.m_missionDetailView != null)
                {
                    this.m_missionDetailView.UpdateMissionStatus();
                }
                if (this.m_disableButtonWhenFollowerAssigned)
                {
                    this.m_portraitFrameImage.GetComponent <Image>().enabled = true;
                }
                if (this.m_missionDetailView != null)
                {
                    this.m_missionDetailView.NotifyFollowerSlotsChanged();
                }
                return;
            }
            this.m_portraitRingImage.gameObject.SetActive(true);
            this.m_levelBorderImage.gameObject.SetActive(true);
            GarrFollowerRec garrFollowerRec = StaticDB.garrFollowerDB.GetRecord(garrFollowerID);

            if (garrFollowerRec == null)
            {
                return;
            }
            if (garrFollowerRec.GarrFollowerTypeID != (uint)GarrisonStatus.GarrisonFollowerType)
            {
                return;
            }
            MissionMechanic[] missionMechanicArray = base.gameObject.transform.parent.parent.parent.gameObject.GetComponentsInChildren <MissionMechanic>(true);
            if (missionMechanicArray == null)
            {
                return;
            }
            WrapperGarrisonFollower item = PersistentFollowerData.followerDictionary[garrFollowerID];
            float single = 0f;

            if (this.m_missionDetailView != null)
            {
                single = MissionDetailView.ComputeFollowerBias(item, item.FollowerLevel, (item.ItemLevelWeapon + item.ItemLevelArmor) / 2, this.m_missionDetailView.GetCurrentMissionID());
            }
            if (single == -1f)
            {
                this.m_levelText.color = Color.red;
            }
            else if (single >= 0f)
            {
                this.m_levelText.color = Color.white;
            }
            else
            {
                this.m_levelText.color = new Color(0.9333f, 0.4392f, 0.2117f);
            }
            if (this.m_abilityAreaRootObject != null && single > -1f)
            {
                for (int j = 0; j < item.AbilityIDs.Count; j++)
                {
                    GarrAbilityRec garrAbilityRec = StaticDB.garrAbilityDB.GetRecord(item.AbilityIDs[j]);
                    if ((garrAbilityRec.Flags & 1) == 0)
                    {
                        GarrAbilityEffectRec garrAbilityEffectRec1 = StaticDB.garrAbilityEffectDB.GetRecordsByParentID(garrAbilityRec.ID).FirstOrDefault <GarrAbilityEffectRec>((GarrAbilityEffectRec garrAbilityEffectRec) => {
                            if (garrAbilityEffectRec.GarrMechanicTypeID == 0 || garrAbilityEffectRec.AbilityAction != 0)
                            {
                                return(false);
                            }
                            GarrMechanicTypeRec record = StaticDB.garrMechanicTypeDB.GetRecord((int)garrAbilityEffectRec.GarrMechanicTypeID);
                            if (record == null)
                            {
                                return(false);
                            }
                            return(missionMechanicArray.Any <MissionMechanic>((MissionMechanic mechanic) => mechanic.m_missionMechanicTypeID == record.ID));
                        });
                        if (garrAbilityEffectRec1 != null)
                        {
                            GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_missionMechanicCounterPrefab, this.m_abilityAreaRootObject.transform, false);
                            MissionMechanicTypeCounter component = gameObject.GetComponent <MissionMechanicTypeCounter>();
                            component.usedIcon.gameObject.SetActive(false);
                            Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, garrAbilityRec.IconFileDataID);
                            if (sprite != null)
                            {
                                component.missionMechanicIcon.sprite = sprite;
                            }
                            component.countersMissionMechanicTypeID = (int)garrAbilityEffectRec1.GarrMechanicTypeID;
                        }
                    }
                }
            }
            this.m_levelText.gameObject.SetActive(true);
            this.m_levelText.text = item.FollowerLevel.ToString();
            this.m_portraitImage.gameObject.SetActive(true);
            Sprite sprite1 = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? garrFollowerRec.AllianceIconFileDataID : garrFollowerRec.HordeIconFileDataID));

            if (sprite1 != null)
            {
                this.m_portraitImage.sprite = sprite1;
            }
            if (item.Quality != 6)
            {
                this.m_levelBorderImage_TitleQuality.gameObject.SetActive(false);
                this.m_qualityColorImage.gameObject.SetActive(true);
                this.m_levelBorderImage.gameObject.SetActive(true);
                Color qualityColor = GeneralHelpers.GetQualityColor(item.Quality);
                this.m_qualityColorImage.color = qualityColor;
            }
            else
            {
                this.m_levelBorderImage_TitleQuality.gameObject.SetActive(true);
                this.m_qualityColorImage.gameObject.SetActive(false);
                this.m_levelBorderImage.gameObject.SetActive(false);
            }
            this.isOccupied = true;
            bool flags = (item.Flags & 8) != 0;

            this.m_qualityColorImage.gameObject.SetActive(!flags);
            this.m_levelBorderImage.gameObject.SetActive(!flags);
            if (this.m_heartPanel != null)
            {
                this.m_heartPanel.SetActive(flags);
                if (flags)
                {
                    this.m_garrFollowerRec = garrFollowerRec;
                    this.m_follower        = item;
                }
            }
            this.m_portraitFrameImage.enabled = !flags;
            this.currentGarrFollowerID        = garrFollowerID;
            if (this.m_disableButtonWhenFollowerAssigned)
            {
                this.m_portraitFrameImage.GetComponent <Image>().enabled = false;
            }
            if (this.m_missionDetailView != null)
            {
                this.m_missionDetailView.UpdateMissionStatus();
                this.m_missionDetailView.NotifyFollowerSlotsChanged();
            }
        }