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();
    }
 private void OnEnable()
 {
     this.GetRequestedMissionCollectionDictionary().Clear();
     this.okButton.SetActive(false);
     this.mainCanvas.renderMode = 1;
     if (GarrisonStatus.Faction() == PVP_FACTION.HORDE)
     {
         this.hordeCommander.SetActive(true);
         this.allianceCommander.SetActive(false);
     }
     else
     {
         this.hordeCommander.SetActive(false);
         this.allianceCommander.SetActive(true);
     }
     this.completedMissionsText.text = string.Empty + PersistentMissionData.GetNumCompletedMissions(false) + " Completed Missions";
     MissionListItem[] componentsInChildren = this.completedMissionListContents.GetComponentsInChildren <MissionListItem>(true);
     for (int i = 0; i < componentsInChildren.Length; i++)
     {
         Object.DestroyImmediate(componentsInChildren[i].gameObject);
     }
     MissionRewardDisplay[] componentsInChildren2 = this.missionRewardsIconArea.GetComponentsInChildren <MissionRewardDisplay>(true);
     for (int j = 0; j < componentsInChildren2.Length; j++)
     {
         Object.DestroyImmediate(componentsInChildren2[j].gameObject);
     }
     this.missionReportView.SetActive(true);
     this.missionResultsView.SetActive(false);
 }
Example #3
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;
         }
     }
 }
Example #4
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();
    }
Example #5
0
    public void SetCharShipmentTroop(CharShipmentRec charShipmentRec, int iconFileDataID = 0)
    {
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID);

        if (record == null)
        {
            Debug.LogError("Invalid Follower ID: " + charShipmentRec.GarrFollowerID);
            return;
        }
        if (iconFileDataID <= 0)
        {
            iconFileDataID = ((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID);
        }
        Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, iconFileDataID);

        if (sprite != null)
        {
            this.m_troopPortraitImage.set_sprite(sprite);
        }
    }
 private void OnEnable()
 {
     this.m_theActualButton.SetActive(false);
     this.m_numReadyTroops = 0;
     this.m_numReadyTroopsText.set_text(string.Empty);
     this.m_numReadyTroopsTextBG.SetActive(false);
     if (this.m_treasureChestHorde != null && this.m_treasureChestAlliance != null)
     {
         if (GarrisonStatus.Faction() == PVP_FACTION.HORDE)
         {
             this.m_treasureChestHorde.SetActive(true);
             this.m_treasureChestAlliance.SetActive(false);
         }
         else
         {
             this.m_treasureChestHorde.SetActive(false);
             this.m_treasureChestAlliance.SetActive(true);
         }
     }
 }
 private void SetTroopSlotForExistingFollower(TroopSlot[] troopSlots, JamGarrisonFollower follower)
 {
     if (follower.Durability <= 0)
     {
         return;
     }
     for (int i = 0; i < troopSlots.Length; i++)
     {
         TroopSlot troopSlot       = troopSlots[i];
         int       ownedFollowerID = troopSlot.GetOwnedFollowerID();
         if (ownedFollowerID != 0 && ownedFollowerID == follower.GarrFollowerID)
         {
             return;
         }
     }
     for (int j = 0; j < troopSlots.Length; j++)
     {
         TroopSlot troopSlot2 = troopSlots[j];
         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_shipmentType.CharShipmentID, 0uL, follower.GarrFollowerID, false, iconFileDataID);
             return;
         }
     }
     for (int k = 0; k < troopSlots.Length; k++)
     {
         TroopSlot troopSlot3 = troopSlots[k];
         if (troopSlot3.IsEmpty())
         {
             GarrFollowerRec record2         = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);
             int             iconFileDataID2 = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record2.AllianceIconFileDataID : record2.HordeIconFileDataID;
             troopSlot3.SetCharShipment(this.m_shipmentType.CharShipmentID, 0uL, follower.GarrFollowerID, false, iconFileDataID2);
             return;
         }
     }
 }
    private void UpdateTroopSlots()
    {
        int maxTroops = this.GetMaxTroops((int)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? this.m_followerRec.AllianceGarrClassSpecID : this.m_followerRec.HordeGarrClassSpecID));

        TroopSlot[] componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true);
        if (componentsInChildren.Length < maxTroops)
        {
            for (int i = componentsInChildren.Length; i < maxTroops; i++)
            {
                GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopSlotPrefab);
                gameObject.get_transform().SetParent(this.m_troopSlotsRootObject.get_transform(), false);
                TroopSlot component = gameObject.GetComponent <TroopSlot>();
                component.SetCharShipment(this.m_shipmentType.CharShipmentID, 0uL, 0, false, 0);
            }
        }
        if (componentsInChildren.Length > maxTroops)
        {
            for (int j = maxTroops; j < componentsInChildren.Length; j++)
            {
                Object.DestroyImmediate(componentsInChildren[j].get_gameObject());
            }
        }
        componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true);
        TroopSlot[] array = componentsInChildren;
        for (int k = 0; k < array.Length; k++)
        {
            TroopSlot troopSlot       = array[k];
            int       ownedFollowerID = troopSlot.GetOwnedFollowerID();
            if (ownedFollowerID != 0 && (!PersistentFollowerData.followerDictionary.ContainsKey(ownedFollowerID) || PersistentFollowerData.followerDictionary.get_Item(ownedFollowerID).Durability == 0))
            {
                troopSlot.SetCharShipment(this.m_shipmentType.CharShipmentID, 0uL, 0, false, 0);
            }
        }
        uint num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? this.m_followerRec.AllianceGarrClassSpecID : this.m_followerRec.HordeGarrClassSpecID;

        using (Dictionary <int, JamGarrisonFollower> .ValueCollection.Enumerator enumerator = PersistentFollowerData.followerDictionary.get_Values().GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                JamGarrisonFollower current = enumerator.get_Current();
                GarrFollowerRec     record  = StaticDB.garrFollowerDB.GetRecord(current.GarrFollowerID);
                uint num2 = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID;
                if (num2 == num && current.Durability > 0)
                {
                    this.SetTroopSlotForExistingFollower(componentsInChildren, current);
                }
            }
        }
        CharShipmentRec record2     = StaticDB.charShipmentDB.GetRecord(this.m_shipmentType.CharShipmentID);
        IEnumerator     enumerator2 = PersistentShipmentData.shipmentDictionary.get_Values().GetEnumerator();

        try
        {
            while (enumerator2.MoveNext())
            {
                JamCharacterShipment jamCharacterShipment = (JamCharacterShipment)enumerator2.get_Current();
                if (jamCharacterShipment.ShipmentRecID == this.m_shipmentType.CharShipmentID)
                {
                    this.SetTroopSlotForPendingShipment(componentsInChildren, jamCharacterShipment.ShipmentID);
                }
                else
                {
                    CharShipmentRec record3 = StaticDB.charShipmentDB.GetRecord(jamCharacterShipment.ShipmentRecID);
                    if (record3.ContainerID == record2.ContainerID)
                    {
                        this.SetTroopSlotForPendingShipment(componentsInChildren, jamCharacterShipment.ShipmentID);
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable = enumerator2 as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
    }
Example #9
0
    private void UpdateTroopSlots()
    {
        if (this.m_followerRec == null || this.m_charShipmentRec == null)
        {
            return;
        }
        int maxTroops = this.GetMaxTroops((int)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? this.m_followerRec.AllianceGarrClassSpecID : this.m_followerRec.HordeGarrClassSpecID));

        TroopSlot[] componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true);
        if (componentsInChildren.Length < maxTroops)
        {
            for (int i = componentsInChildren.Length; i < maxTroops; i++)
            {
                GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopSlotPrefab);
                gameObject.transform.SetParent(this.m_troopSlotsRootObject.transform, false);
                TroopSlot component = gameObject.GetComponent <TroopSlot>();
                component.SetCharShipment(this.m_charShipmentRec.ID, 0UL, 0, false, 0);
            }
        }
        if (componentsInChildren.Length > maxTroops)
        {
            for (int j = maxTroops; j < componentsInChildren.Length; j++)
            {
                Object.DestroyImmediate(componentsInChildren[j].gameObject);
            }
        }
        componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true);
        foreach (TroopSlot troopSlot in componentsInChildren)
        {
            int ownedFollowerID = troopSlot.GetOwnedFollowerID();
            if (ownedFollowerID != 0 && (!PersistentFollowerData.followerDictionary.ContainsKey(ownedFollowerID) || PersistentFollowerData.followerDictionary[ownedFollowerID].Durability == 0))
            {
                troopSlot.SetCharShipment(this.m_charShipmentRec.ID, 0UL, 0, false, 0);
            }
        }
        uint num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? this.m_followerRec.AllianceGarrClassSpecID : this.m_followerRec.HordeGarrClassSpecID;

        foreach (JamGarrisonFollower jamGarrisonFollower in PersistentFollowerData.followerDictionary.Values)
        {
            GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(jamGarrisonFollower.GarrFollowerID);
            uint            num2   = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID;
            if (num2 == num && jamGarrisonFollower.Durability > 0)
            {
                this.SetTroopSlotForExistingFollower(componentsInChildren, jamGarrisonFollower);
            }
        }
        CharShipmentRec record2     = StaticDB.charShipmentDB.GetRecord(this.m_charShipmentRec.ID);
        IEnumerator     enumerator2 = PersistentShipmentData.shipmentDictionary.Values.GetEnumerator();

        try
        {
            while (enumerator2.MoveNext())
            {
                object obj = enumerator2.Current;
                JamCharacterShipment jamCharacterShipment = (JamCharacterShipment)obj;
                if (jamCharacterShipment.ShipmentRecID == this.m_charShipmentRec.ID)
                {
                    this.SetTroopSlotForPendingShipment(componentsInChildren, jamCharacterShipment.ShipmentID);
                }
                else
                {
                    CharShipmentRec record3 = StaticDB.charShipmentDB.GetRecord(jamCharacterShipment.ShipmentRecID);
                    if (record3.ContainerID == record2.ContainerID)
                    {
                        this.SetTroopSlotForPendingShipment(componentsInChildren, jamCharacterShipment.ShipmentID);
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator2 as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
    }
Example #10
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();
        }
    }
Example #11
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
                });
            }
        }
    }
