private void SetCharShipmentTroop(MobileClientShipmentType shipmentType, CharShipmentRec charShipmentRec)
    {
        this.m_isTroop      = true;
        this.m_shipmentType = shipmentType;
        this.m_troopSpecificArea.SetActive(true);
        this.m_itemSpecificArea.SetActive(false);
        this.m_troopName.get_gameObject().SetActive(true);
        this.m_itemName.get_gameObject().SetActive(false);
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID);

        if (record == null)
        {
            Debug.LogError("Invalid Follower ID: " + charShipmentRec.GarrFollowerID);
            this.m_troopName.set_text("Invalid Follower ID: " + charShipmentRec.GarrFollowerID);
            return;
        }
        this.m_followerRec = record;
        int         num     = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID;
        CreatureRec record2 = StaticDB.creatureDB.GetRecord(num);

        if (record2 == null)
        {
            Debug.LogError("Invalid Creature ID: " + num);
            this.m_troopName.set_text("Invalid Creature ID: " + num);
            return;
        }
        string text   = "Assets/BundleAssets/PortraitIcons/cid_" + record2.ID.ToString("D8") + ".png";
        Sprite sprite = AssetBundleManager.portraitIcons.LoadAsset <Sprite>(text);

        if (sprite != null)
        {
            this.m_troopSnapshotImage.set_sprite(sprite);
        }
        for (int i = 0; i < record.Vitality; i++)
        {
            GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab);
            gameObject.get_transform().SetParent(this.m_troopHeartContainer.get_transform(), false);
        }
        this.m_troopName.set_text(record2.Name);
        StaticDB.garrFollowerXAbilityDB.EnumRecordsByParentID((int)charShipmentRec.GarrFollowerID, delegate(GarrFollowerXAbilityRec xAbilityRec)
        {
            if (xAbilityRec.FactionIndex == (int)GarrisonStatus.Faction())
            {
                GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab);
                gameObject2.get_transform().SetParent(this.m_traitsAndAbilitiesRootObject.get_transform(), false);
                AbilityDisplay component = gameObject2.GetComponent <AbilityDisplay>();
                component.SetAbility(xAbilityRec.GarrAbilityID, true, true, null);
            }
            return(true);
        });
        this.UpdateTroopSlots();
        this.m_troopResourceCostText.set_text(string.Empty + shipmentType.CurrencyCost);
        Sprite sprite2 = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID);

        if (sprite2 != null)
        {
            this.m_troopResourceIcon.set_sprite(sprite2);
        }
        this.UpdateRecruitButtonState();
    }
Esempio n. 2
0
        public void UpdateVisuals()
        {
            CombatAllyMissionState combatAllyMissionState = CombatAllyMissionState.notAvailable;

            foreach (WrapperGarrisonMission wrapperGarrisonMission in PersistentMissionData.missionDictionary.Values)
            {
                GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(wrapperGarrisonMission.MissionRecID);
                if (record != null)
                {
                    if ((record.Flags & 16u) != 0u)
                    {
                        this.m_combatAllyMissionID = wrapperGarrisonMission.MissionRecID;
                        if (wrapperGarrisonMission.MissionState == 1)
                        {
                            combatAllyMissionState = CombatAllyMissionState.inProgress;
                        }
                        else
                        {
                            combatAllyMissionState = CombatAllyMissionState.available;
                        }
                        break;
                    }
                }
            }
            if (combatAllyMissionState == CombatAllyMissionState.inProgress)
            {
                foreach (WrapperGarrisonFollower wrapperGarrisonFollower in PersistentFollowerData.followerDictionary.Values)
                {
                    if (wrapperGarrisonFollower.CurrentMissionID == this.m_combatAllyMissionID)
                    {
                        this.m_combatAllySlot.SetFollower(wrapperGarrisonFollower.GarrFollowerID);
                        this.m_combatAllyLabel.gameObject.SetActive(false);
                        this.m_assignChampionText.gameObject.SetActive(false);
                        this.m_championName.gameObject.SetActive(true);
                        GarrFollowerRec record2 = StaticDB.garrFollowerDB.GetRecord(wrapperGarrisonFollower.GarrFollowerID);
                        CreatureRec     record3 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record2.HordeCreatureID : record2.AllianceCreatureID);
                        if (wrapperGarrisonFollower.Quality == 6 && record2.TitleName != null && record2.TitleName.Length > 0)
                        {
                            this.m_championName.text = record2.TitleName;
                        }
                        else if (record2 != null)
                        {
                            this.m_championName.text = record3.Name;
                        }
                        this.m_championName.color = GeneralHelpers.GetQualityColor(wrapperGarrisonFollower.Quality);
                        this.m_combatAllySupportSpellDisplay.gameObject.SetActive(true);
                        this.m_combatAllySupportSpellDisplay.SetSpell(wrapperGarrisonFollower.ZoneSupportSpellID);
                        this.m_unassignCombatAllyButton.SetActive(true);
                        break;
                    }
                }
            }
            else
            {
                this.ClearCombatAllyDisplay();
            }
        }
