Exemple #1
0
    private void InitMissionSites()
    {
        if (this.OnInitMissionSites != null)
        {
            this.OnInitMissionSites.Invoke();
        }
        AdventureMapMissionSite[] componentsInChildren = this.m_missionAndWordQuestArea.get_transform().GetComponentsInChildren <AdventureMapMissionSite>(true);
        AdventureMapMissionSite[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            AdventureMapMissionSite adventureMapMissionSite = array[i];
            if (adventureMapMissionSite != null)
            {
                Object.DestroyImmediate(adventureMapMissionSite.get_gameObject());
            }
        }
        IEnumerator enumerator = PersistentMissionData.missionDictionary.get_Values().GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)enumerator.get_Current();
                this.CreateMissionSite(jamGarrisonMobileMission.MissionRecID);
            }
        }
        finally
        {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
    }
    private void PopulateCompletedMissionList()
    {
        IEnumerator enumerator = PersistentMissionData.missionDictionary.Values.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object obj = enumerator.Current;
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)obj;
                if ((jamGarrisonMobileMission.MissionState == 2 || jamGarrisonMobileMission.MissionState == 6) && !this.MissionIsOnCompletedMissionList(jamGarrisonMobileMission.MissionRecID))
                {
                    GameObject gameObject = Object.Instantiate <GameObject>(this.missionListItemPrefab);
                    gameObject.transform.SetParent(this.completedMissionListContents.transform, false);
                    MissionListItem component = gameObject.GetComponent <MissionListItem>();
                    component.Init(jamGarrisonMobileMission.MissionRecID);
                    component.isResultsItem = true;
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
    }
