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);
             }
         }
     }
 }
        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.º 3
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);
    }
Exemplo n.º 4
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);
                    }
                }
            }
        }
    }
Exemplo n.º 5
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);
                }
            }
        }
    }
Exemplo n.º 6
0
    public void SetMechanicTypeWithMechanicID(int missionMechanicID, bool hideBorder = false)
    {
        GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(missionMechanicID);

        if (record == null)
        {
            Debug.LogWarning("Invalid MissionMechanicID " + missionMechanicID);
            return;
        }
        this.SetMechanicType((int)record.GarrMechanicTypeID, record.GarrAbilityID, hideBorder);
    }
Exemplo n.º 7
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);
                    }
                }
            }
        }
Exemplo n.º 8
0
        public void SetEncounter(int garrEncounterID, int garrMechanicID)
        {
            this.m_garrEncounterID = garrEncounterID;
            this.m_garrMechanicID  = garrMechanicID;
            GarrEncounterRec record = StaticDB.garrEncounterDB.GetRecord(garrEncounterID);

            if (record == null)
            {
                this.nameText.text = string.Empty + garrEncounterID;
                return;
            }
            this.nameText.text = record.Name;
            Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, record.PortraitFileDataID);

            if (sprite != null)
            {
                this.portraitImage.sprite = sprite;
            }
            else
            {
                this.missingIconText.gameObject.SetActive(true);
                this.missingIconText.text = string.Empty + record.PortraitFileDataID;
            }
            if (this.m_missionMechanicPrefab != null)
            {
                GameObject gameObject = Object.Instantiate <GameObject>(this.m_missionMechanicPrefab);
                gameObject.transform.SetParent(this.m_mechanicRoot.transform, false);
                MissionMechanic component = gameObject.GetComponent <MissionMechanic>();
                component.SetMechanicTypeWithMechanicID(garrMechanicID, false);
            }
            if (this.m_mechanicEffectDisplayPrefab != null)
            {
                GarrMechanicRec record2 = StaticDB.garrMechanicDB.GetRecord(garrMechanicID);
                if (record2 == null)
                {
                    this.m_mechanicRoot.SetActive(false);
                }
                if (record2 != null && record2.GarrAbilityID != 0)
                {
                    GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_mechanicEffectDisplayPrefab);
                    gameObject2.transform.SetParent(this.m_mechanicEffectRoot.transform, false);
                    AbilityDisplay component2 = gameObject2.GetComponent <AbilityDisplay>();
                    component2.SetAbility(record2.GarrAbilityID, false, false, null);
                }
            }
        }
Exemplo n.º 9
0
        public void InitializeMissionDialog(int missionId, Sprite missionTypeSprite)
        {
            GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(missionId);

            if (record != null)
            {
                GarrMechanicRec record2 = StaticDB.garrMechanicDB.GetRecord(record.EnvGarrMechanicID);
                if (record2 != null)
                {
                    GarrMechanicTypeRec record3 = StaticDB.garrMechanicTypeDB.GetRecord((int)record2.GarrMechanicTypeID);
                    if (record3 != null)
                    {
                        this.m_icon.sprite                 = missionTypeSprite;
                        this.m_missionTypeName.text        = record3.Name;
                        this.m_missionTypeDescription.text = WowTextParser.parser.Parse(record3.Description, 0).Replace("FFFFD200", "FFD200FF");
                    }
                }
            }
        }
Exemplo n.º 10
0
        public void InitializeMissionDialog(int missionId)
        {
            GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(missionId);

            if (record != null)
            {
                GarrMechanicRec garrMechanicRec = StaticDB.garrMechanicDB.GetRecord(record.EnvGarrMechanicID);
                if (garrMechanicRec != null)
                {
                    GarrAbilityRec garrAbilityRec = StaticDB.garrAbilityDB.GetRecord(garrMechanicRec.GarrAbilityID);
                    if (garrAbilityRec != null)
                    {
                        this.m_icon.sprite                 = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, garrAbilityRec.IconFileDataID);
                        this.m_missionTypeName.text        = garrAbilityRec.Name;
                        this.m_missionTypeDescription.text = WowTextParser.parser.Parse(garrAbilityRec.Description, 0).Replace("FFFFD200", "FFD200FF");
                    }
                }
            }
        }
