jcallahan@0
|
1 -----------------------------------------------------------------------
|
jcallahan@0
|
2 -- Upvalued Lua API.
|
jcallahan@0
|
3 -----------------------------------------------------------------------
|
jcallahan@0
|
4 local _G = getfenv(0)
|
jcallahan@0
|
5
|
jcallahan@0
|
6 local pairs = _G.pairs
|
jcallahan@1
|
7 local tonumber = _G.tonumber
|
jcallahan@1
|
8
|
jcallahan@1
|
9 local bit = _G.bit
|
jcallahan@1
|
10 local math = _G.math
|
jcallahan@1
|
11 local table = _G.table
|
jcallahan@1
|
12
|
jcallahan@78
|
13 local select = _G.select
|
jcallahan@78
|
14
|
jcallahan@0
|
15
|
jcallahan@0
|
16 -----------------------------------------------------------------------
|
jcallahan@0
|
17 -- AddOn namespace.
|
jcallahan@0
|
18 -----------------------------------------------------------------------
|
jcallahan@0
|
19 local ADDON_NAME, private = ...
|
jcallahan@0
|
20
|
jcallahan@0
|
21 local LibStub = _G.LibStub
|
jcallahan@0
|
22 local WDP = LibStub("AceAddon-3.0"):NewAddon(ADDON_NAME, "AceEvent-3.0", "AceTimer-3.0")
|
jcallahan@0
|
23
|
jcallahan@48
|
24 local deformat = LibStub("LibDeformat-3.0")
|
jcallahan@115
|
25 local LPJ = LibStub("LibPetJournal-2.0")
|
jcallahan@141
|
26 local MapData = LibStub("LibMapData-1.0")
|
jcallahan@48
|
27
|
jcallahan@4
|
28 local DatamineTT = _G.CreateFrame("GameTooltip", "WDPDatamineTT", _G.UIParent, "GameTooltipTemplate")
|
jcallahan@5
|
29 DatamineTT:SetOwner(_G.WorldFrame, "ANCHOR_NONE")
|
jcallahan@5
|
30
|
jcallahan@0
|
31
|
jcallahan@0
|
32 -----------------------------------------------------------------------
|
jcallahan@0
|
33 -- Local constants.
|
jcallahan@0
|
34 -----------------------------------------------------------------------
|
jcallahan@133
|
35 local DB_VERSION = 8
|
jcallahan@63
|
36
|
jcallahan@92
|
37
|
jcallahan@0
|
38 local DATABASE_DEFAULTS = {
|
jcallahan@128
|
39 char = {},
|
jcallahan@0
|
40 global = {
|
jcallahan@0
|
41 items = {},
|
jcallahan@0
|
42 npcs = {},
|
jcallahan@0
|
43 objects = {},
|
jcallahan@0
|
44 quests = {},
|
jcallahan@17
|
45 zones = {},
|
jcallahan@0
|
46 }
|
jcallahan@0
|
47 }
|
jcallahan@0
|
48
|
jcallahan@0
|
49
|
jcallahan@1
|
50 local EVENT_MAPPING = {
|
jcallahan@90
|
51 AUCTION_HOUSE_SHOW = true,
|
jcallahan@90
|
52 BANKFRAME_OPENED = true,
|
jcallahan@90
|
53 BATTLEFIELDS_SHOW = true,
|
jcallahan@56
|
54 BLACK_MARKET_ITEM_UPDATE = true,
|
jcallahan@48
|
55 CHAT_MSG_LOOT = true,
|
jcallahan@95
|
56 CHAT_MSG_MONSTER_SAY = "RecordQuote",
|
jcallahan@95
|
57 CHAT_MSG_MONSTER_WHISPER = "RecordQuote",
|
jcallahan@95
|
58 CHAT_MSG_MONSTER_YELL = "RecordQuote",
|
jcallahan@40
|
59 CHAT_MSG_SYSTEM = true,
|
jcallahan@23
|
60 COMBAT_LOG_EVENT_UNFILTERED = true,
|
jcallahan@18
|
61 COMBAT_TEXT_UPDATE = true,
|
jcallahan@140
|
62 CURSOR_UPDATE = true,
|
jcallahan@90
|
63 FORGE_MASTER_OPENED = true,
|
jcallahan@90
|
64 GOSSIP_SHOW = true,
|
jcallahan@93
|
65 GUILDBANKFRAME_OPENED = true,
|
jcallahan@42
|
66 ITEM_TEXT_BEGIN = true,
|
jcallahan@124
|
67 LOOT_CLOSED = true,
|
jcallahan@1
|
68 LOOT_OPENED = true,
|
jcallahan@89
|
69 MAIL_SHOW = true,
|
jcallahan@133
|
70 MERCHANT_CLOSED = true,
|
jcallahan@7
|
71 MERCHANT_SHOW = "UpdateMerchantItems",
|
jcallahan@61
|
72 MERCHANT_UPDATE = "UpdateMerchantItems",
|
jcallahan@25
|
73 PET_BAR_UPDATE = true,
|
jcallahan@115
|
74 PET_JOURNAL_LIST_UPDATE = true,
|
jcallahan@2
|
75 PLAYER_TARGET_CHANGED = true,
|
jcallahan@9
|
76 QUEST_COMPLETE = true,
|
jcallahan@9
|
77 QUEST_DETAIL = true,
|
jcallahan@9
|
78 QUEST_LOG_UPDATE = true,
|
jcallahan@97
|
79 QUEST_PROGRESS = true,
|
jcallahan@88
|
80 TAXIMAP_OPENED = true,
|
jcallahan@92
|
81 TRADE_SKILL_SHOW = true,
|
jcallahan@27
|
82 TRAINER_SHOW = true,
|
jcallahan@90
|
83 TRANSMOGRIFY_OPEN = true,
|
jcallahan@4
|
84 UNIT_QUEST_LOG_CHANGED = true,
|
jcallahan@1
|
85 UNIT_SPELLCAST_FAILED = "HandleSpellFailure",
|
jcallahan@1
|
86 UNIT_SPELLCAST_FAILED_QUIET = "HandleSpellFailure",
|
jcallahan@1
|
87 UNIT_SPELLCAST_INTERRUPTED = "HandleSpellFailure",
|
jcallahan@1
|
88 UNIT_SPELLCAST_SENT = true,
|
jcallahan@1
|
89 UNIT_SPELLCAST_SUCCEEDED = true,
|
jcallahan@90
|
90 VOID_STORAGE_OPEN = true,
|
jcallahan@129
|
91 ZONE_CHANGED = "SetCurrentAreaID",
|
jcallahan@129
|
92 ZONE_CHANGED_INDOORS = "SetCurrentAreaID",
|
jcallahan@129
|
93 ZONE_CHANGED_NEW_AREA = "SetCurrentAreaID",
|
jcallahan@0
|
94 }
|
jcallahan@0
|
95
|
jcallahan@4
|
96
|
jcallahan@92
|
97 local OBJECT_ID_ANVIL = 192628
|
jcallahan@92
|
98 local OBJECT_ID_FORGE = 1685
|
jcallahan@92
|
99
|
jcallahan@92
|
100
|
jcallahan@1
|
101 local AF = private.ACTION_TYPE_FLAGS
|
jcallahan@0
|
102
|
jcallahan@4
|
103
|
jcallahan@27
|
104 local PLAYER_CLASS = _G.select(2, _G.UnitClass("player"))
|
jcallahan@100
|
105 local PLAYER_FACTION = _G.UnitFactionGroup("player")
|
jcallahan@34
|
106 local PLAYER_GUID = _G.UnitGUID("player")
|
jcallahan@95
|
107 local PLAYER_NAME = _G.UnitName("player")
|
jcallahan@39
|
108 local PLAYER_RACE = _G.select(2, _G.UnitRace("player"))
|
jcallahan@27
|
109
|
jcallahan@95
|
110
|
jcallahan@112
|
111 local CLIENT_LOCALE = _G.GetLocale()
|
jcallahan@112
|
112
|
jcallahan@112
|
113
|
jcallahan@112
|
114 local ALLOWED_LOCALES = {
|
jcallahan@112
|
115 enUS = true,
|
jcallahan@112
|
116 enGB = true,
|
jcallahan@112
|
117 }
|
jcallahan@112
|
118
|
jcallahan@112
|
119
|
jcallahan@0
|
120 -----------------------------------------------------------------------
|
jcallahan@0
|
121 -- Local variables.
|
jcallahan@0
|
122 -----------------------------------------------------------------------
|
jcallahan@92
|
123 local anvil_spell_ids = {}
|
jcallahan@92
|
124 local currently_drunk
|
jcallahan@128
|
125 local char_db
|
jcallahan@128
|
126 local global_db
|
jcallahan@0
|
127 local durability_timer_handle
|
jcallahan@92
|
128 local faction_standings = {}
|
jcallahan@92
|
129 local forge_spell_ids = {}
|
jcallahan@95
|
130 local languages_known = {}
|
jcallahan@95
|
131 local name_to_id_map = {}
|
jcallahan@92
|
132 local reputation_npc_id
|
jcallahan@2
|
133 local target_location_timer_handle
|
jcallahan@86
|
134 local current_target_id
|
jcallahan@126
|
135 local current_area_id
|
jcallahan@131
|
136 local current_loot
|
jcallahan@1
|
137
|
jcallahan@121
|
138 -----------------------------------------------------------------------
|
jcallahan@121
|
139 -- Data for our current action. Including possible values as a reference.
|
jcallahan@121
|
140 -----------------------------------------------------------------------
|
jcallahan@122
|
141 local current_action = {
|
jcallahan@121
|
142 identifier = nil,
|
jcallahan@121
|
143 loot_label = nil,
|
jcallahan@121
|
144 loot_list = nil,
|
jcallahan@121
|
145 loot_sources = nil,
|
jcallahan@121
|
146 map_level = nil,
|
jcallahan@121
|
147 spell_label = nil,
|
jcallahan@123
|
148 target_type = nil,
|
jcallahan@121
|
149 x = nil,
|
jcallahan@121
|
150 y = nil,
|
jcallahan@121
|
151 zone_data = nil,
|
jcallahan@121
|
152 }
|
jcallahan@92
|
153
|
jcallahan@1
|
154 -----------------------------------------------------------------------
|
jcallahan@1
|
155 -- Helper Functions.
|
jcallahan@1
|
156 -----------------------------------------------------------------------
|
jcallahan@39
|
157 local ActualCopperCost
|
jcallahan@39
|
158 do
|
jcallahan@39
|
159 local BARTERING_SPELL_ID = 83964
|
jcallahan@39
|
160
|
jcallahan@39
|
161 local STANDING_DISCOUNTS = {
|
jcallahan@39
|
162 HATED = 0,
|
jcallahan@39
|
163 HOSTILE = 0,
|
jcallahan@39
|
164 UNFRIENDLY = 0,
|
jcallahan@39
|
165 NEUTRAL = 0,
|
jcallahan@39
|
166 FRIENDLY = 0.05,
|
jcallahan@39
|
167 HONORED = 0.1,
|
jcallahan@39
|
168 REVERED = 0.15,
|
jcallahan@39
|
169 EXALTED = 0.2,
|
jcallahan@39
|
170 }
|
jcallahan@39
|
171
|
jcallahan@39
|
172
|
jcallahan@39
|
173 function ActualCopperCost(copper_cost, rep_standing)
|
jcallahan@39
|
174 if not copper_cost or copper_cost == 0 then
|
jcallahan@39
|
175 return 0
|
jcallahan@39
|
176 end
|
jcallahan@39
|
177 local modifier = 1
|
jcallahan@39
|
178
|
jcallahan@39
|
179 if _G.IsSpellKnown(BARTERING_SPELL_ID) then
|
jcallahan@39
|
180 modifier = modifier - 0.1
|
jcallahan@39
|
181 end
|
jcallahan@39
|
182
|
jcallahan@39
|
183 if rep_standing then
|
jcallahan@39
|
184 if PLAYER_RACE == "Goblin" then
|
jcallahan@39
|
185 modifier = modifier - STANDING_DISCOUNTS["EXALTED"]
|
jcallahan@39
|
186 elseif STANDING_DISCOUNTS[rep_standing] then
|
jcallahan@39
|
187 modifier = modifier - STANDING_DISCOUNTS[rep_standing]
|
jcallahan@39
|
188 end
|
jcallahan@39
|
189 end
|
jcallahan@39
|
190 return math.floor(copper_cost / modifier)
|
jcallahan@39
|
191 end
|
jcallahan@39
|
192 end -- do-block
|
jcallahan@39
|
193
|
jcallahan@39
|
194
|
jcallahan@29
|
195 local function InstanceDifficultyToken()
|
jcallahan@29
|
196 local _, instance_type, instance_difficulty, difficulty_name, _, _, is_dynamic = _G.GetInstanceInfo()
|
jcallahan@59
|
197 if not difficulty_name or difficulty_name == "" then
|
jcallahan@29
|
198 difficulty_name = "NONE"
|
jcallahan@29
|
199 end
|
jcallahan@59
|
200
|
jcallahan@59
|
201 if not instance_type or instance_type == "" then
|
jcallahan@59
|
202 instance_type = "NONE"
|
jcallahan@59
|
203 end
|
jcallahan@137
|
204
|
jcallahan@137
|
205 -- Raid difficulty of 2 is 25-man
|
jcallahan@137
|
206 if instance_type == "raid" and instance_difficulty == 2 and _G.IsPartyLFG() and _G.IsInLFGDungeon() then
|
jcallahan@137
|
207 difficulty_name = "LOOKING_FOR_RAID"
|
jcallahan@137
|
208 end
|
jcallahan@29
|
209 return ("%s:%s:%s"):format(instance_type:upper(), difficulty_name:upper():gsub(" ", "_"), _G.tostring(is_dynamic))
|
jcallahan@29
|
210 end
|
jcallahan@29
|
211
|
jcallahan@29
|
212
|
jcallahan@19
|
213 local function DBEntry(data_type, unit_id)
|
jcallahan@19
|
214 if not data_type or not unit_id then
|
jcallahan@6
|
215 return
|
jcallahan@6
|
216 end
|
jcallahan@128
|
217 local unit = global_db[data_type][unit_id]
|
jcallahan@6
|
218
|
jcallahan@10
|
219 if not unit then
|
jcallahan@128
|
220 global_db[data_type][unit_id] = {}
|
jcallahan@128
|
221 unit = global_db[data_type][unit_id]
|
jcallahan@6
|
222 end
|
jcallahan@10
|
223 return unit
|
jcallahan@6
|
224 end
|
jcallahan@6
|
225
|
jcallahan@6
|
226
|
jcallahan@29
|
227 local function NPCEntry(identifier)
|
jcallahan@29
|
228 local npc = DBEntry("npcs", identifier)
|
jcallahan@29
|
229
|
jcallahan@29
|
230 if not npc then
|
jcallahan@29
|
231 return
|
jcallahan@22
|
232 end
|
jcallahan@29
|
233 local instance_token = InstanceDifficultyToken()
|
jcallahan@29
|
234 npc.encounter_data = npc.encounter_data or {}
|
jcallahan@29
|
235 npc.encounter_data[instance_token] = npc.encounter_data[instance_token] or {}
|
jcallahan@30
|
236 npc.encounter_data[instance_token].stats = npc.encounter_data[instance_token].stats or {}
|
jcallahan@29
|
237 return npc
|
jcallahan@22
|
238 end
|
jcallahan@22
|
239
|
jcallahan@22
|
240
|
jcallahan@1
|
241 local function CurrentLocationData()
|
jcallahan@1
|
242 local map_level = _G.GetCurrentMapDungeonLevel() or 0
|
jcallahan@1
|
243 local x, y = _G.GetPlayerMapPosition("player")
|
jcallahan@1
|
244
|
jcallahan@1
|
245 x = x or 0
|
jcallahan@1
|
246 y = y or 0
|
jcallahan@1
|
247
|
jcallahan@1
|
248 if x == 0 and y == 0 then
|
jcallahan@1
|
249 for level_index = 1, _G.GetNumDungeonMapLevels() do
|
jcallahan@1
|
250 _G.SetDungeonMapLevel(level_index)
|
jcallahan@1
|
251 x, y = _G.GetPlayerMapPosition("player")
|
jcallahan@1
|
252
|
jcallahan@1
|
253 if x and y and (x > 0 or y > 0) then
|
jcallahan@1
|
254 _G.SetDungeonMapLevel(map_level)
|
jcallahan@1
|
255 map_level = level_index
|
jcallahan@1
|
256 break
|
jcallahan@1
|
257 end
|
jcallahan@1
|
258 end
|
jcallahan@1
|
259 end
|
jcallahan@1
|
260
|
jcallahan@1
|
261 if _G.DungeonUsesTerrainMap() then
|
jcallahan@1
|
262 map_level = map_level - 1
|
jcallahan@1
|
263 end
|
jcallahan@31
|
264 local x = _G.floor(x * 1000)
|
jcallahan@31
|
265 local y = _G.floor(y * 1000)
|
jcallahan@28
|
266
|
jcallahan@31
|
267 if x % 2 ~= 0 then
|
jcallahan@31
|
268 x = x + 1
|
jcallahan@28
|
269 end
|
jcallahan@28
|
270
|
jcallahan@31
|
271 if y % 2 ~= 0 then
|
jcallahan@31
|
272 y = y + 1
|
jcallahan@28
|
273 end
|
jcallahan@126
|
274 return _G.GetRealZoneText(), current_area_id, x, y, map_level, InstanceDifficultyToken()
|
jcallahan@1
|
275 end
|
jcallahan@1
|
276
|
jcallahan@1
|
277
|
jcallahan@1
|
278 local function ItemLinkToID(item_link)
|
jcallahan@1
|
279 if not item_link then
|
jcallahan@1
|
280 return
|
jcallahan@1
|
281 end
|
jcallahan@7
|
282 return tonumber(item_link:match("item:(%d+)"))
|
jcallahan@1
|
283 end
|
jcallahan@0
|
284
|
jcallahan@4
|
285
|
jcallahan@34
|
286 local ParseGUID
|
jcallahan@4
|
287 do
|
jcallahan@4
|
288 local UNIT_TYPE_BITMASK = 0x007
|
jcallahan@4
|
289
|
jcallahan@34
|
290 function ParseGUID(guid)
|
jcallahan@5
|
291 if not guid then
|
jcallahan@5
|
292 return
|
jcallahan@5
|
293 end
|
jcallahan@4
|
294 local types = private.UNIT_TYPES
|
jcallahan@4
|
295 local unit_type = _G.bit.band(tonumber(guid:sub(1, 5)), UNIT_TYPE_BITMASK)
|
jcallahan@4
|
296
|
jcallahan@10
|
297 if unit_type ~= types.PLAYER and unit_type ~= types.PET then
|
jcallahan@66
|
298 return unit_type, tonumber(guid:sub(6, 10), 16)
|
jcallahan@4
|
299 end
|
jcallahan@4
|
300 return unit_type
|
jcallahan@4
|
301 end
|
jcallahan@4
|
302 end -- do-block
|
jcallahan@4
|
303
|
jcallahan@4
|
304
|
jcallahan@128
|
305 local function UpdateBlacklistMaps()
|
jcallahan@128
|
306 local empty_count = 0
|
jcallahan@128
|
307
|
jcallahan@128
|
308 for index = 1, _G.MAX_BLACKLIST_BATTLEGROUNDS do
|
jcallahan@128
|
309 local map_id = _G.GetBlacklistMap(index)
|
jcallahan@128
|
310 char_db.bg_blacklist = char_db.bg_blacklist or {}
|
jcallahan@128
|
311 char_db.bg_blacklist[index] = map_id
|
jcallahan@128
|
312
|
jcallahan@128
|
313 if map_id < 0 then
|
jcallahan@128
|
314 empty_count = empty_count + 1
|
jcallahan@128
|
315 end
|
jcallahan@128
|
316 end
|
jcallahan@128
|
317
|
jcallahan@128
|
318 if empty_count == _G.MAX_BLACKLIST_BATTLEGROUNDS then
|
jcallahan@128
|
319 char_db.bg_blacklist = nil
|
jcallahan@128
|
320 end
|
jcallahan@128
|
321 end
|
jcallahan@128
|
322
|
jcallahan@128
|
323
|
jcallahan@141
|
324 local UpdateDBEntryLocation
|
jcallahan@141
|
325 do
|
jcallahan@141
|
326 local pi = math.pi
|
jcallahan@141
|
327
|
jcallahan@141
|
328 -- Fishing node coordinate code based on code in GatherMate2 with permission from Kagaro.
|
jcallahan@141
|
329 local function FishingCoordinates(x, y, yard_width, yard_height)
|
jcallahan@141
|
330 local facing = _G.GetPlayerFacing()
|
jcallahan@141
|
331
|
jcallahan@141
|
332 if not facing then
|
jcallahan@141
|
333 return x, y
|
jcallahan@141
|
334 end
|
jcallahan@141
|
335 local rad = facing + pi
|
jcallahan@141
|
336 return x + math.sin(rad) * 15 / yard_width, y + math.cos(rad) * 15 / yard_height
|
jcallahan@10
|
337 end
|
jcallahan@10
|
338
|
jcallahan@24
|
339
|
jcallahan@141
|
340 function UpdateDBEntryLocation(entry_type, identifier)
|
jcallahan@141
|
341 if not identifier then
|
jcallahan@141
|
342 return
|
jcallahan@141
|
343 end
|
jcallahan@141
|
344 local zone_name, area_id, x, y, map_level, difficulty_token = CurrentLocationData()
|
jcallahan@141
|
345 local entry = DBEntry(entry_type, identifier)
|
jcallahan@141
|
346 entry[difficulty_token] = entry[difficulty_token] or {}
|
jcallahan@141
|
347 entry[difficulty_token].locations = entry[difficulty_token].locations or {}
|
jcallahan@141
|
348
|
jcallahan@141
|
349 local zone_token = ("%s:%d"):format(zone_name, area_id)
|
jcallahan@141
|
350 local zone_data = entry[difficulty_token].locations[zone_token]
|
jcallahan@141
|
351
|
jcallahan@141
|
352 if not zone_data then
|
jcallahan@141
|
353 zone_data = {}
|
jcallahan@141
|
354 entry[difficulty_token].locations[zone_token] = zone_data
|
jcallahan@141
|
355 end
|
jcallahan@141
|
356
|
jcallahan@141
|
357 -- Special case for Fishing.
|
jcallahan@141
|
358 if current_action.spell_label == "FISHING" then
|
jcallahan@141
|
359 local yard_width, yard_height = MapData:MapArea(area_id, map_level)
|
jcallahan@141
|
360
|
jcallahan@141
|
361 if yard_width > 0 and yard_height > 0 then
|
jcallahan@141
|
362 x, y = FishingCoordinates(x, y, yard_width, yard_height)
|
jcallahan@141
|
363 current_action.x = x
|
jcallahan@141
|
364 current_action.y = y
|
jcallahan@141
|
365 end
|
jcallahan@141
|
366 end
|
jcallahan@141
|
367 local location_token = ("%d:%d:%d"):format(map_level, x, y)
|
jcallahan@141
|
368
|
jcallahan@141
|
369 zone_data[location_token] = zone_data[location_token] or true
|
jcallahan@141
|
370 return zone_data
|
jcallahan@10
|
371 end
|
jcallahan@141
|
372 end -- do-block
|
jcallahan@10
|
373
|
jcallahan@10
|
374
|
jcallahan@19
|
375 local function HandleItemUse(item_link, bag_index, slot_index)
|
jcallahan@19
|
376 if not item_link then
|
jcallahan@19
|
377 return
|
jcallahan@19
|
378 end
|
jcallahan@19
|
379 local item_id = ItemLinkToID(item_link)
|
jcallahan@19
|
380
|
jcallahan@19
|
381 if not bag_index or not slot_index then
|
jcallahan@19
|
382 for new_bag_index = 0, _G.NUM_BAG_FRAMES do
|
jcallahan@19
|
383 for new_slot_index = 1, _G.GetContainerNumSlots(new_bag_index) do
|
jcallahan@19
|
384 if item_id == ItemLinkToID(_G.GetContainerItemLink(new_bag_index, new_slot_index)) then
|
jcallahan@19
|
385 bag_index = new_bag_index
|
jcallahan@19
|
386 slot_index = new_slot_index
|
jcallahan@19
|
387 break
|
jcallahan@19
|
388 end
|
jcallahan@19
|
389 end
|
jcallahan@19
|
390 end
|
jcallahan@19
|
391 end
|
jcallahan@19
|
392
|
jcallahan@19
|
393 if not bag_index or not slot_index then
|
jcallahan@19
|
394 return
|
jcallahan@19
|
395 end
|
jcallahan@19
|
396 local _, _, _, _, _, is_lootable = _G.GetContainerItemInfo(bag_index, slot_index)
|
jcallahan@19
|
397
|
jcallahan@19
|
398 if not is_lootable then
|
jcallahan@19
|
399 return
|
jcallahan@19
|
400 end
|
jcallahan@19
|
401 DatamineTT:ClearLines()
|
jcallahan@19
|
402 DatamineTT:SetBagItem(bag_index, slot_index)
|
jcallahan@19
|
403
|
jcallahan@19
|
404 for line_index = 1, DatamineTT:NumLines() do
|
jcallahan@19
|
405 local current_line = _G["WDPDatamineTTTextLeft" .. line_index]
|
jcallahan@19
|
406
|
jcallahan@19
|
407 if not current_line then
|
jcallahan@19
|
408 break
|
jcallahan@19
|
409 end
|
jcallahan@19
|
410
|
jcallahan@19
|
411 if current_line:GetText() == _G.ITEM_OPENABLE then
|
jcallahan@122
|
412 table.wipe(current_action)
|
jcallahan@123
|
413 current_action.target_type = AF.ITEM
|
jcallahan@122
|
414 current_action.identifier = item_id
|
jcallahan@122
|
415 current_action.loot_label = "contains"
|
jcallahan@19
|
416 break
|
jcallahan@19
|
417 end
|
jcallahan@19
|
418 end
|
jcallahan@19
|
419 end
|
jcallahan@19
|
420
|
jcallahan@19
|
421
|
jcallahan@39
|
422 local UnitFactionStanding
|
jcallahan@32
|
423 local UpdateFactionData
|
jcallahan@32
|
424 do
|
jcallahan@32
|
425 local MAX_FACTION_INDEX = 1000
|
jcallahan@20
|
426
|
jcallahan@32
|
427 local STANDING_NAMES = {
|
jcallahan@32
|
428 "HATED",
|
jcallahan@32
|
429 "HOSTILE",
|
jcallahan@32
|
430 "UNFRIENDLY",
|
jcallahan@32
|
431 "NEUTRAL",
|
jcallahan@32
|
432 "FRIENDLY",
|
jcallahan@32
|
433 "HONORED",
|
jcallahan@32
|
434 "REVERED",
|
jcallahan@32
|
435 "EXALTED",
|
jcallahan@32
|
436 }
|
jcallahan@32
|
437
|
jcallahan@39
|
438
|
jcallahan@39
|
439 function UnitFactionStanding(unit)
|
jcallahan@135
|
440 local unit_name = _G.UnitName(unit)
|
jcallahan@39
|
441 UpdateFactionData()
|
jcallahan@39
|
442 DatamineTT:ClearLines()
|
jcallahan@39
|
443 DatamineTT:SetUnit(unit)
|
jcallahan@39
|
444
|
jcallahan@39
|
445 for line_index = 1, DatamineTT:NumLines() do
|
jcallahan@64
|
446 local faction_name = _G["WDPDatamineTTTextLeft" .. line_index]:GetText():trim()
|
jcallahan@39
|
447
|
jcallahan@135
|
448 if faction_name and faction_name ~= unit_name and faction_standings[faction_name] then
|
jcallahan@39
|
449 return faction_name, faction_standings[faction_name]
|
jcallahan@39
|
450 end
|
jcallahan@39
|
451 end
|
jcallahan@39
|
452 end
|
jcallahan@39
|
453
|
jcallahan@39
|
454
|
jcallahan@32
|
455 function UpdateFactionData()
|
jcallahan@32
|
456 for faction_index = 1, MAX_FACTION_INDEX do
|
jcallahan@32
|
457 local faction_name, _, current_standing, _, _, _, _, _, is_header = _G.GetFactionInfo(faction_index)
|
jcallahan@32
|
458
|
jcallahan@86
|
459 if faction_name then
|
jcallahan@32
|
460 faction_standings[faction_name] = STANDING_NAMES[current_standing]
|
jcallahan@32
|
461 elseif not faction_name then
|
jcallahan@32
|
462 break
|
jcallahan@32
|
463 end
|
jcallahan@20
|
464 end
|
jcallahan@20
|
465 end
|
jcallahan@32
|
466 end -- do-block
|
jcallahan@20
|
467
|
jcallahan@48
|
468
|
jcallahan@75
|
469 local GenericLootUpdate
|
jcallahan@75
|
470 do
|
jcallahan@77
|
471 local function LootTable(entry, loot_type, top_field)
|
jcallahan@75
|
472 if top_field then
|
jcallahan@75
|
473 entry[top_field] = entry[top_field] or {}
|
jcallahan@75
|
474 entry[top_field][loot_type] = entry[top_field][loot_type] or {}
|
jcallahan@75
|
475 return entry[top_field][loot_type]
|
jcallahan@75
|
476 end
|
jcallahan@48
|
477 entry[loot_type] = entry[loot_type] or {}
|
jcallahan@75
|
478 return entry[loot_type]
|
jcallahan@48
|
479 end
|
jcallahan@48
|
480
|
jcallahan@75
|
481 function GenericLootUpdate(data_type, top_field)
|
jcallahan@132
|
482 local loot_type = current_loot.label
|
jcallahan@75
|
483 local loot_count = ("%s_count"):format(loot_type)
|
jcallahan@77
|
484 local source_list = {}
|
jcallahan@75
|
485
|
jcallahan@131
|
486 if current_loot.sources then
|
jcallahan@131
|
487 for source_guid, loot_data in pairs(current_loot.sources) do
|
jcallahan@119
|
488 local entry, source_id
|
jcallahan@78
|
489
|
jcallahan@131
|
490 if current_loot.target_type == AF.ITEM then
|
jcallahan@119
|
491 -- Items return the player as the source, so we need to use the item's ID (disenchant, milling, etc)
|
jcallahan@131
|
492 source_id = current_loot.identifier
|
jcallahan@119
|
493 entry = DBEntry(data_type, source_id)
|
jcallahan@131
|
494 elseif current_loot.target_type == AF.OBJECT then
|
jcallahan@131
|
495 source_id = ("%s:%s"):format(current_loot.spell_label, select(2, ParseGUID(source_guid)))
|
jcallahan@119
|
496 entry = DBEntry(data_type, source_id)
|
jcallahan@119
|
497 else
|
jcallahan@119
|
498 source_id = select(2, ParseGUID(source_guid))
|
jcallahan@119
|
499 entry = DBEntry(data_type, source_id)
|
jcallahan@119
|
500 end
|
jcallahan@75
|
501
|
jcallahan@119
|
502 if entry then
|
jcallahan@119
|
503 local loot_table = LootTable(entry, loot_type, top_field)
|
jcallahan@77
|
504
|
jcallahan@119
|
505 if not source_list[source_guid] then
|
jcallahan@119
|
506 if top_field then
|
jcallahan@119
|
507 entry[top_field][loot_count] = (entry[top_field][loot_count] or 0) + 1
|
jcallahan@119
|
508 else
|
jcallahan@119
|
509 entry[loot_count] = (entry[loot_count] or 0) + 1
|
jcallahan@119
|
510 end
|
jcallahan@119
|
511 source_list[source_guid] = true
|
jcallahan@77
|
512 end
|
jcallahan@119
|
513 UpdateDBEntryLocation(data_type, source_id)
|
jcallahan@75
|
514
|
jcallahan@119
|
515 for item_id, quantity in pairs(loot_data) do
|
jcallahan@119
|
516 table.insert(loot_table, ("%d:%d"):format(item_id, quantity))
|
jcallahan@119
|
517 end
|
jcallahan@75
|
518 end
|
jcallahan@75
|
519 end
|
jcallahan@75
|
520 end
|
jcallahan@121
|
521
|
jcallahan@121
|
522 -- This is used for Gas Extractions.
|
jcallahan@131
|
523 if #current_loot.list <= 0 then
|
jcallahan@78
|
524 return
|
jcallahan@78
|
525 end
|
jcallahan@82
|
526 local entry
|
jcallahan@82
|
527
|
jcallahan@82
|
528 -- At this point we only have a name if it's an object.
|
jcallahan@131
|
529 if current_loot.target_type == AF.OBJECT then
|
jcallahan@131
|
530 entry = DBEntry(data_type, ("%s:%s"):format(current_loot.spell_label, current_loot.object_name))
|
jcallahan@82
|
531 else
|
jcallahan@131
|
532 entry = DBEntry(data_type, current_loot.identifier)
|
jcallahan@82
|
533 end
|
jcallahan@75
|
534
|
jcallahan@75
|
535 if not entry then
|
jcallahan@75
|
536 return
|
jcallahan@75
|
537 end
|
jcallahan@77
|
538 local loot_table = LootTable(entry, loot_type, top_field)
|
jcallahan@77
|
539
|
jcallahan@131
|
540 if not source_list[current_loot.identifier] then
|
jcallahan@77
|
541 if top_field then
|
jcallahan@77
|
542 entry[top_field][loot_count] = (entry[top_field][loot_count] or 0) + 1
|
jcallahan@77
|
543 else
|
jcallahan@77
|
544 entry[loot_count] = (entry[loot_count] or 0) + 1
|
jcallahan@77
|
545 end
|
jcallahan@77
|
546 end
|
jcallahan@75
|
547
|
jcallahan@131
|
548 for index = 1, #current_loot.list do
|
jcallahan@131
|
549 table.insert(loot_table, current_loot.list[index])
|
jcallahan@75
|
550 end
|
jcallahan@48
|
551 end
|
jcallahan@75
|
552 end -- do-block
|
jcallahan@48
|
553
|
jcallahan@97
|
554
|
jcallahan@97
|
555 local ReplaceKeywords
|
jcallahan@97
|
556 do
|
jcallahan@97
|
557 local KEYWORD_SUBSTITUTIONS = {
|
jcallahan@97
|
558 class = PLAYER_CLASS,
|
jcallahan@97
|
559 name = PLAYER_NAME,
|
jcallahan@97
|
560 race = PLAYER_RACE,
|
jcallahan@97
|
561 }
|
jcallahan@97
|
562
|
jcallahan@97
|
563
|
jcallahan@97
|
564 function ReplaceKeywords(text)
|
jcallahan@97
|
565 if not text or text == "" then
|
jcallahan@97
|
566 return ""
|
jcallahan@97
|
567 end
|
jcallahan@97
|
568
|
jcallahan@97
|
569 for category, lookup in pairs(KEYWORD_SUBSTITUTIONS) do
|
jcallahan@97
|
570 local category_format = ("<%s>"):format(category)
|
jcallahan@97
|
571 text = text:gsub(lookup, category_format):gsub(lookup:lower(), category_format)
|
jcallahan@97
|
572 end
|
jcallahan@97
|
573 return text
|
jcallahan@97
|
574 end
|
jcallahan@97
|
575 end -- do-block
|
jcallahan@97
|
576
|
jcallahan@97
|
577
|
jcallahan@129
|
578 function WDP:SetCurrentAreaID(event_name)
|
jcallahan@126
|
579 local map_area_id = _G.GetCurrentMapAreaID()
|
jcallahan@126
|
580 _G.SetMapToCurrentZone()
|
jcallahan@126
|
581
|
jcallahan@126
|
582 current_area_id = _G.GetCurrentMapAreaID()
|
jcallahan@126
|
583 _G.SetMapByID(map_area_id)
|
jcallahan@126
|
584 end
|
jcallahan@126
|
585
|
jcallahan@126
|
586
|
jcallahan@0
|
587 -----------------------------------------------------------------------
|
jcallahan@0
|
588 -- Methods.
|
jcallahan@0
|
589 -----------------------------------------------------------------------
|
jcallahan@0
|
590 function WDP:OnInitialize()
|
jcallahan@128
|
591 local db = LibStub("AceDB-3.0"):New("WoWDBProfilerData", DATABASE_DEFAULTS, "Default")
|
jcallahan@128
|
592 global_db = db.global
|
jcallahan@128
|
593 char_db = db.char
|
jcallahan@14
|
594
|
jcallahan@14
|
595 local raw_db = _G["WoWDBProfilerData"]
|
jcallahan@18
|
596 local build_num = tonumber(private.build_num)
|
jcallahan@14
|
597
|
jcallahan@136
|
598 if (raw_db.version and raw_db.version < DB_VERSION) or (raw_db.build_num and raw_db.build_num < build_num) then
|
jcallahan@74
|
599 for entry in pairs(DATABASE_DEFAULTS.global) do
|
jcallahan@128
|
600 global_db[entry] = {}
|
jcallahan@74
|
601 end
|
jcallahan@74
|
602 end
|
jcallahan@35
|
603 raw_db.build_num = build_num
|
jcallahan@63
|
604 raw_db.version = DB_VERSION
|
jcallahan@0
|
605 end
|
jcallahan@0
|
606
|
jcallahan@0
|
607
|
jcallahan@0
|
608 function WDP:OnEnable()
|
jcallahan@0
|
609 for event_name, mapping in pairs(EVENT_MAPPING) do
|
jcallahan@1
|
610 self:RegisterEvent(event_name, (_G.type(mapping) ~= "boolean") and mapping or nil)
|
jcallahan@0
|
611 end
|
jcallahan@95
|
612
|
jcallahan@95
|
613 for index = 1, _G.GetNumLanguages() do
|
jcallahan@95
|
614 languages_known[_G.GetLanguageByIndex(index)] = true
|
jcallahan@95
|
615 end
|
jcallahan@0
|
616 durability_timer_handle = self:ScheduleRepeatingTimer("ProcessDurability", 30)
|
jcallahan@31
|
617 target_location_timer_handle = self:ScheduleRepeatingTimer("UpdateTargetLocation", 0.5)
|
jcallahan@19
|
618
|
jcallahan@19
|
619 _G.hooksecurefunc("UseContainerItem", function(bag_index, slot_index, target_unit)
|
jcallahan@19
|
620 if target_unit then
|
jcallahan@19
|
621 return
|
jcallahan@19
|
622 end
|
jcallahan@19
|
623 HandleItemUse(_G.GetContainerItemLink(bag_index, slot_index), bag_index, slot_index)
|
jcallahan@19
|
624 end)
|
jcallahan@19
|
625
|
jcallahan@19
|
626 _G.hooksecurefunc("UseItemByName", function(identifier, target_unit)
|
jcallahan@19
|
627 if target_unit then
|
jcallahan@19
|
628 return
|
jcallahan@19
|
629 end
|
jcallahan@19
|
630 local _, item_link = _G.GetItemInfo(identifier)
|
jcallahan@19
|
631 HandleItemUse(item_link)
|
jcallahan@19
|
632 end)
|
jcallahan@129
|
633 self:SetCurrentAreaID("OnEnable")
|
jcallahan@126
|
634
|
jcallahan@128
|
635 _G.hooksecurefunc("SetBlacklistMap", UpdateBlacklistMaps)
|
jcallahan@128
|
636 _G.hooksecurefunc("ClearBlacklistMap", UpdateBlacklistMaps)
|
jcallahan@128
|
637
|
jcallahan@128
|
638 UpdateBlacklistMaps()
|
jcallahan@0
|
639 end
|
jcallahan@0
|
640
|
jcallahan@0
|
641
|
jcallahan@0
|
642 local function RecordDurability(item_id, durability)
|
jcallahan@0
|
643 if not durability or durability <= 0 then
|
jcallahan@0
|
644 return
|
jcallahan@0
|
645 end
|
jcallahan@0
|
646
|
jcallahan@128
|
647 if not global_db.items[item_id] then
|
jcallahan@128
|
648 global_db.items[item_id] = {}
|
jcallahan@0
|
649 end
|
jcallahan@128
|
650 global_db.items[item_id].durability = durability
|
jcallahan@0
|
651 end
|
jcallahan@0
|
652
|
jcallahan@0
|
653
|
jcallahan@0
|
654 function WDP:ProcessDurability()
|
jcallahan@0
|
655 for slot_index = 0, _G.INVSLOT_LAST_EQUIPPED do
|
jcallahan@1
|
656 local item_id = _G.GetInventoryItemID("player", slot_index)
|
jcallahan@0
|
657
|
jcallahan@0
|
658 if item_id and item_id > 0 then
|
jcallahan@1
|
659 local _, max_durability = _G.GetInventoryItemDurability(slot_index)
|
jcallahan@0
|
660 RecordDurability(item_id, max_durability)
|
jcallahan@0
|
661 end
|
jcallahan@0
|
662 end
|
jcallahan@0
|
663
|
jcallahan@0
|
664 for bag_index = 0, _G.NUM_BAG_SLOTS do
|
jcallahan@0
|
665 for slot_index = 1, _G.GetContainerNumSlots(bag_index) do
|
jcallahan@1
|
666 local item_id = _G.GetContainerItemID(bag_index, slot_index)
|
jcallahan@0
|
667
|
jcallahan@0
|
668 if item_id and item_id > 0 then
|
jcallahan@1
|
669 local _, max_durability = _G.GetContainerItemDurability(bag_index, slot_index)
|
jcallahan@0
|
670 RecordDurability(item_id, max_durability)
|
jcallahan@0
|
671 end
|
jcallahan@0
|
672 end
|
jcallahan@0
|
673 end
|
jcallahan@0
|
674 end
|
jcallahan@0
|
675
|
jcallahan@118
|
676
|
jcallahan@118
|
677 local PlayerTarget
|
jcallahan@118
|
678 do
|
jcallahan@118
|
679 local GENDER_NAMES = {
|
jcallahan@118
|
680 "UNKNOWN",
|
jcallahan@118
|
681 "MALE",
|
jcallahan@118
|
682 "FEMALE",
|
jcallahan@118
|
683 }
|
jcallahan@118
|
684
|
jcallahan@118
|
685
|
jcallahan@118
|
686 local REACTION_NAMES = {
|
jcallahan@118
|
687 "HATED",
|
jcallahan@118
|
688 "HOSTILE",
|
jcallahan@118
|
689 "UNFRIENDLY",
|
jcallahan@118
|
690 "NEUTRAL",
|
jcallahan@118
|
691 "FRIENDLY",
|
jcallahan@118
|
692 "HONORED",
|
jcallahan@118
|
693 "REVERED",
|
jcallahan@118
|
694 "EXALTED",
|
jcallahan@118
|
695 }
|
jcallahan@118
|
696
|
jcallahan@118
|
697
|
jcallahan@118
|
698 local POWER_TYPE_NAMES = {
|
jcallahan@118
|
699 ["0"] = "MANA",
|
jcallahan@118
|
700 ["1"] = "RAGE",
|
jcallahan@118
|
701 ["2"] = "FOCUS",
|
jcallahan@118
|
702 ["3"] = "ENERGY",
|
jcallahan@118
|
703 ["6"] = "RUNIC_POWER",
|
jcallahan@118
|
704 }
|
jcallahan@118
|
705
|
jcallahan@118
|
706
|
jcallahan@118
|
707 function PlayerTarget()
|
jcallahan@118
|
708 if not _G.UnitExists("target") or _G.UnitPlayerControlled("target") or currently_drunk then
|
jcallahan@118
|
709 current_target_id = nil
|
jcallahan@118
|
710 return
|
jcallahan@118
|
711 end
|
jcallahan@118
|
712 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target"))
|
jcallahan@118
|
713
|
jcallahan@118
|
714 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then
|
jcallahan@118
|
715 return
|
jcallahan@118
|
716 end
|
jcallahan@118
|
717 current_target_id = unit_idnum
|
jcallahan@118
|
718
|
jcallahan@118
|
719 local npc = NPCEntry(unit_idnum)
|
jcallahan@118
|
720 local _, class_token = _G.UnitClass("target")
|
jcallahan@118
|
721 npc.class = class_token
|
jcallahan@118
|
722 npc.faction = UnitFactionStanding("target")
|
jcallahan@118
|
723 npc.genders = npc.genders or {}
|
jcallahan@118
|
724 npc.genders[GENDER_NAMES[_G.UnitSex("target")] or "UNDEFINED"] = true
|
jcallahan@118
|
725 npc.is_pvp = _G.UnitIsPVP("target") and true or nil
|
jcallahan@118
|
726 npc.reaction = ("%s:%s:%s"):format(_G.UnitLevel("player"), _G.UnitFactionGroup("player"), REACTION_NAMES[_G.UnitReaction("player", "target")])
|
jcallahan@118
|
727
|
jcallahan@118
|
728 local encounter_data = npc.encounter_data[InstanceDifficultyToken()].stats
|
jcallahan@118
|
729 local npc_level = ("level_%d"):format(_G.UnitLevel("target"))
|
jcallahan@118
|
730
|
jcallahan@118
|
731 if not encounter_data[npc_level] then
|
jcallahan@118
|
732 encounter_data[npc_level] = {
|
jcallahan@118
|
733 max_health = _G.UnitHealthMax("target"),
|
jcallahan@118
|
734 }
|
jcallahan@118
|
735
|
jcallahan@118
|
736 local max_power = _G.UnitManaMax("target")
|
jcallahan@118
|
737
|
jcallahan@118
|
738 if max_power > 0 then
|
jcallahan@118
|
739 local power_type = _G.UnitPowerType("target")
|
jcallahan@118
|
740 encounter_data[npc_level].power = ("%s:%d"):format(POWER_TYPE_NAMES[_G.tostring(power_type)] or power_type, max_power)
|
jcallahan@118
|
741 end
|
jcallahan@118
|
742 end
|
jcallahan@118
|
743 name_to_id_map[_G.UnitName("target")] = unit_idnum
|
jcallahan@118
|
744
|
jcallahan@123
|
745 current_action.target_type = AF.NPC
|
jcallahan@122
|
746 current_action.identifier = unit_idnum
|
jcallahan@118
|
747 return npc, unit_idnum
|
jcallahan@118
|
748 end
|
jcallahan@118
|
749 end -- do-block
|
jcallahan@118
|
750
|
jcallahan@118
|
751
|
jcallahan@113
|
752 do
|
jcallahan@113
|
753 local COORD_MAX = 5
|
jcallahan@0
|
754
|
jcallahan@113
|
755 function WDP:UpdateTargetLocation()
|
jcallahan@113
|
756 if currently_drunk or not _G.UnitExists("target") or _G.UnitPlayerControlled("target") or (_G.UnitIsTapped("target") and not _G.UnitIsDead("target")) then
|
jcallahan@2
|
757 return
|
jcallahan@2
|
758 end
|
jcallahan@113
|
759
|
jcallahan@113
|
760 for index = 1, 4 do
|
jcallahan@113
|
761 if not _G.CheckInteractDistance("target", index) then
|
jcallahan@113
|
762 return
|
jcallahan@113
|
763 end
|
jcallahan@113
|
764 end
|
jcallahan@118
|
765 local npc = PlayerTarget()
|
jcallahan@113
|
766
|
jcallahan@113
|
767 if not npc then
|
jcallahan@113
|
768 return
|
jcallahan@113
|
769 end
|
jcallahan@113
|
770 local zone_name, area_id, x, y, map_level, difficulty_token = CurrentLocationData()
|
jcallahan@113
|
771 local npc_data = npc.encounter_data[difficulty_token].stats[("level_%d"):format(_G.UnitLevel("target"))]
|
jcallahan@113
|
772 local zone_token = ("%s:%d"):format(zone_name, area_id)
|
jcallahan@118
|
773 npc_data.locations = npc_data.locations or {} -- TODO: Fix this. It is broken. Possibly something to do with the timed updates.
|
jcallahan@113
|
774
|
jcallahan@113
|
775 local zone_data = npc_data.locations[zone_token]
|
jcallahan@113
|
776
|
jcallahan@113
|
777 if not zone_data then
|
jcallahan@113
|
778 zone_data = {}
|
jcallahan@113
|
779 npc_data.locations[zone_token] = zone_data
|
jcallahan@113
|
780 end
|
jcallahan@113
|
781
|
jcallahan@113
|
782 for location_token in pairs(zone_data) do
|
jcallahan@113
|
783 local loc_level, loc_x, loc_y = (":"):split(location_token)
|
jcallahan@113
|
784 loc_level = tonumber(loc_level)
|
jcallahan@113
|
785
|
jcallahan@113
|
786 if map_level == loc_level and math.abs(x - loc_x) <= COORD_MAX and math.abs(y - loc_y) <= COORD_MAX then
|
jcallahan@113
|
787 return
|
jcallahan@113
|
788 end
|
jcallahan@113
|
789 end
|
jcallahan@141
|
790 zone_data[("%d:%d:%d"):format(map_level, x, y)] = true
|
jcallahan@2
|
791 end
|
jcallahan@113
|
792 end -- do-block
|
jcallahan@2
|
793
|
jcallahan@118
|
794
|
jcallahan@0
|
795 -----------------------------------------------------------------------
|
jcallahan@0
|
796 -- Event handlers.
|
jcallahan@0
|
797 -----------------------------------------------------------------------
|
jcallahan@90
|
798 function WDP:BLACK_MARKET_ITEM_UPDATE(event_name)
|
jcallahan@56
|
799 local num_items = _G.C_BlackMarket.GetNumItems()
|
jcallahan@56
|
800
|
jcallahan@56
|
801 for index = 1, num_items do
|
jcallahan@56
|
802 local name, texture, quantity, item_type, is_usable, level, level_type, seller_name, min_bid, min_increment, current_bid, has_high_bid, num_bids, time_left, item_link, market_id = _G.C_BlackMarket.GetItemInfoByIndex(index);
|
jcallahan@56
|
803
|
jcallahan@56
|
804 if item_link then
|
jcallahan@56
|
805 DBEntry("items", ItemLinkToID(item_link)).black_market = seller_name or "UNKNOWN"
|
jcallahan@56
|
806 end
|
jcallahan@56
|
807 end
|
jcallahan@56
|
808 end
|
jcallahan@56
|
809
|
jcallahan@56
|
810
|
jcallahan@75
|
811 function WDP:CHAT_MSG_LOOT(event_name, message)
|
jcallahan@122
|
812 if current_action.spell_label ~= "EXTRACT_GAS" then
|
jcallahan@48
|
813 return
|
jcallahan@48
|
814 end
|
jcallahan@48
|
815 local item_link, quantity = deformat(message, _G.LOOT_ITEM_PUSHED_SELF_MULTIPLE)
|
jcallahan@48
|
816
|
jcallahan@48
|
817 if not item_link then
|
jcallahan@48
|
818 quantity, item_link = 1, deformat(message, _G.LOOT_ITEM_PUSHED_SELF)
|
jcallahan@48
|
819 end
|
jcallahan@48
|
820
|
jcallahan@48
|
821 if not item_link then
|
jcallahan@48
|
822 return
|
jcallahan@48
|
823 end
|
jcallahan@48
|
824 local item_id = ItemLinkToID(item_link)
|
jcallahan@48
|
825
|
jcallahan@48
|
826 if not item_id then
|
jcallahan@48
|
827 return
|
jcallahan@48
|
828 end
|
jcallahan@131
|
829 current_loot = {
|
jcallahan@131
|
830 list = {
|
jcallahan@131
|
831 ("%d:%d"):format(item_id, quantity)
|
jcallahan@131
|
832 },
|
jcallahan@131
|
833 identifier = current_action.identifier,
|
jcallahan@132
|
834 label = current_action.loot_label or "drops",
|
jcallahan@131
|
835 map_level = current_action.map_level,
|
jcallahan@131
|
836 object_name = current_action.object_name,
|
jcallahan@131
|
837 spell_label = current_action.spell_label,
|
jcallahan@131
|
838 target_type = current_action.target_type,
|
jcallahan@131
|
839 x = current_action.x,
|
jcallahan@131
|
840 y = current_action.y,
|
jcallahan@131
|
841 zone_data = current_action.zone_data,
|
jcallahan@48
|
842 }
|
jcallahan@131
|
843 table.wipe(current_action)
|
jcallahan@48
|
844 GenericLootUpdate("zones")
|
jcallahan@48
|
845 end
|
jcallahan@48
|
846
|
jcallahan@48
|
847
|
jcallahan@97
|
848 function WDP:RecordQuote(event_name, message, source_name, language_name)
|
jcallahan@112
|
849 if not ALLOWED_LOCALES[CLIENT_LOCALE] or not source_name or not name_to_id_map[source_name] or (language_name ~= "" and not languages_known[language_name]) then
|
jcallahan@97
|
850 return
|
jcallahan@95
|
851 end
|
jcallahan@97
|
852 local npc = NPCEntry(name_to_id_map[source_name])
|
jcallahan@97
|
853 npc.quotes = npc.quotes or {}
|
jcallahan@97
|
854 npc.quotes[event_name] = npc.quotes[event_name] or {}
|
jcallahan@97
|
855 npc.quotes[event_name][ReplaceKeywords(message)] = true
|
jcallahan@97
|
856 end
|
jcallahan@95
|
857
|
jcallahan@95
|
858
|
jcallahan@95
|
859 do
|
jcallahan@40
|
860 local SOBER_MATCH = _G.DRUNK_MESSAGE_ITEM_SELF1:gsub("%%s", ".+")
|
jcallahan@40
|
861
|
jcallahan@40
|
862 local DRUNK_COMPARES = {
|
jcallahan@40
|
863 _G.DRUNK_MESSAGE_SELF2,
|
jcallahan@40
|
864 _G.DRUNK_MESSAGE_SELF3,
|
jcallahan@40
|
865 _G.DRUNK_MESSAGE_SELF4,
|
jcallahan@40
|
866 }
|
jcallahan@40
|
867
|
jcallahan@40
|
868 local DRUNK_MATCHES = {
|
jcallahan@40
|
869 _G.DRUNK_MESSAGE_SELF2:gsub("%%s", ".+"),
|
jcallahan@40
|
870 _G.DRUNK_MESSAGE_SELF3:gsub("%%s", ".+"),
|
jcallahan@40
|
871 _G.DRUNK_MESSAGE_SELF4:gsub("%%s", ".+"),
|
jcallahan@40
|
872 }
|
jcallahan@40
|
873
|
jcallahan@92
|
874 function WDP:CHAT_MSG_SYSTEM(event_name, message)
|
jcallahan@40
|
875 if currently_drunk then
|
jcallahan@40
|
876 if message == _G.DRUNK_MESSAGE_SELF1 or message:match(SOBER_MATCH) then
|
jcallahan@40
|
877 currently_drunk = nil
|
jcallahan@40
|
878 end
|
jcallahan@40
|
879 return
|
jcallahan@40
|
880 end
|
jcallahan@40
|
881
|
jcallahan@40
|
882 for index = 1, #DRUNK_MATCHES do
|
jcallahan@40
|
883 if message == DRUNK_COMPARES[index] or message:match(DRUNK_MATCHES[index]) then
|
jcallahan@40
|
884 currently_drunk = true
|
jcallahan@40
|
885 break
|
jcallahan@40
|
886 end
|
jcallahan@40
|
887 end
|
jcallahan@40
|
888 end
|
jcallahan@40
|
889 end
|
jcallahan@40
|
890
|
jcallahan@40
|
891 -- do-block
|
jcallahan@40
|
892
|
jcallahan@40
|
893 do
|
jcallahan@23
|
894 local FLAGS_NPC = bit.bor(_G.COMBATLOG_OBJECT_TYPE_GUARDIAN, _G.COMBATLOG_OBJECT_CONTROL_NPC)
|
jcallahan@23
|
895 local FLAGS_NPC_CONTROL = bit.bor(_G.COMBATLOG_OBJECT_AFFILIATION_OUTSIDER, _G.COMBATLOG_OBJECT_CONTROL_NPC)
|
jcallahan@23
|
896
|
jcallahan@23
|
897 local function RecordNPCSpell(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name)
|
jcallahan@23
|
898 if not spell_id then
|
jcallahan@23
|
899 return
|
jcallahan@23
|
900 end
|
jcallahan@34
|
901 local source_type, source_id = ParseGUID(source_guid)
|
jcallahan@23
|
902
|
jcallahan@23
|
903 if not source_id or source_type ~= private.UNIT_TYPES.NPC then
|
jcallahan@23
|
904 return
|
jcallahan@23
|
905 end
|
jcallahan@23
|
906
|
jcallahan@23
|
907 if bit.band(FLAGS_NPC_CONTROL, source_flags) == FLAGS_NPC_CONTROL and bit.band(FLAGS_NPC, source_flags) ~= 0 then
|
jcallahan@29
|
908 local encounter_data = NPCEntry(source_id).encounter_data[InstanceDifficultyToken()]
|
jcallahan@28
|
909 encounter_data.spells = encounter_data.spells or {}
|
jcallahan@28
|
910 encounter_data.spells[spell_id] = (encounter_data.spells[spell_id] or 0) + 1
|
jcallahan@23
|
911 end
|
jcallahan@23
|
912 end
|
jcallahan@23
|
913
|
jcallahan@115
|
914 local HEAL_BATTLE_PETS_SPELL_ID = 125801
|
jcallahan@115
|
915
|
jcallahan@23
|
916 local COMBAT_LOG_FUNCS = {
|
jcallahan@23
|
917 SPELL_AURA_APPLIED = RecordNPCSpell,
|
jcallahan@23
|
918 SPELL_CAST_START = RecordNPCSpell,
|
jcallahan@115
|
919 SPELL_CAST_SUCCESS = function(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name)
|
jcallahan@115
|
920 if spell_id == HEAL_BATTLE_PETS_SPELL_ID then
|
jcallahan@115
|
921 local unit_type, unit_idnum = ParseGUID(source_guid)
|
jcallahan@115
|
922
|
jcallahan@115
|
923 if unit_type == private.UNIT_TYPES.NPC and unit_idnum then
|
jcallahan@115
|
924 NPCEntry(unit_idnum).stable_master = true
|
jcallahan@115
|
925 end
|
jcallahan@115
|
926 end
|
jcallahan@115
|
927 RecordNPCSpell(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name)
|
jcallahan@115
|
928 end,
|
jcallahan@65
|
929 UNIT_DIED = function(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name)
|
jcallahan@65
|
930 local unit_type, unit_idnum = ParseGUID(dest_guid)
|
jcallahan@65
|
931
|
jcallahan@65
|
932 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then
|
jcallahan@67
|
933 reputation_npc_id = nil
|
jcallahan@98
|
934 private.harvesting = nil
|
jcallahan@65
|
935 return
|
jcallahan@65
|
936 end
|
jcallahan@67
|
937 reputation_npc_id = unit_idnum
|
jcallahan@65
|
938 end,
|
jcallahan@23
|
939 }
|
jcallahan@23
|
940
|
jcallahan@23
|
941
|
jcallahan@92
|
942 function WDP:COMBAT_LOG_EVENT_UNFILTERED(event_name, time_stamp, sub_event, hide_caster, source_guid, source_name, source_flags, source_raid_flags, dest_guid, dest_name, dest_flags, dest_raid_flags, ...)
|
jcallahan@23
|
943 local combat_log_func = COMBAT_LOG_FUNCS[sub_event]
|
jcallahan@23
|
944
|
jcallahan@23
|
945 if not combat_log_func then
|
jcallahan@23
|
946 return
|
jcallahan@23
|
947 end
|
jcallahan@23
|
948 combat_log_func(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, ...)
|
jcallahan@23
|
949 end
|
jcallahan@23
|
950
|
jcallahan@44
|
951 local DIPLOMACY_SPELL_ID = 20599
|
jcallahan@44
|
952 local MR_POP_RANK1_SPELL_ID = 78634
|
jcallahan@44
|
953 local MR_POP_RANK2_SPELL_ID = 78635
|
jcallahan@44
|
954
|
jcallahan@44
|
955 local REP_BUFFS = {
|
jcallahan@44
|
956 [_G.GetSpellInfo(30754)] = "CENARION_FAVOR",
|
jcallahan@44
|
957 [_G.GetSpellInfo(24705)] = "GRIM_VISAGE",
|
jcallahan@44
|
958 [_G.GetSpellInfo(32098)] = "HONOR_HOLD_FAVOR",
|
jcallahan@44
|
959 [_G.GetSpellInfo(39913)] = "NAZGRELS_FERVOR",
|
jcallahan@44
|
960 [_G.GetSpellInfo(39953)] = "SONG_OF_BATTLE",
|
jcallahan@44
|
961 [_G.GetSpellInfo(61849)] = "SPIRIT_OF_SHARING",
|
jcallahan@44
|
962 [_G.GetSpellInfo(32096)] = "THRALLMARS_FAVOR",
|
jcallahan@44
|
963 [_G.GetSpellInfo(39911)] = "TROLLBANES_COMMAND",
|
jcallahan@44
|
964 [_G.GetSpellInfo(95987)] = "UNBURDENED",
|
jcallahan@44
|
965 [_G.GetSpellInfo(100951)] = "WOW_ANNIVERSARY",
|
jcallahan@44
|
966 }
|
jcallahan@44
|
967
|
jcallahan@44
|
968
|
jcallahan@44
|
969 local FACTION_NAMES = {
|
jcallahan@44
|
970 CENARION_CIRCLE = _G.GetFactionInfoByID(609),
|
jcallahan@44
|
971 HONOR_HOLD = _G.GetFactionInfoByID(946),
|
jcallahan@44
|
972 THE_SHATAR = _G.GetFactionInfoByID(935),
|
jcallahan@44
|
973 THRALLMAR = _G.GetFactionInfoByID(947),
|
jcallahan@44
|
974 }
|
jcallahan@44
|
975
|
jcallahan@44
|
976
|
jcallahan@44
|
977 local MODIFIERS = {
|
jcallahan@44
|
978 CENARION_FAVOR = {
|
jcallahan@44
|
979 faction = FACTION_NAMES.CENARION_CIRCLE,
|
jcallahan@44
|
980 modifier = 0.25,
|
jcallahan@44
|
981 },
|
jcallahan@44
|
982 GRIM_VISAGE = {
|
jcallahan@44
|
983 modifier = 0.1,
|
jcallahan@44
|
984 },
|
jcallahan@44
|
985 HONOR_HOLD_FAVOR = {
|
jcallahan@44
|
986 faction = FACTION_NAMES.HONOR_HOLD,
|
jcallahan@44
|
987 modifier = 0.25,
|
jcallahan@44
|
988 },
|
jcallahan@44
|
989 NAZGRELS_FERVOR = {
|
jcallahan@44
|
990 faction = FACTION_NAMES.THRALLMAR,
|
jcallahan@44
|
991 modifier = 0.1,
|
jcallahan@44
|
992 },
|
jcallahan@44
|
993 SONG_OF_BATTLE = {
|
jcallahan@44
|
994 faction = FACTION_NAMES.THE_SHATAR,
|
jcallahan@44
|
995 modifier = 0.1,
|
jcallahan@44
|
996 },
|
jcallahan@44
|
997 SPIRIT_OF_SHARING = {
|
jcallahan@44
|
998 modifier = 0.1,
|
jcallahan@44
|
999 },
|
jcallahan@44
|
1000 THRALLMARS_FAVOR = {
|
jcallahan@44
|
1001 faction = FACTION_NAMES.THRALLMAR,
|
jcallahan@44
|
1002 modifier = 0.25,
|
jcallahan@44
|
1003 },
|
jcallahan@44
|
1004 TROLLBANES_COMMAND = {
|
jcallahan@44
|
1005 faction = FACTION_NAMES.HONOR_HOLD,
|
jcallahan@44
|
1006 modifier = 0.1,
|
jcallahan@44
|
1007 },
|
jcallahan@44
|
1008 UNBURDENED = {
|
jcallahan@44
|
1009 modifier = 0.1,
|
jcallahan@44
|
1010 },
|
jcallahan@44
|
1011 WOW_ANNIVERSARY = {
|
jcallahan@44
|
1012 modifier = 0.08,
|
jcallahan@44
|
1013 }
|
jcallahan@44
|
1014 }
|
jcallahan@44
|
1015
|
jcallahan@44
|
1016
|
jcallahan@92
|
1017 function WDP:COMBAT_TEXT_UPDATE(event_name, message_type, faction_name, amount)
|
jcallahan@67
|
1018 if message_type ~= "FACTION" or not reputation_npc_id then
|
jcallahan@44
|
1019 return
|
jcallahan@44
|
1020 end
|
jcallahan@44
|
1021 UpdateFactionData()
|
jcallahan@44
|
1022
|
jcallahan@46
|
1023 if not faction_name or not faction_standings[faction_name] then
|
jcallahan@46
|
1024 return
|
jcallahan@46
|
1025 end
|
jcallahan@67
|
1026 local npc = NPCEntry(reputation_npc_id)
|
jcallahan@98
|
1027 reputation_npc_id = nil
|
jcallahan@46
|
1028
|
jcallahan@44
|
1029 if not npc then
|
jcallahan@98
|
1030 private.harvesting = nil
|
jcallahan@44
|
1031 return
|
jcallahan@44
|
1032 end
|
jcallahan@98
|
1033 npc.harvested = private.harvesting
|
jcallahan@98
|
1034 private.harvesting = nil
|
jcallahan@98
|
1035
|
jcallahan@44
|
1036 local modifier = 1
|
jcallahan@44
|
1037
|
jcallahan@44
|
1038 if _G.IsSpellKnown(DIPLOMACY_SPELL_ID) then
|
jcallahan@44
|
1039 modifier = modifier + 0.1
|
jcallahan@44
|
1040 end
|
jcallahan@44
|
1041
|
jcallahan@44
|
1042 if _G.IsSpellKnown(MR_POP_RANK2_SPELL_ID) then
|
jcallahan@44
|
1043 modifier = modifier + 0.1
|
jcallahan@44
|
1044 elseif _G.IsSpellKnown(MR_POP_RANK1_SPELL_ID) then
|
jcallahan@44
|
1045 modifier = modifier + 0.05
|
jcallahan@44
|
1046 end
|
jcallahan@44
|
1047
|
jcallahan@44
|
1048 for buff_name, buff_label in pairs(REP_BUFFS) do
|
jcallahan@44
|
1049 if _G.UnitBuff("player", buff_name) then
|
jcallahan@44
|
1050 local modded_faction = MODIFIERS[buff_label].faction
|
jcallahan@44
|
1051
|
jcallahan@44
|
1052 if not modded_faction or faction_name == modded_faction then
|
jcallahan@44
|
1053 modifier = modifier + MODIFIERS[buff_label].modifier
|
jcallahan@44
|
1054 end
|
jcallahan@44
|
1055 end
|
jcallahan@44
|
1056 end
|
jcallahan@65
|
1057 npc.reputations = npc.reputations or {}
|
jcallahan@65
|
1058 npc.reputations[("%s:%s"):format(faction_name, faction_standings[faction_name])] = math.floor(amount / modifier)
|
jcallahan@32
|
1059 end
|
jcallahan@44
|
1060 end -- do-block
|
jcallahan@18
|
1061
|
jcallahan@18
|
1062
|
jcallahan@140
|
1063 function WDP:CURSOR_UPDATE(event_name)
|
jcallahan@141
|
1064 if current_action.fishing_target or _G.Minimap:IsMouseOver() or current_action.spell_label ~= "FISHING" then
|
jcallahan@140
|
1065 return
|
jcallahan@140
|
1066 end
|
jcallahan@140
|
1067 local text = _G["GameTooltipTextLeft1"]:GetText()
|
jcallahan@140
|
1068
|
jcallahan@140
|
1069 if not text or text == "Fishing Bobber" then
|
jcallahan@140
|
1070 text = "NONE"
|
jcallahan@140
|
1071 else
|
jcallahan@140
|
1072 current_action.fishing_target = true
|
jcallahan@140
|
1073 end
|
jcallahan@140
|
1074 current_action.identifier = ("%s:%s"):format(current_action.spell_label, text)
|
jcallahan@140
|
1075 end
|
jcallahan@140
|
1076
|
jcallahan@140
|
1077
|
jcallahan@92
|
1078 function WDP:ITEM_TEXT_BEGIN(event_name)
|
jcallahan@42
|
1079 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("npc"))
|
jcallahan@42
|
1080
|
jcallahan@42
|
1081 if not unit_idnum or unit_type ~= private.UNIT_TYPES.OBJECT or _G.UnitName("npc") ~= _G.ItemTextGetItem() then
|
jcallahan@42
|
1082 return
|
jcallahan@42
|
1083 end
|
jcallahan@42
|
1084 UpdateDBEntryLocation("objects", unit_idnum)
|
jcallahan@42
|
1085 end
|
jcallahan@42
|
1086
|
jcallahan@42
|
1087
|
jcallahan@13
|
1088 do
|
jcallahan@40
|
1089 local RE_GOLD = _G.GOLD_AMOUNT:gsub("%%d", "(%%d+)")
|
jcallahan@40
|
1090 local RE_SILVER = _G.SILVER_AMOUNT:gsub("%%d", "(%%d+)")
|
jcallahan@40
|
1091 local RE_COPPER = _G.COPPER_AMOUNT:gsub("%%d", "(%%d+)")
|
jcallahan@13
|
1092
|
jcallahan@13
|
1093
|
jcallahan@13
|
1094 local function _moneyMatch(money, re)
|
jcallahan@13
|
1095 return money:match(re) or 0
|
jcallahan@1
|
1096 end
|
jcallahan@1
|
1097
|
jcallahan@0
|
1098
|
jcallahan@13
|
1099 local function _toCopper(money)
|
jcallahan@13
|
1100 if not money then
|
jcallahan@13
|
1101 return 0
|
jcallahan@13
|
1102 end
|
jcallahan@40
|
1103 return _moneyMatch(money, RE_GOLD) * 10000 + _moneyMatch(money, RE_SILVER) * 100 + _moneyMatch(money, RE_COPPER)
|
jcallahan@1
|
1104 end
|
jcallahan@1
|
1105
|
jcallahan@1
|
1106
|
jcallahan@13
|
1107 local LOOT_VERIFY_FUNCS = {
|
jcallahan@16
|
1108 [AF.ITEM] = function()
|
jcallahan@16
|
1109 local locked_item_id
|
jcallahan@16
|
1110
|
jcallahan@16
|
1111 for bag_index = 0, _G.NUM_BAG_FRAMES do
|
jcallahan@16
|
1112 for slot_index = 1, _G.GetContainerNumSlots(bag_index) do
|
jcallahan@16
|
1113 local _, _, is_locked = _G.GetContainerItemInfo(bag_index, slot_index)
|
jcallahan@16
|
1114
|
jcallahan@16
|
1115 if is_locked then
|
jcallahan@16
|
1116 locked_item_id = ItemLinkToID(_G.GetContainerItemLink(bag_index, slot_index))
|
jcallahan@16
|
1117 end
|
jcallahan@16
|
1118 end
|
jcallahan@16
|
1119 end
|
jcallahan@16
|
1120
|
jcallahan@122
|
1121 if not locked_item_id or (current_action.identifier and current_action.identifier ~= locked_item_id) then
|
jcallahan@16
|
1122 return false
|
jcallahan@16
|
1123 end
|
jcallahan@122
|
1124 current_action.identifier = locked_item_id
|
jcallahan@16
|
1125 return true
|
jcallahan@16
|
1126 end,
|
jcallahan@13
|
1127 [AF.NPC] = function()
|
jcallahan@17
|
1128 if not _G.UnitExists("target") or _G.UnitIsFriend("player", "target") or _G.UnitIsPlayer("target") or _G.UnitPlayerControlled("target") then
|
jcallahan@15
|
1129 return false
|
jcallahan@13
|
1130 end
|
jcallahan@34
|
1131 local unit_type, id_num = ParseGUID(_G.UnitGUID("target"))
|
jcallahan@122
|
1132 current_action.identifier = id_num
|
jcallahan@13
|
1133 return true
|
jcallahan@13
|
1134 end,
|
jcallahan@14
|
1135 [AF.OBJECT] = true,
|
jcallahan@17
|
1136 [AF.ZONE] = function()
|
jcallahan@140
|
1137 if not _G.IsFishingLoot() then
|
jcallahan@140
|
1138 return false
|
jcallahan@140
|
1139 end
|
jcallahan@140
|
1140 current_action.zone_data = UpdateDBEntryLocation("zones", current_action.identifier)
|
jcallahan@140
|
1141 return true
|
jcallahan@17
|
1142 end,
|
jcallahan@13
|
1143 }
|
jcallahan@13
|
1144
|
jcallahan@13
|
1145
|
jcallahan@13
|
1146 local LOOT_UPDATE_FUNCS = {
|
jcallahan@16
|
1147 [AF.ITEM] = function()
|
jcallahan@28
|
1148 GenericLootUpdate("items")
|
jcallahan@28
|
1149 end,
|
jcallahan@28
|
1150 [AF.NPC] = function()
|
jcallahan@75
|
1151 local difficulty_token = InstanceDifficultyToken()
|
jcallahan@132
|
1152 local loot_type = current_loot.label
|
jcallahan@77
|
1153 local source_list = {}
|
jcallahan@75
|
1154
|
jcallahan@131
|
1155 for source_guid, loot_data in pairs(current_loot.sources) do
|
jcallahan@78
|
1156 local source_id = select(2, ParseGUID(source_guid))
|
jcallahan@75
|
1157 local npc = NPCEntry(source_id)
|
jcallahan@75
|
1158
|
jcallahan@75
|
1159 if npc then
|
jcallahan@75
|
1160 local encounter_data = npc.encounter_data[difficulty_token]
|
jcallahan@75
|
1161 encounter_data[loot_type] = encounter_data[loot_type] or {}
|
jcallahan@75
|
1162
|
jcallahan@78
|
1163 if not source_list[source_guid] then
|
jcallahan@77
|
1164 encounter_data.loot_counts = encounter_data.loot_counts or {}
|
jcallahan@77
|
1165 encounter_data.loot_counts[loot_type] = (encounter_data.loot_counts[loot_type] or 0) + 1
|
jcallahan@77
|
1166 source_list[source_id] = true
|
jcallahan@77
|
1167 end
|
jcallahan@77
|
1168
|
jcallahan@75
|
1169 for item_id, quantity in pairs(loot_data) do
|
jcallahan@75
|
1170 table.insert(encounter_data[loot_type], ("%d:%d"):format(item_id, quantity))
|
jcallahan@75
|
1171 end
|
jcallahan@75
|
1172 end
|
jcallahan@75
|
1173 end
|
jcallahan@75
|
1174
|
jcallahan@75
|
1175 -- TODO: Remove this when GetLootSourceInfo() has values for money
|
jcallahan@131
|
1176 if #current_loot.list <= 0 then
|
jcallahan@79
|
1177 return
|
jcallahan@79
|
1178 end
|
jcallahan@131
|
1179 local npc = NPCEntry(current_loot.identifier)
|
jcallahan@28
|
1180
|
jcallahan@28
|
1181 if not npc then
|
jcallahan@28
|
1182 return
|
jcallahan@28
|
1183 end
|
jcallahan@75
|
1184 local encounter_data = npc.encounter_data[difficulty_token]
|
jcallahan@29
|
1185 encounter_data[loot_type] = encounter_data[loot_type] or {}
|
jcallahan@16
|
1186
|
jcallahan@131
|
1187 if not source_list[current_loot.identifier] then
|
jcallahan@77
|
1188 encounter_data.loot_counts = encounter_data.loot_counts or {}
|
jcallahan@77
|
1189 encounter_data.loot_counts[loot_type] = (encounter_data.loot_counts[loot_type] or 0) + 1
|
jcallahan@77
|
1190 end
|
jcallahan@77
|
1191
|
jcallahan@131
|
1192 for index = 1, #current_loot.list do
|
jcallahan@131
|
1193 table.insert(encounter_data[loot_type], current_loot.list[index])
|
jcallahan@16
|
1194 end
|
jcallahan@16
|
1195 end,
|
jcallahan@13
|
1196 [AF.OBJECT] = function()
|
jcallahan@28
|
1197 GenericLootUpdate("objects", InstanceDifficultyToken())
|
jcallahan@17
|
1198 end,
|
jcallahan@17
|
1199 [AF.ZONE] = function()
|
jcallahan@141
|
1200 local location_token = ("%d:%d:%d"):format(current_loot.map_level, current_loot.x, current_loot.y)
|
jcallahan@41
|
1201
|
jcallahan@41
|
1202 -- This will start life as a boolean true.
|
jcallahan@131
|
1203 if _G.type(current_loot.zone_data[location_token]) ~= "table" then
|
jcallahan@131
|
1204 current_loot.zone_data[location_token] = {
|
jcallahan@41
|
1205 drops = {}
|
jcallahan@41
|
1206 }
|
jcallahan@41
|
1207 end
|
jcallahan@132
|
1208 local loot_count = ("%s_count"):format(current_loot.label)
|
jcallahan@131
|
1209 current_loot.zone_data[location_token][loot_count] = (current_loot.zone_data[location_token][loot_count] or 0) + 1
|
jcallahan@41
|
1210
|
jcallahan@131
|
1211 if current_loot.sources then
|
jcallahan@131
|
1212 for source_guid, loot_data in pairs(current_loot.sources) do
|
jcallahan@131
|
1213 for item_id, quantity in pairs(loot_data) do
|
jcallahan@131
|
1214 table.insert(current_loot.zone_data[location_token].drops, ("%d:%d"):format(item_id, quantity))
|
jcallahan@131
|
1215 end
|
jcallahan@131
|
1216 end
|
jcallahan@131
|
1217 end
|
jcallahan@131
|
1218
|
jcallahan@131
|
1219 if #current_loot.list <= 0 then
|
jcallahan@131
|
1220 return
|
jcallahan@131
|
1221 end
|
jcallahan@131
|
1222
|
jcallahan@131
|
1223 for index = 1, #current_loot.list do
|
jcallahan@131
|
1224 table.insert(current_loot.zone_data[location_token].drops, current_loot.loot_list[index])
|
jcallahan@41
|
1225 end
|
jcallahan@13
|
1226 end,
|
jcallahan@13
|
1227 }
|
jcallahan@13
|
1228
|
jcallahan@79
|
1229 -- Prevent opening the same loot window multiple times from recording data multiple times.
|
jcallahan@79
|
1230 local loot_guid_registry = {}
|
jcallahan@124
|
1231
|
jcallahan@124
|
1232
|
jcallahan@124
|
1233 function WDP:LOOT_CLOSED(event_name)
|
jcallahan@131
|
1234 current_loot = nil
|
jcallahan@131
|
1235 table.wipe(current_action)
|
jcallahan@124
|
1236 end
|
jcallahan@124
|
1237
|
jcallahan@13
|
1238
|
jcallahan@92
|
1239 function WDP:LOOT_OPENED(event_name)
|
jcallahan@132
|
1240 if current_loot then
|
jcallahan@18
|
1241 return
|
jcallahan@18
|
1242 end
|
jcallahan@132
|
1243 current_action.target_type = current_action.target_type or AF.NPC
|
jcallahan@132
|
1244
|
jcallahan@123
|
1245 local verify_func = LOOT_VERIFY_FUNCS[current_action.target_type]
|
jcallahan@123
|
1246 local update_func = LOOT_UPDATE_FUNCS[current_action.target_type]
|
jcallahan@13
|
1247
|
jcallahan@14
|
1248 if not verify_func or not update_func then
|
jcallahan@13
|
1249 return
|
jcallahan@13
|
1250 end
|
jcallahan@13
|
1251
|
jcallahan@14
|
1252 if _G.type(verify_func) == "function" and not verify_func() then
|
jcallahan@14
|
1253 return
|
jcallahan@14
|
1254 end
|
jcallahan@80
|
1255 local guids_used = {}
|
jcallahan@132
|
1256
|
jcallahan@131
|
1257 current_loot = {
|
jcallahan@131
|
1258 list = {},
|
jcallahan@131
|
1259 sources = {},
|
jcallahan@131
|
1260 identifier = current_action.identifier,
|
jcallahan@132
|
1261 label = current_action.loot_label or "drops",
|
jcallahan@131
|
1262 map_level = current_action.map_level,
|
jcallahan@131
|
1263 object_name = current_action.object_name,
|
jcallahan@131
|
1264 spell_label = current_action.spell_label,
|
jcallahan@131
|
1265 target_type = current_action.target_type,
|
jcallahan@131
|
1266 x = current_action.x,
|
jcallahan@131
|
1267 y = current_action.y,
|
jcallahan@131
|
1268 zone_data = current_action.zone_data,
|
jcallahan@131
|
1269 }
|
jcallahan@131
|
1270 table.wipe(current_action)
|
jcallahan@13
|
1271
|
jcallahan@55
|
1272 for loot_slot = 1, _G.GetNumLootItems() do
|
jcallahan@55
|
1273 local icon_texture, item_text, quantity, quality, locked = _G.GetLootSlotInfo(loot_slot)
|
jcallahan@55
|
1274 local slot_type = _G.GetLootSlotType(loot_slot)
|
jcallahan@13
|
1275
|
jcallahan@77
|
1276 -- TODO: Move LOOT_SLOT_X checks within loop when money is detectable via GetLootSourceInfo
|
jcallahan@77
|
1277 if slot_type == _G.LOOT_SLOT_ITEM then
|
jcallahan@78
|
1278 local loot_info = {
|
jcallahan@77
|
1279 _G.GetLootSourceInfo(loot_slot)
|
jcallahan@77
|
1280 }
|
jcallahan@75
|
1281
|
jcallahan@77
|
1282 -- Odd index is GUID, even is count.
|
jcallahan@78
|
1283 for loot_index = 1, #loot_info, 2 do
|
jcallahan@78
|
1284 local source_guid = loot_info[loot_index]
|
jcallahan@77
|
1285
|
jcallahan@79
|
1286 if not loot_guid_registry[source_guid] then
|
jcallahan@79
|
1287 local loot_quantity = loot_info[loot_index + 1]
|
jcallahan@79
|
1288 local source_type, source_id = ParseGUID(source_guid)
|
jcallahan@79
|
1289 -- TODO: Remove debugging
|
jcallahan@133
|
1290 -- local source_key = ("%s:%d"):format(private.UNIT_TYPE_NAMES[source_type + 1], source_id)
|
jcallahan@133
|
1291 -- print(("GUID: %s - Type:ID: %s - Amount: %d"):format(loot_info[loot_index], source_key, loot_quantity))
|
jcallahan@79
|
1292
|
jcallahan@79
|
1293 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot))
|
jcallahan@131
|
1294 current_loot.sources[source_guid] = current_loot.sources[source_guid] or {}
|
jcallahan@131
|
1295 current_loot.sources[source_guid][item_id] = current_loot.sources[source_guid][item_id] or 0 + loot_quantity
|
jcallahan@80
|
1296 guids_used[source_guid] = true
|
jcallahan@79
|
1297 end
|
jcallahan@75
|
1298 end
|
jcallahan@82
|
1299 -- elseif slot_type == _G.LOOT_SLOT_MONEY then
|
jcallahan@122
|
1300 -- table.insert(current_action.loot_list, ("money:%d"):format(_toCopper(item_text)))
|
jcallahan@77
|
1301 elseif slot_type == _G.LOOT_SLOT_CURRENCY then
|
jcallahan@131
|
1302 table.insert(current_loot.list, ("currency:%d:%s"):format(quantity, icon_texture:match("[^\\]+$"):lower()))
|
jcallahan@13
|
1303 end
|
jcallahan@13
|
1304 end
|
jcallahan@80
|
1305
|
jcallahan@81
|
1306 for guid in pairs(guids_used) do
|
jcallahan@80
|
1307 loot_guid_registry[guid] = true
|
jcallahan@80
|
1308 end
|
jcallahan@13
|
1309 update_func()
|
jcallahan@1
|
1310 end
|
jcallahan@13
|
1311 end -- do-block
|
jcallahan@0
|
1312
|
jcallahan@0
|
1313
|
jcallahan@89
|
1314 function WDP:MAIL_SHOW(event_name)
|
jcallahan@89
|
1315 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("npc"))
|
jcallahan@89
|
1316
|
jcallahan@89
|
1317 if not unit_idnum or unit_type ~= private.UNIT_TYPES.OBJECT then
|
jcallahan@89
|
1318 return
|
jcallahan@89
|
1319 end
|
jcallahan@89
|
1320 UpdateDBEntryLocation("objects", unit_idnum)
|
jcallahan@89
|
1321 end
|
jcallahan@89
|
1322
|
jcallahan@89
|
1323
|
jcallahan@44
|
1324 do
|
jcallahan@44
|
1325 local POINT_MATCH_PATTERNS = {
|
jcallahan@44
|
1326 ("^%s$"):format(_G.ITEM_REQ_ARENA_RATING:gsub("%%d", "(%%d+)")), -- May no longer be necessary
|
jcallahan@44
|
1327 ("^%s$"):format(_G.ITEM_REQ_ARENA_RATING_3V3:gsub("%%d", "(%%d+)")), -- May no longer be necessary
|
jcallahan@44
|
1328 ("^%s$"):format(_G.ITEM_REQ_ARENA_RATING_5V5:gsub("%%d", "(%%d+)")), -- May no longer be necessary
|
jcallahan@44
|
1329 ("^%s$"):format(_G.ITEM_REQ_ARENA_RATING_BG:gsub("%%d", "(%%d+)")),
|
jcallahan@44
|
1330 ("^%s$"):format(_G.ITEM_REQ_ARENA_RATING_3V3_BG:gsub("%%d", "(%%d+)")),
|
jcallahan@44
|
1331 }
|
jcallahan@5
|
1332
|
jcallahan@68
|
1333 local ITEM_REQ_REPUTATION_MATCH = "Requires (.-) %- (.*)"
|
jcallahan@87
|
1334 local ITEM_REQ_QUEST_MATCH1 = "Requires: .*"
|
jcallahan@87
|
1335 local ITEM_REQ_QUEST_MATCH2 = "Must have completed: .*"
|
jcallahan@68
|
1336
|
jcallahan@133
|
1337 local current_merchant
|
jcallahan@133
|
1338 local merchant_standing
|
jcallahan@133
|
1339
|
jcallahan@133
|
1340 function WDP:MERCHANT_CLOSED(event_name)
|
jcallahan@133
|
1341 current_merchant = nil
|
jcallahan@133
|
1342 merchant_standing = nil
|
jcallahan@133
|
1343 end
|
jcallahan@133
|
1344
|
jcallahan@133
|
1345
|
jcallahan@89
|
1346 function WDP:UpdateMerchantItems(event_name)
|
jcallahan@133
|
1347 if not current_merchant then
|
jcallahan@133
|
1348 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target"))
|
jcallahan@4
|
1349
|
jcallahan@133
|
1350 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then
|
jcallahan@133
|
1351 return
|
jcallahan@133
|
1352 end
|
jcallahan@133
|
1353 merchant_standing = select(2, UnitFactionStanding("target"))
|
jcallahan@133
|
1354 current_merchant = NPCEntry(unit_idnum)
|
jcallahan@133
|
1355 current_merchant.sells = current_merchant.sells or {}
|
jcallahan@44
|
1356 end
|
jcallahan@133
|
1357 local num_items = _G.GetMerchantNumItems()
|
jcallahan@55
|
1358 local current_filters = _G.GetMerchantFilter()
|
jcallahan@57
|
1359 _G.SetMerchantFilter(_G.LE_LOOT_FILTER_ALL)
|
jcallahan@57
|
1360 _G.MerchantFrame_Update()
|
jcallahan@57
|
1361
|
jcallahan@44
|
1362 for item_index = 1, num_items do
|
jcallahan@44
|
1363 local _, _, copper_price, stack_size, num_available, _, extended_cost = _G.GetMerchantItemInfo(item_index)
|
jcallahan@44
|
1364 local item_id = ItemLinkToID(_G.GetMerchantItemLink(item_index))
|
jcallahan@5
|
1365
|
jcallahan@44
|
1366 if item_id and item_id > 0 then
|
jcallahan@44
|
1367 local price_string = ActualCopperCost(copper_price, merchant_standing)
|
jcallahan@5
|
1368
|
jcallahan@68
|
1369 DatamineTT:ClearLines()
|
jcallahan@68
|
1370 DatamineTT:SetMerchantItem(item_index)
|
jcallahan@68
|
1371
|
jcallahan@68
|
1372 local num_lines = DatamineTT:NumLines()
|
jcallahan@68
|
1373
|
jcallahan@68
|
1374 for line_index = 1, num_lines do
|
jcallahan@68
|
1375 local current_line = _G["WDPDatamineTTTextLeft" .. line_index]
|
jcallahan@68
|
1376
|
jcallahan@68
|
1377 if not current_line then
|
jcallahan@68
|
1378 break
|
jcallahan@68
|
1379 end
|
jcallahan@68
|
1380 local faction, reputation = current_line:GetText():match(ITEM_REQ_REPUTATION_MATCH)
|
jcallahan@68
|
1381
|
jcallahan@68
|
1382 if faction or reputation then
|
jcallahan@68
|
1383 DBEntry("items", item_id).req_reputation = ("%s:%s"):format(faction:gsub("-", ""), reputation:upper())
|
jcallahan@68
|
1384 break
|
jcallahan@68
|
1385 end
|
jcallahan@68
|
1386 end
|
jcallahan@68
|
1387
|
jcallahan@87
|
1388 for line_index = 1, num_lines do
|
jcallahan@87
|
1389 local current_line = _G["WDPDatamineTTTextLeft" .. line_index]
|
jcallahan@87
|
1390
|
jcallahan@87
|
1391 if not current_line then
|
jcallahan@87
|
1392 break
|
jcallahan@87
|
1393 end
|
jcallahan@87
|
1394 local line_text = current_line:GetText()
|
jcallahan@87
|
1395 local quest_name = line_text:match(ITEM_REQ_QUEST_MATCH1) or line_text:match(ITEM_REQ_QUEST_MATCH2)
|
jcallahan@87
|
1396
|
jcallahan@87
|
1397 if quest_name then
|
jcallahan@87
|
1398 DBEntry("items", item_id).req_quest = ("%s"):format(quest_name:gsub("(.+): ", ""), quest_name)
|
jcallahan@87
|
1399 break
|
jcallahan@87
|
1400 end
|
jcallahan@87
|
1401 end
|
jcallahan@87
|
1402
|
jcallahan@44
|
1403 if extended_cost then
|
jcallahan@53
|
1404 local battleground_rating = 0
|
jcallahan@53
|
1405 local personal_rating = 0
|
jcallahan@53
|
1406 local required_season_amount
|
jcallahan@5
|
1407
|
jcallahan@68
|
1408 for line_index = 1, num_lines do
|
jcallahan@44
|
1409 local current_line = _G["WDPDatamineTTTextLeft" .. line_index]
|
jcallahan@5
|
1410
|
jcallahan@44
|
1411 if not current_line then
|
jcallahan@44
|
1412 break
|
jcallahan@44
|
1413 end
|
jcallahan@53
|
1414 required_season_amount = current_line:GetText():match("Requires earning a total of (%d+)\n(.-) for the season.")
|
jcallahan@5
|
1415
|
jcallahan@44
|
1416 for match_index = 1, #POINT_MATCH_PATTERNS do
|
jcallahan@44
|
1417 local match1, match2 = current_line:GetText():match(POINT_MATCH_PATTERNS[match_index])
|
jcallahan@53
|
1418 personal_rating = personal_rating + (match1 or 0)
|
jcallahan@53
|
1419 battleground_rating = battleground_rating + (match2 or 0)
|
jcallahan@5
|
1420
|
jcallahan@44
|
1421 if match1 or match2 then
|
jcallahan@44
|
1422 break
|
jcallahan@44
|
1423 end
|
jcallahan@44
|
1424 end
|
jcallahan@5
|
1425 end
|
jcallahan@44
|
1426 local currency_list = {}
|
jcallahan@44
|
1427 local item_count = _G.GetMerchantItemCostInfo(item_index)
|
jcallahan@50
|
1428
|
jcallahan@50
|
1429 -- Keeping this around in case Blizzard makes the two points diverge at some point.
|
jcallahan@53
|
1430 -- price_string = ("%s:%s:%s:%s"):format(price_string, battleground_rating, personal_rating, required_season_amount or 0)
|
jcallahan@53
|
1431 price_string = ("%s:%s:%s"):format(price_string, personal_rating, required_season_amount or 0)
|
jcallahan@5
|
1432
|
jcallahan@44
|
1433 for cost_index = 1, item_count do
|
jcallahan@44
|
1434 local icon_texture, amount_required, currency_link = _G.GetMerchantItemCostItem(item_index, cost_index)
|
jcallahan@44
|
1435 local currency_id = currency_link and ItemLinkToID(currency_link) or nil
|
jcallahan@44
|
1436
|
jcallahan@44
|
1437 if (not currency_id or currency_id < 1) and icon_texture then
|
jcallahan@44
|
1438 currency_id = icon_texture:match("[^\\]+$"):lower()
|
jcallahan@44
|
1439 end
|
jcallahan@44
|
1440
|
jcallahan@44
|
1441 if currency_id then
|
jcallahan@44
|
1442 currency_list[#currency_list + 1] = ("(%s:%s)"):format(amount_required, currency_id)
|
jcallahan@44
|
1443 end
|
jcallahan@44
|
1444 end
|
jcallahan@44
|
1445
|
jcallahan@44
|
1446 for currency_index = 1, #currency_list do
|
jcallahan@44
|
1447 price_string = ("%s:%s"):format(price_string, currency_list[currency_index])
|
jcallahan@5
|
1448 end
|
jcallahan@5
|
1449 end
|
jcallahan@133
|
1450 current_merchant.sells[item_id] = ("%s:%s:[%s]"):format(num_available, stack_size, price_string)
|
jcallahan@44
|
1451 end
|
jcallahan@44
|
1452 end
|
jcallahan@5
|
1453
|
jcallahan@44
|
1454 if _G.CanMerchantRepair() then
|
jcallahan@133
|
1455 current_merchant.can_repair = true
|
jcallahan@5
|
1456 end
|
jcallahan@57
|
1457 _G.SetMerchantFilter(current_filters)
|
jcallahan@57
|
1458 _G.MerchantFrame_Update()
|
jcallahan@4
|
1459 end
|
jcallahan@44
|
1460 end -- do-block
|
jcallahan@4
|
1461
|
jcallahan@89
|
1462
|
jcallahan@92
|
1463 function WDP:PET_BAR_UPDATE(event_name)
|
jcallahan@122
|
1464 if current_action.spell_label ~= "MIND_CONTROL" then
|
jcallahan@25
|
1465 return
|
jcallahan@25
|
1466 end
|
jcallahan@34
|
1467 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("pet"))
|
jcallahan@25
|
1468
|
jcallahan@25
|
1469 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then
|
jcallahan@25
|
1470 return
|
jcallahan@25
|
1471 end
|
jcallahan@29
|
1472 NPCEntry(unit_idnum).mind_control = true
|
jcallahan@122
|
1473 table.wipe(current_action)
|
jcallahan@25
|
1474 end
|
jcallahan@25
|
1475
|
jcallahan@25
|
1476
|
jcallahan@115
|
1477 function WDP:PET_JOURNAL_LIST_UPDATE(event_name)
|
jcallahan@115
|
1478 local num_pets = LPJ:NumPets()
|
jcallahan@115
|
1479
|
jcallahan@115
|
1480 for index, pet_id in LPJ:IteratePetIDs() do
|
jcallahan@115
|
1481 local _, _, is_owned, _, level, _, _, name, icon, pet_type, npc_id, _, _, is_wild = _G.C_PetJournal.GetPetInfoByIndex(index)
|
jcallahan@115
|
1482
|
jcallahan@115
|
1483 if is_owned then
|
jcallahan@115
|
1484 local health, max_health, attack, speed, rarity = _G.C_PetJournal.GetPetStats(pet_id)
|
jcallahan@115
|
1485
|
jcallahan@139
|
1486 if rarity then
|
jcallahan@139
|
1487 local rarity_name = _G["BATTLE_PET_BREED_QUALITY" .. rarity]
|
jcallahan@139
|
1488 local npc = NPCEntry(npc_id)
|
jcallahan@139
|
1489 npc.wild_pet = is_wild or nil
|
jcallahan@139
|
1490 npc.battle_pet_data = npc.battle_pet_data or {}
|
jcallahan@139
|
1491 npc.battle_pet_data[rarity_name] = npc.battle_pet_data[rarity_name] or {}
|
jcallahan@139
|
1492 npc.battle_pet_data[rarity_name]["level_" .. level] = npc.battle_pet_data[rarity_name]["level_" .. level] or {}
|
jcallahan@139
|
1493
|
jcallahan@139
|
1494 local data = npc.battle_pet_data[rarity_name]["level_" .. level]
|
jcallahan@139
|
1495 data.max_health = max_health
|
jcallahan@139
|
1496 data.attack = attack
|
jcallahan@139
|
1497 data.speed = speed
|
jcallahan@139
|
1498 end
|
jcallahan@115
|
1499 end
|
jcallahan@115
|
1500 end
|
jcallahan@115
|
1501 end
|
jcallahan@115
|
1502
|
jcallahan@115
|
1503
|
jcallahan@118
|
1504 function WDP:PLAYER_TARGET_CHANGED(event_name)
|
jcallahan@118
|
1505 if not PlayerTarget() then
|
jcallahan@118
|
1506 return
|
jcallahan@2
|
1507 end
|
jcallahan@118
|
1508 self:UpdateTargetLocation()
|
jcallahan@118
|
1509 end
|
jcallahan@2
|
1510
|
jcallahan@89
|
1511
|
jcallahan@12
|
1512 do
|
jcallahan@12
|
1513 local function UpdateQuestJuncture(point)
|
jcallahan@12
|
1514 local unit_name = _G.UnitName("questnpc")
|
jcallahan@9
|
1515
|
jcallahan@12
|
1516 if not unit_name then
|
jcallahan@12
|
1517 return
|
jcallahan@12
|
1518 end
|
jcallahan@34
|
1519 local unit_type, unit_id = ParseGUID(_G.UnitGUID("questnpc"))
|
jcallahan@9
|
1520
|
jcallahan@12
|
1521 if unit_type == private.UNIT_TYPES.OBJECT then
|
jcallahan@38
|
1522 UpdateDBEntryLocation("objects", unit_id)
|
jcallahan@12
|
1523 end
|
jcallahan@19
|
1524 local quest = DBEntry("quests", _G.GetQuestID())
|
jcallahan@12
|
1525 quest[point] = quest[point] or {}
|
jcallahan@12
|
1526 quest[point][("%s:%d"):format(private.UNIT_TYPE_NAMES[unit_type + 1], unit_id)] = true
|
jcallahan@24
|
1527
|
jcallahan@24
|
1528 return quest
|
jcallahan@12
|
1529 end
|
jcallahan@10
|
1530
|
jcallahan@12
|
1531
|
jcallahan@92
|
1532 function WDP:QUEST_COMPLETE(event_name)
|
jcallahan@97
|
1533 local quest = UpdateQuestJuncture("end")
|
jcallahan@97
|
1534
|
jcallahan@112
|
1535 if ALLOWED_LOCALES[CLIENT_LOCALE] then
|
jcallahan@112
|
1536 quest.reward_text = ReplaceKeywords(_G.GetRewardText())
|
jcallahan@112
|
1537 end
|
jcallahan@67
|
1538 -- Make sure the quest NPC isn't erroneously recorded as giving reputation for quests which award it.
|
jcallahan@67
|
1539 reputation_npc_id = nil
|
jcallahan@10
|
1540 end
|
jcallahan@10
|
1541
|
jcallahan@12
|
1542
|
jcallahan@92
|
1543 function WDP:QUEST_DETAIL(event_name)
|
jcallahan@24
|
1544 local quest = UpdateQuestJuncture("begin")
|
jcallahan@24
|
1545
|
jcallahan@46
|
1546 if not quest then
|
jcallahan@46
|
1547 return
|
jcallahan@46
|
1548 end
|
jcallahan@24
|
1549 quest.classes = quest.classes or {}
|
jcallahan@27
|
1550 quest.classes[PLAYER_CLASS] = true
|
jcallahan@24
|
1551
|
jcallahan@24
|
1552 quest.races = quest.races or {}
|
jcallahan@100
|
1553 quest.races[(PLAYER_RACE == "Pandaren") and ("%s_%s"):format(PLAYER_RACE, PLAYER_FACTION or "Neutral") or PLAYER_RACE] = true
|
jcallahan@10
|
1554 end
|
jcallahan@12
|
1555 end -- do-block
|
jcallahan@9
|
1556
|
jcallahan@9
|
1557
|
jcallahan@92
|
1558 function WDP:QUEST_LOG_UPDATE(event_name)
|
jcallahan@38
|
1559 local selected_quest = _G.GetQuestLogSelection() -- Save current selection to be restored when we're done.
|
jcallahan@36
|
1560 local entry_index, processed_quests = 1, 0
|
jcallahan@36
|
1561 local _, num_quests = _G.GetNumQuestLogEntries()
|
jcallahan@36
|
1562
|
jcallahan@36
|
1563 while processed_quests <= num_quests do
|
jcallahan@36
|
1564 local _, _, _, _, is_header, _, _, _, quest_id = _G.GetQuestLogTitle(entry_index)
|
jcallahan@36
|
1565
|
jcallahan@84
|
1566 if quest_id == 0 then
|
jcallahan@84
|
1567 processed_quests = processed_quests + 1
|
jcallahan@84
|
1568 elseif not is_header then
|
jcallahan@36
|
1569 _G.SelectQuestLogEntry(entry_index);
|
jcallahan@36
|
1570
|
jcallahan@36
|
1571 local quest = DBEntry("quests", quest_id)
|
jcallahan@36
|
1572 quest.timer = _G.GetQuestLogTimeLeft()
|
jcallahan@37
|
1573 quest.can_share = _G.GetQuestLogPushable() and true or nil
|
jcallahan@36
|
1574 processed_quests = processed_quests + 1
|
jcallahan@36
|
1575 end
|
jcallahan@36
|
1576 entry_index = entry_index + 1
|
jcallahan@36
|
1577 end
|
jcallahan@36
|
1578 _G.SelectQuestLogEntry(selected_quest)
|
jcallahan@4
|
1579 self:UnregisterEvent("QUEST_LOG_UPDATE")
|
jcallahan@4
|
1580 end
|
jcallahan@4
|
1581
|
jcallahan@4
|
1582
|
jcallahan@97
|
1583 function WDP:QUEST_PROGRESS(event_name)
|
jcallahan@112
|
1584 if not ALLOWED_LOCALES[CLIENT_LOCALE] then
|
jcallahan@112
|
1585 return
|
jcallahan@112
|
1586 end
|
jcallahan@97
|
1587 DBEntry("quests", _G.GetQuestID()).progress_text = ReplaceKeywords(_G.GetProgressText())
|
jcallahan@97
|
1588 end
|
jcallahan@97
|
1589
|
jcallahan@97
|
1590
|
jcallahan@92
|
1591 function WDP:UNIT_QUEST_LOG_CHANGED(event_name, unit_id)
|
jcallahan@4
|
1592 if unit_id ~= "player" then
|
jcallahan@4
|
1593 return
|
jcallahan@4
|
1594 end
|
jcallahan@4
|
1595 self:RegisterEvent("QUEST_LOG_UPDATE")
|
jcallahan@4
|
1596 end
|
jcallahan@4
|
1597
|
jcallahan@4
|
1598
|
jcallahan@92
|
1599 do
|
jcallahan@92
|
1600 local TRADESKILL_TOOLS = {
|
jcallahan@92
|
1601 Anvil = anvil_spell_ids,
|
jcallahan@92
|
1602 Forge = forge_spell_ids,
|
jcallahan@92
|
1603 }
|
jcallahan@92
|
1604
|
jcallahan@92
|
1605
|
jcallahan@92
|
1606 function WDP:TRADE_SKILL_SHOW(event_name)
|
jcallahan@92
|
1607 local profession_name, prof_level = _G.GetTradeSkillLine()
|
jcallahan@92
|
1608
|
jcallahan@92
|
1609 if profession_name == _G.UNKNOWN then
|
jcallahan@92
|
1610 return
|
jcallahan@92
|
1611 end
|
jcallahan@92
|
1612
|
jcallahan@92
|
1613 if _G.TradeSkillFrame and _G.TradeSkillFrame:IsVisible() then
|
jcallahan@92
|
1614 -- Clear the search box focus so the scan will have correct results.
|
jcallahan@92
|
1615 local search_box = _G.TradeSkillFrameSearchBox
|
jcallahan@92
|
1616 search_box:SetText("")
|
jcallahan@92
|
1617 _G.TradeSkillSearch_OnTextChanged(search_box)
|
jcallahan@92
|
1618 search_box:ClearFocus()
|
jcallahan@92
|
1619 search_box:GetScript("OnEditFocusLost")(search_box)
|
jcallahan@92
|
1620 end
|
jcallahan@92
|
1621 local header_list = {}
|
jcallahan@92
|
1622
|
jcallahan@92
|
1623 -- Save the current state of the TradeSkillFrame so it can be restored after we muck with it.
|
jcallahan@92
|
1624 local have_materials = _G.TradeSkillFrame.filterTbl.hasMaterials
|
jcallahan@92
|
1625 local have_skillup = _G.TradeSkillFrame.filterTbl.hasSkillUp
|
jcallahan@92
|
1626
|
jcallahan@92
|
1627 if have_materials then
|
jcallahan@92
|
1628 _G.TradeSkillFrame.filterTbl.hasMaterials = false
|
jcallahan@92
|
1629 _G.TradeSkillOnlyShowMakeable(false)
|
jcallahan@92
|
1630 end
|
jcallahan@92
|
1631
|
jcallahan@92
|
1632 if have_skillup then
|
jcallahan@92
|
1633 _G.TradeSkillFrame.filterTbl.hasSkillUp = false
|
jcallahan@92
|
1634 _G.TradeSkillOnlyShowSkillUps(false)
|
jcallahan@92
|
1635 end
|
jcallahan@92
|
1636 _G.SetTradeSkillInvSlotFilter(0, 1, 1)
|
jcallahan@92
|
1637 _G.TradeSkillUpdateFilterBar()
|
jcallahan@92
|
1638 _G.TradeSkillFrame_Update()
|
jcallahan@92
|
1639
|
jcallahan@92
|
1640 -- Expand all headers so we can see all the recipes there are
|
jcallahan@92
|
1641 for tradeskill_index = 1, _G.GetNumTradeSkills() do
|
jcallahan@92
|
1642 local name, tradeskill_type, _, is_expanded = _G.GetTradeSkillInfo(tradeskill_index)
|
jcallahan@92
|
1643
|
jcallahan@94
|
1644 if tradeskill_type == "header" or tradeskill_type == "subheader" then
|
jcallahan@92
|
1645 if not is_expanded then
|
jcallahan@92
|
1646 header_list[name] = true
|
jcallahan@92
|
1647 _G.ExpandTradeSkillSubClass(tradeskill_index)
|
jcallahan@92
|
1648 end
|
jcallahan@92
|
1649 else
|
jcallahan@92
|
1650 local spell_id = tonumber(_G.GetTradeSkillRecipeLink(tradeskill_index):match("^|c%x%x%x%x%x%x%x%x|H%w+:(%d+)"))
|
jcallahan@92
|
1651 local required_tool = _G.GetTradeSkillTools(tradeskill_index)
|
jcallahan@92
|
1652
|
jcallahan@92
|
1653 if required_tool then
|
jcallahan@92
|
1654 for tool_name, registry in pairs(TRADESKILL_TOOLS) do
|
jcallahan@92
|
1655 if required_tool:find(tool_name) then
|
jcallahan@92
|
1656 registry[spell_id] = true
|
jcallahan@92
|
1657 end
|
jcallahan@92
|
1658 end
|
jcallahan@92
|
1659 end
|
jcallahan@92
|
1660 end
|
jcallahan@92
|
1661 end
|
jcallahan@92
|
1662
|
jcallahan@92
|
1663 -- Restore the state of the things we changed.
|
jcallahan@92
|
1664 for tradeskill_index = 1, _G.GetNumTradeSkills() do
|
jcallahan@92
|
1665 local name, tradeskill_type, _, is_expanded = _G.GetTradeSkillInfo(tradeskill_index)
|
jcallahan@92
|
1666
|
jcallahan@92
|
1667 if header_list[name] then
|
jcallahan@92
|
1668 _G.CollapseTradeSkillSubClass(tradeskill_index)
|
jcallahan@92
|
1669 end
|
jcallahan@92
|
1670 end
|
jcallahan@92
|
1671 _G.TradeSkillFrame.filterTbl.hasMaterials = have_materials
|
jcallahan@92
|
1672 _G.TradeSkillOnlyShowMakeable(have_materials)
|
jcallahan@92
|
1673 _G.TradeSkillFrame.filterTbl.hasSkillUp = have_skillup
|
jcallahan@92
|
1674 _G.TradeSkillOnlyShowSkillUps(have_skillup)
|
jcallahan@92
|
1675
|
jcallahan@92
|
1676 _G.TradeSkillUpdateFilterBar()
|
jcallahan@92
|
1677 _G.TradeSkillFrame_Update()
|
jcallahan@92
|
1678 end
|
jcallahan@92
|
1679 end -- do-block
|
jcallahan@92
|
1680
|
jcallahan@92
|
1681
|
jcallahan@92
|
1682 function WDP:TRAINER_SHOW(event_name)
|
jcallahan@34
|
1683 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target"))
|
jcallahan@29
|
1684 local npc = NPCEntry(unit_idnum)
|
jcallahan@58
|
1685
|
jcallahan@58
|
1686 if not npc then
|
jcallahan@58
|
1687 return
|
jcallahan@58
|
1688 end
|
jcallahan@27
|
1689 npc.teaches = npc.teaches or {}
|
jcallahan@27
|
1690
|
jcallahan@27
|
1691 -- Get the initial trainer filters
|
jcallahan@27
|
1692 local available = _G.GetTrainerServiceTypeFilter("available")
|
jcallahan@27
|
1693 local unavailable = _G.GetTrainerServiceTypeFilter("unavailable")
|
jcallahan@27
|
1694 local used = _G.GetTrainerServiceTypeFilter("used")
|
jcallahan@27
|
1695
|
jcallahan@27
|
1696 -- Clear the trainer filters
|
jcallahan@27
|
1697 _G.SetTrainerServiceTypeFilter("available", 1)
|
jcallahan@27
|
1698 _G.SetTrainerServiceTypeFilter("unavailable", 1)
|
jcallahan@27
|
1699 _G.SetTrainerServiceTypeFilter("used", 1)
|
jcallahan@27
|
1700
|
jcallahan@27
|
1701 for index = 1, _G.GetNumTrainerServices(), 1 do
|
jcallahan@27
|
1702 local spell_name, rank_name, _, _, required_level = _G.GetTrainerServiceInfo(index)
|
jcallahan@27
|
1703
|
jcallahan@27
|
1704 if spell_name then
|
jcallahan@27
|
1705 DatamineTT:ClearLines()
|
jcallahan@27
|
1706 DatamineTT:SetTrainerService(index)
|
jcallahan@27
|
1707
|
jcallahan@27
|
1708 local _, _, spell_id = DatamineTT:GetSpell()
|
jcallahan@27
|
1709
|
jcallahan@43
|
1710 if spell_id then
|
jcallahan@43
|
1711 local profession, min_skill = _G.GetTrainerServiceSkillReq(index)
|
jcallahan@43
|
1712 profession = profession or "General"
|
jcallahan@43
|
1713
|
jcallahan@43
|
1714 local class_professions = npc.teaches[PLAYER_CLASS]
|
jcallahan@43
|
1715 if not class_professions then
|
jcallahan@43
|
1716 npc.teaches[PLAYER_CLASS] = {}
|
jcallahan@43
|
1717 class_professions = npc.teaches[PLAYER_CLASS]
|
jcallahan@43
|
1718 end
|
jcallahan@43
|
1719
|
jcallahan@43
|
1720 local profession_skills = class_professions[profession]
|
jcallahan@43
|
1721 if not profession_skills then
|
jcallahan@43
|
1722 class_professions[profession] = {}
|
jcallahan@43
|
1723 profession_skills = class_professions[profession]
|
jcallahan@43
|
1724 end
|
jcallahan@43
|
1725 profession_skills[spell_id] = ("%d:%d"):format(required_level, min_skill)
|
jcallahan@27
|
1726 end
|
jcallahan@27
|
1727 end
|
jcallahan@27
|
1728 end
|
jcallahan@27
|
1729 -- Reset the filters to what they were before
|
jcallahan@27
|
1730 _G.SetTrainerServiceTypeFilter("available", available or 0)
|
jcallahan@27
|
1731 _G.SetTrainerServiceTypeFilter("unavailable", unavailable or 0)
|
jcallahan@27
|
1732 _G.SetTrainerServiceTypeFilter("used", used or 0)
|
jcallahan@27
|
1733 end
|
jcallahan@27
|
1734
|
jcallahan@27
|
1735
|
jcallahan@1
|
1736 function WDP:UNIT_SPELLCAST_SENT(event_name, unit_id, spell_name, spell_rank, target_name, spell_line)
|
jcallahan@1
|
1737 if private.tracked_line or unit_id ~= "player" then
|
jcallahan@1
|
1738 return
|
jcallahan@1
|
1739 end
|
jcallahan@1
|
1740 local spell_label = private.SPELL_LABELS_BY_NAME[spell_name]
|
jcallahan@1
|
1741
|
jcallahan@1
|
1742 if not spell_label then
|
jcallahan@1
|
1743 return
|
jcallahan@1
|
1744 end
|
jcallahan@122
|
1745 table.wipe(current_action)
|
jcallahan@1
|
1746
|
jcallahan@1
|
1747 local tt_item_name, tt_item_link = _G.GameTooltip:GetItem()
|
jcallahan@1
|
1748 local tt_unit_name, tt_unit_id = _G.GameTooltip:GetUnit()
|
jcallahan@1
|
1749
|
jcallahan@1
|
1750 if not tt_unit_name and _G.UnitName("target") == target_name then
|
jcallahan@1
|
1751 tt_unit_name = target_name
|
jcallahan@1
|
1752 tt_unit_id = "target"
|
jcallahan@1
|
1753 end
|
jcallahan@1
|
1754 local spell_flags = private.SPELL_FLAGS_BY_LABEL[spell_label]
|
jcallahan@28
|
1755 local zone_name, area_id, x, y, map_level, instance_token = CurrentLocationData()
|
jcallahan@28
|
1756
|
jcallahan@122
|
1757 current_action.instance_token = instance_token
|
jcallahan@122
|
1758 current_action.map_level = map_level
|
jcallahan@122
|
1759 current_action.x = x
|
jcallahan@122
|
1760 current_action.y = y
|
jcallahan@122
|
1761 current_action.zone_data = ("%s:%d"):format(zone_name, area_id)
|
jcallahan@122
|
1762 current_action.spell_label = spell_label
|
jcallahan@105
|
1763
|
jcallahan@105
|
1764 if not private.NON_LOOT_SPELL_LABELS[spell_label] then
|
jcallahan@122
|
1765 current_action.loot_label = spell_label:lower()
|
jcallahan@105
|
1766 end
|
jcallahan@1
|
1767
|
jcallahan@16
|
1768 if tt_unit_name and not tt_item_name then
|
jcallahan@16
|
1769 if bit.band(spell_flags, AF.NPC) == AF.NPC then
|
jcallahan@16
|
1770 if not tt_unit_id or tt_unit_name ~= target_name then
|
jcallahan@16
|
1771 return
|
jcallahan@16
|
1772 end
|
jcallahan@123
|
1773 current_action.target_type = AF.NPC
|
jcallahan@16
|
1774 end
|
jcallahan@16
|
1775 elseif bit.band(spell_flags, AF.ITEM) == AF.ITEM then
|
jcallahan@123
|
1776 current_action.target_type = AF.ITEM
|
jcallahan@16
|
1777
|
jcallahan@16
|
1778 if tt_item_name and tt_item_name == target_name then
|
jcallahan@122
|
1779 current_action.identifier = ItemLinkToID(tt_item_link)
|
jcallahan@16
|
1780 elseif target_name and target_name ~= "" then
|
jcallahan@16
|
1781 local _, target_item_link = _G.GetItemInfo(target_name)
|
jcallahan@122
|
1782 current_action.identifier = ItemLinkToID(target_item_link)
|
jcallahan@16
|
1783 end
|
jcallahan@16
|
1784 elseif not tt_item_name and not tt_unit_name then
|
jcallahan@1
|
1785 if bit.band(spell_flags, AF.OBJECT) == AF.OBJECT then
|
jcallahan@17
|
1786 if target_name == "" then
|
jcallahan@17
|
1787 return
|
jcallahan@17
|
1788 end
|
jcallahan@122
|
1789 current_action.object_name = target_name
|
jcallahan@123
|
1790 current_action.target_type = AF.OBJECT
|
jcallahan@1
|
1791 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then
|
jcallahan@123
|
1792 current_action.target_type = AF.ZONE
|
jcallahan@1
|
1793 end
|
jcallahan@1
|
1794 end
|
jcallahan@1
|
1795 private.tracked_line = spell_line
|
jcallahan@0
|
1796 end
|
jcallahan@0
|
1797
|
jcallahan@94
|
1798
|
jcallahan@1
|
1799 function WDP:UNIT_SPELLCAST_SUCCEEDED(event_name, unit_id, spell_name, spell_rank, spell_line, spell_id)
|
jcallahan@1
|
1800 if unit_id ~= "player" then
|
jcallahan@1
|
1801 return
|
jcallahan@1
|
1802 end
|
jcallahan@1
|
1803 private.tracked_line = nil
|
jcallahan@85
|
1804
|
jcallahan@86
|
1805 if spell_name:match("^Harvest.+") then
|
jcallahan@86
|
1806 reputation_npc_id = current_target_id
|
jcallahan@98
|
1807 private.harvesting = true
|
jcallahan@85
|
1808 end
|
jcallahan@92
|
1809
|
jcallahan@92
|
1810 if anvil_spell_ids[spell_id] then
|
jcallahan@92
|
1811 UpdateDBEntryLocation("objects", OBJECT_ID_ANVIL)
|
jcallahan@92
|
1812 elseif forge_spell_ids[spell_id] then
|
jcallahan@92
|
1813 UpdateDBEntryLocation("objects", OBJECT_ID_FORGE)
|
jcallahan@92
|
1814 end
|
jcallahan@0
|
1815 end
|
jcallahan@0
|
1816
|
jcallahan@90
|
1817
|
jcallahan@1
|
1818 function WDP:HandleSpellFailure(event_name, unit_id, spell_name, spell_rank, spell_line, spell_id)
|
jcallahan@1
|
1819 if unit_id ~= "player" then
|
jcallahan@1
|
1820 return
|
jcallahan@1
|
1821 end
|
jcallahan@0
|
1822
|
jcallahan@1
|
1823 if private.tracked_line == spell_line then
|
jcallahan@1
|
1824 private.tracked_line = nil
|
jcallahan@122
|
1825 table.wipe(current_action)
|
jcallahan@1
|
1826 end
|
jcallahan@0
|
1827 end
|
jcallahan@90
|
1828
|
jcallahan@90
|
1829
|
jcallahan@90
|
1830 do
|
jcallahan@90
|
1831 local function SetUnitField(field, required_type)
|
jcallahan@90
|
1832 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("npc"))
|
jcallahan@90
|
1833
|
jcallahan@90
|
1834 if not unit_idnum or (required_type and unit_type ~= required_type) then
|
jcallahan@90
|
1835 return
|
jcallahan@90
|
1836 end
|
jcallahan@90
|
1837
|
jcallahan@90
|
1838 if unit_type == private.UNIT_TYPES.NPC then
|
jcallahan@90
|
1839 NPCEntry(unit_idnum)[field] = true
|
jcallahan@90
|
1840 elseif unit_type == private.UNIT_TYPES.OBJECT then
|
jcallahan@90
|
1841 DBEntry("objects", unit_idnum)[field] = true
|
jcallahan@93
|
1842 UpdateDBEntryLocation("objects", unit_idnum)
|
jcallahan@90
|
1843 end
|
jcallahan@90
|
1844 end
|
jcallahan@90
|
1845
|
jcallahan@90
|
1846
|
jcallahan@90
|
1847 function WDP:AUCTION_HOUSE_SHOW(event_name)
|
jcallahan@90
|
1848 SetUnitField("auctioneer", private.UNIT_TYPES.NPC)
|
jcallahan@90
|
1849 end
|
jcallahan@90
|
1850
|
jcallahan@90
|
1851
|
jcallahan@90
|
1852 function WDP:BANKFRAME_OPENED(event_name)
|
jcallahan@90
|
1853 SetUnitField("banker", private.UNIT_TYPES.NPC)
|
jcallahan@90
|
1854 end
|
jcallahan@90
|
1855
|
jcallahan@90
|
1856
|
jcallahan@90
|
1857 function WDP:BATTLEFIELDS_SHOW(event_name)
|
jcallahan@90
|
1858 SetUnitField("battlemaster", private.UNIT_TYPES.NPC)
|
jcallahan@90
|
1859 end
|
jcallahan@90
|
1860
|
jcallahan@90
|
1861
|
jcallahan@92
|
1862 function WDP:FORGE_MASTER_OPENED(event_name)
|
jcallahan@90
|
1863 SetUnitField("arcane_reforger", private.UNIT_TYPES.NPC)
|
jcallahan@90
|
1864 end
|
jcallahan@90
|
1865
|
jcallahan@90
|
1866
|
jcallahan@92
|
1867 function WDP:GOSSIP_SHOW(event_name)
|
jcallahan@90
|
1868 local gossip_options = { _G.GetGossipOptions() }
|
jcallahan@90
|
1869
|
jcallahan@90
|
1870 for index = 2, #gossip_options, 2 do
|
jcallahan@90
|
1871 if gossip_options[index] == "binder" then
|
jcallahan@90
|
1872 SetUnitField("innkeeper", private.UNIT_TYPES.NPC)
|
jcallahan@90
|
1873 return
|
jcallahan@90
|
1874 end
|
jcallahan@90
|
1875 end
|
jcallahan@90
|
1876 end
|
jcallahan@90
|
1877
|
jcallahan@90
|
1878
|
jcallahan@93
|
1879 function WDP:GUILDBANKFRAME_OPENED(event_name)
|
jcallahan@93
|
1880 SetUnitField("guild_bank", private.UNIT_TYPES.OBJECT)
|
jcallahan@93
|
1881 end
|
jcallahan@93
|
1882
|
jcallahan@93
|
1883
|
jcallahan@90
|
1884 function WDP:TAXIMAP_OPENED(event_name)
|
jcallahan@90
|
1885 SetUnitField("flight_master", private.UNIT_TYPES.NPC)
|
jcallahan@90
|
1886 end
|
jcallahan@90
|
1887
|
jcallahan@90
|
1888
|
jcallahan@90
|
1889 function WDP:TRANSMOGRIFY_OPEN(event_name)
|
jcallahan@90
|
1890 SetUnitField("transmogrifier", private.UNIT_TYPES.NPC)
|
jcallahan@90
|
1891 end
|
jcallahan@90
|
1892
|
jcallahan@90
|
1893
|
jcallahan@90
|
1894 function WDP:VOID_STORAGE_OPEN(event_name)
|
jcallahan@90
|
1895 SetUnitField("void_storage", private.UNIT_TYPES.NPC)
|
jcallahan@90
|
1896 end
|
jcallahan@90
|
1897 end -- do-block
|