More work on pet spells, typo fix

This commit is contained in:
tomrus88 2008-11-05 21:47:56 +03:00
parent 7adf2001f3
commit d48844a699
9 changed files with 146 additions and 123 deletions

View file

@ -2341,7 +2341,6 @@ void Player::SendInitialSpells()
continue;
data << uint16(itr->first);
//data << uint16(itr->second->slotId);
data << uint16(0); // it's not slot id
spellCount +=1;
@ -2368,13 +2367,13 @@ void Player::SendInitialSpells()
data << uint16(sEntry->Category); // spell category
if(sEntry->Category) // may be wrong, but anyway better than nothing...
{
data << uint32(0);
data << uint32(cooldown);
data << uint32(0); // cooldown
data << uint32(cooldown); // category cooldown
}
else
{
data << uint32(cooldown);
data << uint32(0);
data << uint32(cooldown); // cooldown
data << uint32(0); // category cooldown
}
}
@ -16002,68 +16001,67 @@ void Player::PetSpellInitialize()
{
Pet* pet = GetPet();
if(pet)
if(!pet)
return;
sLog.outDebug("Pet Spells Groups");
CharmInfo *charmInfo = pet->GetCharmInfo();
WorldPacket data(SMSG_PET_SPELLS, 8+4+4+4+10*4);
data << uint64(pet->GetGUID());
data << uint32(pet->GetCreatureInfo()->family); // creature family (required for pet talents)
data << uint32(0);
data << uint8(charmInfo->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0);
// action bar loop
for(uint32 i = 0; i < 10; i++)
{
uint8 addlist = 0;
sLog.outDebug("Pet Spells Groups");
CreatureInfo const *cinfo = pet->GetCreatureInfo();
if(pet->isControlled() && (pet->getPetType() == HUNTER_PET || cinfo && cinfo->type == CREATURE_TYPE_DEMON && getClass() == CLASS_WARLOCK))
{
for(PetSpellMap::iterator itr = pet->m_spells.begin();itr != pet->m_spells.end();itr++)
{
if(itr->second->state == PETSPELL_REMOVED)
continue;
++addlist;
}
}
// first line + actionbar + spellcount + spells + last adds
WorldPacket data(SMSG_PET_SPELLS, 16+40+1+4*addlist+25);
CharmInfo *charmInfo = pet->GetCharmInfo();
//16
data << uint64(pet->GetGUID());
data << uint32(pet->GetCreatureInfo()->family); // creature family (required for pet talents)
data << uint8(charmInfo->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0);
data << uint32(0);
for(uint32 i = 0; i < 10; i++) //40
{
data << uint16(charmInfo->GetActionBarEntry(i)->SpellOrAction) << uint16(charmInfo->GetActionBarEntry(i)->Type);
}
data << uint8(addlist); //1
if(addlist && pet->isControlled())
{
for (PetSpellMap::iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr)
{
if(itr->second->state == PETSPELL_REMOVED)
continue;
data << uint16(itr->first);
data << uint16(itr->second->active); // pet spell active state isn't boolean
}
}
//data << uint8(0x01) << uint32(0x6010) << uint32(0x01) << uint32(0x05) << uint16(0x00); //15
uint8 count = 3; //1+8+8+8=25
// if count = 0, then end of packet...
data << count;
// uint32 value is spell id...
// uint64 value is constant 0, unknown...
data << uint32(0x6010) << uint64(0); // if count = 1, 2 or 3
//data << uint32(0x5fd1) << uint64(0); // if count = 2
data << uint32(0x8e8c) << uint64(0); // if count = 3
data << uint32(0x8e8b) << uint64(0); // if count = 3
GetSession()->SendPacket(&data);
data << uint32(charmInfo->GetActionBarEntry(i)->Raw);
}
size_t spellsCountPos = data.wpos();
// spells count
uint8 addlist = 0;
data << uint8(addlist); // placeholder
if(pet->isControlled() && ((pet->getPetType() == HUNTER_PET) || ((pet->GetCreatureInfo()->type == CREATURE_TYPE_DEMON) && (getClass() == CLASS_WARLOCK))))
{
// spells loop
for (PetSpellMap::iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr)
{
if(itr->second->state == PETSPELL_REMOVED)
continue;
data << uint16(itr->first);
data << uint16(itr->second->active); // pet spell active state isn't boolean
++addlist;
}
}
data.put<uint8>(spellsCountPos, addlist);
uint8 cooldownsCount = pet->m_CreatureSpellCooldowns.size() + pet->m_CreatureCategoryCooldowns.size();
data << uint8(cooldownsCount);
for(CreatureSpellCooldowns::const_iterator itr = pet->m_CreatureSpellCooldowns.begin(); itr != pet->m_CreatureSpellCooldowns.end(); ++itr)
{
data << uint16(itr->first); // spellid
data << uint16(0); // unk
data << uint32(itr->second); // cooldown
data << uint32(0); // category cooldown
}
for(CreatureSpellCooldowns::const_iterator itr = pet->m_CreatureCategoryCooldowns.begin(); itr != pet->m_CreatureCategoryCooldowns.end(); ++itr)
{
data << uint16(itr->first); // spellid
data << uint16(0); // unk
data << uint32(0); // cooldown
data << uint32(itr->second); // category cooldown
}
GetSession()->SendPacket(&data);
}
void Player::PossessSpellInitialize()
@ -16087,8 +16085,8 @@ void Player::PossessSpellInitialize()
//16
data << uint64(charm->GetGUID());
data << uint32(0x00000000);
data << uint8(0) << uint8(0) << uint16(0);
data << uint32(0);
data << uint8(0) << uint8(0) << uint16(0);
for(uint32 i = 0; i < 10; i++) //40
{
@ -16097,11 +16095,8 @@ void Player::PossessSpellInitialize()
data << uint8(addlist); //1
uint8 count = 3;
data << count;
data << uint32(0x6010) << uint64(0); // if count = 1, 2 or 3
data << uint32(0x8e8c) << uint64(0); // if count = 3
data << uint32(0x8e8b) << uint64(0); // if count = 3
uint8 count = 0;
data << uint8(count); // cooldowns count
GetSession()->SendPacket(&data);
}
@ -16138,15 +16133,14 @@ void Player::CharmSpellInitialize()
WorldPacket data(SMSG_PET_SPELLS, 16+40+1+4*addlist+25);// first line + actionbar + spellcount + spells + last adds
data << (uint64)charm->GetGUID() << uint32(0x00000000);
data << uint64(charm->GetGUID());
data << uint32(0x00000000);
data << uint32(0);
if(charm->GetTypeId() != TYPEID_PLAYER)
data << uint8(charmInfo->GetReactState()) << uint8(charmInfo->GetCommandState());
else
data << uint8(0) << uint8(0);
data << uint16(0);
data << uint32(0);
for(uint32 i = 0; i < 10; i++) //40
{
@ -16168,11 +16162,8 @@ void Player::CharmSpellInitialize()
}
}
uint8 count = 3;
data << count;
data << uint32(0x6010) << uint64(0); // if count = 1, 2 or 3
data << uint32(0x8e8c) << uint64(0); // if count = 3
data << uint32(0x8e8b) << uint64(0); // if count = 3
uint8 count = 0;
data << uint8(count); // cooldowns count
GetSession()->SendPacket(&data);
}