Mercurial > wow > askmrrobot
comparison ui/EnchantLinkText.lua @ 17:e77e01abce98
Warlords of Draenor pre-patch
| author | Adam tegen <adam.tegen@gmail.com> |
|---|---|
| date | Mon, 13 Oct 2014 21:28:32 -0500 |
| parents | ec731d2fe6ba |
| children |
comparison
equal
deleted
inserted
replaced
| 16:9793e8b683d2 | 17:e77e01abce98 |
|---|---|
| 16 | 16 |
| 17 return o | 17 return o |
| 18 end | 18 end |
| 19 | 19 |
| 20 function AskMrRobot.EnchantLinkText:SetEnchantId(enchantId) | 20 function AskMrRobot.EnchantLinkText:SetEnchantId(enchantId) |
| 21 self.itemName = nil | 21 --self.itemName = nil |
| 22 if enchantId and enchantId ~= 0 then | 22 if enchantId and enchantId ~= 0 then |
| 23 local spellId = AskMrRobot.getEnchantSpellId(enchantId) | 23 local enchantData = AskMrRobot.ExtraEnchantData[enchantId]; |
| 24 local spellId = enchantData and enchantData.spellId | |
| 24 local link = nil | 25 local link = nil |
| 25 if spellId then | 26 if spellId then |
| 26 link = 'enchant:' .. spellId | 27 link = 'enchant:' .. spellId |
| 27 end | 28 end |
| 28 self:SetItemLink(link) | 29 self:SetItemLink(link) |
| 29 if self.useSpellName then | 30 if enchantData then |
| 30 local spellName = spellId and select(1, GetSpellInfo(spellId)) | 31 self.itemText:SetText(enchantData.text) |
| 31 self.itemText:SetText(spellName) | |
| 32 self.itemName = spellName | |
| 33 else | 32 else |
| 34 self.itemName = AskMrRobot.getEnchantName(enchantId) | 33 --self.itemText:SetText(enchantId) |
| 35 self.itemText:SetText(self.itemName) | 34 self.itemText:SetText('unknown') |
| 36 end | 35 end |
| 36 -- if self.useSpellName then | |
| 37 -- local spellName = spellId and select(1, GetSpellInfo(spellId)) | |
| 38 -- self.itemText:SetText(spellName) | |
| 39 -- self.itemName = spellName | |
| 40 -- else | |
| 41 -- self.itemName = AskMrRobot.getEnchantName(enchantId) | |
| 42 -- self.itemText:SetText(self.itemName) | |
| 43 -- end | |
| 37 else | 44 else |
| 38 self:SetItemLink(nil) | 45 self:SetItemLink(nil) |
| 39 self.itemText:SetText('') | 46 self.itemText:SetText('') |
| 40 end | 47 end |
| 41 end | 48 end |
| 81 end | 88 end |
| 82 | 89 |
| 83 function AskMrRobot.EnchantLinkIconAndText:SetEnchantId(enchantId) | 90 function AskMrRobot.EnchantLinkIconAndText:SetEnchantId(enchantId) |
| 84 AskMrRobot.EnchantLinkText.SetEnchantId(self, enchantId) | 91 AskMrRobot.EnchantLinkText.SetEnchantId(self, enchantId) |
| 85 if enchantId and enchantId ~= 0 then | 92 if enchantId and enchantId ~= 0 then |
| 86 local texture = AskMrRobot.getEnchantIcon(enchantId) | 93 --local texture = AskMrRobot.getEnchantIcon(enchantId) |
| 87 self.icon:SetTexture('Interface/Icons/' .. texture) | 94 --self.icon:SetTexture('Interface/Icons/' .. texture) |
| 95 local enchantData = AskMrRobot.ExtraEnchantData[enchantId]; | |
| 96 local spellId = enchantData and enchantData.spellId | |
| 97 local link = nil | |
| 98 if spellId then | |
| 99 link = 'enchant:' .. spellId | |
| 100 local _, _, icon = GetSpellInfo(spellId) | |
| 101 if icon then | |
| 102 self.icon:SetTexture(icon) | |
| 103 end | |
| 104 end | |
| 105 | |
| 88 self.iconFrame:Show() | 106 self.iconFrame:Show() |
| 89 else | 107 else |
| 90 self.iconFrame:Hide() | 108 self.iconFrame:Hide() |
| 91 end | 109 end |
| 92 end | 110 end |
