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