Mercurial > wow > wowdb-profiler
comparison Main.lua @ 115:6daf570bc198 1.0.6
Record Stable Masters as being such. Record BattlePet data based on pet quality and level.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Tue, 11 Sep 2012 15:38:34 -0500 |
parents | be3ec607e964 |
children | bdf1ec712304 |
comparison
equal
deleted
inserted
replaced
114:5048fcaeb963 | 115:6daf570bc198 |
---|---|
20 | 20 |
21 local LibStub = _G.LibStub | 21 local LibStub = _G.LibStub |
22 local WDP = LibStub("AceAddon-3.0"):NewAddon(ADDON_NAME, "AceEvent-3.0", "AceTimer-3.0") | 22 local WDP = LibStub("AceAddon-3.0"):NewAddon(ADDON_NAME, "AceEvent-3.0", "AceTimer-3.0") |
23 | 23 |
24 local deformat = LibStub("LibDeformat-3.0") | 24 local deformat = LibStub("LibDeformat-3.0") |
25 local LPJ = LibStub("LibPetJournal-2.0") | |
25 | 26 |
26 local DatamineTT = _G.CreateFrame("GameTooltip", "WDPDatamineTT", _G.UIParent, "GameTooltipTemplate") | 27 local DatamineTT = _G.CreateFrame("GameTooltip", "WDPDatamineTT", _G.UIParent, "GameTooltipTemplate") |
27 DatamineTT:SetOwner(_G.WorldFrame, "ANCHOR_NONE") | 28 DatamineTT:SetOwner(_G.WorldFrame, "ANCHOR_NONE") |
28 | 29 |
29 | 30 |
63 LOOT_OPENED = true, | 64 LOOT_OPENED = true, |
64 MAIL_SHOW = true, | 65 MAIL_SHOW = true, |
65 MERCHANT_SHOW = "UpdateMerchantItems", | 66 MERCHANT_SHOW = "UpdateMerchantItems", |
66 MERCHANT_UPDATE = "UpdateMerchantItems", | 67 MERCHANT_UPDATE = "UpdateMerchantItems", |
67 PET_BAR_UPDATE = true, | 68 PET_BAR_UPDATE = true, |
69 PET_JOURNAL_LIST_UPDATE = true, | |
68 PLAYER_TARGET_CHANGED = true, | 70 PLAYER_TARGET_CHANGED = true, |
69 QUEST_COMPLETE = true, | 71 QUEST_COMPLETE = true, |
70 QUEST_DETAIL = true, | 72 QUEST_DETAIL = true, |
71 QUEST_LOG_UPDATE = true, | 73 QUEST_LOG_UPDATE = true, |
72 QUEST_PROGRESS = true, | 74 QUEST_PROGRESS = true, |
729 encounter_data.spells = encounter_data.spells or {} | 731 encounter_data.spells = encounter_data.spells or {} |
730 encounter_data.spells[spell_id] = (encounter_data.spells[spell_id] or 0) + 1 | 732 encounter_data.spells[spell_id] = (encounter_data.spells[spell_id] or 0) + 1 |
731 end | 733 end |
732 end | 734 end |
733 | 735 |
736 local HEAL_BATTLE_PETS_SPELL_ID = 125801 | |
737 | |
734 local COMBAT_LOG_FUNCS = { | 738 local COMBAT_LOG_FUNCS = { |
735 SPELL_AURA_APPLIED = RecordNPCSpell, | 739 SPELL_AURA_APPLIED = RecordNPCSpell, |
736 SPELL_CAST_START = RecordNPCSpell, | 740 SPELL_CAST_START = RecordNPCSpell, |
737 SPELL_CAST_SUCCESS = RecordNPCSpell, | 741 SPELL_CAST_SUCCESS = function(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name) |
742 if spell_id == HEAL_BATTLE_PETS_SPELL_ID then | |
743 local unit_type, unit_idnum = ParseGUID(source_guid) | |
744 | |
745 if unit_type == private.UNIT_TYPES.NPC and unit_idnum then | |
746 NPCEntry(unit_idnum).stable_master = true | |
747 end | |
748 end | |
749 RecordNPCSpell(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name) | |
750 end, | |
738 UNIT_DIED = function(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name) | 751 UNIT_DIED = function(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name) |
739 local unit_type, unit_idnum = ParseGUID(dest_guid) | 752 local unit_type, unit_idnum = ParseGUID(dest_guid) |
740 | 753 |
741 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then | 754 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then |
742 reputation_npc_id = nil | 755 reputation_npc_id = nil |
1224 NPCEntry(unit_idnum).mind_control = true | 1237 NPCEntry(unit_idnum).mind_control = true |
1225 table.wipe(action_data) | 1238 table.wipe(action_data) |
1226 end | 1239 end |
1227 | 1240 |
1228 | 1241 |
1242 function WDP:PET_JOURNAL_LIST_UPDATE(event_name) | |
1243 local num_pets = LPJ:NumPets() | |
1244 | |
1245 LPJ:ClearFilters() | |
1246 for index, pet_id in LPJ:IteratePetIDs() do | |
1247 local _, _, is_owned, _, level, _, _, name, icon, pet_type, npc_id, _, _, is_wild = _G.C_PetJournal.GetPetInfoByIndex(index) | |
1248 | |
1249 if is_owned then | |
1250 local health, max_health, attack, speed, rarity = _G.C_PetJournal.GetPetStats(pet_id) | |
1251 local rarity_name = _G["ITEM_QUALITY" .. rarity - 1 .. "_DESC"] | |
1252 local npc = NPCEntry(npc_id) | |
1253 npc.wild_pet = is_wild or nil | |
1254 npc.battle_pet_data = npc.battle_pet_data or {} | |
1255 npc.battle_pet_data[rarity_name] = npc.battle_pet_data[rarity_name] or {} | |
1256 npc.battle_pet_data[rarity_name]["level_" .. level] = npc.battle_pet_data[rarity_name]["level_" .. level] or {} | |
1257 | |
1258 local data = npc.battle_pet_data[rarity_name]["level_" .. level] | |
1259 data.max_health = max_health | |
1260 data.attack = attack | |
1261 data.speed = speed | |
1262 end | |
1263 end | |
1264 LPJ:RestoreFilters() | |
1265 end | |
1266 | |
1267 | |
1229 do | 1268 do |
1230 local GENDER_NAMES = { | 1269 local GENDER_NAMES = { |
1231 "UNKNOWN", | 1270 "UNKNOWN", |
1232 "MALE", | 1271 "MALE", |
1233 "FEMALE", | 1272 "FEMALE", |
1273 npc.faction = UnitFactionStanding("target") | 1312 npc.faction = UnitFactionStanding("target") |
1274 npc.genders = npc.genders or {} | 1313 npc.genders = npc.genders or {} |
1275 npc.genders[GENDER_NAMES[_G.UnitSex("target")] or "UNDEFINED"] = true | 1314 npc.genders[GENDER_NAMES[_G.UnitSex("target")] or "UNDEFINED"] = true |
1276 npc.is_pvp = _G.UnitIsPVP("target") and true or nil | 1315 npc.is_pvp = _G.UnitIsPVP("target") and true or nil |
1277 npc.reaction = ("%s:%s:%s"):format(_G.UnitLevel("player"), _G.UnitFactionGroup("player"), REACTION_NAMES[_G.UnitReaction("player", "target")]) | 1316 npc.reaction = ("%s:%s:%s"):format(_G.UnitLevel("player"), _G.UnitFactionGroup("player"), REACTION_NAMES[_G.UnitReaction("player", "target")]) |
1278 npc.wild_pet = (_G.UnitCreatureType("target") == "Wild Pet") and true or nil | |
1279 | 1317 |
1280 local encounter_data = npc.encounter_data[InstanceDifficultyToken()].stats | 1318 local encounter_data = npc.encounter_data[InstanceDifficultyToken()].stats |
1281 local npc_level = ("level_%d"):format(_G.UnitLevel("target")) | 1319 local npc_level = ("level_%d"):format(_G.UnitLevel("target")) |
1282 | 1320 |
1283 if not encounter_data[npc_level] then | 1321 if not encounter_data[npc_level] then |