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(); }
private void UpdateChampionButtons(JamGarrisonFollower follower) { if (this.m_activateChampionButton == null || this.m_deactivateChampionButton == null) { return; } bool flag = (follower.Flags & 8) != 0; if (flag) { this.m_activateChampionButton.SetActive(false); this.m_deactivateChampionButton.SetActive(false); } else { bool flag2 = (follower.Flags & 4) != 0; bool flag3 = GarrisonStatus.GetRemainingFollowerActivations() > 0; this.m_activateChampionButton.SetActive(flag2 && flag3); int numActiveChampions = GeneralHelpers.GetNumActiveChampions(); int maxActiveFollowers = GarrisonStatus.GetMaxActiveFollowers(); bool flag4 = follower.CurrentMissionID != 0; this.m_deactivateChampionButton.SetActive(!flag2 && !flag4 && numActiveChampions > maxActiveFollowers); } }
private void InitFollowerList() { FollowerListItem[] componentsInChildren = this.m_followerDetailListContent.GetComponentsInChildren <FollowerListItem>(true); foreach (FollowerListItem followerListItem in componentsInChildren) { if (!PersistentFollowerData.followerDictionary.ContainsKey(followerListItem.m_followerID)) { followerListItem.gameObject.SetActive(false); followerListItem.transform.SetParent(Main.instance.transform); } else { JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary[followerListItem.m_followerID]; bool flag = (jamGarrisonFollower.Flags & 8) != 0; if (flag && jamGarrisonFollower.Durability <= 0) { followerListItem.gameObject.SetActive(false); followerListItem.transform.SetParent(Main.instance.transform); } else { followerListItem.SetFollower(jamGarrisonFollower); } } } this.SortFollowerListData(); if (this.m_championsHeader == null) { this.m_championsHeader = Object.Instantiate <FollowerListHeader>(this.m_followerListHeaderPrefab); } this.m_championsHeader.transform.SetParent(this.m_followerDetailListContent.transform, false); this.m_championsHeader.m_title.font = GeneralHelpers.LoadStandardFont(); this.m_championsHeader.m_title.text = StaticDB.GetString("CHAMPIONS", null) + ": "; int numActiveChampions = GeneralHelpers.GetNumActiveChampions(); int maxActiveFollowers = GarrisonStatus.GetMaxActiveFollowers(); if (numActiveChampions <= maxActiveFollowers) { this.m_championsHeader.m_count.text = string.Concat(new object[] { string.Empty, numActiveChampions, "/", maxActiveFollowers }); } else { this.m_championsHeader.m_count.text = string.Concat(new object[] { "<color=#ff0000ff>", numActiveChampions, "/", maxActiveFollowers, "</color>" }); } foreach (KeyValuePair <int, JamGarrisonFollower> keyValuePair in this.m_sortedFollowerList) { bool flag2 = false; foreach (FollowerListItem followerListItem2 in componentsInChildren) { if (followerListItem2.m_followerID == keyValuePair.Value.GarrFollowerID) { flag2 = true; break; } } if (!flag2) { this.InsertFollowerIntoListView(keyValuePair.Value, FollowerCategory.ActiveChampion); } } int numTroops = GeneralHelpers.GetNumTroops(); if (this.m_troopsHeader == null) { this.m_troopsHeader = Object.Instantiate <FollowerListHeader>(this.m_followerListHeaderPrefab); } this.m_troopsHeader.transform.SetParent(this.m_followerDetailListContent.transform, false); this.m_troopsHeader.m_title.font = GeneralHelpers.LoadStandardFont(); this.m_troopsHeader.m_title.text = StaticDB.GetString("TROOPS", null) + ": "; this.m_troopsHeader.m_count.font = GeneralHelpers.LoadStandardFont(); this.m_troopsHeader.m_count.text = string.Empty + numTroops; foreach (KeyValuePair <int, JamGarrisonFollower> keyValuePair2 in this.m_sortedFollowerList) { bool flag3 = false; foreach (FollowerListItem followerListItem3 in componentsInChildren) { if (followerListItem3.m_followerID == keyValuePair2.Value.GarrFollowerID) { flag3 = true; break; } } if (!flag3) { this.InsertFollowerIntoListView(keyValuePair2.Value, FollowerCategory.Troop); } } int numInactiveChampions = GeneralHelpers.GetNumInactiveChampions(); if (this.m_inactiveHeader == null) { this.m_inactiveHeader = Object.Instantiate <FollowerListHeader>(this.m_followerListHeaderPrefab); } this.m_inactiveHeader.transform.SetParent(this.m_followerDetailListContent.transform, false); this.m_inactiveHeader.m_title.font = GeneralHelpers.LoadStandardFont(); this.m_inactiveHeader.m_title.text = StaticDB.GetString("INACTIVE", null) + ": "; this.m_inactiveHeader.m_count.font = GeneralHelpers.LoadStandardFont(); this.m_inactiveHeader.m_count.text = string.Empty + numInactiveChampions; foreach (KeyValuePair <int, JamGarrisonFollower> keyValuePair3 in this.m_sortedFollowerList) { bool flag4 = false; foreach (FollowerListItem followerListItem4 in componentsInChildren) { if (followerListItem4.m_followerID == keyValuePair3.Value.GarrFollowerID) { flag4 = true; break; } } if (!flag4) { this.InsertFollowerIntoListView(keyValuePair3.Value, FollowerCategory.InactiveChampion); } } this.SyncVisibleListOrderToSortedFollowerList(); this.m_championsHeader.gameObject.SetActive(numActiveChampions > 0); this.m_troopsHeader.gameObject.SetActive(numTroops > 0); this.m_inactiveHeader.gameObject.SetActive(numInactiveChampions > 0); this.m_championsHeader.transform.SetSiblingIndex(0); this.m_troopsHeader.transform.SetSiblingIndex(numActiveChampions + 1); this.m_inactiveHeader.transform.SetSiblingIndex(numActiveChampions + numTroops + 2); }