Esempio n. 1
0
    public void SetFollower(JamGarrisonFollower oldFollower, JamGarrisonFollower newFollower, float initialEffectDelay)
    {
        this.m_followerID = oldFollower.GarrFollowerID;
        bool flag = (oldFollower.Flags & 8) != 0;

        if (flag)
        {
            JamGarrisonFollower jamGarrisonFollower = newFollower;
            if (jamGarrisonFollower == null)
            {
                jamGarrisonFollower = new JamGarrisonFollower();
                jamGarrisonFollower.GarrFollowerID = oldFollower.GarrFollowerID;
                jamGarrisonFollower.Quality        = oldFollower.Quality;
                jamGarrisonFollower.Durability     = 0;
            }
            this.SetFollowerAppearance(jamGarrisonFollower, false, false, true, initialEffectDelay);
            return;
        }
        this.m_showedLevelUpEffect = false;
        bool isMaxLevelAndMaxQuality = false;
        bool nextCapIsForQuality     = false;

        GeneralHelpers.GetXpCapInfo(oldFollower.FollowerLevel, oldFollower.Quality, out this.m_currentCap, out nextCapIsForQuality, out isMaxLevelAndMaxQuality);
        this.SetFollowerAppearance(oldFollower, nextCapIsForQuality, isMaxLevelAndMaxQuality, false, initialEffectDelay);
        GeneralHelpers.GetXpCapInfo(newFollower.FollowerLevel, newFollower.Quality, out this.m_newCap, out this.m_newCapIsQuality, out this.m_newFollowerIsMaxLevelAndMaxQuality);
        this.m_fancyNumberDisplay.SetValue((int)(this.m_currentCap - (uint)oldFollower.Xp), true, 0f);
        if (oldFollower.FollowerLevel != newFollower.FollowerLevel || oldFollower.Quality != newFollower.Quality)
        {
            this.m_fancyNumberDisplay.SetValue(0, initialEffectDelay);
        }
        else
        {
            this.m_fancyNumberDisplay.SetValue((int)(this.m_currentCap - (uint)newFollower.Xp), initialEffectDelay);
        }
    }
    public void SetArmament(MobileFollowerArmament item, FollowerDetailView followerDetailView)
    {
        this.m_armamentItem       = item;
        this.m_followerDetailView = followerDetailView;
        ItemRec record = StaticDB.itemDB.GetRecord(item.ItemID);

        this.m_equipmentName.set_text(GeneralHelpers.GetItemQualityColorTag(record.OverallQualityID) + record.Display + "</color>");
        SpellTooltipRec record2 = StaticDB.spellTooltipDB.GetRecord(item.SpellID);

        if (record2 != null)
        {
            this.m_equipmentDescription.set_text(record2.Description);
        }
        else
        {
            this.m_equipmentDescription.set_text(string.Concat(new object[]
            {
                "ERROR. Unknown Spell ID: ",
                item.SpellID,
                " Item ID:",
                item.ItemID
            }));
        }
        this.m_equipmentDescription.set_text(WowTextParser.parser.Parse(this.m_equipmentDescription.get_text(), item.SpellID));
        this.m_equipmentDescription.set_supportRichText(WowTextParser.parser.IsRichText());
        if (this.m_iconErrorText != null)
        {
            this.m_iconErrorText.get_gameObject().SetActive(false);
        }
        Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID);

        if (sprite != null)
        {
            this.m_equipmentIcon.set_sprite(sprite);
        }
        else if (this.m_iconErrorText != null)
        {
            this.m_iconErrorText.get_gameObject().SetActive(true);
            this.m_iconErrorText.set_text(string.Empty + record.IconFileDataID);
        }
        this.m_equipmentQuantity.set_text((item.Quantity <= 1) ? string.Empty : (string.Empty + item.Quantity));
        JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary.get_Item(this.m_followerDetailView.GetCurrentFollower());

        if (jamGarrisonFollower != null && jamGarrisonFollower.CurrentMissionID != 0)
        {
            this.m_useItemButtonLabel.set_text(StaticDB.GetString("ON_MISSION", null));
            this.m_useItemButtonLabel.set_color(new Color(0.5f, 0.5f, 0.5f, 1f));
            this.m_useItemButton.set_interactable(false);
        }
        else if (jamGarrisonFollower != null && (jamGarrisonFollower.ItemLevelArmor + jamGarrisonFollower.ItemLevelWeapon) / 2 >= 850)
        {
            this.m_useItemButtonLabel.set_text(FollowerInventoryListItem.m_maxiLevelString);
            this.m_useItemButtonLabel.set_color(new Color(0.5f, 0.5f, 0.5f, 1f));
            this.m_useItemButton.set_interactable(false);
        }
        else
        {
            this.m_useItemButtonLabel.set_text(StaticDB.GetString("USE_ITEM", null));
        }
    }
    public void HandleFollowerDataChanged()
    {
        if (!this.m_popupView.activeSelf)
        {
            return;
        }
        FollowerExperienceDisplay[] componentsInChildren = this.m_followerExperienceDisplayArea.GetComponentsInChildren <FollowerExperienceDisplay>(true);
        int num = 0;

        foreach (FollowerExperienceDisplay followerExperienceDisplay in componentsInChildren)
        {
            JamGarrisonFollower jamGarrisonFollower = null;
            if (PersistentFollowerData.preMissionFollowerDictionary.ContainsKey(followerExperienceDisplay.GetFollowerID()))
            {
                jamGarrisonFollower = PersistentFollowerData.preMissionFollowerDictionary[followerExperienceDisplay.GetFollowerID()];
            }
            JamGarrisonFollower newFollower = null;
            if (PersistentFollowerData.followerDictionary.ContainsKey(followerExperienceDisplay.GetFollowerID()))
            {
                newFollower = PersistentFollowerData.followerDictionary[followerExperienceDisplay.GetFollowerID()];
            }
            if (jamGarrisonFollower != null)
            {
                float initialEffectDelay = (float)num * this.m_experienceDisplayEntranceDelay;
                followerExperienceDisplay.SetFollower(jamGarrisonFollower, newFollower, initialEffectDelay);
                num++;
            }
        }
    }