Esempio n. 3
0
        private void SetCharShipmentTroop(WrapperShipmentType shipmentType, CharShipmentRec charShipmentRec)
        {
            this.m_rightStackLayoutElement.minHeight = 170f;
            this.m_isTroop         = true;
            this.m_charShipmentRec = charShipmentRec;
            this.m_troopSpecificArea.SetActive(true);
            this.m_itemSpecificArea.SetActive(false);
            this.m_troopName.gameObject.SetActive(true);
            this.m_itemName.gameObject.SetActive(false);
            GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID);

            if (record == null)
            {
                this.m_troopName.text = "Invalid Follower ID: " + charShipmentRec.GarrFollowerID;
                return;
            }
            this.m_followerRec = record;
            int         num     = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID;
            CreatureRec record2 = StaticDB.creatureDB.GetRecord(num);

            if (record2 == null)
            {
                this.m_troopName.text = "Invalid Creature ID: " + num;
                return;
            }
            string text   = "Assets/BundleAssets/PortraitIcons/cid_" + record2.ID.ToString("D8") + ".png";
            Sprite sprite = AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(text);

            if (sprite != null)
            {
                this.m_troopSnapshotImage.sprite = sprite;
            }
            for (int i = 0; i < record.Vitality; i++)
            {
                GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab);
                gameObject.transform.SetParent(this.m_troopHeartContainer.transform, false);
            }
            this.m_troopName.text = record2.Name;
            foreach (GarrFollowerXAbilityRec garrFollowerXAbilityRec in from rec in StaticDB.garrFollowerXAbilityDB.GetRecordsByParentID((int)charShipmentRec.GarrFollowerID)
                     where rec.FactionIndex == (int)GarrisonStatus.Faction()
                     select rec)
            {
                GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab);
                gameObject2.transform.SetParent(this.m_traitsAndAbilitiesRootObject.transform, false);
                AbilityDisplay component = gameObject2.GetComponent <AbilityDisplay>();
                component.SetAbility(garrFollowerXAbilityRec.GarrAbilityID, true, true, null);
            }
            this.UpdateTroopSlots();
            this.m_troopResourceCostText.text = string.Empty + shipmentType.CurrencyCost;
            Sprite sprite2 = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID);

            if (sprite2 != null)
            {
                this.m_troopResourceIcon.sprite = sprite2;
            }
            this.UpdateRecruitButtonState();
        }
        private void SetCharShipmentTroop(WrapperShipmentType shipmentType, CharShipmentRec charShipmentRec)
        {
            this.m_isTroop         = true;
            this.m_charShipmentRec = charShipmentRec;
            this.m_troopSpecificArea.SetActive(true);
            this.m_itemSpecificArea.SetActive(false);
            this.m_troopName.gameObject.SetActive(true);
            this.m_itemName.gameObject.SetActive(false);
            GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID);

            if (record == null)
            {
                Debug.LogError(string.Concat("Invalid Follower ID: ", charShipmentRec.GarrFollowerID));
                this.m_troopName.text = string.Concat("Invalid Follower ID: ", charShipmentRec.GarrFollowerID);
                return;
            }
            this.m_followerRec = record;
            int         num         = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceCreatureID : record.HordeCreatureID);
            CreatureRec creatureRec = StaticDB.creatureDB.GetRecord(num);

            if (creatureRec == null)
            {
                Debug.LogError(string.Concat("Invalid Creature ID: ", num));
                this.m_troopName.text = string.Concat("Invalid Creature ID: ", num);
                return;
            }
            int    d   = creatureRec.ID;
            string str = string.Concat("Assets/BundleAssets/PortraitIcons/cid_", d.ToString("D8"), ".png");

            AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(str);
            for (int i = 0; i < record.Vitality; i++)
            {
                GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_troopHeartPrefab);
                gameObject.transform.SetParent(this.m_troopHeartContainer.transform, false);
            }
            this.m_troopName.text = creatureRec.Name;
            foreach (GarrFollowerXAbilityRec garrFollowerXAbilityRec in
                     from rec in StaticDB.garrFollowerXAbilityDB.GetRecordsByParentID((int)charShipmentRec.GarrFollowerID)
                     where rec.FactionIndex == (int)GarrisonStatus.Faction()
                     select rec)
            {
                GameObject gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab);
                gameObject1.transform.SetParent(this.m_traitsAndAbilitiesRootObject.transform, false);
                AbilityDisplay component = gameObject1.GetComponent <AbilityDisplay>();
                component.SetAbility(garrFollowerXAbilityRec.GarrAbilityID, true, true, null);
            }
            this.UpdateTroopSlots();
            this.m_troopResourceCostText.text = string.Concat(string.Empty, shipmentType.CurrencyCost);
            Sprite sprite = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID);

            if (sprite != null)
            {
                this.m_troopResourceIcon.sprite = sprite;
            }
            this.UpdateRecruitButtonState();
        }
        public void SetCombatAllyChampion(WrapperGarrisonFollower follower, int garrMissionID, int missionCost)
        {
            this.m_combatAllyMissionID = garrMissionID;
            this.m_combatAllyChampion  = new WrapperGarrisonFollower?(follower);
            this.m_combatAllyAbilityDisplay.SetSpell(this.m_combatAllyChampion.Value.ZoneSupportSpellID);
            this.m_combatAllySlot.SetFollower(follower.GarrFollowerID);
            GarrFollowerRec record      = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);
            CreatureRec     creatureRec = 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 = creatureRec.Name;
            }
            Text mCombatAllyName          = this.m_combatAllyName;
            WrapperGarrisonFollower value = this.m_combatAllyChampion.Value;

            mCombatAllyName.color = GeneralHelpers.GetQualityColor(value.Quality);
            if (missionCost > GarrisonStatus.WarResources())
            {
                this.m_useItemButtonLabel.text    = StaticDB.GetString("CANT_AFFORD", "Can't Afford");
                this.m_useItemButtonLabel.color   = Color.red;
                this.m_useItemButton.interactable = false;
            }
            else
            {
                this.m_useItemButtonLabel.text = StaticDB.GetString("ASSIGN_CHAMPION", null);
            }
            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.WarResources() < missionCost)
            {
                this.m_needMoreResources = true;
            }
            this.SetCombatAllyAvailabilityStatus();
        }
    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);

        this.m_combatAllyName.set_text(record2.Name);
        this.m_combatAllyName.set_color(GeneralHelpers.GetQualityColor(this.m_combatAllyChampion.Quality));
        if (missionCost <= GarrisonStatus.Resources())
        {
            this.m_useItemButtonLabel.set_text(StaticDB.GetString("ASSIGN_CHAMPION", null));
        }
        else
        {
            this.m_useItemButtonLabel.set_text(StaticDB.GetString("CANT_AFFORD", "Can't Afford"));
            this.m_useItemButtonLabel.set_color(Color.get_red());
            this.m_useItemButton.set_interactable(false);
        }
        int numActiveChampions = GeneralHelpers.GetNumActiveChampions();
        int maxActiveChampions = GeneralHelpers.GetMaxActiveChampions();

        this.m_isOverMaxChampionSoftCap = false;
        this.m_needMoreResources        = false;
        if (numActiveChampions > maxActiveChampions)
        {
            this.m_isOverMaxChampionSoftCap = true;
        }
        if (GarrisonStatus.Resources() < missionCost)
        {
            this.m_needMoreResources = true;
        }
        this.SetCombatAllyAvailabilityStatus();
    }
Esempio n. 7
0
    public void UpdateVisuals()
    {
        CombatAllyMissionState combatAllyMissionState = CombatAllyMissionState.notAvailable;
        IEnumerator            enumerator             = PersistentMissionData.missionDictionary.get_Values().GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)enumerator.get_Current();
                GarrMissionRec           record = StaticDB.garrMissionDB.GetRecord(jamGarrisonMobileMission.MissionRecID);
                if (record != null)
                {
                    if ((record.Flags & 16u) != 0u)
                    {
                        this.m_combatAllyMissionID = jamGarrisonMobileMission.MissionRecID;
                        if (jamGarrisonMobileMission.MissionState == 1)
                        {
                            combatAllyMissionState = CombatAllyMissionState.inProgress;
                        }
                        else
                        {
                            combatAllyMissionState = CombatAllyMissionState.available;
                        }
                        break;
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
        if (combatAllyMissionState == CombatAllyMissionState.inProgress)
        {
            using (Dictionary <int, JamGarrisonFollower> .ValueCollection.Enumerator enumerator2 = PersistentFollowerData.followerDictionary.get_Values().GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    JamGarrisonFollower current = enumerator2.get_Current();
                    if (current.CurrentMissionID == this.m_combatAllyMissionID)
                    {
                        this.m_combatAllySlot.SetFollower(current.GarrFollowerID);
                        this.m_combatAllyLabel.get_gameObject().SetActive(false);
                        this.m_assignChampionText.get_gameObject().SetActive(false);
                        this.m_championName.get_gameObject().SetActive(true);
                        GarrFollowerRec record2 = StaticDB.garrFollowerDB.GetRecord(current.GarrFollowerID);
                        CreatureRec     record3 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record2.HordeCreatureID : record2.AllianceCreatureID);
                        this.m_championName.set_text(record3.Name);
                        this.m_championName.set_color(GeneralHelpers.GetQualityColor(current.Quality));
                        this.m_combatAllySupportSpellDisplay.get_gameObject().SetActive(true);
                        this.m_combatAllySupportSpellDisplay.SetSpell(current.ZoneSupportSpellID);
                        this.m_unassignCombatAllyButton.SetActive(true);
                        break;
                    }
                }
            }
        }
        else
        {
            this.ClearCombatAllyDisplay();
        }
    }