Exemple #3
0
    public void CompleteAllMissions()
    {
        Debug.Log("Main.CompleteAllMissions()");
        IEnumerator enumerator = PersistentMissionData.missionDictionary.get_Values().GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)enumerator.get_Current();
                GarrMissionRec           record = StaticDB.garrMissionDB.GetRecord(jamGarrisonMobileMission.MissionRecID);
                if (record.GarrFollowerTypeID == 4u)
                {
                    if (jamGarrisonMobileMission.MissionState == 1)
                    {
                        long num  = GarrisonStatus.CurrentTime() - jamGarrisonMobileMission.StartTime;
                        long num2 = jamGarrisonMobileMission.MissionDuration - num;
                        if (num2 <= 0L)
                        {
                            this.CompleteMission(jamGarrisonMobileMission.MissionRecID);
                        }
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
    }
 public void UpdateMechanicPreview(bool missionInProgress, JamGarrisonMobileMission mission)
 {
     if (this.m_previewMechanicsGroup != null)
     {
         AbilityDisplay[] componentsInChildren = this.m_previewMechanicsGroup.GetComponentsInChildren <AbilityDisplay>(true);
         for (int i = 0; i < componentsInChildren.Length; i++)
         {
             if (componentsInChildren[i] != null)
             {
                 Object.DestroyImmediate(componentsInChildren[i].get_gameObject());
             }
         }
     }
     if (!missionInProgress)
     {
         for (int j = 0; j < mission.Encounter.Length; j++)
         {
             int             id     = (mission.Encounter[j].MechanicID.Length <= 0) ? 0 : mission.Encounter[j].MechanicID[0];
             GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(id);
             if (record != null && record.GarrAbilityID != 0)
             {
                 GameObject gameObject = Object.Instantiate <GameObject>(this.m_previewMechanicEffectPrefab);
                 gameObject.get_transform().SetParent(this.m_previewMechanicsGroup.get_transform(), false);
                 AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>();
                 component.SetAbility(record.GarrAbilityID, false, false, null);
                 FollowerCanCounterMechanic canCounterStatus = GeneralHelpers.HasFollowerWhoCanCounter((int)record.GarrMechanicTypeID);
                 component.SetCanCounterStatus(canCounterStatus);
             }
         }
     }
 }
Exemple #5
0
 public static void AddMission(JamGarrisonMobileMission mission)
 {
     if (!PersistentMissionData.instance.m_missionDictionary.ContainsKey(mission.MissionRecID))
     {
         PersistentMissionData.instance.m_missionDictionary.Add(mission.MissionRecID, mission);
     }
 }
Exemple #6
0
    public void OnAddMissionLootToRewardPanel(int garrMissionID)
    {
        JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary[garrMissionID];

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

        if (record == null)
        {
            return;
        }
        if (StaticDB.rewardPackDB.GetRecord(record.OvermaxRewardPackID) == null)
        {
            return;
        }
        if (jamGarrisonMobileMission.OvermaxReward.Length > 0)
        {
            GameObject gameObject = Object.Instantiate <GameObject>(AdventureMapPanel.instance.m_missionRewardResultsDisplayPrefab);
            gameObject.transform.SetParent(this.m_rewardIconArea.transform, false);
            MissionRewardDisplay component = gameObject.GetComponent <MissionRewardDisplay>();
            component.InitReward(MissionRewardDisplay.RewardType.item, jamGarrisonMobileMission.OvermaxReward[0].ItemID, (int)jamGarrisonMobileMission.OvermaxReward[0].ItemQuantity, 0, jamGarrisonMobileMission.OvermaxReward[0].ItemFileDataID);
        }
    }
Exemple #7
0
    public void OnMissionStatusChanged(bool awardOvermax = false)
    {
        JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary.get_Item(this.m_garrMissionID);

        if (jamGarrisonMobileMission.MissionState == 6 && !this.m_claimedMyLoot)
        {
            Debug.Log("OnMissionStatusChanged() MISSION FAILED " + this.m_garrMissionID);
            this.m_claimedMyLoot = true;
            this.ShowMissionFailure();
            return;
        }
        if (!this.m_claimedMyLoot)
        {
            if (jamGarrisonMobileMission.MissionState == 2 || jamGarrisonMobileMission.MissionState == 3)
            {
                Main.instance.ClaimMissionBonus(this.m_garrMissionID);
                this.m_claimedMyLoot = true;
            }
            return;
        }
        if (!this.m_showedMyLoot)
        {
            this.ShowMissionSuccess(awardOvermax);
            this.m_showedMyLoot = true;
        }
    }
    public static int GetNumCompletedMissions()
    {
        int         num        = 0;
        IEnumerator enumerator = PersistentMissionData.missionDictionary.get_Values().GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)enumerator.get_Current();
                GarrMissionRec           record = StaticDB.garrMissionDB.GetRecord(jamGarrisonMobileMission.MissionRecID);
                if (record != null)
                {
                    if (record.GarrFollowerTypeID == 4u)
                    {
                        long num2 = GarrisonStatus.CurrentTime() - jamGarrisonMobileMission.StartTime;
                        long num3 = jamGarrisonMobileMission.MissionDuration - num2;
                        if ((jamGarrisonMobileMission.MissionState == 1 && num3 <= 0L) || jamGarrisonMobileMission.MissionState == 2 || jamGarrisonMobileMission.MissionState == 3)
                        {
                            num++;
                        }
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
        return(num);
    }
Exemple #9
0
    private void InitMissionSites()
    {
        if (this.OnInitMissionSites != null)
        {
            this.OnInitMissionSites();
        }
        AdventureMapMissionSite[] componentsInChildren = this.m_mapViewContentsRT.GetComponentsInChildren <AdventureMapMissionSite>(true);
        foreach (AdventureMapMissionSite adventureMapMissionSite in componentsInChildren)
        {
            if (adventureMapMissionSite != null)
            {
                StackableMapIcon component  = adventureMapMissionSite.GetComponent <StackableMapIcon>();
                GameObject       gameObject = adventureMapMissionSite.gameObject;
                if (component != null)
                {
                    component.RemoveFromContainer();
                }
                if (gameObject != null)
                {
                    Object.DestroyImmediate(adventureMapMissionSite.gameObject);
                }
            }
        }
        componentsInChildren = this.m_missionAndWorldQuestArea_Argus.transform.GetComponentsInChildren <AdventureMapMissionSite>(true);
        foreach (AdventureMapMissionSite adventureMapMissionSite2 in componentsInChildren)
        {
            if (adventureMapMissionSite2 != null)
            {
                StackableMapIcon component2  = adventureMapMissionSite2.GetComponent <StackableMapIcon>();
                GameObject       gameObject2 = adventureMapMissionSite2.gameObject;
                if (component2 != null)
                {
                    component2.RemoveFromContainer();
                }
                if (gameObject2 != null)
                {
                    Object.DestroyImmediate(adventureMapMissionSite2.gameObject);
                }
            }
        }
        IEnumerator enumerator = PersistentMissionData.missionDictionary.Values.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object obj = enumerator.Current;
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)obj;
                this.CreateMissionSite(jamGarrisonMobileMission.MissionRecID);
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
    }
Exemple #10
0
    private int GetUncounteredMissionDuration(JamGarrisonMobileMission mission)
    {
        if (mission == null)
        {
            return(0);
        }
        GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(mission.MissionRecID);

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

        foreach (JamGarrisonEncounter jamGarrisonEncounter in mission.Encounter)
        {
            foreach (int id in jamGarrisonEncounter.MechanicID)
            {
                GarrMechanicRec record2 = StaticDB.garrMechanicDB.GetRecord(id);
                if (record2 != null)
                {
                    StaticDB.garrAbilityEffectDB.EnumRecordsByParentID(record2.GarrAbilityID, delegate(GarrAbilityEffectRec garrAbilityEffectRec)
                    {
                        if (garrAbilityEffectRec.AbilityAction == 17u)
                        {
                            missionDuration *= garrAbilityEffectRec.ActionValueFlat;
                        }
                        return(true);
                    });
                }
            }
        }
        missionDuration *= GeneralHelpers.GetMissionDurationTalentMultiplier();
        return((int)missionDuration);
    }
    private void InitMissionList()
    {
        RectTransform[] componentsInChildren = this.missionListViewContents.GetComponentsInChildren <RectTransform>(true);
        for (int i = 0; i < componentsInChildren.Length; i++)
        {
            if (componentsInChildren[i] != null && componentsInChildren[i] != this.missionListViewContents.get_transform())
            {
                Object.DestroyImmediate(componentsInChildren[i].get_gameObject());
            }
        }
        List <JamGarrisonMobileMission> list = Enumerable.ToList <JamGarrisonMobileMission>(Enumerable.OfType <JamGarrisonMobileMission>(PersistentMissionData.missionDictionary.get_Values()));

        if (this.isInProgressMissionList)
        {
            list.Sort(new MissionListView.MissionTimeComparer());
        }
        else
        {
            list.Sort(new MissionListView.MissionLevelComparer());
        }
        using (List <JamGarrisonMobileMission> .Enumerator enumerator = list.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                JamGarrisonMobileMission current = enumerator.get_Current();
                GarrMissionRec           record  = StaticDB.garrMissionDB.GetRecord(current.MissionRecID);
                if (record != null)
                {
                    if (record.GarrFollowerTypeID == 4u)
                    {
                        if (this.isInProgressMissionList)
                        {
                            if (current.MissionState == 0)
                            {
                                continue;
                            }
                            if (current.MissionState == 1)
                            {
                                long num  = GarrisonStatus.CurrentTime() - current.StartTime;
                                long num2 = current.MissionDuration - num;
                                if (num2 <= 0L)
                                {
                                    continue;
                                }
                            }
                        }
                        if (this.isInProgressMissionList || current.MissionState == 0)
                        {
                            GameObject gameObject = Object.Instantiate <GameObject>(this.missionListItemPrefab);
                            gameObject.get_transform().SetParent(this.missionListViewContents.get_transform(), false);
                            MissionListItem component = gameObject.GetComponent <MissionListItem>();
                            component.Init(record.ID);
                        }
                    }
                }
            }
        }
    }