Esempio n. 4
0
    public void HandleFollowerDataChanged()
    {
        if (!this.m_popupView.get_activeSelf())
        {
            return;
        }
        FollowerExperienceDisplay[] componentsInChildren = this.m_followerExperienceDisplayArea.GetComponentsInChildren <FollowerExperienceDisplay>(true);
        int num = 0;

        FollowerExperienceDisplay[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            FollowerExperienceDisplay followerExperienceDisplay = array[i];
            JamGarrisonFollower       jamGarrisonFollower       = null;
            if (PersistentFollowerData.preMissionFollowerDictionary.ContainsKey(followerExperienceDisplay.GetFollowerID()))
            {
                jamGarrisonFollower = PersistentFollowerData.preMissionFollowerDictionary.get_Item(followerExperienceDisplay.GetFollowerID());
            }
            JamGarrisonFollower newFollower = null;
            if (PersistentFollowerData.followerDictionary.ContainsKey(followerExperienceDisplay.GetFollowerID()))
            {
                newFollower = PersistentFollowerData.followerDictionary.get_Item(followerExperienceDisplay.GetFollowerID());
            }
            if (jamGarrisonFollower != null)
            {
                float initialEffectDelay = (float)num * this.m_experienceDisplayEntranceDelay;
                followerExperienceDisplay.SetFollower(jamGarrisonFollower, newFollower, initialEffectDelay);
                num++;
            }
        }
    }
Esempio n. 5
0
    private void SetFillValue(int newXPRemainingUntilNextLevel)
    {
        if (newXPRemainingUntilNextLevel == 0 && this.m_currentCap != this.m_newCap)
        {
            if (!this.m_showedLevelUpEffect)
            {
                Main.instance.m_UISound.Play_ChampionLevelUp();
                UiAnimMgr.instance.PlayAnim("FlameGlowPulse", this.m_followerPortrait.get_transform(), Vector3.get_zero(), 2f, 0f);
                UiAnimMgr.instance.PlayAnim("MinimapPulseAnim", this.m_followerPortrait.get_transform(), Vector3.get_zero(), 2f, 0f);
                this.m_showedLevelUpEffect = true;
            }
            JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary.get_Item(this.m_followerID);
            this.SetFollowerAppearance(jamGarrisonFollower, this.m_newCapIsQuality, this.m_newFollowerIsMaxLevelAndMaxQuality, false, 0f);
            this.m_currentCap = this.m_newCap;
            this.m_fancyNumberDisplay.SetValue((int)this.m_newCap, true, 0f);
            this.m_fancyNumberDisplay.SetValue((int)(this.m_newCap - (uint)jamGarrisonFollower.Xp), 0f);
        }
        this.m_xpAmountText.set_text(string.Concat(new object[]
        {
            string.Empty,
            (long)((ulong)this.m_currentCap - (ulong)((long)newXPRemainingUntilNextLevel)),
            "\\",
            this.m_currentCap
        }));
        float fillAmount = Mathf.Clamp01((float)((ulong)this.m_currentCap - (ulong)((long)newXPRemainingUntilNextLevel)) / this.m_currentCap);

        this.m_progressBarFillImage.set_fillAmount(fillAmount);
    }
