public static void AddOrUpdateEquipment(MobileFollowerEquipment equipment) { if (PersistentEquipmentData.instance.m_equipmentDictionary.ContainsKey(equipment.ItemID)) { PersistentEquipmentData.instance.m_equipmentDictionary.Remove(equipment.ItemID); } PersistentEquipmentData.instance.m_equipmentDictionary.Add(equipment.ItemID, equipment); }
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); }
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 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 void Init(FollowerDetailView followerDetailView, int abilityToReplace) { this.m_followerDetailView = followerDetailView; this.m_abilityToReplace = abilityToReplace; FollowerInventoryListItem[] componentsInChildren = this.m_equipmentInventoryContent.GetComponentsInChildren <FollowerInventoryListItem>(true); foreach (FollowerInventoryListItem followerInventoryListItem in componentsInChildren) { Object.DestroyImmediate(followerInventoryListItem.gameObject); } int num = 0; IEnumerator enumerator = PersistentEquipmentData.equipmentDictionary.Values.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; MobileFollowerEquipment item = (MobileFollowerEquipment)obj; if (num == 0) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_headerPrefab); gameObject.transform.SetParent(this.m_equipmentInventoryContent.transform, false); FollowerInventoryListItem component = gameObject.GetComponent <FollowerInventoryListItem>(); component.SetHeaderText("Equipment"); } GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_followerInventoryListItemPrefab); gameObject2.transform.SetParent(this.m_equipmentInventoryContent.transform, false); FollowerInventoryListItem component2 = gameObject2.GetComponent <FollowerInventoryListItem>(); component2.SetEquipment(item, followerDetailView, abilityToReplace); num++; } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } if (num == 0) { GameObject gameObject3 = Object.Instantiate <GameObject>(this.m_headerPrefab); gameObject3.transform.SetParent(this.m_equipmentInventoryContent.transform, false); FollowerInventoryListItem component3 = gameObject3.GetComponent <FollowerInventoryListItem>(); component3.SetHeaderText(StaticDB.GetString("NO_EQUIPMENT", null)); } int num2 = 0; IEnumerator enumerator2 = PersistentArmamentData.armamentDictionary.Values.GetEnumerator(); try { while (enumerator2.MoveNext()) { object obj2 = enumerator2.Current; MobileFollowerArmamentExt item2 = (MobileFollowerArmamentExt)obj2; if (num2 == 0) { GameObject gameObject4 = Object.Instantiate <GameObject>(this.m_headerPrefab); gameObject4.transform.SetParent(this.m_equipmentInventoryContent.transform, false); FollowerInventoryListItem component4 = gameObject4.GetComponent <FollowerInventoryListItem>(); component4.SetHeaderText("Armaments"); } GameObject gameObject5 = Object.Instantiate <GameObject>(this.m_followerInventoryListItemPrefab); gameObject5.transform.SetParent(this.m_equipmentInventoryContent.transform, false); FollowerInventoryListItem component5 = gameObject5.GetComponent <FollowerInventoryListItem>(); component5.SetArmament(item2, followerDetailView); num2++; } } finally { IDisposable disposable2; if ((disposable2 = (enumerator2 as IDisposable)) != null) { disposable2.Dispose(); } } if (num == 0) { GameObject gameObject6 = Object.Instantiate <GameObject>(this.m_headerPrefab); gameObject6.transform.SetParent(this.m_equipmentInventoryContent.transform, false); FollowerInventoryListItem component6 = gameObject6.GetComponent <FollowerInventoryListItem>(); component6.SetHeaderText(StaticDB.GetString("NO_ARMAMENTS", null)); } }
public void Init(FollowerDetailView followerDetailView, int abilityToReplace) { this.m_followerDetailView = followerDetailView; this.m_abilityToReplace = abilityToReplace; FollowerInventoryListItem[] componentsInChildren = this.m_equipmentInventoryContent.GetComponentsInChildren <FollowerInventoryListItem>(true); FollowerInventoryListItem[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { FollowerInventoryListItem followerInventoryListItem = array[i]; Object.DestroyImmediate(followerInventoryListItem.get_gameObject()); } int num = 0; IEnumerator enumerator = PersistentEquipmentData.equipmentDictionary.get_Values().GetEnumerator(); try { while (enumerator.MoveNext()) { MobileFollowerEquipment item = (MobileFollowerEquipment)enumerator.get_Current(); if (num == 0) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_headerPrefab); gameObject.get_transform().SetParent(this.m_equipmentInventoryContent.get_transform(), false); FollowerInventoryListItem component = gameObject.GetComponent <FollowerInventoryListItem>(); component.SetHeaderText("Equipment"); } GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_followerInventoryListItemPrefab); gameObject2.get_transform().SetParent(this.m_equipmentInventoryContent.get_transform(), false); FollowerInventoryListItem component2 = gameObject2.GetComponent <FollowerInventoryListItem>(); component2.SetEquipment(item, followerDetailView, abilityToReplace); num++; } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } if (num == 0) { GameObject gameObject3 = Object.Instantiate <GameObject>(this.m_headerPrefab); gameObject3.get_transform().SetParent(this.m_equipmentInventoryContent.get_transform(), false); FollowerInventoryListItem component3 = gameObject3.GetComponent <FollowerInventoryListItem>(); component3.SetHeaderText(StaticDB.GetString("NO_EQUIPMENT", null)); } int num2 = 0; IEnumerator enumerator2 = PersistentArmamentData.armamentDictionary.get_Values().GetEnumerator(); try { while (enumerator2.MoveNext()) { MobileFollowerArmament item2 = (MobileFollowerArmament)enumerator2.get_Current(); if (num2 == 0) { GameObject gameObject4 = Object.Instantiate <GameObject>(this.m_headerPrefab); gameObject4.get_transform().SetParent(this.m_equipmentInventoryContent.get_transform(), false); FollowerInventoryListItem component4 = gameObject4.GetComponent <FollowerInventoryListItem>(); component4.SetHeaderText("Armaments"); } GameObject gameObject5 = Object.Instantiate <GameObject>(this.m_followerInventoryListItemPrefab); gameObject5.get_transform().SetParent(this.m_equipmentInventoryContent.get_transform(), false); FollowerInventoryListItem component5 = gameObject5.GetComponent <FollowerInventoryListItem>(); component5.SetArmament(item2, followerDetailView); num2++; } } finally { IDisposable disposable2 = enumerator2 as IDisposable; if (disposable2 != null) { disposable2.Dispose(); } } if (num == 0) { GameObject gameObject6 = Object.Instantiate <GameObject>(this.m_headerPrefab); gameObject6.get_transform().SetParent(this.m_equipmentInventoryContent.get_transform(), false); FollowerInventoryListItem component6 = gameObject6.GetComponent <FollowerInventoryListItem>(); component6.SetHeaderText(StaticDB.GetString("NO_ARMAMENTS", null)); } }
public void SetEquipment(MobileFollowerEquipment item, FollowerDetailView followerDetailView, int abilityToReplace) { this.m_abilityToReplace = abilityToReplace; this.m_equipmentItem = item; this.m_followerDetailView = followerDetailView; ItemRec record = StaticDB.itemDB.GetRecord(item.ItemID); this.m_equipmentName.set_text(GeneralHelpers.GetItemQualityColorTag(record.OverallQualityID) + record.Display + "</color>"); GarrAbilityRec record2 = StaticDB.garrAbilityDB.GetRecord(item.GarrAbilityID); if (record2 != null) { this.m_equipmentDescription.set_text(record2.Description); } else { SpellTooltipRec record3 = StaticDB.spellTooltipDB.GetRecord(item.SpellID); if (record3 != null) { this.m_equipmentDescription.set_text(record3.Description); } else { this.m_equipmentDescription.set_text(string.Concat(new object[] { "ERROR. Ability ID:", item.GarrAbilityID, " Spell ID: ", item.SpellID, " Item ID:", item.ItemID })); } } this.m_equipmentDescription.set_text(WowTextParser.parser.Parse(this.m_equipmentDescription.get_text(), 0)); this.m_equipmentDescription.set_supportRichText(WowTextParser.parser.IsRichText()); if (this.m_iconErrorText != null) { this.m_iconErrorText.get_gameObject().SetActive(false); } Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID); if (sprite != null) { this.m_equipmentIcon.set_sprite(sprite); } else if (this.m_iconErrorText != null) { this.m_iconErrorText.get_gameObject().SetActive(true); this.m_iconErrorText.set_text(string.Empty + record.IconFileDataID); } this.m_equipmentQuantity.set_text((item.Quantity <= 1) ? string.Empty : (string.Empty + item.Quantity)); JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary.get_Item(this.m_followerDetailView.GetCurrentFollower()); if (jamGarrisonFollower != null && jamGarrisonFollower.CurrentMissionID != 0) { this.m_useItemButtonLabel.set_text(StaticDB.GetString("ON_MISSION", null)); this.m_useItemButton.set_interactable(false); } else { this.m_useItemButtonLabel.set_text(StaticDB.GetString("USE_ITEM", null)); } }