View Single Post
09-25-12, 06:42 AM   #1
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Pet Battle Fight Announcer

By looking at PetBattleQuality I had the idea to do sth like the Street Fighter "FIGHT" thing.

Concept:


When a pet battle starts you can extract the pet names + quality.

You could display that data on screen.

Lua Code:
  1. local pet_quality = {
  2.       [1] = "|cff999999", --gray, poor
  3.       [2] = "|cffffffff", --white, common
  4.       [3] = "|cff009900", --green, uncommon
  5.       [4] = "|cff0099ff", --blue, rare
  6.       [5] = "|cffcc33cc", --purple, epic
  7.       [6] = "|cffff6600", --orange, legendary
  8.     }
  9.      
  10.     local function getPetString(ownerId)
  11.       local string
  12.       for i = 1, C_PetBattles.GetNumPets(ownerId) do
  13.         local pet, quality
  14.         pet = C_PetBattles.GetName(ownerId, i)
  15.         quality = pet_quality[C_PetBattles.GetBreedQuality(ownerId, i)]
  16.         if i > 1 then
  17.           string = string.." + "
  18.         end
  19.         if pet and quality then
  20.           string = string..quality..pet.."|r"
  21.         else
  22.           string = string.."ErrorFindingPet"
  23.         end
  24.       end
  25.       return string
  26.     end
  27.      
  28.     local function init()
  29.       local playerPetString = getPetString(1)
  30.       local enemyPetString = getPetString(2)
  31.       print("READY, SET, FIGHT!!!")
  32.       print(playerPetString.." VS. "..enemyPetString)
  33.     end
  34.      
  35.     local frame = CreateFrame("Frame")
  36.     frame:Hide()
  37.     frame:SetScript("OnEvent", init)
  38.     frame:RegisterEvent("PET_BATTLE_OPENING_START")

Maybe we can even extract the pet ID and use it to display a number of portraits + school of magic.
Pet quality is already in.

Ok there is sth like:
Lua Code:
  1. local speciesID, customName, level, xp, maxXp, displayID, name, icon, petType, creatureID, sourceText, description, isWild, canBattle, tradable = C_PetJournal.GetPetInfoByPetID(petID)

Plus there is GetDisplayID(). Not tested but this may return the DisplayID() that could be used in a 3D portrait. Which would be good since that is enough to display: portrait, name, quality.
Lua Code:
  1. C_PetBattles.GetDisplayID(ownerId, i) -- This function is not yet documented
  2. C_PetBattles.GetHealth(ownerId, i) -- This function is not yet documented
  3. C_PetBattles.GetIcon(ownerId, i)     -- This function is not yet documented
  4. C_PetBattles.GetLevel(ownerId, i) -- This function is not yet documented
http://wowprogramming.com/docs/api

I'm thinking of sth like this:
http://images-mediawiki-sites.theful...2942977455.gif

Under the portrait would be the petname in petquality.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 09-25-12 at 07:47 AM.
  Reply With Quote