Mercurial > wow > wowdb-profiler
changeset 139:aa48190cb5eb
Handle race-condition case when a player releases a captured pet - also, use the BATTLE_PET_BREED_QUALITY constants instead of the ITEM_QUALITY constant for rarity.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Thu, 27 Sep 2012 04:16:54 -0500 |
parents | 87177ba1f6f7 |
children | f45ff137cf8f |
files | Main.lua |
diffstat | 1 files changed, 13 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/Main.lua Wed Sep 26 13:39:11 2012 -0500 +++ b/Main.lua Thu Sep 27 04:16:54 2012 -0500 @@ -1432,17 +1432,20 @@ if is_owned then local health, max_health, attack, speed, rarity = _G.C_PetJournal.GetPetStats(pet_id) - local rarity_name = _G["ITEM_QUALITY" .. rarity - 1 .. "_DESC"] - local npc = NPCEntry(npc_id) - npc.wild_pet = is_wild or nil - npc.battle_pet_data = npc.battle_pet_data or {} - npc.battle_pet_data[rarity_name] = npc.battle_pet_data[rarity_name] or {} - npc.battle_pet_data[rarity_name]["level_" .. level] = npc.battle_pet_data[rarity_name]["level_" .. level] or {} - local data = npc.battle_pet_data[rarity_name]["level_" .. level] - data.max_health = max_health - data.attack = attack - data.speed = speed + if rarity then + local rarity_name = _G["BATTLE_PET_BREED_QUALITY" .. rarity] + local npc = NPCEntry(npc_id) + npc.wild_pet = is_wild or nil + npc.battle_pet_data = npc.battle_pet_data or {} + npc.battle_pet_data[rarity_name] = npc.battle_pet_data[rarity_name] or {} + npc.battle_pet_data[rarity_name]["level_" .. level] = npc.battle_pet_data[rarity_name]["level_" .. level] or {} + + local data = npc.battle_pet_data[rarity_name]["level_" .. level] + data.max_health = max_health + data.attack = attack + data.speed = speed + end end end end