Example #12
0
    public void SetMission(int garrMissionID)
    {
        base.get_gameObject().set_name("AdvMapMissionSite " + garrMissionID);
        if (!PersistentMissionData.missionDictionary.ContainsKey(garrMissionID))
        {
            return;
        }
        this.m_garrMissionID = garrMissionID;
        GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(garrMissionID);

        if (record == null || !PersistentMissionData.missionDictionary.ContainsKey(garrMissionID))
        {
            return;
        }
        this.m_areaID           = record.AreaID;
        this.m_isSupportMission = false;
        if ((record.Flags & 16u) != 0u)
        {
            this.m_isSupportMission = true;
            this.m_missionTimeRemainingText.set_text("Fortified");
        }
        GarrMissionTypeRec record2 = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID);

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

        if (jamGarrisonMobileMission.MissionState == 1 || jamGarrisonMobileMission.MissionState == 2)
        {
            this.m_missionDurationInSeconds = (int)jamGarrisonMobileMission.MissionDuration;
        }
        else
        {
            this.m_missionDurationInSeconds = record.MissionDuration;
        }
        this.m_missionStartedTime = jamGarrisonMobileMission.StartTime;
        this.m_availableMissionGroup.get_gameObject().SetActive(jamGarrisonMobileMission.MissionState == 0);
        this.m_inProgressMissionGroup.get_gameObject().SetActive(jamGarrisonMobileMission.MissionState == 1);
        this.m_completeMissionGroup.get_gameObject().SetActive(jamGarrisonMobileMission.MissionState == 2 || jamGarrisonMobileMission.MissionState == 3);
        if (jamGarrisonMobileMission.MissionState == 1)
        {
            using (Dictionary <int, JamGarrisonFollower> .Enumerator enumerator = PersistentFollowerData.followerDictionary.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <int, JamGarrisonFollower> current = enumerator.get_Current();
                    if (current.get_Value().CurrentMissionID == garrMissionID)
                    {
                        GarrFollowerRec record3 = StaticDB.garrFollowerDB.GetRecord(current.get_Value().GarrFollowerID);
                        if (record3 != null)
                        {
                            Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record3.AllianceIconFileDataID : record3.HordeIconFileDataID);
                            if (sprite != null)
                            {
                                this.m_followerPortraitImage.set_sprite(sprite);
                            }
                            this.m_followerPortraitRingImage.GetComponent <Image>().set_enabled(true);
                            break;
                        }
                    }
                }
            }
        }
        this.m_missionLevelText.set_text(string.Empty + record.TargetLevel + ((record.TargetLevel != 110) ? string.Empty : (" (" + record.TargetItemLevel + ")")));
        this.UpdateMissionRemainingTimeDisplay();
    }