Esempio n. 6
0
    public static FollowerStatus GetFollowerStatus(JamGarrisonFollower follower)
    {
        bool flag = (follower.Flags & 4) != 0;

        if (flag)
        {
            return(FollowerStatus.inactive);
        }
        bool flag2 = (follower.Flags & 2) != 0;

        if (flag2)
        {
            return(FollowerStatus.fatigued);
        }
        bool flag3 = follower.CurrentBuildingID != 0;

        if (flag3)
        {
            return(FollowerStatus.inBuilding);
        }
        bool flag4 = follower.CurrentMissionID != 0;

        if (flag4)
        {
            return(FollowerStatus.onMission);
        }
        return(FollowerStatus.available);
    }
    private void InitEquipmentSlots(JamGarrisonFollower follower)
    {
        AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true);
        for (int i = 0; i < componentsInChildren.Length; i++)
        {
            Object.DestroyImmediate(componentsInChildren[i].get_gameObject());
        }
        bool flag  = false;
        bool flag2 = true;

        for (int j = 0; j < follower.AbilityID.Length; j++)
        {
            GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(follower.AbilityID[j]);
            if ((record.Flags & 1u) != 0u)
            {
                flag = true;
                GameObject gameObject = Object.Instantiate <GameObject>(this.m_equipmentSlotPrefab);
                gameObject.get_transform().SetParent(this.m_equipmentSlotsRootObject.get_transform(), false);
                AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>();
                component.SetAbility(follower.AbilityID[j], true, true, this);
            }
        }
        bool            flag3   = (follower.Flags & 8) != 0;
        GarrFollowerRec record2 = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

        if (flag3 || follower.FollowerLevel < MissionDetailView.GarrisonFollower_GetMaxFollowerLevel((int)record2.GarrFollowerTypeID))
        {
            flag2 = false;
        }
        this.m_equipmentSlotsText.get_gameObject().SetActive(flag || flag2);
    }
 private void HandleUseEquipmentResult(JamGarrisonFollower oldFollower, JamGarrisonFollower newFollower)
 {
     if (this.m_garrFollowerID != newFollower.GarrFollowerID)
     {
         return;
     }
     int[] abilityID = newFollower.AbilityID;
     for (int i = 0; i < abilityID.Length; i++)
     {
         int            num    = abilityID[i];
         GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(num);
         if ((record.Flags & 1u) != 0u)
         {
             bool  flag       = true;
             int[] abilityID2 = oldFollower.AbilityID;
             for (int j = 0; j < abilityID2.Length; j++)
             {
                 int num2 = abilityID2[j];
                 if (num2 == num)
                 {
                     flag = false;
                     break;
                 }
             }
             if (flag)
             {
                 AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true);
                 AbilityDisplay[] array = componentsInChildren;
                 for (int k = 0; k < array.Length; k++)
                 {
                     AbilityDisplay abilityDisplay = array[k];
                     bool           flag2          = true;
                     int[]          abilityID3     = newFollower.AbilityID;
                     for (int l = 0; l < abilityID3.Length; l++)
                     {
                         int num3 = abilityID3[l];
                         if (abilityDisplay.GetAbilityID() == num3)
                         {
                             flag2 = false;
                             break;
                         }
                     }
                     if (flag2)
                     {
                         Debug.Log(string.Concat(new object[]
                         {
                             "New ability is ",
                             num,
                             " replacing ability ID ",
                             abilityDisplay.GetAbilityID()
                         }));
                         abilityDisplay.SetAbility(num, true, true, this);
                         Main.instance.m_UISound.Play_UpgradeEquipment();
                         UiAnimMgr.instance.PlayAnim("FlameGlowPulse", abilityDisplay.get_transform(), Vector3.get_zero(), 2f, 0f);
                     }
                 }
             }
         }
     }
 }
    private FollowerListItem InsertFollowerIntoListView(JamGarrisonFollower follower)
    {
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

        if (record == null)
        {
            return(null);
        }
        if (record.GarrFollowerTypeID != 4u)
        {
            return(null);
        }
        if (this.m_isCombatAllyList)
        {
            bool           flag           = (follower.Flags & 8) != 0;
            FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(follower);
            if (flag || follower.ZoneSupportSpellID <= 0 || followerStatus == FollowerStatus.inactive || followerStatus == FollowerStatus.fatigued || followerStatus == FollowerStatus.inBuilding)
            {
                return(null);
            }
        }
        GameObject gameObject = Object.Instantiate <GameObject>(this.m_followerListItemPrefab);

        gameObject.get_transform().SetParent(this.m_followerListViewContents.get_transform());
        gameObject.get_transform().set_localScale(Vector3.get_one());
        gameObject.get_transform().set_localPosition(Vector3.get_zero());
        FollowerListItem component = gameObject.GetComponent <FollowerListItem>();

        component.SetFollower(follower);
        AutoHide autoHide = gameObject.AddComponent <AutoHide>();

        autoHide.m_clipRT = base.get_gameObject().GetComponent <RectTransform>();
        return(component);
    }
    private FollowerListItem InsertFollowerIntoListView(JamGarrisonFollower follower)
    {
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

        if (record == null)
        {
            return(null);
        }
        if (record.GarrFollowerTypeID != 4u)
        {
            return(null);
        }
        if (this.m_isCombatAllyList)
        {
            bool           flag           = (follower.Flags & 8) != 0;
            FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(follower);
            if (flag || follower.ZoneSupportSpellID <= 0 || followerStatus == FollowerStatus.inactive || followerStatus == FollowerStatus.fatigued || followerStatus == FollowerStatus.inBuilding)
            {
                return(null);
            }
        }
        GameObject gameObject = Object.Instantiate <GameObject>(this.m_followerListItemPrefab);

        gameObject.get_transform().SetParent(this.m_followerListViewContents.get_transform(), false);
        FollowerListItem component = gameObject.GetComponent <FollowerListItem>();

        component.SetFollower(follower);
        return(component);
    }
