Exemplo n.º 1
0
 public static void AddMission(WrapperGarrisonMission mission)
 {
     if (!PersistentMissionData.instance.m_missionDictionary.ContainsKey(mission.MissionRecID))
     {
         PersistentMissionData.instance.m_missionDictionary.Add(mission.MissionRecID, mission);
     }
 }
        public void OnMissionStatusChanged(bool awardOvermax, bool missionSucceeded)
        {
            WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[this.m_garrMissionID];

            if (wrapperGarrisonMission.MissionState == 6 && !missionSucceeded)
            {
                Debug.Log("OnMissionStatusChanged() MISSION FAILED " + this.m_garrMissionID);
                this.m_claimedMyLoot = true;
                this.ShowMissionFailure();
                return;
            }
            if (!this.m_claimedMyLoot)
            {
                if (wrapperGarrisonMission.MissionState == 2 || wrapperGarrisonMission.MissionState == 3)
                {
                    Singleton <GarrisonWrapper> .Instance.ClaimMissionBonus(this.m_garrMissionID);

                    this.m_claimedMyLoot = true;
                }
                return;
            }
            if (!this.m_showedMyLoot)
            {
                this.ShowMissionSuccess(awardOvermax);
                this.m_showedMyLoot = true;
            }
        }
Exemplo n.º 3
0
        public void OnAddMissionLootToRewardPanel(int garrMissionID)
        {
            WrapperGarrisonMission item = PersistentMissionData.missionDictionary[garrMissionID];

            MissionRewardDisplay.InitMissionRewards(AdventureMapPanel.instance.m_missionRewardResultsDisplayPrefab, this.m_rewardIconArea.transform, item.Rewards);
            if (item.MissionState != 3)
            {
                return;
            }
            GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(garrMissionID);

            if (record == null)
            {
                return;
            }
            if (StaticDB.rewardPackDB.GetRecord(record.OvermaxRewardPackID) == null)
            {
                return;
            }
            if (item.OvermaxRewards.Count > 0)
            {
                GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(AdventureMapPanel.instance.m_missionRewardResultsDisplayPrefab);
                gameObject.transform.SetParent(this.m_rewardIconArea.transform, false);
                MissionRewardDisplay component = gameObject.GetComponent <MissionRewardDisplay>();
                int  itemID       = item.OvermaxRewards[0].ItemID;
                uint itemQuantity = item.OvermaxRewards[0].ItemQuantity;
                WrapperGarrisonMissionReward wrapperGarrisonMissionReward = item.OvermaxRewards[0];
                component.InitReward(MissionRewardDisplay.RewardType.item, itemID, (int)itemQuantity, 0, wrapperGarrisonMissionReward.ItemFileDataID);
            }
        }
        public void OnMissionStatusChanged(bool awardOvermax, bool missionSucceeded)
        {
            WrapperGarrisonMission item = PersistentMissionData.missionDictionary[this.m_garrMissionID];

            if (item.MissionState == 6 && !missionSucceeded)
            {
                Debug.Log(string.Concat("OnMissionStatusChanged() MISSION FAILED ", this.m_garrMissionID));
                this.m_claimedMyLoot = true;
                this.ShowMissionFailure();
                return;
            }
            if (this.m_claimedMyLoot)
            {
                if (!this.m_showedMyLoot)
                {
                    this.ShowMissionSuccess(awardOvermax);
                    this.m_showedMyLoot = true;
                }
                return;
            }
            if (item.MissionState == 2 || item.MissionState == 3)
            {
                Main.instance.ClaimMissionBonus(this.m_garrMissionID);
                this.m_claimedMyLoot = true;
            }
        }
        private int GetUncounteredMissionDuration(WrapperGarrisonMission mission)
        {
            GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(mission.MissionRecID);

            if (record == null)
            {
                return(0);
            }
            float num = (float)record.MissionDuration;

            foreach (WrapperGarrisonEncounter wrapperGarrisonEncounter in mission.Encounters)
            {
                foreach (int id in wrapperGarrisonEncounter.MechanicIDs)
                {
                    GarrMechanicRec record2 = StaticDB.garrMechanicDB.GetRecord(id);
                    if (record2 != null)
                    {
                        foreach (GarrAbilityEffectRec garrAbilityEffectRec in from rec in StaticDB.garrAbilityEffectDB.GetRecordsByParentID(record2.GarrAbilityID)
                                 where rec.AbilityAction == 17u
                                 select rec)
                        {
                            num *= garrAbilityEffectRec.ActionValueFlat;
                        }
                    }
                }
            }
            num *= GeneralHelpers.GetMissionDurationTalentMultiplier();
            return((int)num);
        }
Exemplo n.º 6
0
        public void UpdateUsefulAbilitiesDisplay(int currentGarrMissionID, IDictionary <uint, int> usefulCounterAbilityIDs)
        {
            if (!PersistentFollowerData.followerDictionary.ContainsKey(this.m_followerID))
            {
                return;
            }
            AbilityDisplay[] componentsInChildren = this.usefulAbilitiesGroup.GetComponentsInChildren <AbilityDisplay>(true);
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                Object.Destroy(componentsInChildren[i].gameObject);
            }
            WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[currentGarrMissionID];

            for (int j = 0; j < wrapperGarrisonMission.Encounters.Count; j++)
            {
                int             num    = (wrapperGarrisonMission.Encounters[j].MechanicIDs.Count <= 0) ? 0 : wrapperGarrisonMission.Encounters[j].MechanicIDs[0];
                GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(num);
                if (record == null)
                {
                    Debug.LogWarning(string.Concat(new object[]
                    {
                        "INVALID garrMechanic ID ",
                        num,
                        " in mission ",
                        wrapperGarrisonMission.MissionRecID
                    }));
                }
                else if (!usefulCounterAbilityIDs.ContainsKey(record.GarrMechanicTypeID))
                {
                    int abilityToCounterMechanicType = MissionMechanic.GetAbilityToCounterMechanicType((int)record.GarrMechanicTypeID);
                    usefulCounterAbilityIDs.Add(record.GarrMechanicTypeID, abilityToCounterMechanicType);
                }
            }
            List <int> usefulBuffAbilitiesForFollower = MissionMechanic.GetUsefulBuffAbilitiesForFollower(this.m_followerID);
            List <int> list = usefulCounterAbilityIDs.Values.Union(usefulBuffAbilitiesForFollower).ToList <int>();

            foreach (int num2 in PersistentFollowerData.followerDictionary[this.m_followerID].AbilityIDs)
            {
                foreach (int num3 in list)
                {
                    if (num2 == num3)
                    {
                        GameObject gameObject = Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab);
                        gameObject.transform.SetParent(this.usefulAbilitiesGroup.transform, false);
                        AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>();
                        component.SetAbility(num2, true, false, null);
                        component.m_abilityNameText.gameObject.SetActive(false);
                    }
                }
            }
        }
        public bool ShouldShowCompletedMission()
        {
            WrapperGarrisonMission item = PersistentMissionData.missionDictionary[this.m_garrMissionID];

            if (item.MissionState == 2 || item.MissionState == 3)
            {
                return(true);
            }
            if (item.MissionState == 1 && (GarrisonStatus.CurrentTime() - this.m_missionStartedTime) >= this.m_missionDuration)
            {
                return(true);
            }
            return(false);
        }
 private void CollectFirstCompletedMission()
 {
     MissionListItem[] componentsInChildren = this.completedMissionListContents.GetComponentsInChildren <MissionListItem>(true);
     for (int i = 0; i < componentsInChildren.Length; i++)
     {
         WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[componentsInChildren[i].garrMissionID];
         if (!this.GetRequestedMissionCollectionDictionary().ContainsKey(componentsInChildren[i].garrMissionID) && PersistentMissionData.missionDictionary.ContainsKey(componentsInChildren[i].garrMissionID) && wrapperGarrisonMission.MissionState == 2)
         {
             this.GetRequestedMissionCollectionDictionary().Add(componentsInChildren[i].garrMissionID, true);
             Main.instance.ClaimMissionBonus(componentsInChildren[i].garrMissionID);
             break;
         }
     }
 }
        private void OnMissionSuccessChanceChanged(int chance)
        {
            if (this.m_garrMissionID == 0)
            {
                return;
            }
            if (!base.gameObject.activeSelf)
            {
                return;
            }
            this.m_bonusLootDisplay.SetActive(false);
            if (chance <= -1000)
            {
                this.missionPercentChanceText.text = "%";
                this.m_missionChanceSpinner.SetActive(true);
            }
            else
            {
                this.missionPercentChanceText.text = chance + "%";
                this.m_missionChanceSpinner.SetActive(false);
            }
            this.m_lootBorderNormal.SetActive(chance < 100);
            this.m_lootBorderLitUp.SetActive(chance >= 100);
            GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(this.m_garrMissionID);

            if (record == null)
            {
                Debug.LogError("Invalid Mission ID:" + this.m_garrMissionID);
                return;
            }
            if (StaticDB.rewardPackDB.GetRecord(record.OvermaxRewardPackID) == null)
            {
                return;
            }
            if (PersistentMissionData.missionDictionary.ContainsKey(this.m_garrMissionID))
            {
                WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[this.m_garrMissionID];
                if (record.OvermaxRewardPackID > 0 && wrapperGarrisonMission.OvermaxRewards.Count > 0)
                {
                    this.m_bonusLootDisplay.SetActive(true);
                    this.m_bonusLootChanceText.text = "<color=#ff9600ff>" + Mathf.Max(0, chance - 100) + "%</color>";
                    this.m_bonusLootChance          = Mathf.Max(0, chance - 100);
                }
            }
        }
