comparison Main.lua @ 336:cba0e57a71b7 WoD

Many updated WoD constants, added new WoD english locales, and consolidated two similar variables.
author MMOSimca <MMOSimca@gmail.com>
date Fri, 05 Sep 2014 01:20:44 -0400
parents 5bc69e705add
children 48f7f671fc77
comparison
equal deleted inserted replaced
335:2ca6db4e2296 336:cba0e57a71b7
46 local PLAYER_FACTION = _G.UnitFactionGroup("player") 46 local PLAYER_FACTION = _G.UnitFactionGroup("player")
47 local PLAYER_GUID 47 local PLAYER_GUID
48 local PLAYER_NAME = _G.UnitName("player") 48 local PLAYER_NAME = _G.UnitName("player")
49 local PLAYER_RACE = _G.select(2, _G.UnitRace("player")) 49 local PLAYER_RACE = _G.select(2, _G.UnitRace("player"))
50 50
51 local SPELL_ID_CHI_WAVE = 132464 51 local CHI_WAVE_SPELL_ID = 132464
52 local SPELL_ID_DISGUISE = 121308 52 local DISGUISE_SPELL_ID = 121308
53
54 -- Constant for duplicate boss data; a dirty hack to get around world bosses that cannot be identified individually and cannot be linked on wowdb because they are not in a raid
55 local DUPLICATE_WORLD_BOSS_IDS = {
56 [71952] = { 71953, 71954, 71955, },
57 }
53 58
54 local ALLOWED_LOCALES = { 59 local ALLOWED_LOCALES = {
55 enUS = true, 60 enUS = true,
56 enGB = true, 61 enGB = true,
62 enTW = true,
63 enCN = true,
57 } 64 }
58 65
59 local DATABASE_DEFAULTS = { 66 local DATABASE_DEFAULTS = {
60 char = {}, 67 char = {},
61 global = { 68 global = {
291 return math.floor(copper_cost / modifier) 298 return math.floor(copper_cost / modifier)
292 end 299 end
293 end -- do-block 300 end -- do-block
294 301
295 302
296 -- Constant for duplicate boss data; a dirty hack to get around world bosses that cannot be identified individually and cannot be linked on wowdb because they are not in a raid
297 local DUPLICATE_WORLD_BOSS_IDS = {
298 [71952] = { 71953, 71954, 71955, },
299 }
300
301
302 -- Called on a timer 303 -- Called on a timer
303 local function ClearKilledNPC() 304 local function ClearKilledNPC()
304 killed_npc_id = nil 305 killed_npc_id = nil
305 end 306 end
306 307
310 WDP:CancelTimer(killed_boss_id_timer_handle) 311 WDP:CancelTimer(killed_boss_id_timer_handle)
311 killed_boss_id_timer_handle = nil 312 killed_boss_id_timer_handle = nil
312 end 313 end
313 314
314 table.wipe(boss_loot_toasting) 315 table.wipe(boss_loot_toasting)
315 private.raid_finder_boss_id = nil 316 private.raid_boss_id = nil
316 private.world_boss_id = nil
317 end 317 end
318 318
319 319
320 local function ClearLootToastContainerID() 320 local function ClearLootToastContainerID()
321 if loot_toast_container_timer_handle then 321 if loot_toast_container_timer_handle then
589 589
590 for line_index = 1, DatamineTT:NumLines() do 590 for line_index = 1, DatamineTT:NumLines() do
591 local current_line = _G["WDPDatamineTTTextLeft" .. line_index] 591 local current_line = _G["WDPDatamineTTTextLeft" .. line_index]
592 592
593 if not current_line then 593 if not current_line then
594 Debug("HandleItemUse: Item with ID %d and link %s had an invalid tooltip.", item_id, item_link, _G.ITEM_OPENABLE) 594 Debug("HandleItemUse: Item with ID %d and link %s had an invalid tooltip.", item_id, item_link)
595 return 595 return
596 end 596 end
597 597
598 if current_line:GetText() == _G.ITEM_OPENABLE then 598 if current_line:GetText() == _G.ITEM_OPENABLE then
599 table.wipe(current_action) 599 table.wipe(current_action)
973 973
974 for stat, amount in pairs(intermediary) do 974 for stat, amount in pairs(intermediary) do
975 item.upgrades[upgrade_id][stat] = amount 975 item.upgrades[upgrade_id][stat] = amount
976 end 976 end
977 end 977 end
978 end 978 end -- do-block
979
980 -- do-block
981 979
982 980
983 local function RecordItemData(item_id, item_link, durability) 981 local function RecordItemData(item_id, item_link, durability)
984 local _, _, item_string = item_link:find("^|%x+|H(.+)|h%[.+%]") 982 local _, _, item_string = item_link:find("^|%x+|H(.+)|h%[.+%]")
985 local item 983 local item
1241 if not loot_type or (loot_type ~= "item" and loot_type ~= "money" and loot_type ~= "currency") then 1239 if not loot_type or (loot_type ~= "item" and loot_type ~= "money" and loot_type ~= "currency") then
1242 Debug("%s: loot_type is %s. Item link is %s, and quantity is %d.", event_name, loot_type, item_link, quantity) 1240 Debug("%s: loot_type is %s. Item link is %s, and quantity is %d.", event_name, loot_type, item_link, quantity)
1243 return 1241 return
1244 end 1242 end
1245 local container_id = private.loot_toast_container_id 1243 local container_id = private.loot_toast_container_id
1246 local npc_id = private.raid_finder_boss_id or private.world_boss_id 1244 local npc_id = private.raid_boss_id
1247 1245
1248 if npc_id then 1246 if npc_id then
1249 -- slightly messy hack to workaround duplicate world bosses 1247 -- Slightly messy hack to workaround duplicate world bosses
1250 local upper_limit = 0 1248 local upper_limit = 0
1251 if DUPLICATE_WORLD_BOSS_IDS[npc_id] then 1249 if DUPLICATE_WORLD_BOSS_IDS[npc_id] then
1252 upper_limit = #DUPLICATE_WORLD_BOSS_IDS[npc_id] 1250 upper_limit = #DUPLICATE_WORLD_BOSS_IDS[npc_id]
1253 end 1251 end
1254 for i = 0, upper_limit do 1252 for i = 0, upper_limit do
1365 function WDP:CHAT_MSG_LOOT(event_name, message) 1363 function WDP:CHAT_MSG_LOOT(event_name, message)
1366 local category 1364 local category
1367 1365
1368 if current_action.spell_label ~= "EXTRACT_GAS" then 1366 if current_action.spell_label ~= "EXTRACT_GAS" then
1369 category = AF.ZONE 1367 category = AF.ZONE
1370 elseif private.raid_finder_boss_id then 1368 elseif private.raid_boss_id then
1371 category = AF.NPC 1369 category = AF.NPC
1372 end 1370 end
1373 local update_func = CHAT_MSG_LOOT_UPDATE_FUNCS[category] 1371 local update_func = CHAT_MSG_LOOT_UPDATE_FUNCS[category]
1374 1372
1375 if not category or not update_func then 1373 if not category or not update_func then
1474 do 1472 do
1475 local FLAGS_NPC = bit.bor(_G.COMBATLOG_OBJECT_TYPE_GUARDIAN, _G.COMBATLOG_OBJECT_CONTROL_NPC) 1473 local FLAGS_NPC = bit.bor(_G.COMBATLOG_OBJECT_TYPE_GUARDIAN, _G.COMBATLOG_OBJECT_CONTROL_NPC)
1476 local FLAGS_NPC_CONTROL = bit.bor(_G.COMBATLOG_OBJECT_AFFILIATION_OUTSIDER, _G.COMBATLOG_OBJECT_CONTROL_NPC) 1474 local FLAGS_NPC_CONTROL = bit.bor(_G.COMBATLOG_OBJECT_AFFILIATION_OUTSIDER, _G.COMBATLOG_OBJECT_CONTROL_NPC)
1477 1475
1478 local function RecordNPCSpell(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name) 1476 local function RecordNPCSpell(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name)
1479 if not spell_id or spell_id == SPELL_ID_CHI_WAVE or spell_id == SPELL_ID_DISGUISE then 1477 if not spell_id or spell_id == CHI_WAVE_SPELL_ID or spell_id == DISGUISE_SPELL_ID then
1480 return 1478 return
1481 end 1479 end
1482 local source_type, source_id = ParseGUID(source_guid) 1480 local source_type, source_id = ParseGUID(source_guid)
1483 1481
1484 if not source_id or not UnitTypeIsNPC(source_type) then 1482 if not source_id or not UnitTypeIsNPC(source_type) then
2192 end 2190 end
2193 end -- do-block 2191 end -- do-block
2194 2192
2195 2193
2196 function WDP:PET_BAR_UPDATE(event_name) 2194 function WDP:PET_BAR_UPDATE(event_name)
2197 if current_action.spell_label ~= "MIND_CONTROL" then 2195 if not private.NON_LOOT_SPELL_LABELS[current_action.spell_label] then
2198 return 2196 return
2199 end 2197 end
2200 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("pet")) 2198 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("pet"))
2201 2199
2202 if not unit_idnum or not UnitTypeIsNPC(unit_type) then 2200 if not unit_idnum or not UnitTypeIsNPC(unit_type) then
2514 2512
2515 function WDP:SPELL_CONFIRMATION_PROMPT(event_name, spell_id, confirm_type, text, duration, currency_id_cost) 2513 function WDP:SPELL_CONFIRMATION_PROMPT(event_name, spell_id, confirm_type, text, duration, currency_id_cost)
2516 if private.RAID_BOSS_BONUS_SPELL_ID_TO_NPC_ID_MAP[spell_id] then 2514 if private.RAID_BOSS_BONUS_SPELL_ID_TO_NPC_ID_MAP[spell_id] then
2517 ClearKilledBossID() 2515 ClearKilledBossID()
2518 ClearLootToastContainerID() 2516 ClearLootToastContainerID()
2519 private.raid_finder_boss_id = private.RAID_BOSS_BONUS_SPELL_ID_TO_NPC_ID_MAP[spell_id] 2517 private.raid_boss_id = private.RAID_BOSS_BONUS_SPELL_ID_TO_NPC_ID_MAP[spell_id]
2520 elseif private.WORLD_BOSS_BONUS_SPELL_ID_TO_NPC_ID_MAP[spell_id] then
2521 ClearKilledBossID()
2522 ClearLootToastContainerID()
2523 private.world_boss_id = private.WORLD_BOSS_BONUS_SPELL_ID_TO_NPC_ID_MAP[spell_id]
2524 else 2518 else
2525 Debug("%s: Spell ID %d is not a known raid or world boss 'Bonus' spell.", event_name, spell_id) 2519 Debug("%s: Spell ID %d is not a known raid boss 'Bonus' spell.", event_name, spell_id)
2526 return 2520 return
2527 end 2521 end
2528 2522
2529 -- Assign existing loot data to boss if it exists 2523 -- Assign existing loot data to boss if it exists
2530 if loot_toast_data then 2524 if loot_toast_data then
2531 local npc_id = private.raid_finder_boss_id or private.world_boss_id 2525 local npc_id = private.raid_boss_id
2532 2526
2533 -- Slightly messy hack to workaround duplicate world bosses 2527 -- Slightly messy hack to workaround duplicate world bosses
2534 local upper_limit = 0 2528 local upper_limit = 0
2535 if DUPLICATE_WORLD_BOSS_IDS[npc_id] then 2529 if DUPLICATE_WORLD_BOSS_IDS[npc_id] then
2536 upper_limit = #DUPLICATE_WORLD_BOSS_IDS[npc_id] 2530 upper_limit = #DUPLICATE_WORLD_BOSS_IDS[npc_id]