Esempio n. 11
0
    public static List <int> GetUsefulBuffAbilitiesForFollower(int garrFollowerID)
    {
        List <int>          usefulBuffAbilityIDs = new List <int>();
        JamGarrisonFollower jamGarrisonFollower  = PersistentFollowerData.followerDictionary[garrFollowerID];

        int[] abilityID2 = jamGarrisonFollower.AbilityID;
        for (int i = 0; i < abilityID2.Length; i++)
        {
            int            abilityID = abilityID2[i];
            GarrAbilityRec record    = StaticDB.garrAbilityDB.GetRecord(abilityID);
            if (record != null)
            {
                if ((record.Flags & 1024u) != 0u)
                {
                    StaticDB.garrAbilityEffectDB.EnumRecordsByParentID(abilityID, delegate(GarrAbilityEffectRec garrAbilityEffectRec)
                    {
                        if (garrAbilityEffectRec.AbilityAction == 0u)
                        {
                            return(true);
                        }
                        usefulBuffAbilityIDs.Add(abilityID);
                        return(true);
                    });
                }
            }
        }
        return(usefulBuffAbilityIDs);
    }
Esempio n. 12
0
 private void AddToParty(bool forceReplaceFirstSlot = false)
 {
     if (this.m_availableForMission)
     {
         MissionFollowerSlotGroup componentInChildren = base.gameObject.transform.parent.parent.parent.parent.gameObject.GetComponentInChildren <MissionFollowerSlotGroup>();
         if (componentInChildren != null && componentInChildren.gameObject.activeSelf)
         {
             this.m_inParty = componentInChildren.SetFollower(this.m_followerID, this.followerPortrait.overrideSprite, this.m_portraitQualityRing.color, forceReplaceFirstSlot);
             if (this.m_inParty)
             {
                 JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary[this.m_followerID];
                 bool flag = (jamGarrisonFollower.Flags & 8) != 0;
                 if (flag)
                 {
                     Main.instance.m_UISound.Play_SlotTroop();
                 }
                 else
                 {
                     Main.instance.m_UISound.Play_SlotChampion();
                 }
             }
             else
             {
                 Main.instance.m_UISound.Play_DefaultNavClick();
                 this.DeselectMe();
             }
             this.SetAvailabilityStatus(PersistentFollowerData.followerDictionary[this.m_followerID]);
         }
     }
 }
 public static void CachePreMissionFollower(JamGarrisonFollower follower)
 {
     if (PersistentFollowerData.instance.m_preMissionFollowerDictionary.ContainsKey(follower.GarrFollowerID))
     {
         PersistentFollowerData.instance.m_preMissionFollowerDictionary.Remove(follower.GarrFollowerID);
     }
     PersistentFollowerData.instance.m_preMissionFollowerDictionary.Add(follower.GarrFollowerID, follower);
 }
Esempio n. 14
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);
                    }
                }
            }
        }
    }
 private void InitFollowerList()
 {
     FollowerListItem[] componentsInChildren = this.m_followerListViewContents.GetComponentsInChildren <FollowerListItem>(true);
     FollowerListItem[] array = componentsInChildren;
     for (int i = 0; i < array.Length; i++)
     {
         FollowerListItem followerListItem = array[i];
         if (!PersistentFollowerData.followerDictionary.ContainsKey(followerListItem.m_followerID))
         {
             followerListItem.get_gameObject().SetActive(false);
             followerListItem.get_transform().SetParent(Main.instance.get_transform());
         }
         else
         {
             JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary.get_Item(followerListItem.m_followerID);
             bool flag = (jamGarrisonFollower.Flags & 8) != 0;
             if (flag && jamGarrisonFollower.Durability <= 0)
             {
                 followerListItem.get_gameObject().SetActive(false);
                 followerListItem.get_transform().SetParent(Main.instance.get_transform());
             }
             else
             {
                 followerListItem.SetFollower(jamGarrisonFollower);
             }
         }
     }
     this.m_followerListViewContents.get_transform().set_localPosition(new Vector3(this.m_followerListViewContents.get_transform().get_localPosition().x, 0f, this.m_followerListViewContents.get_transform().get_localPosition().z));
     this.SortFollowerListData();
     componentsInChildren = this.m_followerListViewContents.GetComponentsInChildren <FollowerListItem>(true);
     using (List <KeyValuePair <int, JamGarrisonFollower> > .Enumerator enumerator = this.m_sortedFollowerList.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             KeyValuePair <int, JamGarrisonFollower> current = enumerator.get_Current();
             bool flag2 = false;
             FollowerListItem[] array2 = componentsInChildren;
             for (int j = 0; j < array2.Length; j++)
             {
                 FollowerListItem followerListItem2 = array2[j];
                 if (followerListItem2.m_followerID == current.get_Value().GarrFollowerID)
                 {
                     flag2 = true;
                     break;
                 }
             }
             if (!flag2)
             {
                 bool flag3 = (current.get_Value().Flags & 8) != 0;
                 if (!flag3 || current.get_Value().Durability > 0)
                 {
                     this.InsertFollowerIntoListView(current.get_Value());
                 }
             }
         }
     }
 }