Exemplo n.º 10
0
        public void OnMissionStatusChanged()
        {
            this.PopulateCompletedMissionList();
            this.CollectFirstCompletedMission();
            int num = 0;

            MissionListItem[]      componentsInChildren  = this.completedMissionListContents.GetComponentsInChildren <MissionListItem>(true);
            MissionRewardDisplay[] componentsInChildren2 = this.missionRewardsIconArea.transform.GetComponentsInChildren <MissionRewardDisplay>(true);
            for (int i = 0; i < componentsInChildren2.Length; i++)
            {
                Object.Destroy(componentsInChildren2[i].gameObject);
            }
            for (int j = 0; j < componentsInChildren.Length; j++)
            {
                WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[componentsInChildren[j].garrMissionID];
                if (PersistentMissionData.missionDictionary.ContainsKey(componentsInChildren[j].garrMissionID) && wrapperGarrisonMission.MissionState == 6)
                {
                    componentsInChildren[j].inProgressDarkener.SetActive(true);
                    componentsInChildren[j].missionResultsText.gameObject.SetActive(true);
                    if (this.GetRequestedMissionCollectionDictionary().ContainsKey(componentsInChildren[j].garrMissionID))
                    {
                        componentsInChildren[j].missionResultsText.text = "<color=#00ff00ff>SUCCEEDED!</color>";
                        MissionRewardDisplay[] componentsInChildren3 = componentsInChildren[j].missionRewardGroup.GetComponentsInChildren <MissionRewardDisplay>(true);
                        for (int k = 0; k < componentsInChildren3.Length; k++)
                        {
                            GameObject gameObject = Object.Instantiate <GameObject>(this.missionRewardResultsDisplayPrefab);
                            gameObject.transform.SetParent(this.missionRewardsIconArea.transform, false);
                        }
                    }
                    else
                    {
                        componentsInChildren[j].missionResultsText.text = "<color=#ff0000ff>FAILED</color>";
                    }
                }
                else
                {
                    num++;
                }
                if (num == 0)
                {
                    this.okButton.SetActive(true);
                }
            }
        }
        private void OnMissionSuccessChanceChanged(int chance)
        {
            if (this.m_garrMissionID == 0)
            {
                return;
            }
            if (!base.gameObject.activeSelf)
            {
                return;
            }
            this.m_bonusLootDisplay.SetActive(false);
            if (chance > -1000)
            {
                this.missionPercentChanceText.text = string.Concat(chance, "%");
                this.m_missionChanceSpinner.SetActive(false);
            }
            else
            {
                this.missionPercentChanceText.text = "%";
                this.m_missionChanceSpinner.SetActive(true);
            }
            GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(this.m_garrMissionID);

            if (record == null)
            {
                Debug.LogError(string.Concat("Invalid Mission ID:", this.m_garrMissionID));
                return;
            }
            if (StaticDB.rewardPackDB.GetRecord(record.OvermaxRewardPackID) == null)
            {
                return;
            }
            if (PersistentMissionData.missionDictionary.ContainsKey(this.m_garrMissionID))
            {
                WrapperGarrisonMission item = PersistentMissionData.missionDictionary[this.m_garrMissionID];
                if (record.OvermaxRewardPackID > 0 && item.OvermaxRewards.Count > 0)
                {
                    this.m_bonusLootDisplay.SetActive(true);
                    this.m_bonusLootChanceText.text = string.Concat("<color=#ff9600ff>", Mathf.Max(0, chance - 100), "%</color>");
                    this.m_bonusLootChance          = Mathf.Max(0, chance - 100);
                }
            }
        }
Exemplo n.º 12
0
        private void CollectFirstCompletedMission()
        {
            MissionListItem[] componentsInChildren = this.completedMissionListContents.GetComponentsInChildren <MissionListItem>(true);
            int num = 0;

            while (num < (int)componentsInChildren.Length)
            {
                WrapperGarrisonMission item = PersistentMissionData.missionDictionary[componentsInChildren[num].garrMissionID];
                if (this.GetRequestedMissionCollectionDictionary().ContainsKey(componentsInChildren[num].garrMissionID) || !PersistentMissionData.missionDictionary.ContainsKey(componentsInChildren[num].garrMissionID) || item.MissionState != 2)
                {
                    num++;
                }
                else
                {
                    this.GetRequestedMissionCollectionDictionary().Add(componentsInChildren[num].garrMissionID, true);
                    Main.instance.ClaimMissionBonus(componentsInChildren[num].garrMissionID);
                    break;
                }
            }
        }
 public void ZoomToNextCompleteMission()
 {
     this.m_miniMissionListPanel.InitMissionList();
     MiniMissionListItem[] componentsInChildren = this.m_miniMissionListPanel.m_inProgressMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
     foreach (MiniMissionListItem miniMissionListItem in componentsInChildren)
     {
         if (PersistentMissionData.missionDictionary.ContainsKey(miniMissionListItem.GetMissionID()))
         {
             WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[miniMissionListItem.GetMissionID()];
             if (wrapperGarrisonMission.MissionState == 1)
             {
                 TimeSpan t = GarrisonStatus.CurrentTime() - wrapperGarrisonMission.StartTime;
                 if ((wrapperGarrisonMission.MissionDuration - t).TotalSeconds <= 0.0)
                 {
                     AdventureMapPanel.instance.ShowMissionResultAction(wrapperGarrisonMission.MissionRecID, 0, false);
                     break;
                 }
             }
         }
     }
 }
		public void ZoomToNextCompleteMission()
		{
			this.m_miniMissionListPanel.InitMissionList();
			MiniMissionListItem[] componentsInChildren = this.m_miniMissionListPanel.m_inProgressMission_listContents.GetComponentsInChildren<MiniMissionListItem>(true);
			for (int i = 0; i < (int)componentsInChildren.Length; i++)
			{
				MiniMissionListItem miniMissionListItem = componentsInChildren[i];
				if (PersistentMissionData.missionDictionary.ContainsKey(miniMissionListItem.GetMissionID()))
				{
					WrapperGarrisonMission item = PersistentMissionData.missionDictionary[miniMissionListItem.GetMissionID()];
					if (item.MissionState == 1)
					{
						TimeSpan timeSpan = GarrisonStatus.CurrentTime() - item.StartTime;
						if ((item.MissionDuration - timeSpan).TotalSeconds <= 0)
						{
							AdventureMapPanel.instance.ShowMissionResultAction(item.MissionRecID, 0, false);
							break;
						}
					}
				}
			}
		}
        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);
        }