Example #13
0
    public void ShowMissionResults(int garrMissionID, int missionResultType, bool awardOvermax)
    {
        this.m_missionResultsDisplayCanvasGroupAutoFadeOut.Reset();
        this.m_currentResultType = (MissionResultType)missionResultType;
        this.m_followerExperienceDisplayArea.SetActive(false);
        this.m_attemptedAutoComplete = false;
        this.m_garrMissionID         = garrMissionID;
        this.m_darknessBG.SetActive(true);
        this.m_popupView.SetActive(true);
        this.m_bonusLootDisplay.SetActive(false);
        if (this.missionFollowerSlotGroup != null)
        {
            MissionFollowerSlot[] componentsInChildren = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                if (componentsInChildren[i] != null && componentsInChildren[i] != this.missionFollowerSlotGroup.get_transform())
                {
                    Object.DestroyImmediate(componentsInChildren[i].get_gameObject());
                }
            }
        }
        MissionEncounter[] componentsInChildren2 = this.enemyPortraitsGroup.GetComponentsInChildren <MissionEncounter>(true);
        for (int j = 0; j < componentsInChildren2.Length; j++)
        {
            if (componentsInChildren2[j] != null && componentsInChildren2[j] != this.enemyPortraitsGroup.get_transform())
            {
                Object.DestroyImmediate(componentsInChildren2[j].get_gameObject());
            }
        }
        if (this.treasureChestHorde != null && this.treasureChestAlliance != null)
        {
            if (GarrisonStatus.Faction() == PVP_FACTION.HORDE)
            {
                this.treasureChestHorde.SetActive(true);
                this.treasureChestAlliance.SetActive(false);
            }
            else
            {
                this.treasureChestHorde.SetActive(false);
                this.treasureChestAlliance.SetActive(true);
            }
        }
        JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary.get_Item(garrMissionID);

        this.m_missionStartedTime       = jamGarrisonMobileMission.StartTime;
        this.m_missionDurationInSeconds = jamGarrisonMobileMission.MissionDuration;
        for (int k = 0; k < jamGarrisonMobileMission.Encounter.Length; k++)
        {
            GameObject gameObject = Object.Instantiate <GameObject>(this.missionEncounterPrefab);
            gameObject.get_transform().SetParent(this.enemyPortraitsGroup.get_transform(), false);
            MissionEncounter component = gameObject.GetComponent <MissionEncounter>();
            int garrMechanicID         = (jamGarrisonMobileMission.Encounter[k].MechanicID.Length <= 0) ? 0 : jamGarrisonMobileMission.Encounter[k].MechanicID[0];
            component.SetEncounter(jamGarrisonMobileMission.Encounter[k].EncounterID, garrMechanicID);
        }
        GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(garrMissionID);

        this.missionNameText.set_text(record.Name);
        this.missionLocationText.set_text(record.Location);
        this.missioniLevelText.set_text(StaticDB.GetString("ITEM_LEVEL_ABBREVIATION", null) + " " + record.TargetItemLevel);
        GarrMissionTypeRec record2 = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID);

        this.missionTypeImage.set_overrideSprite(TextureAtlas.instance.GetAtlasSprite((int)record2.UiTextureAtlasMemberID));
        if (this.missionFollowerSlotGroup != null)
        {
            int num = 0;
            while ((long)num < (long)((ulong)record.MaxFollowers))
            {
                GameObject gameObject2 = Object.Instantiate <GameObject>(this.missionFollowerSlotPrefab);
                gameObject2.get_transform().SetParent(this.missionFollowerSlotGroup.get_transform(), false);
                MissionFollowerSlot component2 = gameObject2.GetComponent <MissionFollowerSlot>();
                component2.m_enemyPortraitsGroup = this.enemyPortraitsGroup;
                num++;
            }
        }
        if (record.UiTextureKitID > 0u)
        {
            UiTextureKitRec record3 = StaticDB.uiTextureKitDB.GetRecord((int)record.UiTextureKitID);
            this.m_scrollingEnvironment_Back.set_enabled(false);
            this.m_scrollingEnvironment_Mid.set_enabled(false);
            this.m_scrollingEnvironment_Fore.set_enabled(false);
            int uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Back");
            if (uITextureAtlasMemberID > 0)
            {
                Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite(uITextureAtlasMemberID);
                if (atlasSprite != null)
                {
                    this.m_scrollingEnvironment_Back.set_enabled(true);
                    this.m_scrollingEnvironment_Back.set_sprite(atlasSprite);
                }
            }
            int uITextureAtlasMemberID2 = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Mid");
            if (uITextureAtlasMemberID2 > 0)
            {
                Sprite atlasSprite2 = TextureAtlas.instance.GetAtlasSprite(uITextureAtlasMemberID2);
                if (atlasSprite2 != null)
                {
                    this.m_scrollingEnvironment_Mid.set_enabled(true);
                    this.m_scrollingEnvironment_Mid.set_sprite(atlasSprite2);
                }
            }
            int uITextureAtlasMemberID3 = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Fore");
            if (uITextureAtlasMemberID3 > 0)
            {
                Sprite atlasSprite3 = TextureAtlas.instance.GetAtlasSprite(uITextureAtlasMemberID3);
                if (atlasSprite3 != null)
                {
                    this.m_scrollingEnvironment_Fore.set_enabled(true);
                    this.m_scrollingEnvironment_Fore.set_sprite(atlasSprite3);
                }
            }
        }
        else
        {
            Debug.LogWarning(string.Concat(new object[]
            {
                "DATA ERROR: Mission UITextureKit Not Set for mission ID:",
                record.ID,
                " - ",
                record.Name
            }));
            Debug.LogWarning("This means the scrolling background images will show the wrong location");
        }
        if (this.m_lootGroupObj == null || this.m_missionRewardDisplayPrefab == null)
        {
            return;
        }
        MissionRewardDisplay[] componentsInChildren3 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
        for (int l = 0; l < componentsInChildren3.Length; l++)
        {
            if (componentsInChildren3[l] != null)
            {
                Object.DestroyImmediate(componentsInChildren3[l].get_gameObject());
            }
        }
        MissionFollowerSlot[] componentsInChildren4 = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
        int num2 = 0;

        using (Dictionary <int, JamGarrisonFollower> .ValueCollection.Enumerator enumerator = PersistentFollowerData.followerDictionary.get_Values().GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                JamGarrisonFollower current = enumerator.get_Current();
                if (current.CurrentMissionID == garrMissionID)
                {
                    componentsInChildren4[num2++].SetFollower(current.GarrFollowerID);
                    if (missionResultType == 1)
                    {
                        PersistentFollowerData.CachePreMissionFollower(current);
                    }
                }
            }
        }
        this.UpdateMissionStatus(garrMissionID);
        MissionFollowerSlot[] array = componentsInChildren4;
        for (int m = 0; m < array.Length; m++)
        {
            MissionFollowerSlot missionFollowerSlot = array[m];
            missionFollowerSlot.InitHeartPanel();
        }
        MissionRewardDisplay.InitMissionRewards(this.m_missionRewardDisplayPrefab.get_gameObject(), this.m_lootGroupObj.get_transform(), jamGarrisonMobileMission.Reward);
        if (record.OvermaxRewardPackID > 0 && jamGarrisonMobileMission.OvermaxReward.Length > 0)
        {
            this.m_bonusLootDisplay.SetActive(true);
            JamGarrisonMissionReward jamGarrisonMissionReward = jamGarrisonMobileMission.OvermaxReward[0];
            if (jamGarrisonMissionReward.ItemID > 0)
            {
                this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.item, jamGarrisonMissionReward.ItemID, (int)jamGarrisonMissionReward.ItemQuantity, 0, jamGarrisonMissionReward.ItemFileDataID);
            }
            else if (jamGarrisonMissionReward.FollowerXP > 0u)
            {
                this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.followerXP, 0, (int)jamGarrisonMissionReward.FollowerXP, 0, 0);
            }
            else if (jamGarrisonMissionReward.CurrencyQuantity > 0u)
            {
                if (jamGarrisonMissionReward.CurrencyType == 0)
                {
                    this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.gold, 0, (int)(jamGarrisonMissionReward.CurrencyQuantity / 10000u), 0, 0);
                }
                else
                {
                    CurrencyTypesRec record4 = StaticDB.currencyTypesDB.GetRecord(jamGarrisonMissionReward.CurrencyType);
                    int rewardQuantity       = (int)((ulong)jamGarrisonMissionReward.CurrencyQuantity / (ulong)(((record4.Flags & 8u) == 0u) ? 1L : 100L));
                    this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.currency, jamGarrisonMissionReward.CurrencyType, rewardQuantity, 0, 0);
                }
            }
        }
        this.m_timeUntilFadeOutMissionDetailsDisplay   = this.m_missionDetailsFadeOutDelay;
        this.m_timeUntilShowFollowerExperienceDisplays = this.m_experienceDisplayInitialEntranceDelay;
        if (missionResultType == 2)
        {
            this.InitFollowerExperienceDisplays();
            Main.instance.m_UISound.Play_MissionSuccess();
            this.m_missionInProgressMessage.SetActive(false);
            this.m_missionSuccessMessage.SetActive(true);
            this.m_missionFailMessage.SetActive(false);
            if (this.m_fancyEntrance != null)
            {
                Object.DestroyImmediate(this.m_fancyEntrance);
                iTween.Stop(this.m_missionSuccessMessage);
                this.m_missionSuccessMessage.get_transform().set_localScale(Vector3.get_one());
                iTween.Stop(this.m_missionFailMessage);
                this.m_missionFailMessage.get_transform().set_localScale(Vector3.get_one());
            }
            this.m_missionSuccessMessage.SetActive(false);
            this.m_fancyEntrance = this.m_missionSuccessMessage.AddComponent <FancyEntrance>();
            this.m_fancyEntrance.m_fadeInCanvasGroup   = this.m_missionSuccessMessage.GetComponent <CanvasGroup>();
            this.m_fancyEntrance.m_fadeInTime          = this.m_messageFadeInTime;
            this.m_fancyEntrance.m_punchScale          = this.m_messagePunchScale;
            this.m_fancyEntrance.m_punchScaleAmount    = this.m_messagePunchScaleAmount;
            this.m_fancyEntrance.m_punchScaleDuration  = this.m_messagePunchScaleDuration;
            this.m_fancyEntrance.m_timeToDelayEntrance = this.m_messageTimeToDelayEntrance;
            this.m_missionSuccessMessage.SetActive(true);
            MissionRewardDisplay[] componentsInChildren5 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
            for (int n = 0; n < componentsInChildren5.Length; n++)
            {
                componentsInChildren5[n].ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)n);
            }
            if (awardOvermax)
            {
                this.m_bonusMissionRewardDisplay.ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)componentsInChildren5.Length);
            }
            else
            {
                this.m_bonusMissionRewardDisplay.ShowResultFail(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)componentsInChildren5.Length);
            }
        }
        if (missionResultType == 3)
        {
            this.InitFollowerExperienceDisplays();
            Main.instance.m_UISound.Play_MissionFailure();
            this.m_missionInProgressMessage.SetActive(false);
            this.m_missionSuccessMessage.SetActive(false);
            this.m_missionFailMessage.SetActive(true);
            if (this.m_fancyEntrance != null)
            {
                Object.DestroyImmediate(this.m_fancyEntrance);
                iTween.Stop(this.m_missionSuccessMessage);
                this.m_missionSuccessMessage.get_transform().set_localScale(Vector3.get_one());
                iTween.Stop(this.m_missionFailMessage);
                this.m_missionFailMessage.get_transform().set_localScale(Vector3.get_one());
            }
            this.m_missionFailMessage.SetActive(false);
            this.m_fancyEntrance = this.m_missionFailMessage.AddComponent <FancyEntrance>();
            this.m_fancyEntrance.m_fadeInCanvasGroup   = this.m_missionFailMessage.GetComponent <CanvasGroup>();
            this.m_fancyEntrance.m_fadeInTime          = this.m_messageFadeInTime;
            this.m_fancyEntrance.m_punchScale          = this.m_messagePunchScale;
            this.m_fancyEntrance.m_punchScaleAmount    = this.m_messagePunchScaleAmount;
            this.m_fancyEntrance.m_punchScaleDuration  = this.m_messagePunchScaleDuration;
            this.m_fancyEntrance.m_timeToDelayEntrance = this.m_messageTimeToDelayEntrance;
            this.m_missionFailMessage.SetActive(true);
            MissionRewardDisplay[] componentsInChildren6 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
            for (int num3 = 0; num3 < componentsInChildren6.Length; num3++)
            {
                componentsInChildren6[num3].ShowResultFail(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)num3);
            }
            this.m_bonusMissionRewardDisplay.ShowResultFail(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)componentsInChildren6.Length);
        }
        if (missionResultType == 0)
        {
            this.m_missionInProgressMessage.SetActive(true);
            this.m_missionSuccessMessage.SetActive(false);
            this.m_missionFailMessage.SetActive(false);
            this.m_bonusMissionRewardDisplay.ClearResults();
        }
        if (missionResultType == 1)
        {
            this.m_missionInProgressMessage.SetActive(false);
            this.m_missionSuccessMessage.SetActive(false);
            this.m_missionFailMessage.SetActive(false);
            FollowerExperienceDisplay[] componentsInChildren7 = this.m_followerExperienceDisplayArea.GetComponentsInChildren <FollowerExperienceDisplay>(true);
            FollowerExperienceDisplay[] array2 = componentsInChildren7;
            for (int num4 = 0; num4 < array2.Length; num4++)
            {
                FollowerExperienceDisplay followerExperienceDisplay = array2[num4];
                Object.DestroyImmediate(followerExperienceDisplay.get_gameObject());
            }
        }
        if (this.m_partyBuffGroup != null)
        {
            AbilityDisplay[] componentsInChildren8 = this.m_partyBuffGroup.GetComponentsInChildren <AbilityDisplay>(true);
            AbilityDisplay[] array3 = componentsInChildren8;
            for (int num5 = 0; num5 < array3.Length; num5++)
            {
                AbilityDisplay abilityDisplay = array3[num5];
                Object.DestroyImmediate(abilityDisplay.get_gameObject());
            }
        }
        int num6 = 0;

        using (Dictionary <int, JamGarrisonFollower> .ValueCollection.Enumerator enumerator2 = PersistentFollowerData.followerDictionary.get_Values().GetEnumerator())
        {
            while (enumerator2.MoveNext())
            {
                JamGarrisonFollower current2 = enumerator2.get_Current();
                if (current2.CurrentMissionID == garrMissionID)
                {
                    int[] buffsForCurrentMission = GeneralHelpers.GetBuffsForCurrentMission(current2.GarrFollowerID, garrMissionID, this.missionFollowerSlotGroup);
                    num6 += buffsForCurrentMission.Length;
                    int[] array4 = buffsForCurrentMission;
                    for (int num7 = 0; num7 < array4.Length; num7++)
                    {
                        int        garrAbilityID = array4[num7];
                        GameObject gameObject3   = Object.Instantiate <GameObject>(this.m_mechanicEffectDisplayPrefab);
                        gameObject3.get_transform().SetParent(this.m_partyBuffGroup.get_transform(), false);
                        AbilityDisplay component3 = gameObject3.GetComponent <AbilityDisplay>();
                        component3.SetAbility(garrAbilityID, false, false, null);
                    }
                }
            }
        }
        this.m_partyBuffGroup.SetActive(num6 > 0);
    }
    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();
        }
    }