Esempio n. 16
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);
                }
            }
        }
    }
    private void InsertFollowerIntoListView(JamGarrisonFollower follower, FollowerCategory followerCategory)
    {
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

        if (record == null)
        {
            return;
        }
        if (record.GarrFollowerTypeID != 4u)
        {
            return;
        }
        bool           flag           = (follower.Flags & 8) != 0;
        bool           flag2          = !flag;
        FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(follower);

        switch (followerCategory)
        {
        case FollowerCategory.ActiveChampion:
            if (!flag2 || followerStatus == FollowerStatus.inactive)
            {
                return;
            }
            break;

        case FollowerCategory.InactiveChampion:
            if (!flag2 || followerStatus != FollowerStatus.inactive)
            {
                return;
            }
            break;

        case FollowerCategory.Troop:
            if (!flag || follower.Durability <= 0)
            {
                return;
            }
            break;

        default:
            return;
        }
        FollowerListItem followerListItem = Object.Instantiate <FollowerListItem>(this.m_followerDetailListItemPrefab);

        followerListItem.get_transform().SetParent(this.m_followerDetailListContent.get_transform(), false);
        followerListItem.SetFollower(follower);
        AutoHide autoHide = followerListItem.m_followerDetailView.get_gameObject().AddComponent <AutoHide>();

        autoHide.m_clipRT = this.m_panelViewRT;
        AutoHide autoHide2 = followerListItem.m_listItemArea.get_gameObject().AddComponent <AutoHide>();

        autoHide2.m_clipRT = this.m_panelViewRT;
    }
Esempio n. 18
0
    private void MobileClientGarrisonDataRequestResultHandler(MobileClientGarrisonDataRequestResult msg)
    {
        PersistentFollowerData.ClearData();
        PersistentMissionData.ClearData();
        PersistentTalentData.ClearData();
        if (this.GarrisonDataResetStartedAction != null)
        {
            this.GarrisonDataResetStartedAction.Invoke();
        }
        GarrisonStatus.SetFaction(msg.PvpFaction);
        GarrisonStatus.SetGarrisonServerConnectTime(msg.ServerTime);
        GarrisonStatus.SetCurrencies(msg.GoldCurrency, msg.OilCurrency, msg.OrderhallResourcesCurrency);
        GarrisonStatus.SetCharacterName(msg.CharacterName);
        GarrisonStatus.SetCharacterLevel(msg.CharacterLevel);
        GarrisonStatus.SetCharacterClass(msg.CharacterClassID);
        uint num = 0u;

        while ((ulong)num < (ulong)((long)msg.Follower.GetLength(0)))
        {
            JamGarrisonFollower jamGarrisonFollower = msg.Follower[(int)((UIntPtr)num)];
            PersistentFollowerData.AddOrUpdateFollower(jamGarrisonFollower);
            bool flag = (jamGarrisonFollower.Flags & 8) != 0;
            if (flag && jamGarrisonFollower.Durability <= 0)
            {
                Debug.Log("Follower " + jamGarrisonFollower.GarrFollowerID + " has expired.");
                if (this.TroopExpiredAction != null)
                {
                    this.TroopExpiredAction.Invoke(jamGarrisonFollower);
                }
            }
            num += 1u;
        }
        uint num2 = 0u;

        while ((ulong)num2 < (ulong)((long)msg.Mission.GetLength(0)))
        {
            PersistentMissionData.AddMission(msg.Mission[(int)((UIntPtr)num2)]);
            num2 += 1u;
        }
        for (int i = 0; i < msg.Talent.GetLength(0); i++)
        {
            PersistentTalentData.AddOrUpdateTalent(msg.Talent[i]);
        }
        if (this.GarrisonDataResetFinishedAction != null)
        {
            this.GarrisonDataResetFinishedAction.Invoke();
        }
        if (this.FollowerDataChangedAction != null)
        {
            this.FollowerDataChangedAction.Invoke();
        }
    }
