private void Start() { bool flag = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? false : true); this.m_hordeBG.gameObject.SetActive(flag); this.m_allianceBG.gameObject.SetActive(!flag); }
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.Destroy(componentsInChildren[i].gameObject); } MissionRewardDisplay[] componentsInChildren2 = this.missionRewardsIconArea.GetComponentsInChildren <MissionRewardDisplay>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { Object.Destroy(componentsInChildren2[j].gameObject); } this.missionReportView.SetActive(true); this.missionResultsView.SetActive(false); }
private void OnEnable() { this.GetRequestedMissionCollectionDictionary().Clear(); this.okButton.SetActive(false); this.mainCanvas.renderMode = RenderMode.ScreenSpaceCamera; if (GarrisonStatus.Faction() != PVP_FACTION.HORDE) { this.hordeCommander.SetActive(false); this.allianceCommander.SetActive(true); } else { this.hordeCommander.SetActive(true); this.allianceCommander.SetActive(false); } this.completedMissionsText.text = string.Concat(string.Empty, PersistentMissionData.GetNumCompletedMissions(false), " Completed Missions"); MissionListItem[] componentsInChildren = this.completedMissionListContents.GetComponentsInChildren <MissionListItem>(true); for (int i = 0; i < (int)componentsInChildren.Length; i++) { UnityEngine.Object.Destroy(componentsInChildren[i].gameObject); } MissionRewardDisplay[] missionRewardDisplayArray = this.missionRewardsIconArea.GetComponentsInChildren <MissionRewardDisplay>(true); for (int j = 0; j < (int)missionRewardDisplayArray.Length; j++) { UnityEngine.Object.Destroy(missionRewardDisplayArray[j].gameObject); } this.missionReportView.SetActive(true); this.missionResultsView.SetActive(false); }
private void SetCharShipmentTroop(WrapperShipmentType shipmentType, CharShipmentRec charShipmentRec) { this.m_rightStackLayoutElement.minHeight = 170f; this.m_isTroop = true; this.m_charShipmentRec = charShipmentRec; this.m_troopSpecificArea.SetActive(true); this.m_itemSpecificArea.SetActive(false); this.m_troopName.gameObject.SetActive(true); this.m_itemName.gameObject.SetActive(false); GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID); if (record == null) { this.m_troopName.text = "Invalid Follower ID: " + charShipmentRec.GarrFollowerID; return; } this.m_followerRec = record; int num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID; CreatureRec record2 = StaticDB.creatureDB.GetRecord(num); if (record2 == null) { this.m_troopName.text = "Invalid Creature ID: " + num; return; } string text = "Assets/BundleAssets/PortraitIcons/cid_" + record2.ID.ToString("D8") + ".png"; Sprite sprite = AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(text); if (sprite != null) { this.m_troopSnapshotImage.sprite = sprite; } for (int i = 0; i < record.Vitality; i++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.transform.SetParent(this.m_troopHeartContainer.transform, false); } this.m_troopName.text = record2.Name; foreach (GarrFollowerXAbilityRec garrFollowerXAbilityRec in from rec in StaticDB.garrFollowerXAbilityDB.GetRecordsByParentID((int)charShipmentRec.GarrFollowerID) where rec.FactionIndex == (int)GarrisonStatus.Faction() select rec) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab); gameObject2.transform.SetParent(this.m_traitsAndAbilitiesRootObject.transform, false); AbilityDisplay component = gameObject2.GetComponent <AbilityDisplay>(); component.SetAbility(garrFollowerXAbilityRec.GarrAbilityID, true, true, null); } this.UpdateTroopSlots(); this.m_troopResourceCostText.text = string.Empty + shipmentType.CurrencyCost; Sprite sprite2 = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID); if (sprite2 != null) { this.m_troopResourceIcon.sprite = sprite2; } this.UpdateRecruitButtonState(); }
public void UpdateVisuals() { CombatAllyMissionState combatAllyMissionState = CombatAllyMissionState.notAvailable; foreach (WrapperGarrisonMission wrapperGarrisonMission in PersistentMissionData.missionDictionary.Values) { GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(wrapperGarrisonMission.MissionRecID); if (record != null) { if ((record.Flags & 16u) != 0u) { this.m_combatAllyMissionID = wrapperGarrisonMission.MissionRecID; if (wrapperGarrisonMission.MissionState == 1) { combatAllyMissionState = CombatAllyMissionState.inProgress; } else { combatAllyMissionState = CombatAllyMissionState.available; } break; } } } if (combatAllyMissionState == CombatAllyMissionState.inProgress) { foreach (WrapperGarrisonFollower wrapperGarrisonFollower in PersistentFollowerData.followerDictionary.Values) { if (wrapperGarrisonFollower.CurrentMissionID == this.m_combatAllyMissionID) { this.m_combatAllySlot.SetFollower(wrapperGarrisonFollower.GarrFollowerID); this.m_combatAllyLabel.gameObject.SetActive(false); this.m_assignChampionText.gameObject.SetActive(false); this.m_championName.gameObject.SetActive(true); GarrFollowerRec record2 = StaticDB.garrFollowerDB.GetRecord(wrapperGarrisonFollower.GarrFollowerID); CreatureRec record3 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record2.HordeCreatureID : record2.AllianceCreatureID); if (wrapperGarrisonFollower.Quality == 6 && record2.TitleName != null && record2.TitleName.Length > 0) { this.m_championName.text = record2.TitleName; } else if (record2 != null) { this.m_championName.text = record3.Name; } this.m_championName.color = GeneralHelpers.GetQualityColor(wrapperGarrisonFollower.Quality); this.m_combatAllySupportSpellDisplay.gameObject.SetActive(true); this.m_combatAllySupportSpellDisplay.SetSpell(wrapperGarrisonFollower.ZoneSupportSpellID); this.m_unassignCombatAllyButton.SetActive(true); break; } } } else { this.ClearCombatAllyDisplay(); } }
private void SetCharShipmentTroop(WrapperShipmentType shipmentType, CharShipmentRec charShipmentRec) { this.m_isTroop = true; this.m_charShipmentRec = charShipmentRec; this.m_troopSpecificArea.SetActive(true); this.m_itemSpecificArea.SetActive(false); this.m_troopName.gameObject.SetActive(true); this.m_itemName.gameObject.SetActive(false); GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID); if (record == null) { Debug.LogError(string.Concat("Invalid Follower ID: ", charShipmentRec.GarrFollowerID)); this.m_troopName.text = string.Concat("Invalid Follower ID: ", charShipmentRec.GarrFollowerID); return; } this.m_followerRec = record; int num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceCreatureID : record.HordeCreatureID); CreatureRec creatureRec = StaticDB.creatureDB.GetRecord(num); if (creatureRec == null) { Debug.LogError(string.Concat("Invalid Creature ID: ", num)); this.m_troopName.text = string.Concat("Invalid Creature ID: ", num); return; } int d = creatureRec.ID; string str = string.Concat("Assets/BundleAssets/PortraitIcons/cid_", d.ToString("D8"), ".png"); AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(str); for (int i = 0; i < record.Vitality; i++) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.transform.SetParent(this.m_troopHeartContainer.transform, false); } this.m_troopName.text = creatureRec.Name; foreach (GarrFollowerXAbilityRec garrFollowerXAbilityRec in from rec in StaticDB.garrFollowerXAbilityDB.GetRecordsByParentID((int)charShipmentRec.GarrFollowerID) where rec.FactionIndex == (int)GarrisonStatus.Faction() select rec) { GameObject gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab); gameObject1.transform.SetParent(this.m_traitsAndAbilitiesRootObject.transform, false); AbilityDisplay component = gameObject1.GetComponent <AbilityDisplay>(); component.SetAbility(garrFollowerXAbilityRec.GarrAbilityID, true, true, null); } this.UpdateTroopSlots(); this.m_troopResourceCostText.text = string.Concat(string.Empty, shipmentType.CurrencyCost); Sprite sprite = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID); if (sprite != null) { this.m_troopResourceIcon.sprite = sprite; } this.UpdateRecruitButtonState(); }
public void SetStartingMapByFaction() { if (GarrisonStatus.Faction() == PVP_FACTION.HORDE) { this.m_zoneID = AdventureMapPanel.eZone.Zandalar; } else if (GarrisonStatus.Faction() == PVP_FACTION.ALLIANCE) { this.m_zoneID = AdventureMapPanel.eZone.Kultiras; } this.SetMapByActiveZoneID(); }
private void SetTroopSlotForExistingFollower(TroopSlot[] troopSlots, WrapperGarrisonFollower follower) { if (follower.Durability <= 0) { return; } TroopSlot[] troopSlotArray = troopSlots; for (int i = 0; i < (int)troopSlotArray.Length; i++) { int ownedFollowerID = troopSlotArray[i].GetOwnedFollowerID(); if (ownedFollowerID != 0 && ownedFollowerID == follower.GarrFollowerID) { return; } } TroopSlot[] troopSlotArray1 = troopSlots; for (int j = 0; j < (int)troopSlotArray1.Length; j++) { TroopSlot troopSlot = troopSlotArray1[j]; if (troopSlot.IsCollected()) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); int num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceIconFileDataID : record.HordeIconFileDataID); troopSlot.SetCharShipment(this.m_charShipmentRec.ID, (ulong)0, follower.GarrFollowerID, false, num); return; } } TroopSlot[] troopSlotArray2 = troopSlots; for (int k = 0; k < (int)troopSlotArray2.Length; k++) { TroopSlot troopSlot1 = troopSlotArray2[k]; if (troopSlot1.IsPendingCreate()) { GarrFollowerRec garrFollowerRec = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); int num1 = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? garrFollowerRec.AllianceIconFileDataID : garrFollowerRec.HordeIconFileDataID); troopSlot1.SetCharShipment(this.m_charShipmentRec.ID, (ulong)0, follower.GarrFollowerID, false, num1); return; } } TroopSlot[] troopSlotArray3 = troopSlots; for (int l = 0; l < (int)troopSlotArray3.Length; l++) { TroopSlot troopSlot2 = troopSlotArray3[l]; if (troopSlot2.IsEmpty()) { GarrFollowerRec record1 = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); int num2 = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record1.AllianceIconFileDataID : record1.HordeIconFileDataID); troopSlot2.SetCharShipment(this.m_charShipmentRec.ID, (ulong)0, follower.GarrFollowerID, false, num2); return; } } }
private void Start() { if (GarrisonStatus.Faction() == PVP_FACTION.HORDE) { this.m_hordeChest.SetActive(true); this.m_allianceChest.SetActive(false); } else if (GarrisonStatus.Faction() == PVP_FACTION.ALLIANCE) { this.m_hordeChest.SetActive(false); this.m_allianceChest.SetActive(true); } }
public void SetCombatAllyChampion(WrapperGarrisonFollower follower, int garrMissionID, int missionCost) { this.m_combatAllyMissionID = garrMissionID; this.m_combatAllyChampion = new WrapperGarrisonFollower?(follower); this.m_combatAllyAbilityDisplay.SetSpell(this.m_combatAllyChampion.Value.ZoneSupportSpellID); this.m_combatAllySlot.SetFollower(follower.GarrFollowerID); GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); CreatureRec creatureRec = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE ? record.HordeCreatureID : record.AllianceCreatureID)); if (follower.Quality == 6 && record.TitleName != null && record.TitleName.Length > 0) { this.m_combatAllyName.text = record.TitleName; } else if (record != null) { this.m_combatAllyName.text = creatureRec.Name; } Text mCombatAllyName = this.m_combatAllyName; WrapperGarrisonFollower value = this.m_combatAllyChampion.Value; mCombatAllyName.color = GeneralHelpers.GetQualityColor(value.Quality); if (missionCost > GarrisonStatus.WarResources()) { this.m_useItemButtonLabel.text = StaticDB.GetString("CANT_AFFORD", "Can't Afford"); this.m_useItemButtonLabel.color = Color.red; this.m_useItemButton.interactable = false; } else { this.m_useItemButtonLabel.text = StaticDB.GetString("ASSIGN_CHAMPION", null); } int numActiveChampions = GeneralHelpers.GetNumActiveChampions(); int maxActiveFollowers = GarrisonStatus.GetMaxActiveFollowers(); this.m_isOverMaxChampionSoftCap = false; this.m_needMoreResources = false; if (numActiveChampions > maxActiveFollowers) { this.m_isOverMaxChampionSoftCap = true; } if (GarrisonStatus.WarResources() < missionCost) { this.m_needMoreResources = true; } this.SetCombatAllyAvailabilityStatus(); }
private void SetTroopSlotForExistingFollower(TroopSlot[] troopSlots, WrapperGarrisonFollower 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; } } }
public void SetCommunity(Community community) { this.m_community = community; this.m_communityName.text = community.Name; this.m_guildIcon.SetActive(this.m_community.IsGuild()); this.m_communityIcon.gameObject.SetActive(!this.m_community.IsGuild()); if (this.m_community.IsGuild()) { this.m_guildIcon.GetComponent <Image>().sprite = ((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? this.m_hordeGuildSprite : this.m_allianceGuildSprite); } else { this.m_communityIcon.sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, (int)((this.m_community.AvatarId != 0u) ? this.m_community.AvatarId : ((uint)StaticDB.communityIconDB.GetRecord(1).IconFileID))); } this.m_communityBorder.SetActive(!this.m_community.IsGuild()); this.m_guildBorder.SetActive(this.m_community.IsGuild()); this.UpdateNotifications(); }
private void Start() { if (Main.instance.IsNarrowScreen()) { if (this.m_troopSpecificArea != null) { Main.instance.NudgeX(ref this.m_troopSpecificArea, 30f); } if (this.m_itemSpecificArea != null) { Main.instance.NudgeX(ref this.m_itemSpecificArea, 30f); } if (this.m_troopSlotsRootObject != null) { GridLayoutGroup component = this.m_troopSlotsRootObject.GetComponent <GridLayoutGroup>(); if (component != null) { Vector2 vector2 = component.spacing; vector2.x = 20f; component.spacing = vector2; } } } if (GarrisonStatus.Faction() == PVP_FACTION.HORDE) { this.m_hordeBanner.SetActive(true); this.m_allianceBanner.SetActive(false); } else if (GarrisonStatus.Faction() == PVP_FACTION.ALLIANCE) { this.m_hordeBanner.SetActive(false); this.m_allianceBanner.SetActive(true); } Main.instance.ShipmentAddedAction += new Action <int, ulong>(this.HandleShipmentAdded); this.m_troopResourceCostText.font = GeneralHelpers.LoadStandardFont(); this.m_itemResourceCostText.font = GeneralHelpers.LoadStandardFont(); this.m_recruitButtonText.font = GeneralHelpers.LoadStandardFont(); this.m_itemName.font = GeneralHelpers.LoadStandardFont(); this.m_youReceivedLoot.font = GeneralHelpers.LoadStandardFont(); this.m_youReceivedLoot.text = StaticDB.GetString("YOU_RECEIVED_LOOT", "You received loot:"); this.m_akHintText.font = FontLoader.LoadStandardFont(); this.m_artifactKnowledgeLevelIncreasedLabel.font = GeneralHelpers.LoadStandardFont(); this.m_artifactKnowledgeLevelIncreasedLabel.gameObject.SetActive(false); }
public void SetCharShipmentTroop(CharShipmentRec charShipmentRec, int iconFileDataID = 0) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID); if (record == null) { 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.sprite = sprite; } }
private void OnEnable() { this.m_theActualButton.SetActive(false); this.m_numReadyTroops = 0; this.m_numReadyTroopsText.text = string.Empty; if (this.m_treasureChestHorde != null && this.m_treasureChestAlliance != null) { if (GarrisonStatus.Faction() != PVP_FACTION.HORDE) { this.m_treasureChestHorde.SetActive(false); this.m_treasureChestAlliance.SetActive(true); } else { this.m_treasureChestHorde.SetActive(true); this.m_treasureChestAlliance.SetActive(false); } } }
public void SetFollower(WrapperGarrisonFollower follower) { this.m_followerID = follower.GarrFollowerID; this.followerIDText.text = string.Concat(new object[] { "ID:", follower.GarrFollowerID, " Q:", follower.Quality }); this.m_inParty = false; this.SetAvailabilityStatus(follower); GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); if (record == null) { return; } if (record.GarrFollowerTypeID != (uint)GarrisonStatus.GarrisonFollowerType) { return; } if (follower.Quality == 6 && record.TitleName != null && record.TitleName.Length > 0) { this.nameText.text = record.TitleName; } else if (record != null) { CreatureRec 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.Destroy(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 }); } } }
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.Destroy(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 = (uint)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? this.m_followerRec.AllianceGarrClassSpecID : this.m_followerRec.HordeGarrClassSpecID); foreach (WrapperGarrisonFollower follower in PersistentFollowerData.followerDictionary.Values) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); uint num2 = (uint)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID); if (num2 == num && follower.Durability > 0) { this.SetTroopSlotForExistingFollower(componentsInChildren, follower); } } CharShipmentRec record2 = StaticDB.charShipmentDB.GetRecord(this.m_charShipmentRec.ID); foreach (WrapperCharacterShipment wrapperCharacterShipment in PersistentShipmentData.shipmentDictionary.Values) { if (wrapperCharacterShipment.ShipmentRecID == this.m_charShipmentRec.ID) { this.SetTroopSlotForPendingShipment(componentsInChildren, wrapperCharacterShipment.ShipmentID); } else { CharShipmentRec record3 = StaticDB.charShipmentDB.GetRecord(wrapperCharacterShipment.ShipmentRecID); if (record3.ContainerID == record2.ContainerID) { this.SetTroopSlotForPendingShipment(componentsInChildren, wrapperCharacterShipment.ShipmentID); } } } }
public static int[] GetBuffsForCurrentMission(int garrFollowerID, int garrMissionID, GameObject missionFollowerSlotGroup, int missionDuration) { HashSet <int> hashSet = new HashSet <int>(); if (!PersistentFollowerData.followerDictionary.ContainsKey(garrFollowerID)) { return(hashSet.ToArray <int>()); } WrapperGarrisonFollower wrapperGarrisonFollower = PersistentFollowerData.followerDictionary[garrFollowerID]; for (int i = 0; i < wrapperGarrisonFollower.AbilityIDs.Count; i++) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(wrapperGarrisonFollower.AbilityIDs[i]); if (record == null) { Debug.Log(string.Concat(new object[] { "Invalid Ability ID ", wrapperGarrisonFollower.AbilityIDs[i], " from follower ", wrapperGarrisonFollower.GarrFollowerID })); } else { foreach (GarrAbilityEffectRec garrAbilityEffectRec in StaticDB.garrAbilityEffectDB.GetRecordsByParentID(record.ID)) { if ((garrAbilityEffectRec.Flags & 1) == 0) { bool flag = false; byte abilityAction = garrAbilityEffectRec.AbilityAction; switch (abilityAction) { case 0: break; case 1: { MissionFollowerSlot[] componentsInChildren = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true); int num = 0; foreach (MissionFollowerSlot missionFollowerSlot in componentsInChildren) { if (missionFollowerSlot.GetCurrentGarrFollowerID() > 0) { num++; } } flag = (num == 1); break; } case 2: case 17: case 21: flag = true; break; default: if (abilityAction != 37) { } break; case 5: { MissionFollowerSlot[] componentsInChildren2 = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true); bool flag2 = false; foreach (MissionFollowerSlot missionFollowerSlot2 in componentsInChildren2) { int currentGarrFollowerID = missionFollowerSlot2.GetCurrentGarrFollowerID(); if (currentGarrFollowerID > 0 && currentGarrFollowerID != wrapperGarrisonFollower.GarrFollowerID) { GarrFollowerRec record2 = StaticDB.garrFollowerDB.GetRecord(currentGarrFollowerID); if (record2 != null) { uint num2 = (uint)((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record2.HordeGarrFollRaceID : record2.AllianceGarrFollRaceID); if (num2 == (uint)garrAbilityEffectRec.ActionRace) { flag2 = true; break; } } } } flag = flag2; break; } case 6: flag = ((float)missionDuration >= (float)garrAbilityEffectRec.ActionHours * 3600f); break; case 7: flag = ((float)missionDuration <= (float)garrAbilityEffectRec.ActionHours * 3600f); break; case 9: { GarrMissionRec record3 = StaticDB.garrMissionDB.GetRecord(garrMissionID); flag = (record3 != null && (float)record3.TravelDuration >= (float)garrAbilityEffectRec.ActionHours * 3600f); break; } case 10: { GarrMissionRec record4 = StaticDB.garrMissionDB.GetRecord(garrMissionID); flag = (record4 != null && (float)record4.TravelDuration <= (float)garrAbilityEffectRec.ActionHours * 3600f); break; } case 12: break; case 22: { MissionFollowerSlot[] componentsInChildren3 = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true); bool flag3 = false; foreach (MissionFollowerSlot missionFollowerSlot3 in componentsInChildren3) { int currentGarrFollowerID2 = missionFollowerSlot3.GetCurrentGarrFollowerID(); if (currentGarrFollowerID2 > 0 && currentGarrFollowerID2 != wrapperGarrisonFollower.GarrFollowerID) { GarrFollowerRec record5 = StaticDB.garrFollowerDB.GetRecord(currentGarrFollowerID2); if (record5 != null) { uint num3 = (uint)((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record5.HordeGarrClassSpecID : record5.AllianceGarrClassSpecID); if ((ulong)num3 == (ulong)((long)garrAbilityEffectRec.ActionRecordID)) { flag3 = true; break; } } } } flag = flag3; break; } case 23: { bool flag4 = false; if (PersistentMissionData.missionDictionary.ContainsKey(garrMissionID)) { WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[garrMissionID]; for (int m = 0; m < wrapperGarrisonMission.Encounters.Count; m++) { for (int n = 0; n < wrapperGarrisonMission.Encounters[m].MechanicIDs.Count; n++) { GarrMechanicRec record6 = StaticDB.garrMechanicDB.GetRecord(wrapperGarrisonMission.Encounters[m].MechanicIDs[n]); if (record6 != null && garrAbilityEffectRec.GarrMechanicTypeID == record6.GarrMechanicTypeID) { flag4 = true; break; } } } } flag = flag4; break; } case 26: { MissionFollowerSlot[] componentsInChildren4 = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true); bool flag5 = false; foreach (MissionFollowerSlot missionFollowerSlot4 in componentsInChildren4) { int currentGarrFollowerID3 = missionFollowerSlot4.GetCurrentGarrFollowerID(); if (currentGarrFollowerID3 > 0 && currentGarrFollowerID3 != wrapperGarrisonFollower.GarrFollowerID && garrAbilityEffectRec.ActionRecordID == currentGarrFollowerID3) { flag5 = true; break; } } flag = flag5; break; } } if (flag) { hashSet.Add(record.ID); } } } } } return(hashSet.ToArray <int>()); }
public void SetFollower(int garrFollowerID) { 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) { componentsInChildren[i].gameObject.transform.SetParent(null); Object.Destroy(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_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 ((GARR_FOLLOWER_TYPE)record.GarrFollowerTypeID != GarrisonStatus.GarrisonFollowerType) { return; } MissionMechanic[] mechanics = base.gameObject.transform.parent.parent.parent.gameObject.GetComponentsInChildren<MissionMechanic>(true); if (mechanics == null) { return; } WrapperGarrisonFollower follower = PersistentFollowerData.followerDictionary[garrFollowerID]; float num = 0f; if (this.m_missionDetailView != null) { num = MissionDetailView.ComputeFollowerBias(follower, follower.FollowerLevel, (follower.ItemLevelWeapon + follower.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 < follower.AbilityIDs.Count; j++) { GarrAbilityRec record2 = StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[j]); GarrAbilityEffectRec garrAbilityEffectRec2 = StaticDB.garrAbilityEffectDB.GetRecordsByParentID(record2.ID).FirstOrDefault(delegate(GarrAbilityEffectRec garrAbilityEffectRec) { if (garrAbilityEffectRec.GarrMechanicTypeID == 0 || garrAbilityEffectRec.AbilityAction != 0) { return false; } GarrMechanicTypeRec garrMechanicTypeRec = StaticDB.garrMechanicTypeDB.GetRecord((int)garrAbilityEffectRec.GarrMechanicTypeID); return garrMechanicTypeRec != null && mechanics.Any((MissionMechanic mechanic) => mechanic.m_missionMechanicTypeID == garrMechanicTypeRec.ID); }); if (garrAbilityEffectRec2 != null) { GameObject gameObject = Object.Instantiate<GameObject>(this.m_missionMechanicCounterPrefab, this.m_abilityAreaRootObject.transform, false); MissionMechanicTypeCounter component = gameObject.GetComponent<MissionMechanicTypeCounter>(); component.usedIcon.gameObject.SetActive(false); Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record2.IconFileDataID); if (sprite != null) { component.missionMechanicIcon.sprite = sprite; } component.countersMissionMechanicTypeID = (int)garrAbilityEffectRec2.GarrMechanicTypeID; } } } this.m_levelText.gameObject.SetActive(true); this.m_levelText.text = follower.FollowerLevel.ToString(); this.m_portraitImage.gameObject.SetActive(true); Sprite sprite2 = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID); if (sprite2 != null) { this.m_portraitImage.sprite = sprite2; } if (follower.Quality == 6) { this.m_levelBorderImage_TitleQuality.gameObject.SetActive(true); this.m_qualityColorImage.gameObject.SetActive(false); this.m_levelBorderImage.gameObject.SetActive(false); } else { this.m_levelBorderImage_TitleQuality.gameObject.SetActive(false); this.m_qualityColorImage.gameObject.SetActive(true); this.m_levelBorderImage.gameObject.SetActive(true); Color qualityColor = GeneralHelpers.GetQualityColor(follower.Quality); this.m_qualityColorImage.color = qualityColor; } this.isOccupied = true; bool flag2 = (follower.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 = follower; } } 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 static List <MapInfo> GetAllMapInfos() { return((from info in MapInfo.s_mapInfoDictionary.Values orderby(int)(((GarrisonStatus.Faction() != PVP_FACTION.HORDE || info.m_zone != AdventureMapPanel.eZone.Zandalar) && (GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE || info.m_zone != AdventureMapPanel.eZone.Kultiras)) ? info.m_zone : ((AdventureMapPanel.eZone)(-2147483648))) select info).ToList <MapInfo>()); }
public void SetMission(int garrMissionID) { base.gameObject.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.text = "Fortified"; } GarrMissionTypeRec record2 = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID); if (record2.UiTextureAtlasMemberID > 0) { Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite((int)record2.UiTextureAtlasMemberID); if (atlasSprite != null) { this.m_availableMissionTypeIcon.sprite = atlasSprite; this.m_inProgressMissionTypeIcon.sprite = atlasSprite; } } WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[garrMissionID]; if (wrapperGarrisonMission.MissionState == 1 || wrapperGarrisonMission.MissionState == 2) { this.m_missionDuration = wrapperGarrisonMission.MissionDuration; } else { this.m_missionDuration = TimeSpan.FromSeconds((double)record.MissionDuration); } this.m_missionStartedTime = wrapperGarrisonMission.StartTime; this.m_availableMissionGroup.gameObject.SetActive(wrapperGarrisonMission.MissionState == 0); this.m_inProgressMissionGroup.gameObject.SetActive(wrapperGarrisonMission.MissionState == 1); this.m_completeMissionGroup.gameObject.SetActive(wrapperGarrisonMission.MissionState == 2 || wrapperGarrisonMission.MissionState == 3); if (wrapperGarrisonMission.MissionState == 1) { foreach (KeyValuePair <int, WrapperGarrisonFollower> keyValuePair in PersistentFollowerData.followerDictionary) { if (keyValuePair.Value.CurrentMissionID == garrMissionID) { GarrFollowerRec record3 = StaticDB.garrFollowerDB.GetRecord(keyValuePair.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.sprite = sprite; } this.m_followerPortraitRingImage.GetComponent <Image>().enabled = true; break; } } } } this.m_missionLevelText.text = string.Empty + record.TargetLevel + (((int)record.TargetLevel != 110) ? string.Empty : (" (" + record.TargetItemLevel + ")")); this.UpdateMissionRemainingTimeDisplay(); }
private void InitTalentTree() { this.m_needsFullInit = false; if (GarrisonStatus.Faction() == PVP_FACTION.HORDE) { this.m_hordeBG.gameObject.SetActive(true); this.m_allianceBG.gameObject.SetActive(false); } else if (GarrisonStatus.Faction() == PVP_FACTION.ALLIANCE) { this.m_hordeBG.gameObject.SetActive(false); this.m_allianceBG.gameObject.SetActive(true); } TalentTreeItem[] componentsInChildren = this.m_talentTreeItemRoot.GetComponentsInChildren <TalentTreeItem>(true); for (int i = 0; i < (int)componentsInChildren.Length; i++) { TalentTreeItem talentTreeItem = componentsInChildren[i]; talentTreeItem.transform.SetParent(null); UnityEngine.Object.Destroy(talentTreeItem.gameObject); } Image[] imageArray = this.m_romanNumeralRoot.GetComponentsInChildren <Image>(true); for (int j = 0; j < (int)imageArray.Length; j++) { Image image = imageArray[j]; image.transform.SetParent(null); UnityEngine.Object.Destroy(image.gameObject); } this.m_talentTreeItems.Clear(); int num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? 153 : 152); GarrTalentTreeRec recordFirstOrDefault = StaticDB.garrTalentTreeDB.GetRecordFirstOrDefault((GarrTalentTreeRec garrTalentTreeRec) => garrTalentTreeRec.ID == num); if (recordFirstOrDefault == null) { Debug.LogError(string.Concat("No GarrTalentTree record found for class ", GarrisonStatus.CharacterClassID())); return; } for (int k = 0; k < recordFirstOrDefault.MaxTiers; k++) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_talentTreeItemPrefab); gameObject.transform.SetParent(this.m_talentTreeItemRoot.transform, false); TalentTreeItem component = gameObject.GetComponent <TalentTreeItem>(); this.m_talentTreeItems.Add(component); switch (k) { case 0: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-One"); break; } case 1: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Two"); break; } case 2: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Three"); break; } case 3: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Four"); break; } case 4: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Five"); break; } case 5: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Six"); break; } case 6: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Seven"); break; } case 7: { component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Eight"); break; } } } foreach (GarrTalentRec recordsByParentID in StaticDB.garrTalentDB.GetRecordsByParentID(recordFirstOrDefault.ID)) { this.m_talentTreeItems[recordsByParentID.Tier].SetTalent(recordsByParentID); LegionCompanionWrapper.RequestCanResearchGarrisonTalent(recordsByParentID.ID); } foreach (TalentTreeItem mTalentTreeItem in this.m_talentTreeItems) { mTalentTreeItem.UpdateVisualStates(); } }
private void Start() { this.m_hordeBG.gameObject.SetActive(GarrisonStatus.Faction() == PVP_FACTION.HORDE); this.m_allianceBG.gameObject.SetActive(GarrisonStatus.Faction() == PVP_FACTION.ALLIANCE); }
public void SetFollower(int followerID) { this.m_garrFollowerID = followerID; if (followerID == 0) { RectTransform[] componentsInChildren = this.traitsAndAbilitiesRootObject.GetComponentsInChildren <RectTransform>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (componentsInChildren[i] != null && componentsInChildren[i] != this.traitsAndAbilitiesRootObject.transform) { Object.Destroy(componentsInChildren[i].gameObject); } } AbilityDisplay[] componentsInChildren2 = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { Object.Destroy(componentsInChildren2[j].gameObject); } } if (!PersistentFollowerData.followerDictionary.ContainsKey(followerID)) { return; } GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(followerID); if (record == null) { return; } CreatureRec record2 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID); if (record2 == null) { return; } WrapperGarrisonFollower follower = PersistentFollowerData.followerDictionary[followerID]; string text = "Assets/BundleAssets/PortraitIcons/cid_" + record2.ID.ToString("D8") + ".png"; Sprite sprite = AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(text); if (sprite != null) { this.followerSnapshot.sprite = sprite; } RectTransform[] componentsInChildren3 = this.traitsAndAbilitiesRootObject.GetComponentsInChildren <RectTransform>(true); for (int k = 0; k < componentsInChildren3.Length; k++) { if (componentsInChildren3[k] != null && componentsInChildren3[k] != this.traitsAndAbilitiesRootObject.transform) { Object.Destroy(componentsInChildren3[k].gameObject); } } bool flag = false; for (int l = 0; l < follower.AbilityIDs.Count; l++) { GarrAbilityRec record3 = StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[l]); if ((record3.Flags & 512u) != 0u) { if (!flag) { GameObject gameObject = Object.Instantiate <GameObject>(this.specializationHeaderPrefab); gameObject.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); flag = true; Text component = gameObject.GetComponent <Text>(); if (component != null) { component.text = StaticDB.GetString("SPECIALIZATION", null); } } GameObject gameObject2 = Object.Instantiate <GameObject>(this.abilityDisplayPrefab); gameObject2.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); AbilityDisplay component2 = gameObject2.GetComponent <AbilityDisplay>(); component2.SetAbility(record3.ID, false, false, null); } } bool flag2 = false; for (int m = 0; m < follower.AbilityIDs.Count; m++) { GarrAbilityRec record4 = StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[m]); if ((record4.Flags & 1u) == 0u) { if ((record4.Flags & 512u) == 0u) { if (!flag2) { GameObject gameObject3 = Object.Instantiate <GameObject>(this.abilitiesHeaderPrefab); gameObject3.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); flag2 = true; Text component3 = gameObject3.GetComponent <Text>(); if (component3 != null) { component3.text = StaticDB.GetString("ABILITIES", null); } } GameObject gameObject4 = Object.Instantiate <GameObject>(this.abilityDisplayPrefab); gameObject4.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); AbilityDisplay component4 = gameObject4.GetComponent <AbilityDisplay>(); component4.SetAbility(follower.AbilityIDs[m], false, false, null); } } } if (follower.ZoneSupportSpellID > 0) { GameObject gameObject5 = Object.Instantiate <GameObject>(this.zoneSupportAbilityHeaderPrefab); gameObject5.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); GameObject gameObject6 = Object.Instantiate <GameObject>(this.m_spellDisplayPrefab); gameObject6.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); SpellDisplay component5 = gameObject6.GetComponent <SpellDisplay>(); component5.SetSpell(follower.ZoneSupportSpellID); Text componentInChildren = gameObject5.GetComponentInChildren <Text>(); if (componentInChildren != null) { componentInChildren.text = StaticDB.GetString("COMBAT_ALLY", null); } } bool flag3 = (follower.Flags & 8) != 0; if (flag3) { GarrStringRec record5 = StaticDB.garrStringDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record.HordeFlavorGarrStringID : record.AllianceFlavorGarrStringID); if (record5 != null) { Text text2 = Object.Instantiate <Text>(this.m_troopDescriptionPrefab); text2.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); text2.text = record5.Text; text2.font = FontLoader.LoadStandardFont(); } } this.InitEquipmentSlots(follower); this.UpdateChampionButtons(follower); }
public void ShowMissionResults(int garrMissionID, int missionResultType, bool awardOvermax) { int num; GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(garrMissionID); if (record == null) { return; } this.RegisterMainScriptObjEvents(); 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 < (int)componentsInChildren.Length; i++) { if (componentsInChildren[i] != null && componentsInChildren[i] != this.missionFollowerSlotGroup.transform) { componentsInChildren[i].gameObject.transform.SetParent(null); UnityEngine.Object.Destroy(componentsInChildren[i].gameObject); } } } MissionEncounter[] missionEncounterArray = this.enemyPortraitsGroup.GetComponentsInChildren <MissionEncounter>(true); for (int j = 0; j < (int)missionEncounterArray.Length; j++) { if (missionEncounterArray[j] != null && missionEncounterArray[j] != this.enemyPortraitsGroup.transform) { missionEncounterArray[j].gameObject.transform.SetParent(null); UnityEngine.Object.Destroy(missionEncounterArray[j].gameObject); } } if (this.treasureChestHorde != null && this.treasureChestAlliance != null) { if (GarrisonStatus.Faction() != PVP_FACTION.HORDE) { this.treasureChestHorde.SetActive(false); this.treasureChestAlliance.SetActive(true); } else { this.treasureChestHorde.SetActive(true); this.treasureChestAlliance.SetActive(false); } } WrapperGarrisonMission item = PersistentMissionData.missionDictionary[garrMissionID]; this.m_missionStartedTime = item.StartTime; this.m_missionDurationInSeconds = item.MissionDuration; for (int k = 0; k < item.Encounters.Count; k++) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.missionEncounterPrefab); gameObject.transform.SetParent(this.enemyPortraitsGroup.transform, false); MissionEncounter component = gameObject.GetComponent <MissionEncounter>(); num = (item.Encounters[k].MechanicIDs.Count <= 0 ? 0 : item.Encounters[k].MechanicIDs[0]); component.SetEncounter(item.Encounters[k].EncounterID, num); } this.missionNameText.text = record.Name; this.missionLocationText.text = record.Location; GarrMissionTypeRec garrMissionTypeRec = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID); this.missionTypeImage.overrideSprite = TextureAtlas.instance.GetAtlasSprite((int)garrMissionTypeRec.UiTextureAtlasMemberID); if (this.missionFollowerSlotGroup != null) { for (int l = 0; (long)l < (ulong)record.MaxFollowers; l++) { GameObject gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.missionFollowerSlotPrefab); gameObject1.transform.SetParent(this.missionFollowerSlotGroup.transform, false); gameObject1.GetComponent <MissionFollowerSlot>().m_enemyPortraitsGroup = this.enemyPortraitsGroup; } } if (record.UiTextureKitID <= 0) { 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"); } else { UiTextureKitRec uiTextureKitRec = 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(string.Concat("_", uiTextureKitRec.KitPrefix, "-Back")); if (uITextureAtlasMemberID > 0) { Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite(uITextureAtlasMemberID); if (atlasSprite == null) { uint uiTextureKitID = record.UiTextureKitID; Debug.Log(string.Concat("Missing expected Back sprite from UiTextureKitID: [", uiTextureKitID.ToString(), "]")); } else { this.m_scrollingEnvironment_Back.enabled = true; this.m_scrollingEnvironment_Back.sprite = atlasSprite; } } int uITextureAtlasMemberID1 = TextureAtlas.GetUITextureAtlasMemberID(string.Concat("_", uiTextureKitRec.KitPrefix, "-Mid")); if (uITextureAtlasMemberID1 > 0) { Sprite sprite = TextureAtlas.instance.GetAtlasSprite(uITextureAtlasMemberID1); if (sprite == null) { uint uiTextureKitID1 = record.UiTextureKitID; Debug.Log(string.Concat("Missing expected Mid sprite from UiTextureKitID: [", uiTextureKitID1.ToString(), "]")); } else { this.m_scrollingEnvironment_Mid.enabled = true; this.m_scrollingEnvironment_Mid.sprite = sprite; } } int num1 = TextureAtlas.GetUITextureAtlasMemberID(string.Concat("_", uiTextureKitRec.KitPrefix, "-Fore")); if (num1 > 0) { Sprite atlasSprite1 = TextureAtlas.instance.GetAtlasSprite(num1); if (atlasSprite1 == null) { uint uiTextureKitID2 = record.UiTextureKitID; Debug.Log(string.Concat("Missing expected Fore sprite from UiTextureKitID: [", uiTextureKitID2.ToString(), "]")); } else { this.m_scrollingEnvironment_Fore.enabled = true; this.m_scrollingEnvironment_Fore.sprite = atlasSprite1; } } } if (this.m_lootGroupObj == null || this.m_missionRewardDisplayPrefab == null) { return; } MissionRewardDisplay[] missionRewardDisplayArray = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true); for (int m = 0; m < (int)missionRewardDisplayArray.Length; m++) { if (missionRewardDisplayArray[m] != null) { UnityEngine.Object.Destroy(missionRewardDisplayArray[m].gameObject); } } if (missionResultType == 1) { PersistentFollowerData.ClearPreMissionFollowerData(); } List <WrapperGarrisonFollower> wrapperGarrisonFollowers = new List <WrapperGarrisonFollower>(); MissionFollowerSlot[] missionFollowerSlotArray = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true); int num2 = 0; foreach (WrapperGarrisonFollower value in PersistentFollowerData.followerDictionary.Values) { if (value.CurrentMissionID != garrMissionID) { continue; } int num3 = num2; num2 = num3 + 1; missionFollowerSlotArray[num3].SetFollower(value.GarrFollowerID); if (missionResultType == 1) { PersistentFollowerData.CachePreMissionFollower(value); } wrapperGarrisonFollowers.Add(value); } this.UpdateMissionStatus(garrMissionID); MissionFollowerSlot[] missionFollowerSlotArray1 = missionFollowerSlotArray; for (int n = 0; n < (int)missionFollowerSlotArray1.Length; n++) { missionFollowerSlotArray1[n].InitHeartPanel(); } MissionRewardDisplay.InitMissionRewards(this.m_missionRewardDisplayPrefab.gameObject, this.m_lootGroupObj.transform, item.Rewards); if (record.OvermaxRewardPackID > 0 && item.OvermaxRewards.Count > 0) { this.m_bonusLootDisplay.SetActive(true); WrapperGarrisonMissionReward wrapperGarrisonMissionReward = item.OvermaxRewards[0]; if (wrapperGarrisonMissionReward.ItemID > 0) { this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.item, wrapperGarrisonMissionReward.ItemID, (int)wrapperGarrisonMissionReward.ItemQuantity, 0, wrapperGarrisonMissionReward.ItemFileDataID); } else if (wrapperGarrisonMissionReward.FollowerXP > 0) { this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.followerXP, 0, (int)wrapperGarrisonMissionReward.FollowerXP, 0, 0); } else if (wrapperGarrisonMissionReward.CurrencyQuantity > 0) { if (wrapperGarrisonMissionReward.CurrencyType != 0) { CurrencyTypesRec currencyTypesRec = StaticDB.currencyTypesDB.GetRecord(wrapperGarrisonMissionReward.CurrencyType); int currencyQuantity = (int)((ulong)wrapperGarrisonMissionReward.CurrencyQuantity / (long)(((currencyTypesRec.Flags & 8) == 0 ? 1 : 100))); this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.currency, wrapperGarrisonMissionReward.CurrencyType, currencyQuantity, 0, 0); } else { this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.gold, 0, (int)(wrapperGarrisonMissionReward.CurrencyQuantity / 10000), 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) { UnityEngine.Object.Destroy(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[] componentsInChildren1 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true); for (int o = 0; o < (int)componentsInChildren1.Length; o++) { componentsInChildren1[o].ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)o); } 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.ShowResultFail(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)((int)componentsInChildren1.Length)); } else { this.m_bonusMissionRewardDisplay.ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)((int)componentsInChildren1.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) { UnityEngine.Object.Destroy(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[] missionRewardDisplayArray1 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true); for (int p = 0; p < (int)missionRewardDisplayArray1.Length; p++) { missionRewardDisplayArray1[p].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[] followerExperienceDisplayArray = this.m_followerExperienceDisplayArea.GetComponentsInChildren <FollowerExperienceDisplay>(true); for (int q = 0; q < (int)followerExperienceDisplayArray.Length; q++) { UnityEngine.Object.Destroy(followerExperienceDisplayArray[q].gameObject); } } if (this.m_partyBuffGroup == null) { return; } AbilityDisplay[] abilityDisplayArray = this.m_partyBuffGroup.GetComponentsInChildren <AbilityDisplay>(true); for (int r = 0; r < (int)abilityDisplayArray.Length; r++) { UnityEngine.Object.Destroy(abilityDisplayArray[r].gameObject); } int adjustedMissionDuration = GeneralHelpers.GetAdjustedMissionDuration(record, wrapperGarrisonFollowers, this.enemyPortraitsGroup); int length = 0; foreach (WrapperGarrisonFollower wrapperGarrisonFollower in PersistentFollowerData.followerDictionary.Values) { if (wrapperGarrisonFollower.CurrentMissionID == garrMissionID) { int[] buffsForCurrentMission = GeneralHelpers.GetBuffsForCurrentMission(wrapperGarrisonFollower.GarrFollowerID, garrMissionID, this.missionFollowerSlotGroup, adjustedMissionDuration); length += (int)buffsForCurrentMission.Length; int[] numArray = buffsForCurrentMission; for (int s = 0; s < (int)numArray.Length; s++) { int num4 = numArray[s]; GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(this.m_mechanicEffectDisplayPrefab); gameObject2.transform.SetParent(this.m_partyBuffGroup.transform, false); gameObject2.GetComponent <AbilityDisplay>().SetAbility(num4, false, false, null); } } } if (length <= 8) { this.m_partyBuffsText.text = StaticDB.GetString("PARTY_BUFFS", null); } else { this.m_partyBuffsText.text = string.Empty; } HorizontalLayoutGroup horizontalLayoutGroup = this.m_partyBuffGroup.GetComponent <HorizontalLayoutGroup>(); if (horizontalLayoutGroup != null) { if (length <= 10 || !Main.instance.IsNarrowScreen()) { horizontalLayoutGroup.spacing = 6f; } else { horizontalLayoutGroup.spacing = 3f; } } this.m_partyBuffGroup.SetActive(length > 0); }
private void InitTalentTree() { if (this.m_needsFullInit) { this.m_needsFullInit = false; if (GarrisonStatus.Faction() == PVP_FACTION.HORDE) { this.m_hordeBG.gameObject.SetActive(true); this.m_allianceBG.gameObject.SetActive(false); } else if (GarrisonStatus.Faction() == PVP_FACTION.ALLIANCE) { this.m_hordeBG.gameObject.SetActive(false); this.m_allianceBG.gameObject.SetActive(true); } TalentTreeItem[] componentsInChildren = this.m_talentTreeItemRoot.GetComponentsInChildren <TalentTreeItem>(true); foreach (TalentTreeItem talentTreeItem in componentsInChildren) { talentTreeItem.transform.SetParent(null); Object.Destroy(talentTreeItem.gameObject); } Image[] componentsInChildren2 = this.m_romanNumeralRoot.GetComponentsInChildren <Image>(true); foreach (Image image in componentsInChildren2) { image.transform.SetParent(null); Object.Destroy(image.gameObject); } this.m_talentTreeItems.Clear(); int lookupId = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? 153 : 152; GarrTalentTreeRec recordFirstOrDefault = StaticDB.garrTalentTreeDB.GetRecordFirstOrDefault((GarrTalentTreeRec garrTalentTreeRec) => garrTalentTreeRec.ID == lookupId); if (recordFirstOrDefault == null) { Debug.LogError("No GarrTalentTree record found for class " + GarrisonStatus.CharacterClassID()); return; } for (int k = 0; k < (int)recordFirstOrDefault.MaxTiers; k++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_talentTreeItemPrefab); gameObject.transform.SetParent(this.m_talentTreeItemRoot.transform, false); TalentTreeItem component = gameObject.GetComponent <TalentTreeItem>(); this.m_talentTreeItems.Add(component); switch (k) { case 0: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-One"); break; case 1: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Two"); break; case 2: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Three"); break; case 3: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Four"); break; case 4: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Five"); break; case 5: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Six"); break; case 6: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Seven"); break; case 7: component.m_talentTier.sprite = Resources.Load <Sprite>("OrderAdvancement/Number-Eight"); break; } } foreach (GarrTalentRec garrTalentRec in StaticDB.garrTalentDB.GetRecordsByParentID(recordFirstOrDefault.ID)) { this.m_talentTreeItems[(int)garrTalentRec.Tier].SetTalent(garrTalentRec); LegionCompanionWrapper.RequestCanResearchGarrisonTalent(garrTalentRec.ID); } } foreach (TalentTreeItem talentTreeItem2 in this.m_talentTreeItems) { talentTreeItem2.UpdateVisualStates(); } }
private void UpdateTroopSlots() { if (this.m_followerRec == null || this.m_charShipmentRec == null) { return; } int maxTroops = this.GetMaxTroops((GarrisonStatus.Faction() != PVP_FACTION.HORDE ? (int)this.m_followerRec.AllianceGarrClassSpecID : (int)this.m_followerRec.HordeGarrClassSpecID)); TroopSlot[] componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true); if ((int)componentsInChildren.Length < maxTroops) { for (int i = (int)componentsInChildren.Length; i < maxTroops; i++) { GameObject gameObject = UnityEngine.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, (ulong)0, 0, false, 0); } } if ((int)componentsInChildren.Length > maxTroops) { for (int j = maxTroops; j < (int)componentsInChildren.Length; j++) { UnityEngine.Object.Destroy(componentsInChildren[j].gameObject); } } componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true); TroopSlot[] troopSlotArray = componentsInChildren; for (int k = 0; k < (int)troopSlotArray.Length; k++) { TroopSlot troopSlot = troopSlotArray[k]; int ownedFollowerID = troopSlot.GetOwnedFollowerID(); if (ownedFollowerID != 0 && (!PersistentFollowerData.followerDictionary.ContainsKey(ownedFollowerID) || PersistentFollowerData.followerDictionary[ownedFollowerID].Durability == 0)) { troopSlot.SetCharShipment(this.m_charShipmentRec.ID, (ulong)0, 0, false, 0); } } uint num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? this.m_followerRec.AllianceGarrClassSpecID : this.m_followerRec.HordeGarrClassSpecID); foreach (WrapperGarrisonFollower value in PersistentFollowerData.followerDictionary.Values) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(value.GarrFollowerID); if ((GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID) != num || value.Durability <= 0) { continue; } this.SetTroopSlotForExistingFollower(componentsInChildren, value); } CharShipmentRec charShipmentRec = StaticDB.charShipmentDB.GetRecord(this.m_charShipmentRec.ID); foreach (WrapperCharacterShipment wrapperCharacterShipment in PersistentShipmentData.shipmentDictionary.Values) { if (wrapperCharacterShipment.ShipmentRecID != this.m_charShipmentRec.ID) { if (StaticDB.charShipmentDB.GetRecord(wrapperCharacterShipment.ShipmentRecID).ContainerID != charShipmentRec.ContainerID) { continue; } this.SetTroopSlotForPendingShipment(componentsInChildren, wrapperCharacterShipment.ShipmentID); } else { this.SetTroopSlotForPendingShipment(componentsInChildren, wrapperCharacterShipment.ShipmentID); } } }
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) { componentsInChildren[i].gameObject.transform.SetParent(null); Object.Destroy(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) { componentsInChildren2[j].gameObject.transform.SetParent(null); Object.Destroy(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); } } WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[garrMissionID]; this.m_missionStartedTime = wrapperGarrisonMission.StartTime; this.m_missionDurationInSeconds = wrapperGarrisonMission.MissionDuration; for (int k = 0; k < wrapperGarrisonMission.Encounters.Count; k++) { GameObject gameObject = Object.Instantiate <GameObject>(this.missionEncounterPrefab); gameObject.transform.SetParent(this.enemyPortraitsGroup.transform, false); MissionEncounter component = gameObject.GetComponent <MissionEncounter>(); int garrMechanicID = (wrapperGarrisonMission.Encounters[k].MechanicIDs.Count <= 0) ? 0 : wrapperGarrisonMission.Encounters[k].MechanicIDs[0]; component.SetEncounter(wrapperGarrisonMission.Encounters[k].EncounterID, garrMechanicID); } this.missionNameText.text = record.Name; this.missionLocationText.text = record.Location; GarrMissionTypeRec record2 = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID); this.missionTypeImage.overrideSprite = TextureAtlas.instance.GetAtlasSprite((int)record2.UiTextureAtlasMemberID); if (this.missionFollowerSlotGroup != null) { for (int l = 0; l < (int)record.MaxFollowers; l++) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.missionFollowerSlotPrefab); gameObject2.transform.SetParent(this.missionFollowerSlotGroup.transform, false); MissionFollowerSlot component2 = gameObject2.GetComponent <MissionFollowerSlot>(); component2.m_enemyPortraitsGroup = this.enemyPortraitsGroup; } } if (record.UiTextureKitID > 0) { 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; } else { Debug.Log("Missing expected Back sprite from UiTextureKitID: [" + record.UiTextureKitID.ToString() + "]"); } } 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; } else { Debug.Log("Missing expected Mid sprite from UiTextureKitID: [" + record.UiTextureKitID.ToString() + "]"); } } 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.Log("Missing expected Fore sprite from UiTextureKitID: [" + record.UiTextureKitID.ToString() + "]"); } } } 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 m = 0; m < componentsInChildren3.Length; m++) { if (componentsInChildren3[m] != null) { Object.Destroy(componentsInChildren3[m].gameObject); } } if (missionResultType == 1) { PersistentFollowerData.ClearPreMissionFollowerData(); } List <WrapperGarrisonFollower> list = new List <WrapperGarrisonFollower>(); MissionFollowerSlot[] componentsInChildren4 = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true); int num = 0; foreach (WrapperGarrisonFollower wrapperGarrisonFollower in PersistentFollowerData.followerDictionary.Values) { if (wrapperGarrisonFollower.CurrentMissionID == garrMissionID) { componentsInChildren4[num++].SetFollower(wrapperGarrisonFollower.GarrFollowerID); if (missionResultType == 1) { PersistentFollowerData.CachePreMissionFollower(wrapperGarrisonFollower); } list.Add(wrapperGarrisonFollower); } } this.UpdateMissionStatus(garrMissionID); foreach (MissionFollowerSlot missionFollowerSlot in componentsInChildren4) { missionFollowerSlot.InitHeartPanel(); } MissionRewardDisplay.InitMissionRewards(this.m_missionRewardDisplayPrefab.gameObject, this.m_lootGroupObj.transform, wrapperGarrisonMission.Rewards); if (record.OvermaxRewardPackID > 0 && wrapperGarrisonMission.OvermaxRewards.Count > 0) { this.m_bonusLootDisplay.SetActive(true); WrapperGarrisonMissionReward wrapperGarrisonMissionReward = wrapperGarrisonMission.OvermaxRewards[0]; if (wrapperGarrisonMissionReward.ItemID > 0) { this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.item, wrapperGarrisonMissionReward.ItemID, (int)wrapperGarrisonMissionReward.ItemQuantity, 0, wrapperGarrisonMissionReward.ItemFileDataID); } else if (wrapperGarrisonMissionReward.FollowerXP > 0u) { this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.followerXP, 0, (int)wrapperGarrisonMissionReward.FollowerXP, 0, 0); } else if (wrapperGarrisonMissionReward.CurrencyQuantity > 0u) { if (wrapperGarrisonMissionReward.CurrencyType == 0) { this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.gold, 0, (int)(wrapperGarrisonMissionReward.CurrencyQuantity / 10000u), 0, 0); } else { CurrencyTypesRec record4 = StaticDB.currencyTypesDB.GetRecord(wrapperGarrisonMissionReward.CurrencyType); int rewardQuantity = (int)((ulong)wrapperGarrisonMissionReward.CurrencyQuantity / (ulong)(((record4.Flags & 8u) == 0u) ? 1L : 100L)); this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.currency, wrapperGarrisonMissionReward.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.Destroy(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 num2 = 0; num2 < componentsInChildren5.Length; num2++) { componentsInChildren5[num2].ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)num2); } 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.Destroy(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.Destroy(followerExperienceDisplay.gameObject); } } if (this.m_partyBuffGroup == null) { return; } AbilityDisplay[] componentsInChildren8 = this.m_partyBuffGroup.GetComponentsInChildren <AbilityDisplay>(true); foreach (AbilityDisplay abilityDisplay in componentsInChildren8) { Object.Destroy(abilityDisplay.gameObject); } int adjustedMissionDuration = GeneralHelpers.GetAdjustedMissionDuration(record, list, this.enemyPortraitsGroup); int num6 = 0; foreach (WrapperGarrisonFollower wrapperGarrisonFollower2 in PersistentFollowerData.followerDictionary.Values) { if (wrapperGarrisonFollower2.CurrentMissionID == garrMissionID) { int[] buffsForCurrentMission = GeneralHelpers.GetBuffsForCurrentMission(wrapperGarrisonFollower2.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); }
private void SetFollowerAppearance(WrapperGarrisonFollower follower, bool nextCapIsForQuality, bool isMaxLevelAndMaxQuality, bool isTroop, float initialEntranceDelay) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); this.m_troopHeartContainerEmpty.SetActive(isTroop); this.m_troopHeartContainerFull.SetActive(isTroop); this.m_expiredPortraitX.SetActive(false); if (isTroop) { this.m_levelBorder.gameObject.SetActive(false); this.m_progressBarObj.SetActive(false); this.m_portraitBG.gameObject.SetActive(false); this.m_troopHeartContainerEmpty.SetActive(true); this.m_troopHeartContainerFull.SetActive(true); Transform[] componentsInChildren = this.m_troopHeartContainerEmpty.GetComponentsInChildren <Transform>(true); foreach (Transform transform in componentsInChildren) { if (transform != this.m_troopHeartContainerEmpty.transform) { Object.Destroy(transform.gameObject); } } Transform[] componentsInChildren2 = this.m_troopHeartContainerFull.GetComponentsInChildren <Transform>(true); foreach (Transform transform2 in componentsInChildren2) { if (transform2 != this.m_troopHeartContainerFull.transform) { Object.Destroy(transform2.gameObject); } } float num = 0.15f; WrapperGarrisonFollower wrapperGarrisonFollower = PersistentFollowerData.preMissionFollowerDictionary[follower.GarrFollowerID]; for (int k = 0; k < wrapperGarrisonFollower.Durability; k++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.transform.SetParent(this.m_troopHeartContainerFull.transform, false); if (k >= follower.Durability) { float num2 = initialEntranceDelay + (float)(wrapperGarrisonFollower.Durability - (k - follower.Durability)) * num; float num3 = 2f; iTween.ValueTo(gameObject, iTween.Hash(new object[] { "name", "fade", "from", 0f, "to", 1f, "time", num3, "easetype", iTween.EaseType.easeOutCubic, "delay", num2, "onupdatetarget", gameObject, "onupdate", "SetHeartEffectProgress", "oncomplete", "FinishHeartEffect" })); } } for (int l = 0; l < record.Vitality; l++) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_troopEmptyHeartPrefab); gameObject2.transform.SetParent(this.m_troopHeartContainerEmpty.transform, false); } if (follower.Durability <= 0) { DelayedUIAnim delayedUIAnim = base.gameObject.AddComponent <DelayedUIAnim>(); float num4 = initialEntranceDelay + (float)(wrapperGarrisonFollower.Durability - follower.Durability) * num + 1f; delayedUIAnim.Init(num4, "RedFailX", "SFX/UI_Mission_Fail_Red_X", this.m_followerPortrait.transform, 1.5f, 0.3f); DelayedObjectEnable delayedObjectEnable = base.gameObject.AddComponent <DelayedObjectEnable>(); delayedObjectEnable.Init(num4 + 0.25f, this.m_expiredPortraitX); } } int iconFileDataID = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID; Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, iconFileDataID); if (sprite != null) { this.m_followerPortrait.sprite = sprite; } if (isTroop) { this.m_qualityBorder_TitleQuality.gameObject.SetActive(false); this.m_levelBorder_TitleQuality.gameObject.SetActive(false); this.m_qualityBorder.gameObject.SetActive(false); this.m_levelBorder.gameObject.SetActive(false); this.m_followerNameText.color = Color.white; this.m_iLevelText.gameObject.SetActive(false); } else { if (follower.Quality == 6) { this.m_qualityBorder_TitleQuality.gameObject.SetActive(true); this.m_levelBorder_TitleQuality.gameObject.SetActive(true); this.m_qualityBorder.gameObject.SetActive(false); this.m_levelBorder.gameObject.SetActive(false); } else { this.m_qualityBorder_TitleQuality.gameObject.SetActive(false); this.m_levelBorder_TitleQuality.gameObject.SetActive(false); this.m_qualityBorder.gameObject.SetActive(true); this.m_levelBorder.gameObject.SetActive(true); } Color qualityColor = GeneralHelpers.GetQualityColor(follower.Quality); this.m_qualityBorder.color = qualityColor; this.m_levelBorder.color = qualityColor; this.m_followerNameText.color = qualityColor; } CreatureRec record2 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID); if (follower.Quality == 6 && record.TitleName != null && record.TitleName.Length > 0) { this.m_followerNameText.text = record.TitleName; } else if (record != null) { this.m_followerNameText.text = record2.Name; } if (follower.FollowerLevel < 110) { this.m_iLevelText.text = GeneralHelpers.TextOrderString(StaticDB.GetString("LEVEL", null), follower.FollowerLevel.ToString()); } else { this.m_iLevelText.text = StaticDB.GetString("ILVL", null) + " " + ((follower.ItemLevelArmor + follower.ItemLevelWeapon) / 2).ToString(); } GarrClassSpecRec record3 = StaticDB.garrClassSpecDB.GetRecord((int)((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceGarrClassSpecID : record.HordeGarrClassSpecID)); this.m_classText.text = record3.ClassSpec; Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite((int)record3.UiTextureAtlasMemberID); if (atlasSprite != null) { this.m_classIcon.sprite = atlasSprite; } if (!isTroop) { if (isMaxLevelAndMaxQuality) { this.m_progressBarObj.SetActive(false); this.m_toNextLevelOrUpgradeText.text = string.Empty; } else if (nextCapIsForQuality) { this.m_progressBarObj.SetActive(true); this.m_toNextLevelOrUpgradeText.text = StaticDB.GetString("TO_NEXT_UPGRADE", string.Empty); } else { this.m_progressBarObj.SetActive(true); this.m_toNextLevelOrUpgradeText.text = StaticDB.GetString("TO_NEXT_LEVEL", string.Empty); } } }
public void SetFollower(int garrFollowerID) { 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 < (int)componentsInChildren.Length; i++) { if (componentsInChildren[i] != null && componentsInChildren[i] != this.m_abilityAreaRootObject.transform) { componentsInChildren[i].gameObject.transform.SetParent(null); UnityEngine.Object.Destroy(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_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 garrFollowerRec = StaticDB.garrFollowerDB.GetRecord(garrFollowerID); if (garrFollowerRec == null) { return; } if (garrFollowerRec.GarrFollowerTypeID != (uint)GarrisonStatus.GarrisonFollowerType) { return; } MissionMechanic[] missionMechanicArray = base.gameObject.transform.parent.parent.parent.gameObject.GetComponentsInChildren <MissionMechanic>(true); if (missionMechanicArray == null) { return; } WrapperGarrisonFollower item = PersistentFollowerData.followerDictionary[garrFollowerID]; float single = 0f; if (this.m_missionDetailView != null) { single = MissionDetailView.ComputeFollowerBias(item, item.FollowerLevel, (item.ItemLevelWeapon + item.ItemLevelArmor) / 2, this.m_missionDetailView.GetCurrentMissionID()); } if (single == -1f) { this.m_levelText.color = Color.red; } else if (single >= 0f) { this.m_levelText.color = Color.white; } else { this.m_levelText.color = new Color(0.9333f, 0.4392f, 0.2117f); } if (this.m_abilityAreaRootObject != null && single > -1f) { for (int j = 0; j < item.AbilityIDs.Count; j++) { GarrAbilityRec garrAbilityRec = StaticDB.garrAbilityDB.GetRecord(item.AbilityIDs[j]); if ((garrAbilityRec.Flags & 1) == 0) { GarrAbilityEffectRec garrAbilityEffectRec1 = StaticDB.garrAbilityEffectDB.GetRecordsByParentID(garrAbilityRec.ID).FirstOrDefault <GarrAbilityEffectRec>((GarrAbilityEffectRec garrAbilityEffectRec) => { if (garrAbilityEffectRec.GarrMechanicTypeID == 0 || garrAbilityEffectRec.AbilityAction != 0) { return(false); } GarrMechanicTypeRec record = StaticDB.garrMechanicTypeDB.GetRecord((int)garrAbilityEffectRec.GarrMechanicTypeID); if (record == null) { return(false); } return(missionMechanicArray.Any <MissionMechanic>((MissionMechanic mechanic) => mechanic.m_missionMechanicTypeID == record.ID)); }); if (garrAbilityEffectRec1 != null) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_missionMechanicCounterPrefab, this.m_abilityAreaRootObject.transform, false); MissionMechanicTypeCounter component = gameObject.GetComponent <MissionMechanicTypeCounter>(); component.usedIcon.gameObject.SetActive(false); Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, garrAbilityRec.IconFileDataID); if (sprite != null) { component.missionMechanicIcon.sprite = sprite; } component.countersMissionMechanicTypeID = (int)garrAbilityEffectRec1.GarrMechanicTypeID; } } } } this.m_levelText.gameObject.SetActive(true); this.m_levelText.text = item.FollowerLevel.ToString(); this.m_portraitImage.gameObject.SetActive(true); Sprite sprite1 = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? garrFollowerRec.AllianceIconFileDataID : garrFollowerRec.HordeIconFileDataID)); if (sprite1 != null) { this.m_portraitImage.sprite = sprite1; } if (item.Quality != 6) { this.m_levelBorderImage_TitleQuality.gameObject.SetActive(false); this.m_qualityColorImage.gameObject.SetActive(true); this.m_levelBorderImage.gameObject.SetActive(true); Color qualityColor = GeneralHelpers.GetQualityColor(item.Quality); this.m_qualityColorImage.color = qualityColor; } else { this.m_levelBorderImage_TitleQuality.gameObject.SetActive(true); this.m_qualityColorImage.gameObject.SetActive(false); this.m_levelBorderImage.gameObject.SetActive(false); } this.isOccupied = true; bool flags = (item.Flags & 8) != 0; this.m_qualityColorImage.gameObject.SetActive(!flags); this.m_levelBorderImage.gameObject.SetActive(!flags); if (this.m_heartPanel != null) { this.m_heartPanel.SetActive(flags); if (flags) { this.m_garrFollowerRec = garrFollowerRec; this.m_follower = item; } } this.m_portraitFrameImage.enabled = !flags; 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(); } }