Example #15
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));
            }
        }
    }
    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.get_transform())
                {
                    Object.DestroyImmediate(componentsInChildren[i].get_gameObject());
                }
            }
            AbilityDisplay[] componentsInChildren2 = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true);
            for (int j = 0; j < componentsInChildren2.Length; j++)
            {
                Object.DestroyImmediate(componentsInChildren2[j].get_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;
        }
        JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary.get_Item(followerID);
        string text   = "Assets/BundleAssets/PortraitIcons/cid_" + record2.ID.ToString("D8") + ".png";
        Sprite sprite = AssetBundleManager.portraitIcons.LoadAsset <Sprite>(text);

        if (sprite != null)
        {
            this.followerSnapshot.set_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.get_transform())
            {
                Object.DestroyImmediate(componentsInChildren3[k].get_gameObject());
            }
        }
        bool flag = false;

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

        for (int m = 0; m < jamGarrisonFollower.AbilityID.Length; m++)
        {
            GarrAbilityRec record4 = StaticDB.garrAbilityDB.GetRecord(jamGarrisonFollower.AbilityID[m]);
            if ((record4.Flags & 1u) == 0u)
            {
                if ((record4.Flags & 512u) == 0u)
                {
                    if (!flag2)
                    {
                        GameObject gameObject3 = Object.Instantiate <GameObject>(this.abilitiesHeaderPrefab);
                        gameObject3.get_transform().SetParent(this.traitsAndAbilitiesRootObject.get_transform(), false);
                        flag2 = true;
                        Text component3 = gameObject3.GetComponent <Text>();
                        if (component3 != null)
                        {
                            component3.set_text(StaticDB.GetString("ABILITIES", null));
                        }
                    }
                    GameObject gameObject4 = Object.Instantiate <GameObject>(this.abilityDisplayPrefab);
                    gameObject4.get_transform().SetParent(this.traitsAndAbilitiesRootObject.get_transform(), false);
                    AbilityDisplay component4 = gameObject4.GetComponent <AbilityDisplay>();
                    component4.SetAbility(jamGarrisonFollower.AbilityID[m], false, false, null);
                }
            }
        }
        if (jamGarrisonFollower.ZoneSupportSpellID > 0)
        {
            GameObject gameObject5 = Object.Instantiate <GameObject>(this.zoneSupportAbilityHeaderPrefab);
            gameObject5.get_transform().SetParent(this.traitsAndAbilitiesRootObject.get_transform(), false);
            GameObject gameObject6 = Object.Instantiate <GameObject>(this.m_spellDisplayPrefab);
            gameObject6.get_transform().SetParent(this.traitsAndAbilitiesRootObject.get_transform(), false);
            SpellDisplay component5 = gameObject6.GetComponent <SpellDisplay>();
            component5.SetSpell(jamGarrisonFollower.ZoneSupportSpellID);
            Text componentInChildren = gameObject5.GetComponentInChildren <Text>();
            if (componentInChildren != null)
            {
                componentInChildren.set_text(StaticDB.GetString("COMBAT_ALLY", null));
            }
        }
        bool flag3 = (jamGarrisonFollower.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.get_transform().SetParent(this.traitsAndAbilitiesRootObject.get_transform(), false);
                text2.set_text(record5.Text);
            }
        }
        this.InitEquipmentSlots(jamGarrisonFollower);
        this.UpdateChampionButtons(jamGarrisonFollower);
    }