Exemplo n.º 11
0
        public void SetEncounter(int garrEncounterID, int garrMechanicID)
        {
            this.m_missionEncounter.SetEncounter(garrEncounterID, garrMechanicID);
            GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(garrMechanicID);

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

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

            if (record2 == null)
            {
                base.gameObject.SetActive(false);
                return;
            }
            this.m_encounterTypeLabel.text = record2.Name;
        }
Exemplo n.º 12
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]);
                    }
                }
            }
        }
Exemplo n.º 13
0
    public static int[] GetBuffsForCurrentMission(int garrFollowerID, int garrMissionID, GameObject missionFollowerSlotGroup, int missionDuration)
    {
        List <int> abilityIDList = new List <int>();

        if (!PersistentFollowerData.followerDictionary.ContainsKey(garrFollowerID))
        {
            return(abilityIDList.ToArray());
        }
        JamGarrisonFollower follower = PersistentFollowerData.followerDictionary[garrFollowerID];

        for (int i = 0; i < follower.AbilityID.Length; i++)
        {
            GarrAbilityRec garrAbilityRec = StaticDB.garrAbilityDB.GetRecord(follower.AbilityID[i]);
            if (garrAbilityRec == null)
            {
                Debug.Log(string.Concat(new object[]
                {
                    "Invalid Ability ID ",
                    follower.AbilityID[i],
                    " from follower ",
                    follower.GarrFollowerID
                }));
            }
            else
            {
                StaticDB.garrAbilityEffectDB.EnumRecordsByParentID(garrAbilityRec.ID, delegate(GarrAbilityEffectRec garrAbilityEffectRec)
                {
                    uint abilityAction = garrAbilityEffectRec.AbilityAction;
                    switch (abilityAction)
                    {
                    case 0u:
                        return(true);

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

                    default:
                        switch (abilityAction)
                        {
                        case 22u:
                            {
                                MissionFollowerSlot[] componentsInChildren2 = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
                                bool flag = false;
                                foreach (MissionFollowerSlot missionFollowerSlot2 in componentsInChildren2)
                                {
                                    int currentGarrFollowerID = missionFollowerSlot2.GetCurrentGarrFollowerID();
                                    if (currentGarrFollowerID > 0 && currentGarrFollowerID != follower.GarrFollowerID)
                                    {
                                        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(currentGarrFollowerID);
                                        if (record != null)
                                        {
                                            uint num2 = (GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record.HordeGarrClassSpecID : record.AllianceGarrClassSpecID;
                                            if (num2 == garrAbilityEffectRec.ActionRecordID)
                                            {
                                                flag = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                if (!flag)
                                {
                                    return(true);
                                }
                                break;
                            }

                        case 23u:
                            {
                                bool flag2 = false;
                                if (PersistentMissionData.missionDictionary.ContainsKey(garrMissionID))
                                {
                                    JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary[garrMissionID];
                                    for (int l = 0; l < jamGarrisonMobileMission.Encounter.Length; l++)
                                    {
                                        for (int m = 0; m < jamGarrisonMobileMission.Encounter[l].MechanicID.Length; m++)
                                        {
                                            GarrMechanicRec record2 = StaticDB.garrMechanicDB.GetRecord(jamGarrisonMobileMission.Encounter[l].MechanicID[m]);
                                            if (record2 != null && garrAbilityEffectRec.GarrMechanicTypeID == record2.GarrMechanicTypeID)
                                            {
                                                flag2 = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                if (!flag2)
                                {
                                    return(true);
                                }
                                break;
                            }

                        default:
                            if (abilityAction == 37u)
                            {
                                return(true);
                            }
                            break;

                        case 26u:
                            {
                                MissionFollowerSlot[] componentsInChildren3 = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
                                bool flag3 = false;
                                foreach (MissionFollowerSlot missionFollowerSlot3 in componentsInChildren3)
                                {
                                    int currentGarrFollowerID2 = missionFollowerSlot3.GetCurrentGarrFollowerID();
                                    if (currentGarrFollowerID2 > 0 && currentGarrFollowerID2 != follower.GarrFollowerID && (ulong)garrAbilityEffectRec.ActionRecordID == (ulong)((long)currentGarrFollowerID2))
                                    {
                                        flag3 = true;
                                        break;
                                    }
                                }
                                if (!flag3)
                                {
                                    return(true);
                                }
                                break;
                            }
                        }
                        break;

                    case 5u:
                        {
                            MissionFollowerSlot[] componentsInChildren4 = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
                            bool flag4 = false;
                            foreach (MissionFollowerSlot missionFollowerSlot4 in componentsInChildren4)
                            {
                                int currentGarrFollowerID3 = missionFollowerSlot4.GetCurrentGarrFollowerID();
                                if (currentGarrFollowerID3 > 0 && currentGarrFollowerID3 != follower.GarrFollowerID)
                                {
                                    GarrFollowerRec record3 = StaticDB.garrFollowerDB.GetRecord(currentGarrFollowerID3);
                                    if (record3 != null)
                                    {
                                        uint num4 = (GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record3.HordeGarrFollRaceID : record3.AllianceGarrFollRaceID;
                                        if (num4 == garrAbilityEffectRec.ActionRace)
                                        {
                                            flag4 = true;
                                            break;
                                        }
                                    }
                                }
                            }
                            if (!flag4)
                            {
                                return(true);
                            }
                            break;
                        }

                    case 6u:
                        if ((float)missionDuration < garrAbilityEffectRec.ActionHours * 3600f)
                        {
                            return(true);
                        }
                        break;

                    case 7u:
                        if ((float)missionDuration > garrAbilityEffectRec.ActionHours * 3600f)
                        {
                            return(true);
                        }
                        break;

                    case 9u:
                        {
                            GarrMissionRec record4 = StaticDB.garrMissionDB.GetRecord(garrMissionID);
                            if (record4 != null && record4.TravelDuration < garrAbilityEffectRec.ActionHours * 3600f)
                            {
                                return(true);
                            }
                            break;
                        }

                    case 10u:
                        {
                            GarrMissionRec record5 = StaticDB.garrMissionDB.GetRecord(garrMissionID);
                            if (record5 != null && record5.TravelDuration > garrAbilityEffectRec.ActionHours * 3600f)
                            {
                                return(true);
                            }
                            break;
                        }

                    case 12u:
                        return(true);
                    }
                    if (!abilityIDList.Contains(garrAbilityRec.ID))
                    {
                        abilityIDList.Add(garrAbilityRec.ID);
                    }
                    return(true);
                });
            }
        }
        return(abilityIDList.ToArray());
    }
Exemplo n.º 14
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.º 15
0
        public static int[] GetBuffsForCurrentMission(int garrFollowerID, int garrMissionID, GameObject missionFollowerSlotGroup, int missionDuration)
        {
            HashSet <int> nums = new HashSet <int>();

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

            for (int i = 0; i < item.AbilityIDs.Count; i++)
            {
                GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(item.AbilityIDs[i]);
                if (record != null)
                {
                    foreach (GarrAbilityEffectRec recordsByParentID in StaticDB.garrAbilityEffectDB.GetRecordsByParentID(record.ID))
                    {
                        bool flag          = false;
                        uint abilityAction = recordsByParentID.AbilityAction;
                        switch (abilityAction)
                        {
                        case 0:
                        {
                            break;
                        }

                        case 1:
                        {
                            MissionFollowerSlot[] componentsInChildren = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
                            int num = 0;
                            MissionFollowerSlot[] missionFollowerSlotArray = componentsInChildren;
                            for (int j = 0; j < (int)missionFollowerSlotArray.Length; j++)
                            {
                                if (missionFollowerSlotArray[j].GetCurrentGarrFollowerID() > 0)
                                {
                                    num++;
                                }
                            }
                            flag = num == 1;
                            break;
                        }

                        case 5:
                        {
                            MissionFollowerSlot[] componentsInChildren1 = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
                            bool flag1 = false;
                            MissionFollowerSlot[] missionFollowerSlotArray1 = componentsInChildren1;
                            for (int k = 0; k < (int)missionFollowerSlotArray1.Length; k++)
                            {
                                int currentGarrFollowerID = missionFollowerSlotArray1[k].GetCurrentGarrFollowerID();
                                if (currentGarrFollowerID > 0 && currentGarrFollowerID != item.GarrFollowerID)
                                {
                                    GarrFollowerRec garrFollowerRec = StaticDB.garrFollowerDB.GetRecord(currentGarrFollowerID);
                                    if (garrFollowerRec != null)
                                    {
                                        if ((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE ? garrFollowerRec.HordeGarrFollRaceID : garrFollowerRec.AllianceGarrFollRaceID) == recordsByParentID.ActionRace)
                                        {
                                            flag1 = true;
                                            break;
                                        }
                                    }
                                }
                            }
                            flag = flag1;
                            break;
                        }

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

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

                        case 9:
                        {
                            GarrMissionRec garrMissionRec = StaticDB.garrMissionDB.GetRecord(garrMissionID);
                            flag = (garrMissionRec == null ? false : (float)((float)garrMissionRec.TravelDuration) >= (float)((float)recordsByParentID.ActionHours) * 3600f);
                            break;
                        }

                        case 10:
                        {
                            GarrMissionRec record1 = StaticDB.garrMissionDB.GetRecord(garrMissionID);
                            flag = (record1 == null ? false : (float)((float)record1.TravelDuration) <= (float)((float)recordsByParentID.ActionHours) * 3600f);
                            break;
                        }

                        case 12:
                        {
                            break;
                        }

                        default:
                        {
                            switch (abilityAction)
                            {
                            case 22:
                            {
                                MissionFollowerSlot[] componentsInChildren2 = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
                                bool flag2 = false;
                                MissionFollowerSlot[] missionFollowerSlotArray2 = componentsInChildren2;
                                for (int l = 0; l < (int)missionFollowerSlotArray2.Length; l++)
                                {
                                    int currentGarrFollowerID1 = missionFollowerSlotArray2[l].GetCurrentGarrFollowerID();
                                    if (currentGarrFollowerID1 > 0 && currentGarrFollowerID1 != item.GarrFollowerID)
                                    {
                                        GarrFollowerRec garrFollowerRec1 = StaticDB.garrFollowerDB.GetRecord(currentGarrFollowerID1);
                                        if (garrFollowerRec1 != null)
                                        {
                                            if ((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE ? garrFollowerRec1.HordeGarrClassSpecID : garrFollowerRec1.AllianceGarrClassSpecID) == recordsByParentID.ActionRecordID)
                                            {
                                                flag2 = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                flag = flag2;
                                break;
                            }

                            case 23:
                            {
                                bool flag3 = false;
                                if (PersistentMissionData.missionDictionary.ContainsKey(garrMissionID))
                                {
                                    WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[garrMissionID];
                                    for (int m = 0; m < wrapperGarrisonMission.Encounters.Count; m++)
                                    {
                                        int num1 = 0;
                                        while (num1 < wrapperGarrisonMission.Encounters[m].MechanicIDs.Count)
                                        {
                                            GarrMechanicDB           garrMechanicDB           = StaticDB.garrMechanicDB;
                                            WrapperGarrisonEncounter wrapperGarrisonEncounter = wrapperGarrisonMission.Encounters[m];
                                            GarrMechanicRec          garrMechanicRec          = garrMechanicDB.GetRecord(wrapperGarrisonEncounter.MechanicIDs[num1]);
                                            if (garrMechanicRec == null || recordsByParentID.GarrMechanicTypeID != garrMechanicRec.GarrMechanicTypeID)
                                            {
                                                num1++;
                                            }
                                            else
                                            {
                                                flag3 = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                flag = flag3;
                                break;
                            }

                            case 26:
                            {
                                MissionFollowerSlot[] componentsInChildren3 = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
                                bool flag4 = false;
                                MissionFollowerSlot[] missionFollowerSlotArray3 = componentsInChildren3;
                                int num2 = 0;
                                while (num2 < (int)missionFollowerSlotArray3.Length)
                                {
                                    int currentGarrFollowerID2 = missionFollowerSlotArray3[num2].GetCurrentGarrFollowerID();
                                    if (currentGarrFollowerID2 <= 0 || currentGarrFollowerID2 == item.GarrFollowerID || (ulong)recordsByParentID.ActionRecordID != (long)currentGarrFollowerID2)
                                    {
                                        num2++;
                                    }
                                    else
                                    {
                                        flag4 = true;
                                        break;
                                    }
                                }
                                flag = flag4;
                                break;
                            }

                            default:
                            {
                                if (abilityAction == 37)
                                {
                                }
                                break;
                            }
                            }
                            break;
                        }
                        }
                        if (!flag)
                        {
                            continue;
                        }
                        nums.Add(record.ID);
                    }
                }
                else
                {
                    Debug.Log(string.Concat(new object[] { "Invalid Ability ID ", item.AbilityIDs[i], " from follower ", item.GarrFollowerID }));
                }
            }
            return(nums.ToArray <int>());
        }