Mercurial > wow > askmrrobot
comparison ui/Components.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 | ece9167c0d1c |
children |
comparison
equal
deleted
inserted
replaced
16:9793e8b683d2 | 17:e77e01abce98 |
---|---|
75 -- there wasn't a list, so make a new one with this callback | 75 -- there wasn't a list, so make a new one with this callback |
76 unresolvedItemIds[itemId] = { callback } | 76 unresolvedItemIds[itemId] = { callback } |
77 end | 77 end |
78 end | 78 end |
79 | 79 |
80 function AskMrRobot.getItemIdFromLink(item) | |
81 if not item then return 0 end | |
82 local id = tonumber (item:match ("item:(%d+):%d+:%d+:%d+:%d+:%d+:%-?%d+:%-?%d+:%d+:%d+")) | |
83 return (id and id ~= 0 and id or 0) | |
84 end | |
85 | 80 |
86 -- initialize the Frame class (inherit from a dummy frame) | 81 -- initialize the Frame class (inherit from a dummy frame) |
87 AskMrRobot.Frame = AskMrRobot.inheritsFrom(CreateFrame("Frame")) | 82 AskMrRobot.Frame = AskMrRobot.inheritsFrom(CreateFrame("Frame")) |
88 | 83 |
89 -- Frame contructor | 84 -- Frame contructor |
95 setmetatable(o, { __index = AskMrRobot.Frame }) | 90 setmetatable(o, { __index = AskMrRobot.Frame }) |
96 | 91 |
97 -- return the instance of the Frame | 92 -- return the instance of the Frame |
98 return o | 93 return o |
99 end | 94 end |
100 | |
101 local MAINHAND = nil | |
102 local OFFHAND = nil | |
103 | |
104 AskMrRobot.slotNames = {"HeadSlot", "NeckSlot", "ShoulderSlot", "BackSlot", "ChestSlot", "ShirtSlot", "TabardSlot", "WristSlot", "HandsSlot", "WaistSlot", "LegsSlot", "FeetSlot", "Finger0Slot", "Finger1Slot", "Trinket0Slot", "Trinket1Slot", "MainHandSlot", "SecondaryHandSlot", "AmmoSlot" }; | |
105 AskMrRobot.OptimizationSlots = {} | |
106 AskMrRobot.slotIdToSlotNum = {} | |
107 AskMrRobot.slotIds = {}; | |
108 for slotNum = 1, #AskMrRobot.slotNames do | |
109 local slotId = GetInventorySlotInfo(AskMrRobot.slotNames[slotNum]) | |
110 AskMrRobot.slotIds[slotNum] = slotId | |
111 AskMrRobot.slotIdToSlotNum[slotId] = slotNum | |
112 local slotName = AskMrRobot.slotNames[slotNum] | |
113 if slotName == "MainHandSlot" then | |
114 MAINHAND = slotNum | |
115 end | |
116 if slotName == "SecondaryHandSlot" then | |
117 OFFHAND = slotNum | |
118 end | |
119 if slotName ~= "TabardSlot" and slotName ~= "AmmoSlot" and slotName ~= "ShirtSlot" then | |
120 AskMrRobot.OptimizationSlots[slotNum] = true | |
121 end | |
122 | |
123 end | |
124 | |
125 AskMrRobot.sortedSlots = {[MAINHAND] = 1, [OFFHAND] = 2} | |
126 | |
127 local i = 3 | |
128 for slotNum = 1, #AskMrRobot.slotNames do | |
129 if slotNum ~= MAINHAND and slotNum ~= OFFHAND then | |
130 AskMrRobot.sortedSlots[slotNum] = i | |
131 i = i + 1 | |
132 end | |
133 end |