vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | |
2 | if (not Nurfed_General) then |
||
3 | |||
4 | local items = Nurfed_Items:New(); |
||
5 | |||
6 | Nurfed_General = {}; |
||
7 | |||
8 | Nurfed_General.mounts = { |
||
9 | 18243, |
||
10 | 13328, |
||
11 | 2411, |
||
12 | 18247, |
||
13 | 18244, |
||
14 | 18241, |
||
15 | 8595, |
||
16 | 13332, |
||
17 | 5656, |
||
18 | 15290, |
||
19 | 5872, |
||
20 | 13333, |
||
21 | 5655, |
||
22 | 13335, |
||
23 | 13329, |
||
24 | 15277, |
||
25 | 5864, |
||
26 | 18794, |
||
27 | 18795, |
||
28 | 18793, |
||
29 | 15292, |
||
30 | 13321, |
||
31 | 13334, |
||
32 | 12351, |
||
33 | 18245, |
||
34 | 1041, |
||
35 | 5668, |
||
36 | 5665, |
||
37 | 19029, |
||
38 | 1134, |
||
39 | 5663, |
||
40 | 18796, |
||
41 | 18798, |
||
42 | 18797, |
||
43 | 1132, |
||
44 | 13327, |
||
45 | 12354, |
||
46 | 2414, |
||
47 | 18791, |
||
48 | 8563, |
||
49 | 13331, |
||
50 | 18248, |
||
51 | 1133, |
||
52 | 8630, |
||
53 | 18242, |
||
54 | 12302, |
||
55 | 8633, |
||
56 | 12303, |
||
57 | 8632, |
||
58 | 8631, |
||
59 | 8629, |
||
60 | 18766, |
||
61 | 18767, |
||
62 | 18902, |
||
63 | 13086, |
||
64 | 19030, |
||
65 | 18788, |
||
66 | 18786, |
||
67 | 18777, |
||
68 | 18787, |
||
69 | 18772, |
||
70 | 18789, |
||
71 | 18790, |
||
72 | 18776, |
||
73 | 19872, |
||
74 | 18773, |
||
75 | 18785, |
||
76 | 18778, |
||
77 | 18774, |
||
78 | 19902, |
||
79 | 15293, |
||
80 | 13322, |
||
81 | 18246, |
||
82 | 8588, |
||
83 | 13317, |
||
84 | 8586, |
||
85 | 8591, |
||
86 | 8592, |
||
87 | 13326, |
||
88 | 5873, |
||
89 | 12353, |
||
90 | 21176, |
||
91 | }; |
||
92 | |||
93 | Nurfed_General.aqmounts = { |
||
94 | 21176, |
||
95 | 21324, |
||
96 | 21323, |
||
97 | 21218, |
||
98 | 21321, |
||
99 | }; |
||
100 | |||
101 | Nurfed_General.useablemounts = {}; |
||
102 | Nurfed_General.useableaqmounts = {}; |
||
103 | Nurfed_General.randmount = false; |
||
104 | |||
105 | function Nurfed_General:New() |
||
106 | local object = {}; |
||
107 | setmetatable(object, self); |
||
108 | self.__index = self; |
||
109 | return object; |
||
110 | end |
||
111 | |||
112 | function Nurfed_General:repair(limit, inv) |
||
113 | limit = tonumber(limit); |
||
114 | local money = GetMoney(); |
||
115 | local g = math.floor(money / COPPER_PER_GOLD); |
||
116 | if (g < limit) then |
||
117 | return; |
||
118 | end |
||
119 | |||
120 | local repairbill = 0; |
||
121 | local repairAllCost, canRepair = GetRepairAllCost(); |
||
122 | |||
123 | if (canRepair) then |
||
124 | repairbill = repairbill + repairAllCost; |
||
125 | RepairAllItems(); |
||
126 | end |
||
127 | |||
128 | if (inv ~= 0) then |
||
129 | ShowRepairCursor(); |
||
130 | for bag = 0,4,1 do |
||
131 | for slot = 1, GetContainerNumSlots(bag) , 1 do |
||
132 | local hasCooldown, repairCost = GameTooltip:SetBagItem(bag,slot); |
||
133 | if (InRepairMode() and (repairCost and repairCost > 0)) then |
||
134 | UseContainerItem(bag,slot); |
||
135 | repairbill = repairbill + repairCost; |
||
136 | end |
||
137 | end |
||
138 | end |
||
139 | HideRepairCursor(); |
||
140 | end |
||
141 | |||
142 | if (repairbill > 0) then |
||
143 | local gold = floor(repairbill / (COPPER_PER_SILVER * SILVER_PER_GOLD)); |
||
144 | local silver = floor((repairbill - (gold * COPPER_PER_SILVER * SILVER_PER_GOLD)) / COPPER_PER_SILVER); |
||
145 | local copper = mod(repairbill, COPPER_PER_SILVER); |
||
146 | DEFAULT_CHAT_FRAME:AddMessage("|cffffffffSpent|r |c00ffff66"..gold.."g|r |c00c0c0c0"..silver.."s|r |c00cc9900"..copper.."c|r |cffffffffOn Repairs.|r"); |
||
147 | end |
||
148 | end |
||
149 | |||
150 | function Nurfed_General:itemswitch(item, slotnum) |
||
151 | local bag, slot = items:getslot(item); |
||
152 | if (bag and slot) then |
||
153 | if (not CursorHasItem()) then |
||
154 | PickupContainerItem(bag, slot); |
||
155 | if (slotnum) then |
||
156 | PickupInventoryItem(slotnum); |
||
157 | else |
||
158 | AutoEquipCursorItem(); |
||
159 | end |
||
160 | end |
||
161 | end |
||
162 | end |
||
163 | |||
164 | function Nurfed_General:updatemount() |
||
165 | self.useablemounts = {}; |
||
166 | for k, v in self.mounts do |
||
167 | local bagnum, slotnum = items:getslot(v); |
||
168 | if (bagnum and slotnum) then |
||
169 | local i = table.getn(self.useablemounts) + 1; |
||
170 | table.setn(self.useablemounts, i); |
||
171 | self.useablemounts[i] = { itemid = v, bag = bagnum, slot = slotnum }; |
||
172 | end |
||
173 | end |
||
174 | end |
||
175 | |||
176 | function Nurfed_General:updateaqmount() |
||
177 | self.useableaqmounts = {}; |
||
178 | for k, v in self.aqmounts do |
||
179 | local bagnum, slotnum = items:getslot(v); |
||
180 | if (bagnum and slotnum) then |
||
181 | local i = table.getn(self.useableaqmounts) + 1; |
||
182 | table.setn(self.useableaqmounts, i); |
||
183 | self.useableaqmounts[i] = { itemid = v, bag = bagnum, slot = slotnum }; |
||
184 | end |
||
185 | end |
||
186 | end |
||
187 | |||
188 | function Nurfed_General:getmount() |
||
189 | local i, bufftex, mounttable; |
||
190 | local _, eclass = UnitClass("player"); |
||
191 | for i = 0 , 20, 1 do |
||
192 | bufftex = GetPlayerBuffTexture(i); |
||
193 | if (bufftex and (string.find(bufftex, "_Mount_", 1, true) or string.find(bufftex, "_QirajiCrystal_", 1, true))) then |
||
194 | if (not eclass == "HUNTER") then |
||
195 | CancelPlayerBuff(i); |
||
196 | return nil; |
||
197 | else |
||
198 | if (not string.find(bufftex, "_JungleTiger", 1, true)) then |
||
199 | CancelPlayerBuff(i); |
||
200 | return nil; |
||
201 | end |
||
202 | end |
||
203 | end |
||
204 | end |
||
205 | |||
206 | if (GetZoneText() == "Ahn'Qiraj") then |
||
207 | mounttable = self.useableaqmounts; |
||
208 | else |
||
209 | mounttable = self.useablemounts; |
||
210 | end |
||
211 | if (table.getn(mounttable) == 0) then |
||
212 | self:updatemount(); |
||
213 | self:updateaqmount(); |
||
214 | end |
||
215 | local count = table.getn(mounttable); |
||
216 | if (count ~= 0) then |
||
217 | local mount = math.random(count); |
||
218 | local item = mounttable[mount]; |
||
219 | if (item) then |
||
220 | itemLink = GetContainerItemLink(item.bag, item.slot); |
||
221 | if (itemLink) then |
||
222 | _, itemID = items:linkdecode(itemLink); |
||
223 | if (itemID == item.itemid) then |
||
224 | return item.bag, item.slot; |
||
225 | else |
||
226 | table.remove(mounttable, mount); |
||
227 | end |
||
228 | else |
||
229 | table.remove(mounttable, mount); |
||
230 | end |
||
231 | end |
||
232 | end |
||
233 | return nil; |
||
234 | end |
||
235 | end |