Exemple #12
0
    public void UpdateUsefulAbilitiesDisplay(int currentGarrMissionID)
    {
        AbilityDisplay[] componentsInChildren = this.usefulAbilitiesGroup.GetComponentsInChildren <AbilityDisplay>(true);
        for (int i = 0; i < componentsInChildren.Length; i++)
        {
            Object.DestroyImmediate(componentsInChildren[i].get_gameObject());
        }
        List <int> list = new List <int>();
        JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary.get_Item(currentGarrMissionID);

        for (int j = 0; j < jamGarrisonMobileMission.Encounter.Length; j++)
        {
            int             num    = (jamGarrisonMobileMission.Encounter[j].MechanicID.Length <= 0) ? 0 : jamGarrisonMobileMission.Encounter[j].MechanicID[0];
            GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(num);
            if (record == null)
            {
                Debug.LogWarning(string.Concat(new object[]
                {
                    "INVALID garrMechanic ID ",
                    num,
                    " in mission ",
                    jamGarrisonMobileMission.MissionRecID
                }));
            }
            else
            {
                int abilityToCounterMechanicType = MissionMechanic.GetAbilityToCounterMechanicType((int)record.GarrMechanicTypeID);
                if (!list.Contains(abilityToCounterMechanicType))
                {
                    list.Add(abilityToCounterMechanicType);
                }
            }
        }
        List <int>          usefulBuffAbilitiesForFollower = MissionMechanic.GetUsefulBuffAbilitiesForFollower(this.m_followerID);
        List <int>          list2 = Enumerable.ToList <int>(Enumerable.Union <int>(list, usefulBuffAbilitiesForFollower));
        JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary.get_Item(this.m_followerID);

        int[] abilityID = jamGarrisonFollower.AbilityID;
        for (int k = 0; k < abilityID.Length; k++)
        {
            int num2 = abilityID[k];
            using (List <int> .Enumerator enumerator = list2.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    int current = enumerator.get_Current();
                    if (num2 == current)
                    {
                        GameObject gameObject = Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab);
                        gameObject.get_transform().SetParent(this.usefulAbilitiesGroup.get_transform(), false);
                        AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>();
                        component.SetAbility(num2, true, false, null);
                        component.m_abilityNameText.get_gameObject().SetActive(false);
                    }
                }
            }
        }
    }
