예제 #1
0
 private void PrecacheMissionChances()
 {
     foreach (WrapperGarrisonMission wrapperGarrisonMission in PersistentMissionData.missionDictionary.Values)
     {
         GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(wrapperGarrisonMission.MissionRecID);
         if (record != null && (GARR_FOLLOWER_TYPE)record.GarrFollowerTypeID == GarrisonStatus.GarrisonFollowerType)
         {
             if (wrapperGarrisonMission.MissionState == 1)
             {
                 List <WrapperGarrisonFollower> list = new List <WrapperGarrisonFollower>();
                 foreach (WrapperGarrisonFollower item in PersistentFollowerData.followerDictionary.Values)
                 {
                     if (item.CurrentMissionID == wrapperGarrisonMission.MissionRecID)
                     {
                         list.Add(item);
                     }
                 }
                 LegionCompanionWrapper.EvaluateMission(wrapperGarrisonMission.MissionRecID, (from f in list
                                                                                              select f.GarrFollowerID).ToList <int>());
             }
         }
     }
 }
        public void UpdateMissionStatus(int garrMissionID)
        {
            MissionMechanic[] componentsInChildren = this.enemyPortraitsGroup.GetComponentsInChildren <MissionMechanic>(true);
            if (componentsInChildren == null)
            {
                return;
            }
            for (int i = 0; i < (int)componentsInChildren.Length; i++)
            {
                componentsInChildren[i].SetCountered(false, false, true);
            }
            AbilityDisplay[] abilityDisplayArray = this.enemyPortraitsGroup.GetComponentsInChildren <AbilityDisplay>(true);
            if (abilityDisplayArray == null)
            {
                return;
            }
            for (int j = 0; j < (int)abilityDisplayArray.Length; j++)
            {
                abilityDisplayArray[j].SetCountered(false, true);
            }
            MissionMechanicTypeCounter[] missionMechanicTypeCounterArray = base.gameObject.GetComponentsInChildren <MissionMechanicTypeCounter>(true);
            if (missionMechanicTypeCounterArray == null)
            {
                return;
            }
            for (int k = 0; k < (int)missionMechanicTypeCounterArray.Length; k++)
            {
                missionMechanicTypeCounterArray[k].usedIcon.gameObject.SetActive(false);
                int num = 0;
                while (num < (int)componentsInChildren.Length)
                {
                    if (missionMechanicTypeCounterArray[k].countersMissionMechanicTypeID != componentsInChildren[num].m_missionMechanicTypeID || componentsInChildren[num].IsCountered())
                    {
                        num++;
                    }
                    else
                    {
                        componentsInChildren[num].SetCountered(true, false, false);
                        if (num < (int)abilityDisplayArray.Length)
                        {
                            abilityDisplayArray[num].SetCountered(true, false);
                        }
                        break;
                    }
                }
            }
            MissionFollowerSlot[]          missionFollowerSlotArray = base.gameObject.GetComponentsInChildren <MissionFollowerSlot>(true);
            List <WrapperGarrisonFollower> wrapperGarrisonFollowers = new List <WrapperGarrisonFollower>();

            for (int l = 0; l < (int)missionFollowerSlotArray.Length; l++)
            {
                int currentGarrFollowerID = missionFollowerSlotArray[l].GetCurrentGarrFollowerID();
                if (PersistentFollowerData.followerDictionary.ContainsKey(currentGarrFollowerID))
                {
                    wrapperGarrisonFollowers.Add(PersistentFollowerData.followerDictionary[currentGarrFollowerID]);
                }
            }
            int item = -1000;

            if (!MissionDataCache.missionDataDictionary.ContainsKey(this.m_garrMissionID))
            {
                LegionCompanionWrapper.EvaluateMission(garrMissionID, (
                                                           from f in wrapperGarrisonFollowers
                                                           select f.GarrFollowerID).ToList <int>());
            }
            else
            {
                item = MissionDataCache.missionDataDictionary[this.m_garrMissionID];
            }
            this.OnMissionSuccessChanceChanged(item);
        }
        public void UpdateMissionStatus(int garrMissionID)
        {
            MissionMechanic[] componentsInChildren = this.enemyPortraitsGroup.GetComponentsInChildren <MissionMechanic>(true);
            if (componentsInChildren == null)
            {
                return;
            }
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                componentsInChildren[i].SetCountered(false, false, true);
            }
            AbilityDisplay[] componentsInChildren2 = this.enemyPortraitsGroup.GetComponentsInChildren <AbilityDisplay>(true);
            if (componentsInChildren2 == null)
            {
                return;
            }
            for (int j = 0; j < componentsInChildren2.Length; j++)
            {
                componentsInChildren2[j].SetCountered(false, true);
            }
            MissionMechanicTypeCounter[] componentsInChildren3 = base.gameObject.GetComponentsInChildren <MissionMechanicTypeCounter>(true);
            if (componentsInChildren3 == null)
            {
                return;
            }
            for (int k = 0; k < componentsInChildren3.Length; k++)
            {
                componentsInChildren3[k].usedIcon.gameObject.SetActive(false);
                for (int l = 0; l < componentsInChildren.Length; l++)
                {
                    if (componentsInChildren3[k].countersMissionMechanicTypeID == componentsInChildren[l].m_missionMechanicTypeID && !componentsInChildren[l].IsCountered())
                    {
                        componentsInChildren[l].SetCountered(true, false, false);
                        if (l < componentsInChildren2.Length)
                        {
                            componentsInChildren2[l].SetCountered(true, false);
                        }
                        break;
                    }
                }
            }
            MissionFollowerSlot[]          componentsInChildren4 = base.gameObject.GetComponentsInChildren <MissionFollowerSlot>(true);
            List <WrapperGarrisonFollower> list = new List <WrapperGarrisonFollower>();

            for (int m = 0; m < componentsInChildren4.Length; m++)
            {
                int currentGarrFollowerID = componentsInChildren4[m].GetCurrentGarrFollowerID();
                if (PersistentFollowerData.followerDictionary.ContainsKey(currentGarrFollowerID))
                {
                    WrapperGarrisonFollower item = PersistentFollowerData.followerDictionary[currentGarrFollowerID];
                    list.Add(item);
                }
            }
            int chance = -1000;

            if (MissionDataCache.missionDataDictionary.ContainsKey(this.m_garrMissionID))
            {
                chance = MissionDataCache.missionDataDictionary[this.m_garrMissionID];
            }
            else
            {
                LegionCompanionWrapper.EvaluateMission(garrMissionID, (from f in list
                                                                       select f.GarrFollowerID).ToList <int>());
            }
            this.OnMissionSuccessChanceChanged(chance);
        }