public void ShowMissionResults(int garrMissionID, int missionResultType, bool awardOvermax)
        {
            int            num;
            GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(garrMissionID);

            if (record == null)
            {
                return;
            }
            this.RegisterMainScriptObjEvents();
            this.m_missionResultsDisplayCanvasGroupAutoFadeOut.Reset();
            this.m_currentResultType = (MissionResultType)missionResultType;
            this.m_followerExperienceDisplayArea.SetActive(false);
            this.m_attemptedAutoComplete = false;
            this.m_garrMissionID         = garrMissionID;
            this.m_darknessBG.SetActive(true);
            this.m_popupView.SetActive(true);
            this.m_bonusLootDisplay.SetActive(false);
            if (this.missionFollowerSlotGroup != null)
            {
                MissionFollowerSlot[] componentsInChildren = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
                for (int i = 0; i < (int)componentsInChildren.Length; i++)
                {
                    if (componentsInChildren[i] != null && componentsInChildren[i] != this.missionFollowerSlotGroup.transform)
                    {
                        componentsInChildren[i].gameObject.transform.SetParent(null);
                        UnityEngine.Object.Destroy(componentsInChildren[i].gameObject);
                    }
                }
            }
            MissionEncounter[] missionEncounterArray = this.enemyPortraitsGroup.GetComponentsInChildren <MissionEncounter>(true);
            for (int j = 0; j < (int)missionEncounterArray.Length; j++)
            {
                if (missionEncounterArray[j] != null && missionEncounterArray[j] != this.enemyPortraitsGroup.transform)
                {
                    missionEncounterArray[j].gameObject.transform.SetParent(null);
                    UnityEngine.Object.Destroy(missionEncounterArray[j].gameObject);
                }
            }
            if (this.treasureChestHorde != null && this.treasureChestAlliance != null)
            {
                if (GarrisonStatus.Faction() != PVP_FACTION.HORDE)
                {
                    this.treasureChestHorde.SetActive(false);
                    this.treasureChestAlliance.SetActive(true);
                }
                else
                {
                    this.treasureChestHorde.SetActive(true);
                    this.treasureChestAlliance.SetActive(false);
                }
            }
            WrapperGarrisonMission item = PersistentMissionData.missionDictionary[garrMissionID];

            this.m_missionStartedTime       = item.StartTime;
            this.m_missionDurationInSeconds = item.MissionDuration;
            for (int k = 0; k < item.Encounters.Count; k++)
            {
                GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.missionEncounterPrefab);
                gameObject.transform.SetParent(this.enemyPortraitsGroup.transform, false);
                MissionEncounter component = gameObject.GetComponent <MissionEncounter>();
                num = (item.Encounters[k].MechanicIDs.Count <= 0 ? 0 : item.Encounters[k].MechanicIDs[0]);
                component.SetEncounter(item.Encounters[k].EncounterID, num);
            }
            this.missionNameText.text     = record.Name;
            this.missionLocationText.text = record.Location;
            GarrMissionTypeRec garrMissionTypeRec = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID);

            this.missionTypeImage.overrideSprite = TextureAtlas.instance.GetAtlasSprite((int)garrMissionTypeRec.UiTextureAtlasMemberID);
            if (this.missionFollowerSlotGroup != null)
            {
                for (int l = 0; (long)l < (ulong)record.MaxFollowers; l++)
                {
                    GameObject gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.missionFollowerSlotPrefab);
                    gameObject1.transform.SetParent(this.missionFollowerSlotGroup.transform, false);
                    gameObject1.GetComponent <MissionFollowerSlot>().m_enemyPortraitsGroup = this.enemyPortraitsGroup;
                }
            }
            if (record.UiTextureKitID <= 0)
            {
                Debug.LogWarning(string.Concat(new object[] { "DATA ERROR: Mission UITextureKit Not Set for mission ID:", record.ID, " - ", record.Name }));
                Debug.LogWarning("This means the scrolling background images will show the wrong location");
            }
            else
            {
                UiTextureKitRec uiTextureKitRec = StaticDB.uiTextureKitDB.GetRecord((int)record.UiTextureKitID);
                this.m_scrollingEnvironment_Back.enabled = false;
                this.m_scrollingEnvironment_Mid.enabled  = false;
                this.m_scrollingEnvironment_Fore.enabled = false;
                int uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID(string.Concat("_", uiTextureKitRec.KitPrefix, "-Back"));
                if (uITextureAtlasMemberID > 0)
                {
                    Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite(uITextureAtlasMemberID);
                    if (atlasSprite == null)
                    {
                        uint uiTextureKitID = record.UiTextureKitID;
                        Debug.Log(string.Concat("Missing expected Back sprite from UiTextureKitID: [", uiTextureKitID.ToString(), "]"));
                    }
                    else
                    {
                        this.m_scrollingEnvironment_Back.enabled = true;
                        this.m_scrollingEnvironment_Back.sprite  = atlasSprite;
                    }
                }
                int uITextureAtlasMemberID1 = TextureAtlas.GetUITextureAtlasMemberID(string.Concat("_", uiTextureKitRec.KitPrefix, "-Mid"));
                if (uITextureAtlasMemberID1 > 0)
                {
                    Sprite sprite = TextureAtlas.instance.GetAtlasSprite(uITextureAtlasMemberID1);
                    if (sprite == null)
                    {
                        uint uiTextureKitID1 = record.UiTextureKitID;
                        Debug.Log(string.Concat("Missing expected Mid sprite from UiTextureKitID: [", uiTextureKitID1.ToString(), "]"));
                    }
                    else
                    {
                        this.m_scrollingEnvironment_Mid.enabled = true;
                        this.m_scrollingEnvironment_Mid.sprite  = sprite;
                    }
                }
                int num1 = TextureAtlas.GetUITextureAtlasMemberID(string.Concat("_", uiTextureKitRec.KitPrefix, "-Fore"));
                if (num1 > 0)
                {
                    Sprite atlasSprite1 = TextureAtlas.instance.GetAtlasSprite(num1);
                    if (atlasSprite1 == null)
                    {
                        uint uiTextureKitID2 = record.UiTextureKitID;
                        Debug.Log(string.Concat("Missing expected Fore sprite from UiTextureKitID: [", uiTextureKitID2.ToString(), "]"));
                    }
                    else
                    {
                        this.m_scrollingEnvironment_Fore.enabled = true;
                        this.m_scrollingEnvironment_Fore.sprite  = atlasSprite1;
                    }
                }
            }
            if (this.m_lootGroupObj == null || this.m_missionRewardDisplayPrefab == null)
            {
                return;
            }
            MissionRewardDisplay[] missionRewardDisplayArray = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
            for (int m = 0; m < (int)missionRewardDisplayArray.Length; m++)
            {
                if (missionRewardDisplayArray[m] != null)
                {
                    UnityEngine.Object.Destroy(missionRewardDisplayArray[m].gameObject);
                }
            }
            if (missionResultType == 1)
            {
                PersistentFollowerData.ClearPreMissionFollowerData();
            }
            List <WrapperGarrisonFollower> wrapperGarrisonFollowers = new List <WrapperGarrisonFollower>();

            MissionFollowerSlot[] missionFollowerSlotArray = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
            int num2 = 0;

            foreach (WrapperGarrisonFollower value in PersistentFollowerData.followerDictionary.Values)
            {
                if (value.CurrentMissionID != garrMissionID)
                {
                    continue;
                }
                int num3 = num2;
                num2 = num3 + 1;
                missionFollowerSlotArray[num3].SetFollower(value.GarrFollowerID);
                if (missionResultType == 1)
                {
                    PersistentFollowerData.CachePreMissionFollower(value);
                }
                wrapperGarrisonFollowers.Add(value);
            }
            this.UpdateMissionStatus(garrMissionID);
            MissionFollowerSlot[] missionFollowerSlotArray1 = missionFollowerSlotArray;
            for (int n = 0; n < (int)missionFollowerSlotArray1.Length; n++)
            {
                missionFollowerSlotArray1[n].InitHeartPanel();
            }
            MissionRewardDisplay.InitMissionRewards(this.m_missionRewardDisplayPrefab.gameObject, this.m_lootGroupObj.transform, item.Rewards);
            if (record.OvermaxRewardPackID > 0 && item.OvermaxRewards.Count > 0)
            {
                this.m_bonusLootDisplay.SetActive(true);
                WrapperGarrisonMissionReward wrapperGarrisonMissionReward = item.OvermaxRewards[0];
                if (wrapperGarrisonMissionReward.ItemID > 0)
                {
                    this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.item, wrapperGarrisonMissionReward.ItemID, (int)wrapperGarrisonMissionReward.ItemQuantity, 0, wrapperGarrisonMissionReward.ItemFileDataID);
                }
                else if (wrapperGarrisonMissionReward.FollowerXP > 0)
                {
                    this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.followerXP, 0, (int)wrapperGarrisonMissionReward.FollowerXP, 0, 0);
                }
                else if (wrapperGarrisonMissionReward.CurrencyQuantity > 0)
                {
                    if (wrapperGarrisonMissionReward.CurrencyType != 0)
                    {
                        CurrencyTypesRec currencyTypesRec = StaticDB.currencyTypesDB.GetRecord(wrapperGarrisonMissionReward.CurrencyType);
                        int currencyQuantity = (int)((ulong)wrapperGarrisonMissionReward.CurrencyQuantity / (long)(((currencyTypesRec.Flags & 8) == 0 ? 1 : 100)));
                        this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.currency, wrapperGarrisonMissionReward.CurrencyType, currencyQuantity, 0, 0);
                    }
                    else
                    {
                        this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.gold, 0, (int)(wrapperGarrisonMissionReward.CurrencyQuantity / 10000), 0, 0);
                    }
                }
            }
            this.m_timeUntilFadeOutMissionDetailsDisplay   = this.m_missionDetailsFadeOutDelay;
            this.m_timeUntilShowFollowerExperienceDisplays = this.m_experienceDisplayInitialEntranceDelay;
            if (missionResultType == 2)
            {
                this.InitFollowerExperienceDisplays();
                this.m_missionInProgressMessage.SetActive(false);
                this.m_missionSuccessMessage.SetActive(true);
                this.m_missionFailMessage.SetActive(false);
                if (this.m_fancyEntrance != null)
                {
                    UnityEngine.Object.Destroy(this.m_fancyEntrance);
                    iTween.Stop(this.m_missionSuccessMessage);
                    this.m_missionSuccessMessage.transform.localScale = Vector3.one;
                    iTween.Stop(this.m_missionFailMessage);
                    this.m_missionFailMessage.transform.localScale = Vector3.one;
                }
                this.m_missionSuccessMessage.SetActive(false);
                this.m_fancyEntrance = this.m_missionSuccessMessage.AddComponent <FancyEntrance>();
                this.m_fancyEntrance.m_fadeInCanvasGroup         = this.m_missionSuccessMessage.GetComponent <CanvasGroup>();
                this.m_fancyEntrance.m_fadeInTime                = this.m_messageFadeInTime;
                this.m_fancyEntrance.m_punchScale                = this.m_messagePunchScale;
                this.m_fancyEntrance.m_punchScaleAmount          = this.m_messagePunchScaleAmount;
                this.m_fancyEntrance.m_punchScaleDuration        = this.m_messagePunchScaleDuration;
                this.m_fancyEntrance.m_timeToDelayEntrance       = this.m_messageTimeToDelayEntrance;
                this.m_fancyEntrance.m_activateOnEnable          = true;
                this.m_fancyEntrance.m_objectToNotifyOnBegin     = base.gameObject;
                this.m_fancyEntrance.m_notifyOnBeginCallbackName = "OnShowSuccessMessage";
                this.m_missionSuccessMessage.SetActive(true);
                MissionRewardDisplay[] componentsInChildren1 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
                for (int o = 0; o < (int)componentsInChildren1.Length; o++)
                {
                    componentsInChildren1[o].ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)o);
                }
                if (this.m_bonusLootChance > 0)
                {
                    iTween.ValueTo(base.gameObject, iTween.Hash(new object[] { "name", "ShakeIt", "from", 0.3f, "to", 1f, "delay", this.m_bonusLootShakeInitialDelay, "time", this.m_bonusLootShakeDuration, "onupdate", "OnBonusLootShakeUpdate", "oncomplete", "OnBonusLootShakeComplete" }));
                }
                if (!awardOvermax)
                {
                    this.m_bonusMissionRewardDisplay.ShowResultFail(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)((int)componentsInChildren1.Length));
                }
                else
                {
                    this.m_bonusMissionRewardDisplay.ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)((int)componentsInChildren1.Length));
                }
            }
            if (missionResultType == 3)
            {
                this.InitFollowerExperienceDisplays();
                this.m_missionInProgressMessage.SetActive(false);
                this.m_missionSuccessMessage.SetActive(false);
                this.m_missionFailMessage.SetActive(true);
                if (this.m_fancyEntrance != null)
                {
                    UnityEngine.Object.Destroy(this.m_fancyEntrance);
                    iTween.Stop(this.m_missionSuccessMessage);
                    this.m_missionSuccessMessage.transform.localScale = Vector3.one;
                    iTween.Stop(this.m_missionFailMessage);
                    this.m_missionFailMessage.transform.localScale = Vector3.one;
                }
                this.m_missionFailMessage.SetActive(false);
                this.m_fancyEntrance = this.m_missionFailMessage.AddComponent <FancyEntrance>();
                this.m_fancyEntrance.m_fadeInCanvasGroup         = this.m_missionFailMessage.GetComponent <CanvasGroup>();
                this.m_fancyEntrance.m_fadeInTime                = this.m_messageFadeInTime;
                this.m_fancyEntrance.m_punchScale                = this.m_messagePunchScale;
                this.m_fancyEntrance.m_punchScaleAmount          = this.m_messagePunchScaleAmount;
                this.m_fancyEntrance.m_punchScaleDuration        = this.m_messagePunchScaleDuration;
                this.m_fancyEntrance.m_timeToDelayEntrance       = this.m_messageTimeToDelayEntrance;
                this.m_fancyEntrance.m_activateOnEnable          = true;
                this.m_fancyEntrance.m_objectToNotifyOnBegin     = base.gameObject;
                this.m_fancyEntrance.m_notifyOnBeginCallbackName = "OnShowFailMessage";
                this.m_missionFailMessage.SetActive(true);
                MissionRewardDisplay[] missionRewardDisplayArray1 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
                for (int p = 0; p < (int)missionRewardDisplayArray1.Length; p++)
                {
                    missionRewardDisplayArray1[p].ShowResultFail(this.m_lootEffectInitialDelay);
                }
                this.m_bonusMissionRewardDisplay.ShowResultFail(this.m_lootEffectInitialDelay);
            }
            if (missionResultType == 0)
            {
                this.m_missionInProgressMessage.SetActive(true);
                this.m_missionSuccessMessage.SetActive(false);
                this.m_missionFailMessage.SetActive(false);
                this.m_bonusMissionRewardDisplay.ClearResults();
            }
            if (missionResultType == 1)
            {
                this.m_missionInProgressMessage.SetActive(false);
                this.m_missionSuccessMessage.SetActive(false);
                this.m_missionFailMessage.SetActive(false);
                FollowerExperienceDisplay[] followerExperienceDisplayArray = this.m_followerExperienceDisplayArea.GetComponentsInChildren <FollowerExperienceDisplay>(true);
                for (int q = 0; q < (int)followerExperienceDisplayArray.Length; q++)
                {
                    UnityEngine.Object.Destroy(followerExperienceDisplayArray[q].gameObject);
                }
            }
            if (this.m_partyBuffGroup == null)
            {
                return;
            }
            AbilityDisplay[] abilityDisplayArray = this.m_partyBuffGroup.GetComponentsInChildren <AbilityDisplay>(true);
            for (int r = 0; r < (int)abilityDisplayArray.Length; r++)
            {
                UnityEngine.Object.Destroy(abilityDisplayArray[r].gameObject);
            }
            int adjustedMissionDuration = GeneralHelpers.GetAdjustedMissionDuration(record, wrapperGarrisonFollowers, this.enemyPortraitsGroup);
            int length = 0;

            foreach (WrapperGarrisonFollower wrapperGarrisonFollower in PersistentFollowerData.followerDictionary.Values)
            {
                if (wrapperGarrisonFollower.CurrentMissionID == garrMissionID)
                {
                    int[] buffsForCurrentMission = GeneralHelpers.GetBuffsForCurrentMission(wrapperGarrisonFollower.GarrFollowerID, garrMissionID, this.missionFollowerSlotGroup, adjustedMissionDuration);
                    length += (int)buffsForCurrentMission.Length;
                    int[] numArray = buffsForCurrentMission;
                    for (int s = 0; s < (int)numArray.Length; s++)
                    {
                        int        num4        = numArray[s];
                        GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(this.m_mechanicEffectDisplayPrefab);
                        gameObject2.transform.SetParent(this.m_partyBuffGroup.transform, false);
                        gameObject2.GetComponent <AbilityDisplay>().SetAbility(num4, false, false, null);
                    }
                }
            }
            if (length <= 8)
            {
                this.m_partyBuffsText.text = StaticDB.GetString("PARTY_BUFFS", null);
            }
            else
            {
                this.m_partyBuffsText.text = string.Empty;
            }
            HorizontalLayoutGroup horizontalLayoutGroup = this.m_partyBuffGroup.GetComponent <HorizontalLayoutGroup>();

            if (horizontalLayoutGroup != null)
            {
                if (length <= 10 || !Main.instance.IsNarrowScreen())
                {
                    horizontalLayoutGroup.spacing = 6f;
                }
                else
                {
                    horizontalLayoutGroup.spacing = 3f;
                }
            }
            this.m_partyBuffGroup.SetActive(length > 0);
        }
        public void ShowMissionResults(int garrMissionID, int missionResultType, bool awardOvermax)
        {
            GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(garrMissionID);

            if (record == null)
            {
                return;
            }
            this.m_missionResultsDisplayCanvasGroupAutoFadeOut.Reset();
            this.m_currentResultType = (MissionResultType)missionResultType;
            this.m_followerExperienceDisplayArea.SetActive(false);
            this.m_attemptedAutoComplete = false;
            this.m_garrMissionID         = garrMissionID;
            this.m_darknessBG.SetActive(true);
            this.m_popupView.SetActive(true);
            this.m_bonusLootDisplay.SetActive(false);
            if (this.missionFollowerSlotGroup != null)
            {
                MissionFollowerSlot[] componentsInChildren = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
                for (int i = 0; i < componentsInChildren.Length; i++)
                {
                    if (componentsInChildren[i] != null && componentsInChildren[i] != this.missionFollowerSlotGroup.transform)
                    {
                        componentsInChildren[i].gameObject.transform.SetParent(null);
                        Object.Destroy(componentsInChildren[i].gameObject);
                    }
                }
            }
            MissionEncounter[] componentsInChildren2 = this.enemyPortraitsGroup.GetComponentsInChildren <MissionEncounter>(true);
            for (int j = 0; j < componentsInChildren2.Length; j++)
            {
                if (componentsInChildren2[j] != null && componentsInChildren2[j] != this.enemyPortraitsGroup.transform)
                {
                    componentsInChildren2[j].gameObject.transform.SetParent(null);
                    Object.Destroy(componentsInChildren2[j].gameObject);
                }
            }
            if (this.treasureChestHorde != null && this.treasureChestAlliance != null)
            {
                if (GarrisonStatus.Faction() == PVP_FACTION.HORDE)
                {
                    this.treasureChestHorde.SetActive(true);
                    this.treasureChestAlliance.SetActive(false);
                }
                else
                {
                    this.treasureChestHorde.SetActive(false);
                    this.treasureChestAlliance.SetActive(true);
                }
            }
            WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[garrMissionID];

            this.m_missionStartedTime       = wrapperGarrisonMission.StartTime;
            this.m_missionDurationInSeconds = wrapperGarrisonMission.MissionDuration;
            for (int k = 0; k < wrapperGarrisonMission.Encounters.Count; k++)
            {
                GameObject gameObject = Object.Instantiate <GameObject>(this.missionEncounterPrefab);
                gameObject.transform.SetParent(this.enemyPortraitsGroup.transform, false);
                MissionEncounter component = gameObject.GetComponent <MissionEncounter>();
                int garrMechanicID         = (wrapperGarrisonMission.Encounters[k].MechanicIDs.Count <= 0) ? 0 : wrapperGarrisonMission.Encounters[k].MechanicIDs[0];
                component.SetEncounter(wrapperGarrisonMission.Encounters[k].EncounterID, garrMechanicID);
            }
            this.missionNameText.text     = record.Name;
            this.missionLocationText.text = record.Location;
            GarrMissionTypeRec record2 = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID);

            this.missionTypeImage.overrideSprite = TextureAtlas.instance.GetAtlasSprite((int)record2.UiTextureAtlasMemberID);
            if (this.missionFollowerSlotGroup != null)
            {
                for (int l = 0; l < (int)record.MaxFollowers; l++)
                {
                    GameObject gameObject2 = Object.Instantiate <GameObject>(this.missionFollowerSlotPrefab);
                    gameObject2.transform.SetParent(this.missionFollowerSlotGroup.transform, false);
                    MissionFollowerSlot component2 = gameObject2.GetComponent <MissionFollowerSlot>();
                    component2.m_enemyPortraitsGroup = this.enemyPortraitsGroup;
                }
            }
            if (record.UiTextureKitID > 0)
            {
                UiTextureKitRec record3 = StaticDB.uiTextureKitDB.GetRecord((int)record.UiTextureKitID);
                this.m_scrollingEnvironment_Back.enabled = false;
                this.m_scrollingEnvironment_Mid.enabled  = false;
                this.m_scrollingEnvironment_Fore.enabled = false;
                int uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Back");
                if (uitextureAtlasMemberID > 0)
                {
                    Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite(uitextureAtlasMemberID);
                    if (atlasSprite != null)
                    {
                        this.m_scrollingEnvironment_Back.enabled = true;
                        this.m_scrollingEnvironment_Back.sprite  = atlasSprite;
                    }
                    else
                    {
                        Debug.Log("Missing expected Back sprite from UiTextureKitID: [" + record.UiTextureKitID.ToString() + "]");
                    }
                }
                int uitextureAtlasMemberID2 = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Mid");
                if (uitextureAtlasMemberID2 > 0)
                {
                    Sprite atlasSprite2 = TextureAtlas.instance.GetAtlasSprite(uitextureAtlasMemberID2);
                    if (atlasSprite2 != null)
                    {
                        this.m_scrollingEnvironment_Mid.enabled = true;
                        this.m_scrollingEnvironment_Mid.sprite  = atlasSprite2;
                    }
                    else
                    {
                        Debug.Log("Missing expected Mid sprite from UiTextureKitID: [" + record.UiTextureKitID.ToString() + "]");
                    }
                }
                int uitextureAtlasMemberID3 = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Fore");
                if (uitextureAtlasMemberID3 > 0)
                {
                    Sprite atlasSprite3 = TextureAtlas.instance.GetAtlasSprite(uitextureAtlasMemberID3);
                    if (atlasSprite3 != null)
                    {
                        this.m_scrollingEnvironment_Fore.enabled = true;
                        this.m_scrollingEnvironment_Fore.sprite  = atlasSprite3;
                    }
                    else
                    {
                        Debug.Log("Missing expected Fore sprite from UiTextureKitID: [" + record.UiTextureKitID.ToString() + "]");
                    }
                }
            }
            else
            {
                Debug.LogWarning(string.Concat(new object[]
                {
                    "DATA ERROR: Mission UITextureKit Not Set for mission ID:",
                    record.ID,
                    " - ",
                    record.Name
                }));
                Debug.LogWarning("This means the scrolling background images will show the wrong location");
            }
            if (this.m_lootGroupObj == null || this.m_missionRewardDisplayPrefab == null)
            {
                return;
            }
            MissionRewardDisplay[] componentsInChildren3 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
            for (int m = 0; m < componentsInChildren3.Length; m++)
            {
                if (componentsInChildren3[m] != null)
                {
                    Object.Destroy(componentsInChildren3[m].gameObject);
                }
            }
            if (missionResultType == 1)
            {
                PersistentFollowerData.ClearPreMissionFollowerData();
            }
            List <WrapperGarrisonFollower> list = new List <WrapperGarrisonFollower>();

            MissionFollowerSlot[] componentsInChildren4 = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
            int num = 0;

            foreach (WrapperGarrisonFollower wrapperGarrisonFollower in PersistentFollowerData.followerDictionary.Values)
            {
                if (wrapperGarrisonFollower.CurrentMissionID == garrMissionID)
                {
                    componentsInChildren4[num++].SetFollower(wrapperGarrisonFollower.GarrFollowerID);
                    if (missionResultType == 1)
                    {
                        PersistentFollowerData.CachePreMissionFollower(wrapperGarrisonFollower);
                    }
                    list.Add(wrapperGarrisonFollower);
                }
            }
            this.UpdateMissionStatus(garrMissionID);
            foreach (MissionFollowerSlot missionFollowerSlot in componentsInChildren4)
            {
                missionFollowerSlot.InitHeartPanel();
            }
            MissionRewardDisplay.InitMissionRewards(this.m_missionRewardDisplayPrefab.gameObject, this.m_lootGroupObj.transform, wrapperGarrisonMission.Rewards);
            if (record.OvermaxRewardPackID > 0 && wrapperGarrisonMission.OvermaxRewards.Count > 0)
            {
                this.m_bonusLootDisplay.SetActive(true);
                WrapperGarrisonMissionReward wrapperGarrisonMissionReward = wrapperGarrisonMission.OvermaxRewards[0];
                if (wrapperGarrisonMissionReward.ItemID > 0)
                {
                    this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.item, wrapperGarrisonMissionReward.ItemID, (int)wrapperGarrisonMissionReward.ItemQuantity, 0, wrapperGarrisonMissionReward.ItemFileDataID);
                }
                else if (wrapperGarrisonMissionReward.FollowerXP > 0u)
                {
                    this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.followerXP, 0, (int)wrapperGarrisonMissionReward.FollowerXP, 0, 0);
                }
                else if (wrapperGarrisonMissionReward.CurrencyQuantity > 0u)
                {
                    if (wrapperGarrisonMissionReward.CurrencyType == 0)
                    {
                        this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.gold, 0, (int)(wrapperGarrisonMissionReward.CurrencyQuantity / 10000u), 0, 0);
                    }
                    else
                    {
                        CurrencyTypesRec record4 = StaticDB.currencyTypesDB.GetRecord(wrapperGarrisonMissionReward.CurrencyType);
                        int rewardQuantity       = (int)((ulong)wrapperGarrisonMissionReward.CurrencyQuantity / (ulong)(((record4.Flags & 8u) == 0u) ? 1L : 100L));
                        this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.currency, wrapperGarrisonMissionReward.CurrencyType, rewardQuantity, 0, 0);
                    }
                }
            }
            this.m_timeUntilFadeOutMissionDetailsDisplay   = this.m_missionDetailsFadeOutDelay;
            this.m_timeUntilShowFollowerExperienceDisplays = this.m_experienceDisplayInitialEntranceDelay;
            if (missionResultType == 2)
            {
                this.InitFollowerExperienceDisplays();
                this.m_missionInProgressMessage.SetActive(false);
                this.m_missionSuccessMessage.SetActive(true);
                this.m_missionFailMessage.SetActive(false);
                if (this.m_fancyEntrance != null)
                {
                    Object.Destroy(this.m_fancyEntrance);
                    iTween.Stop(this.m_missionSuccessMessage);
                    this.m_missionSuccessMessage.transform.localScale = Vector3.one;
                    iTween.Stop(this.m_missionFailMessage);
                    this.m_missionFailMessage.transform.localScale = Vector3.one;
                }
                this.m_missionSuccessMessage.SetActive(false);
                this.m_fancyEntrance = this.m_missionSuccessMessage.AddComponent <FancyEntrance>();
                this.m_fancyEntrance.m_fadeInCanvasGroup         = this.m_missionSuccessMessage.GetComponent <CanvasGroup>();
                this.m_fancyEntrance.m_fadeInTime                = this.m_messageFadeInTime;
                this.m_fancyEntrance.m_punchScale                = this.m_messagePunchScale;
                this.m_fancyEntrance.m_punchScaleAmount          = this.m_messagePunchScaleAmount;
                this.m_fancyEntrance.m_punchScaleDuration        = this.m_messagePunchScaleDuration;
                this.m_fancyEntrance.m_timeToDelayEntrance       = this.m_messageTimeToDelayEntrance;
                this.m_fancyEntrance.m_activateOnEnable          = true;
                this.m_fancyEntrance.m_objectToNotifyOnBegin     = base.gameObject;
                this.m_fancyEntrance.m_notifyOnBeginCallbackName = "OnShowSuccessMessage";
                this.m_missionSuccessMessage.SetActive(true);
                MissionRewardDisplay[] componentsInChildren5 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
                for (int num2 = 0; num2 < componentsInChildren5.Length; num2++)
                {
                    componentsInChildren5[num2].ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)num2);
                }
                if (this.m_bonusLootChance > 0)
                {
                    iTween.ValueTo(base.gameObject, iTween.Hash(new object[]
                    {
                        "name",
                        "ShakeIt",
                        "from",
                        0.3f,
                        "to",
                        1f,
                        "delay",
                        this.m_bonusLootShakeInitialDelay,
                        "time",
                        this.m_bonusLootShakeDuration,
                        "onupdate",
                        "OnBonusLootShakeUpdate",
                        "oncomplete",
                        "OnBonusLootShakeComplete"
                    }));
                }
                if (awardOvermax)
                {
                    this.m_bonusMissionRewardDisplay.ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)componentsInChildren5.Length);
                }
                else
                {
                    this.m_bonusMissionRewardDisplay.ShowResultFail(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)componentsInChildren5.Length);
                }
            }
            if (missionResultType == 3)
            {
                this.InitFollowerExperienceDisplays();
                this.m_missionInProgressMessage.SetActive(false);
                this.m_missionSuccessMessage.SetActive(false);
                this.m_missionFailMessage.SetActive(true);
                if (this.m_fancyEntrance != null)
                {
                    Object.Destroy(this.m_fancyEntrance);
                    iTween.Stop(this.m_missionSuccessMessage);
                    this.m_missionSuccessMessage.transform.localScale = Vector3.one;
                    iTween.Stop(this.m_missionFailMessage);
                    this.m_missionFailMessage.transform.localScale = Vector3.one;
                }
                this.m_missionFailMessage.SetActive(false);
                this.m_fancyEntrance = this.m_missionFailMessage.AddComponent <FancyEntrance>();
                this.m_fancyEntrance.m_fadeInCanvasGroup         = this.m_missionFailMessage.GetComponent <CanvasGroup>();
                this.m_fancyEntrance.m_fadeInTime                = this.m_messageFadeInTime;
                this.m_fancyEntrance.m_punchScale                = this.m_messagePunchScale;
                this.m_fancyEntrance.m_punchScaleAmount          = this.m_messagePunchScaleAmount;
                this.m_fancyEntrance.m_punchScaleDuration        = this.m_messagePunchScaleDuration;
                this.m_fancyEntrance.m_timeToDelayEntrance       = this.m_messageTimeToDelayEntrance;
                this.m_fancyEntrance.m_activateOnEnable          = true;
                this.m_fancyEntrance.m_objectToNotifyOnBegin     = base.gameObject;
                this.m_fancyEntrance.m_notifyOnBeginCallbackName = "OnShowFailMessage";
                this.m_missionFailMessage.SetActive(true);
                MissionRewardDisplay[] componentsInChildren6 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
                for (int num3 = 0; num3 < componentsInChildren6.Length; num3++)
                {
                    componentsInChildren6[num3].ShowResultFail(this.m_lootEffectInitialDelay);
                }
                this.m_bonusMissionRewardDisplay.ShowResultFail(this.m_lootEffectInitialDelay);
            }
            if (missionResultType == 0)
            {
                this.m_missionInProgressMessage.SetActive(true);
                this.m_missionSuccessMessage.SetActive(false);
                this.m_missionFailMessage.SetActive(false);
                this.m_bonusMissionRewardDisplay.ClearResults();
            }
            if (missionResultType == 1)
            {
                this.m_missionInProgressMessage.SetActive(false);
                this.m_missionSuccessMessage.SetActive(false);
                this.m_missionFailMessage.SetActive(false);
                FollowerExperienceDisplay[] componentsInChildren7 = this.m_followerExperienceDisplayArea.GetComponentsInChildren <FollowerExperienceDisplay>(true);
                foreach (FollowerExperienceDisplay followerExperienceDisplay in componentsInChildren7)
                {
                    Object.Destroy(followerExperienceDisplay.gameObject);
                }
            }
            if (this.m_partyBuffGroup == null)
            {
                return;
            }
            AbilityDisplay[] componentsInChildren8 = this.m_partyBuffGroup.GetComponentsInChildren <AbilityDisplay>(true);
            foreach (AbilityDisplay abilityDisplay in componentsInChildren8)
            {
                Object.Destroy(abilityDisplay.gameObject);
            }
            int adjustedMissionDuration = GeneralHelpers.GetAdjustedMissionDuration(record, list, this.enemyPortraitsGroup);
            int num6 = 0;

            foreach (WrapperGarrisonFollower wrapperGarrisonFollower2 in PersistentFollowerData.followerDictionary.Values)
            {
                if (wrapperGarrisonFollower2.CurrentMissionID == garrMissionID)
                {
                    int[] buffsForCurrentMission = GeneralHelpers.GetBuffsForCurrentMission(wrapperGarrisonFollower2.GarrFollowerID, garrMissionID, this.missionFollowerSlotGroup, adjustedMissionDuration);
                    num6 += buffsForCurrentMission.Length;
                    foreach (int garrAbilityID in buffsForCurrentMission)
                    {
                        GameObject gameObject3 = Object.Instantiate <GameObject>(this.m_mechanicEffectDisplayPrefab);
                        gameObject3.transform.SetParent(this.m_partyBuffGroup.transform, false);
                        AbilityDisplay component3 = gameObject3.GetComponent <AbilityDisplay>();
                        component3.SetAbility(garrAbilityID, false, false, null);
                    }
                }
            }
            if (num6 > 8)
            {
                this.m_partyBuffsText.text = string.Empty;
            }
            else
            {
                this.m_partyBuffsText.text = StaticDB.GetString("PARTY_BUFFS", null);
            }
            HorizontalLayoutGroup component4 = this.m_partyBuffGroup.GetComponent <HorizontalLayoutGroup>();

            if (component4 != null)
            {
                if (num6 > 10 && Main.instance.IsNarrowScreen())
                {
                    component4.spacing = 3f;
                }
                else
                {
                    component4.spacing = 6f;
                }
            }
            this.m_partyBuffGroup.SetActive(num6 > 0);
        }