Esempio n. 8
0
    public void SetFollower(JamGarrisonFollower follower)
    {
        this.m_followerID        = follower.GarrFollowerID;
        this.followerIDText.text = string.Concat(new object[]
        {
            "ID:",
            follower.GarrFollowerID,
            " Q:",
            follower.Quality
        });
        this.m_inParty = false;
        this.SetAvailabilityStatus(follower);
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

        if (record == null)
        {
            return;
        }
        if (record.GarrFollowerTypeID != 4u)
        {
            return;
        }
        if (follower.Quality == 6 && record.TitleName != null && record.TitleName.Length > 0)
        {
            this.nameText.text = record.TitleName;
        }
        else if (record != null)
        {
            CreatureRec record2 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID);
            this.nameText.text = record2.Name;
        }
        this.m_levelText.text = string.Empty + follower.FollowerLevel;
        int    num    = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID;
        Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, num);

        if (sprite != null)
        {
            this.followerPortrait.sprite = sprite;
            this.portraitErrorText.gameObject.SetActive(false);
        }
        else
        {
            this.portraitErrorText.text = string.Empty + num;
            this.portraitErrorText.gameObject.SetActive(true);
        }
        GarrClassSpecRec record3     = StaticDB.garrClassSpecDB.GetRecord((int)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID));
        Sprite           atlasSprite = TextureAtlas.instance.GetAtlasSprite((int)record3.UiTextureAtlasMemberID);

        if (atlasSprite != null)
        {
            this.m_classIcon.sprite = atlasSprite;
        }
        Transform[] componentsInChildren = this.m_troopHeartContainer.GetComponentsInChildren <Transform>(true);
        foreach (Transform transform in componentsInChildren)
        {
            if (transform != this.m_troopHeartContainer.transform)
            {
                Object.DestroyImmediate(transform.gameObject);
            }
        }
        bool flag = (follower.Flags & 8) != 0;

        if (flag)
        {
            this.m_portraitQualityRing.color = Color.white;
            this.m_levelBorder.color         = Color.white;
            this.nameText.color = Color.white;
            int j;
            for (j = 0; j < follower.Durability; j++)
            {
                GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab);
                gameObject.transform.SetParent(this.m_troopHeartContainer.transform, false);
            }
            for (int k = j; k < record.Vitality; k++)
            {
                GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_troopEmptyHeartPrefab);
                gameObject2.transform.SetParent(this.m_troopHeartContainer.transform, false);
            }
            this.m_portraitQualityRing.gameObject.SetActive(false);
            this.m_portraitQualityRing_TitleQuality.gameObject.SetActive(false);
            this.m_levelBorder.gameObject.SetActive(false);
            this.m_levelBorder_TitleQuality.gameObject.SetActive(false);
            this.followerPortraitFrame.enabled = false;
            this.m_progressBarObj.SetActive(false);
            this.m_levelText.gameObject.SetActive(false);
        }
        else
        {
            this.m_levelText.gameObject.SetActive(true);
            if (follower.Quality == 6)
            {
                this.m_portraitQualityRing.gameObject.SetActive(false);
                this.m_portraitQualityRing_TitleQuality.gameObject.SetActive(true);
                this.m_levelBorder.gameObject.SetActive(false);
                this.m_levelBorder_TitleQuality.gameObject.SetActive(true);
            }
            else
            {
                this.m_portraitQualityRing.gameObject.SetActive(true);
                this.m_portraitQualityRing_TitleQuality.gameObject.SetActive(false);
                this.m_levelBorder.gameObject.SetActive(true);
                this.m_levelBorder_TitleQuality.gameObject.SetActive(false);
            }
            Color qualityColor = GeneralHelpers.GetQualityColor(follower.Quality);
            this.m_portraitQualityRing.color = qualityColor;
            this.m_levelBorder.color         = qualityColor;
            if (follower.Quality <= 1)
            {
                this.nameText.color = Color.white;
            }
            else
            {
                this.nameText.color = qualityColor;
            }
            uint num2;
            bool flag2;
            bool flag3;
            GeneralHelpers.GetXpCapInfo(follower.FollowerLevel, follower.Quality, out num2, out flag2, out flag3);
            if (flag3)
            {
                this.m_progressBarObj.SetActive(false);
            }
            else
            {
                this.m_progressBarObj.SetActive(true);
                float fillAmount = Mathf.Clamp01((float)follower.Xp / num2);
                this.m_progressBarFillImage.fillAmount = fillAmount;
                this.m_xpAmountText.text = string.Concat(new object[]
                {
                    string.Empty,
                    follower.Xp,
                    "/",
                    num2
                });
            }
        }
    }
        public void SetFollower(int followerID)
        {
            this.m_garrFollowerID = followerID;
            if (followerID == 0)
            {
                RectTransform[] componentsInChildren = this.traitsAndAbilitiesRootObject.GetComponentsInChildren <RectTransform>(true);
                for (int i = 0; i < componentsInChildren.Length; i++)
                {
                    if (componentsInChildren[i] != null && componentsInChildren[i] != this.traitsAndAbilitiesRootObject.transform)
                    {
                        Object.Destroy(componentsInChildren[i].gameObject);
                    }
                }
                AbilityDisplay[] componentsInChildren2 = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true);
                for (int j = 0; j < componentsInChildren2.Length; j++)
                {
                    Object.Destroy(componentsInChildren2[j].gameObject);
                }
            }
            if (!PersistentFollowerData.followerDictionary.ContainsKey(followerID))
            {
                return;
            }
            GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(followerID);

            if (record == null)
            {
                return;
            }
            CreatureRec record2 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID);

            if (record2 == null)
            {
                return;
            }
            WrapperGarrisonFollower follower = PersistentFollowerData.followerDictionary[followerID];
            string text   = "Assets/BundleAssets/PortraitIcons/cid_" + record2.ID.ToString("D8") + ".png";
            Sprite sprite = AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(text);

            if (sprite != null)
            {
                this.followerSnapshot.sprite = sprite;
            }
            RectTransform[] componentsInChildren3 = this.traitsAndAbilitiesRootObject.GetComponentsInChildren <RectTransform>(true);
            for (int k = 0; k < componentsInChildren3.Length; k++)
            {
                if (componentsInChildren3[k] != null && componentsInChildren3[k] != this.traitsAndAbilitiesRootObject.transform)
                {
                    Object.Destroy(componentsInChildren3[k].gameObject);
                }
            }
            bool flag = false;

            for (int l = 0; l < follower.AbilityIDs.Count; l++)
            {
                GarrAbilityRec record3 = StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[l]);
                if ((record3.Flags & 512u) != 0u)
                {
                    if (!flag)
                    {
                        GameObject gameObject = Object.Instantiate <GameObject>(this.specializationHeaderPrefab);
                        gameObject.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                        flag = true;
                        Text component = gameObject.GetComponent <Text>();
                        if (component != null)
                        {
                            component.text = StaticDB.GetString("SPECIALIZATION", null);
                        }
                    }
                    GameObject gameObject2 = Object.Instantiate <GameObject>(this.abilityDisplayPrefab);
                    gameObject2.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                    AbilityDisplay component2 = gameObject2.GetComponent <AbilityDisplay>();
                    component2.SetAbility(record3.ID, false, false, null);
                }
            }
            bool flag2 = false;

            for (int m = 0; m < follower.AbilityIDs.Count; m++)
            {
                GarrAbilityRec record4 = StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[m]);
                if ((record4.Flags & 1u) == 0u)
                {
                    if ((record4.Flags & 512u) == 0u)
                    {
                        if (!flag2)
                        {
                            GameObject gameObject3 = Object.Instantiate <GameObject>(this.abilitiesHeaderPrefab);
                            gameObject3.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                            flag2 = true;
                            Text component3 = gameObject3.GetComponent <Text>();
                            if (component3 != null)
                            {
                                component3.text = StaticDB.GetString("ABILITIES", null);
                            }
                        }
                        GameObject gameObject4 = Object.Instantiate <GameObject>(this.abilityDisplayPrefab);
                        gameObject4.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                        AbilityDisplay component4 = gameObject4.GetComponent <AbilityDisplay>();
                        component4.SetAbility(follower.AbilityIDs[m], false, false, null);
                    }
                }
            }
            if (follower.ZoneSupportSpellID > 0)
            {
                GameObject gameObject5 = Object.Instantiate <GameObject>(this.zoneSupportAbilityHeaderPrefab);
                gameObject5.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                GameObject gameObject6 = Object.Instantiate <GameObject>(this.m_spellDisplayPrefab);
                gameObject6.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                SpellDisplay component5 = gameObject6.GetComponent <SpellDisplay>();
                component5.SetSpell(follower.ZoneSupportSpellID);
                Text componentInChildren = gameObject5.GetComponentInChildren <Text>();
                if (componentInChildren != null)
                {
                    componentInChildren.text = StaticDB.GetString("COMBAT_ALLY", null);
                }
            }
            bool flag3 = (follower.Flags & 8) != 0;

            if (flag3)
            {
                GarrStringRec record5 = StaticDB.garrStringDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record.HordeFlavorGarrStringID : record.AllianceFlavorGarrStringID);
                if (record5 != null)
                {
                    Text text2 = Object.Instantiate <Text>(this.m_troopDescriptionPrefab);
                    text2.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                    text2.text = record5.Text;
                    text2.font = FontLoader.LoadStandardFont();
                }
            }
            this.InitEquipmentSlots(follower);
            this.UpdateChampionButtons(follower);
        }