Example #17
0
    public static int[] GetBuffsForCurrentMission(int garrFollowerID, int garrMissionID, GameObject missionFollowerSlotGroup, int missionDuration)
    {
        List <int> abilityIDList = new List <int>();

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

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

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

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

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

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

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

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

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

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

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

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

                    case 12u:
                        return(true);
                    }
                    if (!abilityIDList.Contains(garrAbilityRec.ID))
                    {
                        abilityIDList.Add(garrAbilityRec.ID);
                    }
                    return(true);
                });
            }
        }
        return(abilityIDList.ToArray());
    }
Example #18
0
    public void SetFollower(int garrFollowerID)
    {
        this.m_follower        = null;
        this.m_garrFollowerRec = null;
        if (this.m_abilityAreaRootObject != null)
        {
            RectTransform[] componentsInChildren = this.m_abilityAreaRootObject.GetComponentsInChildren <RectTransform>(true);
            if (componentsInChildren != null)
            {
                for (int i = 0; i < componentsInChildren.Length; i++)
                {
                    if (componentsInChildren[i] != null && componentsInChildren[i] != this.m_abilityAreaRootObject.transform)
                    {
                        Object.DestroyImmediate(componentsInChildren[i].gameObject);
                    }
                }
            }
        }
        if (garrFollowerID == 0)
        {
            if (this.m_portraitRingImage != null)
            {
                this.m_portraitRingImage.gameObject.SetActive(false);
            }
            if (this.m_heartPanel != null)
            {
                this.m_heartPanel.SetActive(false);
            }
            this.m_levelBorderImage.gameObject.SetActive(false);
            this.m_levelBorderImage_TitleQuality.gameObject.SetActive(false);
            this.m_portraitImage.gameObject.SetActive(false);
            this.m_qualityColorImage.gameObject.SetActive(false);
            this.m_qualityColorImage_TitleQuality.gameObject.SetActive(false);
            this.m_levelBorderImage.color = Color.white;
            this.m_levelText.gameObject.SetActive(false);
            this.isOccupied = false;
            this.m_portraitFrameImage.enabled = true;
            if (this.currentGarrFollowerID != garrFollowerID)
            {
                AdventureMapPanel.instance.MissionFollowerSlotChanged(this.currentGarrFollowerID, false);
            }
            bool flag = this.currentGarrFollowerID != 0;
            this.currentGarrFollowerID = 0;
            if (flag && this.m_missionDetailView != null)
            {
                this.m_missionDetailView.UpdateMissionStatus();
            }
            if (this.m_disableButtonWhenFollowerAssigned)
            {
                this.m_portraitFrameImage.GetComponent <Image>().enabled = true;
            }
            if (this.m_missionDetailView != null)
            {
                this.m_missionDetailView.NotifyFollowerSlotsChanged();
            }
            return;
        }
        this.m_portraitRingImage.gameObject.SetActive(true);
        this.m_levelBorderImage.gameObject.SetActive(true);
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(garrFollowerID);

        if (record == null)
        {
            return;
        }
        if (record.GarrFollowerTypeID != 4u)
        {
            return;
        }
        MissionMechanic[] mechanics = base.gameObject.transform.parent.parent.parent.gameObject.GetComponentsInChildren <MissionMechanic>(true);
        if (mechanics == null)
        {
            return;
        }
        JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary[garrFollowerID];
        float num = 0f;

        if (this.m_missionDetailView != null)
        {
            num = MissionDetailView.ComputeFollowerBias(jamGarrisonFollower, jamGarrisonFollower.FollowerLevel, (jamGarrisonFollower.ItemLevelWeapon + jamGarrisonFollower.ItemLevelArmor) / 2, this.m_missionDetailView.GetCurrentMissionID());
        }
        if (num == -1f)
        {
            this.m_levelText.color = Color.red;
        }
        else if (num < 0f)
        {
            this.m_levelText.color = new Color(0.9333f, 0.4392f, 0.2117f);
        }
        else
        {
            this.m_levelText.color = Color.white;
        }
        if (this.m_abilityAreaRootObject != null && num > -1f)
        {
            for (int j = 0; j < jamGarrisonFollower.AbilityID.Length; j++)
            {
                GarrAbilityRec garrAbilityRec = StaticDB.garrAbilityDB.GetRecord(jamGarrisonFollower.AbilityID[j]);
                if ((garrAbilityRec.Flags & 1u) == 0u)
                {
                    StaticDB.garrAbilityEffectDB.EnumRecordsByParentID(garrAbilityRec.ID, delegate(GarrAbilityEffectRec garrAbilityEffectRec)
                    {
                        if (garrAbilityEffectRec.GarrMechanicTypeID == 0u)
                        {
                            return(true);
                        }
                        if (garrAbilityEffectRec.AbilityAction != 0u)
                        {
                            return(true);
                        }
                        GarrMechanicTypeRec record2 = StaticDB.garrMechanicTypeDB.GetRecord((int)garrAbilityEffectRec.GarrMechanicTypeID);
                        if (record2 == null)
                        {
                            return(true);
                        }
                        bool flag3 = false;
                        for (int k = 0; k < mechanics.Length; k++)
                        {
                            if (mechanics[k].m_missionMechanicTypeID == record2.ID)
                            {
                                flag3 = true;
                                break;
                            }
                        }
                        if (!flag3)
                        {
                            return(true);
                        }
                        GameObject gameObject = Object.Instantiate <GameObject>(this.m_missionMechanicCounterPrefab);
                        gameObject.transform.SetParent(this.m_abilityAreaRootObject.transform, false);
                        MissionMechanicTypeCounter component = gameObject.GetComponent <MissionMechanicTypeCounter>();
                        component.usedIcon.gameObject.SetActive(false);
                        Sprite sprite2 = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, garrAbilityRec.IconFileDataID);
                        if (sprite2 != null)
                        {
                            component.missionMechanicIcon.sprite = sprite2;
                        }
                        component.countersMissionMechanicTypeID = record2.ID;
                        return(false);
                    });
                }
            }
        }
        this.m_levelText.gameObject.SetActive(true);
        if (jamGarrisonFollower.FollowerLevel < 110)
        {
            this.m_levelText.text = GeneralHelpers.TextOrderString(StaticDB.GetString("LEVEL", null), jamGarrisonFollower.FollowerLevel.ToString());
        }
        else
        {
            this.m_levelText.text = GeneralHelpers.TextOrderString(StaticDB.GetString("ILVL", null), ((jamGarrisonFollower.ItemLevelArmor + jamGarrisonFollower.ItemLevelWeapon) / 2).ToString());
        }
        this.m_portraitImage.gameObject.SetActive(true);
        Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID);

        if (sprite != null)
        {
            this.m_portraitImage.sprite = sprite;
        }
        if (jamGarrisonFollower.Quality == 6)
        {
            this.m_qualityColorImage_TitleQuality.gameObject.SetActive(true);
            this.m_levelBorderImage_TitleQuality.gameObject.SetActive(true);
            this.m_qualityColorImage.gameObject.SetActive(false);
            this.m_levelBorderImage.gameObject.SetActive(false);
        }
        else
        {
            this.m_qualityColorImage_TitleQuality.gameObject.SetActive(false);
            this.m_levelBorderImage_TitleQuality.gameObject.SetActive(false);
            this.m_qualityColorImage.gameObject.SetActive(true);
            this.m_levelBorderImage.gameObject.SetActive(true);
            Color qualityColor = GeneralHelpers.GetQualityColor(jamGarrisonFollower.Quality);
            this.m_qualityColorImage.color = qualityColor;
            this.m_levelBorderImage.color  = qualityColor;
        }
        this.isOccupied = true;
        bool flag2 = (jamGarrisonFollower.Flags & 8) != 0;

        this.m_qualityColorImage.gameObject.SetActive(!flag2);
        this.m_levelBorderImage.gameObject.SetActive(!flag2);
        if (this.m_heartPanel != null)
        {
            this.m_heartPanel.SetActive(flag2);
            if (flag2)
            {
                this.m_garrFollowerRec = record;
                this.m_follower        = jamGarrisonFollower;
            }
        }
        this.m_portraitFrameImage.enabled = !flag2;
        this.currentGarrFollowerID        = garrFollowerID;
        if (this.m_disableButtonWhenFollowerAssigned)
        {
            this.m_portraitFrameImage.GetComponent <Image>().enabled = false;
        }
        if (this.m_missionDetailView != null)
        {
            this.m_missionDetailView.UpdateMissionStatus();
            this.m_missionDetailView.NotifyFollowerSlotsChanged();
        }
    }
    public void ShowMissionResults(int garrMissionID, int missionResultType, bool awardOvermax)
    {
        GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(garrMissionID);

        if (record == null)
        {
            return;
        }
        this.m_missionResultsDisplayCanvasGroupAutoFadeOut.Reset();
        this.m_currentResultType = (MissionResultType)missionResultType;
        this.m_followerExperienceDisplayArea.SetActive(false);
        this.m_attemptedAutoComplete = false;
        this.m_garrMissionID         = garrMissionID;
        this.m_darknessBG.SetActive(true);
        this.m_popupView.SetActive(true);
        this.m_bonusLootDisplay.SetActive(false);
        if (this.missionFollowerSlotGroup != null)
        {
            MissionFollowerSlot[] componentsInChildren = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                if (componentsInChildren[i] != null && componentsInChildren[i] != this.missionFollowerSlotGroup.transform)
                {
                    Object.DestroyImmediate(componentsInChildren[i].gameObject);
                }
            }
        }
        MissionEncounter[] componentsInChildren2 = this.enemyPortraitsGroup.GetComponentsInChildren <MissionEncounter>(true);
        for (int j = 0; j < componentsInChildren2.Length; j++)
        {
            if (componentsInChildren2[j] != null && componentsInChildren2[j] != this.enemyPortraitsGroup.transform)
            {
                Object.DestroyImmediate(componentsInChildren2[j].gameObject);
            }
        }
        if (this.treasureChestHorde != null && this.treasureChestAlliance != null)
        {
            if (GarrisonStatus.Faction() == PVP_FACTION.HORDE)
            {
                this.treasureChestHorde.SetActive(true);
                this.treasureChestAlliance.SetActive(false);
            }
            else
            {
                this.treasureChestHorde.SetActive(false);
                this.treasureChestAlliance.SetActive(true);
            }
        }
        JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary[garrMissionID];

        this.m_missionStartedTime       = jamGarrisonMobileMission.StartTime;
        this.m_missionDurationInSeconds = jamGarrisonMobileMission.MissionDuration;
        for (int k = 0; k < jamGarrisonMobileMission.Encounter.Length; k++)
        {
            GameObject gameObject = Object.Instantiate <GameObject>(this.missionEncounterPrefab);
            gameObject.transform.SetParent(this.enemyPortraitsGroup.transform, false);
            MissionEncounter component = gameObject.GetComponent <MissionEncounter>();
            int garrMechanicID         = (jamGarrisonMobileMission.Encounter[k].MechanicID.Length <= 0) ? 0 : jamGarrisonMobileMission.Encounter[k].MechanicID[0];
            component.SetEncounter(jamGarrisonMobileMission.Encounter[k].EncounterID, garrMechanicID);
        }
        this.missionNameText.text     = record.Name;
        this.missionLocationText.text = record.Location;
        this.missioniLevelText.text   = StaticDB.GetString("ITEM_LEVEL_ABBREVIATION", null) + " " + record.TargetItemLevel;
        GarrMissionTypeRec record2 = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID);

        this.missionTypeImage.overrideSprite = TextureAtlas.instance.GetAtlasSprite((int)record2.UiTextureAtlasMemberID);
        if (this.missionFollowerSlotGroup != null)
        {
            int num = 0;
            while ((long)num < (long)((ulong)record.MaxFollowers))
            {
                GameObject gameObject2 = Object.Instantiate <GameObject>(this.missionFollowerSlotPrefab);
                gameObject2.transform.SetParent(this.missionFollowerSlotGroup.transform, false);
                MissionFollowerSlot component2 = gameObject2.GetComponent <MissionFollowerSlot>();
                component2.m_enemyPortraitsGroup = this.enemyPortraitsGroup;
                num++;
            }
        }
        if (record.UiTextureKitID > 0u)
        {
            UiTextureKitRec record3 = StaticDB.uiTextureKitDB.GetRecord((int)record.UiTextureKitID);
            this.m_scrollingEnvironment_Back.enabled = false;
            this.m_scrollingEnvironment_Mid.enabled  = false;
            this.m_scrollingEnvironment_Fore.enabled = false;
            int uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Back");
            if (uitextureAtlasMemberID > 0)
            {
                Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite(uitextureAtlasMemberID);
                if (atlasSprite != null)
                {
                    this.m_scrollingEnvironment_Back.enabled = true;
                    this.m_scrollingEnvironment_Back.sprite  = atlasSprite;
                }
            }
            int uitextureAtlasMemberID2 = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Mid");
            if (uitextureAtlasMemberID2 > 0)
            {
                Sprite atlasSprite2 = TextureAtlas.instance.GetAtlasSprite(uitextureAtlasMemberID2);
                if (atlasSprite2 != null)
                {
                    this.m_scrollingEnvironment_Mid.enabled = true;
                    this.m_scrollingEnvironment_Mid.sprite  = atlasSprite2;
                }
            }
            int uitextureAtlasMemberID3 = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Fore");
            if (uitextureAtlasMemberID3 > 0)
            {
                Sprite atlasSprite3 = TextureAtlas.instance.GetAtlasSprite(uitextureAtlasMemberID3);
                if (atlasSprite3 != null)
                {
                    this.m_scrollingEnvironment_Fore.enabled = true;
                    this.m_scrollingEnvironment_Fore.sprite  = atlasSprite3;
                }
            }
        }
        else
        {
            Debug.LogWarning(string.Concat(new object[]
            {
                "DATA ERROR: Mission UITextureKit Not Set for mission ID:",
                record.ID,
                " - ",
                record.Name
            }));
            Debug.LogWarning("This means the scrolling background images will show the wrong location");
        }
        if (this.m_lootGroupObj == null || this.m_missionRewardDisplayPrefab == null)
        {
            return;
        }
        MissionRewardDisplay[] componentsInChildren3 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
        for (int l = 0; l < componentsInChildren3.Length; l++)
        {
            if (componentsInChildren3[l] != null)
            {
                Object.DestroyImmediate(componentsInChildren3[l].gameObject);
            }
        }
        if (missionResultType == 1)
        {
            PersistentFollowerData.ClearPreMissionFollowerData();
        }
        List <JamGarrisonFollower> list = new List <JamGarrisonFollower>();

        MissionFollowerSlot[] componentsInChildren4 = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
        int num2 = 0;

        foreach (JamGarrisonFollower jamGarrisonFollower in PersistentFollowerData.followerDictionary.Values)
        {
            if (jamGarrisonFollower.CurrentMissionID == garrMissionID)
            {
                componentsInChildren4[num2++].SetFollower(jamGarrisonFollower.GarrFollowerID);
                if (missionResultType == 1)
                {
                    PersistentFollowerData.CachePreMissionFollower(jamGarrisonFollower);
                }
                list.Add(jamGarrisonFollower);
            }
        }
        this.UpdateMissionStatus(garrMissionID);
        foreach (MissionFollowerSlot missionFollowerSlot in componentsInChildren4)
        {
            missionFollowerSlot.InitHeartPanel();
        }
        MissionRewardDisplay.InitMissionRewards(this.m_missionRewardDisplayPrefab.gameObject, this.m_lootGroupObj.transform, jamGarrisonMobileMission.Reward);
        if (record.OvermaxRewardPackID > 0 && jamGarrisonMobileMission.OvermaxReward.Length > 0)
        {
            this.m_bonusLootDisplay.SetActive(true);
            JamGarrisonMissionReward jamGarrisonMissionReward = jamGarrisonMobileMission.OvermaxReward[0];
            if (jamGarrisonMissionReward.ItemID > 0)
            {
                this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.item, jamGarrisonMissionReward.ItemID, (int)jamGarrisonMissionReward.ItemQuantity, 0, jamGarrisonMissionReward.ItemFileDataID);
            }
            else if (jamGarrisonMissionReward.FollowerXP > 0u)
            {
                this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.followerXP, 0, (int)jamGarrisonMissionReward.FollowerXP, 0, 0);
            }
            else if (jamGarrisonMissionReward.CurrencyQuantity > 0u)
            {
                if (jamGarrisonMissionReward.CurrencyType == 0)
                {
                    this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.gold, 0, (int)(jamGarrisonMissionReward.CurrencyQuantity / 10000u), 0, 0);
                }
                else
                {
                    CurrencyTypesRec record4 = StaticDB.currencyTypesDB.GetRecord(jamGarrisonMissionReward.CurrencyType);
                    int rewardQuantity       = (int)((ulong)jamGarrisonMissionReward.CurrencyQuantity / (ulong)(((record4.Flags & 8u) == 0u) ? 1L : 100L));
                    this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.currency, jamGarrisonMissionReward.CurrencyType, rewardQuantity, 0, 0);
                }
            }
        }
        this.m_timeUntilFadeOutMissionDetailsDisplay   = this.m_missionDetailsFadeOutDelay;
        this.m_timeUntilShowFollowerExperienceDisplays = this.m_experienceDisplayInitialEntranceDelay;
        if (missionResultType == 2)
        {
            this.InitFollowerExperienceDisplays();
            this.m_missionInProgressMessage.SetActive(false);
            this.m_missionSuccessMessage.SetActive(true);
            this.m_missionFailMessage.SetActive(false);
            if (this.m_fancyEntrance != null)
            {
                Object.DestroyImmediate(this.m_fancyEntrance);
                iTween.Stop(this.m_missionSuccessMessage);
                this.m_missionSuccessMessage.transform.localScale = Vector3.one;
                iTween.Stop(this.m_missionFailMessage);
                this.m_missionFailMessage.transform.localScale = Vector3.one;
            }
            this.m_missionSuccessMessage.SetActive(false);
            this.m_fancyEntrance = this.m_missionSuccessMessage.AddComponent <FancyEntrance>();
            this.m_fancyEntrance.m_fadeInCanvasGroup         = this.m_missionSuccessMessage.GetComponent <CanvasGroup>();
            this.m_fancyEntrance.m_fadeInTime                = this.m_messageFadeInTime;
            this.m_fancyEntrance.m_punchScale                = this.m_messagePunchScale;
            this.m_fancyEntrance.m_punchScaleAmount          = this.m_messagePunchScaleAmount;
            this.m_fancyEntrance.m_punchScaleDuration        = this.m_messagePunchScaleDuration;
            this.m_fancyEntrance.m_timeToDelayEntrance       = this.m_messageTimeToDelayEntrance;
            this.m_fancyEntrance.m_activateOnEnable          = true;
            this.m_fancyEntrance.m_objectToNotifyOnBegin     = base.gameObject;
            this.m_fancyEntrance.m_notifyOnBeginCallbackName = "OnShowSuccessMessage";
            this.m_missionSuccessMessage.SetActive(true);
            MissionRewardDisplay[] componentsInChildren5 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
            for (int n = 0; n < componentsInChildren5.Length; n++)
            {
                componentsInChildren5[n].ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)n);
            }
            if (this.m_bonusLootChance > 0)
            {
                iTween.ValueTo(base.gameObject, iTween.Hash(new object[]
                {
                    "name",
                    "ShakeIt",
                    "from",
                    0.3f,
                    "to",
                    1f,
                    "delay",
                    this.m_bonusLootShakeInitialDelay,
                    "time",
                    this.m_bonusLootShakeDuration,
                    "onupdate",
                    "OnBonusLootShakeUpdate",
                    "oncomplete",
                    "OnBonusLootShakeComplete"
                }));
            }
            if (awardOvermax)
            {
                this.m_bonusMissionRewardDisplay.ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)componentsInChildren5.Length);
            }
            else
            {
                this.m_bonusMissionRewardDisplay.ShowResultFail(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)componentsInChildren5.Length);
            }
        }
        if (missionResultType == 3)
        {
            this.InitFollowerExperienceDisplays();
            this.m_missionInProgressMessage.SetActive(false);
            this.m_missionSuccessMessage.SetActive(false);
            this.m_missionFailMessage.SetActive(true);
            if (this.m_fancyEntrance != null)
            {
                Object.DestroyImmediate(this.m_fancyEntrance);
                iTween.Stop(this.m_missionSuccessMessage);
                this.m_missionSuccessMessage.transform.localScale = Vector3.one;
                iTween.Stop(this.m_missionFailMessage);
                this.m_missionFailMessage.transform.localScale = Vector3.one;
            }
            this.m_missionFailMessage.SetActive(false);
            this.m_fancyEntrance = this.m_missionFailMessage.AddComponent <FancyEntrance>();
            this.m_fancyEntrance.m_fadeInCanvasGroup         = this.m_missionFailMessage.GetComponent <CanvasGroup>();
            this.m_fancyEntrance.m_fadeInTime                = this.m_messageFadeInTime;
            this.m_fancyEntrance.m_punchScale                = this.m_messagePunchScale;
            this.m_fancyEntrance.m_punchScaleAmount          = this.m_messagePunchScaleAmount;
            this.m_fancyEntrance.m_punchScaleDuration        = this.m_messagePunchScaleDuration;
            this.m_fancyEntrance.m_timeToDelayEntrance       = this.m_messageTimeToDelayEntrance;
            this.m_fancyEntrance.m_activateOnEnable          = true;
            this.m_fancyEntrance.m_objectToNotifyOnBegin     = base.gameObject;
            this.m_fancyEntrance.m_notifyOnBeginCallbackName = "OnShowFailMessage";
            this.m_missionFailMessage.SetActive(true);
            MissionRewardDisplay[] componentsInChildren6 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
            for (int num3 = 0; num3 < componentsInChildren6.Length; num3++)
            {
                componentsInChildren6[num3].ShowResultFail(this.m_lootEffectInitialDelay);
            }
            this.m_bonusMissionRewardDisplay.ShowResultFail(this.m_lootEffectInitialDelay);
        }
        if (missionResultType == 0)
        {
            this.m_missionInProgressMessage.SetActive(true);
            this.m_missionSuccessMessage.SetActive(false);
            this.m_missionFailMessage.SetActive(false);
            this.m_bonusMissionRewardDisplay.ClearResults();
        }
        if (missionResultType == 1)
        {
            this.m_missionInProgressMessage.SetActive(false);
            this.m_missionSuccessMessage.SetActive(false);
            this.m_missionFailMessage.SetActive(false);
            FollowerExperienceDisplay[] componentsInChildren7 = this.m_followerExperienceDisplayArea.GetComponentsInChildren <FollowerExperienceDisplay>(true);
            foreach (FollowerExperienceDisplay followerExperienceDisplay in componentsInChildren7)
            {
                Object.DestroyImmediate(followerExperienceDisplay.gameObject);
            }
        }
        if (this.m_partyBuffGroup == null)
        {
            return;
        }
        AbilityDisplay[] componentsInChildren8 = this.m_partyBuffGroup.GetComponentsInChildren <AbilityDisplay>(true);
        foreach (AbilityDisplay abilityDisplay in componentsInChildren8)
        {
            Object.DestroyImmediate(abilityDisplay.gameObject);
        }
        int adjustedMissionDuration = GeneralHelpers.GetAdjustedMissionDuration(record, list, this.enemyPortraitsGroup);
        int num6 = 0;

        foreach (JamGarrisonFollower jamGarrisonFollower2 in PersistentFollowerData.followerDictionary.Values)
        {
            if (jamGarrisonFollower2.CurrentMissionID == garrMissionID)
            {
                int[] buffsForCurrentMission = GeneralHelpers.GetBuffsForCurrentMission(jamGarrisonFollower2.GarrFollowerID, garrMissionID, this.missionFollowerSlotGroup, adjustedMissionDuration);
                num6 += buffsForCurrentMission.Length;
                foreach (int garrAbilityID in buffsForCurrentMission)
                {
                    GameObject gameObject3 = Object.Instantiate <GameObject>(this.m_mechanicEffectDisplayPrefab);
                    gameObject3.transform.SetParent(this.m_partyBuffGroup.transform, false);
                    AbilityDisplay component3 = gameObject3.GetComponent <AbilityDisplay>();
                    component3.SetAbility(garrAbilityID, false, false, null);
                }
            }
        }
        if (num6 > 8)
        {
            this.m_partyBuffsText.text = string.Empty;
        }
        else
        {
            this.m_partyBuffsText.text = StaticDB.GetString("PARTY_BUFFS", null);
        }
        HorizontalLayoutGroup component4 = this.m_partyBuffGroup.GetComponent <HorizontalLayoutGroup>();

        if (component4 != null)
        {
            if (num6 > 10 && Main.instance.IsNarrowScreen())
            {
                component4.spacing = 3f;
            }
            else
            {
                component4.spacing = 6f;
            }
        }
        this.m_partyBuffGroup.SetActive(num6 > 0);
    }