Esempio n. 19
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 HandleUseEquipmentResult(JamGarrisonFollower oldFollower, JamGarrisonFollower newFollower)
 {
     if (this.m_garrFollowerID != newFollower.GarrFollowerID)
     {
         return;
     }
     foreach (int num in newFollower.AbilityID)
     {
         GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(num);
         if ((record.Flags & 1u) != 0u)
         {
             bool flag = true;
             foreach (int num2 in oldFollower.AbilityID)
             {
                 if (num2 == num)
                 {
                     flag = false;
                     break;
                 }
             }
             if (flag)
             {
                 AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true);
                 foreach (AbilityDisplay abilityDisplay in componentsInChildren)
                 {
                     bool flag2 = true;
                     foreach (int num3 in newFollower.AbilityID)
                     {
                         if (abilityDisplay.GetAbilityID() == num3)
                         {
                             flag2 = false;
                             break;
                         }
                     }
                     if (flag2)
                     {
                         Debug.Log(string.Concat(new object[]
                         {
                             "New ability is ",
                             num,
                             " replacing ability ID ",
                             abilityDisplay.GetAbilityID()
                         }));
                         abilityDisplay.SetAbility(num, true, true, this);
                         Main.instance.m_UISound.Play_UpgradeEquipment();
                         UiAnimMgr.instance.PlayAnim("FlameGlowPulse", abilityDisplay.transform, Vector3.zero, 2f, 0f);
                     }
                 }
             }
         }
     }
 }
Esempio n. 21
0
 private void HandleUseArmamentResult(int result, JamGarrisonFollower oldFollower, JamGarrisonFollower newFollower)
 {
     if (result != 0)
     {
         return;
     }
     if (newFollower.GarrFollowerID != this.m_followerID)
     {
         return;
     }
     this.SetAvailabilityStatus(newFollower);
     UiAnimMgr.instance.PlayAnim("FlameGlowPulse", this.followerPortraitFrame.transform, Vector3.zero, 1.5f, 0f);
     Main.instance.m_UISound.Play_UpgradeArmament();
 }
Esempio n. 22
0
 public void InitFollowerList()
 {
     FollowerListItem[] componentsInChildren = this.m_followerListViewContents.GetComponentsInChildren <FollowerListItem>(true);
     foreach (FollowerListItem followerListItem in componentsInChildren)
     {
         if (!PersistentFollowerData.followerDictionary.ContainsKey(followerListItem.m_followerID))
         {
             followerListItem.gameObject.SetActive(false);
             followerListItem.transform.SetParent(Main.instance.transform);
         }
         else
         {
             JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary[followerListItem.m_followerID];
             bool flag = (jamGarrisonFollower.Flags & 8) != 0;
             if (flag && jamGarrisonFollower.Durability <= 0)
             {
                 followerListItem.gameObject.SetActive(false);
                 followerListItem.transform.SetParent(Main.instance.transform);
             }
             else
             {
                 followerListItem.SetFollower(jamGarrisonFollower);
             }
         }
     }
     this.m_followerListViewContents.transform.localPosition = new Vector3(this.m_followerListViewContents.transform.localPosition.x, 0f, this.m_followerListViewContents.transform.localPosition.z);
     this.SortFollowerListData();
     componentsInChildren = this.m_followerListViewContents.GetComponentsInChildren <FollowerListItem>(true);
     foreach (KeyValuePair <int, JamGarrisonFollower> keyValuePair in this.m_sortedFollowerList)
     {
         bool flag2 = false;
         foreach (FollowerListItem followerListItem2 in componentsInChildren)
         {
             if (followerListItem2.m_followerID == keyValuePair.Value.GarrFollowerID)
             {
                 flag2 = true;
                 break;
             }
         }
         if (!flag2)
         {
             bool flag3 = (keyValuePair.Value.Flags & 8) != 0;
             if (!flag3 || keyValuePair.Value.Durability > 0)
             {
                 this.InsertFollowerIntoListView(keyValuePair.Value);
             }
         }
     }
 }