Esempio n. 10
0
    private void SetFollowerAppearance(JamGarrisonFollower follower, bool nextCapIsForQuality, bool isMaxLevelAndMaxQuality, bool isTroop, float initialEntranceDelay)
    {
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

        this.m_troopHeartContainerEmpty.SetActive(isTroop);
        this.m_troopHeartContainerFull.SetActive(isTroop);
        this.m_expiredPortraitX.SetActive(false);
        if (isTroop)
        {
            this.m_levelBorder.get_gameObject().SetActive(false);
            this.m_progressBarObj.SetActive(false);
            this.m_portraitBG.get_gameObject().SetActive(false);
            this.m_troopHeartContainerEmpty.SetActive(true);
            this.m_troopHeartContainerFull.SetActive(true);
            Transform[] componentsInChildren = this.m_troopHeartContainerEmpty.GetComponentsInChildren <Transform>(true);
            Transform[] array = componentsInChildren;
            for (int i = 0; i < array.Length; i++)
            {
                Transform transform = array[i];
                if (transform != this.m_troopHeartContainerEmpty.get_transform())
                {
                    Object.DestroyImmediate(transform.get_gameObject());
                }
            }
            Transform[] componentsInChildren2 = this.m_troopHeartContainerFull.GetComponentsInChildren <Transform>(true);
            Transform[] array2 = componentsInChildren2;
            for (int j = 0; j < array2.Length; j++)
            {
                Transform transform2 = array2[j];
                if (transform2 != this.m_troopHeartContainerFull.get_transform())
                {
                    Object.DestroyImmediate(transform2.get_gameObject());
                }
            }
            float num = 0.15f;
            JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.preMissionFollowerDictionary.get_Item(follower.GarrFollowerID);
            for (int k = 0; k < jamGarrisonFollower.Durability; k++)
            {
                GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab);
                gameObject.get_transform().SetParent(this.m_troopHeartContainerFull.get_transform(), false);
                if (k >= follower.Durability)
                {
                    float num2 = initialEntranceDelay + (float)(jamGarrisonFollower.Durability - (k - follower.Durability)) * num;
                    float num3 = 2f;
                    iTween.ValueTo(gameObject, iTween.Hash(new object[]
                    {
                        "name",
                        "fade",
                        "from",
                        0f,
                        "to",
                        1f,
                        "time",
                        num3,
                        "easetype",
                        iTween.EaseType.easeOutCubic,
                        "delay",
                        num2,
                        "onupdatetarget",
                        gameObject,
                        "onupdate",
                        "SetHeartEffectProgress",
                        "oncomplete",
                        "FinishHeartEffect"
                    }));
                }
            }
            for (int l = 0; l < record.Vitality; l++)
            {
                GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_troopEmptyHeartPrefab);
                gameObject2.get_transform().SetParent(this.m_troopHeartContainerEmpty.get_transform(), false);
            }
            if (follower.Durability <= 0)
            {
                DelayedUIAnim delayedUIAnim = base.get_gameObject().AddComponent <DelayedUIAnim>();
                float         num4          = initialEntranceDelay + (float)(jamGarrisonFollower.Durability - follower.Durability) * num + 1f;
                delayedUIAnim.Init(num4, "RedFailX", "SFX/UI_Mission_Fail_Red_X", this.m_followerPortrait.get_transform(), 1.5f);
                DelayedObjectEnable delayedObjectEnable = base.get_gameObject().AddComponent <DelayedObjectEnable>();
                delayedObjectEnable.Init(num4 + 0.25f, this.m_expiredPortraitX);
            }
        }
        int    iconFileDataID = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID;
        Sprite sprite         = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, iconFileDataID);

        if (sprite != null)
        {
            this.m_followerPortrait.set_sprite(sprite);
        }
        if (isTroop)
        {
            this.m_qualityBorder.get_gameObject().SetActive(false);
            this.m_levelBorder.get_gameObject().SetActive(false);
            this.m_followerNameText.set_color(Color.get_white());
        }
        else
        {
            Color qualityColor = GeneralHelpers.GetQualityColor(follower.Quality);
            this.m_qualityBorder.set_color(qualityColor);
            this.m_levelBorder.set_color(qualityColor);
            this.m_followerNameText.set_color(qualityColor);
        }
        CreatureRec record2 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID);

        this.m_followerNameText.set_text(record2.Name);
        if (follower.FollowerLevel < 110)
        {
            this.m_iLevelText.set_text(StaticDB.GetString("LEVEL", null) + " " + follower.FollowerLevel);
        }
        else
        {
            this.m_iLevelText.set_text(StaticDB.GetString("ILVL", null) + " " + (follower.ItemLevelArmor + follower.ItemLevelWeapon) / 2);
        }
        GarrClassSpecRec record3 = StaticDB.garrClassSpecDB.GetRecord((int)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID));

        this.m_classText.set_text(record3.ClassSpec);
        Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite((int)record3.UiTextureAtlasMemberID);

        if (atlasSprite != null)
        {
            this.m_classIcon.set_sprite(atlasSprite);
        }
        if (!isTroop)
        {
            if (isMaxLevelAndMaxQuality)
            {
                this.m_progressBarObj.SetActive(false);
                this.m_toNextLevelOrUpgradeText.set_text(string.Empty);
            }
            else if (nextCapIsForQuality)
            {
                this.m_progressBarObj.SetActive(true);
                this.m_toNextLevelOrUpgradeText.set_text(StaticDB.GetString("TO_NEXT_UPGRADE", string.Empty));
            }
            else
            {
                this.m_progressBarObj.SetActive(true);
                this.m_toNextLevelOrUpgradeText.set_text(StaticDB.GetString("TO_NEXT_LEVEL", string.Empty));
            }
        }
    }
        private void SetFollowerAppearance(WrapperGarrisonFollower follower, bool nextCapIsForQuality, bool isMaxLevelAndMaxQuality, bool isTroop, float initialEntranceDelay)
        {
            GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

            this.m_troopHeartContainerEmpty.SetActive(isTroop);
            this.m_troopHeartContainerFull.SetActive(isTroop);
            this.m_expiredPortraitX.SetActive(false);
            if (isTroop)
            {
                this.m_levelBorder.gameObject.SetActive(false);
                this.m_progressBarObj.SetActive(false);
                this.m_portraitBG.gameObject.SetActive(false);
                this.m_troopHeartContainerEmpty.SetActive(true);
                this.m_troopHeartContainerFull.SetActive(true);
                Transform[] componentsInChildren = this.m_troopHeartContainerEmpty.GetComponentsInChildren <Transform>(true);
                foreach (Transform transform in componentsInChildren)
                {
                    if (transform != this.m_troopHeartContainerEmpty.transform)
                    {
                        Object.Destroy(transform.gameObject);
                    }
                }
                Transform[] componentsInChildren2 = this.m_troopHeartContainerFull.GetComponentsInChildren <Transform>(true);
                foreach (Transform transform2 in componentsInChildren2)
                {
                    if (transform2 != this.m_troopHeartContainerFull.transform)
                    {
                        Object.Destroy(transform2.gameObject);
                    }
                }
                float num = 0.15f;
                WrapperGarrisonFollower wrapperGarrisonFollower = PersistentFollowerData.preMissionFollowerDictionary[follower.GarrFollowerID];
                for (int k = 0; k < wrapperGarrisonFollower.Durability; k++)
                {
                    GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab);
                    gameObject.transform.SetParent(this.m_troopHeartContainerFull.transform, false);
                    if (k >= follower.Durability)
                    {
                        float num2 = initialEntranceDelay + (float)(wrapperGarrisonFollower.Durability - (k - follower.Durability)) * num;
                        float num3 = 2f;
                        iTween.ValueTo(gameObject, iTween.Hash(new object[]
                        {
                            "name",
                            "fade",
                            "from",
                            0f,
                            "to",
                            1f,
                            "time",
                            num3,
                            "easetype",
                            iTween.EaseType.easeOutCubic,
                            "delay",
                            num2,
                            "onupdatetarget",
                            gameObject,
                            "onupdate",
                            "SetHeartEffectProgress",
                            "oncomplete",
                            "FinishHeartEffect"
                        }));
                    }
                }
                for (int l = 0; l < (int)record.Vitality; l++)
                {
                    GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_troopEmptyHeartPrefab);
                    gameObject2.transform.SetParent(this.m_troopHeartContainerEmpty.transform, false);
                }
                if (follower.Durability <= 0)
                {
                    DelayedUIAnim delayedUIAnim = base.gameObject.AddComponent <DelayedUIAnim>();
                    float         num4          = initialEntranceDelay + (float)(wrapperGarrisonFollower.Durability - follower.Durability) * num + 1f;
                    delayedUIAnim.Init(num4, "RedFailX", "FollowerDead", this.m_followerPortrait.transform, 1.5f);
                    DelayedObjectEnable delayedObjectEnable = base.gameObject.AddComponent <DelayedObjectEnable>();
                    delayedObjectEnable.Init(num4 + 0.25f, this.m_expiredPortraitX);
                }
            }
            int    iconFileDataID = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID;
            Sprite sprite         = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, iconFileDataID);

            if (sprite != null)
            {
                this.m_followerPortrait.sprite = sprite;
            }
            if (isTroop)
            {
                this.m_qualityBorder.gameObject.SetActive(false);
                this.m_levelBorder.gameObject.SetActive(false);
                this.m_troopBackground.SetActive(true);
                this.m_followerBackground.SetActive(false);
                this.m_iLevelText.gameObject.SetActive(false);
            }
            else
            {
                if (follower.Quality == 6)
                {
                    this.m_qualityBorder.gameObject.SetActive(false);
                    this.m_levelBorder.gameObject.SetActive(false);
                }
                else
                {
                    this.m_qualityBorder.gameObject.SetActive(true);
                    this.m_levelBorder.gameObject.SetActive(true);
                }
                Color qualityColor = GeneralHelpers.GetQualityColor(follower.Quality);
                this.m_qualityBorder.color = qualityColor;
                this.m_troopBackground.SetActive(false);
                this.m_followerBackground.SetActive(true);
            }
            CreatureRec record2 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID);

            if (follower.Quality == 6 && record.TitleName != null && record.TitleName.Length > 0)
            {
                this.m_followerNameText.text = record.TitleName;
            }
            else if (record != null)
            {
                this.m_followerNameText.text = record2.Name;
            }
            this.m_iLevelText.text = follower.FollowerLevel.ToString();
            if (!isTroop)
            {
                if (isMaxLevelAndMaxQuality)
                {
                    this.m_progressBarObj.SetActive(false);
                    this.m_toNextLevelOrUpgradeText.text = string.Empty;
                }
                else if (nextCapIsForQuality)
                {
                    this.m_progressBarObj.SetActive(true);
                    this.m_toNextLevelOrUpgradeText.text = StaticDB.GetString("TO_NEXT_UPGRADE", string.Empty);
                }
                else
                {
                    this.m_progressBarObj.SetActive(true);
                    this.m_toNextLevelOrUpgradeText.text = StaticDB.GetString("TO_NEXT_LEVEL", string.Empty);
                }
            }
        }
    public void UpdateVisuals()
    {
        CombatAllyMissionState combatAllyMissionState = CombatAllyMissionState.notAvailable;
        IEnumerator            enumerator             = PersistentMissionData.missionDictionary.Values.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object obj = enumerator.Current;
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)obj;
                GarrMissionRec           record = StaticDB.garrMissionDB.GetRecord(jamGarrisonMobileMission.MissionRecID);
                if (record != null)
                {
                    if ((record.Flags & 16u) != 0u)
                    {
                        this.m_combatAllyMissionID = jamGarrisonMobileMission.MissionRecID;
                        if (jamGarrisonMobileMission.MissionState == 1)
                        {
                            combatAllyMissionState = CombatAllyMissionState.inProgress;
                        }
                        else
                        {
                            combatAllyMissionState = CombatAllyMissionState.available;
                        }
                        break;
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
        if (combatAllyMissionState == CombatAllyMissionState.inProgress)
        {
            foreach (JamGarrisonFollower jamGarrisonFollower in PersistentFollowerData.followerDictionary.Values)
            {
                if (jamGarrisonFollower.CurrentMissionID == this.m_combatAllyMissionID)
                {
                    this.m_combatAllySlot.SetFollower(jamGarrisonFollower.GarrFollowerID);
                    this.m_combatAllyLabel.gameObject.SetActive(false);
                    this.m_assignChampionText.gameObject.SetActive(false);
                    this.m_championName.gameObject.SetActive(true);
                    GarrFollowerRec record2 = StaticDB.garrFollowerDB.GetRecord(jamGarrisonFollower.GarrFollowerID);
                    CreatureRec     record3 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record2.HordeCreatureID : record2.AllianceCreatureID);
                    if (jamGarrisonFollower.Quality == 6 && record2.TitleName != null && record2.TitleName.Length > 0)
                    {
                        this.m_championName.text = record2.TitleName;
                    }
                    else if (record2 != null)
                    {
                        this.m_championName.text = record3.Name;
                    }
                    this.m_championName.color = GeneralHelpers.GetQualityColor(jamGarrisonFollower.Quality);
                    this.m_combatAllySupportSpellDisplay.gameObject.SetActive(true);
                    this.m_combatAllySupportSpellDisplay.SetSpell(jamGarrisonFollower.ZoneSupportSpellID);
                    this.m_unassignCombatAllyButton.SetActive(true);
                    break;
                }
            }
        }
        else
        {
            this.ClearCombatAllyDisplay();
        }
    }
        public void SetFollower(WrapperGarrisonFollower follower)
        {
            this.m_followerID        = follower.GarrFollowerID;
            this.followerIDText.text = string.Concat(new object[] { "ID:", follower.GarrFollowerID, " Q:", follower.Quality });
            this.m_inParty           = false;
            this.SetAvailabilityStatus(follower);
            GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

            if (record == null)
            {
                return;
            }
            if (record.GarrFollowerTypeID != (uint)GarrisonStatus.GarrisonFollowerType)
            {
                return;
            }
            if (follower.Quality == 6 && record.TitleName != null && record.TitleName.Length > 0)
            {
                this.nameText.text = record.TitleName;
            }
            else if (record != null)
            {
                CreatureRec creatureRec = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceCreatureID : record.HordeCreatureID));
                this.nameText.text = creatureRec.Name;
            }
            this.m_levelText.text = string.Concat(string.Empty, follower.FollowerLevel);
            int    num    = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceIconFileDataID : record.HordeIconFileDataID);
            Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, num);

            if (sprite == null)
            {
                this.portraitErrorText.text = string.Concat(string.Empty, num);
                this.portraitErrorText.gameObject.SetActive(true);
            }
            else
            {
                this.followerPortrait.sprite = sprite;
                this.portraitErrorText.gameObject.SetActive(false);
            }
            Transform[] componentsInChildren = this.m_troopHeartContainer.GetComponentsInChildren <Transform>(true);
            for (int i = 0; i < (int)componentsInChildren.Length; i++)
            {
                Transform transforms = componentsInChildren[i];
                if (transforms != this.m_troopHeartContainer.transform)
                {
                    UnityEngine.Object.Destroy(transforms.gameObject);
                }
            }
            if ((follower.Flags & 8) == 0)
            {
                this.m_LevelBorderArea.gameObject.SetActive(true);
                this.m_followerBG.SetActive(true);
                this.m_troopBG.SetActive(false);
                this.m_listItem.targetGraphic = this.m_followerBG.GetComponent <Graphic>();
            }
            else
            {
                this.nameText.color = Color.white;
                int j = 0;
                for (j = 0; j < follower.Durability; j++)
                {
                    GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_troopHeartPrefab);
                    gameObject.transform.SetParent(this.m_troopHeartContainer.transform, false);
                }
                for (int k = j; k < record.Vitality; k++)
                {
                    GameObject gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.m_troopEmptyHeartPrefab);
                    gameObject1.transform.SetParent(this.m_troopHeartContainer.transform, false);
                }
                this.m_progressBarObj.SetActive(false);
                this.m_LevelBorderArea.gameObject.SetActive(false);
                this.m_followerBG.SetActive(false);
                this.m_troopBG.SetActive(true);
                this.m_listItem.targetGraphic = this.m_troopBG.GetComponent <Graphic>();
            }
            if (follower.Quality != 6)
            {
                this.m_portraitQualityRing.gameObject.SetActive(true);
            }
            else
            {
                this.m_portraitQualityRing.gameObject.SetActive(false);
            }
            if (follower.Quality >= 2)
            {
                Color qualityColor = GeneralHelpers.GetQualityColor(follower.Quality);
                this.m_portraitQualityRing.color = qualityColor;
            }
            this.m_portraitQualityRing.gameObject.SetActive(follower.Quality >= 2);
        }