Exemple #13
0
    private void CreateMissionSite(int garrMissionID)
    {
        GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(garrMissionID);

        if (record == null)
        {
            Debug.LogWarning("Mission Not Found: ID " + garrMissionID);
            return;
        }
        if (record.GarrFollowerTypeID != 4u)
        {
            return;
        }
        if ((record.Flags & 16u) != 0u)
        {
            return;
        }
        if (!PersistentMissionData.missionDictionary.ContainsKey(garrMissionID))
        {
            return;
        }
        JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary.get_Item(garrMissionID);

        if (jamGarrisonMobileMission.MissionState == 0)
        {
            return;
        }
        GameObject gameObject = Object.Instantiate <GameObject>(AdventureMapPanel.instance.m_AdvMapMissionSitePrefab);

        gameObject.get_transform().SetParent(this.m_missionAndWordQuestArea.get_transform(), false);
        float num  = 1.84887111f;
        float num2 = record.Mappos_x * num;
        float num3 = record.Mappos_y * -num;
        float num4 = -272.5694f;
        float num5 = 1318.388f;

        num2 += num4;
        num3 += num5;
        float         width     = this.m_worldMapLowDetail.get_sprite().get_textureRect().get_width();
        float         height    = this.m_worldMapLowDetail.get_sprite().get_textureRect().get_height();
        Vector2       vector    = new Vector3(num2 / width, num3 / height);
        RectTransform component = gameObject.GetComponent <RectTransform>();

        component.set_anchorMin(vector);
        component.set_anchorMax(vector);
        component.set_anchoredPosition(Vector2.get_zero());
        AdventureMapMissionSite component2 = gameObject.GetComponent <AdventureMapMissionSite>();

        component2.SetMission(record.ID);
        StackableMapIcon component3 = gameObject.GetComponent <StackableMapIcon>();

        if (component3 != null)
        {
            component3.RegisterWithManager();
        }
    }
Exemple #14
0
    public void UpdateUsefulAbilitiesDisplay(int currentGarrMissionID)
    {
        if (!PersistentFollowerData.followerDictionary.ContainsKey(this.m_followerID))
        {
            return;
        }
        AbilityDisplay[] componentsInChildren = this.usefulAbilitiesGroup.GetComponentsInChildren <AbilityDisplay>(true);
        for (int i = 0; i < componentsInChildren.Length; i++)
        {
            Object.DestroyImmediate(componentsInChildren[i].gameObject);
        }
        List <int> list = new List <int>();
        JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary[currentGarrMissionID];

        for (int j = 0; j < jamGarrisonMobileMission.Encounter.Length; j++)
        {
            int             num    = (jamGarrisonMobileMission.Encounter[j].MechanicID.Length <= 0) ? 0 : jamGarrisonMobileMission.Encounter[j].MechanicID[0];
            GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(num);
            if (record == null)
            {
                Debug.LogWarning(string.Concat(new object[]
                {
                    "INVALID garrMechanic ID ",
                    num,
                    " in mission ",
                    jamGarrisonMobileMission.MissionRecID
                }));
            }
            else
            {
                int abilityToCounterMechanicType = MissionMechanic.GetAbilityToCounterMechanicType((int)record.GarrMechanicTypeID);
                if (!list.Contains(abilityToCounterMechanicType))
                {
                    list.Add(abilityToCounterMechanicType);
                }
            }
        }
        List <int>          usefulBuffAbilitiesForFollower = MissionMechanic.GetUsefulBuffAbilitiesForFollower(this.m_followerID);
        List <int>          list2 = list.Union(usefulBuffAbilitiesForFollower).ToList <int>();
        JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary[this.m_followerID];

        foreach (int num2 in jamGarrisonFollower.AbilityID)
        {
            foreach (int num3 in list2)
            {
                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);
                }
            }
        }
    }
Exemple #15
0
    private void PrecacheMissionChances()
    {
        IEnumerator enumerator = PersistentMissionData.missionDictionary.get_Values().GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)enumerator.get_Current();
                GarrMissionRec           record = StaticDB.garrMissionDB.GetRecord(jamGarrisonMobileMission.MissionRecID);
                if (record.GarrFollowerTypeID == 4u)
                {
                    if (jamGarrisonMobileMission.MissionState == 1)
                    {
                        List <JamGarrisonFollower> list = new List <JamGarrisonFollower>();
                        using (Dictionary <int, JamGarrisonFollower> .ValueCollection.Enumerator enumerator2 = PersistentFollowerData.followerDictionary.get_Values().GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                JamGarrisonFollower current = enumerator2.get_Current();
                                if (current.CurrentMissionID == jamGarrisonMobileMission.MissionRecID)
                                {
                                    list.Add(current);
                                }
                            }
                        }
                        MobilePlayerEvaluateMission mobilePlayerEvaluateMission = new MobilePlayerEvaluateMission();
                        mobilePlayerEvaluateMission.GarrMissionID  = jamGarrisonMobileMission.MissionRecID;
                        mobilePlayerEvaluateMission.GarrFollowerID = new int[list.get_Count()];
                        int num = 0;
                        using (List <JamGarrisonFollower> .Enumerator enumerator3 = list.GetEnumerator())
                        {
                            while (enumerator3.MoveNext())
                            {
                                JamGarrisonFollower current2 = enumerator3.get_Current();
                                mobilePlayerEvaluateMission.GarrFollowerID[num++] = current2.GarrFollowerID;
                            }
                        }
                        Login.instance.SendToMobileServer(mobilePlayerEvaluateMission);
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
    }
 private void CollectFirstCompletedMission()
 {
     MissionListItem[] componentsInChildren = this.completedMissionListContents.GetComponentsInChildren <MissionListItem>(true);
     for (int i = 0; i < componentsInChildren.Length; i++)
     {
         JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary[componentsInChildren[i].garrMissionID];
         if (!this.GetRequestedMissionCollectionDictionary().ContainsKey(componentsInChildren[i].garrMissionID) && PersistentMissionData.missionDictionary.ContainsKey(componentsInChildren[i].garrMissionID) && jamGarrisonMobileMission.MissionState == 2)
         {
             this.GetRequestedMissionCollectionDictionary().Add(componentsInChildren[i].garrMissionID, true);
             Main.instance.ClaimMissionBonus(componentsInChildren[i].garrMissionID);
             break;
         }
     }
 }