Exemplo n.º 16
0
        public void Init(int missionRecID)
        {
            this.garrMissionID = missionRecID;
            GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(this.garrMissionID);

            if (record == null)
            {
                return;
            }
            if (!PersistentMissionData.missionDictionary.ContainsKey(this.garrMissionID))
            {
                return;
            }
            this.missionDurationInSeconds = TimeSpan.FromSeconds((double)record.MissionDuration);
            WrapperGarrisonMission item = PersistentMissionData.missionDictionary[this.garrMissionID];

            this.missionStartedTime = item.StartTime;
            Duration duration  = new Duration(record.MissionDuration, false);
            string   str       = (duration.Hours < 2 ? "<color=#ffffffff>" : "<color=#ff8600ff>");
            TimeSpan timeSpan  = GarrisonStatus.CurrentTime() - this.missionStartedTime;
            TimeSpan timeSpan1 = this.missionDurationInSeconds - timeSpan;

            timeSpan1 = (timeSpan1.TotalSeconds <= 0 ? TimeSpan.Zero : timeSpan1);
            bool flag = (item.MissionState != 1 ? false : timeSpan1.TotalSeconds > 0);

            this.missionNameText.text  = string.Concat(record.Name, (!flag ? string.Concat(" (", str, duration.DurationString, "</color>)") : string.Empty));
            this.missionLevelText.text = string.Concat(string.Empty, record.TargetLevel);
            this.inProgressDarkener.SetActive(flag);
            this.missionTimeRemainingText.gameObject.SetActive(flag);
            this.missionDurationInSeconds = TimeSpan.FromSeconds((double)record.MissionDuration);
            this.missionResultsText.gameObject.SetActive(false);
            this.isResultsItem = false;
            MissionRewardDisplay.InitMissionRewards(this.missionRewardDisplayPrefab, this.missionRewardGroup.transform, item.Rewards);
            for (int i = 0; i < (int)this.locationImages.Length; i++)
            {
                if (this.locationImages[i] != null)
                {
                    this.locationImages[i].gameObject.SetActive(false);
                }
            }
            Image image          = null;
            uint  uiTextureKitID = record.UiTextureKitID;

            switch (uiTextureKitID)
            {
            case 101:
            {
                image = this.locationImages[1];
                this.locationIndex = 1;
                break;
            }

            case 102:
            {
                image = this.locationImages[10];
                this.locationIndex = 10;
                break;
            }

            case 103:
            {
                image = this.locationImages[3];
                this.locationIndex = 3;
                break;
            }

            case 104:
            {
                image = this.locationImages[4];
                this.locationIndex = 4;
                break;
            }

            case 105:
            {
                image = this.locationImages[9];
                this.locationIndex = 9;
                break;
            }

            case 106:
            {
                image = this.locationImages[7];
                this.locationIndex = 7;
                break;
            }

            case 107:
            {
                image = this.locationImages[8];
                this.locationIndex = 8;
                break;
            }

            default:
            {
                switch (uiTextureKitID)
                {
                case 203:
                {
                    image = this.locationImages[2];
                    this.locationIndex = 2;
                    break;
                }

                case 204:
                {
                    image = this.locationImages[6];
                    this.locationIndex = 6;
                    break;
                }

                case 205:
                {
                    image = this.locationImages[5];
                    this.locationIndex = 5;
                    break;
                }

                default:
                {
                    if (uiTextureKitID == 164)
                    {
                        image = this.locationImages[0];
                        this.locationIndex = 0;
                    }
                    else if (uiTextureKitID == 165)
                    {
                        image = this.locationImages[11];
                        this.locationIndex = 11;
                    }
                    else
                    {
                        this.locationIndex = 0;
                    }
                    break;
                }
                }
                break;
            }
            }
            if (image != null)
            {
                image.gameObject.SetActive(true);
            }
            GarrMissionTypeRec garrMissionTypeRec = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID);

            this.m_missionTypeImage.overrideSprite = TextureAtlas.instance.GetAtlasSprite((int)garrMissionTypeRec.UiTextureAtlasMemberID);
            if ((record.Flags & 1) == 0)
            {
                this.rareMissionText.gameObject.SetActive(false);
            }
            else
            {
                this.rareMissionText.gameObject.SetActive(true);
                Color color = this.levelBG.color;
                color.r            = 0f;
                color.g            = 0.211f;
                color.b            = 0.506f;
                this.levelBG.color = color;
            }
        }