Esempio n. 14
0
        public void SetFollower(int followerID)
        {
            this.m_garrFollowerID = followerID;
            if (followerID == 0)
            {
                RectTransform[] componentsInChildren = this.traitsAndAbilitiesRootObject.GetComponentsInChildren <RectTransform>(true);
                for (int i = 0; i < (int)componentsInChildren.Length; i++)
                {
                    if (componentsInChildren[i] != null && componentsInChildren[i] != this.traitsAndAbilitiesRootObject.transform)
                    {
                        UnityEngine.Object.Destroy(componentsInChildren[i].gameObject);
                    }
                }
                AbilityDisplay[] abilityDisplayArray = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true);
                for (int j = 0; j < (int)abilityDisplayArray.Length; j++)
                {
                    UnityEngine.Object.Destroy(abilityDisplayArray[j].gameObject);
                }
            }
            if (!PersistentFollowerData.followerDictionary.ContainsKey(followerID))
            {
                return;
            }
            GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(followerID);

            if (record == null)
            {
                return;
            }
            CreatureRec creatureRec = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceCreatureID : record.HordeCreatureID));

            if (creatureRec == null)
            {
                return;
            }
            WrapperGarrisonFollower item = PersistentFollowerData.followerDictionary[followerID];
            int    d      = creatureRec.ID;
            string str    = string.Concat("Assets/BundleAssets/PortraitIcons/cid_", d.ToString("D8"), ".png");
            Sprite sprite = AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(str);

            if (sprite != null)
            {
                this.followerSnapshot.sprite = sprite;
            }
            RectTransform[] rectTransformArray = this.traitsAndAbilitiesRootObject.GetComponentsInChildren <RectTransform>(true);
            for (int k = 0; k < (int)rectTransformArray.Length; k++)
            {
                if (rectTransformArray[k] != null && rectTransformArray[k] != this.traitsAndAbilitiesRootObject.transform)
                {
                    UnityEngine.Object.Destroy(rectTransformArray[k].gameObject);
                }
            }
            bool flag = false;

            for (int l = 0; l < item.AbilityIDs.Count; l++)
            {
                GarrAbilityRec garrAbilityRec = StaticDB.garrAbilityDB.GetRecord(item.AbilityIDs[l]);
                if ((garrAbilityRec.Flags & 512) != 0)
                {
                    if (!flag)
                    {
                        GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.specializationHeaderPrefab);
                        gameObject.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                        flag = true;
                        Text component = gameObject.GetComponent <Text>();
                        if (component != null)
                        {
                            component.text = StaticDB.GetString("SPECIALIZATION", null);
                        }
                    }
                    GameObject gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.abilityDisplayPrefab);
                    gameObject1.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                    AbilityDisplay abilityDisplay = gameObject1.GetComponent <AbilityDisplay>();
                    abilityDisplay.SetAbility(garrAbilityRec.ID, false, false, null);
                }
            }
            bool flag1 = false;

            for (int m = 0; m < item.AbilityIDs.Count; m++)
            {
                GarrAbilityRec record1 = StaticDB.garrAbilityDB.GetRecord(item.AbilityIDs[m]);
                if ((record1.Flags & 1) == 0)
                {
                    if ((record1.Flags & 512) == 0)
                    {
                        if (!flag1)
                        {
                            GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(this.abilitiesHeaderPrefab);
                            gameObject2.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                            flag1 = true;
                            Text text = gameObject2.GetComponent <Text>();
                            if (text != null)
                            {
                                text.text = StaticDB.GetString("ABILITIES", null);
                            }
                        }
                        GameObject gameObject3 = UnityEngine.Object.Instantiate <GameObject>(this.abilityDisplayPrefab);
                        gameObject3.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                        AbilityDisplay component1 = gameObject3.GetComponent <AbilityDisplay>();
                        component1.SetAbility(item.AbilityIDs[m], false, false, null);
                    }
                }
            }
            if (item.ZoneSupportSpellID > 0)
            {
                GameObject gameObject4 = UnityEngine.Object.Instantiate <GameObject>(this.zoneSupportAbilityHeaderPrefab);
                gameObject4.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                GameObject gameObject5 = UnityEngine.Object.Instantiate <GameObject>(this.m_spellDisplayPrefab);
                gameObject5.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                gameObject5.GetComponent <SpellDisplay>().SetSpell(item.ZoneSupportSpellID);
                Text componentInChildren = gameObject4.GetComponentInChildren <Text>();
                if (componentInChildren != null)
                {
                    componentInChildren.text = StaticDB.GetString("COMBAT_ALLY", null);
                }
            }
            if ((item.Flags & 8) != 0)
            {
                GarrStringRec garrStringRec = StaticDB.garrStringDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE ? record.HordeFlavorGarrStringID : record.AllianceFlavorGarrStringID));
                if (garrStringRec != null)
                {
                    Text text1 = UnityEngine.Object.Instantiate <Text>(this.m_troopDescriptionPrefab);
                    text1.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false);
                    text1.text = garrStringRec.Text;
                    text1.font = FontLoader.LoadStandardFont();
                }
            }
            this.InitEquipmentSlots(item);
            this.UpdateChampionButtons(item);
        }
