Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Add pet slots to character profile lookup.

  • Loading branch information...
roncli committed Apr 15, 2014
1 parent c133e3a commit 3e4d89b4be414dfc45c1e56581bc4b2aaa0233d9
@@ -38,6 +38,7 @@ Namespace roncliProductions.LibWowAPI.Character.Schema
<DataMember()> Public Property quests As Integer()
<DataMember()> Public Property feed As feed()
<DataMember()> Public Property pets As pets
<DataMember()> Public Property petSlots As petSlot()

End Class

@@ -0,0 +1,20 @@
' LibWowAPI
' by Ronald M. Clifford (roncli@roncli.com)
'
' This source code is released under the GNU Lesser General Public License (LGPL) Version 3.0.

Imports System.Runtime.Serialization

Namespace roncliProductions.LibWowAPI.Character.Schema

<DataContract()> Friend Class petSlot

<DataMember()> Public Property slot As Integer
<DataMember()> Public Property battlePetGuid As String
<DataMember()> Public Property isEmpty As Boolean
<DataMember()> Public Property isLocked As Boolean
<DataMember()> Public Property abilities As Integer()

End Class

End Namespace
@@ -271,7 +271,20 @@ Namespace roncliProductions.LibWowAPI.Character
''' <remarks>If the <see cref="CharacterProfileOptions.Pets" /> property of the <see cref="CharacterProfile.Options" /> property is set to true, a <see cref="Pets" /> object will be available, containing the character's pets.</remarks>
Public Property Pets As Pets

Friend Sub New(dtLastModified As Date, strName As String, strRealm As String, strBattlegroup As String, cClass As [Class], rRace As Race, gGender As Gender, intLevel As Integer, intAchievementPoints As Integer, strThumbnail As String, strCalcClass As String, intTotalHonorableKills As Integer, gbiGuild As GuildBasicInfo, iItems As Items, sStats As Stats, pProfessions As Professions, rReputation As Collection(Of Reputation), tTitles As Collection(Of Title), aAchievements As Achievements, pHunterPets As Collection(Of HunterPet), tTalents As Collection(Of TalentSpec), aAppearance As Appearance, mMounts As Mounts, pProgression As Progression, pPvP As PvP, intQuests As Collection(Of Integer), fiFeed As Collection(Of FeedItem), pPets As Pets)
Private colPetSlots As Collection(Of PetSlot)
''' <summary>
''' The character's pet slots.
''' </summary>
''' <value>This property gets the PetSlots field.</value>
''' <returns>Returns the character's pet slots.</returns>
''' <remarks>This is a <see cref="Collection(Of PetSlot)" /> of <see cref="PetSlot" /> that represents the character's pet slots.</remarks>
Public ReadOnly Property PetSlots As Collection(Of PetSlot)
Get
Return colPetSlots
End Get
End Property

Friend Sub New(dtLastModified As Date, strName As String, strRealm As String, strBattlegroup As String, cClass As [Class], rRace As Race, gGender As Gender, intLevel As Integer, intAchievementPoints As Integer, strThumbnail As String, strCalcClass As String, intTotalHonorableKills As Integer, gbiGuild As GuildBasicInfo, iItems As Items, sStats As Stats, pProfessions As Professions, rReputation As Collection(Of Reputation), tTitles As Collection(Of Title), aAchievements As Achievements, pHunterPets As Collection(Of HunterPet), tTalents As Collection(Of TalentSpec), aAppearance As Appearance, mMounts As Mounts, pProgression As Progression, pPvP As PvP, intQuests As Collection(Of Integer), fiFeed As Collection(Of FeedItem), pPets As Pets, psPetSlots As Collection(Of PetSlot))
LastModified = dtLastModified
Name = strName
Realm = strRealm
@@ -300,6 +313,7 @@ Namespace roncliProductions.LibWowAPI.Character
colQuests = intQuests
colFeed = fiFeed
Pets = pPets
colPetSlots = psPetSlots
End Sub

End Class
@@ -1137,6 +1137,19 @@ Namespace roncliProductions.LibWowAPI.Character
)
).ToCollection()
)
),
If(
cpCharacter.petSlots Is Nothing, Nothing, (
From ps In cpCharacter.petSlots
Order By ps.slot
Select New PetSlot(
ps.slot,
ps.battlePetGuid,
ps.isEmpty,
ps.isLocked,
ps.abilities.ToCollection()
)
).ToCollection()
)
)
End Sub
@@ -1191,6 +1204,7 @@ Namespace roncliProductions.LibWowAPI.Character
If Options.Quests Then lstFields.Add("quests")
If Options.Feed Then lstFields.Add("feed")
If Options.Pets Then lstFields.Add("pets")
If Options.PetSlots Then lstFields.Add("petSlots")
Return String.Join(",", lstFields)
End Get
End Property
@@ -0,0 +1,71 @@
' LibWowAPI
' by Ronald M. Clifford (roncli@roncli.com)
'
' This source code is released under the GNU Lesser General Public License (LGPL) Version 3.0.

Imports System.Collections.ObjectModel

Namespace roncliProductions.LibWowAPI.Character

''' <summary>
''' A class containing information about a character's battle pet slot.
''' </summary>
''' <remarks>The data contained within this class contains information about a character's battle pet slot.</remarks>
Public Class PetSlot

''' <summary>
''' The slot the battle pet is in.
''' </summary>
''' <value>This property gets or sets the Slot field.</value>
''' <returns>Returns the slot the battle pet is in.</returns>
''' <remarks>This represents the slot the battle pet is in.</remarks>
Public Property Slot As Integer

''' <summary>
''' The pet's GUID.
''' </summary>
''' <value>This property gets or sets the BattlePetGuid field.</value>
''' <returns>Returns the pet's GUID.</returns>
''' <remarks>This is an internal identifier used by Blizzard to identify a pet.</remarks>
Public Property BattlePetGuid As String

''' <summary>
''' Determines if the slot is empty.
''' </summary>
''' <value>This property gets or sets the IsEmpty field.</value>
''' <returns>Returns whether the slot if empty.</returns>
''' <remarks>This determines if the slot is empty.</remarks>
Public Property IsEmpty As Boolean

''' <summary>
''' Determines if the slot is locked.
''' </summary>
''' <value>This property gets or sets the IsLocked field.</value>
''' <returns>Returns whether the slot if locked.</returns>
''' <remarks>This determines if the slot is locked.</remarks>
Public Property IsLocked As Boolean

Private colAbilities As Collection(Of Integer)
''' <summary>
''' The ability IDs the pet has.
''' </summary>
''' <value>This property gets or sets the Abilities field.</value>
''' <returns>Returns the ability IDs the pet has.</returns>
''' <remarks>This is a <see cref="Collection(Of Integer)" /> of ability IDs the pet has.</remarks>
Public ReadOnly Property Abilites As Collection(Of Integer)
Get
Return colAbilities
End Get
End Property

Friend Sub New(intSlot As Integer, strBattlePetGuid As String, blnIsEmpty As Boolean, blnIsLocked As Boolean, intAbilities As Collection(Of Integer))
Slot = intSlot
BattlePetGuid = strBattlePetGuid
IsEmpty = blnIsEmpty
IsLocked = blnIsLocked
colAbilities = intAbilities
End Sub

End Class

End Namespace
@@ -147,6 +147,7 @@
<Compile Include="Character\clsHunterPet.vb" />
<Compile Include="Character\clsMount.vb" />
<Compile Include="Character\clsMounts.vb" />
<Compile Include="Character\clsPetSlot.vb" />
<Compile Include="Character\clsPets.vb" />
<Compile Include="Character\clsProfession.vb" />
<Compile Include="Character\clsProfessions.vb" />
@@ -165,6 +166,7 @@
<Compile Include="Character\clsTooltipParams.vb" />
<Compile Include="Character\clsUpgrade.vb" />
<Compile Include="Character\Schema\collected.vb" />
<Compile Include="Character\Schema\petSlot.vb" />
<Compile Include="Character\Schema\pets.vb" />
<Compile Include="Character\Schema\achievements.vb" />
<Compile Include="Character\Schema\appearance.vb" />
@@ -1233,6 +1233,7 @@ Namespace roncliProductions.LibWowAPIDemo
Console.WriteLine("14 - Include Quests - {0}", If(cpCharacter.Options.Quests, "Yes", "No"))
Console.WriteLine("15 - Include Feed - {0}", If(cpCharacter.Options.Feed, "Yes", "No"))
Console.WriteLine("16 - Include Pets - {0}", If(cpCharacter.Options.Pets, "Yes", "No"))
Console.WriteLine("17 - Include Pet Slots - {0}", If(cpCharacter.Options.PetSlots, "Yes", "No"))
Console.Write(">")
Dim strResponse = Console.ReadLine
If String.IsNullOrWhiteSpace(strResponse) Then Exit Do
@@ -1271,6 +1272,8 @@ Namespace roncliProductions.LibWowAPIDemo
cpCharacter.Options.Feed = Not cpCharacter.Options.Feed
Case 16
cpCharacter.Options.Pets = Not cpCharacter.Options.Pets
Case 17
cpCharacter.Options.PetSlots = Not cpCharacter.Options.PetSlots
End Select
Console.Clear()
Else
@@ -1580,6 +1583,15 @@ Namespace roncliProductions.LibWowAPIDemo
For Each cPet In cpCharacter.Character.Pets.Collected
Console.WriteLine(" {0} ({1}) - Level {2}", cPet.Name, cPet.CreatureName, cPet.Stats.Level)
Next
Console.WriteLine()
End If

If cpCharacter.Character.PetSlots IsNot Nothing Then
Console.WriteLine("Pet Slots:")
For Each psSlot In cpCharacter.Character.PetSlots
Console.WriteLine(" {0}) {1}", psSlot.Slot, psSlot.BattlePetGuid)
Next
Console.WriteLine()
End If

Console.WriteLine("Press any key to continue.")

0 comments on commit 3e4d89b

Please sign in to comment.
You can’t perform that action at this time.