Exemplo n.º 17
0
        public void InitMissionList()
        {
            this.m_combatAllyListItem.gameObject.SetActive(false);
            MiniMissionListItem[] componentsInChildren = this.m_availableMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
            for (int i = 0; i < (int)componentsInChildren.Length; i++)
            {
                MiniMissionListItem miniMissionListItem = componentsInChildren[i];
                bool flag = true;
                if (PersistentMissionData.missionDictionary.ContainsKey(miniMissionListItem.GetMissionID()))
                {
                    WrapperGarrisonMission item = PersistentMissionData.missionDictionary[miniMissionListItem.GetMissionID()];
                    if (item.MissionState == 0)
                    {
                        flag = false;
                        miniMissionListItem.UpdateMechanicPreview(false, item);
                    }
                }
                if (flag)
                {
                    miniMissionListItem.gameObject.transform.SetParent(null);
                    UnityEngine.Object.Destroy(miniMissionListItem.gameObject);
                }
            }
            MiniMissionListItem[] miniMissionListItemArray = this.m_inProgressMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
            for (int j = 0; j < (int)miniMissionListItemArray.Length; j++)
            {
                MiniMissionListItem miniMissionListItem1 = miniMissionListItemArray[j];
                bool flag1 = true;
                if (PersistentMissionData.missionDictionary.ContainsKey(miniMissionListItem1.GetMissionID()) && PersistentMissionData.missionDictionary[miniMissionListItem1.GetMissionID()].MissionState != 0)
                {
                    flag1 = false;
                }
                if (flag1)
                {
                    miniMissionListItem1.gameObject.transform.SetParent(null);
                    UnityEngine.Object.Destroy(miniMissionListItem1.gameObject);
                }
            }
            MiniMissionListItem[] componentsInChildren1     = this.m_availableMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
            MiniMissionListItem[] miniMissionListItemArray1 = this.m_inProgressMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
            foreach (WrapperGarrisonMission value in PersistentMissionData.missionDictionary.Values)
            {
                bool flag2 = false;
                MiniMissionListItem[] miniMissionListItemArray2 = componentsInChildren1;
                int num = 0;
                while (num < (int)miniMissionListItemArray2.Length)
                {
                    if (miniMissionListItemArray2[num].GetMissionID() != value.MissionRecID)
                    {
                        num++;
                    }
                    else
                    {
                        flag2 = true;
                        break;
                    }
                }
                if (!flag2)
                {
                    MiniMissionListItem[] miniMissionListItemArray3 = miniMissionListItemArray1;
                    int num1 = 0;
                    while (num1 < (int)miniMissionListItemArray3.Length)
                    {
                        if (miniMissionListItemArray3[num1].GetMissionID() != value.MissionRecID)
                        {
                            num1++;
                        }
                        else
                        {
                            flag2 = true;
                            break;
                        }
                    }
                }
                if (!flag2)
                {
                    GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(value.MissionRecID);
                    if (record == null)
                    {
                        Debug.LogWarning(string.Concat("Mission Not Found: ID ", value.MissionRecID));
                    }
                    else if (record.GarrFollowerTypeID == (uint)GarrisonStatus.GarrisonFollowerType)
                    {
                        if ((record.Flags & 16) == 0)
                        {
                            MiniMissionListItem miniMissionListItem2 = UnityEngine.Object.Instantiate <MiniMissionListItem>(this.m_miniMissionListItemPrefab);
                            if (value.MissionState != 0)
                            {
                                miniMissionListItem2.transform.SetParent(this.m_inProgressMission_listContents.transform, false);
                                this.ShowMissionStartedAnim();
                            }
                            else
                            {
                                miniMissionListItem2.transform.SetParent(this.m_availableMission_listContents.transform, false);
                            }
                            miniMissionListItem2.SetMission(value);
                        }
                        else
                        {
                            this.m_combatAllyListItem.gameObject.SetActive(true);
                            this.m_combatAllyListItem.UpdateVisuals();
                        }
                    }
                }
            }
            int num2 = 0;
            int num3 = 0;

            PersistentMissionData.GetAvailableAndProgressCounts(ref num3, ref num2);
            this.m_availableMissionsTabLabel.text  = string.Concat(StaticDB.GetString("AVAILABLE", null), " - ", num3);
            this.m_inProgressMissionsTabLabel.text = string.Concat(StaticDB.GetString("IN_PROGRESS", null), " - ", num2);
            this.m_noMissionsAvailableLabel.gameObject.SetActive(num3 == 0);
            this.m_noMissionsInProgressLabel.gameObject.SetActive(num2 == 0);
        }
        public void InitMissionList()
        {
            this.m_combatAllyListItem.gameObject.SetActive(false);
            MiniMissionListItem[] componentsInChildren = this.m_availableMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
            foreach (MiniMissionListItem miniMissionListItem in componentsInChildren)
            {
                bool flag = true;
                if (PersistentMissionData.missionDictionary.ContainsKey(miniMissionListItem.GetMissionID()))
                {
                    WrapperGarrisonMission mission = PersistentMissionData.missionDictionary[miniMissionListItem.GetMissionID()];
                    if (mission.MissionState == 0)
                    {
                        flag = false;
                        miniMissionListItem.UpdateMechanicPreview(false, mission);
                    }
                }
                if (flag)
                {
                    miniMissionListItem.gameObject.transform.SetParent(null);
                    Object.Destroy(miniMissionListItem.gameObject);
                }
            }
            componentsInChildren = this.m_inProgressMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
            foreach (MiniMissionListItem miniMissionListItem2 in componentsInChildren)
            {
                bool flag2 = true;
                if (PersistentMissionData.missionDictionary.ContainsKey(miniMissionListItem2.GetMissionID()) && PersistentMissionData.missionDictionary[miniMissionListItem2.GetMissionID()].MissionState != 0)
                {
                    flag2 = false;
                }
                if (flag2)
                {
                    miniMissionListItem2.gameObject.transform.SetParent(null);
                    Object.Destroy(miniMissionListItem2.gameObject);
                }
            }
            MiniMissionListItem[] componentsInChildren2 = this.m_availableMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
            MiniMissionListItem[] componentsInChildren3 = this.m_inProgressMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
            foreach (WrapperGarrisonMission mission2 in PersistentMissionData.missionDictionary.Values)
            {
                bool flag3 = false;
                foreach (MiniMissionListItem miniMissionListItem3 in componentsInChildren2)
                {
                    if (miniMissionListItem3.GetMissionID() == mission2.MissionRecID)
                    {
                        flag3 = true;
                        break;
                    }
                }
                if (!flag3)
                {
                    foreach (MiniMissionListItem miniMissionListItem4 in componentsInChildren3)
                    {
                        if (miniMissionListItem4.GetMissionID() == mission2.MissionRecID)
                        {
                            flag3 = true;
                            break;
                        }
                    }
                }
                if (!flag3)
                {
                    GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(mission2.MissionRecID);
                    if (record == null)
                    {
                        Debug.LogWarning("Mission Not Found: ID " + mission2.MissionRecID);
                    }
                    else if ((GARR_FOLLOWER_TYPE)record.GarrFollowerTypeID == GarrisonStatus.GarrisonFollowerType)
                    {
                        if ((record.Flags & 16u) != 0u)
                        {
                            this.m_combatAllyListItem.gameObject.SetActive(true);
                            this.m_combatAllyListItem.UpdateVisuals();
                        }
                        else
                        {
                            MiniMissionListItem miniMissionListItem5 = Object.Instantiate <MiniMissionListItem>(this.m_miniMissionListItemPrefab);
                            if (mission2.MissionState == 0)
                            {
                                miniMissionListItem5.transform.SetParent(this.m_availableMission_listContents.transform, false);
                            }
                            else
                            {
                                miniMissionListItem5.transform.SetParent(this.m_inProgressMission_listContents.transform, false);
                                this.ShowMissionStartedAnim();
                            }
                            miniMissionListItem5.SetMission(mission2);
                        }
                    }
                }
            }
            int num  = 0;
            int num2 = 0;

            PersistentMissionData.GetAvailableAndProgressCounts(ref num2, ref num);
            this.m_availableMissionsTabLabel.text  = StaticDB.GetString("AVAILABLE", null) + " - " + num2;
            this.m_inProgressMissionsTabLabel.text = StaticDB.GetString("IN_PROGRESS", null) + " - " + num;
            this.m_noMissionsAvailableLabel.gameObject.SetActive(num2 == 0);
            this.m_noMissionsInProgressLabel.gameObject.SetActive(num == 0);
        }
Exemplo n.º 19
0
 public static void UpdateMission(WrapperGarrisonMission mission)
 {
     PersistentMissionData.instance.m_missionDictionary.Remove(mission.MissionRecID);
     PersistentMissionData.AddMission(mission);
 }
        public void SetAvailabilityStatus(WrapperGarrisonFollower follower)
        {
            GarrMissionRec record;
            int            num;

            this.m_isCombatAlly = false;
            if (follower.CurrentMissionID != 0)
            {
                WrapperGarrisonMission item = PersistentMissionData.missionDictionary[follower.CurrentMissionID];
                this.m_missionStartedTime = item.StartTime;
                this.m_missionDuration    = item.MissionDuration;
            }
            bool flags = (follower.Flags & 4) != 0;
            bool flag  = (follower.Flags & 2) != 0;

            this.m_onMission = follower.CurrentMissionID != 0;
            bool currentBuildingID = follower.CurrentBuildingID != 0;
            bool flags1            = (follower.Flags & 8) != 0;

            if (!this.m_onMission)
            {
                record = null;
            }
            else
            {
                record = StaticDB.garrMissionDB.GetRecord(follower.CurrentMissionID);
            }
            GarrMissionRec garrMissionRec = record;

            if (garrMissionRec != null && (garrMissionRec.Flags & 16) != 0)
            {
                this.m_isCombatAlly = true;
            }
            this.m_statusText.gameObject.SetActive(true);
            this.darkeningImage.gameObject.SetActive(true);
            this.m_statusText.color = Color.white;
            this.m_troopHeartContainer.SetActive(false);
            if (flags)
            {
                this.m_statusText.color = Color.red;
                if (follower.FollowerLevel != 110)
                {
                    this.m_statusText.text = FollowerListItem.m_inactiveString;
                }
            }
            else if (flag)
            {
                this.m_statusText.text = FollowerListItem.m_fatiguedString;
            }
            else if (this.m_isCombatAlly)
            {
                this.m_statusText.text = FollowerListItem.m_combatAllyString;
            }
            else if (this.m_onMission)
            {
                this.m_statusText.text = FollowerListItem.m_onMissionString;
            }
            else if (currentBuildingID)
            {
                this.m_statusText.text = FollowerListItem.m_inBuildingString;
            }
            else if (!this.m_inParty)
            {
                GarrFollowerRec garrFollowerRec = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);
                num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? (int)garrFollowerRec.AllianceGarrClassSpecID : (int)garrFollowerRec.HordeGarrClassSpecID);
                GarrClassSpecRec garrClassSpecRec = StaticDB.garrClassSpecDB.GetRecord(num);
                if (flags1)
                {
                    this.m_statusText.text = string.Empty;
                    this.m_statusText.gameObject.SetActive(false);
                    this.m_troopHeartContainer.SetActive(true);
                }
                else
                {
                    this.m_statusText.text = garrClassSpecRec.ClassSpec;
                }
                this.darkeningImage.gameObject.SetActive(false);
            }
            else
            {
                this.m_statusText.text = FollowerListItem.m_inPartyString;
            }
            this.m_availableForMission = (flags || flag || this.m_onMission ? 1 : (int)currentBuildingID) == 0;
        }
