private void InitEquipmentSlots(WrapperGarrisonFollower follower) { AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy(componentsInChildren[i].gameObject); } bool flag = false; bool flag2 = true; for (int j = 0; j < follower.AbilityIDs.Count; j++) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[j]); if ((record.Flags & 1u) != 0u) { flag = true; GameObject gameObject = Object.Instantiate <GameObject>(this.m_equipmentSlotPrefab); gameObject.transform.SetParent(this.m_equipmentSlotsRootObject.transform, false); AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>(); component.SetAbility(follower.AbilityIDs[j], true, true, this); } } bool flag3 = (follower.Flags & 8) != 0; GarrFollowerRec record2 = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); if (flag3 || follower.FollowerLevel < MissionDetailView.GarrisonFollower_GetMaxFollowerLevel((int)record2.GarrFollowerTypeID)) { flag2 = false; } this.m_equipmentSlotsText.gameObject.SetActive(flag || flag2); }
public static List <int> GetUsefulBuffAbilitiesForFollower(int garrFollowerID) { List <int> usefulBuffAbilityIDs = new List <int>(); JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary[garrFollowerID]; int[] abilityID2 = jamGarrisonFollower.AbilityID; for (int i = 0; i < abilityID2.Length; i++) { int abilityID = abilityID2[i]; GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(abilityID); if (record != null) { if ((record.Flags & 1024u) != 0u) { StaticDB.garrAbilityEffectDB.EnumRecordsByParentID(abilityID, delegate(GarrAbilityEffectRec garrAbilityEffectRec) { if (garrAbilityEffectRec.AbilityAction == 0u) { return(true); } usefulBuffAbilityIDs.Add(abilityID); return(true); }); } } } return(usefulBuffAbilityIDs); }
private void HandleUseEquipmentResult(JamGarrisonFollower oldFollower, JamGarrisonFollower newFollower) { if (this.m_garrFollowerID != newFollower.GarrFollowerID) { return; } int[] abilityID = newFollower.AbilityID; for (int i = 0; i < abilityID.Length; i++) { int num = abilityID[i]; GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(num); if ((record.Flags & 1u) != 0u) { bool flag = true; int[] abilityID2 = oldFollower.AbilityID; for (int j = 0; j < abilityID2.Length; j++) { int num2 = abilityID2[j]; if (num2 == num) { flag = false; break; } } if (flag) { AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true); AbilityDisplay[] array = componentsInChildren; for (int k = 0; k < array.Length; k++) { AbilityDisplay abilityDisplay = array[k]; bool flag2 = true; int[] abilityID3 = newFollower.AbilityID; for (int l = 0; l < abilityID3.Length; l++) { int num3 = abilityID3[l]; if (abilityDisplay.GetAbilityID() == num3) { flag2 = false; break; } } if (flag2) { Debug.Log(string.Concat(new object[] { "New ability is ", num, " replacing ability ID ", abilityDisplay.GetAbilityID() })); abilityDisplay.SetAbility(num, true, true, this); Main.instance.m_UISound.Play_UpgradeEquipment(); UiAnimMgr.instance.PlayAnim("FlameGlowPulse", abilityDisplay.get_transform(), Vector3.get_zero(), 2f, 0f); } } } } } }
private bool HasUsefulAbility(JamGarrisonFollower follower) { bool hasUsefulAbility = false; if (this.m_missionDetailViewForComparer == null) { return(false); } MissionMechanic[] mechanics = this.m_missionDetailViewForComparer.get_gameObject().GetComponentsInChildren <MissionMechanic>(true); if (mechanics == null) { return(false); } for (int i = 0; i < follower.AbilityID.Length; i++) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(follower.AbilityID[i]); if (record != null) { if ((record.Flags & 1u) == 0u) { StaticDB.garrAbilityEffectDB.EnumRecordsByParentID(record.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 flag = false; for (int j = 0; j < mechanics.Length; j++) { if (mechanics[j].m_missionMechanicTypeID == record2.ID) { flag = true; break; } } if (!flag) { return(true); } hasUsefulAbility = true; return(false); }); if (hasUsefulAbility) { break; } } } } return(hasUsefulAbility); }
public void SetMechanicType(int missionMechanicTypeID, int mechanicAbilityID, bool hideBorder = false) { this.m_garrAbilityID = mechanicAbilityID; GarrMechanicTypeRec record = StaticDB.garrMechanicTypeDB.GetRecord(missionMechanicTypeID); if (record != null) { this.m_missionMechanicIcon.gameObject.SetActive(true); this.m_missionMechanicTypeID = record.ID; this.m_counterWithThisAbilityID = MissionMechanic.GetAbilityToCounterMechanicType(missionMechanicTypeID); if (this.m_counterWithThisAbilityID != 0) { GarrAbilityRec record2 = StaticDB.garrAbilityDB.GetRecord(this.m_counterWithThisAbilityID); if (record2 != null) { Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record2.IconFileDataID); if (sprite != null) { this.m_missionMechanicIcon.sprite = sprite; if (this.m_grayscaleShader != null) { Material material = new Material(this.m_grayscaleShader); this.m_missionMechanicIcon.material = material; } } } } } else { this.m_missionMechanicIcon.gameObject.SetActive(false); } this.SetCountered(false, false, true); this.m_missionMechanicIconBorder.gameObject.SetActive(!hideBorder); }
private void UpdateEquipmentDisplay(int garrAbilityID, FollowerDetailView followerDetailView) { FollowerInventoryListItem[] componentsInChildren = this.m_equipmentListContent.GetComponentsInChildren <FollowerInventoryListItem>(true); for (int i = 0; i < (int)componentsInChildren.Length; i++) { UnityEngine.Object.Destroy(componentsInChildren[i].gameObject); } bool flag = true; foreach (WrapperFollowerEquipment value in PersistentEquipmentData.equipmentDictionary.Values) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(value.GarrAbilityID); if (record != null) { if ((record.Flags & 64) == 0) { FollowerInventoryListItem followerInventoryListItem = UnityEngine.Object.Instantiate <FollowerInventoryListItem>(this.m_equipmentListItemPrefab); followerInventoryListItem.transform.SetParent(this.m_equipmentListContent.transform, false); followerInventoryListItem.SetEquipment(value, followerDetailView, garrAbilityID); flag = false; } } } this.m_noEquipmentMessage.gameObject.SetActive(flag); }
private void ParseAmpersand() { this.ConsumeCharacter(); if (this.ReadString(10).ToLower() != "garrabdesc") { return; } this.ConsumeCharacters(10); this.ReadAndConsumeNumber(); if (this.m_currentValue == string.Empty) { return; } int num = Convert.ToInt32(this.m_currentValue); GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(num); if (record == null) { return; } WowTextParser wowTextParser = new WowTextParser(); this.m_currentValue = wowTextParser.Parse(record.Description, 0); this.AddTextToken(); }
public void SetAbility(int garrAbilityID) { this.m_garrAbilityID = garrAbilityID; if (this.m_iconErrorText != null) { this.m_iconErrorText.gameObject.SetActive(false); } GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(this.m_garrAbilityID); if (record == null) { Debug.LogWarning("Invalid garrAbilityID " + this.m_garrAbilityID); return; } this.m_abilityNameText.text = record.Name; if (record.IconFileDataID != 0) { Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID); if (sprite != null) { this.m_abilityIcon.sprite = sprite; } else if (this.m_iconErrorText != null) { this.m_iconErrorText.gameObject.SetActive(true); this.m_iconErrorText.text = string.Empty + record.IconFileDataID; } } }
private void UpdateEquipmentDisplay(int garrAbilityID, FollowerDetailView followerDetailView) { FollowerInventoryListItem[] componentsInChildren = this.m_equipmentListContent.GetComponentsInChildren <FollowerInventoryListItem>(true); foreach (FollowerInventoryListItem followerInventoryListItem in componentsInChildren) { Object.Destroy(followerInventoryListItem.gameObject); } bool active = true; foreach (WrapperFollowerEquipment item in PersistentEquipmentData.equipmentDictionary.Values) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(item.GarrAbilityID); if (record != null) { if ((record.Flags & 64) == 0) { FollowerInventoryListItem followerInventoryListItem2 = Object.Instantiate <FollowerInventoryListItem>(this.m_equipmentListItemPrefab); followerInventoryListItem2.transform.SetParent(this.m_equipmentListContent.transform, false); followerInventoryListItem2.SetEquipment(item, followerDetailView, garrAbilityID); active = false; } } } this.m_noEquipmentMessage.gameObject.SetActive(active); }
public void SetEquipment(WrapperFollowerEquipment item, FollowerDetailView followerDetailView, int abilityToReplace) { this.m_abilityToReplace = abilityToReplace; this.m_equipmentItem = new WrapperFollowerEquipment?(item); this.m_followerDetailView = followerDetailView; ItemRec record = StaticDB.itemDB.GetRecord(item.ItemID); this.m_equipmentName.text = string.Concat(GeneralHelpers.GetItemQualityColorTag(record.OverallQualityID), record.Display, "</color>"); GarrAbilityRec garrAbilityRec = StaticDB.garrAbilityDB.GetRecord(item.GarrAbilityID); if (garrAbilityRec == null) { SpellTooltipRec spellTooltipRec = StaticDB.spellTooltipDB.GetRecord(item.SpellID); if (spellTooltipRec == null) { this.m_equipmentDescription.text = string.Concat(new object[] { "ERROR. Ability ID:", item.GarrAbilityID, " Spell ID: ", item.SpellID, " Item ID:", item.ItemID }); } else { this.m_equipmentDescription.text = spellTooltipRec.Description; } } else { this.m_equipmentDescription.text = garrAbilityRec.Description; } this.m_equipmentDescription.text = GeneralHelpers.LimitZhLineLength(WowTextParser.parser.Parse(this.m_equipmentDescription.text, 0), 18); this.m_equipmentDescription.supportRichText = WowTextParser.parser.IsRichText(); if (this.m_iconErrorText != null) { this.m_iconErrorText.gameObject.SetActive(false); } Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID); if (sprite != null) { this.m_equipmentIcon.sprite = sprite; } else if (this.m_iconErrorText != null) { this.m_iconErrorText.gameObject.SetActive(true); this.m_iconErrorText.text = string.Concat(string.Empty, record.IconFileDataID); } this.m_equipmentQuantity.text = (item.Quantity <= 1 ? string.Empty : string.Concat(string.Empty, item.Quantity)); if (PersistentFollowerData.followerDictionary[this.m_followerDetailView.GetCurrentFollower()].CurrentMissionID == 0) { this.m_useItemButtonLabel.text = StaticDB.GetString("USE_ITEM", null); } else { this.m_useItemButtonLabel.text = StaticDB.GetString("ON_MISSION", null); this.m_useItemButtonLabel.color = new Color(0.5f, 0.5f, 0.5f, 1f); this.m_useItemButton.interactable = false; } }
private void HandleUseEquipmentResult(WrapperGarrisonFollower oldFollower, WrapperGarrisonFollower newFollower) { if (this.m_garrFollowerID != newFollower.GarrFollowerID) { return; } foreach (int num in newFollower.AbilityIDs) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(num); if ((record.Flags & 1u) != 0u) { bool flag = true; foreach (int num2 in oldFollower.AbilityIDs) { if (num2 == num) { flag = false; break; } } if (flag) { AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true); foreach (AbilityDisplay abilityDisplay in componentsInChildren) { bool flag2 = true; foreach (int num3 in newFollower.AbilityIDs) { if (abilityDisplay.GetAbilityID() == num3) { flag2 = false; break; } } if (flag2) { Debug.Log(string.Concat(new object[] { "New ability is ", num, " replacing ability ID ", abilityDisplay.GetAbilityID() })); abilityDisplay.SetAbility(num, true, true, this); Main.instance.m_UISound.Play_UpgradeEquipment(); UiAnimMgr.instance.PlayAnim("FlameGlowPulse", abilityDisplay.transform, Vector3.zero, 2f, 0f); } } } } } }
public void SetAbility(int garrAbilityID, FollowerDetailView followerDetailView) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(garrAbilityID); if (record == null) { Debug.LogWarning("Invalid garrAbilityID " + garrAbilityID); return; } this.m_abilityNameText.set_text(record.Name); this.m_abilityDescription.set_text(WowTextParser.parser.Parse(record.Description, 0)); this.m_abilityDescription.set_supportRichText(WowTextParser.parser.IsRichText()); this.m_abilityDisplay.SetAbility(garrAbilityID, true, true, null); FollowerInventoryListItem[] componentsInChildren = this.m_equipmentListContent.GetComponentsInChildren <FollowerInventoryListItem>(true); FollowerInventoryListItem[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { FollowerInventoryListItem followerInventoryListItem = array[i]; Object.DestroyImmediate(followerInventoryListItem.get_gameObject()); } bool active = true; IEnumerator enumerator = PersistentEquipmentData.equipmentDictionary.get_Values().GetEnumerator(); try { while (enumerator.MoveNext()) { MobileFollowerEquipment mobileFollowerEquipment = (MobileFollowerEquipment)enumerator.get_Current(); GarrAbilityRec record2 = StaticDB.garrAbilityDB.GetRecord(mobileFollowerEquipment.GarrAbilityID); if (record2 != null) { if ((record2.Flags & 64u) == 0u) { FollowerInventoryListItem followerInventoryListItem2 = Object.Instantiate <FollowerInventoryListItem>(this.m_equipmentListItemPrefab); followerInventoryListItem2.get_transform().SetParent(this.m_equipmentListContent.get_transform(), false); followerInventoryListItem2.SetEquipment(mobileFollowerEquipment, followerDetailView, garrAbilityID); active = false; } } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } this.m_noEquipmentMessage.get_gameObject().SetActive(active); }
public static FollowerCanCounterMechanic HasFollowerWhoCanCounter(int garrMechanicTypeID) { bool flag = false; using (Dictionary <int, WrapperGarrisonFollower> .ValueCollection.Enumerator enumerator = PersistentFollowerData.followerDictionary.Values.GetEnumerator()) { while (enumerator.MoveNext()) { WrapperGarrisonFollower follower = enumerator.Current; for (int i = 0; i < follower.AbilityIDs.Count; i++) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[i]); if (record == null) { Debug.Log(string.Concat(new object[] { "Invalid Ability ID ", follower.AbilityIDs[i], " from follower ", follower.GarrFollowerID })); } else { IEnumerable <GarrAbilityEffectRec> source = from garrAbilityEffectRec in StaticDB.garrAbilityEffectDB.GetRecordsByParentID(record.ID) where garrAbilityEffectRec.GarrMechanicTypeID != 0 && garrAbilityEffectRec.AbilityAction == 0 && garrMechanicTypeID == (int)garrAbilityEffectRec.GarrMechanicTypeID select garrAbilityEffectRec; if (source.Any(delegate(GarrAbilityEffectRec garrAbilityEffectRec) { bool flag2 = (follower.Flags & 4) != 0; bool flag3 = (follower.Flags & 2) != 0; bool flag4 = follower.CurrentMissionID != 0; bool flag5 = follower.CurrentBuildingID != 0; return(!flag2 && !flag3 && !flag4 && !flag5); })) { return(FollowerCanCounterMechanic.yesAndAvailable); } flag |= (source.Count <GarrAbilityEffectRec>() > 0); } } } } if (flag) { return(FollowerCanCounterMechanic.yesButBusy); } return(FollowerCanCounterMechanic.no); }
public static FollowerCanCounterMechanic HasFollowerWhoCanCounter(int garrMechanicTypeID) { bool canCounterButBusy = false; bool canCounterAndIsAvailable = false; using (Dictionary <int, JamGarrisonFollower> .ValueCollection.Enumerator enumerator = PersistentFollowerData.followerDictionary.get_Values().GetEnumerator()) { JamGarrisonFollower follower; while (enumerator.MoveNext()) { follower = enumerator.get_Current(); for (int i = 0; i < follower.AbilityID.Length; i++) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(follower.AbilityID[i]); if (record == null) { Debug.Log(string.Concat(new object[] { "Invalid Ability ID ", follower.AbilityID[i], " from follower ", follower.GarrFollowerID })); } else if ((record.Flags & 1u) == 0u) { StaticDB.garrAbilityEffectDB.EnumRecordsByParentID(record.ID, delegate(GarrAbilityEffectRec garrAbilityEffectRec) { if (garrAbilityEffectRec.GarrMechanicTypeID == 0u) { return(true); } if (garrAbilityEffectRec.AbilityAction != 0u) { return(true); } if ((long) < HasFollowerWhoCanCounter > c__AnonStorey3C.garrMechanicTypeID != (long)((ulong)garrAbilityEffectRec.GarrMechanicTypeID)) { return(false); } bool flag = (follower.Flags & 4) != 0; bool flag2 = (follower.Flags & 2) != 0; bool flag3 = follower.CurrentMissionID != 0; bool flag4 = follower.CurrentBuildingID != 0; if (flag || flag2 || flag3 || flag4) { < HasFollowerWhoCanCounter > c__AnonStorey3C.canCounterButBusy = true; return(false); }
public static FollowerCanCounterMechanic HasFollowerWhoCanCounter(int garrMechanicTypeID) { FollowerCanCounterMechanic followerCanCounterMechanic; bool flag = false; Dictionary <int, WrapperGarrisonFollower> .ValueCollection.Enumerator enumerator = PersistentFollowerData.followerDictionary.Values.GetEnumerator(); try { while (enumerator.MoveNext()) { WrapperGarrisonFollower current = enumerator.Current; for (int i = 0; i < current.AbilityIDs.Count; i++) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(current.AbilityIDs[i]); if (record == null) { Debug.Log(string.Concat(new object[] { "Invalid Ability ID ", current.AbilityIDs[i], " from follower ", current.GarrFollowerID })); } else if ((record.Flags & 1) == 0) { IEnumerable <GarrAbilityEffectRec> recordsByParentID = from garrAbilityEffectRec in StaticDB.garrAbilityEffectDB.GetRecordsByParentID(record.ID) where (garrAbilityEffectRec.GarrMechanicTypeID == 0 || garrAbilityEffectRec.AbilityAction != 0 ? false : (long)garrMechanicTypeID == (ulong)garrAbilityEffectRec.GarrMechanicTypeID) select garrAbilityEffectRec; if (!recordsByParentID.Any <GarrAbilityEffectRec>((GarrAbilityEffectRec garrAbilityEffectRec) => ((current.Flags & 4) != 0 || (current.Flags & 2) != 0 || current.CurrentMissionID != 0 ? 1 : (int)(current.CurrentBuildingID != 0)) == 0)) { flag = flag | recordsByParentID.Count <GarrAbilityEffectRec>() > 0; } else { followerCanCounterMechanic = FollowerCanCounterMechanic.yesAndAvailable; return(followerCanCounterMechanic); } } } } if (flag) { return(FollowerCanCounterMechanic.yesButBusy); } return(FollowerCanCounterMechanic.no); } finally { ((IDisposable)enumerator).Dispose(); } return(followerCanCounterMechanic); }
public void SetAbility(int garrAbilityID, FollowerDetailView followerDetailView) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(garrAbilityID); if (record == null) { Debug.LogWarning("Invalid garrAbilityID " + garrAbilityID); return; } this.m_garrAbilityID = garrAbilityID; this.m_followerDetailView = followerDetailView; this.m_abilityNameText.set_text(record.Name); this.m_abilityDescription.set_text(WowTextParser.parser.Parse(record.Description, 0)); this.m_abilityDescription.set_supportRichText(WowTextParser.parser.IsRichText()); this.m_abilityDisplay.SetAbility(garrAbilityID, true, true, null); this.UpdateEquipmentDisplay(garrAbilityID, followerDetailView); }
public void InitializeMissionDialog(int missionId) { GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(missionId); if (record != null) { GarrMechanicRec garrMechanicRec = StaticDB.garrMechanicDB.GetRecord(record.EnvGarrMechanicID); if (garrMechanicRec != null) { GarrAbilityRec garrAbilityRec = StaticDB.garrAbilityDB.GetRecord(garrMechanicRec.GarrAbilityID); if (garrAbilityRec != null) { this.m_icon.sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, garrAbilityRec.IconFileDataID); this.m_missionTypeName.text = garrAbilityRec.Name; this.m_missionTypeDescription.text = WowTextParser.parser.Parse(garrAbilityRec.Description, 0).Replace("FFFFD200", "FFD200FF"); } } } }
public void SetAbility(int garrAbilityID) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(garrAbilityID); if (record == null) { Debug.LogWarning("Invalid garrAbilityID " + garrAbilityID); return; } this.m_abilityNameText.text = record.Name; this.m_abilityDescription.text = WowTextParser.parser.Parse(record.Description, 0); this.m_abilityDescription.supportRichText = WowTextParser.parser.IsRichText(); Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID); if (sprite != null) { this.m_abilityIcon.sprite = sprite; } }
public static List <int> GetUsefulBuffAbilitiesForFollower(int garrFollowerID) { List <int> nums = new List <int>(); foreach (int abilityID in PersistentFollowerData.followerDictionary[garrFollowerID].AbilityIDs) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(abilityID); if (record != null) { if ((record.Flags & 1024) != 0) { nums.AddRange( from rec in StaticDB.garrAbilityEffectDB.GetRecordsByParentID(abilityID) where rec.AbilityAction != 0 select abilityID); } } } return(nums); }
private void InitEquipmentSlots(JamGarrisonFollower follower) { AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate(componentsInChildren[i].get_gameObject()); } this.m_equipmentSlotsHeader.get_gameObject().SetActive(false); for (int j = 0; j < follower.AbilityID.Length; j++) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(follower.AbilityID[j]); if ((record.Flags & 1u) != 0u) { this.m_equipmentSlotsHeader.get_gameObject().SetActive(true); GameObject gameObject = Object.Instantiate <GameObject>(this.m_equipmentSlotPrefab); gameObject.get_transform().SetParent(this.m_equipmentSlotsRootObject.get_transform(), false); AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>(); component.SetAbility(follower.AbilityID[j], true, true, this); } } }
private void UpdateEquipmentDisplay(int garrAbilityID, FollowerDetailView followerDetailView) { FollowerInventoryListItem[] componentsInChildren = this.m_equipmentListContent.GetComponentsInChildren <FollowerInventoryListItem>(true); FollowerInventoryListItem[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { FollowerInventoryListItem followerInventoryListItem = array[i]; Object.DestroyImmediate(followerInventoryListItem.get_gameObject()); } bool active = true; IEnumerator enumerator = PersistentEquipmentData.equipmentDictionary.get_Values().GetEnumerator(); try { while (enumerator.MoveNext()) { MobileFollowerEquipment mobileFollowerEquipment = (MobileFollowerEquipment)enumerator.get_Current(); GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(mobileFollowerEquipment.GarrAbilityID); if (record != null) { if ((record.Flags & 64u) == 0u) { FollowerInventoryListItem followerInventoryListItem2 = Object.Instantiate <FollowerInventoryListItem>(this.m_equipmentListItemPrefab); followerInventoryListItem2.get_transform().SetParent(this.m_equipmentListContent.get_transform(), false); followerInventoryListItem2.SetEquipment(mobileFollowerEquipment, followerDetailView, garrAbilityID); active = false; } } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } this.m_noEquipmentMessage.get_gameObject().SetActive(active); }
private void UpdateEquipmentDisplay(int garrAbilityID, FollowerDetailView followerDetailView) { FollowerInventoryListItem[] componentsInChildren = this.m_equipmentListContent.GetComponentsInChildren <FollowerInventoryListItem>(true); foreach (FollowerInventoryListItem followerInventoryListItem in componentsInChildren) { Object.DestroyImmediate(followerInventoryListItem.gameObject); } bool active = true; IEnumerator enumerator = PersistentEquipmentData.equipmentDictionary.Values.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; MobileFollowerEquipment mobileFollowerEquipment = (MobileFollowerEquipment)obj; GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(mobileFollowerEquipment.GarrAbilityID); if (record != null) { if ((record.Flags & 64u) == 0u) { FollowerInventoryListItem followerInventoryListItem2 = Object.Instantiate <FollowerInventoryListItem>(this.m_equipmentListItemPrefab); followerInventoryListItem2.transform.SetParent(this.m_equipmentListContent.transform, false); followerInventoryListItem2.SetEquipment(mobileFollowerEquipment, followerDetailView, garrAbilityID); active = false; } } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } this.m_noEquipmentMessage.gameObject.SetActive(active); }
public static List <int> GetUsefulBuffAbilitiesForFollower(int garrFollowerID) { List <int> list = new List <int>(); using (List <int> .Enumerator enumerator = PersistentFollowerData.followerDictionary[garrFollowerID].AbilityIDs.GetEnumerator()) { while (enumerator.MoveNext()) { int abilityID = enumerator.Current; GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(abilityID); if (record != null) { if ((record.Flags & 1024u) != 0u) { list.AddRange(from rec in StaticDB.garrAbilityEffectDB.GetRecordsByParentID(abilityID) where rec.AbilityAction != 0u select abilityID); } } } } return(list); }
private void InitEquipmentSlots(WrapperGarrisonFollower follower) { AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy(componentsInChildren[i].gameObject); } bool active = false; for (int j = 0; j < follower.AbilityIDs.Count; j++) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[j]); if ((record.Flags & 1) != 0) { active = true; GameObject gameObject = Object.Instantiate <GameObject>(this.m_equipmentSlotPrefab); gameObject.transform.SetParent(this.m_equipmentSlotsRootObject.transform, false); AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>(); component.SetAbility(follower.AbilityIDs[j], true, true, this); } } this.m_equipmentSlotsText.gameObject.SetActive(active); }
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 SetAbility(int garrAbilityID, bool hideCounterInfo = false, bool hideName = false, FollowerDetailView followerDetailView = null) { this.m_followerDetailView = followerDetailView; if (this.m_iconErrorText != null) { this.m_iconErrorText.gameObject.SetActive(false); } this.m_garrAbilityID = garrAbilityID; GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(this.m_garrAbilityID); if (record == null) { Debug.LogWarning(string.Concat("Invalid garrAbilityID ", this.m_garrAbilityID)); return; } this.m_abilityNameText.text = record.Name; if (record.IconFileDataID <= 0) { this.m_abilityIcon.enabled = false; } else { Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID); if (sprite != null) { this.m_abilityIcon.sprite = sprite; if (this.m_grayscaleShader != null) { Material material = new Material(this.m_grayscaleShader); this.m_abilityIcon.material = material; } } else if (this.m_iconErrorText != null) { this.m_iconErrorText.gameObject.SetActive(true); this.m_iconErrorText.text = string.Concat(string.Empty, record.IconFileDataID); } this.m_abilityIcon.enabled = true; } this.m_garrAbilityID = record.ID; GarrAbilityCategoryRec garrAbilityCategoryRec = StaticDB.garrAbilityCategoryDB.GetRecord((int)record.GarrAbilityCategoryID); if (garrAbilityCategoryRec != null) { this.m_counteredMechanicName.text = garrAbilityCategoryRec.Name; } if (this.m_counteredMechanicGroup != null) { if (!hideCounterInfo) { this.m_counteredGarrMechanicTypeID = 0; GarrAbilityEffectRec garrAbilityEffectRec1 = StaticDB.garrAbilityEffectDB.GetRecordsByParentID(record.ID).FirstOrDefault <GarrAbilityEffectRec>((GarrAbilityEffectRec garrAbilityEffectRec) => { if (garrAbilityEffectRec.GarrMechanicTypeID == 0) { return(false); } if (garrAbilityEffectRec.AbilityAction != 0) { return(false); } return(StaticDB.garrMechanicTypeDB.GetRecord((int)garrAbilityEffectRec.GarrMechanicTypeID) != null); }); if (garrAbilityEffectRec1 != null) { GarrMechanicTypeRec garrMechanicTypeRec = StaticDB.garrMechanicTypeDB.GetRecord((int)garrAbilityEffectRec1.GarrMechanicTypeID); Sprite sprite1 = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, garrMechanicTypeRec.IconFileDataID); if (sprite1 == null) { this.m_counteredMechanicName.text = string.Concat("ERR ", garrMechanicTypeRec.IconFileDataID); } else { this.m_counteredMechanicIcon.sprite = sprite1; } this.m_counteredGarrMechanicTypeID = garrMechanicTypeRec.ID; } } else { this.m_counteredMechanicGroup.SetActive(false); } } this.SetCountered(false, true); if (this.m_counteredMechanicGroup != null) { this.m_counteredMechanicGroup.SetActive(this.m_counteredGarrMechanicTypeID > 0); } this.m_abilityNameText.gameObject.SetActive(!hideName); }
public void SetAbility(int garrAbilityID, bool hideCounterInfo = false, bool hideName = false, FollowerDetailView followerDetailView = null) { this.m_followerDetailView = followerDetailView; if (this.m_iconErrorText != null) { this.m_iconErrorText.gameObject.SetActive(false); } this.m_garrAbilityID = garrAbilityID; GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(this.m_garrAbilityID); if (record == null) { Debug.LogWarning("Invalid garrAbilityID " + this.m_garrAbilityID); return; } this.m_abilityNameText.text = record.Name; if (record.IconFileDataID > 0) { Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID); if (sprite != null) { this.m_abilityIcon.sprite = sprite; if (this.m_grayscaleShader != null) { Material material = new Material(this.m_grayscaleShader); this.m_abilityIcon.material = material; } } else if (this.m_iconErrorText != null) { this.m_iconErrorText.gameObject.SetActive(true); this.m_iconErrorText.text = string.Empty + record.IconFileDataID; } this.m_abilityIcon.enabled = true; } else { this.m_abilityIcon.enabled = false; } this.m_garrAbilityID = record.ID; GarrAbilityCategoryRec record2 = StaticDB.garrAbilityCategoryDB.GetRecord((int)record.GarrAbilityCategoryID); if (record2 != null) { this.m_counteredMechanicName.text = record2.Name; } if (this.m_counteredMechanicGroup != null) { if (hideCounterInfo) { this.m_counteredMechanicGroup.SetActive(false); } else { this.m_counteredGarrMechanicTypeID = 0; StaticDB.garrAbilityEffectDB.EnumRecordsByParentID(record.ID, delegate(GarrAbilityEffectRec garrAbilityEffectRec) { if (garrAbilityEffectRec.GarrMechanicTypeID == 0u) { return(true); } if (garrAbilityEffectRec.AbilityAction != 0u) { return(true); } GarrMechanicTypeRec record3 = StaticDB.garrMechanicTypeDB.GetRecord((int)garrAbilityEffectRec.GarrMechanicTypeID); if (record3 == null) { return(true); } Sprite sprite2 = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record3.IconFileDataID); if (sprite2 != null) { this.m_counteredMechanicIcon.sprite = sprite2; } else { this.m_counteredMechanicName.text = "ERR " + record3.IconFileDataID; } this.m_counteredGarrMechanicTypeID = record3.ID; return(false); }); } } this.SetCountered(false, true); if (this.m_counteredMechanicGroup != null) { this.m_counteredMechanicGroup.SetActive(this.m_counteredGarrMechanicTypeID > 0); } this.m_abilityNameText.gameObject.SetActive(!hideName); }
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 SetEquipment(MobileFollowerEquipment item, int garrFollowerID) { this.m_garrFollowerID = garrFollowerID; this.m_item = item; ItemRec record = StaticDB.itemDB.GetRecord(item.ItemID); this.m_equipmentName.text = record.Display; GarrAbilityRec record2 = StaticDB.garrAbilityDB.GetRecord(item.GarrAbilityID); if (record2 != null) { this.m_equipmentDescription.text = record2.Description; } else { SpellTooltipRec record3 = StaticDB.spellTooltipDB.GetRecord(item.SpellID); if (record3 != null) { this.m_equipmentDescription.text = record3.Description; } else { this.m_equipmentDescription.text = string.Concat(new object[] { "ERROR. Ability ID:", item.GarrAbilityID, " Spell ID: ", item.SpellID, " Item ID:", item.ItemID }); } } this.m_equipmentDescription.text = WowTextParser.parser.Parse(this.m_equipmentDescription.text, 0); if (this.m_iconErrorText != null) { this.m_iconErrorText.gameObject.SetActive(false); } Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID); if (sprite != null) { this.m_equipmentIcon.sprite = sprite; } else if (this.m_iconErrorText != null) { this.m_iconErrorText.gameObject.SetActive(true); this.m_iconErrorText.text = string.Empty + record.IconFileDataID; } this.m_equipmentQuantity.text = ((item.Quantity <= 1) ? string.Empty : (string.Empty + item.Quantity)); FollowerEquipmentReplacementSlot[] componentsInChildren = this.m_followerEquipmentReplacementSlotArea.GetComponentsInChildren <FollowerEquipmentReplacementSlot>(true); foreach (FollowerEquipmentReplacementSlot followerEquipmentReplacementSlot in componentsInChildren) { Object.DestroyImmediate(followerEquipmentReplacementSlot.gameObject); } JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary[garrFollowerID]; for (int j = 0; j < jamGarrisonFollower.AbilityID.Length; j++) { GarrAbilityRec record4 = StaticDB.garrAbilityDB.GetRecord(jamGarrisonFollower.AbilityID[j]); if ((record4.Flags & 1u) != 0u) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_followerEquipmentReplacementSlotPrefab); gameObject.transform.SetParent(this.m_followerEquipmentReplacementSlotArea.transform, false); FollowerEquipmentReplacementSlot component = gameObject.GetComponent <FollowerEquipmentReplacementSlot>(); component.SetAbility(jamGarrisonFollower.AbilityID[j]); } } FollowerEquipmentReplacementSlot[] componentsInChildren2 = this.m_followerEquipmentReplacementSlotArea.GetComponentsInChildren <FollowerEquipmentReplacementSlot>(true); bool flag = componentsInChildren2 != null && componentsInChildren2.Length > 0; this.m_noEquipmentSlotsMessage.gameObject.SetActive(!flag); this.m_tapASlotSlotMessage.gameObject.SetActive(flag); }
public static int[] GetBuffsForCurrentMission(int garrFollowerID, int garrMissionID, GameObject missionFollowerSlotGroup, int missionDuration) { List <int> abilityIDList = new List <int>(); if (!PersistentFollowerData.followerDictionary.ContainsKey(garrFollowerID)) { return(abilityIDList.ToArray()); } JamGarrisonFollower follower = PersistentFollowerData.followerDictionary[garrFollowerID]; for (int i = 0; i < follower.AbilityID.Length; i++) { GarrAbilityRec garrAbilityRec = StaticDB.garrAbilityDB.GetRecord(follower.AbilityID[i]); if (garrAbilityRec == null) { Debug.Log(string.Concat(new object[] { "Invalid Ability ID ", follower.AbilityID[i], " from follower ", follower.GarrFollowerID })); } else { StaticDB.garrAbilityEffectDB.EnumRecordsByParentID(garrAbilityRec.ID, delegate(GarrAbilityEffectRec garrAbilityEffectRec) { uint abilityAction = garrAbilityEffectRec.AbilityAction; switch (abilityAction) { case 0u: return(true); case 1u: { MissionFollowerSlot[] componentsInChildren = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true); int num = 0; foreach (MissionFollowerSlot missionFollowerSlot in componentsInChildren) { if (missionFollowerSlot.GetCurrentGarrFollowerID() > 0) { num++; } } if (num != 1) { return(true); } break; } default: switch (abilityAction) { case 22u: { MissionFollowerSlot[] componentsInChildren2 = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true); bool flag = false; foreach (MissionFollowerSlot missionFollowerSlot2 in componentsInChildren2) { int currentGarrFollowerID = missionFollowerSlot2.GetCurrentGarrFollowerID(); if (currentGarrFollowerID > 0 && currentGarrFollowerID != follower.GarrFollowerID) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(currentGarrFollowerID); if (record != null) { uint num2 = (GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record.HordeGarrClassSpecID : record.AllianceGarrClassSpecID; if (num2 == garrAbilityEffectRec.ActionRecordID) { flag = true; break; } } } } if (!flag) { return(true); } break; } case 23u: { bool flag2 = false; if (PersistentMissionData.missionDictionary.ContainsKey(garrMissionID)) { JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary[garrMissionID]; for (int l = 0; l < jamGarrisonMobileMission.Encounter.Length; l++) { for (int m = 0; m < jamGarrisonMobileMission.Encounter[l].MechanicID.Length; m++) { GarrMechanicRec record2 = StaticDB.garrMechanicDB.GetRecord(jamGarrisonMobileMission.Encounter[l].MechanicID[m]); if (record2 != null && garrAbilityEffectRec.GarrMechanicTypeID == record2.GarrMechanicTypeID) { flag2 = true; break; } } } } if (!flag2) { return(true); } break; } default: if (abilityAction == 37u) { return(true); } break; case 26u: { MissionFollowerSlot[] componentsInChildren3 = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true); bool flag3 = false; foreach (MissionFollowerSlot missionFollowerSlot3 in componentsInChildren3) { int currentGarrFollowerID2 = missionFollowerSlot3.GetCurrentGarrFollowerID(); if (currentGarrFollowerID2 > 0 && currentGarrFollowerID2 != follower.GarrFollowerID && (ulong)garrAbilityEffectRec.ActionRecordID == (ulong)((long)currentGarrFollowerID2)) { flag3 = true; break; } } if (!flag3) { return(true); } break; } } break; case 5u: { MissionFollowerSlot[] componentsInChildren4 = missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true); bool flag4 = false; foreach (MissionFollowerSlot missionFollowerSlot4 in componentsInChildren4) { int currentGarrFollowerID3 = missionFollowerSlot4.GetCurrentGarrFollowerID(); if (currentGarrFollowerID3 > 0 && currentGarrFollowerID3 != follower.GarrFollowerID) { GarrFollowerRec record3 = StaticDB.garrFollowerDB.GetRecord(currentGarrFollowerID3); if (record3 != null) { uint num4 = (GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record3.HordeGarrFollRaceID : record3.AllianceGarrFollRaceID; if (num4 == garrAbilityEffectRec.ActionRace) { flag4 = true; break; } } } } if (!flag4) { return(true); } break; } case 6u: if ((float)missionDuration < garrAbilityEffectRec.ActionHours * 3600f) { return(true); } break; case 7u: if ((float)missionDuration > garrAbilityEffectRec.ActionHours * 3600f) { return(true); } break; case 9u: { GarrMissionRec record4 = StaticDB.garrMissionDB.GetRecord(garrMissionID); if (record4 != null && record4.TravelDuration < garrAbilityEffectRec.ActionHours * 3600f) { return(true); } break; } case 10u: { GarrMissionRec record5 = StaticDB.garrMissionDB.GetRecord(garrMissionID); if (record5 != null && record5.TravelDuration > garrAbilityEffectRec.ActionHours * 3600f) { return(true); } break; } case 12u: return(true); } if (!abilityIDList.Contains(garrAbilityRec.ID)) { abilityIDList.Add(garrAbilityRec.ID); } return(true); }); } } return(abilityIDList.ToArray()); }