Esempio n. 23
0
    public void Test()
    {
        JamGarrisonFollower jamGarrisonFollower  = new JamGarrisonFollower();
        JamGarrisonFollower jamGarrisonFollower2 = new JamGarrisonFollower();

        jamGarrisonFollower.Quality         = 1;
        jamGarrisonFollower.FollowerLevel   = 108;
        jamGarrisonFollower.Xp              = 2400;
        jamGarrisonFollower.GarrFollowerID  = 616;
        jamGarrisonFollower2.Quality        = 1;
        jamGarrisonFollower2.FollowerLevel  = 109;
        jamGarrisonFollower2.Xp             = 124;
        jamGarrisonFollower2.GarrFollowerID = 616;
        this.m_testXPDisplay[0].SetFollower(jamGarrisonFollower, jamGarrisonFollower2, 0f);
        JamGarrisonFollower jamGarrisonFollower3 = new JamGarrisonFollower();
        JamGarrisonFollower jamGarrisonFollower4 = new JamGarrisonFollower();

        jamGarrisonFollower3.Quality        = 2;
        jamGarrisonFollower3.FollowerLevel  = 109;
        jamGarrisonFollower3.Xp             = 2650;
        jamGarrisonFollower3.GarrFollowerID = 621;
        jamGarrisonFollower4.Quality        = 2;
        jamGarrisonFollower4.FollowerLevel  = 110;
        jamGarrisonFollower4.Xp             = 777;
        jamGarrisonFollower4.GarrFollowerID = 621;
        this.m_testXPDisplay[1].SetFollower(jamGarrisonFollower3, jamGarrisonFollower4, 0.5f);
        JamGarrisonFollower jamGarrisonFollower5 = new JamGarrisonFollower();
        JamGarrisonFollower jamGarrisonFollower6 = new JamGarrisonFollower();

        jamGarrisonFollower5.Quality        = 3;
        jamGarrisonFollower5.FollowerLevel  = 110;
        jamGarrisonFollower5.Xp             = 57000;
        jamGarrisonFollower5.GarrFollowerID = 617;
        jamGarrisonFollower6.Quality        = 4;
        jamGarrisonFollower6.FollowerLevel  = 110;
        jamGarrisonFollower6.Xp             = 0;
        jamGarrisonFollower6.GarrFollowerID = 617;
        this.m_testXPDisplay[2].SetFollower(jamGarrisonFollower5, jamGarrisonFollower6, 1f);
        JamGarrisonFollower jamGarrisonFollower7 = new JamGarrisonFollower();

        jamGarrisonFollower7.Quality        = 3;
        jamGarrisonFollower7.FollowerLevel  = 110;
        jamGarrisonFollower7.Xp             = 57000;
        jamGarrisonFollower7.GarrFollowerID = 729;
        jamGarrisonFollower7.Flags          = 8;
        jamGarrisonFollower7.Durability     = 0;
        this.m_testXPDisplay[3].SetFollower(jamGarrisonFollower7, null, 1.5f);
    }
Esempio n. 24
0
    public void ExpandDetailViewComplete()
    {
        RectTransform component = this.m_followerDetailView.traitsAndAbilitiesRootObject.GetComponent <RectTransform>();

        this.m_followerDetailViewLayoutElement.set_minHeight(component.get_rect().get_height() + (float)this.m_followerDetailViewExtraHeight);
        JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary.get_Item(this.m_followerID);
        int             num    = (jamGarrisonFollower.ItemLevelWeapon + jamGarrisonFollower.ItemLevelArmor) / 2;
        bool            flag   = (jamGarrisonFollower.Flags & 8) != 0;
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(jamGarrisonFollower.GarrFollowerID);

        if (record != null && num < 850 && jamGarrisonFollower.FollowerLevel == MissionDetailView.GarrisonFollower_GetMaxFollowerLevel((int)record.GarrFollowerTypeID) && !flag)
        {
            this.m_useArmamentsButton.SetActive(true);
            this.m_statusText.get_gameObject().SetActive(false);
        }
    }
    private void InsertFollowerIntoListView(JamGarrisonFollower follower, FollowerCategory followerCategory)
    {
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

        if (record == null)
        {
            return;
        }
        if (record.GarrFollowerTypeID != 4u)
        {
            return;
        }
        bool           flag           = (follower.Flags & 8) != 0;
        bool           flag2          = !flag;
        FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(follower);

        switch (followerCategory)
        {
        case FollowerCategory.ActiveChampion:
            if (!flag2 || followerStatus == FollowerStatus.inactive)
            {
                return;
            }
            break;

        case FollowerCategory.InactiveChampion:
            if (!flag2 || followerStatus != FollowerStatus.inactive)
            {
                return;
            }
            break;

        case FollowerCategory.Troop:
            if (!flag || follower.Durability <= 0)
            {
                return;
            }
            break;

        default:
            return;
        }
        FollowerListItem followerListItem = Object.Instantiate <FollowerListItem>(this.m_followerDetailListItemPrefab);

        followerListItem.transform.SetParent(this.m_followerDetailListContent.transform, false);
        followerListItem.SetFollower(follower);
    }
Esempio n. 26
0
 private void CreateCombatAllyItems(int combatAllyMissionID, int combatAllyMissionCost)
 {
     using (Dictionary <int, JamGarrisonFollower> .ValueCollection.Enumerator enumerator = PersistentFollowerData.followerDictionary.get_Values().GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             JamGarrisonFollower current        = enumerator.get_Current();
             FollowerStatus      followerStatus = GeneralHelpers.GetFollowerStatus(current);
             if (current.ZoneSupportSpellID > 0 && (followerStatus == FollowerStatus.available || followerStatus == FollowerStatus.onMission))
             {
                 FollowerInventoryListItem followerInventoryListItem = Object.Instantiate <FollowerInventoryListItem>(this.m_combatAllyChampionListItemPrefab);
                 followerInventoryListItem.get_transform().SetParent(this.m_combatAllyListContent.get_transform(), false);
                 followerInventoryListItem.SetCombatAllyChampion(current, combatAllyMissionID, combatAllyMissionCost);
             }
         }
     }
 }