Exemple #17
0
    private void OnMissionSuccessChanceChanged(int chance)
    {
        if (this.m_garrMissionID == 0)
        {
            return;
        }
        if (!base.get_gameObject().get_activeSelf())
        {
            return;
        }
        this.m_bonusLootDisplay.SetActive(false);
        if (chance <= -1000)
        {
            this.missionPercentChanceText.set_text("%");
            this.m_missionChanceSpinner.SetActive(true);
        }
        else
        {
            this.missionPercentChanceText.set_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;
        }
        JamGarrisonMobileMission jamGarrisonMobileMission = (!PersistentMissionData.missionDictionary.ContainsKey(this.m_garrMissionID)) ? null : ((JamGarrisonMobileMission)PersistentMissionData.missionDictionary.get_Item(this.m_garrMissionID));

        if (record.OvermaxRewardPackID > 0 && jamGarrisonMobileMission != null && jamGarrisonMobileMission.OvermaxReward.Length > 0)
        {
            this.m_bonusLootDisplay.SetActive(true);
            this.m_bonusLootChanceText.set_text(string.Concat(new object[]
            {
                "<color=#ffff00ff>",
                StaticDB.GetString("BONUS_ROLL", null),
                " </color>\n<color=#ff8600ff>",
                Math.Max(0, chance - 100),
                "%</color>"
            }));
        }
    }
    public void Show()
    {
        int num = 0;
        CombatAllyMissionState combatAllyMissionState = CombatAllyMissionState.notAvailable;
        IEnumerator            enumerator             = PersistentMissionData.missionDictionary.Values.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object obj = enumerator.Current;
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)obj;
                GarrMissionRec           record = StaticDB.garrMissionDB.GetRecord(jamGarrisonMobileMission.MissionRecID);
                if (record != null)
                {
                    if ((record.Flags & 16u) != 0u)
                    {
                        num = jamGarrisonMobileMission.MissionRecID;
                        if (jamGarrisonMobileMission.MissionState == 1)
                        {
                            combatAllyMissionState = CombatAllyMissionState.inProgress;
                        }
                        else
                        {
                            combatAllyMissionState = CombatAllyMissionState.available;
                        }
                        break;
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
        if (num > 0)
        {
            this.m_missionDetailView.HandleMissionSelected(num);
        }
        this.m_missionDetailView.SetCombatAllyMissionState(combatAllyMissionState);
        this.m_sliderPanel.MaximizeSliderPanel();
    }
Exemple #19
0
    private void Update()
    {
        IEnumerator enumerator = PersistentMissionData.missionDictionary.Values.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object obj = enumerator.Current;
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)obj;
                bool           flag   = false;
                GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(jamGarrisonMobileMission.MissionRecID);
                if (record != null)
                {
                    if (record.GarrFollowerTypeID == 4u)
                    {
                        if (jamGarrisonMobileMission.MissionState == 1)
                        {
                            long num  = GarrisonStatus.CurrentTime() - jamGarrisonMobileMission.StartTime;
                            long num2 = jamGarrisonMobileMission.MissionDuration - num;
                            if (num2 <= 0L)
                            {
                                flag = true;
                            }
                        }
                        if (jamGarrisonMobileMission.MissionState == 2)
                        {
                            flag = true;
                        }
                        if (flag)
                        {
                        }
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
    }
    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.DestroyImmediate(componentsInChildren2[i].gameObject);
        }
        for (int j = 0; j < componentsInChildren.Length; j++)
        {
            JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary[componentsInChildren[j].garrMissionID];
            if (PersistentMissionData.missionDictionary.ContainsKey(componentsInChildren[j].garrMissionID) && jamGarrisonMobileMission.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 = "%";
            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;
        }
        JamGarrisonMobileMission jamGarrisonMobileMission = (!PersistentMissionData.missionDictionary.ContainsKey(this.m_garrMissionID)) ? null : ((JamGarrisonMobileMission)PersistentMissionData.missionDictionary[this.m_garrMissionID]);

        if (record.OvermaxRewardPackID > 0 && jamGarrisonMobileMission != null && jamGarrisonMobileMission.OvermaxReward.Length > 0)
        {
            this.m_bonusLootDisplay.SetActive(true);
            this.m_bonusLootChanceText.text = "<color=#ff9600ff>" + Math.Max(0, chance - 100) + "%</color>";
            this.m_bonusLootChance          = Math.Max(0, chance - 100);
        }
    }
Exemple #22
0
    public static int GetNumCompletedMissions(bool skipSupportMissions = false)
    {
        int         num        = 0;
        IEnumerator enumerator = PersistentMissionData.missionDictionary.Values.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object obj = enumerator.Current;
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)obj;
                GarrMissionRec           record = StaticDB.garrMissionDB.GetRecord(jamGarrisonMobileMission.MissionRecID);
                if (record != null)
                {
                    if (record.GarrFollowerTypeID == 4u)
                    {
                        if (!skipSupportMissions || (record.Flags & 16u) == 0u)
                        {
                            long num2 = GarrisonStatus.CurrentTime() - jamGarrisonMobileMission.StartTime;
                            long num3 = jamGarrisonMobileMission.MissionDuration - num2;
                            if ((jamGarrisonMobileMission.MissionState == 1 && num3 <= 0L) || jamGarrisonMobileMission.MissionState == 2 || jamGarrisonMobileMission.MissionState == 3)
                            {
                                num++;
                            }
                        }
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
        return(num);
    }
Exemple #23
0
 public void ZoomToNextCompleteMission()
 {
     AllPanels.instance.m_orderHallMultiPanel.m_miniMissionListPanel.InitMissionList();
     MiniMissionListItem[] componentsInChildren = AllPanels.instance.m_orderHallMultiPanel.m_miniMissionListPanel.m_inProgressMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
     foreach (MiniMissionListItem miniMissionListItem in componentsInChildren)
     {
         JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary[miniMissionListItem.GetMissionID()];
         if (jamGarrisonMobileMission != null)
         {
             if (jamGarrisonMobileMission.MissionState == 1)
             {
                 long num  = GarrisonStatus.CurrentTime() - jamGarrisonMobileMission.StartTime;
                 long num2 = jamGarrisonMobileMission.MissionDuration - num;
                 if (num2 <= 0L)
                 {
                     AdventureMapPanel.instance.ShowMissionResultAction(jamGarrisonMobileMission.MissionRecID, 0, false);
                     break;
                 }
             }
         }
     }
 }
    public void InitMissionList()
    {
        this.m_combatAllyListItem.get_gameObject().SetActive(false);
        MiniMissionListItem[] componentsInChildren = this.m_availableMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        MiniMissionListItem[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            MiniMissionListItem miniMissionListItem = array[i];
            bool flag = true;
            if (PersistentMissionData.missionDictionary.ContainsKey(miniMissionListItem.GetMissionID()))
            {
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary.get_Item(miniMissionListItem.GetMissionID());
                if (jamGarrisonMobileMission.MissionState == 0)
                {
                    flag = false;
                    miniMissionListItem.UpdateMechanicPreview(false, jamGarrisonMobileMission);
                }
            }
            if (flag)
            {
                Object.DestroyImmediate(miniMissionListItem.get_gameObject());
            }
        }
        componentsInChildren = this.m_inProgressMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        MiniMissionListItem[] array2 = componentsInChildren;
        for (int j = 0; j < array2.Length; j++)
        {
            MiniMissionListItem miniMissionListItem2 = array2[j];
            bool flag2 = true;
            if (PersistentMissionData.missionDictionary.ContainsKey(miniMissionListItem2.GetMissionID()))
            {
                JamGarrisonMobileMission jamGarrisonMobileMission2 = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary.get_Item(miniMissionListItem2.GetMissionID());
                if (jamGarrisonMobileMission2.MissionState != 0)
                {
                    flag2 = false;
                }
            }
            if (flag2)
            {
                Object.DestroyImmediate(miniMissionListItem2.get_gameObject());
            }
        }
        MiniMissionListItem[] componentsInChildren2 = this.m_availableMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        MiniMissionListItem[] componentsInChildren3 = this.m_inProgressMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        IEnumerator           enumerator            = PersistentMissionData.missionDictionary.get_Values().GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                JamGarrisonMobileMission jamGarrisonMobileMission3 = (JamGarrisonMobileMission)enumerator.get_Current();
                bool flag3 = false;
                MiniMissionListItem[] array3 = componentsInChildren2;
                for (int k = 0; k < array3.Length; k++)
                {
                    MiniMissionListItem miniMissionListItem3 = array3[k];
                    if (miniMissionListItem3.GetMissionID() == jamGarrisonMobileMission3.MissionRecID)
                    {
                        flag3 = true;
                        break;
                    }
                }
                if (!flag3)
                {
                    MiniMissionListItem[] array4 = componentsInChildren3;
                    for (int l = 0; l < array4.Length; l++)
                    {
                        MiniMissionListItem miniMissionListItem4 = array4[l];
                        if (miniMissionListItem4.GetMissionID() == jamGarrisonMobileMission3.MissionRecID)
                        {
                            flag3 = true;
                            break;
                        }
                    }
                }
                if (!flag3)
                {
                    GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(jamGarrisonMobileMission3.MissionRecID);
                    if (record == null)
                    {
                        Debug.LogWarning("Mission Not Found: ID " + jamGarrisonMobileMission3.MissionRecID);
                    }
                    else if (record.GarrFollowerTypeID == 4u)
                    {
                        if ((record.Flags & 16u) != 0u)
                        {
                            this.m_combatAllyListItem.get_gameObject().SetActive(true);
                        }
                        else
                        {
                            GameObject gameObject = Object.Instantiate <GameObject>(this.m_miniMissionListItemPrefab);
                            if (jamGarrisonMobileMission3.MissionState == 0)
                            {
                                gameObject.get_transform().SetParent(this.m_availableMission_listContents.get_transform(), false);
                            }
                            else
                            {
                                gameObject.get_transform().SetParent(this.m_inProgressMission_listContents.get_transform(), false);
                            }
                            MiniMissionListItem component = gameObject.GetComponent <MiniMissionListItem>();
                            component.SetMission(jamGarrisonMobileMission3);
                            AutoHide autoHide = gameObject.AddComponent <AutoHide>();
                            autoHide.m_clipRT = base.get_gameObject().GetComponent <RectTransform>();
                        }
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
        componentsInChildren2 = this.m_availableMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        componentsInChildren3 = this.m_inProgressMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        int num  = componentsInChildren2.Length;
        int num2 = componentsInChildren3.Length;

        this.m_availableMissionsTabLabel.set_text(StaticDB.GetString("AVAILABLE", null) + " - " + num);
        this.m_inProgressMissionsTabLabel.set_text(StaticDB.GetString("IN_PROGRESS", null) + " - " + num2);
        this.m_noMissionsAvailableLabel.get_gameObject().SetActive(num == 0);
        this.m_noMissionsInProgressLabel.get_gameObject().SetActive(num2 == 0);
    }
Exemple #25
0
    public void UpdateVisuals()
    {
        CombatAllyMissionState combatAllyMissionState = CombatAllyMissionState.notAvailable;
        IEnumerator            enumerator             = PersistentMissionData.missionDictionary.get_Values().GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)enumerator.get_Current();
                GarrMissionRec           record = StaticDB.garrMissionDB.GetRecord(jamGarrisonMobileMission.MissionRecID);
                if (record != null)
                {
                    if ((record.Flags & 16u) != 0u)
                    {
                        this.m_combatAllyMissionID = jamGarrisonMobileMission.MissionRecID;
                        if (jamGarrisonMobileMission.MissionState == 1)
                        {
                            combatAllyMissionState = CombatAllyMissionState.inProgress;
                        }
                        else
                        {
                            combatAllyMissionState = CombatAllyMissionState.available;
                        }
                        break;
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
        if (combatAllyMissionState == CombatAllyMissionState.inProgress)
        {
            using (Dictionary <int, JamGarrisonFollower> .ValueCollection.Enumerator enumerator2 = PersistentFollowerData.followerDictionary.get_Values().GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    JamGarrisonFollower current = enumerator2.get_Current();
                    if (current.CurrentMissionID == this.m_combatAllyMissionID)
                    {
                        this.m_combatAllySlot.SetFollower(current.GarrFollowerID);
                        this.m_combatAllyLabel.get_gameObject().SetActive(false);
                        this.m_assignChampionText.get_gameObject().SetActive(false);
                        this.m_championName.get_gameObject().SetActive(true);
                        GarrFollowerRec record2 = StaticDB.garrFollowerDB.GetRecord(current.GarrFollowerID);
                        CreatureRec     record3 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record2.HordeCreatureID : record2.AllianceCreatureID);
                        this.m_championName.set_text(record3.Name);
                        this.m_championName.set_color(GeneralHelpers.GetQualityColor(current.Quality));
                        this.m_combatAllySupportSpellDisplay.get_gameObject().SetActive(true);
                        this.m_combatAllySupportSpellDisplay.SetSpell(current.ZoneSupportSpellID);
                        this.m_unassignCombatAllyButton.SetActive(true);
                        break;
                    }
                }
            }
        }
        else
        {
            this.ClearCombatAllyDisplay();
        }
    }
Exemple #26
0
    public void Init()
    {
        FollowerInventoryListItem[] componentsInChildren = this.m_combatAllyListContent.GetComponentsInChildren <FollowerInventoryListItem>(true);
        FollowerInventoryListItem[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            FollowerInventoryListItem followerInventoryListItem = array[i];
            Object.DestroyImmediate(followerInventoryListItem.get_gameObject());
        }
        int         num        = 0;
        IEnumerator enumerator = PersistentMissionData.missionDictionary.get_Values().GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)enumerator.get_Current();
                GarrMissionRec           record = StaticDB.garrMissionDB.GetRecord(jamGarrisonMobileMission.MissionRecID);
                if (record != null)
                {
                    if ((record.Flags & 16u) != 0u)
                    {
                        this.CreateCombatAllyItems(jamGarrisonMobileMission.MissionRecID, (int)record.MissionCost);
                        num = (int)record.MissionCost;
                        break;
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
        if (num <= GarrisonStatus.Resources())
        {
            this.m_combatAllyCost.set_text(string.Concat(new object[]
            {
                StaticDB.GetString("COST2", "Cost:"),
                " <color=#ffffffff>",
                num,
                "</color>"
            }));
        }
        else
        {
            this.m_combatAllyCost.set_text(string.Concat(new object[]
            {
                StaticDB.GetString("COST2", "Cost:"),
                " <color=#ff0000ff>",
                num,
                "</color>"
            }));
        }
        Sprite sprite = GeneralHelpers.LoadCurrencyIcon(1220);

        if (sprite != null)
        {
            this.m_combatAllyCostResourceIcon.set_sprite(sprite);
        }
    }
Exemple #27
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 = record.MissionDuration;
        JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary.get_Item(this.garrMissionID);

        this.missionStartedTime = jamGarrisonMobileMission.StartTime;
        Duration duration = new Duration(record.MissionDuration, false);
        string   text     = (duration.Hours < 2) ? "<color=#ffffffff>" : "<color=#ff8600ff>";
        long     num      = GarrisonStatus.CurrentTime() - this.missionStartedTime;
        long     num2     = (long)this.missionDurationInSeconds - num;

        num2 = ((num2 <= 0L) ? 0L : num2);
        bool flag = jamGarrisonMobileMission.MissionState == 1 && num2 > 0L;

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

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

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

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

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

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

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

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

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

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

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

            default:
                if (uiTextureKitID != 164u)
                {
                    if (uiTextureKitID != 165u)
                    {
                        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.get_gameObject().SetActive(true);
        }
        GarrMissionTypeRec record2 = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID);

        this.m_missionTypeImage.set_overrideSprite(TextureAtlas.instance.GetAtlasSprite((int)record2.UiTextureAtlasMemberID));
        if ((record.Flags & 1u) != 0u)
        {
            this.rareMissionText.get_gameObject().SetActive(true);
            Color color = this.levelBG.get_color();
            color.r = 0f;
            color.g = 0.211f;
            color.b = 0.506f;
            this.levelBG.set_color(color);
        }
        else
        {
            this.rareMissionText.get_gameObject().SetActive(false);
        }
    }
Exemple #28
0
    public void SetMission(int garrMissionID)
    {
        base.get_gameObject().set_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.set_text("Fortified");
        }
        GarrMissionTypeRec record2 = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID);

        if (record2.UiTextureAtlasMemberID > 0u)
        {
            Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite((int)record2.UiTextureAtlasMemberID);
            if (atlasSprite != null)
            {
                this.m_availableMissionTypeIcon.set_sprite(atlasSprite);
                this.m_inProgressMissionTypeIcon.set_sprite(atlasSprite);
            }
        }
        JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary.get_Item(garrMissionID);

        if (jamGarrisonMobileMission.MissionState == 1 || jamGarrisonMobileMission.MissionState == 2)
        {
            this.m_missionDurationInSeconds = (int)jamGarrisonMobileMission.MissionDuration;
        }
        else
        {
            this.m_missionDurationInSeconds = record.MissionDuration;
        }
        this.m_missionStartedTime = jamGarrisonMobileMission.StartTime;
        this.m_availableMissionGroup.get_gameObject().SetActive(jamGarrisonMobileMission.MissionState == 0);
        this.m_inProgressMissionGroup.get_gameObject().SetActive(jamGarrisonMobileMission.MissionState == 1);
        this.m_completeMissionGroup.get_gameObject().SetActive(jamGarrisonMobileMission.MissionState == 2 || jamGarrisonMobileMission.MissionState == 3);
        if (jamGarrisonMobileMission.MissionState == 1)
        {
            using (Dictionary <int, JamGarrisonFollower> .Enumerator enumerator = PersistentFollowerData.followerDictionary.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <int, JamGarrisonFollower> current = enumerator.get_Current();
                    if (current.get_Value().CurrentMissionID == garrMissionID)
                    {
                        GarrFollowerRec record3 = StaticDB.garrFollowerDB.GetRecord(current.get_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.set_sprite(sprite);
                            }
                            this.m_followerPortraitRingImage.GetComponent <Image>().set_enabled(true);
                            break;
                        }
                    }
                }
            }
        }
        this.m_missionLevelText.set_text(string.Empty + record.TargetLevel + ((record.TargetLevel != 110) ? string.Empty : (" (" + record.TargetItemLevel + ")")));
        this.UpdateMissionRemainingTimeDisplay();
    }
Exemple #29
0
    public void SetAvailabilityStatus(JamGarrisonFollower follower)
    {
        this.m_isCombatAlly = false;
        if (follower.CurrentMissionID != 0)
        {
            JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary[follower.CurrentMissionID];
            this.m_missionStartedTime       = jamGarrisonMobileMission.StartTime;
            this.m_missionDurationInSeconds = jamGarrisonMobileMission.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);
    }
Exemple #30
0
    public bool ShouldShowCompletedMission()
    {
        JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary[this.m_garrMissionID];

        return(jamGarrisonMobileMission.MissionState == 2 || jamGarrisonMobileMission.MissionState == 3 || (jamGarrisonMobileMission.MissionState == 1 && GarrisonStatus.CurrentTime() - this.m_missionStartedTime >= (long)this.m_missionDurationInSeconds));
    }