Esempio n. 15
0
        private void SetFollowerAppearance(WrapperGarrisonFollower follower, bool nextCapIsForQuality, bool isMaxLevelAndMaxQuality, bool isTroop, float initialEntranceDelay)
        {
            GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

            this.m_troopHeartContainerEmpty.SetActive(isTroop);
            this.m_troopHeartContainerFull.SetActive(isTroop);
            this.m_expiredPortraitX.SetActive(false);
            if (isTroop)
            {
                this.m_levelBorder.gameObject.SetActive(false);
                this.m_progressBarObj.SetActive(false);
                this.m_portraitBG.gameObject.SetActive(false);
                this.m_troopHeartContainerEmpty.SetActive(true);
                this.m_troopHeartContainerFull.SetActive(true);
                Transform[] componentsInChildren = this.m_troopHeartContainerEmpty.GetComponentsInChildren <Transform>(true);
                for (int i = 0; i < (int)componentsInChildren.Length; i++)
                {
                    Transform transforms = componentsInChildren[i];
                    if (transforms != this.m_troopHeartContainerEmpty.transform)
                    {
                        UnityEngine.Object.Destroy(transforms.gameObject);
                    }
                }
                Transform[] transformArrays = this.m_troopHeartContainerFull.GetComponentsInChildren <Transform>(true);
                for (int j = 0; j < (int)transformArrays.Length; j++)
                {
                    Transform transforms1 = transformArrays[j];
                    if (transforms1 != this.m_troopHeartContainerFull.transform)
                    {
                        UnityEngine.Object.Destroy(transforms1.gameObject);
                    }
                }
                float single = 0.15f;
                WrapperGarrisonFollower item = PersistentFollowerData.preMissionFollowerDictionary[follower.GarrFollowerID];
                for (int k = 0; k < item.Durability; k++)
                {
                    GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_troopHeartPrefab);
                    gameObject.transform.SetParent(this.m_troopHeartContainerFull.transform, false);
                    if (k >= follower.Durability)
                    {
                        float single1 = initialEntranceDelay + (float)(item.Durability - (k - follower.Durability)) * single;
                        float single2 = 2f;
                        iTween.ValueTo(gameObject, iTween.Hash(new object[] { "name", "fade", "from", 0f, "to", 1f, "time", single2, "easetype", iTween.EaseType.easeOutCubic, "delay", single1, "onupdatetarget", gameObject, "onupdate", "SetHeartEffectProgress", "oncomplete", "FinishHeartEffect" }));
                    }
                }
                for (int l = 0; l < record.Vitality; l++)
                {
                    GameObject gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.m_troopEmptyHeartPrefab);
                    gameObject1.transform.SetParent(this.m_troopHeartContainerEmpty.transform, false);
                }
                if (follower.Durability <= 0)
                {
                    DelayedUIAnim delayedUIAnim = base.gameObject.AddComponent <DelayedUIAnim>();
                    float         single3       = initialEntranceDelay + (float)(item.Durability - follower.Durability) * single + 1f;
                    delayedUIAnim.Init(single3, "RedFailX", "SFX/UI_Mission_Fail_Red_X", this.m_followerPortrait.transform, 1.5f, 0.3f);
                    DelayedObjectEnable delayedObjectEnable = base.gameObject.AddComponent <DelayedObjectEnable>();
                    delayedObjectEnable.Init(single3 + 0.25f, this.m_expiredPortraitX);
                }
            }
            Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceIconFileDataID : record.HordeIconFileDataID));

            if (sprite != null)
            {
                this.m_followerPortrait.sprite = sprite;
            }
            if (!isTroop)
            {
                if (follower.Quality != 6)
                {
                    this.m_qualityBorder.gameObject.SetActive(true);
                    this.m_levelBorder.gameObject.SetActive(true);
                }
                else
                {
                    this.m_qualityBorder.gameObject.SetActive(false);
                    this.m_levelBorder.gameObject.SetActive(false);
                }
                Color qualityColor = GeneralHelpers.GetQualityColor(follower.Quality);
                this.m_qualityBorder.color = qualityColor;
                this.m_troopBackground.SetActive(false);
                this.m_followerBackground.SetActive(true);
            }
            else
            {
                this.m_qualityBorder.gameObject.SetActive(false);
                this.m_levelBorder.gameObject.SetActive(false);
                this.m_troopBackground.SetActive(true);
                this.m_followerBackground.SetActive(false);
                this.m_iLevelText.gameObject.SetActive(false);
            }
            CreatureRec creatureRec = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceCreatureID : record.HordeCreatureID));

            if (follower.Quality == 6 && record.TitleName != null && record.TitleName.Length > 0)
            {
                this.m_followerNameText.text = record.TitleName;
            }
            else if (record != null)
            {
                this.m_followerNameText.text = creatureRec.Name;
            }
            this.m_iLevelText.text = follower.FollowerLevel.ToString();
            GarrClassSpecRec garrClassSpecRec = StaticDB.garrClassSpecDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE ? (int)record.AllianceGarrClassSpecID : (int)record.HordeGarrClassSpecID));

            this.m_classText.text = garrClassSpecRec.ClassSpec;
            if (!isTroop)
            {
                if (isMaxLevelAndMaxQuality)
                {
                    this.m_progressBarObj.SetActive(false);
                    this.m_toNextLevelOrUpgradeText.text = string.Empty;
                }
                else if (!nextCapIsForQuality)
                {
                    this.m_progressBarObj.SetActive(true);
                    this.m_toNextLevelOrUpgradeText.text = StaticDB.GetString("TO_NEXT_LEVEL", string.Empty);
                }
                else
                {
                    this.m_progressBarObj.SetActive(true);
                    this.m_toNextLevelOrUpgradeText.text = StaticDB.GetString("TO_NEXT_UPGRADE", string.Empty);
                }
            }
        }