Esempio n. 27
0
 private void SetTroopSlotForExistingFollower(TroopSlot[] troopSlots, JamGarrisonFollower follower)
 {
     if (follower.Durability <= 0)
     {
         return;
     }
     foreach (TroopSlot troopSlot in troopSlots)
     {
         int ownedFollowerID = troopSlot.GetOwnedFollowerID();
         if (ownedFollowerID != 0 && ownedFollowerID == follower.GarrFollowerID)
         {
             return;
         }
     }
     foreach (TroopSlot troopSlot2 in troopSlots)
     {
         if (troopSlot2.IsCollected())
         {
             GarrFollowerRec record         = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);
             int             iconFileDataID = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID;
             troopSlot2.SetCharShipment(this.m_charShipmentRec.ID, 0UL, follower.GarrFollowerID, false, iconFileDataID);
             return;
         }
     }
     foreach (TroopSlot troopSlot3 in troopSlots)
     {
         if (troopSlot3.IsPendingCreate())
         {
             GarrFollowerRec record2         = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);
             int             iconFileDataID2 = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record2.AllianceIconFileDataID : record2.HordeIconFileDataID;
             troopSlot3.SetCharShipment(this.m_charShipmentRec.ID, 0UL, follower.GarrFollowerID, false, iconFileDataID2);
             return;
         }
     }
     foreach (TroopSlot troopSlot4 in troopSlots)
     {
         if (troopSlot4.IsEmpty())
         {
             GarrFollowerRec record3         = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);
             int             iconFileDataID3 = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record3.AllianceIconFileDataID : record3.HordeIconFileDataID;
             troopSlot4.SetCharShipment(this.m_charShipmentRec.ID, 0UL, follower.GarrFollowerID, false, iconFileDataID3);
             return;
         }
     }
 }
Esempio n. 28
0
    public void SetCombatAllyChampion(JamGarrisonFollower follower, int garrMissionID, int missionCost)
    {
        this.m_combatAllyMissionID = garrMissionID;
        this.m_combatAllyChampion  = follower;
        this.m_combatAllyAbilityDisplay.SetSpell(this.m_combatAllyChampion.ZoneSupportSpellID);
        this.m_combatAllySlot.SetFollower(follower.GarrFollowerID);
        GarrFollowerRec record  = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);
        CreatureRec     record2 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record.HordeCreatureID : record.AllianceCreatureID);

        if (follower.Quality == 6 && record.TitleName != null && record.TitleName.Length > 0)
        {
            this.m_combatAllyName.text = record.TitleName;
        }
        else if (record != null)
        {
            this.m_combatAllyName.text = record2.Name;
        }
        this.m_combatAllyName.color = GeneralHelpers.GetQualityColor(this.m_combatAllyChampion.Quality);
        if (missionCost <= GarrisonStatus.Resources())
        {
            this.m_useItemButtonLabel.text = StaticDB.GetString("ASSIGN_CHAMPION", null);
        }
        else
        {
            this.m_useItemButtonLabel.text    = StaticDB.GetString("CANT_AFFORD", "Can't Afford");
            this.m_useItemButtonLabel.color   = Color.red;
            this.m_useItemButton.interactable = false;
        }
        int numActiveChampions = GeneralHelpers.GetNumActiveChampions();
        int maxActiveFollowers = GarrisonStatus.GetMaxActiveFollowers();

        this.m_isOverMaxChampionSoftCap = false;
        this.m_needMoreResources        = false;
        if (numActiveChampions > maxActiveFollowers)
        {
            this.m_isOverMaxChampionSoftCap = true;
        }
        if (GarrisonStatus.Resources() < missionCost)
        {
            this.m_needMoreResources = true;
        }
        this.SetCombatAllyAvailabilityStatus();
    }
Esempio n. 29
0
    public static int GetNumTroops()
    {
        int num = 0;

        using (Dictionary <int, JamGarrisonFollower> .ValueCollection.Enumerator enumerator = PersistentFollowerData.followerDictionary.get_Values().GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                JamGarrisonFollower current = enumerator.get_Current();
                bool flag  = (current.Flags & 4) != 0;
                bool flag2 = (current.Flags & 8) != 0;
                if (!flag && flag2 && current.Durability > 0)
                {
                    num++;
                }
            }
        }
        return(num);
    }
Esempio n. 30
0
 private void InitEquipmentSlots(JamGarrisonFollower follower)
 {
     AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true);
     for (int i = 0; i < componentsInChildren.Length; i++)
     {
         Object.DestroyImmediate(componentsInChildren[i].get_gameObject());
     }
     this.m_equipmentSlotsHeader.get_gameObject().SetActive(false);
     for (int j = 0; j < follower.AbilityID.Length; j++)
     {
         GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(follower.AbilityID[j]);
         if ((record.Flags & 1u) != 0u)
         {
             this.m_equipmentSlotsHeader.get_gameObject().SetActive(true);
             GameObject gameObject = Object.Instantiate <GameObject>(this.m_equipmentSlotPrefab);
             gameObject.get_transform().SetParent(this.m_equipmentSlotsRootObject.get_transform(), false);
             AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>();
             component.SetAbility(follower.AbilityID[j], true, true, this);
         }
     }
 }