public void HandleTapUseItemButton()
 {
     if (this.m_armamentItem.HasValue)
     {
         object[] itemID = new object[] { "Attempting to use armament item ", null, null, null };
         itemID[1] = this.m_armamentItem.Value.ItemID;
         itemID[2] = " for follower ";
         itemID[3] = this.m_followerDetailView.GetCurrentFollower();
         Debug.Log(string.Concat(itemID));
         Main.instance.UseArmament(this.m_followerDetailView.GetCurrentFollower(), this.m_armamentItem.Value.ItemID);
         AllPopups.instance.ShowArmamentDialog(null, false);
     }
     else if (this.m_equipmentItem.HasValue)
     {
         object[] currentFollower = new object[] { "Attempting to use equipment item ", null, null, null };
         currentFollower[1] = this.m_equipmentItem.Value.ItemID;
         currentFollower[2] = " for follower ";
         currentFollower[3] = this.m_followerDetailView.GetCurrentFollower();
         Debug.Log(string.Concat(currentFollower));
         Main main = Main.instance;
         int  num  = this.m_followerDetailView.GetCurrentFollower();
         WrapperFollowerEquipment value = this.m_equipmentItem.Value;
         main.UseEquipment(num, value.ItemID, this.m_abilityToReplace);
         AllPopups.instance.ShowEquipmentDialog(0, null, false);
     }
     else if (this.m_combatAllyChampion.HasValue)
     {
         this.AssignCombatAlly();
         base.GetComponentInParent <CombatAllyDialog>().gameObject.SetActive(false);
     }
     Main.instance.m_UISound.Play_ButtonRedClick();
 }
 public static void AddOrUpdateEquipment(WrapperFollowerEquipment 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 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;
            }
        }
Ejemplo n.º 4
0
        public void SetEquipment(WrapperFollowerEquipment 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.Destroy(followerEquipmentReplacementSlot.gameObject);
            }
            WrapperGarrisonFollower wrapperGarrisonFollower = PersistentFollowerData.followerDictionary[garrFollowerID];

            for (int j = 0; j < wrapperGarrisonFollower.AbilityIDs.Count; j++)
            {
                GarrAbilityRec record4 = StaticDB.garrAbilityDB.GetRecord(wrapperGarrisonFollower.AbilityIDs[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(wrapperGarrisonFollower.AbilityIDs[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);
        }
Ejemplo n.º 5
0
        public void SetEquipment(WrapperFollowerEquipment 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 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 = 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.Concat(string.Empty, record.IconFileDataID);
            }
            this.m_equipmentQuantity.text = (item.Quantity <= 1 ? string.Empty : string.Concat(string.Empty, item.Quantity));
            FollowerEquipmentReplacementSlot[] componentsInChildren = this.m_followerEquipmentReplacementSlotArea.GetComponentsInChildren <FollowerEquipmentReplacementSlot>(true);
            for (int i = 0; i < (int)componentsInChildren.Length; i++)
            {
                UnityEngine.Object.Destroy(componentsInChildren[i].gameObject);
            }
            WrapperGarrisonFollower wrapperGarrisonFollower = PersistentFollowerData.followerDictionary[garrFollowerID];

            for (int j = 0; j < wrapperGarrisonFollower.AbilityIDs.Count; j++)
            {
                if ((StaticDB.garrAbilityDB.GetRecord(wrapperGarrisonFollower.AbilityIDs[j]).Flags & 1) != 0)
                {
                    GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_followerEquipmentReplacementSlotPrefab);
                    gameObject.transform.SetParent(this.m_followerEquipmentReplacementSlotArea.transform, false);
                    gameObject.GetComponent <FollowerEquipmentReplacementSlot>().SetAbility(wrapperGarrisonFollower.AbilityIDs[j]);
                }
            }
            FollowerEquipmentReplacementSlot[] followerEquipmentReplacementSlotArray = this.m_followerEquipmentReplacementSlotArea.GetComponentsInChildren <FollowerEquipmentReplacementSlot>(true);
            bool flag = (followerEquipmentReplacementSlotArray == null ? false : (int)followerEquipmentReplacementSlotArray.Length > 0);

            this.m_noEquipmentSlotsMessage.gameObject.SetActive(!flag);
            this.m_tapASlotSlotMessage.gameObject.SetActive(flag);
        }