comparison Main.lua @ 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 5f43b650e341
children f45ff137cf8f
comparison
equal deleted inserted replaced
138:87177ba1f6f7 139:aa48190cb5eb
1430 for index, pet_id in LPJ:IteratePetIDs() do 1430 for index, pet_id in LPJ:IteratePetIDs() do
1431 local _, _, is_owned, _, level, _, _, name, icon, pet_type, npc_id, _, _, is_wild = _G.C_PetJournal.GetPetInfoByIndex(index) 1431 local _, _, is_owned, _, level, _, _, name, icon, pet_type, npc_id, _, _, is_wild = _G.C_PetJournal.GetPetInfoByIndex(index)
1432 1432
1433 if is_owned then 1433 if is_owned then
1434 local health, max_health, attack, speed, rarity = _G.C_PetJournal.GetPetStats(pet_id) 1434 local health, max_health, attack, speed, rarity = _G.C_PetJournal.GetPetStats(pet_id)
1435 local rarity_name = _G["ITEM_QUALITY" .. rarity - 1 .. "_DESC"] 1435
1436 local npc = NPCEntry(npc_id) 1436 if rarity then
1437 npc.wild_pet = is_wild or nil 1437 local rarity_name = _G["BATTLE_PET_BREED_QUALITY" .. rarity]
1438 npc.battle_pet_data = npc.battle_pet_data or {} 1438 local npc = NPCEntry(npc_id)
1439 npc.battle_pet_data[rarity_name] = npc.battle_pet_data[rarity_name] or {} 1439 npc.wild_pet = is_wild or nil
1440 npc.battle_pet_data[rarity_name]["level_" .. level] = npc.battle_pet_data[rarity_name]["level_" .. level] or {} 1440 npc.battle_pet_data = npc.battle_pet_data or {}
1441 1441 npc.battle_pet_data[rarity_name] = npc.battle_pet_data[rarity_name] or {}
1442 local data = npc.battle_pet_data[rarity_name]["level_" .. level] 1442 npc.battle_pet_data[rarity_name]["level_" .. level] = npc.battle_pet_data[rarity_name]["level_" .. level] or {}
1443 data.max_health = max_health 1443
1444 data.attack = attack 1444 local data = npc.battle_pet_data[rarity_name]["level_" .. level]
1445 data.speed = speed 1445 data.max_health = max_health
1446 data.attack = attack
1447 data.speed = speed
1448 end
1446 end 1449 end
1447 end 1450 end
1448 end 1451 end
1449 1452
1450 1453