Exemplo n.º 21
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);
        }
Exemplo n.º 22
0
        public static int[] GetBuffsForCurrentMission(int garrFollowerID, int garrMissionID, GameObject missionFollowerSlotGroup, int missionDuration)
        {
            HashSet <int> hashSet = new HashSet <int>();

            if (!PersistentFollowerData.followerDictionary.ContainsKey(garrFollowerID))
            {
                return(hashSet.ToArray <int>());
            }
            WrapperGarrisonFollower wrapperGarrisonFollower = PersistentFollowerData.followerDictionary[garrFollowerID];

            for (int i = 0; i < wrapperGarrisonFollower.AbilityIDs.Count; i++)
            {
                GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(wrapperGarrisonFollower.AbilityIDs[i]);
                if (record == null)
                {
                    Debug.Log(string.Concat(new object[]
                    {
                        "Invalid Ability ID ",
                        wrapperGarrisonFollower.AbilityIDs[i],
                        " from follower ",
                        wrapperGarrisonFollower.GarrFollowerID
                    }));
                }
                else
                {
                    foreach (GarrAbilityEffectRec garrAbilityEffectRec in StaticDB.garrAbilityEffectDB.GetRecordsByParentID(record.ID))
                    {
                        if ((garrAbilityEffectRec.Flags & 1) == 0)
                        {
                            bool flag          = false;
                            byte abilityAction = garrAbilityEffectRec.AbilityAction;
                            switch (abilityAction)
                            {
                            case 0:
                                break;

                            case 1:
                            {
                                MissionFollowerSlot[] componentsInChildren = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
                                int num = 0;
                                foreach (MissionFollowerSlot missionFollowerSlot in componentsInChildren)
                                {
                                    if (missionFollowerSlot.GetCurrentGarrFollowerID() > 0)
                                    {
                                        num++;
                                    }
                                }
                                flag = (num == 1);
                                break;
                            }

                            case 2:
                            case 17:
                            case 21:
                                flag = true;
                                break;

                            default:
                                if (abilityAction != 37)
                                {
                                }
                                break;

                            case 5:
                            {
                                MissionFollowerSlot[] componentsInChildren2 = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
                                bool flag2 = false;
                                foreach (MissionFollowerSlot missionFollowerSlot2 in componentsInChildren2)
                                {
                                    int currentGarrFollowerID = missionFollowerSlot2.GetCurrentGarrFollowerID();
                                    if (currentGarrFollowerID > 0 && currentGarrFollowerID != wrapperGarrisonFollower.GarrFollowerID)
                                    {
                                        GarrFollowerRec record2 = StaticDB.garrFollowerDB.GetRecord(currentGarrFollowerID);
                                        if (record2 != null)
                                        {
                                            uint num2 = (uint)((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record2.HordeGarrFollRaceID : record2.AllianceGarrFollRaceID);
                                            if (num2 == (uint)garrAbilityEffectRec.ActionRace)
                                            {
                                                flag2 = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                flag = flag2;
                                break;
                            }

                            case 6:
                                flag = ((float)missionDuration >= (float)garrAbilityEffectRec.ActionHours * 3600f);
                                break;

                            case 7:
                                flag = ((float)missionDuration <= (float)garrAbilityEffectRec.ActionHours * 3600f);
                                break;

                            case 9:
                            {
                                GarrMissionRec record3 = StaticDB.garrMissionDB.GetRecord(garrMissionID);
                                flag = (record3 != null && (float)record3.TravelDuration >= (float)garrAbilityEffectRec.ActionHours * 3600f);
                                break;
                            }

                            case 10:
                            {
                                GarrMissionRec record4 = StaticDB.garrMissionDB.GetRecord(garrMissionID);
                                flag = (record4 != null && (float)record4.TravelDuration <= (float)garrAbilityEffectRec.ActionHours * 3600f);
                                break;
                            }

                            case 12:
                                break;

                            case 22:
                            {
                                MissionFollowerSlot[] componentsInChildren3 = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
                                bool flag3 = false;
                                foreach (MissionFollowerSlot missionFollowerSlot3 in componentsInChildren3)
                                {
                                    int currentGarrFollowerID2 = missionFollowerSlot3.GetCurrentGarrFollowerID();
                                    if (currentGarrFollowerID2 > 0 && currentGarrFollowerID2 != wrapperGarrisonFollower.GarrFollowerID)
                                    {
                                        GarrFollowerRec record5 = StaticDB.garrFollowerDB.GetRecord(currentGarrFollowerID2);
                                        if (record5 != null)
                                        {
                                            uint num3 = (uint)((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record5.HordeGarrClassSpecID : record5.AllianceGarrClassSpecID);
                                            if ((ulong)num3 == (ulong)((long)garrAbilityEffectRec.ActionRecordID))
                                            {
                                                flag3 = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                flag = flag3;
                                break;
                            }

                            case 23:
                            {
                                bool flag4 = false;
                                if (PersistentMissionData.missionDictionary.ContainsKey(garrMissionID))
                                {
                                    WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[garrMissionID];
                                    for (int m = 0; m < wrapperGarrisonMission.Encounters.Count; m++)
                                    {
                                        for (int n = 0; n < wrapperGarrisonMission.Encounters[m].MechanicIDs.Count; n++)
                                        {
                                            GarrMechanicRec record6 = StaticDB.garrMechanicDB.GetRecord(wrapperGarrisonMission.Encounters[m].MechanicIDs[n]);
                                            if (record6 != null && garrAbilityEffectRec.GarrMechanicTypeID == record6.GarrMechanicTypeID)
                                            {
                                                flag4 = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                flag = flag4;
                                break;
                            }

                            case 26:
                            {
                                MissionFollowerSlot[] componentsInChildren4 = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
                                bool flag5 = false;
                                foreach (MissionFollowerSlot missionFollowerSlot4 in componentsInChildren4)
                                {
                                    int currentGarrFollowerID3 = missionFollowerSlot4.GetCurrentGarrFollowerID();
                                    if (currentGarrFollowerID3 > 0 && currentGarrFollowerID3 != wrapperGarrisonFollower.GarrFollowerID && garrAbilityEffectRec.ActionRecordID == currentGarrFollowerID3)
                                    {
                                        flag5 = true;
                                        break;
                                    }
                                }
                                flag = flag5;
                                break;
                            }
                            }
                            if (flag)
                            {
                                hashSet.Add(record.ID);
                            }
                        }
                    }
                }
            }
            return(hashSet.ToArray <int>());
        }
Exemplo n.º 23
0
        public void UpdateMechanicPreview(bool missionInProgress, WrapperGarrisonMission mission)
        {
            int num = 0;

            if (!missionInProgress)
            {
                for (int i = 0; i < mission.Encounters.Count; i++)
                {
                    int             id     = (mission.Encounters[i].MechanicIDs.Count <= 0) ? 0 : mission.Encounters[i].MechanicIDs[0];
                    GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(id);
                    if (record != null && record.GarrAbilityID != 0)
                    {
                        this.m_previewAbilityID[num]        = record.GarrAbilityID;
                        this.m_previewCanCounterStatus[num] = GeneralHelpers.HasFollowerWhoCanCounter((int)record.GarrMechanicTypeID);
                        num++;
                    }
                }
                bool             flag = true;
                AbilityDisplay[] componentsInChildren = this.m_previewMechanicsGroup.GetComponentsInChildren <AbilityDisplay>(true);
                if (num != componentsInChildren.Length)
                {
                    flag = false;
                }
                if (flag)
                {
                    for (int j = 0; j < componentsInChildren.Length; j++)
                    {
                        if (componentsInChildren[j] == null)
                        {
                            flag = false;
                            break;
                        }
                        if (componentsInChildren[j].GetAbilityID() != this.m_previewAbilityID[j])
                        {
                            flag = false;
                            break;
                        }
                        if (componentsInChildren[j].GetCanCounterStatus() != this.m_previewCanCounterStatus[j])
                        {
                            flag = false;
                            break;
                        }
                    }
                }
                if (!flag)
                {
                    for (int k = 0; k < componentsInChildren.Length; k++)
                    {
                        if (componentsInChildren[k] != null)
                        {
                            componentsInChildren[k].gameObject.transform.SetParent(null);
                            Object.Destroy(componentsInChildren[k].gameObject);
                        }
                    }
                    for (int l = 0; l < num; l++)
                    {
                        GameObject gameObject = Object.Instantiate <GameObject>(this.m_previewMechanicEffectPrefab);
                        gameObject.transform.SetParent(this.m_previewMechanicsGroup.transform, false);
                        AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>();
                        component.SetAbility(this.m_previewAbilityID[l], false, false, null);
                        component.SetCanCounterStatus(this.m_previewCanCounterStatus[l]);
                    }
                }
            }
        }
        public bool ShouldShowCompletedMission()
        {
            WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[this.m_garrMissionID];

            return(wrapperGarrisonMission.MissionState == 2 || wrapperGarrisonMission.MissionState == 3 || (wrapperGarrisonMission.MissionState == 1 && GarrisonStatus.CurrentTime() - this.m_missionStartedTime >= this.m_missionDuration));
        }
Exemplo n.º 25
0
        public void SetAvailabilityStatus(WrapperGarrisonFollower follower)
        {
            this.m_isCombatAlly = false;
            if (follower.CurrentMissionID != 0)
            {
                WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[follower.CurrentMissionID];
                this.m_missionStartedTime = wrapperGarrisonMission.StartTime;
                this.m_missionDuration    = wrapperGarrisonMission.MissionDuration;
            }
            bool flag  = (follower.Flags & 4) != 0;
            bool flag2 = (follower.Flags & 2) != 0;

            this.m_onMission = (follower.CurrentMissionID != 0);
            bool           flag3          = follower.CurrentBuildingID != 0;
            bool           flag4          = (follower.Flags & 8) != 0;
            GarrMissionRec garrMissionRec = (!this.m_onMission) ? null : StaticDB.garrMissionDB.GetRecord(follower.CurrentMissionID);

            if (garrMissionRec != null && (garrMissionRec.Flags & 16u) != 0u)
            {
                this.m_isCombatAlly = true;
            }
            this.m_statusText.gameObject.SetActive(true);
            this.darkeningImage.gameObject.SetActive(true);
            this.m_statusText.color = Color.white;
            this.m_troopHeartContainer.SetActive(false);
            if (flag)
            {
                this.m_statusText.color = Color.red;
                if (follower.FollowerLevel != 110)
                {
                    this.m_statusText.text = FollowerListItem.m_inactiveString;
                }
            }
            else if (flag2)
            {
                this.m_statusText.text = FollowerListItem.m_fatiguedString;
            }
            else if (this.m_isCombatAlly)
            {
                this.m_statusText.text = FollowerListItem.m_combatAllyString;
            }
            else if (this.m_onMission)
            {
                this.m_statusText.text = FollowerListItem.m_onMissionString;
            }
            else if (flag3)
            {
                this.m_statusText.text = FollowerListItem.m_inBuildingString;
            }
            else if (this.m_inParty)
            {
                this.m_statusText.text = FollowerListItem.m_inPartyString;
            }
            else
            {
                GarrFollowerRec  record  = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);
                int              key     = (int)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID);
                GarrClassSpecRec record2 = StaticDB.garrClassSpecDB.GetRecord(key);
                if (!flag4)
                {
                    this.m_statusText.text = record2.ClassSpec;
                }
                else
                {
                    this.m_statusText.text = string.Empty;
                    this.m_statusText.gameObject.SetActive(false);
                    this.m_troopHeartContainer.SetActive(true);
                }
                this.darkeningImage.gameObject.SetActive(false);
            }
            this.m_availableForMission = (!flag && !flag2 && !this.m_onMission && !flag3);
        }
Exemplo n.º 26
0
        public void SetMission(WrapperGarrisonMission mission)
        {
            this.m_statusDarkener.gameObject.SetActive(false);
            this.m_statusText.gameObject.SetActive(false);
            this.m_mission = mission;
            GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(mission.MissionRecID);

            if (record == null)
            {
                return;
            }
            if (this.m_missionTypeIcon != null)
            {
                GarrMissionTypeRec record2 = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID);
                this.m_missionTypeIcon.sprite = TextureAtlas.instance.GetAtlasSprite((int)record2.UiTextureAtlasMemberID);
            }
            bool flag = false;

            if (mission.MissionState == 1)
            {
                flag = true;
                this.m_statusDarkener.gameObject.SetActive(true);
                this.m_statusDarkener.color = new Color(0f, 0f, 0f, 0.3529412f);
                this.m_statusText.gameObject.SetActive(true);
                this.m_missionTime.gameObject.SetActive(false);
            }
            this.m_previewMechanicsGroup.SetActive(!flag);
            int      uncounteredMissionDuration = this.GetUncounteredMissionDuration(mission);
            Duration duration = new Duration(uncounteredMissionDuration, false);
            string   str;

            if (duration.DurationValue >= 28800)
            {
                str = "<color=#ff8600ff>" + duration.DurationString + "</color>";
            }
            else
            {
                str = "<color=#BEBEBEFF>" + duration.DurationString + "</color>";
            }
            this.m_missionTime.text = "(" + str + ")";
            this.m_missionName.text = record.Name;
            if (this.m_missionLevel != null)
            {
                if (record.TargetLevel < 110)
                {
                    this.m_missionLevel.text = string.Empty + record.TargetLevel;
                }
                else
                {
                    this.m_missionLevel.text = string.Concat(new object[]
                    {
                        string.Empty,
                        record.TargetLevel,
                        "\n(",
                        record.TargetItemLevel,
                        ")"
                    });
                }
            }
            bool flag2 = (record.Flags & 1u) != 0u;

            this.m_expirationText.gameObject.SetActive(flag2);
            this.m_rareMissionLabel.gameObject.SetActive(flag2);
            this.m_rareMissionHighlight.gameObject.SetActive(flag2);
            if (flag2)
            {
                this.m_missionTypeBG.color = new Color(0f, 0f, 1f, 0.24f);
            }
            else
            {
                this.m_missionTypeBG.color = new Color(0f, 0f, 0f, 0.478f);
            }
            this.m_missionLocation.enabled = false;
            UiTextureKitRec record3 = StaticDB.uiTextureKitDB.GetRecord((int)record.UiTextureKitID);

            if (record3 != null)
            {
                int uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID(record3.KitPrefix + "-List");
                if (uitextureAtlasMemberID > 0)
                {
                    Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite(uitextureAtlasMemberID);
                    if (atlasSprite != null)
                    {
                        this.m_missionLocation.enabled = true;
                        this.m_missionLocation.sprite  = atlasSprite;
                    }
                }
            }
            this.UpdateMechanicPreview(flag, mission);
            MissionRewardDisplay[] componentsInChildren = this.m_previewLootGroup.GetComponentsInChildren <MissionRewardDisplay>(true);
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                if (componentsInChildren[i] != null)
                {
                    componentsInChildren[i].gameObject.transform.SetParent(null);
                    Object.Destroy(componentsInChildren[i].gameObject);
                }
            }
            MissionRewardDisplay.InitMissionRewards(this.m_missionRewardDisplayPrefab.gameObject, this.m_previewLootGroup.transform, mission.Rewards);
        }
        public void SetMission(WrapperGarrisonMission mission)
        {
            this.m_statusText.gameObject.SetActive(false);
            this.m_mission = mission;
            GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(mission.MissionRecID);

            if (record == null)
            {
                return;
            }
            if (this.m_missionTypeIcon != null)
            {
                GarrMissionTypeRec garrMissionTypeRec = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID);
                if ((ulong)garrMissionTypeRec.UiTextureAtlasMemberID == (long)this.m_starIconId)
                {
                    this.m_missionTypeIcon.sprite = this.m_starSprite;
                }
                if ((ulong)garrMissionTypeRec.UiTextureAtlasMemberID == (long)this.m_swordIconID)
                {
                    this.m_missionTypeIcon.sprite = this.m_swordSprite;
                }
                if ((ulong)garrMissionTypeRec.UiTextureAtlasMemberID == (long)this.m_bootIconId)
                {
                    this.m_missionTypeIcon.sprite = this.m_bootSprite;
                }
                if ((ulong)garrMissionTypeRec.UiTextureAtlasMemberID == (long)this.m_stealthIconId)
                {
                    this.m_missionTypeIcon.sprite = this.m_stealthSprite;
                }
                if ((ulong)garrMissionTypeRec.UiTextureAtlasMemberID == (long)this.m_scrollIconId)
                {
                    this.m_missionTypeIcon.sprite = this.m_scrollSprite;
                }
            }
            bool flag = false;

            if (mission.MissionState == 1)
            {
                flag = true;
                this.m_statusText.gameObject.SetActive(true);
                this.m_missionTime.gameObject.SetActive(false);
            }
            this.m_previewMechanicsGroup.SetActive(!flag);
            Duration duration = new Duration(this.GetUncounteredMissionDuration(mission), false);
            string   str      = "123 Min";

            str = (duration.DurationValue < 28800 ? string.Concat("<color=#BEBEBEFF>", duration.DurationString, "</color>") : string.Concat("<color=#ff8600ff>", duration.DurationString, "</color>"));
            this.m_missionTime.text = string.Concat("(", str, ")");
            this.m_missionName.text = record.Name;
            if (this.m_missionLevel != null)
            {
                if (record.TargetLevel >= 110)
                {
                    this.m_missionLevel.text = string.Concat(new object[] { string.Empty, record.TargetLevel, "\n(", record.TargetItemLevel, ")" });
                }
                else
                {
                    this.m_missionLevel.text = string.Concat(string.Empty, record.TargetLevel);
                }
            }
            bool flags = (record.Flags & 1) != 0;

            this.m_rareMissionLabel.gameObject.SetActive(flags);
            if (!flags)
            {
                this.m_missionTypeBG.color = new Color(0f, 0f, 0f, 0.478f);
            }
            else
            {
                this.m_missionTypeBG.color = new Color(0f, 0f, 1f, 0.24f);
            }
            this.m_missionLocation.enabled = false;
            UiTextureKitRec uiTextureKitRec = StaticDB.uiTextureKitDB.GetRecord((int)record.UiTextureKitID);

            if (uiTextureKitRec != null)
            {
                int uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID(string.Concat(uiTextureKitRec.KitPrefix, "-List"));
                if (uITextureAtlasMemberID > 0)
                {
                    Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite(uITextureAtlasMemberID);
                    if (atlasSprite != null)
                    {
                        this.m_missionLocation.enabled = true;
                        this.m_missionLocation.sprite  = atlasSprite;
                    }
                }
            }
            this.UpdateMechanicPreview(flag, mission);
            MissionRewardDisplay[] componentsInChildren = this.m_previewLootGroup.GetComponentsInChildren <MissionRewardDisplay>(true);
            for (int i = 0; i < (int)componentsInChildren.Length; i++)
            {
                if (componentsInChildren[i] != null)
                {
                    UnityEngine.Object.Destroy(componentsInChildren[i].gameObject);
                }
            }
            MissionRewardDisplay.InitMissionRewards(this.m_missionRewardDisplayPrefab.gameObject, this.m_previewLootGroup.transform, mission.Rewards);
        }
Exemplo n.º 28
0
        public void SetAvailabilityStatus(WrapperGarrisonFollower follower)
        {
            this.m_isCombatAlly = false;
            if (follower.CurrentMissionID != 0)
            {
                WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[follower.CurrentMissionID];
                this.m_missionStartedTime = wrapperGarrisonMission.StartTime;
                this.m_missionDuration    = wrapperGarrisonMission.MissionDuration;
            }
            this.m_itemLevel = (follower.ItemLevelWeapon + follower.ItemLevelArmor) / 2;
            bool flag  = (follower.Flags & 4) != 0;
            bool flag2 = (follower.Flags & 2) != 0;

            this.m_onMission = (follower.CurrentMissionID != 0);
            bool           flag3          = follower.CurrentBuildingID != 0;
            bool           flag4          = (follower.Flags & 8) != 0;
            GarrMissionRec garrMissionRec = (!this.m_onMission) ? null : StaticDB.garrMissionDB.GetRecord(follower.CurrentMissionID);

            if (garrMissionRec != null && (garrMissionRec.Flags & 16u) != 0u)
            {
                this.m_isCombatAlly = true;
            }
            this.darkeningImage.gameObject.SetActive(true);
            this.darkeningImage.color = new Color(0f, 0f, 0.28f, 0.3f);
            this.m_statusText.color   = Color.white;
            this.m_troopHeartContainer.SetActive(false);
            if (flag)
            {
                this.m_statusText.color = Color.red;
                if (follower.FollowerLevel == 110)
                {
                    this.m_statusText.text = string.Concat(new object[]
                    {
                        FollowerListItem.m_iLvlString,
                        " ",
                        this.m_itemLevel,
                        " - ",
                        FollowerListItem.m_inactiveString
                    });
                }
                else
                {
                    this.m_statusText.text = FollowerListItem.m_inactiveString;
                }
                this.darkeningImage.color = new Color(0.28f, 0f, 0f, 0.196f);
            }
            else if (flag2)
            {
                this.m_statusText.text = string.Concat(new object[]
                {
                    FollowerListItem.m_iLvlString,
                    " ",
                    this.m_itemLevel,
                    " - ",
                    FollowerListItem.m_fatiguedString
                });
            }
            else if (this.m_isCombatAlly)
            {
                this.m_statusText.text = string.Concat(new object[]
                {
                    FollowerListItem.m_iLvlString,
                    " ",
                    this.m_itemLevel,
                    " - ",
                    FollowerListItem.m_combatAllyString
                });
            }
            else if (this.m_onMission)
            {
                this.m_statusText.text = string.Concat(new object[]
                {
                    FollowerListItem.m_iLvlString,
                    " ",
                    this.m_itemLevel,
                    " - ",
                    FollowerListItem.m_onMissionString
                });
            }
            else if (flag3)
            {
                this.m_statusText.text = string.Concat(new object[]
                {
                    FollowerListItem.m_iLvlString,
                    " ",
                    this.m_itemLevel,
                    " - ",
                    FollowerListItem.m_inBuildingString
                });
            }
            else if (this.m_inParty)
            {
                this.m_statusText.text    = FollowerListItem.m_inPartyString;
                this.darkeningImage.color = new Color(0.1f, 0.6f, 0.1f, 0.3f);
            }
            else
            {
                if (!flag4 && follower.FollowerLevel == 110)
                {
                    this.m_statusText.text = FollowerListItem.m_iLvlString + " " + this.m_itemLevel;
                }
                else
                {
                    this.m_statusText.text = string.Empty;
                }
                this.darkeningImage.gameObject.SetActive(false);
                this.m_troopHeartContainer.SetActive(true);
            }
            if (this.m_useArmamentsButtonText != null)
            {
                this.m_useArmamentsButtonText.text = FollowerListItem.m_iLvlString + " " + this.m_itemLevel;
            }
            this.m_availableForMission = (!flag && !flag2 && !this.m_onMission && !flag3);
        }
Exemplo n.º 29
0
        public void Init(int missionRecID)
        {
            this.garrMissionID = missionRecID;
            GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(this.garrMissionID);

            if (record == null)
            {
                return;
            }
            if (!PersistentMissionData.missionDictionary.ContainsKey(this.garrMissionID))
            {
                return;
            }
            this.missionDurationInSeconds = TimeSpan.FromSeconds((double)record.MissionDuration);
            WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[this.garrMissionID];

            this.missionStartedTime = wrapperGarrisonMission.StartTime;
            Duration duration = new Duration(record.MissionDuration, false);
            string   str      = (duration.Hours < 2) ? "<color=#ffffffff>" : "<color=#ff8600ff>";
            TimeSpan t        = GarrisonStatus.CurrentTime() - this.missionStartedTime;
            TimeSpan timeSpan = this.missionDurationInSeconds - t;

            timeSpan = ((timeSpan.TotalSeconds <= 0.0) ? TimeSpan.Zero : timeSpan);
            bool flag = wrapperGarrisonMission.MissionState == 1 && timeSpan.TotalSeconds > 0.0;

            this.missionNameText.text  = record.Name + ((!flag) ? (" (" + str + duration.DurationString + "</color>)") : string.Empty);
            this.missionLevelText.text = string.Empty + record.TargetLevel;
            this.inProgressDarkener.SetActive(flag);
            this.missionTimeRemainingText.gameObject.SetActive(flag);
            this.missionDurationInSeconds = TimeSpan.FromSeconds((double)record.MissionDuration);
            this.missionResultsText.gameObject.SetActive(false);
            this.isResultsItem = false;
            MissionRewardDisplay.InitMissionRewards(this.missionRewardDisplayPrefab, this.missionRewardGroup.transform, wrapperGarrisonMission.Rewards);
            for (int i = 0; i < this.locationImages.Length; i++)
            {
                if (this.locationImages[i] != null)
                {
                    this.locationImages[i].gameObject.SetActive(false);
                }
            }
            Image  image          = null;
            ushort uiTextureKitID = record.UiTextureKitID;

            switch (uiTextureKitID)
            {
            case 101:
                image = this.locationImages[1];
                this.locationIndex = 1;
                break;

            case 102:
                image = this.locationImages[10];
                this.locationIndex = 10;
                break;

            case 103:
                image = this.locationImages[3];
                this.locationIndex = 3;
                break;

            case 104:
                image = this.locationImages[4];
                this.locationIndex = 4;
                break;

            case 105:
                image = this.locationImages[9];
                this.locationIndex = 9;
                break;

            case 106:
                image = this.locationImages[7];
                this.locationIndex = 7;
                break;

            case 107:
                image = this.locationImages[8];
                this.locationIndex = 8;
                break;

            default:
                switch (uiTextureKitID)
                {
                case 203:
                    image = this.locationImages[2];
                    this.locationIndex = 2;
                    break;

                case 204:
                    image = this.locationImages[6];
                    this.locationIndex = 6;
                    break;

                case 205:
                    image = this.locationImages[5];
                    this.locationIndex = 5;
                    break;

                default:
                    if (uiTextureKitID != 164)
                    {
                        if (uiTextureKitID != 165)
                        {
                            this.locationIndex = 0;
                        }
                        else
                        {
                            image = this.locationImages[11];
                            this.locationIndex = 11;
                        }
                    }
                    else
                    {
                        image = this.locationImages[0];
                        this.locationIndex = 0;
                    }
                    break;
                }
                break;
            }
            if (image != null)
            {
                image.gameObject.SetActive(true);
            }
            GarrMissionTypeRec record2 = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID);

            this.m_missionTypeImage.overrideSprite = TextureAtlas.instance.GetAtlasSprite((int)record2.UiTextureAtlasMemberID);
            if ((record.Flags & 1u) != 0u)
            {
                this.rareMissionText.gameObject.SetActive(true);
                Color color = this.levelBG.color;
                color.r            = 0f;
                color.g            = 0.211f;
                color.b            = 0.506f;
                this.levelBG.color = color;
            }
            else
            {
                this.rareMissionText.gameObject.SetActive(false);
            }
        }
        public void SetMission(int garrMissionID)
        {
            base.gameObject.name = "AdvMapMissionSite " + garrMissionID;
            if (!PersistentMissionData.missionDictionary.ContainsKey(garrMissionID))
            {
                return;
            }
            this.m_garrMissionID = garrMissionID;
            GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(garrMissionID);

            if (record == null || !PersistentMissionData.missionDictionary.ContainsKey(garrMissionID))
            {
                return;
            }
            this.m_areaID           = record.AreaID;
            this.m_isSupportMission = false;
            if ((record.Flags & 16u) != 0u)
            {
                this.m_isSupportMission = true;
                this.m_missionTimeRemainingText.text = "Fortified";
            }
            GarrMissionTypeRec record2 = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID);

            if (record2.UiTextureAtlasMemberID > 0)
            {
                Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite((int)record2.UiTextureAtlasMemberID);
                if (atlasSprite != null)
                {
                    this.m_availableMissionTypeIcon.sprite  = atlasSprite;
                    this.m_inProgressMissionTypeIcon.sprite = atlasSprite;
                }
            }
            WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[garrMissionID];

            if (wrapperGarrisonMission.MissionState == 1 || wrapperGarrisonMission.MissionState == 2)
            {
                this.m_missionDuration = wrapperGarrisonMission.MissionDuration;
            }
            else
            {
                this.m_missionDuration = TimeSpan.FromSeconds((double)record.MissionDuration);
            }
            this.m_missionStartedTime = wrapperGarrisonMission.StartTime;
            this.m_availableMissionGroup.gameObject.SetActive(wrapperGarrisonMission.MissionState == 0);
            this.m_inProgressMissionGroup.gameObject.SetActive(wrapperGarrisonMission.MissionState == 1);
            this.m_completeMissionGroup.gameObject.SetActive(wrapperGarrisonMission.MissionState == 2 || wrapperGarrisonMission.MissionState == 3);
            if (wrapperGarrisonMission.MissionState == 1)
            {
                foreach (KeyValuePair <int, WrapperGarrisonFollower> keyValuePair in PersistentFollowerData.followerDictionary)
                {
                    if (keyValuePair.Value.CurrentMissionID == garrMissionID)
                    {
                        GarrFollowerRec record3 = StaticDB.garrFollowerDB.GetRecord(keyValuePair.Value.GarrFollowerID);
                        if (record3 != null)
                        {
                            Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record3.AllianceIconFileDataID : record3.HordeIconFileDataID);
                            if (sprite != null)
                            {
                                this.m_followerPortraitImage.sprite = sprite;
                            }
                            this.m_followerPortraitRingImage.GetComponent <Image>().enabled = true;
                            break;
                        }
                    }
                }
            }
            this.m_missionLevelText.text = string.Empty + record.TargetLevel + (((int)record.TargetLevel != 110) ? string.Empty : (" (" + record.TargetItemLevel + ")"));
            this.UpdateMissionRemainingTimeDisplay();
        }