Esempio n. 16
0
        public void ScheduleNotifications()
        {
            this.ClearPendingNotifications();
            if (!Main.instance.m_enableNotifications)
            {
                return;
            }
            List <NotificationData> list = new List <NotificationData>();
            ICollection <WrapperGarrisonMission> values = PersistentMissionData.missionDictionary.Values;

            foreach (WrapperGarrisonMission wrapperGarrisonMission in values)
            {
                GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(wrapperGarrisonMission.MissionRecID);
                if (record != null && (GARR_FOLLOWER_TYPE)record.GarrFollowerTypeID == GarrisonStatus.GarrisonFollowerType)
                {
                    if (wrapperGarrisonMission.MissionState == 1)
                    {
                        if ((record.Flags & 16u) == 0u)
                        {
                            TimeSpan t             = GarrisonStatus.CurrentTime() - wrapperGarrisonMission.StartTime;
                            TimeSpan timeRemaining = wrapperGarrisonMission.MissionDuration - t;
                            list.Add(new NotificationData
                            {
                                notificationText = record.Name,
                                timeRemaining    = timeRemaining,
                                notificationType = NotificationType.missionCompete
                            });
                        }
                    }
                }
            }
            foreach (WrapperCharacterShipment wrapperCharacterShipment in PersistentShipmentData.shipmentDictionary.Values)
            {
                CharShipmentRec record2 = StaticDB.charShipmentDB.GetRecord(wrapperCharacterShipment.ShipmentRecID);
                if (record2 == null)
                {
                    Debug.LogError("Invalid Shipment ID: " + wrapperCharacterShipment.ShipmentRecID);
                }
                else
                {
                    string notificationText = "Invalid";
                    if (record2.GarrFollowerID > 0)
                    {
                        GarrFollowerRec record3 = StaticDB.garrFollowerDB.GetRecord((int)record2.GarrFollowerID);
                        if (record3 == null)
                        {
                            Debug.LogError("Invalid Follower ID: " + record2.GarrFollowerID);
                            continue;
                        }
                        int         num     = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record3.AllianceCreatureID : record3.HordeCreatureID;
                        CreatureRec record4 = StaticDB.creatureDB.GetRecord(num);
                        if (record4 == null)
                        {
                            Debug.LogError("Invalid Creature ID: " + num);
                            continue;
                        }
                        notificationText = record4.Name;
                    }
                    if (record2.DummyItemID > 0)
                    {
                        ItemRec record5 = StaticDB.itemDB.GetRecord(record2.DummyItemID);
                        if (record5 == null)
                        {
                            Debug.LogError("Invalid Item ID: " + record2.DummyItemID);
                            continue;
                        }
                        notificationText = record5.Display;
                    }
                    TimeSpan t2             = GarrisonStatus.CurrentTime() - wrapperCharacterShipment.CreationTime;
                    TimeSpan timeRemaining2 = wrapperCharacterShipment.ShipmentDuration - t2;
                    list.Add(new NotificationData
                    {
                        notificationText = notificationText,
                        timeRemaining    = timeRemaining2,
                        notificationType = NotificationType.workOrderReady
                    });
                }
            }
            foreach (WrapperGarrisonTalent wrapperGarrisonTalent in PersistentTalentData.talentDictionary.Values)
            {
                if ((wrapperGarrisonTalent.Flags & 1) == 0)
                {
                    if (!(wrapperGarrisonTalent.StartTime <= DateTime.UtcNow))
                    {
                        GarrTalentRec record6 = StaticDB.garrTalentDB.GetRecord(wrapperGarrisonTalent.GarrTalentID);
                        if (record6 != null)
                        {
                            TimeSpan timeRemaining3 = TimeSpan.Zero;
                            if ((wrapperGarrisonTalent.Flags & 2) == 0)
                            {
                                timeRemaining3 = TimeSpan.FromSeconds((double)record6.ResearchDurationSecs) - (GarrisonStatus.CurrentTime() - wrapperGarrisonTalent.StartTime);
                            }
                            else
                            {
                                timeRemaining3 = TimeSpan.FromSeconds((double)record6.RespecDurationSecs) - (GarrisonStatus.CurrentTime() - wrapperGarrisonTalent.StartTime);
                            }
                            list.Add(new NotificationData
                            {
                                notificationText = record6.Name,
                                timeRemaining    = timeRemaining3,
                                notificationType = NotificationType.talentReady
                            });
                        }
                    }
                }
            }
            int num2 = 0;

            foreach (NotificationData notificationData in from n in list
                     orderby n.timeRemaining
                     select n)
            {
                if (notificationData.notificationType == NotificationType.missionCompete)
                {
                    LocalNotifications.ScheduleMissionCompleteNotification(notificationData.notificationText, ++num2, Convert.ToInt64(notificationData.timeRemaining.TotalSeconds));
                }
                if (notificationData.notificationType == NotificationType.workOrderReady)
                {
                    LocalNotifications.ScheduleWorkOrderReadyNotification(notificationData.notificationText, ++num2, Convert.ToInt64(notificationData.timeRemaining.TotalSeconds));
                }
                if (notificationData.notificationType == NotificationType.talentReady)
                {
                    LocalNotifications.ScheduleTalentResearchCompleteNotification(notificationData.notificationText, ++num2, Convert.ToInt64(notificationData.timeRemaining.TotalSeconds));
                }
                Debug.Log(string.Concat(new object[]
                {
                    "Scheduling Notification for [",
                    notificationData.notificationType,
                    "] ",
                    notificationData.notificationText,
                    " (",
                    num2,
                    ") in ",
                    notificationData.timeRemaining.TotalSeconds,
                    " seconds"
                }));
            }
        }