public void Init(FollowerDetailView followerDetailView) { this.m_currentFollowerDetailView = followerDetailView; FollowerInventoryListItem[] componentsInChildren = this.m_armamentListContent.GetComponentsInChildren <FollowerInventoryListItem>(true); foreach (FollowerInventoryListItem followerInventoryListItem in componentsInChildren) { Object.DestroyImmediate(followerInventoryListItem.gameObject); } bool active = true; IEnumerator enumerator = PersistentArmamentData.armamentDictionary.Values.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; MobileFollowerArmamentExt item = (MobileFollowerArmamentExt)obj; FollowerInventoryListItem followerInventoryListItem2 = Object.Instantiate <FollowerInventoryListItem>(this.m_armamentListItemPrefab); followerInventoryListItem2.transform.SetParent(this.m_armamentListContent.transform, false); followerInventoryListItem2.SetArmament(item, followerDetailView); active = false; } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } this.m_emptyMessage.gameObject.SetActive(active); }
public static void AddOrUpdateArmament(MobileFollowerArmamentExt armament) { if (PersistentArmamentData.instance.m_armamentDictionary.ContainsKey(armament.ItemID)) { PersistentArmamentData.instance.m_armamentDictionary.Remove(armament.ItemID); } PersistentArmamentData.instance.m_armamentDictionary.Add(armament.ItemID, armament); }
public void SetArmament(MobileFollowerArmamentExt item, int garrFollowerID) { this.m_garrFollowerID = garrFollowerID; this.m_item = item; ItemRec record = StaticDB.itemDB.GetRecord(item.ItemID); this.m_armamentName.text = record.Display; SpellTooltipRec record2 = StaticDB.spellTooltipDB.GetRecord(item.SpellID); if (record2 != null) { this.m_armamentDescription.text = record2.Description; } else { this.m_armamentDescription.text = string.Concat(new object[] { "ERROR. Unknown Spell ID: ", item.SpellID, " Item ID:", item.ItemID }); } this.m_armamentDescription.text = WowTextParser.parser.Parse(this.m_armamentDescription.text, item.SpellID); if (this.m_iconErrorText != null) { this.m_iconErrorText.gameObject.SetActive(false); } Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID); if (sprite != null) { this.m_armamentIcon.sprite = sprite; } else if (this.m_iconErrorText != null) { this.m_iconErrorText.gameObject.SetActive(true); this.m_iconErrorText.text = string.Empty + record.IconFileDataID; } this.m_armamentQuantity.text = ((item.Quantity <= 1) ? string.Empty : (string.Empty + item.Quantity)); }
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 SetArmament(MobileFollowerArmamentExt item, FollowerDetailView followerDetailView) { this.m_armamentItem = item; this.m_followerDetailView = followerDetailView; ItemRec record = StaticDB.itemDB.GetRecord(item.ItemID); if (record != null) { this.m_equipmentName.text = GeneralHelpers.GetItemQualityColorTag(record.OverallQualityID) + record.Display + "</color>"; } else { this.m_equipmentName.text = "Unknown Item " + item.ItemID; } SpellTooltipRec record2 = StaticDB.spellTooltipDB.GetRecord(item.SpellID); if (record2 != null) { this.m_equipmentDescription.text = record2.Description; } else { this.m_equipmentDescription.text = string.Concat(new object[] { "ERROR. Unknown Spell ID: ", item.SpellID, " Item ID:", item.ItemID }); } this.m_equipmentDescription.text = WowTextParser.parser.Parse(this.m_equipmentDescription.text, item.SpellID); this.m_equipmentDescription.supportRichText = WowTextParser.parser.IsRichText(); if (this.m_iconErrorText != null) { this.m_iconErrorText.gameObject.SetActive(false); } if (record != null) { 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)); JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary[this.m_followerDetailView.GetCurrentFollower()]; bool flag = false; if (jamGarrisonFollower != null && jamGarrisonFollower.CurrentMissionID != 0) { GarrMissionRec record3 = StaticDB.garrMissionDB.GetRecord(jamGarrisonFollower.CurrentMissionID); if (record3 != null && (record3.Flags & 16u) != 0u) { flag = true; } } int num = (jamGarrisonFollower.ItemLevelArmor + jamGarrisonFollower.ItemLevelWeapon) / 2; bool flag2 = num >= item.MinItemLevel && num < item.MaxItemLevel; if (jamGarrisonFollower != null && jamGarrisonFollower.CurrentMissionID != 0 && !flag) { 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; } else if (!flag2 || (long)num >= (long)((ulong)GeneralHelpers.GetMaxFollowerItemLevel())) { this.m_useItemButtonLabel.text = FollowerInventoryListItem.m_maxiLevelString; this.m_useItemButtonLabel.color = new Color(0.5f, 0.5f, 0.5f, 1f); this.m_useItemButton.interactable = false; } else { this.m_useItemButtonLabel.text = StaticDB.GetString("USE_ITEM", null); } }