public void SetFollower(int garrFollowerID) { this.m_follower = null; this.m_garrFollowerRec = null; if (this.m_abilityAreaRootObject != null) { RectTransform[] componentsInChildren = this.m_abilityAreaRootObject.GetComponentsInChildren <RectTransform>(true); if (componentsInChildren != null) { for (int i = 0; i < componentsInChildren.Length; i++) { if (componentsInChildren[i] != null && componentsInChildren[i] != this.m_abilityAreaRootObject.transform) { Object.DestroyImmediate(componentsInChildren[i].gameObject); } } } } if (garrFollowerID == 0) { if (this.m_portraitRingImage != null) { this.m_portraitRingImage.gameObject.SetActive(false); } if (this.m_heartPanel != null) { this.m_heartPanel.SetActive(false); } this.m_levelBorderImage.gameObject.SetActive(false); this.m_levelBorderImage_TitleQuality.gameObject.SetActive(false); this.m_portraitImage.gameObject.SetActive(false); this.m_qualityColorImage.gameObject.SetActive(false); this.m_qualityColorImage_TitleQuality.gameObject.SetActive(false); this.m_levelBorderImage.color = Color.white; this.m_levelText.gameObject.SetActive(false); this.isOccupied = false; this.m_portraitFrameImage.enabled = true; if (this.currentGarrFollowerID != garrFollowerID) { AdventureMapPanel.instance.MissionFollowerSlotChanged(this.currentGarrFollowerID, false); } bool flag = this.currentGarrFollowerID != 0; this.currentGarrFollowerID = 0; if (flag && this.m_missionDetailView != null) { this.m_missionDetailView.UpdateMissionStatus(); } if (this.m_disableButtonWhenFollowerAssigned) { this.m_portraitFrameImage.GetComponent <Image>().enabled = true; } if (this.m_missionDetailView != null) { this.m_missionDetailView.NotifyFollowerSlotsChanged(); } return; } this.m_portraitRingImage.gameObject.SetActive(true); this.m_levelBorderImage.gameObject.SetActive(true); GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(garrFollowerID); if (record == null) { return; } if (record.GarrFollowerTypeID != 4u) { return; } MissionMechanic[] mechanics = base.gameObject.transform.parent.parent.parent.gameObject.GetComponentsInChildren <MissionMechanic>(true); if (mechanics == null) { return; } JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary[garrFollowerID]; float num = 0f; if (this.m_missionDetailView != null) { num = MissionDetailView.ComputeFollowerBias(jamGarrisonFollower, jamGarrisonFollower.FollowerLevel, (jamGarrisonFollower.ItemLevelWeapon + jamGarrisonFollower.ItemLevelArmor) / 2, this.m_missionDetailView.GetCurrentMissionID()); } if (num == -1f) { this.m_levelText.color = Color.red; } else if (num < 0f) { this.m_levelText.color = new Color(0.9333f, 0.4392f, 0.2117f); } else { this.m_levelText.color = Color.white; } if (this.m_abilityAreaRootObject != null && num > -1f) { for (int j = 0; j < jamGarrisonFollower.AbilityID.Length; j++) { GarrAbilityRec garrAbilityRec = StaticDB.garrAbilityDB.GetRecord(jamGarrisonFollower.AbilityID[j]); if ((garrAbilityRec.Flags & 1u) == 0u) { StaticDB.garrAbilityEffectDB.EnumRecordsByParentID(garrAbilityRec.ID, delegate(GarrAbilityEffectRec garrAbilityEffectRec) { if (garrAbilityEffectRec.GarrMechanicTypeID == 0u) { return(true); } if (garrAbilityEffectRec.AbilityAction != 0u) { return(true); } GarrMechanicTypeRec record2 = StaticDB.garrMechanicTypeDB.GetRecord((int)garrAbilityEffectRec.GarrMechanicTypeID); if (record2 == null) { return(true); } bool flag3 = false; for (int k = 0; k < mechanics.Length; k++) { if (mechanics[k].m_missionMechanicTypeID == record2.ID) { flag3 = true; break; } } if (!flag3) { return(true); } GameObject gameObject = Object.Instantiate <GameObject>(this.m_missionMechanicCounterPrefab); gameObject.transform.SetParent(this.m_abilityAreaRootObject.transform, false); MissionMechanicTypeCounter component = gameObject.GetComponent <MissionMechanicTypeCounter>(); component.usedIcon.gameObject.SetActive(false); Sprite sprite2 = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, garrAbilityRec.IconFileDataID); if (sprite2 != null) { component.missionMechanicIcon.sprite = sprite2; } component.countersMissionMechanicTypeID = record2.ID; return(false); }); } } } this.m_levelText.gameObject.SetActive(true); if (jamGarrisonFollower.FollowerLevel < 110) { this.m_levelText.text = GeneralHelpers.TextOrderString(StaticDB.GetString("LEVEL", null), jamGarrisonFollower.FollowerLevel.ToString()); } else { this.m_levelText.text = GeneralHelpers.TextOrderString(StaticDB.GetString("ILVL", null), ((jamGarrisonFollower.ItemLevelArmor + jamGarrisonFollower.ItemLevelWeapon) / 2).ToString()); } this.m_portraitImage.gameObject.SetActive(true); Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID); if (sprite != null) { this.m_portraitImage.sprite = sprite; } if (jamGarrisonFollower.Quality == 6) { this.m_qualityColorImage_TitleQuality.gameObject.SetActive(true); this.m_levelBorderImage_TitleQuality.gameObject.SetActive(true); this.m_qualityColorImage.gameObject.SetActive(false); this.m_levelBorderImage.gameObject.SetActive(false); } else { this.m_qualityColorImage_TitleQuality.gameObject.SetActive(false); this.m_levelBorderImage_TitleQuality.gameObject.SetActive(false); this.m_qualityColorImage.gameObject.SetActive(true); this.m_levelBorderImage.gameObject.SetActive(true); Color qualityColor = GeneralHelpers.GetQualityColor(jamGarrisonFollower.Quality); this.m_qualityColorImage.color = qualityColor; this.m_levelBorderImage.color = qualityColor; } this.isOccupied = true; bool flag2 = (jamGarrisonFollower.Flags & 8) != 0; this.m_qualityColorImage.gameObject.SetActive(!flag2); this.m_levelBorderImage.gameObject.SetActive(!flag2); if (this.m_heartPanel != null) { this.m_heartPanel.SetActive(flag2); if (flag2) { this.m_garrFollowerRec = record; this.m_follower = jamGarrisonFollower; } } this.m_portraitFrameImage.enabled = !flag2; this.currentGarrFollowerID = garrFollowerID; if (this.m_disableButtonWhenFollowerAssigned) { this.m_portraitFrameImage.GetComponent <Image>().enabled = false; } if (this.m_missionDetailView != null) { this.m_missionDetailView.UpdateMissionStatus(); this.m_missionDetailView.NotifyFollowerSlotsChanged(); } }
public void 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(); } }